1414// This code runs loop over leptons.
1515// Please write to: daiki.sekihata@cern.ch
1616
17- #ifndef PWGEM_DILEPTON_CORE_DILEPTONHADRON_H_
18- #define PWGEM_DILEPTON_CORE_DILEPTONHADRON_H_
17+ #ifndef PWGEM_DILEPTON_CORE_DILEPTONHADRONMPC_H_
18+ #define PWGEM_DILEPTON_CORE_DILEPTONHADRONMPC_H_
1919
2020#include " PWGEM/Dilepton/Core/DielectronCut.h"
2121#include " PWGEM/Dilepton/Core/DimuonCut.h"
@@ -97,7 +97,7 @@ using MyEMH_dimuon = o2::aod::pwgem::dilepton::utils::EventMixingHandler<std::tu
9797using MyEMH_track = o2::aod::pwgem::dilepton::utils::EventMixingHandler<std::tuple<int , int , int , int >, std::pair<int , int >, EMTrack>; // for charged track
9898
9999template <o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType pairtype, typename TEMH, typename ... Types>
100- struct DileptonHadron {
100+ struct DileptonHadronMPC {
101101
102102 // Configurables
103103 Configurable<std::string> ccdburl{" ccdb-url" , " http://alice-ccdb.cern.ch" , " url of the ccdb repository" };
@@ -133,7 +133,7 @@ struct DileptonHadron {
133133 ConfigurableAxis ConfRapidityBins{" ConfRapidityBins" , {20 , -1 , 1 }, " rapidity bins for output histograms" };
134134 ConfigurableAxis ConfDEtaBins{" ConfDEtaBins" , {60 , -3 , 3 }, " deta bins for output histograms" };
135135 Configurable<int > cfgNbinsDPhi{" cfgNbinsDPhi" , 36 , " nbins in dphi for output histograms" };
136- Configurable<int > cfgNbinsCosNDPhi{" cfgNbinsCosNDPhi" , 100 , " nbins in cos(n(dphi)) for output histograms" };
136+ Configurable<int > cfgNbinsCosNDPhi{" cfgNbinsCosNDPhi" , 200 , " nbins in cos(n(dphi)) for output histograms" };
137137 Configurable<int > cfgNmod{" cfgNmod" , 2 , " n-th harmonics" };
138138
139139 EMEventCut fEMEventCut ;
@@ -397,10 +397,7 @@ struct DileptonHadron {
397397 leptonM2 = o2::constants::physics::MassMuon;
398398 }
399399
400- fRegistry .add (" DileptonHadron/mix/hDiffBC" , " diff. global BC in mixed event;|BC_{current} - BC_{mixed}|" , kTH1D , {{10001 , -0.5 , 10000.5 }}, true );
401- fRegistry .addClone (" DileptonHadron/mix/hDiffBC" , " HadronHadron/mix/hDiffBC" );
402-
403- if (doprocessTriggerAnalysis) {
400+ if (doprocess2PCwithTrigger) {
404401 fRegistry .add (" Event/hNInspectedTVX" , " N inspected TVX;run number;N_{TVX}" , kTProfile , {{80000 , 520000.5 , 600000.5 }}, true );
405402 }
406403 }
@@ -453,7 +450,7 @@ struct DileptonHadron {
453450 }
454451 }
455452
456- ~DileptonHadron ()
453+ ~DileptonHadronMPC ()
457454 {
458455 delete emh_pos;
459456 emh_pos = 0x0 ;
@@ -466,6 +463,9 @@ struct DileptonHadron {
466463
467464 void addhistograms ()
468465 {
466+ // event info
467+ o2::aod::pwgem::dilepton::utils::eventhistogram::addEventHistograms<-1 >(&fRegistry );
468+
469469 std::string mass_axis_title = " m_{ll} (GeV/c^{2})" ;
470470 std::string pair_pt_axis_title = " p_{T,ll}^{trg} (GeV/c)" ;
471471 std::string pair_dca_axis_title = " DCA_{ll} (#sigma)" ;
@@ -525,6 +525,13 @@ struct DileptonHadron {
525525 fRegistry .addClone (" Dilepton/same/uls/" , " Dilepton/same/lspp/" );
526526 fRegistry .addClone (" Dilepton/same/uls/" , " Dilepton/same/lsmm/" );
527527 fRegistry .addClone (" Dilepton/same/" , " Dilepton/mix/" );
528+
529+ // hadron-hadron
530+ const AxisSpec axis_deta_hh{ConfDEtaBins, " #Delta#eta = #eta_{h}^{trg} - #eta_{h}^{ref}" };
531+ // const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI/2, 3 * M_PI/2, "#Delta#varphi = #varphi_{h}^{trg} - #varphi_{h}^{ref} (rad.)"};
532+ const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1 , +1 , std::format (" cos({0:d}(#varphi_{{h}}^{{trg}} - #varphi_{{h}}^{{ref}}))" , cfgNmod.value )};
533+ fRegistry .add (" HadronHadron/same/hs" , " hadron-hadron 2PC" , kTHnSparseD , {axis_pt_trg, axis_pt_ref, axis_deta_hh, axis_cosndphi_hh}, true );
534+ // fRegistry.addClone("HadronHadron/same/", "HadronHadron/mix/");
528535 } else { // same as kCumulant to avoid seg. fault
529536 fRegistry .add (" Hadron/hs" , " hadron" , kTHnSparseD , {axis_pt_trg, axis_eta_trg, axis_phi_trg}, true );
530537
@@ -537,17 +544,15 @@ struct DileptonHadron {
537544 fRegistry .addClone (" Dilepton/same/uls/" , " Dilepton/same/lspp/" );
538545 fRegistry .addClone (" Dilepton/same/uls/" , " Dilepton/same/lsmm/" );
539546 fRegistry .addClone (" Dilepton/same/" , " Dilepton/mix/" );
540- }
541-
542- // hadron-hadron
543- const AxisSpec axis_deta_hh{ConfDEtaBins, " #Delta#eta = #eta_{h}^{trg} - #eta_{h}^{ref}" };
544- // const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI/2, 3 * M_PI/2, "#Delta#varphi = #varphi_{h}^{trg} - #varphi_{h}^{ref} (rad.)"};
545- const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1 , +1 , std::format (" cos({0:d}(#varphi_{{h}}^{{trg}} - #varphi_{{h}}^{{ref}}))" , cfgNmod.value )};
546- fRegistry .add (" HadronHadron/same/hs" , " hadron-hadron 2PC" , kTHnSparseD , {axis_pt_trg, axis_pt_ref, axis_deta_hh, axis_cosndphi_hh}, true );
547- fRegistry .addClone (" HadronHadron/same/" , " HadronHadron/mix/" );
548547
549- // event info
550- o2::aod::pwgem::dilepton::utils::eventhistogram::addEventHistograms<-1 >(&fRegistry );
548+ // hadron-hadron
549+ const AxisSpec axis_deta_hh{ConfDEtaBins, " #Delta#eta = #eta_{h}^{trg} - #eta_{h}^{ref}" };
550+ // const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI/2, 3 * M_PI/2, "#Delta#varphi = #varphi_{h}^{trg} - #varphi_{h}^{ref} (rad.)"};
551+ const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1 , +1 , std::format (" cos({0:d}(#varphi_{{h}}^{{trg}} - #varphi_{{h}}^{{ref}}))" , cfgNmod.value )};
552+ fRegistry .add (" HadronHadron/same/hs" , " hadron-hadron 2PC" , kTHnSparseD , {axis_pt_trg, axis_pt_ref, axis_deta_hh, axis_cosndphi_hh}, true );
553+ // fRegistry.addClone("HadronHadron/same/", "HadronHadron/mix/");
554+ }
555+ fRegistry .add (" Dilepton/mix/hDiffBC" , " diff. global BC in mixed event;|BC_{current} - BC_{mixed}|" , kTH1D , {{10001 , -0.5 , 10000.5 }}, true );
551556 }
552557
553558 void DefineEMEventCut ()
@@ -1053,6 +1058,8 @@ struct DileptonHadron {
10531058 if (!fEMTrackCut .IsSelected (t1) || !fEMTrackCut .IsSelected (t2)) { // for charged track
10541059 return false ;
10551060 }
1061+ } else {
1062+ return false ; // mixed event is not necessary for cumulant method.
10561063 }
10571064
10581065 float weight = 1 .f ;
@@ -1063,21 +1070,9 @@ struct DileptonHadron {
10631070 float cosndphi = std::cos (cfgNmod * dphi);
10641071
10651072 if (cfgAnalysisType == static_cast <int >(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kCumulant )) {
1066- if (t1.sign () * t2.sign () < 0 ) { // ULS
1067- fRegistry .fill (HIST (" HadronHadron/" ) + HIST (event_pair_types[ev_id]) + HIST (" hs" ), t1.pt (), t2.pt (), deta, cosndphi, weight);
1068- } else if (t1.sign () > 0 && t2.sign () > 0 ) { // LS++
1069- fRegistry .fill (HIST (" HadronHadron/" ) + HIST (event_pair_types[ev_id]) + HIST (" hs" ), t1.pt (), t2.pt (), deta, cosndphi, weight);
1070- } else if (t1.sign () < 0 && t2.sign () < 0 ) { // LS-
1071- fRegistry .fill (HIST (" HadronHadron/" ) + HIST (event_pair_types[ev_id]) + HIST (" hs" ), t1.pt (), t2.pt (), deta, cosndphi, weight);
1072- }
1073- } else { // same as kCumulant to avoid seg. fault
1074- if (t1.sign () * t2.sign () < 0 ) { // ULS
1075- fRegistry .fill (HIST (" HadronHadron/" ) + HIST (event_pair_types[ev_id]) + HIST (" hs" ), t1.pt (), t2.pt (), deta, cosndphi, weight);
1076- } else if (t1.sign () > 0 && t2.sign () > 0 ) { // LS++
1077- fRegistry .fill (HIST (" HadronHadron/" ) + HIST (event_pair_types[ev_id]) + HIST (" hs" ), t1.pt (), t2.pt (), deta, cosndphi, weight);
1078- } else if (t1.sign () < 0 && t2.sign () < 0 ) { // LS--
1079- fRegistry .fill (HIST (" HadronHadron/" ) + HIST (event_pair_types[ev_id]) + HIST (" hs" ), t1.pt (), t2.pt (), deta, cosndphi, weight);
1080- }
1073+ fRegistry .fill (HIST (" HadronHadron/" ) + HIST (event_pair_types[ev_id]) + HIST (" hs" ), t1.pt (), t2.pt (), deta, cosndphi, weight);
1074+ } else { // same as kCumulant to avoid seg. fault
1075+ fRegistry .fill (HIST (" HadronHadron/" ) + HIST (event_pair_types[ev_id]) + HIST (" hs" ), t1.pt (), t2.pt (), deta, cosndphi, weight);
10811076 }
10821077
10831078 // // store tracks for event mixing without double counting
@@ -1199,7 +1194,7 @@ struct DileptonHadron {
11991194 int ndf = 0 ;
12001195
12011196 template <bool isTriggerAnalysis, typename TCollisions, typename TLeptons, typename TPresilce, typename TCut, typename TAllTracks, typename TRefTracks>
1202- void runPairing (TCollisions const & collisions, TLeptons const & posTracks, TLeptons const & negTracks, TPresilce const & perCollision, TCut const & cut, TAllTracks const & tracks, TRefTracks const & refTracks)
1197+ void run2PC (TCollisions const & collisions, TLeptons const & posTracks, TLeptons const & negTracks, TPresilce const & perCollision, TCut const & cut, TAllTracks const & tracks, TRefTracks const & refTracks)
12031198 {
12041199 for (const auto & collision : collisions) {
12051200 initCCDB<isTriggerAnalysis>(collision);
@@ -1230,8 +1225,8 @@ struct DileptonHadron {
12301225
12311226 auto refTracks_per_coll = refTracks.sliceBy (perCollision_track, collision.globalIndex ());
12321227 for (const auto & track : refTracks_per_coll) {
1233- if (fEMTrackCut .IsSelected (track)) { // for charged track
1234- fRegistry .fill (HIST (" Hadron/hs" ), track.pt (), track.eta (), track.phi ()); // accepted
1228+ if (fEMTrackCut .IsSelected (track)) {
1229+ fRegistry .fill (HIST (" Hadron/hs" ), track.pt (), track.eta (), track.phi ());
12351230 }
12361231 }
12371232
@@ -1244,32 +1239,34 @@ struct DileptonHadron {
12441239 bool is_pair_ok = fillDilepton<0 >(collision, pos, neg, cut, tracks);
12451240 if (is_pair_ok) {
12461241 nuls++;
1247- }
1248- for ( const auto & reftrack : refTracks_per_coll) {
1249- fillDileptonHadron< 0 >(collision, pos, neg, cut, tracks, reftrack);
1242+ for ( const auto & reftrack : refTracks_per_coll) {
1243+ fillDileptonHadron< 0 >(collision, pos, neg, cut, tracks, reftrack);
1244+ }
12501245 }
12511246 }
12521247 for (const auto & [pos1, pos2] : combinations (CombinationsStrictlyUpperIndexPolicy (posTracks_per_coll, posTracks_per_coll))) { // LS++
12531248 bool is_pair_ok = fillDilepton<0 >(collision, pos1, pos2, cut, tracks);
12541249 if (is_pair_ok) {
12551250 nlspp++;
1256- }
1257- for ( const auto & reftrack : refTracks_per_coll) {
1258- fillDileptonHadron< 0 >(collision, pos1, pos2, cut, tracks, reftrack);
1251+ for ( const auto & reftrack : refTracks_per_coll) {
1252+ fillDileptonHadron< 0 >(collision, pos1, pos2, cut, tracks, reftrack);
1253+ }
12591254 }
12601255 }
12611256 for (const auto & [neg1, neg2] : combinations (CombinationsStrictlyUpperIndexPolicy (negTracks_per_coll, negTracks_per_coll))) { // LS--
12621257 bool is_pair_ok = fillDilepton<0 >(collision, neg1, neg2, cut, tracks);
12631258 if (is_pair_ok) {
12641259 nlsmm++;
1265- }
1266- for ( const auto & reftrack : refTracks_per_coll) {
1267- fillDileptonHadron< 0 >(collision, neg1, neg2, cut, tracks, reftrack);
1260+ for ( const auto & reftrack : refTracks_per_coll) {
1261+ fillDileptonHadron< 0 >(collision, neg1, neg2, cut, tracks, reftrack);
1262+ }
12681263 }
12691264 }
12701265
1271- for (const auto & [trg, ref] : combinations (CombinationsStrictlyUpperIndexPolicy (refTracks_per_coll, refTracks_per_coll))) {
1272- fillHadronHadron<0 >(trg, ref);
1266+ if (nuls > 0 || nlspp > 0 || nlsmm > 0 ) { // at least 1 pair exists.
1267+ for (const auto & [trg, ref] : combinations (CombinationsStrictlyUpperIndexPolicy (refTracks_per_coll, refTracks_per_coll))) {
1268+ fillHadronHadron<0 >(trg, ref);
1269+ }
12731270 }
12741271
12751272 if (!cfgDoMix || !(nuls > 0 || nlspp > 0 || nlsmm > 0 )) {
@@ -1328,7 +1325,7 @@ struct DileptonHadron {
13281325
13291326 auto globalBC_mix = map_mixed_eventId_to_globalBC[mix_dfId_collisionId];
13301327 uint64_t diffBC = std::max (collision.globalBC (), globalBC_mix) - std::min (collision.globalBC (), globalBC_mix);
1331- fRegistry .fill (HIST (" DileptonHadron /mix/hDiffBC" ), diffBC);
1328+ fRegistry .fill (HIST (" Dilepton /mix/hDiffBC" ), diffBC);
13321329 if (diffBC < ndiff_bc_mix) {
13331330 continue ;
13341331 }
@@ -1491,49 +1488,49 @@ struct DileptonHadron {
14911488 passed_pairIds.shrink_to_fit ();
14921489 }
14931490
1494- void processAnalysis (FilteredMyCollisions const & collisions, MyTracks const & refTracks, Types const &... args)
1491+ void process2PC (FilteredMyCollisions const & collisions, MyTracks const & refTracks, Types const &... args)
14951492 {
14961493 if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron ) {
14971494 auto electrons = std::get<0 >(std::tie (args...));
14981495 if (cfgApplyWeightTTCA) {
14991496 fillPairWeightMap<false >(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut , electrons);
15001497 }
1501- runPairing <false >(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut , electrons, refTracks);
1498+ run2PC <false >(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut , electrons, refTracks);
15021499 } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon ) {
15031500 auto muons = std::get<0 >(std::tie (args...));
15041501 if (cfgApplyWeightTTCA) {
15051502 fillPairWeightMap<false >(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut , muons);
15061503 }
1507- runPairing <false >(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut , muons, refTracks);
1504+ run2PC <false >(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut , muons, refTracks);
15081505 }
15091506 map_weight.clear ();
15101507 ndf++;
15111508 }
1512- PROCESS_SWITCH (DileptonHadron, processAnalysis , " run dilepton analysis" , true );
1509+ PROCESS_SWITCH (DileptonHadronMPC, process2PC , " run dilepton analysis" , true );
15131510
15141511 using FilteredMyCollisionsWithSWT = soa::Filtered<MyCollisionsWithSWT>;
1515- void processTriggerAnalysis (FilteredMyCollisionsWithSWT const & collisions, MyTracks const & refTracks, Types const &... args)
1512+ void process2PCwithTrigger (FilteredMyCollisionsWithSWT const & collisions, MyTracks const & refTracks, Types const &... args)
15161513 {
15171514 if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron ) {
15181515 auto electrons = std::get<0 >(std::tie (args...));
15191516 if (cfgApplyWeightTTCA) {
15201517 fillPairWeightMap<true >(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut , electrons);
15211518 }
1522- runPairing <true >(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut , electrons, refTracks);
1519+ run2PC <true >(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut , electrons, refTracks);
15231520 } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon ) {
15241521 auto muons = std::get<0 >(std::tie (args...));
15251522 if (cfgApplyWeightTTCA) {
15261523 fillPairWeightMap<true >(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut , muons);
15271524 }
1528- runPairing <true >(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut , muons, refTracks);
1525+ run2PC <true >(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut , muons, refTracks);
15291526 }
15301527 map_weight.clear ();
15311528 ndf++;
15321529 }
1533- PROCESS_SWITCH (DileptonHadron, processTriggerAnalysis , " run dilepton analysis on triggered data" , false );
1530+ PROCESS_SWITCH (DileptonHadronMPC, process2PCwithTrigger , " run dilepton analysis on triggered data" , false );
15341531
15351532 void processDummy (MyCollisions const &) {}
1536- PROCESS_SWITCH (DileptonHadron , processDummy, " Dummy function" , false );
1533+ PROCESS_SWITCH (DileptonHadronMPC , processDummy, " Dummy function" , false );
15371534};
15381535
1539- #endif // PWGEM_DILEPTON_CORE_DILEPTONHADRON_H_
1536+ #endif // PWGEM_DILEPTON_CORE_DILEPTONHADRONMPC_H_
0 commit comments