FairShip
Loading...
Searching...
No Matches
ShipParticle.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#ifndef SHIPDATA_SHIPPARTICLE_H_
6#define SHIPDATA_SHIPPARTICLE_H_
7
8#include <array> // for std::array
9
10#include "Rtypes.h" // for Double_t, Int_t, Double32_t, etc
11#include "ShipDetectorList.h" // for DetectorId
12#include "TDatabasePDG.h" // for TDatabasePDG
13#include "TLorentzVector.h" // for TLorentzVector
14#include "TMath.h" // for Sqrt
15#include "TObject.h" // for TObject
16#include "TVector3.h" // for TVector3
17
18class ShipParticle : public TObject {
19 public:
22 ShipParticle(Int_t pdg, Int_t status, Int_t mother1, Int_t mother2,
23 Int_t daughter1, Int_t daughter2, Double_t px, Double_t py,
24 Double_t pz, Double_t etot, Double_t vx, Double_t vy,
25 Double_t vz, Double_t time);
26 ShipParticle(Int_t pdg, Int_t status, Int_t mother1, Int_t mother2,
27 Int_t daughter1, Int_t daughter2, const TLorentzVector& p,
28 const TLorentzVector& v);
30 ~ShipParticle() override;
31
33 ShipParticle(const ShipParticle& particle) = default;
34 ShipParticle& operator=(const ShipParticle& particle) = default;
35
37 using TObject::Print;
38 void Print(Int_t iTrack = 0) const;
39
41 Int_t GetPdgCode() const { return fPdgCode; }
42 Int_t GetStatusCode() const { return fStatusCode; }
43 Int_t GetMother(Int_t i) const { return fMother[i]; }
44 Int_t GetFirstMother() const { return fMother[0]; }
45 Int_t GetSecondMother() const { return fMother[1]; }
46 Int_t GetDaughter(Int_t i) const { return fDaughter[i]; }
47 Int_t GetFirstDaughter() const { return fDaughter[0]; }
48 Int_t GetLastDaughter() const { return fDaughter[1]; }
49 const char* GetName() const override;
50
52 Double_t Px() const { return fPx; }
53 Double_t Py() const { return fPy; }
54 Double_t Pz() const { return fPz; }
55 Double_t P() const { return TMath::Sqrt(fPx * fPx + fPy * fPy + fPz * fPz); }
56 Double_t Pt() const { return TMath::Sqrt(fPx * fPx + fPy * fPy); }
57 Double_t Energy() const { return fE; }
58 void GetMomentum(TLorentzVector& momentum) const;
59 TLorentzVector GetMomentum() const {
60 return TLorentzVector(fPx, fPy, fPz, fE);
61 }
62 void Momentum(TLorentzVector& momentum) const { GetMomentum(momentum); }
63 Double_t GetMass() const;
64
66 Double_t Vx() const { return fVx; }
67 Double_t Vy() const { return fVy; }
68 Double_t Vz() const { return fVz; }
69 Double_t T() const { return fVt; }
70 void GetVertex(TVector3& vertex) const;
71 TVector3 GetVertex() const { return TVector3(fVx, fVy, fVz); }
72 void ProductionVertex(TLorentzVector& vertex) const {
73 vertex.SetXYZT(fVx, fVy, fVz, fVt);
74 }
75
77 // Get momentum covariance matrix elements (4x4 symmetric, 10 unique values)
78 const std::array<Double_t, 10>& GetCovP() const { return fCovP; }
79 void SetCovP(const Double_t* covElements);
80 void SetCovP(const std::array<Double_t, 10>& covElements) {
81 fCovP = covElements;
82 }
83
84 // Get vertex covariance matrix elements (3x3 symmetric, 6 unique values)
85 const std::array<Double_t, 6>& GetCovV() const { return fCovV; }
86 void SetCovV(const Double_t* covElements);
87 void SetCovV(const std::array<Double_t, 6>& covElements) {
88 fCovV = covElements;
89 }
90
92 Double_t GetDoca() const { return fDoca; }
93 void SetDoca(Double_t x) { fDoca = x; }
94
95 private:
96 // Particle identification and status
97 Int_t fPdgCode; // PDG code of the particle
98 Int_t fStatusCode; // generation status code
99 Int_t fMother[2]; // Indices of the mother particles
100 Int_t fDaughter[2]; // Indices of the daughter particles
101
102 // 4-momentum (px, py, pz, E)
103 Double_t fPx; // x component of momentum [GeV]
104 Double_t fPy; // y component of momentum [GeV]
105 Double_t fPz; // z component of momentum [GeV]
106 Double_t fE; // Energy [GeV]
107
108 // 4-vertex (vx, vy, vz, t)
109 Double_t fVx; // x of production vertex [cm]
110 Double_t fVy; // y of production vertex [cm]
111 Double_t fVz; // z of production vertex [cm]
112 Double_t fVt; // t of production vertex [ns]
113
114 // Covariance matrices stored as upper triangular elements
115 // fCovP: 4x4 symmetric momentum covariance (10 elements: 0,0; 0,1; 0,2; 0,3;
116 // 1,1; 1,2; 1,3; 2,2; 2,3; 3,3)
117 std::array<Double_t, 10> fCovP;
118 // fCovV: 3x3 symmetric vertex covariance (6 elements: 0,0; 0,1; 0,2; 1,1;
119 // 1,2; 2,2)
120 std::array<Double_t, 6> fCovV;
121
122 // Distance of closest approach
123 Double_t fDoca;
124
126};
127
128#endif // SHIPDATA_SHIPPARTICLE_H_
void SetDoca(Double_t x)
Double_t Vx() const
const std::array< Double_t, 6 > & GetCovV() const
TLorentzVector GetMomentum() const
void Momentum(TLorentzVector &momentum) const
Int_t GetFirstDaughter() const
Int_t GetDaughter(Int_t i) const
void SetCovP(const Double_t *covElements)
ShipParticle & operator=(const ShipParticle &particle)=default
Double_t Py() const
Double_t Vz() const
Int_t fDaughter[2]
std::array< Double_t, 10 > fCovP
Double_t GetDoca() const
~ShipParticle() override
Double_t P() const
Int_t fStatusCode
Int_t GetPdgCode() const
Double_t Pt() const
Int_t GetLastDaughter() const
Int_t GetSecondMother() const
Int_t GetMother(Int_t i) const
Double_t Px() const
Double_t GetMass() const
TVector3 GetVertex() const
const std::array< Double_t, 10 > & GetCovP() const
void ProductionVertex(TLorentzVector &vertex) const
Int_t fMother[2]
void SetCovP(const std::array< Double_t, 10 > &covElements)
Double_t fDoca
Double_t T() const
Int_t GetStatusCode() const
std::array< Double_t, 6 > fCovV
Double_t Energy() const
void SetCovV(const Double_t *covElements)
Int_t GetFirstMother() const
ShipParticle(const ShipParticle &particle)=default
Double_t Pz() const
ClassDefOverride(ShipParticle, 3)
void SetCovV(const std::array< Double_t, 6 > &covElements)
void Print(Int_t iTrack=0) const
Double_t Vy() const
const char * GetName() const override