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