10#include "FemtoFreezoutsAna.h"
14#include "FemtoConst.h"
15#include "FemtoFastCut.h"
16#include "FemtoFreezoutGenerator.h"
18#include "HistogramManager.h"
22#include <TCollection.h>
23#include <TDatabasePDG.h>
26#include <TLorentzVector.h>
28#include <TParticlePDG.h>
34 FemtoFreezoutsAna::FemtoFreezoutsAna() :
45 fUseFakeMomenta(kFALSE),
47 fFreezoutGenerator(nullptr),
48 fHistograms1d(nullptr),
49 fHistograms3d(nullptr) {
50 fBackgroundMode = kNoBackground;
52 fKinematicsMode = EMode::kPRF;
53 for (
int i = 0; i < 3; i++) {
71 fKinematicsMode(ana.fKinematicsMode),
72 fIgnoreSign(ana.fIgnoreSign),
73 fUseFakeMomenta(ana.fUseFakeMomenta),
75 fFreezoutGenerator(nullptr),
76 fHistograms1d(nullptr),
77 fHistograms3d(nullptr) {
78 if (ana.fFastCut) { fFastCut = (FemtoFastCut*) ana.fFastCut->Clone(); }
79 for (
int i = 0; i < 3; i++) {
80 fBins[i] = ana.fBins[i];
81 fHistoMin[i] = ana.fHistoMin[i];
82 fHistoMax[i] = ana.fHistoMax[i];
85 switch (ana.fKinematicsMode) {
87 fFemtoPair = Femto::MakePair(Femto::EKinematics::kPRF, ana.fUseFakeMomenta);
90 fFemtoPair = Femto::MakePair(Femto::EKinematics::kLCMS, ana.fUseFakeMomenta);
94 if (ana.fFreezoutGenerator) { fFreezoutGenerator = ana.fFreezoutGenerator->MakeCopy(); }
97 void FemtoFreezoutsAna::ComputePRF() {
98 Int_t bin = fFastCut->GetBin();
100 TLorentzVector p1, p2, x1, x2;
101 p1.SetPxPyPzE(fFemtoPair->TruePx1(), fFemtoPair->TruePy1(), fFemtoPair->TruePz1(), fFemtoPair->TrueE1());
102 p2.SetPxPyPzE(fFemtoPair->TruePx2(), fFemtoPair->TruePy2(), fFemtoPair->TruePz2(), fFemtoPair->TrueE2());
103 TLorentzVector P = p1 + p2;
104 x1.SetPxPyPzE(fFemtoPair->GetX1(), fFemtoPair->GetY1(), fFemtoPair->GetZ1(), fFemtoPair->GetT1());
105 x2.SetPxPyPzE(fFemtoPair->GetX2(), fFemtoPair->GetY2(), fFemtoPair->GetZ2(), fFemtoPair->GetT2());
106 Double_t vz = P.Pz() / P.E();
108 Double_t phi = P.Phi();
110 Double_t beta = P.Pt() / P.E();
113 p1.Boost(-beta, 0, 0);
114 if (fCut < p1.P())
return;
121 x1.Boost(-beta, 0, 0);
122 x2.Boost(-beta, 0, 0);
123 fX = x1.X() - x2.X();
124 fY = x1.Y() - x2.Y();
125 fZ = x1.Z() - x2.Z();
126 Double_t R = TMath::Sqrt(fX * fX + fY * fY + fZ * fZ);
129 fHistograms1d->Fill(fCurrentEventCollectionID, fCurrentPairCollectionID, bin, TMath::Abs(R));
131 fCurrentEventCollectionID, fCurrentPairCollectionID, bin, TMath::Abs(fX), TMath::Abs(fY), TMath::Abs(fZ));
133 fHistograms1d->Fill(fCurrentEventCollectionID, fCurrentPairCollectionID, bin, R);
134 fHistograms3d->Fill(fCurrentEventCollectionID, fCurrentPairCollectionID, bin, fX, fY, fZ);
138 void FemtoFreezoutsAna::ComputeLCMS() {
139 Int_t bin = fFastCut->GetBin();
141 TLorentzVector p1, p2, x1, x2;
142 p1.SetPxPyPzE(fFemtoPair->TruePx1(), fFemtoPair->TruePy1(), fFemtoPair->TruePz1(), fFemtoPair->TrueE1());
143 p2.SetPxPyPzE(fFemtoPair->TruePx2(), fFemtoPair->TruePy2(), fFemtoPair->TruePz2(), fFemtoPair->TrueE2());
144 TLorentzVector P = p1 + p2;
145 TLorentzVector M = p1 - p2;
146 fT = TMath::Abs(M.M());
147 if (fT > fCut)
return;
148 x1.SetPxPyPzE(fFemtoPair->GetX1(), fFemtoPair->GetY1(), fFemtoPair->GetZ1(), fFemtoPair->GetT1());
149 x2.SetPxPyPzE(fFemtoPair->GetX2(), fFemtoPair->GetY2(), fFemtoPair->GetZ2(), fFemtoPair->GetT2());
151 x1.Boost(0, 0, -P.Pz() / P.E());
152 x2.Boost(0, 0, -P.Pz() / P.E());
153 P.Boost(0, 0, -P.Pz() / P.E());
155 Double_t phi = P.Phi();
158 fX = x1.X() - x2.X();
159 fY = x1.Y() - x2.Y();
160 fZ = x1.Z() - x2.Z();
162 Double_t R = TMath::Sqrt(fX * fX + fY * fY + fZ * fZ);
165 fHistograms1d->Fill(fCurrentEventCollectionID, fCurrentPairCollectionID, bin, TMath::Abs(R));
167 fCurrentEventCollectionID, fCurrentPairCollectionID, bin, TMath::Abs(fX), TMath::Abs(fY), TMath::Abs(fZ));
169 fHistograms1d->Fill(fCurrentEventCollectionID, fCurrentPairCollectionID, bin, R);
170 fHistograms3d->Fill(fCurrentEventCollectionID, fCurrentPairCollectionID, bin, fX, fY, fZ);
174 void FemtoFreezoutsAna::ComputePRFL() {
175 Int_t bin = fFastCut->GetBin();
177 TLorentzVector p1, p2, x1, x2;
178 p1.SetPxPyPzE(fFemtoPair->TruePx1(), fFemtoPair->TruePy1(), fFemtoPair->TruePz1(), fFemtoPair->TrueE1());
179 p2.SetPxPyPzE(fFemtoPair->TruePx2(), fFemtoPair->TruePy2(), fFemtoPair->TruePz2(), fFemtoPair->TrueE2());
180 TLorentzVector P = p1 + p2;
181 TVector3 v = P.BoostVector();
183 if (p1.P() > fCut)
return;
184 x1.SetPxPyPzE(fFemtoPair->GetX1(), fFemtoPair->GetY1(), fFemtoPair->GetZ1(), fFemtoPair->GetT1());
185 x2.SetPxPyPzE(fFemtoPair->GetX2(), fFemtoPair->GetY2(), fFemtoPair->GetZ2(), fFemtoPair->GetT2());
186 TLorentzVector X = x2 - x1;
193 Double_t R = TMath::Sqrt(fX * fX + fY * fY + fZ * fZ);
196 fHistograms1d->Fill(fCurrentEventCollectionID, fCurrentPairCollectionID, bin, TMath::Abs(R));
198 fCurrentEventCollectionID, fCurrentPairCollectionID, bin, TMath::Abs(fX), TMath::Abs(fY), TMath::Abs(fZ));
200 fHistograms1d->Fill(fCurrentEventCollectionID, fCurrentPairCollectionID, bin, R);
201 fHistograms3d->Fill(fCurrentEventCollectionID, fCurrentPairCollectionID, bin, fX, fY, fZ);
205 void FemtoFreezoutsAna::ComputeLCMSGamma() {
206 Int_t bin = fFastCut->GetBin();
208 TLorentzVector p1, p2, x1, x2;
209 p1.SetPxPyPzE(fFemtoPair->TruePx1(), fFemtoPair->TruePy1(), fFemtoPair->TruePz1(), fFemtoPair->TrueE1());
210 p2.SetPxPyPzE(fFemtoPair->TruePx2(), fFemtoPair->TruePy2(), fFemtoPair->TruePz2(), fFemtoPair->TrueE2());
211 TLorentzVector P = p1 + p2;
212 TVector3 v = P.BoostVector();
213 TLorentzVector pFirst = p1;
215 if (pFirst.P() > fCut)
return;
216 x1.SetPxPyPzE(fFemtoPair->GetX1(), fFemtoPair->GetY1(), fFemtoPair->GetZ1(), fFemtoPair->GetT1());
217 x2.SetPxPyPzE(fFemtoPair->GetX2(), fFemtoPair->GetY2(), fFemtoPair->GetZ2(), fFemtoPair->GetT2());
219 Double_t vz = P.Pz() / P.E();
223 Double_t phi = P.Phi();
226 fX = x1.X() - x2.X();
227 fY = x1.Y() - x2.Y();
228 fZ = x1.Z() - x2.Z();
234 Double_t qout = p1.X() - p2.X();
237 Double_t beta = P.Pt() / P.E();
238 x1.Boost(-beta, 0, 0);
239 x2.Boost(-beta, 0, 0);
240 p1.Boost(-beta, 0, 0);
241 Double_t kstarO = p1.X();
242 Double_t rstarO = TMath::Abs(x1.X() - x2.X());
243 fX = rstarO * kstarO / qout * 2.0;
245 Double_t R = TMath::Sqrt(fX * fX + fY * fY + fZ * fZ);
248 fHistograms1d->Fill(fCurrentEventCollectionID, fCurrentPairCollectionID, bin, TMath::Abs(R));
250 fCurrentEventCollectionID, fCurrentPairCollectionID, bin, TMath::Abs(fX), TMath::Abs(fY), TMath::Abs(fZ));
252 fHistograms1d->Fill(fCurrentEventCollectionID, fCurrentPairCollectionID, bin, R);
253 fHistograms3d->Fill(fCurrentEventCollectionID, fCurrentPairCollectionID, bin, fX, fY, fZ);
257 void FemtoFreezoutsAna::ComputeRaw() {
258 Int_t bin = fFastCut->GetBin();
260 TLorentzVector p1, p2, x1, x2;
261 p1.SetPxPyPzE(fFemtoPair->TruePx1(), fFemtoPair->TruePy1(), fFemtoPair->TruePz1(), fFemtoPair->TrueE1());
262 p2.SetPxPyPzE(fFemtoPair->TruePx2(), fFemtoPair->TruePy2(), fFemtoPair->TruePz2(), fFemtoPair->TrueE2());
263 TLorentzVector P = p1 + p2;
264 x1.SetPxPyPzE(fFemtoPair->GetX1(), fFemtoPair->GetY1(), fFemtoPair->GetZ1(), fFemtoPair->GetT1());
265 x2.SetPxPyPzE(fFemtoPair->GetX2(), fFemtoPair->GetY2(), fFemtoPair->GetZ2(), fFemtoPair->GetT2());
266 Double_t vz = P.Pz() / P.E();
268 Double_t phi = P.Phi();
270 Double_t beta = P.Pt() / P.E();
273 p1.Boost(-beta, 0, 0);
274 if (fCut < p1.P())
return;
275 fX = x1.X() - x2.X();
276 fY = x1.Y() - x2.Y();
277 fZ = x1.Z() - x2.Z();
278 Double_t R = TMath::Sqrt(fX * fX + fY * fY + fZ * fZ);
281 fHistograms1d->Fill(fCurrentEventCollectionID, fCurrentPairCollectionID, bin, TMath::Abs(R));
283 fCurrentEventCollectionID, fCurrentPairCollectionID, bin, TMath::Abs(fX), TMath::Abs(fY), TMath::Abs(fZ));
285 fHistograms1d->Fill(fCurrentEventCollectionID, fCurrentPairCollectionID, bin, R);
286 fHistograms3d->Fill(fCurrentEventCollectionID, fCurrentPairCollectionID, bin, fX, fY, fZ);
290 void FemtoFreezoutsAna::ProcessFemtoPair() {
291 switch (fKinematicsMode) {
292 case EMode::kPRF: ComputePRF();
break;
293 case EMode::kLCMS: ComputeLCMS();
break;
294 case EMode::kGammaLCMS: ComputeLCMSGamma();
break;
295 case EMode::kRaw: ComputeRaw();
break;
300 void FemtoFreezoutsAna::SetMomentumCut(Double_t cut) {
302 Cout::PrintInfo(
"KSTar cut shouldn't be <=0", EInfo::kLowWarning);
308 void FemtoFreezoutsAna::SetOption(Option_t* opt) {
309 TString option = opt;
310 if (option.BeginsWith(
"background:")) {
311 Cout::PrintInfo(Form(
"%s backgrounds are not supported", this->ClassName()), EInfo::kDebugInfo);
313 }
else if (option.EqualTo(
"prf")) {
314 fKinematicsMode = EMode::kPRF;
315 }
else if (option.EqualTo(
"lcms")) {
316 fKinematicsMode = EMode::kLCMS;
317 }
else if (option.EqualTo(
"lcmsG")) {
318 fKinematicsMode = EMode::kGammaLCMS;
319 }
else if (option.EqualTo(
"use_true_momenta")) {
320 fUseFakeMomenta = kFALSE;
322 TwoTrackAna::SetOption(opt);
326 void FemtoFreezoutsAna::AddCut(
const Cut& cut, Option_t* opt) {
328 Cout::PrintInfo(
"This class not work with more than 1 event cut collection", EInfo::kLowWarning);
332 Cout::PrintInfo(
"This class not work with more than 1 track collections (2 "
333 "in case of non idental HBT",
339 Cout::PrintInfo(
"You are trying to add two track collection with tirgger "
340 ">0, it's not supported now, try add FemtoFastCut",
344 TwoTrackAna::AddCut(cut, opt);
347 Task::EInitFlag FemtoFreezoutsAna::Init() {
348 Task::EInitFlag prev = TwoTrackAna::Init();
349 if (prev == Task::EInitFlag::kFATAL)
return prev;
354 switch (fKinematicsMode) {
356 fFemtoPair = Femto::MakePair(Femto::EKinematics::kPRF, fUseFakeMomenta);
359 fFemtoPair = Femto::MakePair(Femto::EKinematics::kLCMS, fUseFakeMomenta);
362 TParticlePDG* pid1 = TDatabasePDG::Instance()->GetParticle(fPdg1);
363 TParticlePDG* pid2 = TDatabasePDG::Instance()->GetParticle(fPdg2);
364 if (pid1) { fFemtoPair->SetMass(pid1->Mass(), pid1->Mass()); }
365 if (pid2) { fFemtoPair->SetMass(pid1->Mass(), pid2->Mass()); }
366 fFemtoPair->Init(GetTaskID());
367 fFastCut->Init(fFemtoPair);
369 switch (fKinematicsMode) {
371 titles[0] =
"r^{*}_{out} [fm]";
372 titles[1] =
"r^{*}_{side}[fm]";
373 titles[2] =
"r^{*}_{long} [fm]";
374 titles[3] =
"r^{*} [fm]";
377 titles[0] =
"r_{out} [fm]";
378 titles[1] =
"r_{side}[fm]";
379 titles[2] =
"r_{long} [fm]";
380 titles[3] =
"r [fm]";
382 case EMode::kGammaLCMS: {
383 titles[0] =
"r_{out #gamma} [fm]";
384 titles[1] =
"r_{side}[fm]";
385 titles[2] =
"r_{long} [fm]";
386 titles[3] =
"r [fm]";
389 titles[0] =
"#DeltaX [fm]";
390 titles[1] =
"#DeltaY[fm]";
391 titles[2] =
"#DeltaZ [fm]";
392 titles[3] =
"#DeltaR [fm]";
395 titles[4] =
"N_{pairs}";
396 for (
int i = 0; i < 3; i++)
397 axis[i] =
new HistogramAxisConf(titles[i], fBins[i], fHistoMin[i], fHistoMax[i]);
398 axis[3] =
new HistogramAxisConf(titles[3], fBins[0], fHistoMin[0], fHistoMax[0]);
399 axis[4] =
new HistogramAxisConf(titles[4], fBins[0], fHistoMin[0], fHistoMax[0]);
401 fHistograms1d->Init(fEventCollectionsNo, fTwoTrackCollectionsNo, fFastCut->GetNBins(), axis + 3,
"Freezouts1d", kFALSE);
402 fHistograms3d->Init(fEventCollectionsNo, fTwoTrackCollectionsNo, fFastCut->GetNBins(), axis,
"Freezouts3d", kFALSE);
403 for (
int i = -0; i < 5; i++) {
407 return Task::EInitFlag::kSUCCESS;
411 Package* pack = TwoTrackAna::Report();
412 if (fKinematicsMode == EMode::kPRF) {
414 }
else if (fKinematicsMode == EMode::kLCMS) {
415 AddToAnaMetadata(pack,
new ParameterString(
"FemtoKinematics",
"LCMS"));
416 }
else if (fKinematicsMode == EMode::kGammaLCMS) {
417 AddToAnaMetadata(pack,
new ParameterString(
"FemtoKinematics",
"LCMS+Gamma"));
419 if (fFreezoutGenerator) {
420 AddToAnaMetadata(pack,
new ParameterString(
"FreezoutGenerator",
"Enabled"));
421 AddToAnaMetadata(pack, fFreezoutGenerator->
Report());
423 AddToAnaMetadata(pack,
new ParameterString(
"FreezoutGenerator",
"Disabled"));
426 AddToAnaMetadata(pack,
new ParameterInt(
"Assumed pdg_{1}", fPdg1));
427 AddToAnaMetadata(pack,
new ParameterInt(
"Assumed pdg_{2}", fPdg2));
429 AddToAnaMetadata(pack,
new ParameterBool(
"IgnoreSign", fIgnoreSign));
430 TList* list = fHistograms1d->GetFlatList();
431 for (
int i = 0; i < list->GetEntries(); i++) {
435 list = fHistograms3d->GetFlatList();
436 for (
int i = 0; i < list->GetEntries(); i++) {
440 AddToAnaMetadata(pack, fFastCut->
Report());
445 void FemtoFreezoutsAna::ProcessPair() {
446 fFemtoPair->Build(fCurrentSignalPair);
447 PreprocessFemtoPair();
451 void FemtoFreezoutsAna::PreprocessFemtoPair() {
452 if (fFreezoutGenerator) fFreezoutGenerator->GenerateFreezoutCooordinates(fFemtoPair);
455 FemtoFreezoutsAna::~FemtoFreezoutsAna() {
456 delete fHistograms1d;
457 delete fHistograms3d;
461 void FemtoFreezoutsAna::SetAxes(Int_t bins, Double_t min, Double_t max) {
462 for (
int i = 0; i < 3; i++) {
469 void FemtoFreezoutsAna::SetOutAxis(Int_t bins, Double_t min, Double_t max) {
476 void FemtoFreezoutsAna::SetSideAxis(Int_t bins, Double_t min, Double_t max) {
483 void FemtoFreezoutsAna::SetLongAxis(Int_t bins, Double_t min, Double_t max) {
ECutUpdate GetUpdateRatio() const
Int_t GetCollectionID() const
void AddObject(TObject *object)