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