@@ -2304,6 +2304,123 @@ struct Phik0shortanalysis {
23042304 }
23052305
23062306 PROCESS_SWITCH (Phik0shortanalysis, processPhiK0SPionData2D, " Process function for Phi-K0S and Phi-Pion Correlations in Data2D" , false );
2307+
2308+ void processPhiK0SPionMCClosure2D (SimCollisions::iterator const & collision, FullMCTracks const & fullMCTracks, FullMCV0s const & V0s, V0DauMCTracks const &, MCCollisions const &, aod::McParticles const &)
2309+ {
2310+ if (!acceptEventQA<true >(collision, true ))
2311+ return ;
2312+
2313+ if (!collision.has_mcCollision ())
2314+ return ;
2315+ mcEventHist.fill (HIST (" hRecMCEventSelection" ), 6 ); // with at least a gen collision
2316+
2317+ const auto & mcCollision = collision.mcCollision_as <MCCollisions>();
2318+ float genmultiplicity = mcCollision.centFT0M ();
2319+ mcEventHist.fill (HIST (" hRecMCGenMultiplicityPercent" ), genmultiplicity);
2320+
2321+ // Defining positive and negative tracks for phi reconstruction
2322+ auto posThisColl = posMCTracks->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
2323+ auto negThisColl = negMCTracks->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
2324+
2325+ bool isCountedPhi = false ;
2326+
2327+ double weight{1.0 };
2328+
2329+ // Loop over all positive tracks
2330+ for (const auto & track1 : posThisColl) {
2331+ if (!selectionTrackResonance<true >(track1, true ) || !selectionPIDKaonpTdependent (track1))
2332+ continue ; // topological and PID selection
2333+
2334+ auto track1ID = track1.globalIndex ();
2335+
2336+ // Loop over all negative tracks
2337+ for (const auto & track2 : negThisColl) {
2338+ if (!selectionTrackResonance<true >(track2, true ) || !selectionPIDKaonpTdependent (track2))
2339+ continue ; // topological and PID selection
2340+
2341+ auto track2ID = track2.globalIndex ();
2342+ if (track2ID == track1ID)
2343+ continue ; // condition to avoid double counting of pair
2344+
2345+ ROOT::Math::PxPyPzMVector recPhi = recMother (track1, track2, massKa, massKa);
2346+ if (recPhi.Pt () < minPhiPt || recPhi.Pt () > maxPhiPt)
2347+ continue ;
2348+ if (std::abs (recPhi.Rapidity ()) > cfgYAcceptance)
2349+ continue ;
2350+
2351+ if (!isCountedPhi) {
2352+ mcEventHist.fill (HIST (" hRecMCEventSelection" ), 7 ); // at least a Phi candidate in the event
2353+ mcEventHist.fill (HIST (" hRecMCGenMultiplicityPercentWithPhi" ), genmultiplicity);
2354+ isCountedPhi = true ;
2355+ }
2356+
2357+ if (fillMethodSingleWeight)
2358+ weight *= (1 - getPhiPurity (genmultiplicity, recPhi));
2359+
2360+ closureMCPhiHist.fill (HIST (" h3PhipurMCClosure" ), genmultiplicity, recPhi.Pt (), recPhi.M ());
2361+
2362+ // V0 already reconstructed by the builder
2363+ for (const auto & v0 : V0s) {
2364+ if (cfgisRecMCWPDGForClosure1) {
2365+ if (!v0.has_mcParticle ())
2366+ continue ;
2367+ auto v0mcparticle = v0.mcParticle ();
2368+ if (v0mcparticle.pdgCode () != PDG_t::kK0Short || !v0mcparticle.isPhysicalPrimary ())
2369+ continue ;
2370+ }
2371+
2372+ const auto & posDaughterTrack = v0.posTrack_as <V0DauMCTracks>();
2373+ const auto & negDaughterTrack = v0.negTrack_as <V0DauMCTracks>();
2374+
2375+ if (!selectionV0 (v0, posDaughterTrack, negDaughterTrack))
2376+ continue ;
2377+ if (v0Configs.cfgFurtherV0Selection && !furtherSelectionV0 (v0, collision))
2378+ continue ;
2379+
2380+ if (std::abs (v0.yK0Short ()) > cfgYAcceptance)
2381+ continue ;
2382+
2383+ closureMCPhiK0SHist.fill (HIST (" h5PhiK0SMCClosure" ), 0 , genmultiplicity, v0.pt (), Vv00.mK0Short (), recPhi.M (), 1.0 );
2384+ for (size_t i = 0 ; i < cfgDeltaYAcceptanceBins->size (); i++) {
2385+ if (std::abs (v0.yK0Short () - recPhi.Rapidity ()) > cfgDeltaYAcceptanceBins->at (i))
2386+ continue ;
2387+ closureMCPhiK0SHist.fill (HIST (" h5PhiK0SMCClosure" ), i + 1 , genmultiplicity, v0.pt (), v0.mK0Short (), recPhi.M (), 1.0 );
2388+ }
2389+ }
2390+
2391+ // Loop over all primary pion candidates
2392+ for (const auto & track : fullMCTracks) {
2393+ if (cfgisRecMCWPDGForClosure1) {
2394+ if (!track.has_mcParticle ())
2395+ continue ;
2396+ auto mcTrack = track.mcParticle_as <aod::McParticles>();
2397+ if (std::abs (mcTrack.pdgCode ()) != PDG_t::kPiPlus || !mcTrack.isPhysicalPrimary ())
2398+ continue ;
2399+ }
2400+
2401+ if (!selectionPion<true , true >(track, false ))
2402+ continue ;
2403+
2404+ if (std::abs (track.rapidity (massPi)) > cfgYAcceptance)
2405+ continue ;
2406+
2407+ float nSigmaTOFPi = (track.hasTOF () ? track.tofNSigmaPi () : -999 );
2408+
2409+ closureMCPhiPionHist.fill (HIST (" h6PhiPiMCClosure" ), 0 , genmultiplicity, track.pt (), track.tpcNSigmaPi (), nSigmaTOFPi, recPhi.M (), 1.0 );
2410+ for (size_t i = 0 ; i < cfgDeltaYAcceptanceBins->size (); i++) {
2411+ if (std::abs (track.rapidity (massPi) - recPhi.Rapidity ()) > cfgDeltaYAcceptanceBins->at (i))
2412+ continue ;
2413+ closureMCPhiPionHist.fill (HIST (" h6PhiPiMCClosure" ), i + 1 , genmultiplicity, track.pt (), track.tpcNSigmaPi (), nSigmaTOFPi, recPhi.M (), 1.0 );
2414+ }
2415+ }
2416+ }
2417+ }
2418+
2419+ weight = 1 - weight;
2420+ mcEventHist.fill (HIST (" hRecMCEventSelection" ), 8 , weight); // at least a Phi in the event
2421+ }
2422+
2423+ PROCESS_SWITCH (Phik0shortanalysis, processPhiK0SPionMCClosure2D, " Process function for Phi-K0S and Phi-Pion Correlations in MCClosure2D" , false );
23072424};
23082425
23092426WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments