Skip to content

Commit dcd2710

Browse files
committed
Process function for Phi-K0S(Pion) 2D without weight in MCReco
1 parent f4db982 commit dcd2710

File tree

1 file changed

+146
-9
lines changed

1 file changed

+146
-9
lines changed

PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx

Lines changed: 146 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,7 +2033,7 @@ struct Phik0shortanalysis {
20332033
}
20342034
}
20352035

2036-
PROCESS_SWITCH(Phik0shortanalysis, processPhiMCGen, "Process function for Phi in MCGen", false);
2036+
PROCESS_SWITCH(Phik0shortanalysis, processPhiMCGen, "Process function for Phi in MCGen (to be removed)", false);
20372037

20382038
void processPhiK0SMCGen(MCCollisions::iterator const& mcCollision, soa::SmallGroups<SimCollisions> const& collisions, aod::McParticles const& mcParticles)
20392039
{
@@ -2269,11 +2269,11 @@ struct Phik0shortanalysis {
22692269
if (std::abs(v0.yK0Short()) > cfgYAcceptance)
22702270
continue;
22712271

2272-
dataPhiK0SHist.fill(HIST("h5PhiK0SData"), 0, multiplicity, v0.pt(), v0.mK0Short(), recPhi.M(), 1.0);
2272+
dataPhiK0SHist.fill(HIST("h5PhiK0SData"), 0, multiplicity, v0.pt(), v0.mK0Short(), recPhi.M());
22732273
for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) {
22742274
if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i))
22752275
continue;
2276-
dataPhiK0SHist.fill(HIST("h5PhiK0SData"), i + 1, multiplicity, v0.pt(), v0.mK0Short(), recPhi.M(), 1.0);
2276+
dataPhiK0SHist.fill(HIST("h5PhiK0SData"), i + 1, multiplicity, v0.pt(), v0.mK0Short(), recPhi.M());
22772277
}
22782278
}
22792279

@@ -2289,11 +2289,11 @@ struct Phik0shortanalysis {
22892289

22902290
float nSigmaTOFPi = (track.hasTOF() ? track.tofNSigmaPi() : -999);
22912291

2292-
dataPhiPionHist.fill(HIST("h6PhiPiData"), 0, multiplicity, track.pt(), track.tpcNSigmaPi(), nSigmaTOFPi, recPhi.M(), 1.0);
2292+
dataPhiPionHist.fill(HIST("h6PhiPiData"), 0, multiplicity, track.pt(), track.tpcNSigmaPi(), nSigmaTOFPi, recPhi.M());
22932293
for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) {
22942294
if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i))
22952295
continue;
2296-
dataPhiPionHist.fill(HIST("h6PhiPiData"), i + 1, multiplicity, track.pt(), track.tpcNSigmaPi(), nSigmaTOFPi, recPhi.M(), 1.0);
2296+
dataPhiPionHist.fill(HIST("h6PhiPiData"), i + 1, multiplicity, track.pt(), track.tpcNSigmaPi(), nSigmaTOFPi, recPhi.M());
22972297
}
22982298
}
22992299
}
@@ -2380,11 +2380,11 @@ struct Phik0shortanalysis {
23802380
if (std::abs(v0.yK0Short()) > cfgYAcceptance)
23812381
continue;
23822382

2383-
closureMCPhiK0SHist.fill(HIST("h5PhiK0SMCClosure"), 0, genmultiplicity, v0.pt(), Vv00.mK0Short(), recPhi.M(), 1.0);
2383+
closureMCPhiK0SHist.fill(HIST("h5PhiK0SMCClosure"), 0, genmultiplicity, v0.pt(), v0.mK0Short(), recPhi.M());
23842384
for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) {
23852385
if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i))
23862386
continue;
2387-
closureMCPhiK0SHist.fill(HIST("h5PhiK0SMCClosure"), i + 1, genmultiplicity, v0.pt(), v0.mK0Short(), recPhi.M(), 1.0);
2387+
closureMCPhiK0SHist.fill(HIST("h5PhiK0SMCClosure"), i + 1, genmultiplicity, v0.pt(), v0.mK0Short(), recPhi.M());
23882388
}
23892389
}
23902390

