FairShip
Loading...
Searching...
No Matches
ShipMCTrack Class Reference

#include <ShipMCTrack.h>

Inheritance diagram for ShipMCTrack:
[legend]
Collaboration diagram for ShipMCTrack:
[legend]

Public Types

enum  SplitRole : Int_t { kNotSplit = 0 , kSplitSurvivor = 1 , kSplitDecay = 2 }

Public Member Functions

 ShipMCTrack ()
 ShipMCTrack (Int_t pdgCode, Int_t motherID, Double_t px, Double_t py, Double_t pz, Double_t E, Double_t x, Double_t y, Double_t z, Double_t t, Int_t nPoints, Int_t eventID, Int_t trackID, Double_t w)
 ShipMCTrack (const ShipMCTrack &track)
 ShipMCTrack (TParticle *particle)
 ~ShipMCTrack () override
void Print (Int_t iTrack=0) const
Int_t GetPdgCode () const
Int_t GetMotherId () const
Double_t GetPx () const
Double_t GetPy () const
Double_t GetPz () const
Double_t GetStartX () const
Double_t GetStartY () const
Double_t GetStartZ () const
Double_t GetStartT () const
Int_t GetEventID () const
void SetProcID (Int_t i)
Int_t GetProcID () const
TString GetProcName () const
Double_t GetMass () const
Double_t GetEnergy () const
Double_t GetPt () const
Double_t GetP () const
Double_t GetRapidity () const
void MultiplyWeight (Double_t w)
void SetWeight (Double_t w)
Double_t GetWeight () const
void GetMomentum (TVector3 &momentum)
void Get4Momentum (TLorentzVector &momentum)
void GetStartVertex (TVector3 &vertex)
Int_t GetSplitSet () const
Int_t GetSplitRole () const
Double_t GetSplitWeight () const
Bool_t IsSplitDecay () const
Bool_t IsSplitSurvivor () const
void SetMotherId (Int_t id)
void SetStartT (Double_t t)
void SetEventID (const Int_t &eventID)
void SetTrackID (const Int_t &trackID)
void SetSplitSet (Int_t splitSet, Int_t role, Double_t splitWeight)

Private Member Functions

 ClassDefOverride (ShipMCTrack, 10)

Private Attributes

Int_t fPdgCode
Int_t fMotherId
Double32_t fPx
Double32_t fPy
Double32_t fPz
Double32_t fM
Double32_t fStartX
Double32_t fStartY
Double32_t fStartZ
Double32_t fStartT
Double32_t fW
Int_t fProcID
Int_t fNPoints
Int_t fEventID
Int_t fTrackID
Int_t fSplitSet
Int_t fSplitRole
Double32_t fSplitWeight

Detailed Description

Definition at line 28 of file ShipMCTrack.h.

Member Enumeration Documentation

◆ SplitRole

enum ShipMCTrack::SplitRole : Int_t

Role of a track in a split set (see GetSplitSet()).

Enumerator
kNotSplit 

not part of a split set

kSplitSurvivor 

the split track itself, or its continuation

kSplitDecay 

a clone standing for one decay of the split track

Definition at line 31 of file ShipMCTrack.h.

31 : Int_t {
32 kNotSplit = 0,
33 kSplitSurvivor = 1,
34 kSplitDecay = 2
35 };
@ kSplitDecay
a clone standing for one decay of the split track
Definition ShipMCTrack.h:34
@ kNotSplit
not part of a split set
Definition ShipMCTrack.h:32
@ kSplitSurvivor
the split track itself, or its continuation
Definition ShipMCTrack.h:33

Constructor & Destructor Documentation

◆ ShipMCTrack() [1/4]

ShipMCTrack::ShipMCTrack ( )

Default constructor

Definition at line 16 of file ShipMCTrack.cxx.

