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

#include <ShipMCTrack.h>

Inheritance diagram for ShipMCTrack:
Collaboration diagram for ShipMCTrack:

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)
 
virtual ~ShipMCTrack ()
 
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
 
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 GetNPoints (DetectorId detId) const
 
void SetMotherId (Int_t id)
 
void SetNPoints (Int_t iDet, Int_t np)
 
void SetEventID (const Int_t &eventID)
 
void SetTrackID (const Int_t &trackID)
 

Private Member Functions

 ClassDef (ShipMCTrack, 9)
 

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
 

Detailed Description

Definition at line 28 of file ShipMCTrack.h.

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) {}
Int_t fProcID
Definition: ShipMCTrack.h:105
Double32_t fPy
Definition: ShipMCTrack.h:96
Int_t fEventID
Definition: ShipMCTrack.h:125
Int_t fNPoints
Definition: ShipMCTrack.h:122
Int_t fPdgCode
Definition: ShipMCTrack.h:90
Int_t fTrackID
Definition: ShipMCTrack.h:128
Double32_t fStartX
Definition: ShipMCTrack.h:99
Double32_t fW
Definition: ShipMCTrack.h:102
Double32_t fStartZ
Definition: ShipMCTrack.h:99
Double32_t fM
Definition: ShipMCTrack.h:96
Double32_t fStartY
Definition: ShipMCTrack.h:99
Double32_t fStartT
Definition: ShipMCTrack.h:99
Int_t fMotherId
Definition: ShipMCTrack.h:93
Double32_t fPz
Definition: ShipMCTrack.h:96
Double32_t fPx
Definition: ShipMCTrack.h:96

◆ 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 36 of file ShipMCTrack.cxx.

40 : TObject(),
41 fPdgCode(pdgCode),
42 fMotherId(motherId),
43 fPx(px),
44 fPy(py),
45 fPz(pz),
46 fM(M),
47 fStartX(x),
48 fStartY(y),
49 fStartZ(z),
50 fStartT(t),
51 fW(w),
52 fProcID(44),
53 fNPoints(nPoints),
54 fEventID(eventID),
55 fTrackID(trackID) {}

◆ ShipMCTrack() [3/4]

ShipMCTrack::ShipMCTrack ( const ShipMCTrack track)

Copy constructor

Definition at line 59 of file ShipMCTrack.cxx.

60 : TObject(track),
61 fPdgCode(track.fPdgCode),
62 fMotherId(track.fMotherId),
63 fPx(track.fPx),
64 fPy(track.fPy),
65 fPz(track.fPz),
66 fM(track.fM),
67 fStartX(track.fStartX),
68 fStartY(track.fStartY),
69 fStartZ(track.fStartZ),
70 fStartT(track.fStartT),
71 fW(track.GetWeight()),
72 fProcID(track.GetProcID()),
73 fNPoints(track.fNPoints),
74 fEventID(track.fEventID),
75 fTrackID(track.fTrackID) {}
Double_t GetWeight() const
Int_t GetProcID() const
Definition: ShipMCTrack.h:63

◆ ShipMCTrack() [4/4]

ShipMCTrack::ShipMCTrack ( TParticle *  particle)
explicit

Constructor from TParticle

Definition at line 79 of file ShipMCTrack.cxx.