@@ -2406,11 +2406,11 @@ struct Phik0shortanalysis {
24062406

24072407
float nSigmaTOFPi = (track.hasTOF() ? track.tofNSigmaPi() : -999);
24082408

2409-
closureMCPhiPionHist.fill(HIST("h6PhiPiMCClosure"), 0, genmultiplicity, track.pt(), track.tpcNSigmaPi(), nSigmaTOFPi, recPhi.M(), 1.0);
2409+
closureMCPhiPionHist.fill(HIST("h6PhiPiMCClosure"), 0, genmultiplicity, track.pt(), track.tpcNSigmaPi(), nSigmaTOFPi, recPhi.M());
24102410
for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) {
24112411
if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i))
24122412
continue;
2413-
closureMCPhiPionHist.fill(HIST("h6PhiPiMCClosure"), i + 1, genmultiplicity, track.pt(), track.tpcNSigmaPi(), nSigmaTOFPi, recPhi.M(), 1.0);
2413+
closureMCPhiPionHist.fill(HIST("h6PhiPiMCClosure"), i + 1, genmultiplicity, track.pt(), track.tpcNSigmaPi(), nSigmaTOFPi, recPhi.M());
24142414
}
24152415
}
24162416
}
@@ -2421,6 +2421,143 @@ struct Phik0shortanalysis {
24212421
}
24222422