17 : TObject(),
18 fPdgCode(0),
19 fMotherId(-1),
20 fPx(0.),
21 fPy(0.),
22 fPz(0.),
23 fM(-1.),
24 fStartX(0.),
25 fStartY(0.),
26 fStartZ(0.),
27 fStartT(0.),
28 fW(1.),
29 fProcID(44),
30 fNPoints(0),
31 fEventID(0),
32 fTrackID(0),
33 fSplitSet(-1),
35 fSplitWeight(0.) {}
Double32_t fPy
Double32_t fStartX
Double32_t fW
Double32_t fStartZ
Double32_t fM
Double32_t fStartY
Double32_t fSplitWeight
Double32_t fStartT
Int_t fSplitSet
Int_t fSplitRole
Int_t fMotherId
Double32_t fPz
Double32_t fPx

◆ ShipMCTrack() [2/4]

ShipMCTrack::ShipMCTrack ( Int_t pdgCode,
Int_t motherID,
Double_t px,
Double_t py,
Double_t pz,
Double_t E,
Double_t x,
Double_t y,
Double_t z,
Double_t t,
Int_t nPoints,
Int_t eventID,
Int_t trackID,
Double_t w )
explicit

Standard constructor

Definition at line 39 of file ShipMCTrack.cxx.

43 : TObject(),
44 fPdgCode(pdgCode),
45 fMotherId(motherId),
46 fPx(px),
47 fPy(py),
48 fPz(pz),
49 fM(M),
50 fStartX(x),
51 fStartY(y),
52 fStartZ(z),
53 fStartT(t),
54 fW(w),
55 fProcID(44),
56 fNPoints(nPoints),
57 fEventID(eventID),
58 fTrackID(trackID),
59 fSplitSet(-1),
61 fSplitWeight(0.) {}

◆ ShipMCTrack() [3/4]

ShipMCTrack::ShipMCTrack ( const ShipMCTrack & track)

Copy constructor

Definition at line 65 of file ShipMCTrack.cxx.

66 : TObject(track),
67 fPdgCode(track.fPdgCode),
68 fMotherId(track.fMotherId),
69 fPx(track.fPx),
70 fPy(track.fPy),
71 fPz(track.fPz),
72 fM(track.fM),
73 fStartX(track.fStartX),
74 fStartY(track.fStartY),
75 fStartZ(track.fStartZ),
76 fStartT(track.fStartT),
77 fW(track.GetWeight()),
78 fProcID(track.GetProcID()),
79 fNPoints(track.fNPoints),
80 fEventID(track.fEventID),
81 fTrackID(track.fTrackID),
82 fSplitSet(track.fSplitSet),
Double_t GetWeight() const
Int_t GetProcID() const
Definition ShipMCTrack.h:71

◆ ShipMCTrack() [4/4]

ShipMCTrack::ShipMCTrack ( TParticle * particle)
explicit

Constructor from TParticle

Definition at line 88 of file ShipMCTrack.cxx.

89 : TObject(),
90 fPdgCode(part->GetPdgCode()),
91 fMotherId(part->GetMother(0)),
92 fPx(part->Px()),
93 fPy(part->Py()),
94 fPz(part->Pz()),
95 fM([](const TParticle* p) {
96 Double_t m2 = p->Energy() * p->Energy() - p->P() * p->P();
97 if (m2 >= 0.) return TMath::Sqrt(m2);
98 // Tiny negative: numerical noise for on-shell massless particle
99 Double_t e2 = p->Energy() * p->Energy();
100 if (-m2 < 1e-10 * e2) return 0.;
101 // Genuinely spacelike (virtual photon): store negative mass (ROOT
102 // convention)
103 return -TMath::Sqrt(-m2);
104 }(part)),
105 fStartX(part->Vx()),
106 fStartY(part->Vy()),
107 fStartZ(part->Vz()),
108 fStartT(part->T() * 1e09),
109 fW(part->GetWeight()),
110 fProcID(part->GetUniqueID()),
111 fNPoints(0),
112 fEventID(0),
113 fTrackID(0),
114 fSplitSet(-1),
116 fSplitWeight(0.) {}
float m2
Definition hepunit.py:58

◆ ~ShipMCTrack()

ShipMCTrack::~ShipMCTrack ( )
overridedefault

Destructor

Member Function Documentation

◆ ClassDefOverride()

ShipMCTrack::ClassDefOverride ( ShipMCTrack ,
10  )
private

