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