FairShip
Loading...
Searching...
No Matches
ShipMCTrack.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// SPDX-FileCopyrightText: Copyright CERN for the benefit of the SHiP
3// Collaboration
4
5// -------------------------------------------------------------------------
6// ----- ShipMCTrack header file -----
7// -------------------------------------------------------------------------
8
15#ifndef SHIPDATA_SHIPMCTRACK_H_
16#define SHIPDATA_SHIPMCTRACK_H_
17
18#include "Rtypes.h" // for Double_t, Int_t, Double32_t, etc
19#include "ShipDetectorList.h" // for DetectorId
20#include "TLorentzVector.h" // for TLorentzVector
21#include "TMCProcess.h" // enum with process ids
22#include "TMath.h" // for Sqrt
23#include "TObject.h" // for TObject
24#include "TString.h"
25#include "TVector3.h" // for TVector3
26class TParticle;
27
28class ShipMCTrack : public TObject {
29 public:
32
34 explicit ShipMCTrack(Int_t pdgCode, Int_t motherID, Double_t px, Double_t py,
35 Double_t pz, Double_t E, Double_t x, Double_t y,
36 Double_t z, Double_t t, Int_t nPoints, Int_t eventID,
37 Int_t trackID, Double_t w);
38
40 ShipMCTrack(const ShipMCTrack& track);
41
43 explicit ShipMCTrack(TParticle* particle);
44
46 virtual ~ShipMCTrack();
47
49 using TObject::Print;
50 void Print(Int_t iTrack = 0) const;
51
53 Int_t GetPdgCode() const { return fPdgCode; }
54 Int_t GetMotherId() const { return fMotherId; }
55 Double_t GetPx() const { return fPx; }
56 Double_t GetPy() const { return fPy; }
57 Double_t GetPz() const { return fPz; }
58 Double_t GetStartX() const { return fStartX; }
59 Double_t GetStartY() const { return fStartY; }
60 Double_t GetStartZ() const { return fStartZ; }
61 Double_t GetStartT() const { return fStartT; }
62 void SetProcID(Int_t i) { fProcID = i; }
63 Int_t GetProcID() const { return fProcID; }
64 TString GetProcName() const { return TMCProcessName[fProcID]; }
65 Double_t GetMass() const;
66 Double_t GetEnergy() const;
67 Double_t GetPt() const { return TMath::Sqrt(fPx * fPx + fPy * fPy); }
68 Double_t GetP() const {
69 return TMath::Sqrt(fPx * fPx + fPy * fPy + fPz * fPz);
70 }
71 Double_t GetRapidity() const;
72 void MultiplyWeight(Double_t w) { fW = fW * w; }
73 void SetWeight(Double_t w) { fW = w; }
74 Double_t GetWeight() const;
75 void GetMomentum(TVector3& momentum);
76 void Get4Momentum(TLorentzVector& momentum);
77 void GetStartVertex(TVector3& vertex);
78
80 Int_t GetNPoints(DetectorId detId) const;
81
83 void SetMotherId(Int_t id) { fMotherId = id; }
84 void SetNPoints(Int_t iDet, Int_t np);
85 void SetEventID(const Int_t& eventID);
86 void SetTrackID(const Int_t& trackID);
87
88 private:
90 Int_t fPdgCode;
91
93 Int_t fMotherId;
94
96 Double32_t fPx, fPy, fPz, fM;
97
100
102 Double32_t fW;
103
105 Int_t fProcID;
106
122 Int_t fNPoints;
123
125 Int_t fEventID;
126
128 Int_t fTrackID;
129
131};
132
133// ========== Inline functions ========================================
134
135inline void ShipMCTrack::GetMomentum(TVector3& momentum) {
136 momentum.SetXYZ(fPx, fPy, fPz);
137}
138
139inline void ShipMCTrack::Get4Momentum(TLorentzVector& momentum) {
140 momentum.SetXYZT(fPx, fPy, fPz, GetEnergy());
141}
142
143inline void ShipMCTrack::GetStartVertex(TVector3& vertex) {
144 vertex.SetXYZ(fStartX, fStartY, fStartZ);
145}
146
147#endif // SHIPDATA_SHIPMCTRACK_H_
DetectorId
Definition: diagrams_e.h:4
Double_t GetWeight() const
Int_t fProcID
Definition: ShipMCTrack.h:105
Double_t GetStartZ() const
Definition: ShipMCTrack.h:60
Double_t GetPt() const
Definition: ShipMCTrack.h:67
void MultiplyWeight(Double_t w)
Definition: ShipMCTrack.h:72
void Print(Int_t iTrack=0) const
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
Double_t GetStartX() const
Definition: ShipMCTrack.h:58
Double_t GetRapidity() const
Double_t GetMass() const
ClassDef(ShipMCTrack, 9)
void SetWeight(Double_t w)
Definition: ShipMCTrack.h:73
void GetMomentum(TVector3 &momentum)
Definition: ShipMCTrack.h:135
Double_t GetStartY() const
Definition: ShipMCTrack.h:59
void SetTrackID(const Int_t &trackID)
Int_t fTrackID
Definition: ShipMCTrack.h:128
Double32_t fStartX
Definition: ShipMCTrack.h:99
Int_t GetProcID() const
Definition: ShipMCTrack.h:63
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
Double_t GetStartT() const
Definition: ShipMCTrack.h:61
void GetStartVertex(TVector3 &vertex)
Definition: ShipMCTrack.h:143
void SetEventID(const Int_t &eventID)
void SetProcID(Int_t i)
Definition: ShipMCTrack.h:62
Double32_t fStartT
Definition: ShipMCTrack.h:99
Double_t GetPy() const
Definition: ShipMCTrack.h:56
Double_t GetEnergy() const
Double_t GetPx() const
Definition: ShipMCTrack.h:55
Int_t GetNPoints(DetectorId detId) const
TString GetProcName() const
Definition: ShipMCTrack.h:64
Int_t GetPdgCode() const
Definition: ShipMCTrack.h:53
void Get4Momentum(TLorentzVector &momentum)
Definition: ShipMCTrack.h:139
void SetNPoints(Int_t iDet, Int_t np)
Int_t GetMotherId() const
Definition: ShipMCTrack.h:54
Int_t fMotherId
Definition: ShipMCTrack.h:93
Double_t GetP() const
Definition: ShipMCTrack.h:68
Double32_t fPz
Definition: ShipMCTrack.h:96
virtual ~ShipMCTrack()
Double32_t fPx
Definition: ShipMCTrack.h:96
void SetMotherId(Int_t id)
Definition: ShipMCTrack.h:83
Double_t GetPz() const
Definition: ShipMCTrack.h:57