PandaRoot
PndMCTrack.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 // -------------------------------------------------------------------------
14 // ----- PndMCTrack header file -----
15 // ----- Created 03/08/04 by V. Friese -----
16 // ----- Adapted to Panda M. Al-Turany -----
17 // -------------------------------------------------------------------------
18 
27 #ifndef CBMMCTRACK_H
28 #define CBMMCTRACK_H 1
29 
30 #include "PndDetectorList.h"
31 #include "TObject.h"
32 #include "TParticle.h"
33 #include "TVector3.h"
34 #include "TLorentzVector.h"
35 
36 #include <iostream>
37 
38 #ifndef ROOT_TParticlePDG
39 #include "TParticlePDG.h"
40 #endif
41 #ifndef ROOT_TDatabasePDG
42 #include "TDatabasePDG.h"
43 #endif
44 
45 class PndMCTrack : public TObject {
46 
47  public:
49  PndMCTrack();
50 
52  // PndMCTrack(Int_t pdgCode, Int_t motherID, TVector3 startVvertex,
54  // Double_t startTime, TLorentzVector momentum, Int_t nPoint=0);
55 
57  PndMCTrack(const PndMCTrack &track);
58 
60  PndMCTrack(TParticle *particle);
61 
63  virtual ~PndMCTrack();
64 
66  void Print(Int_t iTrack = 0) const;
67 
68  friend std::ostream &operator<<(std::ostream &out, PndMCTrack &track)
69  {
70  track.Print();
71  return out;
72  }
73 
75  Int_t GetPdgCode() const { return fPdgCode; }
76  Int_t GetMotherID() const { return fMotherID; }
77  Int_t GetSecondMotherID() const { return fSecondMotherID; }
78  TVector3 GetStartVertex() const { return TVector3(fStartX, fStartY, fStartZ); }
79  Double_t GetStartTime() const { return fStartT; }
80  TVector3 GetMomentum() const { return TVector3(fPx, fPy, fPz); }
81  Double_t GetPt() const { return TMath::Sqrt(fPx * fPx + fPy * fPy); }
82  /*
83  Int_t GetStsPoints() const { return (fPoints & 15 ) ; }
84  */
85 
86  Bool_t IsGeneratorCreated(void) const { return (fGeneratorFlags & 0x1) != 0; }
87  Bool_t IsGeneratorDecayed(void) const { return (fGeneratorFlags & 0x2) != 0; }
88  Bool_t IsGeneratorLast(void) const { return (fGeneratorFlags & 0x1) != 0 && (fGeneratorFlags & 0x2) == 0; }
89  void SetGeneratorCreated(void) { fGeneratorFlags |= 0x1; }
90  void SetGeneratorDecayed(void) { fGeneratorFlags |= 0x2; }
91 
92  Int_t GetNPoints(DetectorId detId) const;
95  void SetMotherID(Int_t id) { fMotherID = id; }
96  void SetSecondMotherID(Int_t id) { fSecondMotherID = id; }
97  /*
98  void SetStsPoints(Int_t np);
99  */
100 
102  /*
103  void AddStsPoint() { SetStsPoints( GetStsPoints() + 1 ); }
104  */
105 
106  void SetNPoints(DetectorId iDet, Int_t np);
107 
108  TLorentzVector Get4Momentum() const;
109 
110  UInt_t GetProcessID() const { return fProcess; }
111 
112  private:
114  Int_t fPdgCode;
115 
117  Double32_t fPx, fPy, fPz, fE;
118 
120  Int_t fMotherID;
121  Int_t fSecondMotherID;
122 
124  Int_t fGeneratorFlags;
125 
127  Double32_t fStartX, fStartY, fStartZ, fStartT;
128 
151  Int_t fPoints;
152 
153  UInt_t fProcess{}; // should actually be a TMCProcess, but as we abuse the TObject::fUniqueId to store the ProcessID causing the track ...
154  ClassDef(PndMCTrack, 2);
155 };
156 
157 #endif
static T Sqrt(const T &x)
Definition: PndCAMath.h:57
Double_t GetStartTime() const
Definition: PndMCTrack.h:79
Int_t GetNPoints(DetectorId detId) const
Bool_t IsGeneratorLast(void) const
Definition: PndMCTrack.h:88
void SetGeneratorDecayed(void)
Definition: PndMCTrack.h:90
Int_t GetSecondMotherID() const
Definition: PndMCTrack.h:77
Double_t GetPt() const
Definition: PndMCTrack.h:81
void Print(Int_t iTrack=0) const
TVector3 GetStartVertex() const
Definition: PndMCTrack.h:78
Bool_t IsGeneratorCreated(void) const
Definition: PndMCTrack.h:86
TVector3 GetMomentum() const
Definition: PndMCTrack.h:80
virtual ~PndMCTrack()
TLorentzVector Get4Momentum() const
UInt_t GetProcessID() const
Definition: PndMCTrack.h:110
Int_t GetPdgCode() const
Definition: PndMCTrack.h:75
friend std::ostream & operator<<(std::ostream &out, PndMCTrack &track)
Definition: PndMCTrack.h:68
void SetSecondMotherID(Int_t id)
Definition: PndMCTrack.h:96
void SetGeneratorCreated(void)
Definition: PndMCTrack.h:89
void SetMotherID(Int_t id)
Definition: PndMCTrack.h:95
DetectorId
Int_t GetMotherID() const
Definition: PndMCTrack.h:76
Bool_t IsGeneratorDecayed(void) const
Definition: PndMCTrack.h:87
void SetNPoints(DetectorId iDet, Int_t np)