2727#include " Common/CCDB/RCTSelectionFlags.h"
2828#include " Common/DataModel/Centrality.h"
2929#include " Common/DataModel/EventSelection.h"
30+ #include " Common/DataModel/PIDResponseTPC.h"
3031#include " Common/DataModel/TrackSelectionTables.h"
3132
3233#include < CCDB/BasicCCDBManager.h>
5758#include < cstddef>
5859#include < cstdint>
5960#include < map>
60- #include < random>
6161#include < string>
62- #include < string_view>
63- #include < tuple>
62+ #include < unordered_map>
6463#include < utility>
6564#include < vector>
6665
@@ -272,9 +271,7 @@ struct DileptonProducer {
272271 float d_bz;
273272
274273 o2::framework::HistogramRegistry fRegistry {" output" , {}, o2::framework::OutputObjHandlingPolicy::AnalysisObject, false , false };
275- static constexpr std::string_view event_pair_types[2 ] = {" same/" , " mix/" };
276274
277- std::mt19937 engine;
278275 float leptonM1 = 0 .f;
279276 float leptonM2 = 0 .f;
280277
@@ -289,9 +286,6 @@ struct DileptonProducer {
289286 ccdb->setFatalWhenNull (false );
290287 rctChecker.init (eventcuts.cfgRCTLabel .value , eventcuts.cfgCheckZDC .value , eventcuts.cfgTreatLimitedAcceptanceAsBad .value );
291288
292- std::random_device seed_gen;
293- engine = std::mt19937 (seed_gen ());
294-
295289 DefineEMEventCut ();
296290 if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron ) {
297291 DefineDielectronCut ();
@@ -461,7 +455,7 @@ struct DileptonProducer {
461455 }
462456
463457 template <typename TCollision, typename TTrack1, typename TTrack2, typename TCut, typename TAllTracks>
464- bool fillPairInfo (TCollision const &, TTrack1 const & t1, TTrack2 const & t2, TCut const & cut, TAllTracks const & tracks )
458+ bool fillPairInfo (TCollision const &, TTrack1 const & t1, TTrack2 const & t2, TCut const & cut, TAllTracks const &)
465459 {
466460 if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron ) {
467461 if (dielectroncuts.cfg_pid_scheme == static_cast <int >(DielectronCut::PIDSchemes::kPIDML )) {
@@ -477,13 +471,16 @@ struct DileptonProducer {
477471 if (!cut.template IsSelectedTrack <false >(t1) || !cut.template IsSelectedTrack <false >(t2)) {
478472 return false ;
479473 }
480-
481- if (!o2::aod::pwgem::dilepton::utils::emtrackutil::isBestMatch (t1, cut, tracks)) {
482- return false ;
483- }
484- if (!o2::aod::pwgem::dilepton::utils::emtrackutil::isBestMatch (t2, cut, tracks)) {
474+ if (!map_best_match_globalmuon[t1.globalIndex ()] || !map_best_match_globalmuon[t2.globalIndex ()]) {
485475 return false ;
486476 }
477+
478+ // if (!o2::aod::pwgem::dilepton::utils::emtrackutil::isBestMatch(t1, cut, tracks)) {
479+ // return false;
480+ // }
481+ // if (!o2::aod::pwgem::dilepton::utils::emtrackutil::isBestMatch(t2, cut, tracks)) {
482+ // return false;
483+ // }
487484 }
488485
489486 if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron ) {
@@ -539,6 +536,7 @@ struct DileptonProducer {
539536 o2::framework::SliceCache cache;
540537 o2::framework::Preslice<MyElectrons> perCollision_electron = o2::aod::emprimaryelectron::emeventId;
541538 o2::framework::expressions::Filter trackFilter_electron = dielectroncuts.cfg_min_pt_track < o2::aod::track::pt && dielectroncuts.cfg_min_eta_track < o2::aod::track::eta && o2::aod::track::eta < dielectroncuts.cfg_max_eta_track && nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz;
539+ o2::framework::expressions::Filter pidFilter_electron = dielectroncuts.cfg_min_TPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < dielectroncuts.cfg_max_TPCNsigmaEl;
542540 o2::framework::expressions::Filter ttcaFilter_electron = ifnode(dielectroncuts.enableTTCA.node(), o2::aod::emprimaryelectron::isAssociatedToMPC == true || o2::aod::emprimaryelectron::isAssociatedToMPC == false , o2::aod::emprimaryelectron::isAssociatedToMPC == true );
543541 o2::framework::expressions::Filter prefilter_derived_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter_derived.node() && dielectroncuts.cfg_prefilter_bits_derived.node() >= static_cast <uint16_t >(1 ),
544542 ifnode ((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast<uint16_t>(1 << int (o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee ))) > static_cast<uint16_t>(0 ), (o2::aod::emprimaryelectron::pfbderived & static_cast <uint16_t >(1 << int (o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee ))) <= static_cast<uint16_t>(0 ), true) &&
@@ -571,7 +569,6 @@ struct DileptonProducer {
571569 o2::framework::Partition<FilteredMyMuons> positive_muons = o2::aod::emprimarymuon::sign > int8_t (0 );
572570 o2::framework::Partition<FilteredMyMuons> negative_muons = o2::aod::emprimarymuon::sign < int8_t (0 );
573571
574- int ndf = 0 ;
575572 template <bool isTriggerAnalysis, typename TCollisions, typename TLeptons, typename TPresilce, typename TCut, typename TAllTracks>
576573 void runPairing (TCollisions const & collisions, TLeptons const & posTracks, TLeptons const & negTracks, TPresilce const & perCollision, TCut const & cut, TAllTracks const & tracks)
577574 {
@@ -628,7 +625,7 @@ struct DileptonProducer {
628625 } // end of DF
629626
630627 template <typename TTrack1, typename TTrack2, typename TCut, typename TAllTracks>
631- bool isPairOK (TTrack1 const & t1, TTrack2 const & t2, TCut const & cut, TAllTracks const & tracks )
628+ bool isPairOK (TTrack1 const & t1, TTrack2 const & t2, TCut const & cut, TAllTracks const &)
632629 {
633630 if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron ) {
634631 if (dielectroncuts.cfg_pid_scheme == static_cast <int >(DielectronCut::PIDSchemes::kPIDML )) {
@@ -644,13 +641,16 @@ struct DileptonProducer {
644641 if (!cut.IsSelectedTrack (t1) || !cut.IsSelectedTrack (t2)) {
645642 return false ;
646643 }
647-
648- if (!o2::aod::pwgem::dilepton::utils::emtrackutil::isBestMatch (t1, cut, tracks)) {
649- return false ;
650- }
651- if (!o2::aod::pwgem::dilepton::utils::emtrackutil::isBestMatch (t2, cut, tracks)) {
644+ if (!map_best_match_globalmuon[t1.globalIndex ()] || !map_best_match_globalmuon[t2.globalIndex ()]) {
652645 return false ;
653646 }
647+
648+ // if (!o2::aod::pwgem::dilepton::utils::emtrackutil::isBestMatch(t1, cut, tracks)) {
649+ // return false;
650+ // }
651+ // if (!o2::aod::pwgem::dilepton::utils::emtrackutil::isBestMatch(t2, cut, tracks)) {
652+ // return false;
653+ // }
654654 }
655655
656656 if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron ) {
@@ -742,6 +742,8 @@ struct DileptonProducer {
742742 passed_pairIds.shrink_to_fit ();
743743 }
744744
745+ std::unordered_map<int , bool > map_best_match_globalmuon;
746+
745747 void processAnalysis (FilteredMyCollisions const & collisions, Types const &... args)
746748 {
747749 if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron ) {
@@ -752,13 +754,14 @@ struct DileptonProducer {
752754 runPairing<false >(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut , electrons);
753755 } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon ) {
754756 auto muons = std::get<0 >(std::tie (args...));
757+ map_best_match_globalmuon = o2::aod::pwgem::dilepton::utils::emtrackutil::findBestMatchMap (muons, fDimuonCut );
755758 if (cfgApplyWeightTTCA) {
756759 fillPairWeightMap<false >(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut , muons);
757760 }
758761 runPairing<false >(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut , muons);
759762 }
760763 map_weight.clear ();
761- ndf++ ;
764+ map_best_match_globalmuon. clear () ;
762765 }
763766 PROCESS_SWITCH (DileptonProducer, processAnalysis, " run dilepton analysis" , true );
764767
0 commit comments