24232423
PROCESS_SWITCH(Phik0shortanalysis, processPhiK0SPionMCClosure2D, "Process function for Phi-K0S and Phi-Pion Correlations in MCClosure2D", false);
2424+
2425+
void processPhiK0SPionMCReco2D(SimCollisions::iterator const& collision, FullMCTracks const& fullMCTracks, FullMCV0s const& V0s, V0DauMCTracks const&, MCCollisions const&, aod::McParticles const&)
2426+
{
2427+
if (!acceptEventQA<true>(collision, true))
2428+
return;
2429+
2430+
float multiplicity = collision.centFT0M();
2431+
mcEventHist.fill(HIST("hRecMCMultiplicityPercent"), multiplicity);
2432+
2433+
if (!collision.has_mcCollision())
2434+
return;
2435+
mcEventHist.fill(HIST("hRecMCEventSelection"), 6); // with at least a gen collision
2436+
2437+
const auto& mcCollision = collision.mcCollision_as<MCCollisions>();
2438+
float genmultiplicity = mcCollision.centFT0M();
2439+
mcEventHist.fill(HIST("hRecMCGenMultiplicityPercent"), genmultiplicity);
2440+
2441+
// Defining positive and negative tracks for phi reconstruction
2442+
auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
2443+
auto negThisColl = negMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
2444+
2445+
bool isCountedPhi = false;
2446+
2447+
// Loop over all positive tracks
2448+
for (const auto& track1 : posThisColl) {
2449+
if (!selectionTrackResonance<true>(track1, false) || !selectionPIDKaonpTdependent(track1))
2450+
continue; // topological and PID selection
2451+
2452+
auto track1ID = track1.globalIndex();
2453+
2454+
if (!track1.has_mcParticle())
2455+
continue;
2456+
auto mcTrack1 = track1.mcParticle_as<aod::McParticles>();
2457+
if (mcTrack1.pdgCode() != PDG_t::kKPlus || !mcTrack1.isPhysicalPrimary())
2458+
continue;
2459+
2460+
// Loop over all negative tracks
2461+
for (const auto& track2 : negThisColl) {
2462+
if (!selectionTrackResonance<true>(track2, false) || !selectionPIDKaonpTdependent(track2))
2463+
continue; // topological and PID selection
2464+
2465+
auto track2ID = track2.globalIndex();
2466+
if (track2ID == track1ID)
2467+
continue; // condition to avoid double counting of pair
2468+
2469+
if (!track2.has_mcParticle())
2470+
continue;
2471+
auto mcTrack2 = track2.mcParticle_as<aod::McParticles>();
2472+
if (mcTrack2.pdgCode() != PDG_t::kKMinus || !mcTrack2.isPhysicalPrimary())
2473+
continue;
2474+
2475+
bool isMCMotherPhi = false;
2476+
for (const auto& motherOfMcTrack1 : mcTrack1.mothers_as<aod::McParticles>()) {
2477+
for (const auto& motherOfMcTrack2 : mcTrack2.mothers_as<aod::McParticles>()) {
2478+
if (motherOfMcTrack1.pdgCode() != motherOfMcTrack2.pdgCode())
2479+
continue;
2480+
if (motherOfMcTrack1.globalIndex() != motherOfMcTrack2.globalIndex())
2481+
continue;
2482+
if (motherOfMcTrack1.pdgCode() != o2::constants::physics::Pdg::kPhi)
2483+
continue;
2484+
isMCMotherPhi = true;
2485+
}
2486+
}
2487+
if (!isMCMotherPhi)
2488+
continue;
2489+
2490+
ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa);
2491+
if (recPhi.Pt() < minPhiPt || recPhi.Pt() > maxPhiPt)
2492+
continue;
2493+
2494+
mcPhiHist.fill(HIST("h3PhiRapiditySmearing"), genmultiplicity, recPhi.Rapidity(), mcMotherPhi.y());
2495+
2496+
if (std::abs(recPhi.Rapidity()) > cfgYAcceptance)
2497+
continue;
2498+
2499+
if (!isCountedPhi) {
2500+
mcEventHist.fill(HIST("hRecMCEventSelection"), 7); // at least a Phi in the event
2501+
isCountedPhi = true;
2502+
}
2503+
2504+
// V0 already reconstructed by the builder
2505+
for (const auto& v0 : V0s) {
2506+
if (!v0.has_mcParticle()) {
2507+
continue;
2508+
}
2509+
2510+
auto v0mcparticle = v0.mcParticle();
2511+
if (v0mcparticle.pdgCode() != PDG_t::kK0Short || !v0mcparticle.isPhysicalPrimary())
2512+
continue;
2513+
2514+
const auto& posDaughterTrack = v0.posTrack_as<V0DauMCTracks>();
2515+
const auto& negDaughterTrack = v0.negTrack_as<V0DauMCTracks>();
2516+
2517+
// Cut on V0 dynamic columns
2518+
if (!selectionV0(v0, posDaughterTrack, negDaughterTrack))
2519+
continue;
2520+
if (v0Configs.cfgFurtherV0Selection && !furtherSelectionV0(v0, collision))
2521+
continue;
2522+
2523+
if (std::abs(v0.yK0Short()) > cfgYAcceptance)
2524+
continue;
2525+
2526+
mcPhiK0SHist.fill(HIST("h5PhiK0SMCClosure"), 0, genmultiplicity, v0.pt(), v0.mK0Short(), recPhi.M());
2527+
for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) {
2528+
if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i))
2529+
continue;
2530+
mcPhiK0SHist.fill(HIST("h5PhiK0SMCClosure"), i + 1, genmultiplicity, v0.pt(), v0.mK0Short(), recPhi.M());
2531+
}
2532+
}
2533+
2534+
// Loop over all primary pion candidates
2535+
for (const auto& track : fullMCTracks) {
2536+
if (!track.has_mcParticle())
2537+
continue;
2538+
2539+
auto mcTrack = track.mcParticle_as<aod::McParticles>();
2540+
if (std::abs(mcTrack.pdgCode()) != PDG_t::kPiPlus || !mcTrack.isPhysicalPrimary())
2541+
continue;
2542+
2543+
if (!selectionPion<true, true>(track, false))
2544+
continue;
2545+
2546+
if (std::abs(track.rapidity(massPi)) > cfgYAcceptance)
2547+
continue;
2548+
2549+
closureMCPhiPionHist.fill(HIST("h6PhiPiMCClosure"), 0, genmultiplicity, track.pt(), track.tpcNSigmaPi(), nSigmaTOFPi, recPhi.M());
2550+
for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) {
2551+
if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i))
2552+
continue;
2553+
closureMCPhiPionHist.fill(HIST("h6PhiPiMCClosure"), i + 1, genmultiplicity, track.pt(), track.tpcNSigmaPi(), nSigmaTOFPi, recPhi.M());
2554+
}
2555+
}
2556+
}
2557+
}
2558+
}
2559+
2560+
PROCESS_SWITCH(Phik0shortanalysis, processPhiK0SPionMCReco2D, "Process function for Phi-K0S and Phi-Pion Correlations Efficiency correction in MCReco2D", false);
24242561
};
24252562

24262563
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)