Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
FemtoPair.cxx
1/*
2 * FemtoPair.cpp
3 *
4 * Created on: 29-05-2014
5 * Author: wielanek
6 */
7
8#include "FemtoPair.h"
9
10#include "ComplexTrack.h"
11#include "Cout.h"
12#include "DataFormatManager.h"
13#include "Event.h"
14#include "FemtoMiniPair.h"
15#include "McTrack.h"
16#include "Track.h"
17#include "TwoTrack.h"
18
19#include <TDatabasePDG.h>
20#include <TLorentzVector.h>
21#include <TParticlePDG.h>
22#include <cstdio>
23#include <iostream>
24
25
26namespace Hal {
27 FemtoPair::FemtoPair(Bool_t use_fake) :
28 fTrack1(NULL),
29 fTrack2(NULL),
30 fPx1(0.0),
31 fPy1(0.0),
32 fPz1(0.0),
33 fE1(0.0),
34 fPx2(0.0),
35 fPy2(0.0),
36 fPz2(0.0),
37 fE2(0.0),
38 fpx1(0.0),
39 fpy1(0.0),
40 fpz1(0.0),
41 fe1(0.0),
42 fpx2(0.0),
43 fpy2(0.0),
44 fpz2(0.0),
45 fe2(0.0),
46 fX1(0.0),
47 fY1(0.0),
48 fZ1(0.0),
49 fT1(0.0),
50 fX2(0.0),
51 fY2(0.0),
52 fZ2(0.0),
53 fT2(0.0),
54 fPdg1(0),
55 fPdg2(0),
56 fM12(-1.0),
57 fM22(-1.0),
58 fUseImgMomenta(use_fake),
59 fX(0),
60 fY(0),
61 fZ(0),
62 fT(0),
63 fWeight(1.0),
64 fMode(kNoMC),
65 fUseAbs(kFALSE) {}
66
67 void FemtoPair::SetTrueMomenta1(Double_t px, Double_t py, Double_t pz, Double_t e) {
68 fPx1 = px;
69 fPy1 = py;
70 fPz1 = pz;
71 fE1 = e;
72 }
73
74 void FemtoPair::SetTrueMomenta2(Double_t px, Double_t py, Double_t pz, Double_t e) {
75 fPx2 = px;
76 fPy2 = py;
77 fPz2 = pz;
78 fE2 = e;
79 }
80
81 Bool_t FemtoPair::Init(Int_t task_id) {
82 TDatabasePDG* pdg = TDatabasePDG::Instance();
83 TParticlePDG* part1 = pdg->GetParticle(fPdg1);
84 TParticlePDG* part2 = pdg->GetParticle(fPdg2);
85 if (part1) {
86 Double_t m1 = part1->Mass();
87 fM12 = m1 * m1;
88 }
89 if (part2) {
90 Double_t m1 = part2->Mass();
91 fM22 = m1 * m1;
92 }
93 if (task_id < 0) {
94 fMode = kNoMC;
95 return kTRUE;
96 }
97 DataFormatManager* mngr = DataFormatManager::Instance();
98 const Event* event = mngr->GetFormat(task_id);
99 Track* tr = event->GetNewTrack();
100 Bool_t use_mc = kFALSE;
101 if (tr->InheritsFrom("Hal::McTrack")) { use_mc = kTRUE; }
102 Bool_t complex = kFALSE;
103 if (tr->InheritsFrom("Hal::ComplexTrack")) { complex = kTRUE; }
104 delete tr;
105 if (use_mc) {
106 fMode = kMC;
107 } else if (complex) {
108 if (fUseImgMomenta) {
109 fMode = kComplexIm;
110 } else {
111 fMode = kComplexRe;
112 }
113 }
114 if (fUseImgMomenta) {
115 if (event->InheritsFrom("Hal::ComplexEvent")) return kTRUE;
116 Cout::PrintInfo("Cannot use fake momenta without combiend event!", EInfo::kLowWarning);
117 return kFALSE;
118 } else {
119 return kTRUE;
120 }
121 }
122
123 void FemtoPair::SetMass(Double_t m1, Double_t m2) {
124 if (m1 > 0) fM12 = m1 * m1;
125 if (m2 > 0) fM22 = m2 * m2;
126 }
127
129 fPx1 = other.TruePx1();
130 fPx2 = other.TruePx2();
131 fPy1 = other.TruePy1();
132 fPy2 = other.TruePy2();
133 fPz1 = other.TruePz1();
134 fPz2 = other.TruePz2();
135 fE1 = other.TrueE1();
136 fE2 = other.TrueE2();
137 fpx1 = other.GetPx1();
138 fpx2 = other.GetPx2();
139 fpy1 = other.GetPy1();
140 fpy2 = other.GetPy2();
141 fpz1 = other.GetPz1();
142 fpz2 = other.GetPz2();
143 fe1 = other.TrueE1();
144 fe2 = other.TrueE2();
145 fPdg1 = other.GetPdg1();
146 fPdg2 = other.GetPdg2();
147 fX1 = other.GetX1();
148 fX2 = other.GetX2();
149 fY1 = other.GetY1();
150 fY2 = other.GetY2();
151 fZ1 = other.GetZ1();
152 fZ2 = other.GetZ2();
153 fT1 = other.GetT1();
154 fT2 = other.GetT2();
155 return *this;
156 }
157
159 fTrack1 = tracks->GetTrack1();
160 fTrack2 = tracks->GetTrack2();
161 switch (fMode) {
162 case kMC: {
163 McTrack* track1 = (McTrack*) fTrack1;
164 McTrack* track2 = (McTrack*) fTrack2;
165 const TLorentzVector& p1 = track1->GetMomentum();
166 const TLorentzVector& p2 = track2->GetMomentum();
167 const TLorentzVector& pt1 = track1->GetMomentum();
168 const TLorentzVector& pt2 = track2->GetMomentum();
169 fPdg1 = track1->GetPdg();
170 fPdg2 = track2->GetPdg();
171 const TLorentzVector& x1 = track1->GetFreezoutPosition();
172 const TLorentzVector& x2 = track2->GetFreezoutPosition();
173 SetFreezoutCoord1(x1.X(), x1.Y(), x1.Z(), x1.T());
174 SetFreezoutCoord2(x2.X(), x2.Y(), x2.Z(), x2.T());
175 SetTrueMomenta1(pt1.Px(), pt1.Py(), pt1.Pz(), pt1.E());
176 SetTrueMomenta2(pt2.Px(), pt2.Py(), pt2.Pz(), pt2.E());
177 SetMomenta1(p1.Px(), p1.Py(), p1.Pz());
178 SetMomenta2(p2.Px(), p2.Py(), p2.Pz());
179
180 } break;
181 case kComplexIm: {
182 McTrack* imtr1 = (McTrack*) ((ComplexTrack*) fTrack1)->GetImgTrack();
183 McTrack* imtr2 = (McTrack*) ((ComplexTrack*) fTrack2)->GetImgTrack();
184 if (imtr1 && imtr2) {
185 const TLorentzVector& pt1 = imtr1->GetMomentum();
186 const TLorentzVector& pt2 = imtr2->GetMomentum();
187 const TLorentzVector& x1 = imtr1->GetFreezoutPosition();
188 const TLorentzVector& x2 = imtr2->GetFreezoutPosition();
189 fPdg1 = imtr1->GetPdg();
190 fPdg2 = imtr2->GetPdg();
191 SetFreezoutCoord1(x1.X(), x1.Y(), x1.Z(), x1.T());
192 SetFreezoutCoord2(x2.X(), x2.Y(), x2.Z(), x2.T());
193 SetTrueMomenta1(pt1.Px(), pt1.Py(), pt1.Pz(), pt1.E());
194 SetTrueMomenta2(pt2.Px(), pt2.Py(), pt2.Pz(), pt2.E());
195
196 } else {
197 const TLorentzVector& p1 = fTrack1->GetMomentum();
198 const TLorentzVector& p2 = fTrack2->GetMomentum();
199 const TLorentzVector& pt1 = p1;
200 const TLorentzVector& pt2 = p2;
201 SetTrueMomenta1(pt1.Px(), pt1.Py(), pt1.Pz());
202 SetTrueMomenta2(pt2.Px(), pt2.Py(), pt2.Pz());
203 }
204 const TLorentzVector& p1 = imtr1->GetMomentum();
205 const TLorentzVector& p2 = imtr2->GetMomentum();
206 SetMomenta1(p1.Px(), p1.Py(), p1.Pz());
207 SetMomenta2(p2.Px(), p2.Py(), p2.Pz());
208
209 } break;
210 case kComplexRe: {
211 McTrack* imtr1 = (McTrack*) ((ComplexTrack*) fTrack1)->GetImgTrack();
212 McTrack* imtr2 = (McTrack*) ((ComplexTrack*) fTrack2)->GetImgTrack();
213 const TLorentzVector& p1 = fTrack1->GetMomentum();
214 const TLorentzVector& p2 = fTrack2->GetMomentum();
215 if (imtr1 && imtr2) {
216 const TLorentzVector& pt1 = imtr1->GetMomentum();
217 const TLorentzVector& pt2 = imtr2->GetMomentum();
218 const TLorentzVector& x1 = imtr1->GetFreezoutPosition();
219 const TLorentzVector& x2 = imtr2->GetFreezoutPosition();
220 fPdg1 = imtr1->GetPdg();
221 fPdg2 = imtr2->GetPdg();
222 SetFreezoutCoord1(x1.X(), x1.Y(), x1.Z(), x1.T());
223 SetFreezoutCoord2(x2.X(), x2.Y(), x2.Z(), x2.T());
224 SetTrueMomenta1(pt1.Px(), pt1.Py(), pt1.Pz(), pt1.E());
225 SetTrueMomenta2(pt2.Px(), pt2.Py(), pt2.Pz(), pt2.E());
226 } else {
227 SetTrueMomenta1(p1.Px(), p1.Py(), p1.Pz());
228 SetTrueMomenta2(p2.Px(), p2.Py(), p2.Pz());
229 }
230 SetMomenta1(p1.Px(), p1.Py(), p1.Pz());
231 SetMomenta2(p2.Px(), p2.Py(), p2.Pz());
232 } break;
233 case kNoMC: {
234 const TLorentzVector& p1 = fTrack1->GetMomentum();
235 const TLorentzVector& p2 = fTrack2->GetMomentum();
236 const TLorentzVector& pt1 = p1;
237 const TLorentzVector& pt2 = p2;
238 SetTrueMomenta1(pt1.Px(), pt1.Py(), pt1.Pz());
239 SetTrueMomenta2(pt2.Px(), pt2.Py(), pt2.Pz());
240 SetMomenta1(p1.Px(), p1.Py(), p1.Pz());
241 SetMomenta2(p2.Px(), p2.Py(), p2.Pz());
242 return;
243 } break;
244 }
245 }
246
247 void FemtoPair::SetMomenta1(Double_t px, Double_t py, Double_t pz, Double_t e) {
248 fpx1 = px;
249 fpy1 = py;
250 fpz1 = pz;
251 fe1 = e;
252 }
253
254 void FemtoPair::SetMomenta2(Double_t px, Double_t py, Double_t pz, Double_t e) {
255 fpx2 = px;
256 fpy2 = py;
257 fpz2 = pz;
258 fe2 = e;
259 }
260
261 void FemtoPair::PrintInfo() const {
262 std::cout << "pair info" << std::endl;
263 Double_t m1 = TMath::Sqrt(fE1 * fE1 - fPx1 * fPx1 - fPy1 * fPy1 - fPz1 * fPz1);
264 Double_t m2 = TMath::Sqrt(fE2 * fE2 - fPx2 * fPx2 - fPy2 * fPy2 - fPz2 * fPz2);
265 printf("momenta (%.4f %.4f %.4f %.4f) (%.4f %.4f %.4f %.4f) m1 = %.4f m2 = %.4f "
266 "\n",
267 GetPx1(),
268 GetPy1(),
269 GetPz1(),
270 GetE1(),
271 GetPx2(),
272 GetPy2(),
273 GetPz2(),
274 GetE2(),
275 m1,
276 m2);
277 printf("True momenta (%.4f %.4f %.4f %.4f) (%.4f %.4f %.4f %.4f) m1 = %.4f m2 = "
278 "%.4f \n",
279 TruePx1(),
280 TruePy1(),
281 TruePz1(),
282 TrueE1(),
283 TruePx2(),
284 TruePy2(),
285 TruePz2(),
286 TrueE2(),
287 m1,
288 m2);
289 printf("coords (%.4f %.4f %.4f %.4f) (%.4f %.4f %.4f %.4f)\n",
290 GetX1(),
291 GetY1(),
292 GetZ1(),
293 GetT1(),
294 GetX2(),
295 GetY2(),
296 GetZ2(),
297 GetT2());
298 }
299
300 FemtoPair::~FemtoPair() {}
301
302 void FemtoPair::SetTrueMomenta1(Double_t px, Double_t py, Double_t pz) {
303 fPx1 = px;
304 fPy1 = py;
305 fPz1 = pz;
306 fE1 = TMath::Sqrt(fPx1 * fPx1 + fPy1 * fPy1 + fPz1 * fPz1 + fM12);
307 }
308
309 void FemtoPair::SetTrueMomenta2(Double_t px, Double_t py, Double_t pz) {
310 fPx2 = px;
311 fPy2 = py;
312 fPz2 = pz;
313 fE2 = TMath::Sqrt(fPx2 * fPx2 + fPy2 * fPy2 + fPz2 * fPz2 + fM22);
314 }
315
316 void FemtoPair::SetMomenta1(Double_t px, Double_t py, Double_t pz) {
317 fpx1 = px;
318 fpy1 = py;
319 fpz1 = pz;
320 fe1 = TMath::Sqrt(fpx1 * fpx1 + fpy1 * fpy1 + fpz1 * fpz1 + fM12);
321 }
322
323 void FemtoPair::SetMomenta2(Double_t px, Double_t py, Double_t pz) {
324 fpx2 = px;
325 fpy2 = py;
326 fpz2 = pz;
327 fe2 = TMath::Sqrt(fpx2 * fpx2 + fpy2 * fpy2 + fpz2 * fpz2 + fM22);
328 }
329
330 Double_t FemtoPair::GetKt() const {
331 Double_t tPx = fpx1 + fpx2;
332 Double_t tPy = fpy1 + fpy2;
333 return 0.5 * TMath::Sqrt(tPx * tPx + tPy * tPy);
334 }
335
336 Double_t FemtoPair::GetTrueKt() const {
337 Double_t tPx = fPx1 + fPx2;
338 Double_t tPy = fPy1 + fPy2;
339 return 0.5 * TMath::Sqrt(tPx * tPx + tPy * tPy);
340 }
341
342 void FemtoPair::SetFreezoutCoord1(Double_t x, Double_t y, Double_t z, Double_t t) {
343 fX1 = x;
344 fY1 = y;
345 fZ1 = z;
346 fT1 = t;
347 }
348
349 void FemtoPair::SetFreezoutCoord2(Double_t x, Double_t y, Double_t z, Double_t t) {
350 fX2 = x;
351 fY2 = y;
352 fZ2 = z;
353 fT2 = t;
354 }
355
357 fPx1 = other.TruePx1();
358 fPx2 = other.TruePx2();
359 fPy1 = other.TruePy1();
360 fPy2 = other.TruePy2();
361 fPz1 = other.TruePz1();
362 fPz2 = other.TruePz2();
363 fE1 = other.TrueE1();
364 fE2 = other.TrueE2();
365 fpx1 = fPx1;
366 fpx2 = fPx2;
367 fpy1 = fPy1;
368 fpy2 = fPy2;
369 fpz1 = fPz1;
370 fpz2 = fPz2;
371 fe1 = fE1;
372 fe2 = fE2;
373 return *this;
374 }
375
376 FemtoPair& FemtoPair::operator=(const FemtoMicroPair& other) {
377 fPx1 = other.TruePx1();
378 fPx2 = other.TruePx2();
379 fPy1 = other.TruePy1();
380 fPy2 = other.TruePy2();
381 fPz1 = other.TruePz1();
382 fPz2 = other.TruePz2();
383 fE1 = other.TrueE1();
384 fE2 = other.TrueE2();
385 fpx1 = other.GetPx1();
386 fpx2 = other.GetPx2();
387 fpy1 = other.GetPy1();
388 fpy2 = other.GetPy2();
389 fpz1 = other.GetPz1();
390 fpz2 = other.GetPz2();
391 fe1 = other.GetE1();
392 fe2 = other.GetE2();
393 fPdg1 = other.GetPdg1();
394 fPdg2 = other.GetPdg2();
395 return *this;
396 }
397
398 void FemtoPair::SetMomenta(const TLorentzVector& p1, const TLorentzVector& p2) {
399 SetMomenta1(p1.X(), p1.Y(), p1.Z(), p1.E());
400 SetMomenta2(p2.X(), p2.Y(), p2.Z(), p2.E());
401 }
402
403 void FemtoPair::SetTrueMomenta(const TLorentzVector& p1, const TLorentzVector& p2) {
404 SetTrueMomenta1(p1.X(), p1.Y(), p1.Z(), p1.E());
405 SetTrueMomenta2(p2.X(), p2.Y(), p2.Z(), p2.E());
406 }
407
408 void FemtoPair::SetFreezouts(const TLorentzVector& x1, const TLorentzVector& x2) {
409 SetFreezoutCoord1(x1.X(), x1.Y(), x1.Z(), x1.T());
410 SetFreezoutCoord2(x2.X(), x2.Y(), x2.Z(), x2.T());
411 }
412
413} // namespace Hal
static void PrintInfo(TString text, Hal::EInfo status)
Definition Cout.cxx:370
static DataFormatManager * Instance()
Float_t GetPy2() const
Float_t GetPx1() const
Float_t GetPx2() const
Float_t GetPz1() const
Int_t GetPdg2() const
Float_t GetPy1() const
Int_t GetPdg1() const
Float_t GetPz2() const
Float_t GetY2() const
Float_t GetZ2() const
Float_t GetX2() const
Float_t GetZ1() const
Float_t GetY1() const
Float_t GetX1() const
Float_t GetT2() const
Float_t GetT1() const
void PrintInfo() const
Double_t GetY1() const
Definition FemtoPair.h:197
Double_t fpx1
Definition FemtoPair.h:49
void SetFreezoutCoord2(Double_t x, Double_t y, Double_t z, Double_t t)
Double_t fM12
Definition FemtoPair.h:68
Double_t GetPy1() const
Definition FemtoPair.h:237
Bool_t fUseImgMomenta
Definition FemtoPair.h:72
Double_t GetPy2() const
Definition FemtoPair.h:262
Double_t fpx2
Definition FemtoPair.h:53
Double_t GetY2() const
Definition FemtoPair.h:217
Track * fTrack1
Definition FemtoPair.h:33
Double_t TruePx1() const
Definition FemtoPair.h:142
Double_t TruePy2() const
Definition FemtoPair.h:172
Double_t GetZ1() const
Definition FemtoPair.h:202
Double_t GetKt() const
Double_t GetPz1() const
Definition FemtoPair.h:242
void SetMass(Double_t m1, Double_t m2)
Double_t fX1
Definition FemtoPair.h:57
Double_t fPx1
Definition FemtoPair.h:41
Double_t TruePy1() const
Definition FemtoPair.h:147
Double_t fPx2
Definition FemtoPair.h:45
Double_t GetX2() const
Definition FemtoPair.h:212
Track * fTrack2
Definition FemtoPair.h:37
Double_t GetPx2() const
Definition FemtoPair.h:257
Double_t GetTrueKt() const
Double_t GetE2() const
Definition FemtoPair.h:272
Double_t TruePz2() const
Definition FemtoPair.h:177
Double_t GetE1() const
Definition FemtoPair.h:247
Double_t TruePx2() const
Definition FemtoPair.h:167
FemtoPair & operator=(const FemtoMiniPair &other)
FemtoPair(Bool_t enable_fake=kFALSE)
Definition FemtoPair.cxx:27
void SetFreezouts(const TLorentzVector &x1, const TLorentzVector &x2)
Double_t GetZ2() const
Definition FemtoPair.h:222
Double_t TrueE1() const
Definition FemtoPair.h:157
Double_t GetT1() const
Definition FemtoPair.h:207
void SetMomenta(const TLorentzVector &p1, const TLorentzVector &p2)
void BuildMomenta(TwoTrack *tracks)
Double_t GetPx1() const
Definition FemtoPair.h:232
Double_t TrueE2() const
Definition FemtoPair.h:182
Double_t fX2
Definition FemtoPair.h:61
void SetFreezoutCoord1(Double_t x, Double_t y, Double_t z, Double_t t)
Double_t TruePz1() const
Definition FemtoPair.h:152
void SetTrueMomenta(const TLorentzVector &p1, const TLorentzVector &p2)
Double_t GetPz2() const
Definition FemtoPair.h:267
Double_t GetT2() const
Definition FemtoPair.h:227
Double_t GetX1() const
Definition FemtoPair.h:192
Float_t TruePy2() const
Float_t TruePx2() const
Float_t TruePz2() const
Float_t TruePy1() const
Float_t TrueE1() const
Float_t TruePz1() const
Float_t TruePx1() const
Float_t TrueE2() const
virtual Int_t GetPdg() const
Definition McTrack.h:31
const TLorentzVector & GetFreezoutPosition() const
Definition McTrack.h:35
const TLorentzVector & GetMomentum() const
Definition Track.h:118
Track * GetTrack1() const
Definition TwoTrack.h:75
Track * GetTrack2() const
Definition TwoTrack.h:80