6262#include < string>
6363#include < tuple>
6464#include < type_traits>
65+ #include < unordered_map>
6566#include < utility>
6667#include < vector>
6768
@@ -115,6 +116,7 @@ struct CorrelationTask {
115116 O2_DEFINE_CONFIGURABLE (cfgEfficiencyAssociated, std::string, " " , " CCDB path to efficiency object for associated particles" )
116117
117118 O2_DEFINE_CONFIGURABLE (cfgNoMixedEvents, int , 5 , " Number of mixed events per event" )
119+ O2_DEFINE_CONFIGURABLE (cfgRejectMixedPhiProngEvents, bool , true , " Reject associated hadrons from either mixed-phi prong event" )
118120
119121 O2_DEFINE_CONFIGURABLE (cfgVerbosity, int , 1 , " Verbosity level (0 = major, 1 = per collision)" )
120122
@@ -127,6 +129,8 @@ struct CorrelationTask {
127129 O2_DEFINE_CONFIGURABLE (cfgPtCentDepMLbkgSel, std::vector<float >, {}, " Bkg ML selection" )
128130 O2_DEFINE_CONFIGURABLE (cfgPtCentDepMLpromptSel, std::vector<float >, {}, " Prompt ML selection" )
129131
132+ std::unordered_map<int64_t , int64_t > cfTrackToCFCollision;
133+
130134 ConfigurableAxis axisVertex{" axisVertex" , {7 , -7 , 7 }, " vertex axis for histograms" };
131135 ConfigurableAxis axisDeltaPhi{" axisDeltaPhi" , {72 , -PIHalf, PIHalf * 3 }, " delta phi axis for histograms" };
132136 ConfigurableAxis axisDeltaEta{" axisDeltaEta" , {40 , -2 , 2 }, " delta eta axis for histograms" };
@@ -511,6 +515,8 @@ struct CorrelationTask {
511515 using HasPartDaugh0Id = decltype (std::declval<T&>().cfParticleDaugh0Id());
512516 template <class T >
513517 using HasPartDaugh1Id = decltype (std::declval<T&>().cfParticleDaugh1Id());
518+ template <class T >
519+ using HasCFCollisionId = decltype (std::declval<T&>().cfCollisionId());
514520
515521 template <class CollType >
516522 bool passOutlier (CollType const & collision)
@@ -654,6 +660,29 @@ struct CorrelationTask {
654660 continue ;
655661 }
656662 }
663+
664+ if ((&target == &mixed) && doprocessMixed2ProngDerivedMixedPhi && cfgRejectMixedPhiProngEvents) {
665+ if constexpr (std::experimental::is_detected<HasDecay, typename TTracks1::iterator>::value &&
666+ std::experimental::is_detected<HasProng0Id, typename TTracks1::iterator>::value &&
667+ std::experimental::is_detected<HasProng1Id, typename TTracks1::iterator>::value &&
668+ std::experimental::is_detected<HasCFCollisionId, typename TTracks2::iterator>::value) {
669+
670+ if (track1.decay () == aod::cf2prongtrack::PhiToKKPID3Mixed) {
671+ auto pr0 = cfTrackToCFCollision.find (track1.cfTrackProng0Id ());
672+ auto pr1 = cfTrackToCFCollision.find (track1.cfTrackProng1Id ());
673+
674+ if (pr0 != cfTrackToCFCollision.end () &&
675+ pr1 != cfTrackToCFCollision.end ()) {
676+ const auto assocColl = track2.cfCollisionId ();
677+
678+ if (assocColl == pr0->second || assocColl == pr1->second ) {
679+ continue ;
680+ }
681+ }
682+ }
683+ }
684+ }
685+
657686 if constexpr (std::experimental::is_detected<HasPDGCode, typename TTracks2::iterator>::value) { // skip those that are specifically chosen to be triggers
658687 if (!cfgMcTriggerPDGs->empty () && std::find (cfgMcTriggerPDGs->begin (), cfgMcTriggerPDGs->end (), track2.pdgCode ()) != cfgMcTriggerPDGs->end ())
659688 continue ; // TODO: fix cases like MC D0-D0
@@ -783,16 +812,15 @@ struct CorrelationTask {
783812 } // ML selection
784813
785814 // last param is the weight
786- if (cfgMassAxis && (doprocessSame2Prong2Prong || doprocessMixed2Prong2Prong || doprocessSame2Prong2ProngML || doprocessMixed2Prong2ProngML) && !(doprocessSame2ProngDerived || doprocessSame2ProngDerivedML || doprocessMixed2ProngDerived || doprocessMixed2ProngDerivedML)) {
815+ if (cfgMassAxis && (doprocessSame2Prong2Prong || doprocessMixed2Prong2Prong || doprocessSame2Prong2ProngML || doprocessMixed2Prong2ProngML) && !(doprocessSame2ProngDerived || doprocessSame2ProngDerivedML || doprocessMixed2ProngDerived || doprocessMixed2ProngDerivedML || doprocessMixed2ProngDerivedMixedPhi )) {
787816 if constexpr (std::experimental::is_detected<HasInvMass, typename TTracks1::iterator>::value && std::experimental::is_detected<HasInvMass, typename TTracks2::iterator>::value)
788817 target->getPairHist ()->Fill (step, track1.eta () - track2.eta (), track2.pt (), track1.pt (), multiplicity, deltaPhi, posZ, track2.invMass (), track1.invMass (), associatedWeight);
789818 else
790819 LOGF (fatal, " Can not fill mass axis without invMass column. \n no mass for two particles" );
791820 } else if (cfgMassAxis) {
792- if constexpr (std::experimental::is_detected<HasInvMass, typename TTracks1::iterator>::value)
821+ if constexpr (std::experimental::is_detected<HasInvMass, typename TTracks1::iterator>::value) {
793822 target->getPairHist ()->Fill (step, track1.eta () - track2.eta (), track2.pt (), track1.pt (), multiplicity, deltaPhi, posZ, track1.invMass (), associatedWeight);
794- else if constexpr (std::experimental::is_detected<HasPDGCode, typename TTracks1::iterator>::value) {
795- // TParticlePDG *p = pdg->GetParticle(track1.pdgCode()); //TODO: get the mass for the PDG properly
823+ } else if constexpr (std::experimental::is_detected<HasPDGCode, typename TTracks1::iterator>::value) {
796824 target->getPairHist ()->Fill (step, track1.eta () - track2.eta (), track2.pt (), track1.pt (), multiplicity, deltaPhi, posZ, 1.8 , associatedWeight); // p->Mass()
797825 } else {
798826 LOGF (fatal, " Can not fill mass axis without invMass column. Disable cfgMassAxis." );
@@ -1071,6 +1099,21 @@ struct CorrelationTask {
10711099 processMixedDerivedT (collisions, p2tracks, tracks);
10721100 }
10731101 PROCESS_SWITCH (CorrelationTask, processMixed2ProngDerived, " Process mixed events on derived data" , false );
1102+ void processMixed2ProngDerivedMixedPhi (DerivedCollisions const & collisions,
1103+ DerivedTracks const & tracks,
1104+ soa::Filtered<aod::CF2ProngTracks> const & p2tracks)
1105+ {
1106+ cfTrackToCFCollision.clear ();
1107+ cfTrackToCFCollision.reserve (tracks.size ());
1108+
1109+ for (const auto & trk : tracks) {
1110+ cfTrackToCFCollision.emplace (trk.globalIndex (), trk.cfCollisionId ());
1111+ }
1112+
1113+ processMixedDerivedT (collisions, p2tracks, tracks);
1114+ }
1115+
1116+ PROCESS_SWITCH (CorrelationTask, processMixed2ProngDerivedMixedPhi, " Process mixed events for mixed-phi triggers" , false );
10741117
10751118 void processMixed2ProngDerivedML (DerivedCollisions const & collisions, DerivedTracks const & tracks, soa::Filtered<soa::Join<aod::CF2ProngTracks, aod::CF2ProngTrackmls>> const & p2tracks)
10761119 {
0 commit comments