CbmRoot
Loading...
Searching...
No Matches
UParticle.cxx
Go to the documentation of this file.
1/* Copyright (C) 2008-2016 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig [committer] */
4
5#include "UParticle.h"
6
7#include "TParticle.h"
8
9#include <iostream>
10using namespace std;
11
12
13//____________________________________________________________________
14//
15// UParticle
16//
17// Class for particle description.
18//
19
20
21//--------------------------------------------------------------------
23 : TObject()
24 , fIndex(0)
25 , fPdg(0)
26 , fStatus(0)
27 , fParent(0)
28 , fParentDecay(0)
29 , fMate(0)
30 , fDecay(0)
31 , fChild()
32 , fPx(0.)
33 , fPy(0.)
34 , fPz(0.)
35 , fE(0.)
36 , fX(0.)
37 , fY(0.)
38 , fZ(0.)
39 , fT(0.)
40 , fWeight(0.)
41{
42 fChild[0] = 0;
43 fChild[1] = 0;
44}
45//--------------------------------------------------------------------
46
47
48//--------------------------------------------------------------------
49UParticle::UParticle(Int_t index, Int_t pdg, Int_t status, Int_t parent, Int_t parentDecay, Int_t mate, Int_t decay,
50 Int_t child[2], Double_t px, Double_t py, Double_t pz, Double_t e, Double_t x, Double_t y,
51 Double_t z, Double_t t, Double_t weight)
52 : TObject()
53 , fIndex(index)
54 , fPdg(pdg)
55 , fStatus(status)
56 , fParent(parent)
57 , fParentDecay(parentDecay)
58 , fMate(mate)
59 , fDecay(decay)
60 , fPx(px)
61 , fPy(py)
62 , fPz(pz)
63 , fE(e)
64 , fX(x)
65 , fY(y)
66 , fZ(z)
67 , fT(t)
68 , fWeight(weight)
69{
70 fChild[0] = child[0];
71 fChild[1] = child[1];
72}
73//--------------------------------------------------------------------
74
75
76//--------------------------------------------------------------------
77UParticle::UParticle(Int_t index, Int_t pdg, Int_t status, Int_t parent, Int_t parentDecay, Int_t mate, Int_t decay,
78 Int_t child[2], TLorentzVector mom, TLorentzVector pos, Double_t weight)
79 : TObject()
80 , fIndex(index)
81 , fPdg(pdg)
82 , fStatus(status)
83 , fParent(parent)
84 , fParentDecay(parentDecay)
85 , fMate(mate)
86 , fDecay(decay)
87 , fPx(mom.Px())
88 , fPy(mom.Py())
89 , fPz(mom.Pz())
90 , fE(mom.E())
91 , fX(pos.X())
92 , fY(pos.Y())
93 , fZ(pos.Z())
94 , fT(pos.T())
95 , fWeight(weight)
96{
97 fChild[0] = child[0];
98 fChild[1] = child[1];
99}
100//--------------------------------------------------------------------
101
102
103//--------------------------------------------------------------------
105 : TObject(right)
106 , fIndex(right.fIndex)
107 , fPdg(right.fPdg)
108 , fStatus(right.fStatus)
109 , fParent(right.fParent)
110 , fParentDecay(right.fParentDecay)
111 , fMate(right.fMate)
112 , fDecay(right.fDecay)
113 , fPx(right.fPx)
114 , fPy(right.fPy)
115 , fPz(right.fPz)
116 , fE(right.fE)
117 , fX(right.fX)
118 , fY(right.fY)
119 , fZ(right.fZ)
120 , fT(right.fT)
121 , fWeight(right.fWeight)
122{
123}
124//--------------------------------------------------------------------
125
126
127//--------------------------------------------------------------------
128UParticle::UParticle(const TParticle& right)
129 : TObject()
130 , fIndex(0)
131 , fPdg(right.GetPdgCode())
132 , fStatus(right.GetStatusCode())
133 , fParent(right.GetFirstMother())
134 , fParentDecay(0)
135 , fMate(0)
136 , fDecay(0)
137 , fPx(right.Px())
138 , fPy(right.Py())
139 , fPz(right.Pz())
140 , fE(right.Energy())
141 , fX(right.Vx())
142 , fY(right.Vy())
143 , fZ(right.Vz())
144 , fT(right.T())
145 , fWeight(right.GetWeight())
146{
147 fChild[0] = right.GetFirstDaughter();
148 fChild[1] = right.GetLastDaughter();
149}
150//--------------------------------------------------------------------
151
152
153//--------------------------------------------------------------------
155{
156 // Destructor
157}
158//--------------------------------------------------------------------
159
160
161//--------------------------------------------------------------------
163{
164 // Assignment operator
165 TObject::operator=(right);
166 fIndex = right.fIndex;
167 fPdg = right.fPdg;
168 fStatus = right.fStatus;
169 fParent = right.fParent;
170 fParentDecay = right.fParentDecay;
171 fMate = right.fMate;
172 fDecay = right.fDecay;
173 fChild[0] = right.fChild[0];
174 fChild[1] = right.fChild[1];
175 fPx = right.fPx;
176 fPy = right.fPy;
177 fPz = right.fPz;
178 fE = right.fE;
179 fX = right.fX;
180 fY = right.fY;
181 fZ = right.fZ;
182 fT = right.fT;
183 fWeight = right.fWeight;
184 return (*this);
185}
186//--------------------------------------------------------------------
187
188
189//--------------------------------------------------------------------
190const UParticle& UParticle::operator=(const TParticle& right)
191{
192 // Assignment operator from the TParticle
193 fIndex = 0;
194 fPdg = right.GetPdgCode();
195 fStatus = right.GetStatusCode();
196 fParent = right.GetFirstMother();
197 fParentDecay = 0;
198 fMate = 0;
199 fDecay = 0;
200 fChild[0] = right.GetFirstDaughter();
201 fChild[1] = right.GetLastDaughter();
202 fPx = right.Px();
203 fPy = right.Py();
204 fPz = right.Pz();
205 fE = right.Energy();
206 fX = right.Vx();
207 fY = right.Vy();
208 fZ = right.Vz();
209 fT = right.T();
210 fWeight = right.GetWeight();
211 return (*this);
212}
213//--------------------------------------------------------------------
214
215
216//--------------------------------------------------------------------
217Bool_t UParticle::operator==(const UParticle& right) const
218{
219 // If equal operator
220 return (
221 fIndex == right.fIndex && fPdg == right.fPdg && fStatus == right.fStatus && fParent == right.fParent
222 && fParentDecay == right.fParentDecay && fMate == right.fMate && fDecay == right.fDecay
223 && fChild[0] == right.fChild[0] && fChild[1] == right.fChild[1]
224 && ((TMath::Abs((fPx - right.fPx) / fPx) < 0.0001) || (TMath::Abs(fPx) < 1e-16 && TMath::Abs(right.fPx) < 1e-16))
225 && ((TMath::Abs((fPy - right.fPy) / fPy) < 0.0001) || (TMath::Abs(fPy) < 1e-16 && TMath::Abs(right.fPy) < 1e-16))
226 && ((TMath::Abs((fPz - right.fPz) / fPz) < 0.0001) || (TMath::Abs(fPz) < 1e-16 && TMath::Abs(right.fPz) < 1e-16))
227 && ((TMath::Abs((fE - right.fE) / fE) < 0.0001) || (TMath::Abs(fE) < 1e-16 && TMath::Abs(right.fE) < 1e-16))
228 && ((TMath::Abs((fX - right.fX) / fX) < 0.0001) || (TMath::Abs(fX) < 1e-16 && TMath::Abs(right.fX) < 1e-16))
229 && ((TMath::Abs((fY - right.fY) / fY) < 0.0001) || (TMath::Abs(fY) < 1e-16 && TMath::Abs(right.fY) < 1e-16))
230 && ((TMath::Abs((fZ - right.fZ) / fZ) < 0.0001) || (TMath::Abs(fZ) < 1e-16 && TMath::Abs(right.fZ) < 1e-16))
231 && ((TMath::Abs((fT - right.fT) / fT) < 0.0001) || (TMath::Abs(fT) < 1e-16 && TMath::Abs(right.fT) < 1e-16))
232 && ((TMath::Abs((fWeight - right.fWeight) / fWeight) < 0.0001)
233 || (TMath::Abs(fWeight) < 1e-16 && TMath::Abs(right.fWeight) < 1e-16)));
234}
235//--------------------------------------------------------------------
236
237
238//--------------------------------------------------------------------
239void UParticle::Print(Option_t* /*option*/) const
240{
241 // Print the data members to the standard output
242 cout << "------------------------------------------------" << endl
243 << "-I- Particle -I-" << endl
244 << "Index : " << fIndex << endl
245 << "PDG code : " << fPdg << endl
246 << "Status code : " << fStatus << endl
247 << "Parent index : " << fParent << endl
248 << "Parent decay index : " << fParentDecay << endl
249 << "Last collision partner : " << fMate << endl
250 << "Decay index : " << fDecay << endl
251 << "First child index : " << fChild[0] << endl
252 << "Last child index : " << fChild[1] << endl
253 << "Momentum (px, py, pz) (GeV) : (" << fPx << ", " << fPy << ", " << fPz << ")" << endl
254 << "Energy (GeV) : " << fE << endl
255 << "Position (x, y, z) (fm) : (" << fX << ", " << fY << ", " << fZ << ")" << endl
256 << "Creation time (fm) : " << fT << endl
257 << "Weight : " << fWeight << endl
258 << "------------------------------------------------" << endl;
259}
260//--------------------------------------------------------------------
261
262
ClassImp(UParticle)
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
void Print(Option_t *="") const
Int_t fStatus
Definition UParticle.h:19
Int_t fMate
Definition UParticle.h:22
const UParticle & operator=(const UParticle &right)
Double32_t fE
Definition UParticle.h:28
Int_t fChild[2]
Definition UParticle.h:24
Int_t fParentDecay
Definition UParticle.h:21
Double32_t fPz
Definition UParticle.h:27
Double_t Px() const
Definition UParticle.h:58
Int_t fIndex
Definition UParticle.h:17
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
virtual ~UParticle()
Bool_t operator==(const UParticle &right) const
Hash for CbmL1LinkKey.