◆ Get4Momentum()

void ShipMCTrack::Get4Momentum ( TLorentzVector & momentum)
inline

Definition at line 179 of file ShipMCTrack.h.

179 {
180 momentum.SetXYZT(fPx, fPy, fPz, GetEnergy());
181}
Double_t GetEnergy() const

◆ GetEnergy()

Double_t ShipMCTrack::GetEnergy ( ) const

Definition at line 132 of file ShipMCTrack.cxx.

132 {
133 if (fM < 0) {
134 // older data, mass not made persistent
135 Double_t mass = GetMass();
136 return TMath::Sqrt(mass * mass + fPx * fPx + fPy * fPy + fPz * fPz);
137 } else {
138 return TMath::Sqrt(fM * fM + fPx * fPx + fPy * fPy + fPz * fPz);
139 }
140}
Double_t GetMass() const

◆ GetEventID()

Int_t ShipMCTrack::GetEventID ( ) const
inline

Definition at line 69 of file ShipMCTrack.h.

69{ return fEventID; }

◆ GetMass()

Double_t ShipMCTrack::GetMass ( ) const

Definition at line 142 of file ShipMCTrack.cxx.

142 {
143 if (fM < 0) {
144 // older data, mass not made persistent
145 if (TDatabasePDG::Instance()) {
146 TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(fPdgCode);
147 if (particle) {
148 return particle->Mass();
149 } else {
150 return 0.;
151 }
152 }
153 }
154 return fM;
155}

◆ GetMomentum()

void ShipMCTrack::GetMomentum ( TVector3 & momentum)
inline

Definition at line 175 of file ShipMCTrack.h.

175 {
176 momentum.SetXYZ(fPx, fPy, fPz);
177}

◆ GetMotherId()

Int_t ShipMCTrack::GetMotherId ( ) const
inline

Definition at line 61 of file ShipMCTrack.h.

61{ return fMotherId; }

◆ GetP()

Double_t ShipMCTrack::GetP ( ) const
inline

Definition at line 76 of file ShipMCTrack.h.

76 {
77 return TMath::Sqrt(fPx * fPx + fPy * fPy + fPz * fPz);
78 }

◆ GetPdgCode()

Int_t ShipMCTrack::GetPdgCode ( ) const
inline

Accessors

Definition at line 60 of file ShipMCTrack.h.

60{ return fPdgCode; }

◆ GetProcID()

Int_t ShipMCTrack::GetProcID ( ) const
inline

Definition at line 71 of file ShipMCTrack.h.

71{ return fProcID; }

◆ GetProcName()

TString ShipMCTrack::GetProcName ( ) const
inline

Definition at line 72 of file ShipMCTrack.h.

72{ return TMCProcessName[fProcID]; }

◆ GetPt()

Double_t ShipMCTrack::GetPt ( ) const
inline

Definition at line 75 of file ShipMCTrack.h.

75{ return TMath::Sqrt(fPx * fPx + fPy * fPy); }

◆ GetPx()

Double_t ShipMCTrack::GetPx ( ) const
inline

Definition at line 62 of file ShipMCTrack.h.

62{ return fPx; }

◆ GetPy()

Double_t ShipMCTrack::GetPy ( ) const
inline

Definition at line 63 of file ShipMCTrack.h.

63{ return fPy; }

◆ GetPz()

Double_t ShipMCTrack::GetPz ( ) const
inline

Definition at line 64 of file ShipMCTrack.h.

64{ return fPz; }

◆ GetRapidity()

Double_t ShipMCTrack::GetRapidity ( ) const

Definition at line 163 of file ShipMCTrack.cxx.

163 {
164 Double_t e = GetEnergy();
165 Double_t y = 0.5 * TMath::Log((e + fPz) / (e - fPz));
166 return y;
167}

◆ GetSplitRole()

Int_t ShipMCTrack::GetSplitRole ( ) const
inline

Definition at line 103 of file ShipMCTrack.h.

103{ return fSplitRole; }

◆ GetSplitSet()

Int_t ShipMCTrack::GetSplitSet ( ) const
inline

