@@ -154,16 +154,16 @@ struct Phik0shortanalysis {
154154 Configurable<std::vector<double >> binspTK0S{" binspTK0S" , {0.1 , 0.5 , 0.8 , 1.2 , 1.6 , 2.0 , 2.5 , 3.0 , 4.0 , 6.0 }, " pT bin limits for K0S" };
155155
156156 // Configurable on pion pT bins
157- Configurable<std::vector<double >> binspTPi{" binspTPi" , {0.3 , 0.4 , 0.5 , 0.6 , 0.8 , 1.0 , 1.2 , 1.5 , 2.0 , 3.0 }, " pT bin limits for pions" };
157+ Configurable<std::vector<double >> binspTPi{" binspTPi" , {0.2 , 0. 3 , 0.4 , 0.5 , 0.6 , 0.8 , 1.0 , 1.2 , 1.5 , 2.0 , 3.0 }, " pT bin limits for pions" };
158158
159159 // Configurables for delta y selection
160160 Configurable<int > nBinsY{" nBinsY" , 80 , " Number of bins in y axis" };
161- Configurable<int > nBinsDeltaY{" nBinsDeltaY" , 24 , " Number of bins in deltay axis" };
161+ Configurable<int > nBinsDeltaY{" nBinsDeltaY" , 20 , " Number of bins in deltay axis" };
162162 Configurable<float > cfgYAcceptance{" cfgYAcceptance" , 0 .5f , " Rapidity acceptance" };
163163 Configurable<float > cfgYAcceptanceSmear{" cfgYAcceptanceSmear" , 0 .8f , " Rapidity acceptance for smearing matrix study" };
164164 Configurable<float > cfgFCutOnDeltaY{" cfgFCutOnDeltaY" , 0 .5f , " First upper bound on Deltay selection" };
165165 Configurable<float > cfgSCutOnDeltaY{" cfgSCutOnDeltaY" , 0 .1f , " Second upper bound on Deltay selection" };
166- Configurable<std::vector<float >> cfgDeltaYAcceptanceBins{" cfgDeltaYAcceptanceBins" , {1 . 0f , 0 . 8f , 0 . 6f , 0 . 5f , 0 . 3f , 0 . 2f }, " Rapidity acceptance bins" };
166+ Configurable<std::vector<float >> cfgDeltaYAcceptanceBins{" cfgDeltaYAcceptanceBins" , {0 . 5f }, " Rapidity acceptance bins" };
167167
168168 // Configurable for RecMC
169169 Configurable<bool > cfgiskNoITSROFrameBorder{" cfgiskNoITSROFrameBorder" , false , " kNoITSROFrameBorder request on RecMC collisions" };
@@ -176,10 +176,13 @@ struct Phik0shortanalysis {
176176 // Configurables to choose the filling method
177177 Configurable<bool > fillMethodMultipleWeights{" fillMethodMultipleWeights" , true , " Fill method Multiple Weights" };
178178 Configurable<bool > fillMethodSingleWeight{" fillMethodSingleWeight" , false , " Fill method Single Weight" };
179+ Configurable<bool > useEfficiency{" useEfficiency" , false , " Use efficiency for filling histograms" };
179180
180181 // Configurable for CCDB
182+ Configurable<bool > useCCDB{" useCCDB" , false , " Use CCDB for corrections" };
181183 Configurable<std::string> ccdbUrl{" ccdbUrl" , " http://alice-ccdb.cern.ch" , " url of the ccdb repository to use" };
182184 Configurable<std::string> ccdbPurityPath{" ccdbPurityPath" , " Users/s/scannito/PhiPuritiesData" , " Correction path to file" };
185+ Configurable<std::string> ccdbEfficiencyPath{" ccdbEfficiencyPath" , " Users/s/scannito/Efficiencies" , " Correction path to file" };
183186
184187 // Constants
185188 double massKa = o2::constants::physics::MassKPlus;
@@ -248,6 +251,11 @@ struct Phik0shortanalysis {
248251 // Set of functions for phi purity
249252 std::vector<std::vector<TF1*>> phiPurityFunctions = std::vector<std::vector<TF1*>>(binsMult->size (), std::vector<TF1*>(binspTPhi->size (), nullptr));
250253
254+ // Efficiecy maps
255+ TH2F* effMapPhi;
256+ TH2F* effMapK0S;
257+ TH2F* effMapPion;
258+
251259 void init (InitContext&)
252260 {
253261 // Axes
@@ -546,13 +554,22 @@ struct Phik0shortanalysis {
546554 mcPionHist.add (" h3PiRapidityGenMC" , " Rapidity for Pion for GenMC" , kTH3F , {binnedmultAxis, binnedptPiAxis, yAxis});
547555
548556 // Initialize CCDB only if purity is requested in the task
549- if (fillMethodSingleWeight ) {
557+ if (useCCDB ) {
550558 ccdb->setURL (ccdbUrl);
551559 ccdb->setCaching (true );
552560 ccdb->setLocalObjectValidityChecking ();
553561 ccdb->setFatalWhenNull (false );
554562
555- getPhiPurityFunctionsFromCCDB ();
563+ if (fillMethodSingleWeight)
564+ getPhiPurityFunctionsFromCCDB ();
565+
566+ if (useEfficiency)
567+ getEfficiencyMapsFromCCDB ();
568+ else {
569+ effMapPhi = nullptr ;
570+ effMapK0S = nullptr ;
571+ effMapPion = nullptr ;
572+ }
556573 }
557574 }
558575
@@ -861,7 +878,7 @@ struct Phik0shortanalysis {
861878 {
862879 TList* listPhiPurityFunctions = ccdb->get <TList>(ccdbPurityPath);
863880 if (!listPhiPurityFunctions)
864- LOG (fatal ) << " Problem getting TList object with phi purity functions!" ;
881+ LOG (error ) << " Problem getting TList object with phi purity functions!" ;
865882
866883 for (size_t multIdx = 0 ; multIdx < binsMult->size () - 1 ; multIdx++) {
867884 for (size_t ptIdx = 0 ; ptIdx < binspTPhi->size () - 1 ; ptIdx++) {
@@ -898,6 +915,29 @@ struct Phik0shortanalysis {
898915 return phiPurityFunctions[multIdx][pTIdx]->Eval (Phi.M ());
899916 }
900917
918+ void getEfficiencyMapsFromCCDB ()
919+ {
920+ TList* listEfficiencyMaps = ccdb->get <TList>(ccdbEfficiencyPath);
921+ if (!listEfficiencyMaps)
922+ LOG (error) << " Problem getting TList object with efficiency maps!" ;
923+
924+ effMapPhi = static_cast <TH2F*>(listEfficiencyMaps->FindObject (" h2EfficiencyPhi" ));
925+ if (!effMapPhi) {
926+ LOG (error) << " Problem getting efficiency map for Phi!" ;
927+ return ;
928+ }
929+ effMapK0S = static_cast <TH2F*>(listEfficiencyMaps->FindObject (" h2EfficiencyK0S" ));
930+ if (!effMapK0S) {
931+ LOG (error) << " Problem getting efficiency map for K0S!" ;
932+ return ;
933+ }
934+ effMapPion = static_cast <TH2F*>(listEfficiencyMaps->FindObject (" h2EfficiencyPion" ));
935+ if (!effMapPion) {
936+ LOG (error) << " Problem getting efficiency map for Pion!" ;
937+ return ;
938+ }
939+ }
940+
901941 // Fill 2D invariant mass histogram for V0 and Phi
902942 template <bool isMC, typename T>
903943 void fillInvMass2D (const T& V0, const std::vector<ROOT::Math::PxPyPzMVector>& listPhi, float multiplicity, const std::vector<float >& weights)
@@ -2276,6 +2316,7 @@ struct Phik0shortanalysis {
22762316
22772317 PROCESS_SWITCH (Phik0shortanalysis, processPhiPionMCGen, " Process function for Phi-Pion Correlations Efficiency correction in MCGen" , false );
22782318
2319+ // dN/deta procedure
22792320 void processdNdetaWPhiData (SelCollisions::iterator const & collision, FilteredTracks const & filteredTracks)
22802321 {
22812322 // Check if the event selection is passed
@@ -2381,6 +2422,7 @@ struct Phik0shortanalysis {
23812422
23822423 PROCESS_SWITCH (Phik0shortanalysis, processdNdetaWPhiMCGen, " Process function for dN/deta values in MCGen" , false );
23832424
2425+ // 2D procedure
23842426 void processPhiK0SPionData2D (SelCollisions::iterator const & collision, FullTracks const & fullTracks, FullV0s const & V0s, V0DauTracks const &)
23852427 {
23862428 // Check if the event selection is passed
@@ -2738,18 +2780,244 @@ struct Phik0shortanalysis {
27382780
27392781 float nSigmaTOFPi = (track.hasTOF () ? track.tofNSigmaPi () : -999 );
27402782
2741- closureMCPhiPionHist .fill (HIST (" h6PhiPiMCClosure" ), 0 , genmultiplicity, track.pt (), track.tpcNSigmaPi (), nSigmaTOFPi, recPhi.M ());
2783+ mcPhiPionHist .fill (HIST (" h6PhiPiMCClosure" ), 0 , genmultiplicity, track.pt (), track.tpcNSigmaPi (), nSigmaTOFPi, recPhi.M ());
27422784 for (size_t i = 0 ; i < cfgDeltaYAcceptanceBins->size (); i++) {
27432785 if (std::abs (track.rapidity (massPi) - recPhi.Rapidity ()) > cfgDeltaYAcceptanceBins->at (i))
27442786 continue ;
2745- closureMCPhiPionHist .fill (HIST (" h6PhiPiMCClosure" ), i + 1 , genmultiplicity, track.pt (), track.tpcNSigmaPi (), nSigmaTOFPi, recPhi.M ());
2787+ mcPhiPionHist .fill (HIST (" h6PhiPiMCClosure" ), i + 1 , genmultiplicity, track.pt (), track.tpcNSigmaPi (), nSigmaTOFPi, recPhi.M ());
27462788 }
27472789 }
27482790 }
27492791 }
27502792 }
27512793
27522794 PROCESS_SWITCH (Phik0shortanalysis, processPhiK0SPionMCReco2D, " Process function for Phi-K0S and Phi-Pion Correlations Efficiency correction in MCReco2D" , false );
2795+
2796+ // New analysis procedure
2797+ void processAllPartMCReco (SimCollisions::iterator const & collision, FullMCTracks const & fullMCTracks, FullMCV0s const & V0s, V0DauMCTracks const &, MCCollisions const &, aod::McParticles const & mcParticles)
2798+ {
2799+ for (const auto & collision : collisions) {
2800+ if (!acceptEventQA<true >(collision, false ))
2801+ continue ;
2802+
2803+ if (!collision.has_mcCollision ())
2804+ continue ;
2805+
2806+ const auto & mcCollision = collision.mcCollision_as <MCCollisions>();
2807+ float genmultiplicity = mcCollision.centFT0M ();
2808+
2809+ // Defining positive and negative tracks for phi reconstruction
2810+ auto posThisColl = posMCTracks->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
2811+ auto negThisColl = negMCTracks->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
2812+
2813+ for (const auto & track1 : posThisColl) { // loop over all selected tracks
2814+ if (!selectionTrackResonance<true >(track1, false ) || !selectionPIDKaonpTdependent (track1))
2815+ continue ; // topological and PID selection
2816+
2817+ auto track1ID = track1.globalIndex ();
2818+
2819+ if (!track1.has_mcParticle ())
2820+ continue ;
2821+ auto mcTrack1 = track1.mcParticle_as <aod::McParticles>();
2822+ if (mcTrack1.pdgCode () != PDG_t::kKPlus || !mcTrack1.isPhysicalPrimary ())
2823+ continue ;
2824+
2825+ for (const auto & track2 : negThisColl) {
2826+ if (!selectionTrackResonance<true >(track2, false ) || !selectionPIDKaonpTdependent (track2))
2827+ continue ; // topological and PID selection
2828+
2829+ auto track2ID = track2.globalIndex ();
2830+ if (track2ID == track1ID)
2831+ continue ; // condition to avoid double counting of pair
2832+
2833+ if (!track2.has_mcParticle ())
2834+ continue ;
2835+ auto mcTrack2 = track2.mcParticle_as <aod::McParticles>();
2836+ if (mcTrack2.pdgCode () != PDG_t::kKMinus || !mcTrack2.isPhysicalPrimary ())
2837+ continue ;
2838+
2839+ float pTMother = -1 .0f ;
2840+ float yMother = -1 .0f ;
2841+ bool isMCMotherPhi = false ;
2842+ for (const auto & motherOfMcTrack1 : mcTrack1.mothers_as <aod::McParticles>()) {
2843+ for (const auto & motherOfMcTrack2 : mcTrack2.mothers_as <aod::McParticles>()) {
2844+ if (motherOfMcTrack1.pdgCode () != motherOfMcTrack2.pdgCode ())
2845+ continue ;
2846+ if (motherOfMcTrack1.globalIndex () != motherOfMcTrack2.globalIndex ())
2847+ continue ;
2848+ if (motherOfMcTrack1.pdgCode () != o2::constants::physics::Pdg::kPhi )
2849+ continue ;
2850+
2851+ pTMother = motherOfMcTrack1.pt ();
2852+ yMother = motherOfMcTrack1.y ();
2853+ isMCMotherPhi = true ;
2854+ }
2855+ }
2856+
2857+ if (!isMCMotherPhi)
2858+ continue ;
2859+ if (pTMother < minPhiPt || std::abs (yMother) > cfgYAcceptance)
2860+ continue ;
2861+
2862+ mcPhiHist.fill (HIST (" h2PhieffInvMass" ), genmultiplicity, recPhi.M ());
2863+ }
2864+ }
2865+
2866+ // Defining V0s in the collision
2867+ auto v0sThisColl = V0s.sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
2868+
2869+ for (const auto & v0 : v0sThisColl) {
2870+ if (!v0.has_mcParticle ())
2871+ continue ;
2872+
2873+ auto v0mcparticle = v0.mcParticle ();
2874+ if (v0mcparticle.pdgCode () != PDG_t::kK0Short || !v0mcparticle.isPhysicalPrimary ())
2875+ continue ;
2876+
2877+ const auto & posDaughterTrack = v0.posTrack_as <V0DauMCTracks>();
2878+ const auto & negDaughterTrack = v0.negTrack_as <V0DauMCTracks>();
2879+
2880+ if (!selectionV0 (v0, posDaughterTrack, negDaughterTrack))
2881+ continue ;
2882+ if (v0Configs.cfgFurtherV0Selection && !furtherSelectionV0 (v0, collision))
2883+ continue ;
2884+ if (std::abs (v0mcparticle.y ()) > cfgYAcceptance)
2885+ continue ;
2886+
2887+ mcK0SHist.fill (HIST (" h3K0SMCReco" ), genmultiplicity, v0mcparticle.pt (), v0.mK0Short ());
2888+ }
2889+
2890+ // Defining tracks in the collision
2891+ auto mcTracksThisColl = fullMCTracks.sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
2892+
2893+ for (const auto & track : mcTracksThisColl) {
2894+ // Pion selection
2895+ if (!selectionPion<false , true >(track, false ))
2896+ continue ;
2897+
2898+ if (!track.has_mcParticle ())
2899+ continue ;
2900+
2901+ auto mcTrack = track.mcParticle_as <aod::McParticles>();
2902+ if (std::abs (mcTrack.pdgCode ()) != PDG_t::kPiPlus )
2903+ continue ;
2904+
2905+ if (std::abs (mcTrack.y ()) > cfgYAcceptance)
2906+ continue ;
2907+
2908+ // Primary pion selection
2909+ if (mcTrack.isPhysicalPrimary ()) {
2910+ mcPionHist.fill (HIST (" h3RecMCDCAxyPrimPi" ), track.pt (), track.dcaXY ());
2911+ } else {
2912+ if (mcTrack.getProcess () == 4 ) { // Selection of secondary pions from weak decay
2913+ mcPionHist.fill (HIST (" h3RecMCDCAxySecWeakDecayPi" ), track.pt (), track.dcaXY ());
2914+ } else { // Selection of secondary pions from material interactions
2915+ mcPionHist.fill (HIST (" h3RecMCDCAxySecMaterialPi" ), track.pt (), track.dcaXY ());
2916+ }
2917+ continue ;
2918+ }
2919+
2920+ mcPionHist.fill (HIST (" h3PiTPCMCReco" ), genmultiplicity, mcTrack.pt (), track.tpcNSigmaPi ());
2921+
2922+ if (track.pt () >= trackConfigs.pTToUseTOF && !track.hasTOF ())
2923+ continue ;
2924+
2925+ mcPionHist.fill (HIST (" h4PiTPCTOFMCReco" ), genmultiplicity, mcTrack.pt (), track.tpcNSigmaPi (), track.tofNSigmaPi ());
2926+ }
2927+
2928+ // Defining McParticles in the collision
2929+ auto mcParticlesThisColl = mcParticles.sliceByCached (aod::mcparticle::mcCollisionId, mcCollision.globalIndex (), cache);
2930+
2931+ for (const auto & mcParticle : mcParticlesThisColl) {
2932+ if (std::abs (mcParticle.y ()) > cfgYAcceptance)
2933+ continue ;
2934+
2935+ // Phi selection
2936+ if (mcParticle.pdgCode () != o2::constants::physics::Pdg::kPhi )
2937+ continue ;
2938+ if (mcParticle.pt () < minPhiPt)
2939+ continue ;
2940+
2941+ mcPhiHist.fill (HIST (" h1PhiGenMCAssocReco" ), genmultiplicity);
2942+
2943+ // K0S selection
2944+ if (mcParticle.pdgCode () != PDG_t::kK0Short )
2945+ continue ;
2946+ if (!mcParticle.isPhysicalPrimary () || mcParticle.pt () < v0Configs.v0SettingMinPt )
2947+ continue ;
2948+
2949+ mcK0SHist.fill (HIST (" h2K0SMCGenAssocReco" ), genmultiplicity, mcParticle1.pt ());
2950+
2951+ // Pion selection
2952+ if (std::abs (mcParticle.pdgCode ()) != PDG_t::kPiPlus )
2953+ continue ;
2954+ if (!mcParticle.isPhysicalPrimary () || mcParticle.pt () < trackConfigs.cMinPionPtcut )
2955+ continue ;
2956+
2957+ mcPionHist.fill (HIST (" h2PiMCGenAssocReco" ), genmultiplicity, mcParticle1.pt ());
2958+ }
2959+ }
2960+ }
2961+
2962+ PROCESS_SWITCH (Phik0shortanalysis, processAllPartMCReco, " Process function for all particles in MCReco" , false );
2963+
2964+ void processAllPartMCGen (MCCollisions::iterator const & mcCollision, soa::SmallGroups<SimCollisions> const & collisions, aod::McParticles const & mcParticles)
2965+ {
2966+ if (std::abs (mcCollision.posZ ()) > cutZVertex)
2967+ return ;
2968+ if (!pwglf::isINELgtNmc (mcParticles, 0 , pdgDB))
2969+ return ;
2970+
2971+ bool isAssocColl = false ;
2972+ for (const auto & collision : collisions) {
2973+ if (acceptEventQA<true >(collision, false )) {
2974+ isAssocColl = true ;
2975+ break ;
2976+ }
2977+ }
2978+
2979+ float genmultiplicity = mcCollision.centFT0M ();
2980+ mcEventHist.fill (HIST (" hGenMCMultiplicityPercent" ), genmultiplicity);
2981+ if (isAssocColl)
2982+ mcEventHist.fill (HIST (" hGenMCAssocRecoMultiplicityPercent" ), genmultiplicity);
2983+
2984+ for (const auto & mcParticle : mcParticles) {
2985+ if (std::abs (mcParticle.y ()) > cfgYAcceptance)
2986+ continue ;
2987+
2988+ // Phi selection
2989+ if (mcParticle.pdgCode () != o2::constants::physics::Pdg::kPhi )
2990+ continue ;
2991+ if (mcParticle.pt () < minPhiPt)
2992+ continue ;
2993+
2994+ mcPhiHist.fill (HIST (" h2PhiGenMCGenAssocReco" ), genmultiplicity, mcParticle.pt ());
2995+ if (isAssocColl)
2996+ mcPhiHist.fill (HIST (" h2PhiGenMCGenAssocReco2" ), genmultiplicity, mcParticle.pt ());
2997+
2998+ // K0S selection
2999+ if (mcParticle.pdgCode () != PDG_t::kK0Short )
3000+ continue ;
3001+ if (!mcParticle.isPhysicalPrimary () || mcParticle.pt () < v0Configs.v0SettingMinPt )
3002+ continue ;
3003+
3004+ mcK0SHist.fill (HIST (" h2K0SMCGenAssocReco" ), genmultiplicity, mcParticle.pt ());
3005+ if (isAssocColl)
3006+ mcK0SHist.fill (HIST (" h2K0SMCGenAssocReco2" ), genmultiplicity, mcParticle.pt ());
3007+
3008+ // Pion selection
3009+ if (std::abs (mcParticle.pdgCode ()) != PDG_t::kPiPlus )
3010+ continue ;
3011+ if (!mcParticle.isPhysicalPrimary () || mcParticle.pt () < trackConfigs.cMinPionPtcut )
3012+ continue ;
3013+
3014+ mcPionHist.fill (HIST (" h2PiMCGenAssocReco" ), genmultiplicity, mcParticle.pt ());
3015+ if (isAssocColl)
3016+ mcPionHist.fill (HIST (" h2PiMCGenAssocReco2" ), genmultiplicity, mcParticle.pt ());
3017+ }
3018+ }
3019+
3020+ PROCESS_SWITCH (Phik0shortanalysis, processAllPartMCGen, " Process function for all particles in MCGen" , false );
27533021};
27543022
27553023WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments