Skip to content

Commit be5a42e

Browse files
Preet-BhanjanPreet Patialibuild
authored
[PWGCF] Addition of likesign method (#12288)
Co-authored-by: Preet Pati <preet@preet-6.local> Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent b0feb9e commit be5a42e

File tree

1 file changed

+93
-35
lines changed

1 file changed

+93
-35
lines changed

PWGCF/Flow/Tasks/resonancesGfwFlow.cxx

Lines changed: 93 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ namespace
6666
{
6767
std::vector<std::shared_ptr<TProfile>> refV2;
6868
std::vector<std::shared_ptr<TProfile3D>> phiV2;
69+
std::vector<std::shared_ptr<TProfile3D>> lsPhiV2;
6970
std::vector<std::shared_ptr<TProfile3D>> k0V2;
7071
std::vector<std::shared_ptr<TProfile3D>> lambdaV2;
7172

7273
std::vector<std::vector<std::shared_ptr<TProfile>>> refBoot;
7374
std::vector<std::vector<std::shared_ptr<TProfile3D>>> phiBoot;
75+
std::vector<std::vector<std::shared_ptr<TProfile3D>>> lsPhiBoot;
7476
std::vector<std::vector<std::shared_ptr<TProfile3D>>> k0Boot;
7577
std::vector<std::vector<std::shared_ptr<TProfile3D>>> lambdaBoot;
7678
} // namespace
@@ -203,7 +205,7 @@ struct ResonancesGfwFlow {
203205
O2_DEFINE_CONFIGURABLE(cfgUseBootStrap, bool, true, "Use bootstrap for error estimation")
204206
O2_DEFINE_CONFIGURABLE(cfgTrackDensityCorrUse, bool, true, "Use track density efficiency correction")
205207
O2_DEFINE_CONFIGURABLE(cfgV0AT0Acut, int, 5, "V0AT0A cut")
206-
208+
O2_DEFINE_CONFIGURABLE(cfgUseLsPhi, bool, true, "Use LikeSign for Phi v2")
207209
O2_DEFINE_CONFIGURABLE(cfgUseOnlyTPC, bool, true, "Use only TPC PID for daughter selection")
208210
O2_DEFINE_CONFIGURABLE(cfgUseStrictPID, bool, true, "Use strict PID cuts for TPC")
209211
O2_DEFINE_CONFIGURABLE(cfgUseAsymmetricPID, bool, false, "Use asymmetric PID cuts")
@@ -314,6 +316,7 @@ struct ResonancesGfwFlow {
314316

315317
refBoot.resize(cfgNbootstrap);
316318
phiBoot.resize(cfgNbootstrap);
319+
lsPhiBoot.resize(cfgNbootstrap);
317320
k0Boot.resize(cfgNbootstrap);
318321
lambdaBoot.resize(cfgNbootstrap);
319322

@@ -328,6 +331,14 @@ struct ResonancesGfwFlow {
328331
} // end of bootstrap condition
329332
} // end of phi loop
330333

334+
if (cfgUseLsPhi && configs.GetHeads()[i].starts_with("LsPhi")) {
335+
lsPhiV2.push_back(histos.add<TProfile3D>(Form("h%spt", configs.GetHeads()[i].c_str()), "", {HistType::kTProfile3D, {axisPt, axisPhiMass, axisMultiplicity}}));
336+
if (cfgUseBootStrap) {
337+
for (int j = 0; j < cfgNbootstrap; ++j) {
338+
phiBoot[j].push_back(histos.add<TProfile3D>(Form("BootStrap/h%spt_boot_%d", configs.GetHeads()[i].c_str(), j), "", {HistType::kTProfile3D, {axisPt, axisPhiMass, axisMultiplicity}}));
339+
}
340+
} // end of bootstrap condition
341+
}
331342
if (resoSwitchVals[K0][kUseParticle] && configs.GetHeads()[i].starts_with("K0")) {
332343
k0V2.push_back(histos.add<TProfile3D>(Form("h%spt", configs.GetHeads()[i].c_str()), "", {HistType::kTProfile3D, {axisPt, axisK0Mass, axisMultiplicity}}));
333344
if (cfgUseBootStrap) {
@@ -357,6 +368,10 @@ struct ResonancesGfwFlow {
357368

358369
} // end of configs loop
359370

371+
if (cfgUseLsPhi) {
372+
histos.add("hLsPhiMass_sparse", "", {HistType::kTHnSparseD, {{axisPhiMass, axisPt, axisMultiplicity}}});
373+
}
374+
360375
if (resoSwitchVals[PHI][kUseParticle]) {
361376
histos.add("KaPlusTPC", "", {HistType::kTH2D, {{axisPt, axisNsigmaTPC}}});
362377
histos.add("KaMinusTPC", "", {HistType::kTH2D, {{axisPt, axisNsigmaTPC}}});
@@ -365,7 +380,6 @@ struct ResonancesGfwFlow {
365380
histos.add("hPhiPhi", "", {HistType::kTH1D, {axisPhi}});
366381
histos.add("hPhiEta", "", {HistType::kTH1D, {axisEta}});
367382
histos.add("hPhiMass_sparse", "", {HistType::kTHnSparseD, {{axisPhiMass, axisPt, axisMultiplicity}}});
368-
histos.add("hPhimassSparse_RD", "", {HistType::kTHnSparseD, {{axisPhiMass, axisPt, axisMultiplicity}}});
369383

370384
histos.add("hPhiCount", "Number of Phi;; Count", {HistType::kTH1D, {{5, 0, 5}}});
371385
histos.get<TH1>(HIST("hPhiCount"))->GetXaxis()->SetBinLabel(1, "Phi candidates");
@@ -878,6 +892,35 @@ struct ResonancesGfwFlow {
878892
}
879893
}
880894

895+
template <typename TTrack>
896+
bool selectionV0Daughter(TTrack const& track, int pid)
897+
{
898+
if (!(track.itsNCls() > cfgITScluster))
899+
return 0;
900+
if (!track.hasTPC())
901+
return false;
902+
if (track.tpcNClsFound() < cfgTpcCluster)
903+
return false;
904+
if (!(track.tpcNClsCrossedRows() > cfgTpcCrossRows))
905+
return 0;
906+
907+
if (cfgUseOnlyTPC) {
908+
if (pid == PIONS && std::abs(track.tpcNSigmaPi()) > cfgTpcCut)
909+
return false;
910+
if (pid == KAONS && std::abs(track.tpcNSigmaKa()) > cfgTpcCut)
911+
return false;
912+
if (pid == PROTONS && std::abs(track.tpcNSigmaPr()) > cfgTpcCut)
913+
return false;
914+
} else {
915+
int partIndex = cfgUseAsymmetricPID ? getNsigmaPIDAssymmetric(track) : getNsigmaPIDTpcTof(track);
916+
int pidIndex = partIndex - 1; // 0 = pion, 1 = kaon, 2 = proton
917+
if (pidIndex != pid)
918+
return false;
919+
}
920+
921+
return true;
922+
}
923+
881924
template <typename TTrack, typename vector, char... chars, typename TCollision>
882925
void resurrectPhi(TTrack trackplus, TTrack trackminus, const TCollision collision, vector plusdaug, vector minusdaug, vector mom, double plusmass, const ConstStr<chars...>& hist)
883926
{
@@ -900,13 +943,6 @@ struct ResonancesGfwFlow {
900943
histos.fill(HIST("KaMinusTPC"), partminus.pt(), partminus.tpcNSigmaKa());
901944
histos.fill(HIST("KaMinusTOF"), partminus.pt(), partminus.tofNSigmaKa());
902945

903-
std::array<std::array<double, 3>, 2> ptarr = {{{partplus.px(), partplus.py(), partplus.pz()}, {partminus.px(), partminus.py(), partminus.pz()}}};
904-
std::array<double, 2> massarr = {plusmass, plusmass};
905-
906-
// Calculation using RecoDecay
907-
double invMassRD = RecoDecay::m2(ptarr, massarr);
908-
double ptRD = std::sqrt(RecoDecay::sumOfSquares(partplus.pt(), partminus.pt()));
909-
910946
// Calculation using ROOT vectors
911947
plusdaug = ROOT::Math::PxPyPzMVector(partplus.px(), partplus.py(), partplus.pz(), plusmass);
912948
minusdaug = ROOT::Math::PxPyPzMVector(partminus.px(), partminus.py(), partminus.pz(), plusmass);
@@ -926,7 +962,6 @@ struct ResonancesGfwFlow {
926962
histos.fill(hist, invMass, pt, collision.centFT0C());
927963
histos.fill(HIST("hPhiPhi"), phi);
928964
histos.fill(HIST("hPhiEta"), mom.Eta());
929-
histos.fill(HIST("hPhimassSparse_RD"), invMassRD, ptRD, collision.centFT0C()); // fill RecoDecay mass and pt
930965

931966
// Fill Phi weights
932967
if (cfgOutputNUAWeights && withinPtPOI) {
@@ -942,37 +977,46 @@ struct ResonancesGfwFlow {
942977
if (withinPtPOI && withinPtRef)
943978
fGFW->Fill(mom.Eta(), ((fPtAxis->FindBin(pt) - 1) * fPhiMassAxis->GetNbins()) + (fPhiMassAxis->FindBin(invMass) - 1), phi, weff * waccPOI, 32);
944979
}
945-
}
980+
} // end of combinations loop
946981
return;
947982
}
948983

949-
template <typename TTrack>
950-
bool selectionV0Daughter(TTrack const& track, int pid)
984+
template <typename TTrack, char... chars, typename TCollision>
985+
void likeSignPhi(TTrack track, const TCollision collision, double plusmass, const ConstStr<chars...>& hist)
951986
{
952-
if (!(track.itsNCls() > cfgITScluster))
953-
return 0;
954-
if (!track.hasTPC())
955-
return false;
956-
if (track.tpcNClsFound() < cfgTpcCluster)
957-
return false;
958-
if (!(track.tpcNClsCrossedRows() > cfgTpcCrossRows))
959-
return 0;
987+
ROOT::Math::PxPyPzMVector daug1, daug2, mom;
988+
for (auto const& [part1, part2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(track, track))) {
960989

961-
if (cfgUseOnlyTPC) {
962-
if (pid == PIONS && std::abs(track.tpcNSigmaPi()) > cfgTpcCut)
963-
return false;
964-
if (pid == KAONS && std::abs(track.tpcNSigmaKa()) > cfgTpcCut)
965-
return false;
966-
if (pid == PROTONS && std::abs(track.tpcNSigmaPr()) > cfgTpcCut)
967-
return false;
968-
} else {
969-
int partIndex = cfgUseAsymmetricPID ? getNsigmaPIDAssymmetric(track) : getNsigmaPIDTpcTof(track);
970-
int pidIndex = partIndex - 1; // 0 = pion, 1 = kaon, 2 = proton
971-
if (pidIndex != pid)
972-
return false;
973-
}
990+
if (!selectionV0Daughter(part1, KAONS) || !selectionV0Daughter(part2, KAONS)) // 0 = pion, 1 = kaon, 2 = proton
991+
continue;
992+
if (isFakeKaon(part1) || isFakeKaon(part2))
993+
continue;
974994

975-
return true;
995+
// Calculation using ROOT vectors
996+
daug1 = ROOT::Math::PxPyPzMVector(part1.px(), part1.py(), part1.pz(), plusmass);
997+
daug2 = ROOT::Math::PxPyPzMVector(part2.px(), part2.py(), part2.pz(), plusmass);
998+
mom = daug1 + daug2;
999+
1000+
double pt = mom.Pt();
1001+
double invMass = mom.M();
1002+
double phi = mom.Phi();
1003+
bool withinPtPOI = (cfgCutPtPOIMin < pt) && (pt < cfgCutPtPOIMax); // within POI pT range
1004+
bool withinPtRef = (cfgCutPtMin < pt) && (pt < cfgCutPtMax);
1005+
1006+
phi = RecoDecay::constrainAngle(phi, 0.0, 1); // constrain azimuthal angle to [0,2pi]
1007+
1008+
if (std::abs(mom.Rapidity()) < resoCutVals[PHI][kRapidity]) {
1009+
histos.fill(hist, invMass, pt, collision.centFT0C());
1010+
double weff = 1;
1011+
double waccPOI = 1;
1012+
1013+
if (withinPtPOI)
1014+
fGFW->Fill(mom.Eta(), ((fPtAxis->FindBin(pt) - 1) * fPhiMassAxis->GetNbins()) + (fPhiMassAxis->FindBin(invMass) - 1), phi, weff * waccPOI, 512);
1015+
if (withinPtPOI && withinPtRef)
1016+
fGFW->Fill(mom.Eta(), ((fPtAxis->FindBin(pt) - 1) * fPhiMassAxis->GetNbins()) + (fPhiMassAxis->FindBin(invMass) - 1), phi, weff * waccPOI, 1024);
1017+
}
1018+
} // end of positive combinations loop
1019+
return;
9761020
}
9771021

9781022
template <typename TCollision, typename V0>
@@ -1348,6 +1392,11 @@ struct ResonancesGfwFlow {
13481392
resurrectPhi(posSlicedTracks, negSlicedTracks, collision, kaonPlus, kaonMinus, phiMom, massKaPlus, HIST("hPhiMass_sparse"));
13491393
}
13501394

1395+
if (cfgUseLsPhi) {
1396+
likeSignPhi(posSlicedTracks, collision, massKaPlus, HIST("hLsPhiMass_sparse"));
1397+
likeSignPhi(negSlicedTracks, collision, massKaPlus, HIST("hLsPhiMass_sparse"));
1398+
}
1399+
13511400
// ---------------------- Analyzing the V0s
13521401
for (auto const& v0s : V0s) {
13531402
if (resoSwitchVals[K0][kUseParticle]) {
@@ -1374,6 +1423,15 @@ struct ResonancesGfwFlow {
13741423
}
13751424
} // end of phi condition
13761425

1426+
if (cfgUseLsPhi && corrconfigs.at(i).Head.starts_with("LsPhi")) {
1427+
int pIndex = findComponent(lsPhiV2, Form("h%spt", corrconfigs.at(i).Head.c_str()));
1428+
fillProfileBoot3D(corrconfigs.at(i), lsPhiV2[pIndex], cent, fPhiMassAxis);
1429+
1430+
if (cfgUseBootStrap) {
1431+
fillProfileBoot3D(corrconfigs.at(i), phiBoot[bootId][pIndex], cent, fPhiMassAxis);
1432+
}
1433+
} // end of LikeSign phi condition
1434+
13771435
if (resoSwitchVals[K0][kUseParticle] && corrconfigs.at(i).Head.starts_with("K0")) {
13781436
int pIndex = findComponent(k0V2, Form("h%spt", corrconfigs.at(i).Head.c_str()));
13791437
fillProfileBoot3D(corrconfigs.at(i), k0V2[pIndex], cent, fK0MassAxis);

0 commit comments

Comments
 (0)