80 : TObject(),
81 fPdgCode(part->GetPdgCode()),
82 fMotherId(part->GetMother(0)),
83 fPx(part->Px()),
84 fPy(part->Py()),
85 fPz(part->Pz()),
86 fM([](const TParticle* p) {
87 Double_t m2 = p->Energy() * p->Energy() - p->P() * p->P();
88 if (m2 >= 0.) return TMath::Sqrt(m2);
89 // Tiny negative: numerical noise for on-shell massless particle
90 Double_t e2 = p->Energy() * p->Energy();
91 if (-m2 < 1e-10 * e2) return 0.;
92 // Genuinely spacelike (virtual photon): store negative mass (ROOT
93 // convention)
94 return -TMath::Sqrt(-m2);
95 }(part)),
96 fStartX(part->Vx()),
97 fStartY(part->Vy()),
98 fStartZ(part->Vz()),
99 fStartT(part->T() * 1e09),
100 fW(part->GetWeight()),
101 fProcID(part->GetUniqueID()),
102 fNPoints(0),
103 fEventID(0),
104 fTrackID(0) {}
examples * if(DOT) set(DIAGRAM_EXAMPLE $
Definition: CMakeLists.txt:6
float m2
Definition: hepunit.py:58
ROOT p
Definition: makeDecay.py:76

◆ ~ShipMCTrack()

ShipMCTrack::~ShipMCTrack ( )
virtual

Destructor

Definition at line 108 of file ShipMCTrack.cxx.

108{}

Member Function Documentation

◆ ClassDef()

ShipMCTrack::ClassDef ( ShipMCTrack  ,
 
)
private

◆ Get4Momentum()

void ShipMCTrack::Get4Momentum ( TLorentzVector &  momentum)
inline

Definition at line 139 of file ShipMCTrack.h.

139 {
140 momentum.SetXYZT(fPx, fPy, fPz, GetEnergy());
141}
Double_t GetEnergy() const

◆ GetEnergy()

Double_t ShipMCTrack::GetEnergy ( ) const

Definition at line 124 of file ShipMCTrack.cxx.

124 {
125 if (fM < 0) {
126 // older data, mass not made persistent
127 Double_t mass = GetMass();
128 return TMath::Sqrt(mass * mass + fPx * fPx + fPy * fPy + fPz * fPz);
129 } else {
130 return TMath::Sqrt(fM * fM + fPx * fPx + fPy * fPy + fPz * fPz);
131 }
132}
Double_t GetMass() const
def mass(str|None particle)
Definition: hnl.py:54

◆ GetMass()

Double_t ShipMCTrack::GetMass ( ) const

Definition at line 134 of file ShipMCTrack.cxx.

134 {
135 if (fM < 0) {
136 // older data, mass not made persistent
137 if (TDatabasePDG::Instance()) {
138 TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(fPdgCode);
139 if (particle) {
140 return particle->Mass();
141 } else {
142 return 0.;
143 }
144 }
145 }
146 return fM;
147}

◆ GetMomentum()

void ShipMCTrack::GetMomentum ( TVector3 &  momentum)
inline

Definition at line 135 of file ShipMCTrack.h.

135 {
136 momentum.SetXYZ(fPx, fPy, fPz);
137}

◆ GetMotherId()

Int_t ShipMCTrack::GetMotherId ( ) const
inline

Definition at line 54 of file ShipMCTrack.h.

54{ return fMotherId; }

◆ GetNPoints()

Int_t ShipMCTrack::GetNPoints ( DetectorId  detId) const

Accessors to the number of MCPoints in the detectors

Definition at line 163 of file ShipMCTrack.cxx.

163 {
164 /* // TODO: Where does this come from
165 if ( detId == kREF ) { return ( fNPoints & 1); }
166 else if ( detId == kTutDet ) { return ( (fNPoints & ( 7 << 1) ) >> 1); }
167 else if ( detId == kFairRutherford ) { return ( (fNPoints & (31 << 4) ) >>
168 4); } else { LOG(error) << "Unknown detector ID " << detId ; return 0;
169 }
170 */
171 return 0;
172}

◆ GetP()

Double_t ShipMCTrack::GetP ( ) const
inline

Definition at line 68 of file ShipMCTrack.h.

68 {
69 return TMath::Sqrt(fPx * fPx + fPy * fPy + fPz * fPz);
70 }

◆ GetPdgCode()

Int_t ShipMCTrack::GetPdgCode ( ) const
inline

Accessors

Definition at line 53 of file ShipMCTrack.h.

53{ return fPdgCode; }

◆ GetProcID()

Int_t ShipMCTrack::GetProcID ( ) const
inline

Definition at line 63 of file ShipMCTrack.h.

63{ return fProcID; }

◆ GetProcName()

TString ShipMCTrack::GetProcName ( ) const
inline

Definition at line 64 of file ShipMCTrack.h.

64{ return TMCProcessName[fProcID]; }

◆ GetPt()

Double_t ShipMCTrack::GetPt ( ) const
inline

Definition at line 67 of file ShipMCTrack.h.

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

◆ GetPx()

Double_t ShipMCTrack::GetPx ( ) const
inline

Definition at line 55 of file ShipMCTrack.h.

55{ return fPx; }

◆ GetPy()

Double_t ShipMCTrack::GetPy ( ) const
inline

Definition at line 56 of file ShipMCTrack.h.

56{ return fPy; }

◆ GetPz()

Double_t ShipMCTrack::GetPz ( ) const
inline

Definition at line 57 of file ShipMCTrack.h.

57{ return fPz; }

◆ GetRapidity()

Double_t ShipMCTrack::GetRapidity ( ) const

Definition at line 155 of file ShipMCTrack.cxx.

155 {
156 Double_t e = GetEnergy();
157 Double_t y = 0.5 * TMath::Log((e + fPz) / (e - fPz));
158 return y;
159}

◆ GetStartT()

Double_t ShipMCTrack::GetStartT ( ) const
inline

Definition at line 61 of file ShipMCTrack.h.

61{ return fStartT; }

◆ GetStartVertex()

void ShipMCTrack::GetStartVertex ( TVector3 &  vertex)
inline

Definition at line 143 of file ShipMCTrack.h.

143 {
144 vertex.SetXYZ(fStartX, fStartY, fStartZ);
145}

◆ GetStartX()

Double_t ShipMCTrack::GetStartX ( ) const
inline

Definition at line 58 of file ShipMCTrack.h.

58{ return fStartX; }

◆ GetStartY()

Double_t ShipMCTrack::GetStartY ( ) const
inline

Definition at line 59 of file ShipMCTrack.h.

59{ return fStartY; }

◆ GetStartZ()

Double_t ShipMCTrack::GetStartZ ( ) const
inline

Definition at line 60 of file ShipMCTrack.h.

60{ return fStartZ; }

◆ GetWeight()

Double_t ShipMCTrack::GetWeight ( ) const

Definition at line 151 of file ShipMCTrack.cxx.

151{ return fW; }

◆ MultiplyWeight()

void ShipMCTrack::MultiplyWeight ( Double_t  w)
inline

Definition at line 72 of file ShipMCTrack.h.

72{ fW = fW * w; }

◆ Print()

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

Definition at line 112 of file ShipMCTrack.cxx.

112 {
113 LOG(debug) << "Track " << trackId << ", mother : " << fMotherId << ", Type "
114 << fPdgCode << ", momentum (" << fPx << ", " << fPy << ", " << fPz
115 << ") GeV";
116 /* LOG(DEBUG2) << " Ref " << GetNPoints(kREF)
117 << ", TutDet " << GetNPoints(kTutDet)
118 << ", Rutherford " << GetNPoints(kFairRutherford) ;
119 */
120}
const Int_t debug

◆ SetEventID()

void ShipMCTrack::SetEventID ( const Int_t &  eventID)

Definition at line 200 of file ShipMCTrack.cxx.

200{ fEventID = eventID; }

◆ SetMotherId()

void ShipMCTrack::SetMotherId ( Int_t  id)
inline

Modifiers

Definition at line 83 of file ShipMCTrack.h.

83{ fMotherId = id; }

◆ SetNPoints()

void ShipMCTrack::SetNPoints ( Int_t  iDet,
Int_t  np 
)

Definition at line 176 of file ShipMCTrack.cxx.

176 {
177 /*
178 if ( iDet == kREF ) {
179 if ( nPoints < 0 ) { nPoints = 0; }
180 else if ( nPoints > 1 ) { nPoints = 1; }
181 fNPoints = ( fNPoints & ( ~ 1 ) ) | nPoints;
182 }
183
184 else if ( iDet == kTutDet ) {
185 if ( nPoints < 0 ) { nPoints = 0; }
186 else if ( nPoints > 7 ) { nPoints = 7; }
187 fNPoints = ( fNPoints & ( ~ ( 7 << 1 ) ) ) | ( nPoints << 1 );
188 }
189
190 else if ( iDet == kFairRutherford ) {
191 if ( nPoints < 0 ) { nPoints = 0; }
192 else if ( nPoints > 31 ) { nPoints = 31; }
193 fNPoints = ( fNPoints & ( ~ ( 31 << 4 ) ) ) | ( nPoints << 4 );
194 }
195
196 else LOG(error) << "Unknown detector ID " << iDet ;
197 */
198}

◆ SetProcID()

void ShipMCTrack::SetProcID ( Int_t  i)
inline

Definition at line 62 of file ShipMCTrack.h.

62{ fProcID = i; }
int i
Definition: ShipAna.py:97

◆ SetTrackID()

void ShipMCTrack::SetTrackID ( const Int_t &  trackID)

Definition at line 202 of file ShipMCTrack.cxx.

202{ fTrackID = trackID; }

◆ SetWeight()

void ShipMCTrack::SetWeight ( Double_t  w)
inline

Definition at line 73 of file ShipMCTrack.h.

73{ fW = w; }

Member Data Documentation

◆ fEventID

Int_t ShipMCTrack::fEventID
private

Index of the event

Definition at line 125 of file ShipMCTrack.h.

◆ fM

Double32_t ShipMCTrack::fM
private

Definition at line 96 of file ShipMCTrack.h.

◆ fMotherId

Int_t ShipMCTrack::fMotherId
private

Index of mother track. -1 for primary particles.

Definition at line 93 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 122 of file ShipMCTrack.h.

◆ fPdgCode

Int_t ShipMCTrack::fPdgCode
private

PDG particle code

Definition at line 90 of file ShipMCTrack.h.

◆ fProcID

Int_t ShipMCTrack::fProcID
private

Geant4 process ID which created the particle

Definition at line 105 of file ShipMCTrack.h.

◆ fPx

Double32_t ShipMCTrack::fPx
private

Momentum components at start vertex [GeV]

Definition at line 96 of file ShipMCTrack.h.

◆ fPy

Double32_t ShipMCTrack::fPy
private

Definition at line 96 of file ShipMCTrack.h.

◆ fPz

Double32_t ShipMCTrack::fPz
private

Definition at line 96 of file ShipMCTrack.h.

◆ fStartT

Double32_t ShipMCTrack::fStartT
private

Definition at line 99 of file ShipMCTrack.h.

◆ fStartX

Double32_t ShipMCTrack::fStartX
private

Coordinates of start vertex [cm, ns]

Definition at line 99 of file ShipMCTrack.h.

◆ fStartY

Double32_t ShipMCTrack::fStartY
private

Definition at line 99 of file ShipMCTrack.h.

◆ fStartZ

Double32_t ShipMCTrack::fStartZ
private

Definition at line 99 of file ShipMCTrack.h.

◆ fTrackID

Int_t ShipMCTrack::fTrackID
private

Index of track in the event

Definition at line 128 of file ShipMCTrack.h.

◆ fW

Double32_t ShipMCTrack::fW
private

weight

Definition at line 102 of file ShipMCTrack.h.


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