PandaRoot
PndMCTrack.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- PndMCTrack header file -----
3 // ----- Created 03/08/04 by V. Friese -----
4 // ----- Adapted to Panda M. Al-Turany -----
5 // -------------------------------------------------------------------------
6 
15 #ifndef CBMMCTRACK_H
16 #define CBMMCTRACK_H 1
17 
18 #include "PndDetectorList.h"
19 #include "TObject.h"
20 #include "TParticle.h"
21 #include "TVector3.h"
22 #include "TLorentzVector.h"
23 
24 #include <iostream>
25 
26 #ifndef ROOT_TParticlePDG
27 #include "TParticlePDG.h"
28 #endif
29 #ifndef ROOT_TDatabasePDG
30 #include "TDatabasePDG.h"
31 #endif
32 
33 class PndMCTrack : public TObject {
34 
35  public:
37  PndMCTrack();
38 
40  // PndMCTrack(Int_t pdgCode, Int_t motherID, TVector3 startVvertex,
42  // Double_t startTime, TLorentzVector momentum, Int_t nPoint=0);
43 
45  PndMCTrack(const PndMCTrack &track);
46 
48  PndMCTrack(TParticle *particle);
49 
51  virtual ~PndMCTrack();
52 
54  void Print(Int_t iTrack = 0) const;
55 
56  friend std::ostream &operator<<(std::ostream &out, PndMCTrack &track)
57  {
58  track.Print();
59  return out;
60  }
61 
63  Int_t GetPdgCode() const { return fPdgCode; }
64  Int_t GetMotherID() const { return fMotherID; }
65  Int_t GetSecondMotherID() const { return fSecondMotherID; }
66  TVector3 GetStartVertex() const { return TVector3(fStartX, fStartY, fStartZ); }
67  Double_t GetStartTime() const { return fStartT; }
68  TVector3 GetMomentum() const { return TVector3(fPx, fPy, fPz); }
69  Double_t GetPt() const { return TMath::Sqrt(fPx * fPx + fPy * fPy); }
70  /*
71  Int_t GetStsPoints() const { return (fPoints & 15 ) ; }
72  */
73 
74  Bool_t IsGeneratorCreated(void) const { return (fGeneratorFlags & 0x1) != 0; }
75  Bool_t IsGeneratorDecayed(void) const { return (fGeneratorFlags & 0x2) != 0; }
76  Bool_t IsGeneratorLast(void) const { return (fGeneratorFlags & 0x1) != 0 && (fGeneratorFlags & 0x2) == 0; }
77  void SetGeneratorCreated(void) { fGeneratorFlags |= 0x1; }
78  void SetGeneratorDecayed(void) { fGeneratorFlags |= 0x2; }
79 
80  Int_t GetNPoints(DetectorId detId) const;
83  void SetMotherID(Int_t id) { fMotherID = id; }
84  void SetSecondMotherID(Int_t id) { fSecondMotherID = id; }
85  /*
86  void SetStsPoints(Int_t np);
87  */
88 
90  /*
91  void AddStsPoint() { SetStsPoints( GetStsPoints() + 1 ); }
92  */
93 
94  void SetNPoints(DetectorId iDet, Int_t np);
95 
96  TLorentzVector Get4Momentum() const;
97 
98  UInt_t GetProcessID() const { return fProcess; }
99 
100  private:
102  Int_t fPdgCode;
103 
105  Double32_t fPx, fPy, fPz, fE;
106 
108  Int_t fMotherID;
109  Int_t fSecondMotherID;
110 
112  Int_t fGeneratorFlags;
113 
115  Double32_t fStartX, fStartY, fStartZ, fStartT;
116 
138  Int_t fPoints;
139 
140  UInt_t fProcess{}; // should actually be a TMCProcess, but as we abuse the TObject::fUniqueId to store the ProcessID causing the track ...
141  ClassDef(PndMCTrack, 2);
142 };
143 
144 #endif
static T Sqrt(const T &x)
Definition: PndCAMath.h:45
Double_t GetStartTime() const
Definition: PndMCTrack.h:67
Int_t GetNPoints(DetectorId detId) const
Bool_t IsGeneratorLast(void) const
Definition: PndMCTrack.h:76
void SetGeneratorDecayed(void)
Definition: PndMCTrack.h:78
Int_t GetSecondMotherID() const
Definition: PndMCTrack.h:65
Double_t GetPt() const
Definition: PndMCTrack.h:69
void Print(Int_t iTrack=0) const
TVector3 GetStartVertex() const
Definition: PndMCTrack.h:66
Bool_t IsGeneratorCreated(void) const
Definition: PndMCTrack.h:74
TVector3 GetMomentum() const
Definition: PndMCTrack.h:68
virtual ~PndMCTrack()
TLorentzVector Get4Momentum() const
UInt_t GetProcessID() const
Definition: PndMCTrack.h:98
Int_t GetPdgCode() const
Definition: PndMCTrack.h:63
friend std::ostream & operator<<(std::ostream &out, PndMCTrack &track)
Definition: PndMCTrack.h:56
void SetSecondMotherID(Int_t id)
Definition: PndMCTrack.h:84
void SetGeneratorCreated(void)
Definition: PndMCTrack.h:77
void SetMotherID(Int_t id)
Definition: PndMCTrack.h:83
DetectorId
Int_t GetMotherID() const
Definition: PndMCTrack.h:64
Bool_t IsGeneratorDecayed(void) const
Definition: PndMCTrack.h:75
void SetNPoints(DetectorId iDet, Int_t np)