BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
UParticle.cxx
Go to the documentation of this file.
1#include <iostream>
2using namespace std;
3
4#include "TObject.h"
5#include "TParticle.h"
6#include "UParticle.h"
7
8//____________________________________________________________________
9//
10// UParticle
11//
12// Class for particle description.
13//
14
15//--------------------------------------------------------------------
17{
18 // Default constructor
20 fChild[0] = fChild[1] = 0;
21 fPx = fPy = fPz = fE = 0.;
22 fX = fY = fZ = fT = 0.;
23 fWeight = 0.;
24}
25//--------------------------------------------------------------------
26
27//--------------------------------------------------------------------
29 Int_t pdg,
30 Int_t status,
31 Int_t parent,
32 Int_t parentDecay,
33 Int_t mate,
34 Int_t decay,
35 Int_t child[2],
36 Double_t px,
37 Double_t py,
38 Double_t pz,
39 Double_t e,
40 Double_t x,
41 Double_t y,
42 Double_t z,
43 Double_t t,
44 Double_t weight)
45{
46 // Standard constructor
47 fIndex = index;
48 fPdg = pdg;
49 fStatus = status;
50 fParent = parent;
51 fParentDecay = parentDecay;
52 fMate = mate;
53 fDecay = decay;
54 fChild[0] = child[0];
55 fChild[1] = child[1];
56 fPx = px;
57 fPy = py;
58 fPz = pz;
59 fE = e;
60 fX = x;
61 fY = y;
62 fZ = z;
63 fT = t;
64 fWeight = weight;
65}
66//--------------------------------------------------------------------
67
68//--------------------------------------------------------------------
70 Int_t pdg,
71 Int_t status,
72 Int_t parent,
73 Int_t parentDecay,
74 Int_t mate,
75 Int_t decay,
76 Int_t child[2],
79 Double_t weight)
80{
81 // Standard constructor
82 fIndex = index;
83 fPdg = pdg;
84 fStatus = status;
85 fParent = parent;
86 fParentDecay = parentDecay;
87 fMate = mate;
88 fDecay = decay;
89 fChild[0] = child[0];
90 fChild[1] = child[1];
91 fPx = mom.Px();
92 fPy = mom.Py();
93 fPz = mom.Pz();
94 fE = mom.E();
95 fX = pos.X();
96 fY = pos.Y();
97 fZ = pos.Z();
98 fT = pos.T();
99 fWeight = weight;
100}
101//--------------------------------------------------------------------
102
103//--------------------------------------------------------------------
105{
106 // Copy constructor
107 *this = right;
108}
109//--------------------------------------------------------------------
110
111//--------------------------------------------------------------------
113{
114 // Copy constructor from the TParticle
115 *this = right;
116}
117//--------------------------------------------------------------------
118
119//--------------------------------------------------------------------
121{
122 // Destructor
123}
124//--------------------------------------------------------------------
125
126//--------------------------------------------------------------------
128{
129 // Assignment operator
130 fIndex = right.fIndex;
131 fPdg = right.fPdg;
132 fStatus = right.fStatus;
133 fParent = right.fParent;
135 fMate = right.fMate;
136 fDecay = right.fDecay;
137 fChild[0] = right.fChild[0];
138 fChild[1] = right.fChild[1];
139 fPx = right.fPx;
140 fPy = right.fPy;
141 fPz = right.fPz;
142 fE = right.fE;
143 fX = right.fX;
144 fY = right.fY;
145 fZ = right.fZ;
146 fT = right.fT;
147 fWeight = right.fWeight;
148 return (*this);
149}
150//--------------------------------------------------------------------
151
152//--------------------------------------------------------------------
154{
155 // Assignment operator from the TParticle
156 fIndex = 0;
157 fPdg = right.GetPdgCode();
158 fStatus = right.GetStatusCode();
159 fParent = right.GetFirstMother();
160 fParentDecay = 0;
161 fMate = 0;
162 fDecay = 0;
163 fChild[0] = right.GetFirstDaughter();
164 fChild[1] = right.GetLastDaughter();
165 fPx = right.Px();
166 fPy = right.Py();
167 fPz = right.Pz();
168 fE = right.Energy();
169 fX = right.Vx();
170 fY = right.Vy();
171 fZ = right.Vz();
172 fT = right.T();
173 fWeight = right.GetWeight();
174 return (*this);
175}
176//--------------------------------------------------------------------
177
178//--------------------------------------------------------------------
179const Bool_t UParticle::operator==(const UParticle& right) const
180{
181 // If equal operator
182 return (fIndex == right.fIndex && fPdg == right.fPdg && fStatus == right.fStatus && fParent == right.fParent
183 && fParentDecay == right.fParentDecay && fMate == right.fMate && fDecay == right.fDecay
184 && fChild[0] == right.fChild[0] && fChild[1] == right.fChild[1]
185 && ((TMath::Abs((fPx - right.fPx) / fPx) < 0.0001)
186 || (TMath::Abs(fPx) < 1e-16 && TMath::Abs(right.fPx) < 1e-16))
187 && ((TMath::Abs((fPy - right.fPy) / fPy) < 0.0001)
188 || (TMath::Abs(fPy) < 1e-16 && TMath::Abs(right.fPy) < 1e-16))
189 && ((TMath::Abs((fPz - right.fPz) / fPz) < 0.0001)
190 || (TMath::Abs(fPz) < 1e-16 && TMath::Abs(right.fPz) < 1e-16))
191 && ((TMath::Abs((fE - right.fE) / fE) < 0.0001) || (TMath::Abs(fE) < 1e-16 && TMath::Abs(right.fE) < 1e-16))
192 && ((TMath::Abs((fX - right.fX) / fX) < 0.0001) || (TMath::Abs(fX) < 1e-16 && TMath::Abs(right.fX) < 1e-16))
193 && ((TMath::Abs((fY - right.fY) / fY) < 0.0001) || (TMath::Abs(fY) < 1e-16 && TMath::Abs(right.fY) < 1e-16))
194 && ((TMath::Abs((fZ - right.fZ) / fZ) < 0.0001) || (TMath::Abs(fZ) < 1e-16 && TMath::Abs(right.fZ) < 1e-16))
195 && ((TMath::Abs((fT - right.fT) / fT) < 0.0001) || (TMath::Abs(fT) < 1e-16 && TMath::Abs(right.fT) < 1e-16))
196 && ((TMath::Abs((fWeight - right.fWeight) / fWeight) < 0.0001)
197 || (TMath::Abs(fWeight) < 1e-16 && TMath::Abs(right.fWeight) < 1e-16)));
198}
199//--------------------------------------------------------------------
200
201//--------------------------------------------------------------------
203{
204 // Print the data members to the standard output
205 cout << "------------------------------------------------" << endl
206 << "-I- Particle -I-" << endl
207 << "Index : " << fIndex << endl
208 << "PDG code : " << fPdg << endl
209 << "Status code : " << fStatus << endl
210 << "Parent index : " << fParent << endl
211 << "Parent decay index : " << fParentDecay << endl
212 << "Last collision partner : " << fMate << endl
213 << "Decay index : " << fDecay << endl
214 << "First child index : " << fChild[0] << endl
215 << "Last child index : " << fChild[1] << endl
216 << "Momentum (px, py, pz) (GeV) : (" << fPx << ", " << fPy << ", " << fPz << ")" << endl
217 << "Energy (GeV) : " << fE << endl
218 << "Position (x, y, z) (fm) : (" << fX << ", " << fY << ", " << fZ << ")" << endl
219 << "Creation time (fm) : " << fT << endl
220 << "Weight : " << fWeight << endl
221 << "------------------------------------------------" << endl;
222}
223//--------------------------------------------------------------------
bool Bool_t
int Int_t
double Double_t
const char Option_t
Double_t Y() const
Double_t Px() const
Double_t Pz() const
Double_t X() const
Double_t Py() const
Double_t E() const
Double_t Z() const
Double_t T() const
Double_t Px() const
Double_t Py() const
Int_t GetStatusCode() const
Double_t Energy() const
Int_t GetPdgCode() const
Float_t GetWeight() const
Int_t GetFirstDaughter() const
Double_t Pz() const
Int_t GetFirstMother() const
Double_t Vy() const
Double_t T() const
Double_t Vx() const
Double_t Vz() const
Int_t GetLastDaughter() const
Double32_t fX
Definition UParticle.h:29
Double32_t fPx
Definition UParticle.h:25
Double32_t fZ
Definition UParticle.h:31
Double32_t fT
Definition UParticle.h:32
UParticle()
default constructor
Definition UParticle.cxx:16
Int_t fStatus
Definition UParticle.h:19
Int_t fMate
Definition UParticle.h:22
const UParticle & operator=(const UParticle &right)
operator =
Double32_t fE
Definition UParticle.h:28
Int_t fParentDecay
Definition UParticle.h:21
Double32_t fPz
Definition UParticle.h:27
Int_t fIndex
Definition UParticle.h:17
const Bool_t operator==(const UParticle &right) const
comare tracks
Double32_t fWeight
Definition UParticle.h:33
Int_t fPdg
Definition UParticle.h:18
Int_t fDecay
Definition UParticle.h:23
Double32_t fPy
Definition UParticle.h:26
Int_t fParent
Definition UParticle.h:20
Double32_t fY
Definition UParticle.h:30
void Print(Option_t *option="")
print info about this particle
Int_t fChild[2]
Definition UParticle.h:24
virtual ~UParticle()
Double_t Abs(Double_t d)
Definition json.hpp:4446