@@ -180,6 +180,9 @@ struct Phik0shortanalysis {
180180 Configurable<bool > fillMethodSingleWeight{" fillMethodSingleWeight" , false , " Fill method Single Weight" };
181181 Configurable<bool > useEfficiency{" useEfficiency" , false , " Use efficiency for filling histograms" };
182182
183+ // Configurable for event mixing
184+ Configurable<int > cfgNoMixedEvents{" cfgNoMixedEvents" , 5 , " Number of mixed events per event" };
185+
183186 // Configurable for CCDB
184187 Configurable<bool > useCCDB{" useCCDB" , false , " Use CCDB for corrections" };
185188 Configurable<std::string> ccdbUrl{" ccdbUrl" , " http://alice-ccdb.cern.ch" , " url of the ccdb repository to use" };
@@ -230,11 +233,20 @@ struct Phik0shortanalysis {
230233 using V0DauTracks = soa::Join<aod::TracksIU, aod::TracksExtra, aod::pidTPCFullPi>;
231234 using V0DauMCTracks = soa::Join<V0DauTracks, aod::McTrackLabels>;
232235
233- // Defining the binning policy for mixed event
234- using BinningTypeVertexContributor = ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentFT0M>;
236+ // Defining binning policy, axis and pairs for mixed event
237+ ConfigurableAxis axisVertexMixing{" axisVertexMixing" , {20 , -10 , 10 }, " Z vertex axis binning for mixing" };
238+ ConfigurableAxis axisCentralityMixing{" axisCentralityMixing" , {20 , 0 , 100 }, " Multiplicity percentil binning for mixing" };
239+
240+ using BinningTypeVertexCent = ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentFT0M>;
241+ BinningTypeVertexCent binningOnVertexAndCent{{axisVertexMixing, axisCentralityMixing}, true };
242+
243+ Pair<SelCollisions, FullTracks, FullV0s, BinningTypeVertexCent> pairPhiK0S{binningOnVertexAndCent, cfgNoMixedEvents, -1 , &cache};
244+ SameKindPair<SelCollisions, FullTracks, BinningTypeVertexCent> pairPhiPion{binningOnVertexAndCent, cfgNoMixedEvents, -1 , &cache};
235245
246+ // Cache for manual slicing
236247 SliceCache cache;
237248
249+ // Positive and negative tracks partitions
238250 Partition<FullTracks> posTracks = aod::track::signed1Pt > trackConfigs.cfgCutCharge;
239251 Partition<FullTracks> negTracks = aod::track::signed1Pt < trackConfigs.cfgCutCharge;
240252
@@ -2648,7 +2660,7 @@ struct Phik0shortanalysis {
26482660
26492661 PROCESS_SWITCH (Phik0shortanalysis, processPhiK0SPionMCClosure2D, " Process function for Phi-K0S and Phi-Pion Correlations in MCClosure2D" , false );
26502662
2651- void processAllPartMCReco (SimCollisions::iterator const & collision , FullMCTracks const & fullMCTracks, FullMCV0s const & V0s, V0DauMCTracks const &, MCCollisions const &, aod::McParticles const & mcParticles)
2663+ void processAllPartMCReco (SimCollisions const & collisions , FullMCTracks const & fullMCTracks, FullMCV0s const & V0s, V0DauMCTracks const &, MCCollisions const &, aod::McParticles const & mcParticles)
26522664 {
26532665 for (const auto & collision : collisions) {
26542666 if (!acceptEventQA<true >(collision, false ))
@@ -2872,6 +2884,134 @@ struct Phik0shortanalysis {
28722884 }
28732885
28742886 PROCESS_SWITCH (Phik0shortanalysis, processAllPartMCGen, " Process function for all particles in MCGen" , false );
2887+
2888+ void processMixingEvent (SelCollisions const & collisions, FullTracks const & fullTracks, FullV0s const & V0s, V0DauTracks const &)
2889+ {
2890+ for (auto const & [collision1, tracks1, collision2, v0s2] : o2::soa::selfCombinations (binningOnPositions, cfgNoMixedEvents, -1 , collisions, collisions)) {
2891+ if (!collision1.isInelGt0 () || !collision2.isInelGt0 ())
2892+ continue ;
2893+
2894+ // Defining V0s from collision1
2895+ auto V0ThisColl = V0s.sliceByCached (aod::v0::collisionId, collision1.globalIndex (), cache);
2896+
2897+ // Defining positive and negative tracks for phi reconstruction from collision1 and collision2, respectively
2898+ auto posThisColl = posTracks->sliceByCached (aod::track::collisionId, collision1.globalIndex (), cache);
2899+ auto negThisColl = negTracks->sliceByCached (aod::track::collisionId, collision2.globalIndex (), cache);
2900+
2901+ for (const auto & v0 : V0ThisColl) {
2902+ const auto & posDaughterTrack = v0.posTrack_as <V0DauTracks>();
2903+ const auto & negDaughterTrack = v0.negTrack_as <V0DauTracks>();
2904+
2905+ // Cut on V0 dynamic columns
2906+ if (!selectionV0 (v0, posDaughterTrack, negDaughterTrack))
2907+ continue ;
2908+
2909+ TLorentzVector recK0S;
2910+ recK0S.SetXYZM (v0.px (), v0.py (), v0.pz (), v0.mK0Short ());
2911+ if (std::abs (recK0S.Rapidity ()) > cfgInclusiveDeltay)
2912+ continue ;
2913+
2914+ // Combinatorial background simulation
2915+ for (auto & [track1, track2] : o2::soa::combinations (o2::soa::CombinationsFullIndexPolicy (posThisColl, negThisColl))) {
2916+ if (!selectionTrackResonance (track1) || !selectionPIDKaon (track1) || !selectionTrackResonance (track2) || !selectionPIDKaon (track2))
2917+ continue ; // topological and PID selection
2918+
2919+ TLorentzVector recPhi;
2920+ recPhi = recMother (track1, track2, massKa, massKa);
2921+ if (std::abs (recPhi.Rapidity ()) > cfgInclusiveDeltay)
2922+ continue ;
2923+ }
2924+ }
2925+
2926+ // Defining positive and negative tracks for phi reconstruction
2927+ auto posThisColl = posTracks->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
2928+ auto negThisColl = negTracks->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
2929+
2930+ bool isCountedPhi = false ;
2931+ bool isFilledhV0 = false ;
2932+
2933+ // Loop over all positive tracks
2934+ for (const auto & track1 : posThisColl) {
2935+ if (!selectionTrackResonance<false >(track1, true ) || !selectionPIDKaonpTdependent (track1))
2936+ continue ; // topological and PID selection
2937+
2938+ dataPhiHist.fill (HIST (" hEta" ), track1.eta ());
2939+ dataPhiHist.fill (HIST (" hNsigmaKaonTPC" ), track1.tpcInnerParam (), track1.tpcNSigmaKa ());
2940+ dataPhiHist.fill (HIST (" hNsigmaKaonTOF" ), track1.tpcInnerParam (), track1.tofNSigmaKa ());
2941+
2942+ auto track1ID = track1.globalIndex ();
2943+
2944+ // Loop over all negative tracks
2945+ for (const auto & track2 : negThisColl) {
2946+ if (!selectionTrackResonance<false >(track2, true ) || !selectionPIDKaonpTdependent (track2))
2947+ continue ; // topological and PID selection
2948+
2949+ auto track2ID = track2.globalIndex ();
2950+ if (track2ID == track1ID)
2951+ continue ; // condition to avoid double counting of pair
2952+
2953+ ROOT::Math::PxPyPzMVector recPhi = recMother (track1, track2, massKa, massKa);
2954+ if (recPhi.Pt () < minPhiPt || recPhi.Pt () > maxPhiPt)
2955+ continue ;
2956+ if (std::abs (recPhi.Rapidity ()) > cfgYAcceptance)
2957+ continue ;
2958+
2959+ if (!isCountedPhi) {
2960+ dataEventHist.fill (HIST (" hEventSelection" ), 4 ); // at least a Phi candidate in the event
2961+ dataEventHist.fill (HIST (" hMultiplicityPercentWithPhi" ), multiplicity);
2962+ isCountedPhi = true ;
2963+ }
2964+
2965+ dataPhiHist.fill (HIST (" h3PhiDataNewProc" ), multiplicity, recPhi.Pt (), recPhi.M ());
2966+
2967+ // V0 already reconstructed by the builder
2968+ for (const auto & v0 : V0s) {
2969+ const auto & posDaughterTrack = v0.posTrack_as <V0DauTracks>();
2970+ const auto & negDaughterTrack = v0.negTrack_as <V0DauTracks>();
2971+
2972+ // Cut on V0 dynamic columns
2973+ if (!selectionV0 (v0, posDaughterTrack, negDaughterTrack))
2974+ continue ;
2975+ if (v0Configs.cfgFurtherV0Selection && !furtherSelectionV0 (v0, collision))
2976+ continue ;
2977+
2978+ if (!isFilledhV0) {
2979+ dataK0SHist.fill (HIST (" hDCAV0Daughters" ), v0.dcaV0daughters ());
2980+ dataK0SHist.fill (HIST (" hV0CosPA" ), v0.v0cosPA ());
2981+
2982+ // Filling the PID of the V0 daughters in the region of the K0 peak
2983+ if (lowMK0S < v0.mK0Short () && v0.mK0Short () < upMK0S) {
2984+ dataK0SHist.fill (HIST (" hNSigmaPosPionFromK0S" ), posDaughterTrack.tpcInnerParam (), posDaughterTrack.tpcNSigmaPi ());
2985+ dataK0SHist.fill (HIST (" hNSigmaNegPionFromK0S" ), negDaughterTrack.tpcInnerParam (), negDaughterTrack.tpcNSigmaPi ());
2986+ }
2987+ }
2988+
2989+ if (std::abs (v0.yK0Short ()) > cfgYAcceptance)
2990+ continue ;
2991+
2992+ dataPhiK0SHist.fill (HIST (" h5PhiK0SDataNewProc" ), v0.yK0Short () - recPhi.Rapidity (), multiplicity, v0.pt (), v0.mK0Short (), recPhi.M ());
2993+ }
2994+
2995+ isFilledhV0 = true ;
2996+
2997+ // Loop over all primary pion candidates
2998+ for (const auto & track : fullTracks) {
2999+ if (!selectionPion<true , false >(track, false ))
3000+ continue ;
3001+
3002+ if (std::abs (track.rapidity (massPi)) > cfgYAcceptance)
3003+ continue ;
3004+
3005+ float nSigmaTOFPi = (track.hasTOF () ? track.tofNSigmaPi () : -999 );
3006+
3007+ dataPhiPionHist.fill (HIST (" h6PhiPiDataNewProc" ), track.rapidity (massPi) - recPhi.Rapidity (), multiplicity, track.pt (), track.tpcNSigmaPi (), nSigmaTOFPi, recPhi.M ());
3008+ }
3009+ }
3010+ }
3011+ }
3012+ }
3013+
3014+ PROCESS_SWITCH (phik0shortanalysis, processMEPhiK0S, " Process Mixed Event for Phi-K0S Analysis" , false );
28753015};
28763016
28773017WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments