@@ -71,7 +71,7 @@ struct k892analysis_PbPb {
7171 // events
7272 Configurable<float > cfgCutVertex{" cfgCutVertex" , 10 .0f , " Accepted z-vertex range" };
7373 Configurable<bool > timFrameEvsel{" timFrameEvsel" , false , " TPC Time frame boundary cut" };
74- Configurable<bool > additionalEvSel2{" additionalEvSel2" , true , " Additional evsel2 " };
74+ Configurable<bool > additionalEvSel2{" additionalEvSel2" , true , " NoSameBunchPileUp and IsGoodZvtxFT0vsPV " };
7575 Configurable<bool > additionalEvSel3{" additionalEvSel3" , false , " Additional evsel3" };
7676
7777 // presel
@@ -136,7 +136,7 @@ struct k892analysis_PbPb {
136136 AxisSpec invMassAxis = {cInvMassBins, cInvMassStart, cInvMassEnd, " Invariant Mass (GeV/#it{c}^2)" };
137137 AxisSpec pidQAAxis = {cPIDBins, -cPIDQALimit, cPIDQALimit};
138138
139- if (doprocessSameEvent || doprocessMixedEvent) {
139+ if (doprocessSameEvent || doprocessSameEventRun2 || doprocessMixedEvent || doprocessMixedEventRun2 ) {
140140 // event histograms
141141 histos.add (" QAevent/hEvtCounterSameE" , " Number of analyzed Same Events" , HistType::kTH1F , {{1 , 0.5 , 1.5 }});
142142 histos.add (" QAevent/hMultiplicityPercentSameE" , " Multiplicity percentile of collision" , HistType::kTH1F , {{120 , 0 .0f , 120 .0f }});
@@ -163,7 +163,7 @@ struct k892analysis_PbPb {
163163 histos.add (" k892invmassDSAnti" , " Invariant mass of Anti-K(892)0 different sign" , kTH1F , {invMassAxis});
164164 histos.add (" k892invmassLS" , " Invariant mass of K(892)0 like sign" , kTH1F , {invMassAxis});
165165 histos.add (" k892invmassLSAnti" , " Invariant mass of Anti-K(892)0 like sign" , kTH1F , {invMassAxis});
166- if (doprocessMixedEvent) {
166+ if (doprocessMixedEvent || doprocessMixedEventRun2 ) {
167167 histos.add (" k892invmassME" , " Invariant mass of K(892)0 mixed event" , kTH1F , {invMassAxis});
168168 if (additionalMEPlots) {
169169 histos.add (" k892invmassME_DS" , " Invariant mass of K(892)0 mixed event DS" , kTH1F , {invMassAxis});
@@ -200,7 +200,7 @@ struct k892analysis_PbPb {
200200 histos.add (" h3k892invmassDSAnti" , " Invariant mass of Anti-K(892)0 differnt sign" , kTH3F , {centAxis, ptAxis, invMassAxis});
201201 histos.add (" h3k892invmassLS" , " Invariant mass of K(892)0 same sign" , kTH3F , {centAxis, ptAxis, invMassAxis});
202202 histos.add (" h3k892invmassLSAnti" , " Invariant mass of Anti-K(892)0 same sign" , kTH3F , {centAxis, ptAxis, invMassAxis});
203- if (doprocessMixedEvent) {
203+ if (doprocessMixedEvent || doprocessMixedEventRun2 ) {
204204 histos.add (" h3k892invmassME" , " Invariant mass of K(892)0 mixed event" , kTH3F , {centAxis, ptAxis, invMassAxis});
205205
206206 if (additionalMEPlots) {
@@ -216,7 +216,7 @@ struct k892analysis_PbPb {
216216 }
217217 }
218218
219- if (doprocessMC) {
219+ if (doprocessMC || doprocessMCRun2 ) {
220220 histos.add (" hMCrecCollSels" , " MC Event statistics" , HistType::kTH1F , {{10 , 0 .0f , 10 .0f }});
221221 histos.add (" QAevent/hMultiplicityPercentMC" , " Multiplicity percentile of MCrec collision" , HistType::kTH1F , {{120 , 0 .0f , 120 .0f }});
222222
@@ -333,11 +333,16 @@ struct k892analysis_PbPb {
333333 return false ;
334334 }
335335
336- template <bool IsMC, bool IsMix, typename CollisionType, typename TracksType>
336+ template <bool IsMC, bool IsMix, bool IsRun2, typename CollisionType, typename TracksType>
337337 void fillHistograms (const CollisionType& collision, const TracksType& dTracks1, const TracksType& dTracks2)
338338 {
339339
340- auto multiplicity = collision.centFT0C ();
340+ auto multiplicity = -999 ;
341+
342+ if constexpr (!IsRun2)
343+ multiplicity = collision.centFT0C ();
344+ else
345+ multiplicity = collision.centRun2V0M ();
341346
342347 auto oldindex = -999 ;
343348 TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;
@@ -545,8 +550,8 @@ struct k892analysis_PbPb {
545550 } // end of loop on tracks combinations
546551 } // ennd on fill histograms
547552
548- Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
549- Filter centralityFilter = nabs(aod::cent::centFT0C) < cfgCutCentrality;
553+ Filter collisionFilter = nabs(aod::collision::posZ) <= cfgCutVertex;
554+ Filter centralityFilter = nabs(aod::cent::centFT0C) <= cfgCutCentrality;
550555 Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT);
551556 Filter DCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz);
552557
@@ -599,29 +604,93 @@ struct k892analysis_PbPb {
599604 auto candPosPitpc = posPitpc->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
600605 auto candNegKatpc = negKatpc->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
601606
602- fillHistograms<false , false >(collision, candPosPitpc, candNegKatpc);
607+ fillHistograms<false , false , false >(collision, candPosPitpc, candNegKatpc);
603608
604609 // -+
605610 auto candNegPitpc = negPitpc->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
606611 auto candPosKatpc = posKatpc->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
607612
608- fillHistograms<false , false >(collision, candNegPitpc, candPosKatpc);
613+ fillHistograms<false , false , false >(collision, candNegPitpc, candPosKatpc);
609614
610615 } else if (tofhighpt) {
611616 // +-
612617 auto candPosPitof = posPitof->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
613618 auto candNegKatof = negKatof->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
614619
615- fillHistograms<false , false >(collision, candPosPitof, candNegKatof);
620+ fillHistograms<false , false , false >(collision, candPosPitof, candNegKatof);
616621
617622 // -+
618623 auto candNegPitof = negPitof->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
619624 auto candPosKatof = posKatof->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
620625
621- fillHistograms<false , false >(collision, candNegPitof, candPosKatof);
626+ fillHistograms<false , false , false >(collision, candNegPitof, candPosKatof);
622627 }
623628 }
624- PROCESS_SWITCH (k892analysis_PbPb, processSameEvent, " Process Same event TOF High Pt" , false );
629+ PROCESS_SWITCH (k892analysis_PbPb, processSameEvent, " Process Same event" , false );
630+
631+ // /////***************************************
632+
633+ using Run2Events = soa::Join<aod::Collisions, aod::EvSels, aod::CentRun2V0Ms, aod::CentRun2CL0s>; // , aod::TrackletMults>;
634+ using BCsWithRun2Info = soa::Join<aod::BCs, aod::Run2BCInfos, aod::Timestamps>;
635+
636+ void processSameEventRun2 (Run2Events::iterator const & collision, TrackCandidates const & tracks, BCsWithRun2Info const &)
637+ {
638+ auto bc = collision.bc_as <BCsWithRun2Info>();
639+
640+ // if (!collision.alias_bit(kINT7))
641+ // return;
642+
643+ // if (!collision.sel7())
644+ // return;
645+
646+ if (!(bc.eventCuts () & BIT (aod::Run2EventCuts::kAliEventCutsAccepted )))
647+ return ;
648+
649+ if (std::abs (collision.posZ ()) > cfgCutVertex)
650+ return ;
651+
652+ auto centrality = collision.centRun2V0M ();
653+
654+ if (centrality > cfgCutCentrality)
655+ return ;
656+
657+ histos.fill (HIST (" QAevent/hEvtCounterSameE" ), 1 );
658+ histos.fill (HIST (" QAevent/hVertexZSameE" ), collision.posZ ());
659+ histos.fill (HIST (" QAevent/hMultiplicityPercentSameE" ), centrality);
660+
661+ if (additionalQAeventPlots) {
662+ histos.fill (HIST (" TestME/hCollisionIndexSameE" ), collision.globalIndex ());
663+ histos.fill (HIST (" TestME/hnTrksSameE" ), tracks.size ());
664+ }
665+
666+ if (tpclowpt) {
667+ // +-
668+ auto candPosPitpc = posPitpc->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
669+ auto candNegKatpc = negKatpc->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
670+
671+ fillHistograms<false , false , true >(collision, candPosPitpc, candNegKatpc);
672+
673+ // -+
674+ auto candNegPitpc = negPitpc->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
675+ auto candPosKatpc = posKatpc->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
676+
677+ fillHistograms<false , false , true >(collision, candNegPitpc, candPosKatpc);
678+
679+ } else if (tofhighpt) {
680+ // +-
681+ auto candPosPitof = posPitof->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
682+ auto candNegKatof = negKatof->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
683+
684+ fillHistograms<false , false , true >(collision, candPosPitof, candNegKatof);
685+
686+ // -+
687+ auto candNegPitof = negPitof->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
688+ auto candPosKatof = posKatof->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
689+
690+ fillHistograms<false , false , true >(collision, candNegPitof, candPosKatof);
691+ }
692+ }
693+ PROCESS_SWITCH (k892analysis_PbPb, processSameEventRun2, " Process Same event Run2" , false );
625694
626695 using BinningTypeVtxCent = ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentFT0C>;
627696 void processMixedEvent (EventCandidates const & collisions, TrackCandidates const & tracks)
@@ -660,31 +729,95 @@ struct k892analysis_PbPb {
660729 auto candPosPitpc = posPitpc->sliceByCached (aod::track::collisionId, collision1.globalIndex (), cache);
661730 auto candNegKatpc = negKatpc->sliceByCached (aod::track::collisionId, collision2.globalIndex (), cache);
662731
663- fillHistograms<false , true >(collision1, candPosPitpc, candNegKatpc);
732+ fillHistograms<false , true , false >(collision1, candPosPitpc, candNegKatpc);
733+
734+ // -+
735+ auto candNegPitpc = negPitpc->sliceByCached (aod::track::collisionId, collision1.globalIndex (), cache);
736+ auto candPosKatpc = posKatpc->sliceByCached (aod::track::collisionId, collision2.globalIndex (), cache);
737+
738+ fillHistograms<false , true , false >(collision1, candNegPitpc, candPosKatpc);
739+
740+ } else if (tofhighpt) {
741+
742+ // +-
743+ auto candPosPitof = posPitof->sliceByCached (aod::track::collisionId, collision1.globalIndex (), cache);
744+ auto candNegKatof = negKatof->sliceByCached (aod::track::collisionId, collision2.globalIndex (), cache);
745+
746+ fillHistograms<false , true , false >(collision1, candPosPitof, candNegKatof);
747+
748+ // -+
749+ auto candNegPitof = negPitof->sliceByCached (aod::track::collisionId, collision1.globalIndex (), cache);
750+ auto candPosKatof = posKatof->sliceByCached (aod::track::collisionId, collision2.globalIndex (), cache);
751+
752+ fillHistograms<false , true , false >(collision1, candNegPitof, candPosKatof);
753+ }
754+ }
755+ }
756+ PROCESS_SWITCH (k892analysis_PbPb, processMixedEvent, " Process Mixed event" , true );
757+
758+ using BinningTypeVtxCentRun2 = ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentRun2V0M>;
759+ void processMixedEventRun2 (Run2Events const & collisions, TrackCandidates const & tracks, BCsWithRun2Info const &)
760+ {
761+ auto tracksTuple = std::make_tuple (tracks);
762+ BinningTypeVtxCentRun2 colBinning{{CfgVtxBins, CfgMultBins}, true };
763+ SameKindPair<Run2Events, TrackCandidates, BinningTypeVtxCentRun2> pairs{colBinning, cfgNoMixedEvents, -1 , collisions, tracksTuple, &cache};
764+
765+ for (auto & [collision1, tracks1, collision2, tracks2] : pairs) {
766+
767+ auto bc1 = collision1.bc_as <BCsWithRun2Info>();
768+ auto bc2 = collision2.bc_as <BCsWithRun2Info>();
769+
770+ if (!(bc1.eventCuts () & BIT (aod::Run2EventCuts::kAliEventCutsAccepted )) || !(bc2.eventCuts () & BIT (aod::Run2EventCuts::kAliEventCutsAccepted )))
771+ continue ;
772+
773+ if ((std::abs (collision1.posZ ()) > cfgCutVertex) || (std::abs (collision2.posZ ()) > cfgCutVertex))
774+ continue ;
775+
776+ auto centrality1 = collision1.centRun2V0M ();
777+ auto centrality2 = collision2.centRun2V0M ();
778+
779+ if ((centrality1 > cfgCutCentrality) || (centrality2 > cfgCutCentrality))
780+ continue ;
781+
782+ if (additionalQAeventPlots) {
783+ histos.fill (HIST (" QAevent/hEvtCounterMixedE" ), 1.0 );
784+ histos.fill (HIST (" QAevent/hVertexZMixedE" ), collision1.posZ ());
785+ histos.fill (HIST (" QAevent/hMultiplicityPercentMixedE" ), centrality1);
786+ histos.fill (HIST (" TestME/hCollisionIndexMixedE" ), collision1.globalIndex ());
787+ histos.fill (HIST (" TestME/hnTrksMixedE" ), tracks1.size ());
788+ }
789+
790+ if (tpclowpt) {
791+
792+ // +-
793+ auto candPosPitpc = posPitpc->sliceByCached (aod::track::collisionId, collision1.globalIndex (), cache);
794+ auto candNegKatpc = negKatpc->sliceByCached (aod::track::collisionId, collision2.globalIndex (), cache);
795+
796+ fillHistograms<false , true , true >(collision1, candPosPitpc, candNegKatpc);
664797
665798 // -+
666799 auto candNegPitpc = negPitpc->sliceByCached (aod::track::collisionId, collision1.globalIndex (), cache);
667800 auto candPosKatpc = posKatpc->sliceByCached (aod::track::collisionId, collision2.globalIndex (), cache);
668801
669- fillHistograms<false , true >(collision1, candNegPitpc, candPosKatpc);
802+ fillHistograms<false , true , true >(collision1, candNegPitpc, candPosKatpc);
670803
671804 } else if (tofhighpt) {
672805
673806 // +-
674807 auto candPosPitof = posPitof->sliceByCached (aod::track::collisionId, collision1.globalIndex (), cache);
675808 auto candNegKatof = negKatof->sliceByCached (aod::track::collisionId, collision2.globalIndex (), cache);
676809
677- fillHistograms<false , true >(collision1, candPosPitof, candNegKatof);
810+ fillHistograms<false , true , true >(collision1, candPosPitof, candNegKatof);
678811
679812 // -+
680813 auto candNegPitof = negPitof->sliceByCached (aod::track::collisionId, collision1.globalIndex (), cache);
681814 auto candPosKatof = posKatof->sliceByCached (aod::track::collisionId, collision2.globalIndex (), cache);
682815
683- fillHistograms<false , true >(collision1, candNegPitof, candPosKatof);
816+ fillHistograms<false , true , true >(collision1, candNegPitof, candPosKatof);
684817 }
685818 }
686819 }
687- PROCESS_SWITCH (k892analysis_PbPb, processMixedEvent , " Process Mixed event TPC low pt " , true );
820+ PROCESS_SWITCH (k892analysis_PbPb, processMixedEventRun2 , " Process Mixed event Run2 " , true );
688821
689822 // MC
690823
@@ -728,7 +861,7 @@ struct k892analysis_PbPb {
728861 auto centrality = RecCollision.centFT0C ();
729862 histos.fill (HIST (" QAevent/hMultiplicityPercentMC" ), centrality);
730863 auto tracks = RecTracks.sliceByCached (aod::track::collisionId, RecCollision.globalIndex (), cache);
731- fillHistograms<true , false >(RecCollision, tracks, tracks);
864+ fillHistograms<true , false , false >(RecCollision, tracks, tracks);
732865
733866 // Generated MC
734867 for (auto & mcPart : mcParticles) {
@@ -781,6 +914,91 @@ struct k892analysis_PbPb {
781914 } // end loop on rec collisions
782915 }
783916 PROCESS_SWITCH (k892analysis_PbPb, processMC, " Process Monte Carlo" , false );
917+
918+ // MC Run2
919+
920+ using EventCandidatesMCrecRun2 = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::CentRun2V0Ms, aod::CentRun2CL0s>; // aod::TrackletMults>;
921+
922+ void processMCRun2 (aod::McCollisions::iterator const & /* mcCollision*/ , aod::McParticles& mcParticles, const soa::SmallGroups<EventCandidatesMCrecRun2>& recCollisions, TrackCandidatesMCrec const & RecTracks, BCsWithRun2Info const &)
923+ {
924+ histos.fill (HIST (" hMCrecCollSels" ), 0 );
925+ if (recCollisions.size () == 0 ) {
926+ histos.fill (HIST (" hMCrecCollSels" ), 1 );
927+ return ;
928+ }
929+ if (recCollisions.size () > 1 ) {
930+ histos.fill (HIST (" hMCrecCollSels" ), 2 );
931+ return ;
932+ }
933+ for (auto & RecCollision : recCollisions) {
934+ auto bc = RecCollision.bc_as <BCsWithRun2Info>();
935+ histos.fill (HIST (" hMCrecCollSels" ), 3 );
936+
937+ if (!(bc.eventCuts () & BIT (aod::Run2EventCuts::kAliEventCutsAccepted )))
938+ return ;
939+ histos.fill (HIST (" hMCrecCollSels" ), 4 );
940+
941+ if (std::abs (RecCollision.posZ ()) > cfgCutVertex)
942+ return ;
943+ histos.fill (HIST (" hMCrecCollSels" ), 5 );
944+
945+ auto centrality = RecCollision.centRun2V0M ();
946+
947+ histos.fill (HIST (" QAevent/hMultiplicityPercentMC" ), centrality);
948+ auto tracks = RecTracks.sliceByCached (aod::track::collisionId, RecCollision.globalIndex (), cache);
949+ fillHistograms<true , false , true >(RecCollision, tracks, tracks);
950+
951+ // Generated MC
952+ for (auto & mcPart : mcParticles) {
953+ if (abs (mcPart.y ()) >= 0.5 || abs (mcPart.pdgCode ()) != 313 )
954+ continue ;
955+
956+ auto kDaughters = mcPart.daughters_as <aod::McParticles>();
957+ if (kDaughters .size () != 2 ) {
958+ continue ;
959+ }
960+
961+ TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;
962+
963+ auto daughtp = false ;
964+ auto daughtk = false ;
965+ for (auto kCurrentDaughter : kDaughters ) {
966+ if (!kCurrentDaughter .isPhysicalPrimary ())
967+ break ;
968+ if (genacceptancecut && (kCurrentDaughter .pt () < cfgCutPT || TMath::Abs (kCurrentDaughter .eta ()) > cfgCutEta))
969+ break ;
970+
971+ if (abs (kCurrentDaughter .pdgCode ()) == 211 ) {
972+ daughtp = true ;
973+ lDecayDaughter1.SetXYZM (kCurrentDaughter .px (), kCurrentDaughter .py (), kCurrentDaughter .pz (), massPi);
974+ } else if (abs (kCurrentDaughter .pdgCode ()) == 321 ) {
975+ daughtk = true ;
976+ lDecayDaughter2.SetXYZM (kCurrentDaughter .px (), kCurrentDaughter .py (), kCurrentDaughter .pz (), massKa);
977+ }
978+ }
979+
980+ if (!daughtp || !daughtk)
981+ continue ;
982+
983+ lResonance = lDecayDaughter1 + lDecayDaughter2;
984+
985+ histos.fill (HIST (" QAMCTrue/hGlobalIndexMotherGen" ), mcPart.globalIndex ());
986+
987+ if (mcPart.pdgCode () > 0 ) { // no cuts, purely generated
988+ histos.fill (HIST (" k892GenInvmass" ), lResonance.M ());
989+ histos.fill (HIST (" h3k892GenInvmass" ), centrality, lResonance.Pt (), lResonance.M ());
990+ histos.fill (HIST (" k892Gen" ), 3 , mcPart.pt (), centrality);
991+ } else {
992+ histos.fill (HIST (" k892GenInvmassAnti" ), lResonance.M ());
993+ histos.fill (HIST (" h3k892GenInvmassAnti" ), centrality, lResonance.Pt (), lResonance.M ());
994+ histos.fill (HIST (" k892GenAnti" ), 3 , mcPart.pt (), centrality);
995+ }
996+
997+ } // end loop on gen particles
998+
999+ } // end loop on rec collisions
1000+ }
1001+ PROCESS_SWITCH (k892analysis_PbPb, processMCRun2, " Process Monte Carlo Run2" , false );
7841002};
7851003WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
7861004{
0 commit comments