FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairMCTrack.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 // -------------------------------------------------------------------------
9 // ----- FairMCTrack header file -----
10 // ----- Created 03/08/04 by V. Friese -----
11 // -------------------------------------------------------------------------
12 
23 #ifndef FAIRMCTRACK_H
24 #define FAIRMCTRACK_H 1
25 
26 #include "FairDetectorList.h" // for DetectorId
27 
28 #include <Rtypes.h> // for Double_t, Int_t, Double32_t, etc
29 #include <TLorentzVector.h> // for TLorentzVector
30 #include <TMath.h> // for Sqrt
31 #include <TObject.h> // for TObject
32 #include <TVector3.h> // for TVector3
33 
34 class TParticle;
35 
36 class FairMCTrack : public TObject
37 {
38  public:
40  FairMCTrack();
41 
43  FairMCTrack(Int_t pdgCode,
44  Int_t motherID,
45  Double_t px,
46  Double_t py,
47  Double_t pz,
48  Double_t x,
49  Double_t y,
50  Double_t z,
51  Double_t t,
52  Int_t nPoints);
53 
55  FairMCTrack(const FairMCTrack& track);
56 
58  FairMCTrack(TParticle* particle);
59 
61  virtual ~FairMCTrack();
62 
63 #if defined(__clang__)
64 #pragma clang diagnostic push
65 #pragma clang diagnostic ignored "-Woverloaded-virtual"
66 #endif
67 
68  virtual void Print(Int_t iTrack) const;
69 #if defined(__clang__)
70 #pragma clang diagnostic pop
71 #endif
72 
73  Int_t GetPdgCode() const { return fPdgCode; }
74  Int_t GetMotherId() const { return fMotherId; }
75  Double_t GetPx() const { return fPx; }
76  Double_t GetPy() const { return fPy; }
77  Double_t GetPz() const { return fPz; }
78  Double_t GetStartX() const { return fStartX; }
79  Double_t GetStartY() const { return fStartY; }
80  Double_t GetStartZ() const { return fStartZ; }
81  Double_t GetStartT() const { return fStartT; }
82  Double_t GetMass() const;
83  Double_t GetEnergy() const;
84  Double_t GetPt() const { return TMath::Sqrt(fPx * fPx + fPy * fPy); }
85  Double_t GetP() const { return TMath::Sqrt(fPx * fPx + fPy * fPy + fPz * fPz); }
86  Double_t GetRapidity() const;
87  void GetMomentum(TVector3& momentum);
88  void Get4Momentum(TLorentzVector& momentum);
89  void GetStartVertex(TVector3& vertex);
90 
92  Int_t GetNPoints(DetectorId detId) const;
93 
95  void SetMotherId(Int_t id) { fMotherId = id; }
96  void SetNPoints(Int_t iDet, Int_t np);
97 
98  private:
100  Int_t fPdgCode;
101 
103  Int_t fMotherId;
104 
106  Double32_t fPx, fPy, fPz;
107 
109  Double32_t fStartX, fStartY, fStartZ, fStartT;
110 
126  Int_t fNPoints;
127 
128  ClassDef(FairMCTrack, 2);
129 };
130 
131 // ========== Inline functions ========================================
132 
133 inline Double_t FairMCTrack::GetEnergy() const
134 {
135  Double_t mass = GetMass();
136  return TMath::Sqrt(mass * mass + fPx * fPx + fPy * fPy + fPz * fPz);
137 }
138 
139 inline void FairMCTrack::GetMomentum(TVector3& momentum) { momentum.SetXYZ(fPx, fPy, fPz); }
140 
141 inline void FairMCTrack::Get4Momentum(TLorentzVector& momentum) { momentum.SetXYZT(fPx, fPy, fPz, GetEnergy()); }
142 
143 inline void FairMCTrack::GetStartVertex(TVector3& vertex) { vertex.SetXYZ(fStartX, fStartY, fStartZ); }
144 
145 #endif
DetectorId
Int_t GetNPoints(DetectorId detId) const
void SetNPoints(Int_t iDet, Int_t np)
Double_t GetMass() const
Definition: FairMCTrack.cxx:95
Double_t GetStartT() const
Definition: FairMCTrack.h:81
Int_t GetMotherId() const
Definition: FairMCTrack.h:74
Double_t GetPz() const
Definition: FairMCTrack.h:77
Double_t GetStartY() const
Definition: FairMCTrack.h:79
void SetMotherId(Int_t id)
Definition: FairMCTrack.h:95
Double_t GetStartX() const
Definition: FairMCTrack.h:78
Double_t GetRapidity() const
Double_t GetPx() const
Definition: FairMCTrack.h:75
void Get4Momentum(TLorentzVector &momentum)
Definition: FairMCTrack.h:141
Double_t GetP() const
Definition: FairMCTrack.h:85
Double_t GetStartZ() const
Definition: FairMCTrack.h:80
Double_t GetPt() const
Definition: FairMCTrack.h:84
void GetStartVertex(TVector3 &vertex)
Definition: FairMCTrack.h:143
Int_t GetPdgCode() const
Definition: FairMCTrack.h:73
Double_t GetPy() const
Definition: FairMCTrack.h:76
void GetMomentum(TVector3 &momentum)
Definition: FairMCTrack.h:139
virtual void Print(Int_t iTrack) const
Definition: FairMCTrack.cxx:87
Double_t GetEnergy() const
Definition: FairMCTrack.h:133
virtual ~FairMCTrack()
Definition: FairMCTrack.cxx:85