Skip to content

Commit deed3c8

Browse files
authored
[PWGLF] Initialize mixed event binning policy in f1-proton correlation task (#9165)
1 parent c1b7644 commit deed3c8

File tree

1 file changed

+110
-5
lines changed

1 file changed

+110
-5
lines changed

PWGLF/Tasks/Resonances/f1protoncorrelation.cxx

Lines changed: 110 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ struct f1protoncorrelation {
6262
// Event Mixing
6363
Configurable<int> nEvtMixing{"nEvtMixing", 10, "Number of events to mix"};
6464
ConfigurableAxis CfgVtxBins{"CfgVtxBins", {10, -10, 10}, "Mixing bins - z-vertex"};
65-
ConfigurableAxis CfgMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0, 20.0, 40.0, 60.0, 80.0, 500.0}, "Mixing bins - number of contributor"};
65+
ConfigurableAxis CfgMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0, 40.0, 80.0, 500.0}, "Mixing bins - number of contributor"};
6666

6767
// THnsparse bining
6868
ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {100, 1.0, 1.4}, "#it{M} (GeV/#it{c}^{2})"};
@@ -71,9 +71,12 @@ struct f1protoncorrelation {
7171
ConfigurableAxis configThnAxisPtProton{"configThnAxisPtProton", {20, 0.0, 4.}, "#it{p}_{T} (GeV/#it{c})"};
7272
ConfigurableAxis configThnAxisNsigma{"configThnAxisNsigma", {90, -9.0, 9.0}, "NsigmaCombined"};
7373

74+
// mix event bining policy
75+
ColumnBinningPolicy<aod::collision::PosZ, aod::collision::NumContrib> colBinningFemto{{CfgVtxBins, CfgMultBins}, true};
7476
// Initialize the ananlysis task
7577
void init(o2::framework::InitContext&)
7678
{
79+
colBinningFemto = {{CfgVtxBins, CfgMultBins}, true};
7780
// register histograms
7881
histos.add("hNsigmaProtonTPC", "Nsigma Proton TPC distribution", kTH2F, {{100, -5.0f, 5.0f}, {100, 0.0f, 10.0f}});
7982
histos.add("hNsigmaKaonTPC", "Nsigma Kaon TPC distribution", kTH2F, {{100, -5.0f, 5.0f}, {100, 0.0f, 10.0f}});
@@ -155,13 +158,13 @@ struct f1protoncorrelation {
155158
if (Kaon.Pt() > 0.7 && Kaon.Pt() <= 1.0 && (f1track.f1d2TPC() < -1.0 || f1track.f1d2TPC() > 2.5)) {
156159
continue;
157160
}
158-
if (Kaon.Pt() > 1.0 && (f1track.f1d2TPC() < -2.0 || f1track.f1d2TPC() > 2.0)) {
161+
if (Kaon.Pt() > 1.0 && (f1track.f1d2TPC() < -2.5 || f1track.f1d2TPC() > 2.5)) {
159162
continue;
160163
}
161164
if (Pion.Pt() < 2.0 && (f1track.f1d1TPC() < -2.5 || f1track.f1d1TPC() > 2.5)) {
162165
continue;
163166
}
164-
if (Pion.Pt() > 2.0 && (f1track.f1d1TPC() < -2.0 || f1track.f1d1TPC() > 2.0)) {
167+
if (Pion.Pt() > 2.0 && (f1track.f1d1TPC() < -2.5 || f1track.f1d1TPC() > 2.5)) {
165168
continue;
166169
}
167170
}
@@ -276,13 +279,13 @@ struct f1protoncorrelation {
276279
if (Kaon.Pt() > 0.7 && Kaon.Pt() <= 1.0 && (t1.f1d2TPC() < -1.0 || t1.f1d2TPC() > 2.5)) {
277280
continue;
278281
}
279-
if (Kaon.Pt() > 1.0 && (t1.f1d2TPC() < -2.0 || t1.f1d2TPC() > 2.0)) {
282+
if (Kaon.Pt() > 1.0 && (t1.f1d2TPC() < -2.5 || t1.f1d2TPC() > 2.5)) {
280283
continue;
281284
}
282285
if (Pion.Pt() < 2.0 && (t1.f1d1TPC() < -2.5 || t1.f1d1TPC() > 2.5)) {
283286
continue;
284287
}
285-
if (Pion.Pt() > 2.0 && (t1.f1d1TPC() < -2.0 || t1.f1d1TPC() > 2.0)) {
288+
if (Pion.Pt() > 2.0 && (t1.f1d1TPC() < -2.5 || t1.f1d1TPC() > 2.5)) {
286289
continue;
287290
}
288291
}
@@ -344,6 +347,108 @@ struct f1protoncorrelation {
344347
}
345348
}
346349
PROCESS_SWITCH(f1protoncorrelation, processME, "Process EventMixing for combinatorial background", false);
350+
void processMEOpti(aod::RedF1PEvents& collisions, aod::F1Tracks& f1tracks, aod::ProtonTracks& protontracks)
351+
{
352+
// for (auto const& [collision1, collision2] : combinations(soa::CombinationsBlockFullIndexPolicy(colBinningFemto, nEvtMixing, -1, collisions, collisions))){
353+
for (auto const& [collision1, collision2] : selfCombinations(colBinning, nEvtMixing, -1, collisions, collisions)) {
354+
// LOGF(info, "Mixed event collisions: (%d, %d)", collision1.index(), collision2.index());
355+
if (collision1.index() == collision2.index()) {
356+
continue;
357+
}
358+
auto groupF1 = f1tracks.sliceBy(tracksPerCollisionPresliceF1, collision1.globalIndex());
359+
auto groupProton = protontracks.sliceBy(tracksPerCollisionPresliceP, collision2.globalIndex());
360+
// auto groupF1 = f1tracks.sliceByCached(aod::f1protondaughter::redF1PEventId, collision1.globalIndex(), cache);
361+
// auto groupProton = protontracks.sliceByCached(aod::f1protondaughter::redF1PEventId, collision2.globalIndex(), cache);
362+
for (auto& [t1, t2] : soa::combinations(o2::soa::CombinationsFullIndexPolicy(groupF1, groupProton))) {
363+
if (t1.f1MassKaonKshort() > maxKKS0Mass) {
364+
continue;
365+
}
366+
F1.SetXYZM(t1.f1Px(), t1.f1Py(), t1.f1Pz(), t1.f1Mass());
367+
Pion.SetXYZM(t1.f1d1Px(), t1.f1d1Py(), t1.f1d1Pz(), 0.139);
368+
Kaon.SetXYZM(t1.f1d2Px(), t1.f1d2Py(), t1.f1d2Pz(), 0.493);
369+
Kshort.SetXYZM(t1.f1d3Px(), t1.f1d3Py(), t1.f1d3Pz(), 0.497);
370+
KaonKshortPair = Kaon + Kshort;
371+
if (Pion.Pt() > maxMomentumPion || Kaon.Pt() > maxMomentumKaon) {
372+
continue;
373+
}
374+
if (pdepPID) {
375+
if (Kaon.Pt() <= 0.5 && (t1.f1d2TPC() < -2.5 || t1.f1d2TPC() > 2.5)) {
376+
continue;
377+
}
378+
if (Kaon.Pt() > 0.5 && Kaon.Pt() <= 0.7 && (t1.f1d2TPC() < -1.5 || t1.f1d2TPC() > 2.5)) {
379+
continue;
380+
}
381+
if (Kaon.Pt() > 0.7 && Kaon.Pt() <= 1.0 && (t1.f1d2TPC() < -1.0 || t1.f1d2TPC() > 2.5)) {
382+
continue;
383+
}
384+
if (Kaon.Pt() > 1.0 && (t1.f1d2TPC() < -2.5 || t1.f1d2TPC() > 2.5)) {
385+
continue;
386+
}
387+
if (Pion.Pt() < 2.0 && (t1.f1d1TPC() < -2.5 || t1.f1d1TPC() > 2.5)) {
388+
continue;
389+
}
390+
if (Pion.Pt() > 2.0 && (t1.f1d1TPC() < -2.5 || t1.f1d1TPC() > 2.5)) {
391+
continue;
392+
}
393+
}
394+
if (strategyPIDPion == 1 && Pion.Pt() > momentumTOFPionMin && Pion.Pt() <= momentumTOFPionMax && t1.f1d1TOFHit() != 1) {
395+
continue;
396+
}
397+
if (strategyPIDKaon == 1 && Kaon.Pt() > momentumTOFKaonMin && Kaon.Pt() <= momentumTOFKaonMax && t1.f1d2TOFHit() != 1) {
398+
continue;
399+
}
400+
if (typeofCombined == 0) {
401+
combinedTPC = TMath::Sqrt(t1.f1d1TPC() * t1.f1d1TPC() + t1.f1d2TPC() * t1.f1d2TPC());
402+
}
403+
if (typeofCombined == 1) {
404+
combinedTPC = (t1.f1d1TPC() - t1.f1d2TPC()) / (t1.f1d1TPC() + t1.f1d2TPC());
405+
}
406+
Proton.SetXYZM(t2.protonPx(), t2.protonPy(), t2.protonPz(), 0.938);
407+
if (Proton.Pt() > momentumProtonMax) {
408+
continue;
409+
}
410+
if (Proton.P() < momentumTOFProton && TMath::Abs(t2.protonNsigmaTPC()) > 2.5) {
411+
continue;
412+
}
413+
if (Proton.P() >= momentumTOFProton && (t2.protonTOFHit() != 1 || TMath::Abs(t2.protonNsigmaTOF()) > 2.5)) {
414+
continue;
415+
}
416+
auto relative_momentum = getkstar(F1, Proton);
417+
if (t1.f1SignalStat() == 1) {
418+
histos.fill(HIST("h2MixEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M()); // F1 sign = 1 unlike, F1 sign = -1 like
419+
if (fillSparse) {
420+
histos.fill(HIST("MEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC);
421+
}
422+
}
423+
if (t1.f1SignalStat() == -1) {
424+
histos.fill(HIST("h2MixEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M());
425+
if (fillSparse) {
426+
histos.fill(HIST("MEMassLike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC);
427+
}
428+
}
429+
if (fillRotation) {
430+
for (int nrotbkg = 0; nrotbkg < 9; nrotbkg++) {
431+
auto anglestart = 5.0 * TMath::Pi() / 6.0;
432+
auto angleend = 7.0 * TMath::Pi() / 6.0;
433+
auto anglestep = (angleend - anglestart) / (1.0 * (9.0 - 1.0));
434+
auto rotangle = anglestart + nrotbkg * anglestep;
435+
auto rotKKPx = KaonKshortPair.Px() * std::cos(rotangle) - KaonKshortPair.Py() * std::sin(rotangle);
436+
auto rotKKPy = KaonKshortPair.Px() * std::sin(rotangle) + KaonKshortPair.Py() * std::cos(rotangle);
437+
KaonKshortPairRot.SetXYZM(rotKKPx, rotKKPy, KaonKshortPair.Pz(), KaonKshortPair.M());
438+
F1Rot = Pion + KaonKshortPairRot;
439+
auto relative_momentum_rot = getkstar(F1Rot, Proton);
440+
if (t1.f1SignalStat() == 1) {
441+
histos.fill(HIST("h2MixEventInvariantMassRot_mass"), relative_momentum_rot, F1Rot.Pt(), F1Rot.M());
442+
if (fillSparse) {
443+
histos.fill(HIST("MEMassRot"), F1Rot.M(), F1Rot.Pt(), Proton.Pt(), relative_momentum_rot, combinedTPC);
444+
}
445+
}
446+
}
447+
}
448+
}
449+
}
450+
}
451+
PROCESS_SWITCH(f1protoncorrelation, processMEOpti, "Process EventMixing for combinatorial background Optimal", false);
347452
};
348453

349454
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<f1protoncorrelation>(cfgc)}; }

0 commit comments

Comments
 (0)