@@ -672,26 +672,18 @@ struct Phik0shortanalysis {
672672 }
673673
674674 if (analysisModeConfigs.isMCNewProc ) {
675- mcPhiHist.add (" h3PhiMCRecoNewProc " , " Phi in MCReco" , kTH3F , {binnedmultAxis, pTPhiAxis, yAxis});
676- mcK0SHist.add (" h3K0SMCRecoNewProc " , " K0S in MCReco" , kTH3F , {binnedmultAxis, pTK0SAxis, yAxis});
677- mcPionHist.add (" h3PiMCRecoNewProc " , " Pion in MCReco" , kTH3F , {binnedmultAxis, pTPiAxis, yAxis});
678- mcPionHist.add (" h3PiMCReco2NewProc " , " Pion in MCReco" , kTH3F , {binnedmultAxis, pTPiAxis, yAxis});
675+ mcPhiHist.add (" h4PhiMCRecoNewProc " , " Phi in MCReco" , kTHnSparseF , {vertexZAxis, binnedmultAxis, pTPhiAxis, yAxis});
676+ mcK0SHist.add (" h4K0SMCRecoNewProc " , " K0S in MCReco" , kTHnSparseF , {vertexZAxis, binnedmultAxis, pTK0SAxis, yAxis});
677+ mcPionHist.add (" h4PiMCRecoNewProc " , " Pion in MCReco" , kTHnSparseF , {vertexZAxis, binnedmultAxis, pTPiAxis, yAxis});
678+ mcPionHist.add (" h4PiMCReco2NewProc " , " Pion in MCReco" , kTHnSparseF , {vertexZAxis, binnedmultAxis, pTPiAxis, yAxis});
679679
680680 mcPhiHist.add (" h3PhiMCGenNewProc" , " Phi in MCGen" , kTH3F , {binnedmultAxis, pTPhiAxis, yAxis});
681681 mcK0SHist.add (" h3K0SMCGenNewProc" , " K0S in MCGen" , kTH3F , {binnedmultAxis, pTK0SAxis, yAxis});
682682 mcPionHist.add (" h3PiMCGenNewProc" , " Pion in MCGen" , kTH3F , {binnedmultAxis, pTPiAxis, yAxis});
683683
684- mcPhiHist.add (" h3PhiMCGenAssocRecoNewProc" , " Phi in MCGen Associated MCReco" , kTH3F , {binnedmultAxis, pTPhiAxis, yAxis});
685- mcK0SHist.add (" h3K0SMCGenAssocRecoNewProc" , " K0S in MCGen Associated MCReco" , kTH3F , {binnedmultAxis, pTK0SAxis, yAxis});
686- mcPionHist.add (" h3PiMCGenAssocRecoNewProc" , " Pion in MCGen Associated MCReco" , kTH3F , {binnedmultAxis, pTPiAxis, yAxis});
687-
688- mcPhiHist.add (" h3PhiMCGenRecoNewProc" , " Phi in MCGen MCReco" , kTH3F , {binnedmultAxis, pTPhiAxis, yAxis});
689- mcK0SHist.add (" h3K0SMCGenRecoNewProc" , " K0S in MCGen MCReco" , kTH3F , {binnedmultAxis, pTK0SAxis, yAxis});
690- mcPionHist.add (" h3PiMCGenRecoNewProc" , " Pion in MCGen MCReco" , kTH3F , {binnedmultAxis, pTPiAxis, yAxis});
691-
692- mcPhiHist.add (" h3PhiMCGenRecoCheckNewProc" , " Phi in MCGen MCReco Check" , kTH3F , {binnedmultAxis, pTPhiAxis, yAxis});
693- mcK0SHist.add (" h3K0SMCGenRecoCheckNewProc" , " K0S in MCGen MCReco Check" , kTH3F , {binnedmultAxis, pTK0SAxis, yAxis});
694- mcPionHist.add (" h3PiMCGenRecoCheckNewProc" , " Pion in MCGen MCReco Check" , kTH3F , {binnedmultAxis, pTPiAxis, yAxis});
684+ mcPhiHist.add (" h4PhiMCGenAssocRecoNewProc" , " Phi in MCGen Associated MCReco" , kTHnSparseF , {vertexZAxis, binnedmultAxis, pTPhiAxis, yAxis});
685+ mcK0SHist.add (" h4K0SMCGenAssocRecoNewProc" , " K0S in MCGen Associated MCReco" , kTHnSparseF , {vertexZAxis, binnedmultAxis, pTK0SAxis, yAxis});
686+ mcPionHist.add (" h4PiMCGenAssocRecoNewProc" , " Pion in MCGen Associated MCReco" , kTHnSparseF , {vertexZAxis, binnedmultAxis, pTPiAxis, yAxis});
695687 }
696688
697689 // Initialize CCDB only if purity or efficiencies are requested in the task
@@ -3066,20 +3058,19 @@ struct Phik0shortanalysis {
30663058 auto collision = collisions.rawIteratorAt (collisionIndex);
30673059
30683060 if (acceptEventQA<true >(collision, false )) {
3069- // //
3070- auto filteredMCTracksThisColl = filteredMCTracks .sliceBy (preslices.perColl , collision.globalIndex ());
3061+ auto fullMCTracksThisColl = fullMCTracks. sliceBy (preslices. perColl , collision. globalIndex ());
3062+ auto v0sThisColl = V0s .sliceBy (preslices.perColl , collision.globalIndex ());
30713063
3072- posFiltMCTracks.bindTable (filteredMCTracksThisColl);
3073- negFiltMCTracks.bindTable (filteredMCTracksThisColl);
3074- // //
3064+ posMCTracks.bindTable (fullMCTracksThisColl);
3065+ negMCTracks.bindTable (fullMCTracksThisColl);
30753066
30763067 switch (filterOnRecoPhi) {
30773068 case 0 :
3078- if (!eventHasRecoPhi (posFiltMCTracks, negFiltMCTracks ))
3069+ if (!eventHasRecoPhi (posMCTracks, negMCTracks ))
30793070 continue ;
30803071 break ;
30813072 case 1 :
3082- if (!eventHasRecoPhiWPDG (posFiltMCTracks, negFiltMCTracks , mcParticles))
3073+ if (!eventHasRecoPhiWPDG (posMCTracks, negMCTracks , mcParticles))
30833074 continue ;
30843075 break ;
30853076 default :
@@ -3091,69 +3082,70 @@ struct Phik0shortanalysis {
30913082
30923083 zVtxs.push_back (collision.posZ ());
30933084
3094- // //
3095- // Defining positive and negative tracks for phi reconstruction
3096- auto posThisColl = posMCTracks-> sliceByCached (aod::track::collisionId, collision. globalIndex (), cache);
3097- auto negThisColl = negMCTracks-> sliceByCached (aod::track::collisionId, collision. globalIndex (), cache);
3085+ if ((filterOnGenPhi != 0 && filterOnGenPhi != 1 ) && (filterOnRecoPhi != 0 && filterOnRecoPhi != 1 )) {
3086+ for ( const auto & track1 : posMCTracks) { // loop over all selected tracks
3087+ if (!selectionTrackResonance< true >(track1, false ) || ! selectionPIDKaonpTdependent (track1))
3088+ continue ; // topological and PID selection
30983089
3099- for (const auto & track1 : posThisColl) { // loop over all selected tracks
3100- if (!selectionTrackResonance<true >(track1, false ) || !selectionPIDKaonpTdependent (track1))
3101- continue ; // topological and PID selection
3090+ auto track1ID = track1.globalIndex ();
31023091
3103- auto track1ID = track1.globalIndex ();
3092+ if (!track1.has_mcParticle ())
3093+ continue ;
3094+ auto mcTrack1 = mcParticles.rawIteratorAt (track1.mcParticleId ());
3095+ if (mcTrack1.pdgCode () != PDG_t::kKPlus || !mcTrack1.isPhysicalPrimary ())
3096+ continue ;
31043097
3105- if (!track1.has_mcParticle ())
3106- continue ;
3107- auto mcTrack1 = track1.mcParticle_as <aod::McParticles>();
3108- if (mcTrack1.pdgCode () != PDG_t::kKPlus || !mcTrack1.isPhysicalPrimary ())
3109- continue ;
3098+ for (const auto & track2 : negMCTracks) {
3099+ if (!selectionTrackResonance<true >(track2, false ) || !selectionPIDKaonpTdependent (track2))
3100+ continue ; // topological and PID selection
31103101
3111- for ( const auto & track2 : negThisColl) {
3112- if (!selectionTrackResonance< true >(track2, false ) || ! selectionPIDKaonpTdependent (track2) )
3113- continue ; // topological and PID selection
3102+ auto track2ID = track2. globalIndex ();
3103+ if (track2ID == track1ID )
3104+ continue ; // condition to avoid double counting of pair
31143105
3115- auto track2ID = track2.globalIndex ();
3116- if (track2ID == track1ID)
3117- continue ; // condition to avoid double counting of pair
3106+ if (!track2.has_mcParticle ())
3107+ continue ;
3108+ auto mcTrack2 = mcParticles.rawIteratorAt (track2.mcParticleId ());
3109+ if (mcTrack2.pdgCode () != PDG_t::kKMinus || !mcTrack2.isPhysicalPrimary ())
3110+ continue ;
31183111
3119- if (!track2.has_mcParticle ())
3120- continue ;
3121- auto mcTrack2 = track2.mcParticle_as <aod::McParticles>();
3122- if (mcTrack2.pdgCode () != PDG_t::kKMinus || !mcTrack2.isPhysicalPrimary ())
3123- continue ;
3112+ const auto mcTrack1MotherIndexes = mcTrack1.mothersIds ();
3113+ const auto mcTrack2MotherIndexes = mcTrack2.mothersIds ();
3114+
3115+ float pTMother = -1 .0f ;
3116+ float yMother = -1 .0f ;
3117+ bool isMCMotherPhi = false ;
3118+
3119+ for (const auto & mcTrack1MotherIndex : mcTrack1MotherIndexes) {
3120+ for (const auto & mcTrack2MotherIndex : mcTrack2MotherIndexes) {
3121+ if (mcTrack1MotherIndex != mcTrack2MotherIndex)
3122+ continue ;
3123+
3124+ const auto mother = mcParticles.rawIteratorAt (mcTrack1MotherIndex);
3125+ if (mother.pdgCode () != o2::constants::physics::Pdg::kPhi )
3126+ continue ;
31243127
3125- float pTMother = -1 .0f ;
3126- float yMother = -1 .0f ;
3127- bool isMCMotherPhi = false ;
3128- for (const auto & motherOfMcTrack1 : mcTrack1.mothers_as <aod::McParticles>()) {
3129- for (const auto & motherOfMcTrack2 : mcTrack2.mothers_as <aod::McParticles>()) {
3130- if (motherOfMcTrack1.pdgCode () != motherOfMcTrack2.pdgCode ())
3131- continue ;
3132- if (motherOfMcTrack1.globalIndex () != motherOfMcTrack2.globalIndex ())
3133- continue ;
3134- if (motherOfMcTrack1.pdgCode () != o2::constants::physics::Pdg::kPhi )
3135- continue ;
3136-
3137- pTMother = motherOfMcTrack1.pt ();
3138- yMother = motherOfMcTrack1.y ();
3139- isMCMotherPhi = true ;
3128+ pTMother = mother.pt ();
3129+ yMother = mother.y ();
3130+ isMCMotherPhi = true ;
3131+ }
31403132 }
3141- }
31423133
3143- if (!isMCMotherPhi)
3144- continue ;
3145- if (pTMother < phiConfigs.minPhiPt || std::abs (yMother) > deltaYConfigs.cfgYAcceptance )
3146- continue ;
3134+ if (!isMCMotherPhi)
3135+ continue ;
3136+ if (pTMother < phiConfigs.minPhiPt || std::abs (yMother) > deltaYConfigs.cfgYAcceptance )
3137+ continue ;
31473138
3148- mcPhiHist.fill (HIST (" h3PhiMCRecoNewProc" ), genmultiplicity, pTMother, yMother);
3139+ mcPhiHist.fill (HIST (" h4PhiMCRecoNewProc" ), collision.posZ (), mcCollision.centFT0M (), pTMother, yMother);
3140+ }
31493141 }
31503142 }
31513143
3152- for (const auto & v0 : V0s ) {
3144+ for (const auto & v0 : v0sThisColl ) {
31533145 if (!v0.has_mcParticle ())
31543146 continue ;
31553147
3156- auto v0mcparticle = v0.mcParticle ( );
3148+ auto v0mcparticle = mcParticles. rawIteratorAt ( v0.mcParticleId () );
31573149 if (v0mcparticle.pdgCode () != PDG_t::kK0Short || !v0mcparticle.isPhysicalPrimary ())
31583150 continue ;
31593151
@@ -3167,18 +3159,18 @@ struct Phik0shortanalysis {
31673159 if (std::abs (v0mcparticle.y ()) > deltaYConfigs.cfgYAcceptance )
31683160 continue ;
31693161
3170- mcK0SHist.fill (HIST (" h3K0SMCRecoNewProc " ), genmultiplicity , v0mcparticle.pt (), v0mcparticle.y ());
3162+ mcK0SHist.fill (HIST (" h4K0SMCRecoNewProc " ), collision. posZ (), mcCollision. centFT0M () , v0mcparticle.pt (), v0mcparticle.y ());
31713163 }
31723164
3173- for (const auto & track : fullMCTracks ) {
3165+ for (const auto & track : fullMCTracksThisColl ) {
31743166 // Pion selection
31753167 if (!selectionPion<false , true >(track, false ))
31763168 continue ;
31773169
31783170 if (!track.has_mcParticle ())
31793171 continue ;
31803172
3181- auto mcTrack = track.mcParticle_as <aod::McParticles>( );
3173+ auto mcTrack = mcParticles. rawIteratorAt ( track.mcParticleId () );
31823174 if (std::abs (mcTrack.pdgCode ()) != PDG_t::kPiPlus )
31833175 continue ;
31843176
@@ -3197,14 +3189,13 @@ struct Phik0shortanalysis {
31973189 continue ;
31983190 }
31993191
3200- mcPionHist.fill (HIST (" h3PiMCRecoNewProc " ), genmultiplicity , mcTrack.pt (), mcTrack.y ());
3192+ mcPionHist.fill (HIST (" h4PiMCRecoNewProc " ), collision. posZ (), mcCollision. centFT0M () , mcTrack.pt (), mcTrack.y ());
32013193
32023194 if (track.pt () >= trackConfigs.pTToUseTOF && !track.hasTOF ())
32033195 continue ;
32043196
3205- mcPionHist.fill (HIST (" h3PiMCReco2NewProc " ), genmultiplicity , mcTrack.pt (), mcTrack.y ());
3197+ mcPionHist.fill (HIST (" h4PiMCReco2NewProc " ), collision. posZ (), mcCollision. centFT0M () , mcTrack.pt (), mcTrack.y ());
32063198 }
3207- // //
32083199
32093200 numberAssocColl++;
32103201 }
@@ -3228,31 +3219,39 @@ struct Phik0shortanalysis {
32283219 if (std::abs (mcParticle.y ()) > deltaYConfigs.cfgYAcceptance )
32293220 continue ;
32303221
3231- // Phi selection
3232- if (mcParticle.pdgCode () == o2::constants::physics::Pdg::kPhi && mcParticle.pt () >= phiConfigs.minPhiPt ) {
3233- mcPhiHist.fill (HIST (" h3PhiMCGenNewProc" ), genmultiplicity, mcParticle.pt (), mcParticle.y ());
3234- if (numberAssocColl > 0 )
3235- mcPhiHist.fill (HIST (" h3PhiMCGenAssocRecoNewProc" ), genmultiplicity, mcParticle.pt (), mcParticle.y ());
3222+ if (filterOnGenPhi != 0 && filterOnGenPhi != 1 ) {
3223+ // Phi selection
3224+ if (mcParticle.pdgCode () == o2::constants::physics::Pdg::kPhi && mcParticle.pt () >= phiConfigs.minPhiPt ) {
3225+ mcPhiHist.fill (HIST (" h3PhiMCGenNewProc" ), mcCollision.centFT0M (), mcParticle.pt (), mcParticle.y ());
3226+ if (numberAssocColl > 0 ) {
3227+ float zVtxRef = zVtxs[0 ];
3228+ mcPhiHist.fill (HIST (" h4PhiMCGenAssocRecoNewProc" ), zVtxRef, mcCollision.centFT0M (), mcParticle.pt (), mcParticle.y ());
3229+ }
3230+ }
32363231 }
32373232
32383233 // K0S selection
32393234 if (mcParticle.pdgCode () == PDG_t::kK0Short && mcParticle.isPhysicalPrimary () && mcParticle.pt () >= v0Configs.v0SettingMinPt ) {
3240- mcK0SHist.fill (HIST (" h3K0SMCGenNewProc" ), genmultiplicity, mcParticle.pt (), mcParticle.y ());
3241- if (numberAssocColl > 0 )
3242- mcK0SHist.fill (HIST (" h3K0SMCGenAssocRecoNewProc" ), genmultiplicity, mcParticle.pt (), mcParticle.y ());
3235+ mcK0SHist.fill (HIST (" h3K0SMCGenNewProc" ), mcCollision.centFT0M (), mcParticle.pt (), mcParticle.y ());
3236+ if (numberAssocColl > 0 ) {
3237+ float zVtxRef = zVtxs[0 ];
3238+ mcK0SHist.fill (HIST (" h4K0SMCGenAssocRecoNewProc" ), zVtxRef, mcCollision.centFT0M (), mcParticle.pt (), mcParticle.y ());
3239+ }
32433240 }
32443241
32453242 // Pion selection
32463243 if (std::abs (mcParticle.pdgCode ()) == PDG_t::kPiPlus && mcParticle.isPhysicalPrimary () && mcParticle.pt () >= trackConfigs.cMinPionPtcut ) {
3247- mcPionHist.fill (HIST (" h3PiMCGenNewProc" ), genmultiplicity, mcParticle.pt (), mcParticle.y ());
3248- if (numberAssocColl > 0 )
3249- mcPionHist.fill (HIST (" h3PiMCGenAssocRecoNewProc" ), genmultiplicity, mcParticle.pt (), mcParticle.y ());
3244+ mcPionHist.fill (HIST (" h3PiMCGenNewProc" ), mcCollision.centFT0M (), mcParticle.pt (), mcParticle.y ());
3245+ if (numberAssocColl > 0 ) {
3246+ float zVtxRef = zVtxs[0 ];
3247+ mcPionHist.fill (HIST (" h4PiMCGenAssocRecoNewProc" ), zVtxRef, mcCollision.centFT0M (), mcParticle.pt (), mcParticle.y ());
3248+ }
32503249 }
32513250 }
32523251 }
32533252 }
32543253
3255- PROCESS_SWITCH (Phik0shortanalysis, processAllPartMC, " Process function for all particles in MC" , false );
3254+ PROCESS_SWITCH (Phik0shortanalysis, processAllPartMC, " Process function for all particles (not for phi if triggered on it) in MC" , false );
32563255
32573256 void processPhiK0SMixingEvent (SelCollisions const & collisions, FullTracks const & fullTracks, FullV0s const & V0s, V0DauTracks const &)
32583257 {
0 commit comments