Split set of the track, -1 if it is not part of one. Splitting a kaon or pion replaces its decay by weighted alternatives, which are mutually exclusive histories rather than particles that exist together. All tracks created for one split track share its split set: the track itself and its continuations (kSplitSurvivor), and the clones that each stand for one of its decays (kSplitDecay). The clones and continuations are pushed with the split track's mother as their mother, so the split set, not the mother index, tells them apart from real siblings. The ID is unique within an event. GetSplitWeight() is the weight of the split track before it was split, the same for every member: a decay alternative of weight w stands for a decay with probability w / GetSplitWeight(). A survivor track carries the weight of its own path, before any decay that ends it. Clones whose products were not stored are pruned from the output, so the stored alternatives of a set need not add up to it.

Definition at line 102 of file ShipMCTrack.h.

102{ return fSplitSet; }

◆ GetSplitWeight()

Double_t ShipMCTrack::GetSplitWeight ( ) const
inline

Definition at line 104 of file ShipMCTrack.h.

104{ return fSplitWeight; }

◆ GetStartT()

Double_t ShipMCTrack::GetStartT ( ) const
inline

Definition at line 68 of file ShipMCTrack.h.

68{ return fStartT; }

◆ GetStartVertex()

void ShipMCTrack::GetStartVertex ( TVector3 & vertex)
inline

Definition at line 183 of file ShipMCTrack.h.

183 {
184 vertex.SetXYZ(fStartX, fStartY, fStartZ);
185}

◆ GetStartX()

Double_t ShipMCTrack::GetStartX ( ) const
inline

Definition at line 65 of file ShipMCTrack.h.

65{ return fStartX; }

◆ GetStartY()

Double_t ShipMCTrack::GetStartY ( ) const
inline

Definition at line 66 of file ShipMCTrack.h.

66{ return fStartY; }

◆ GetStartZ()

Double_t ShipMCTrack::GetStartZ ( ) const
inline

Definition at line 67 of file ShipMCTrack.h.

67{ return fStartZ; }

◆ GetWeight()

Double_t ShipMCTrack::GetWeight ( ) const

Definition at line 159 of file ShipMCTrack.cxx.

159{ return fW; }

◆ IsSplitDecay()

Bool_t ShipMCTrack::IsSplitDecay ( ) const
inline

Definition at line 105 of file ShipMCTrack.h.

105{ return fSplitRole == kSplitDecay; }

◆ IsSplitSurvivor()

Bool_t ShipMCTrack::IsSplitSurvivor ( ) const
inline

Definition at line 106 of file ShipMCTrack.h.

106{ return fSplitRole == kSplitSurvivor; }

◆ MultiplyWeight()

void ShipMCTrack::MultiplyWeight ( Double_t w)
inline

Definition at line 80 of file ShipMCTrack.h.

80{ fW = fW * w; }

◆ Print()

void ShipMCTrack::Print ( Int_t iTrack = 0) const

Definition at line 124 of file ShipMCTrack.cxx.

124 {
125 LOG(debug) << "Track " << trackId << ", mother : " << fMotherId << ", Type "
126 << fPdgCode << ", momentum (" << fPx << ", " << fPy << ", " << fPz
127 << ") GeV";
128}
const Int_t debug

◆ SetEventID()

void ShipMCTrack::SetEventID ( const Int_t & eventID)

Definition at line 170 of file ShipMCTrack.cxx.

170{ fEventID = eventID; }

◆ SetMotherId()

void ShipMCTrack::SetMotherId ( Int_t id)
inline

Modifiers

Definition at line 109 of file ShipMCTrack.h.

109{ fMotherId = id; }

◆ SetProcID()

void ShipMCTrack::SetProcID ( Int_t i)
inline

Definition at line 70 of file ShipMCTrack.h.

70{ fProcID = i; }
int i
Definition ShipAna.py:108

◆ SetSplitSet()

void ShipMCTrack::SetSplitSet ( Int_t splitSet,
Int_t role,
Double_t splitWeight )
inline

Definition at line 113 of file ShipMCTrack.h.

113 {
114 fSplitSet = splitSet;
115 fSplitRole = role;
116 fSplitWeight = splitWeight;
117 }

◆ SetStartT()

void ShipMCTrack::SetStartT ( Double_t t)
inline

Definition at line 110 of file ShipMCTrack.h.

◆ SetTrackID()

void ShipMCTrack::SetTrackID ( const Int_t & trackID)

Definition at line 172 of file ShipMCTrack.cxx.

172{ fTrackID = trackID; }

◆ SetWeight()

void ShipMCTrack::SetWeight ( Double_t w)
inline

Definition at line 81 of file ShipMCTrack.h.

81{ fW = w; }

Member Data Documentation

◆ fEventID

Int_t ShipMCTrack::fEventID
private

Index of the event

Definition at line 156 of file ShipMCTrack.h.

◆ fM

Double32_t ShipMCTrack::fM
private

Definition at line 127 of file ShipMCTrack.h.

◆ fMotherId

Int_t ShipMCTrack::fMotherId
private

Index of mother track. -1 for primary particles.

Definition at line 124 of file ShipMCTrack.h.

◆ fNPoints

Int_t ShipMCTrack::fNPoints
private

Bitvector representing the number of MCPoints for this track in each subdetector. The detectors are represented by REF: Bit 0 (1 bit, max. value 1) MVD: Bit 1 - 3 (3 bits, max. value 7) STS: Bit 4 - 8 (5 bits, max. value 31) RICH: Bit 9 (1 bit, max. value 1) MUCH: Bit 10 - 14 (5 bits, max. value 31) TRD: Bit 15 - 19 (5 bits, max. value 31) TOF: Bit 20 - 23 (4 bits, max. value 15) ECAL: Bit 24 (1 bit, max. value 1) ZDC: Bit 25 (1 bit, max. value 1) The respective point numbers can be accessed and modified with the inline functions. Bits 26-31 are spare for potential additional detectors.

Definition at line 153 of file ShipMCTrack.h.

◆ fPdgCode

Int_t ShipMCTrack::fPdgCode
private

PDG particle code

Definition at line 121 of file ShipMCTrack.h.

◆ fProcID

Int_t ShipMCTrack::fProcID
private

Geant4 process ID which created the particle

Definition at line 136 of file ShipMCTrack.h.

◆ fPx

Double32_t ShipMCTrack::fPx
private

Momentum components at start vertex [GeV]

Definition at line 127 of file ShipMCTrack.h.

◆ fPy

Double32_t ShipMCTrack::fPy
private

Definition at line 127 of file ShipMCTrack.h.

◆ fPz

Double32_t ShipMCTrack::fPz
private

Definition at line 127 of file ShipMCTrack.h.

◆ fSplitRole

Int_t ShipMCTrack::fSplitRole
private

Role in the split set, a SplitRole

Definition at line 165 of file ShipMCTrack.h.

◆ fSplitSet

Int_t ShipMCTrack::fSplitSet
private

Split set the track belongs to, -1 if none (see GetSplitSet())

Definition at line 162 of file ShipMCTrack.h.

◆ fSplitWeight

Double32_t ShipMCTrack::fSplitWeight
private

Weight of the split track before splitting (see GetSplitSet())

Definition at line 168 of file ShipMCTrack.h.

◆ fStartT

Double32_t ShipMCTrack::fStartT
private

Definition at line 130 of file ShipMCTrack.h.

◆ fStartX

Double32_t ShipMCTrack::fStartX
private

Coordinates of start vertex [cm, ns]

Definition at line 130 of file ShipMCTrack.h.

◆ fStartY

Double32_t ShipMCTrack::fStartY
private

Definition at line 130 of file ShipMCTrack.h.

◆ fStartZ

Double32_t ShipMCTrack::fStartZ
private

Definition at line 130 of file ShipMCTrack.h.

◆ fTrackID

Int_t ShipMCTrack::fTrackID
private

Index of track in the event

Definition at line 159 of file ShipMCTrack.h.

◆ fW

Double32_t ShipMCTrack::fW
private

weight

Definition at line 133 of file ShipMCTrack.h.


The documentation for this class was generated from the following files: