@@ -62,6 +62,7 @@ struct HfCorrelatorDMesonPairs {
6262
6363 Configurable<int > selectionFlagD0{" selectionFlagD0" , 1 , " Selection Flag for D0" };
6464 Configurable<int > selectionFlagD0bar{" selectionFlagD0bar" , 1 , " Selection Flag for D0bar" };
65+ Configurable<int > selectionFlagHf{" selectionFlagHf" , 1 , " Selection Flag for HF flagged candidates" };
6566 Configurable<float > yCandMax{" yCandMax" , 0.8 , " maxmum |y| of D0 candidates" };
6667 Configurable<float > ptCandMin{" ptCandMin" , -1 ., " minimum pT of D0 candidates" };
6768 Configurable<std::vector<double >> binsPt{" binsPt" , std::vector<double >{o2::analysis::hf_cuts_d0_to_pi_k::vecBinsPt}, " pT bin limits for candidate mass plots" };
@@ -74,7 +75,7 @@ struct HfCorrelatorDMesonPairs {
7475 using TracksWPid = soa::Join<aod::Tracks, aod::TracksPidPi, aod::PidTpcTofFullPi, aod::TracksPidKa, aod::PidTpcTofFullKa>;
7576
7677 Partition<soa::Join<aod::HfCand2Prong, aod::HfSelD0>> selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar;
77- Partition<soa::Join<aod::HfCand2Prong, aod::HfSelD0, aod::HfCand2ProngMcRec>> selectedD0CandidatesMc = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar ;
78+ Partition<soa::Join<aod::HfCand2Prong, aod::HfSelD0, aod::HfCand2ProngMcRec>> selectedD0CandidatesMc = aod::hf_sel_candidate_d0::isRecoHfFlag >= selectionFlagHf ;
7879
7980 HistogramConfigSpec hTH1Pt{HistType::kTH1F , {{180 , 0 ., 36 .}}};
8081 HistogramConfigSpec hTH1Y{HistType::kTH1F , {{100 , -5 ., 5 .}}};
@@ -370,11 +371,9 @@ struct HfCorrelatorDMesonPairs {
370371 }
371372
372373 // / Fill selection status histogram
373- // / \param candidate1 is the first candidate of the pair
374- // / \param candidate2 is the second candidate of the pair
375- template <typename T>
376- void fillEntry (const T& candidate1, const T& candidate2, const bool & isDCand1, const bool & isDbarCand1,
377- const bool & isDCand2, const bool & isDbarCand2, const uint8_t & candidateType1, const uint8_t & candidateType2)
374+ void fillEntry (const bool & isDCand1, const bool & isDbarCand1, const bool & isDCand2, const bool & isDbarCand2,
375+ const uint8_t & candidateType1, const uint8_t & candidateType2, float yCand1, float yCand2,
376+ double ptCand1, double ptCand2, float massDCand1, float massDbarCand1, float massDCand2, float massDbarCand2)
378377 {
379378
380379 // / Fill information on the D candidates
@@ -399,12 +398,6 @@ struct HfCorrelatorDMesonPairs {
399398 // / Collect information on the D pairs
400399 uint8_t pairType (0 );
401400 registry.fill (HIST (" hSelectionStatus" ), 1 );
402- float yCand1 = hfHelper.yD0 (candidate1);
403- float yCand2 = hfHelper.yD0 (candidate2);
404- float massDCand1 = hfHelper.invMassD0ToPiK (candidate1);
405- float massDbarCand1 = hfHelper.invMassD0barToKPi (candidate1);
406- float massDCand2 = hfHelper.invMassD0ToPiK (candidate2);
407- float massDbarCand2 = hfHelper.invMassD0barToKPi (candidate2);
408401 if (isDCand1 && isDCand2) {
409402 SETBIT (pairType, DD);
410403 registry.fill (HIST (" hSelectionStatus" ), 14 );
@@ -434,7 +427,7 @@ struct HfCorrelatorDMesonPairs {
434427 }
435428 }
436429
437- entryD0Pair (candidate1. pt (), candidate2. pt () , yCand1, yCand2, massDCand1, massDbarCand1, massDCand2, massDbarCand2, pairType, candidateType1, candidateType2);
430+ entryD0Pair (ptCand1, ptCand2 , yCand1, yCand2, massDCand1, massDbarCand1, massDCand2, massDbarCand2, pairType, candidateType1, candidateType2);
438431 }
439432
440433 // / D0(bar)-D0(bar) correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth)
@@ -493,7 +486,9 @@ struct HfCorrelatorDMesonPairs {
493486 bool isDCand2 = isD (candidateType2);
494487 bool isDbarCand2 = isDbar (candidateType2);
495488
496- fillEntry (candidate1, candidate2, isDCand1, isDbarCand1, isDCand2, isDbarCand2, candidateType1, candidateType2);
489+ fillEntry (isDCand1, isDbarCand1, isDCand2, isDbarCand2, candidateType1, candidateType2, hfHelper.yD0 (candidate1), hfHelper.yD0 (candidate2),
490+ candidate1.pt (), candidate2.pt (), hfHelper.invMassD0ToPiK (candidate1), hfHelper.invMassD0barToKPi (candidate1),
491+ hfHelper.invMassD0ToPiK (candidate2), hfHelper.invMassD0barToKPi (candidate2));
497492 } // end inner loop (Cand2)
498493 } // end outer loop (Cand1)
499494 }
@@ -512,20 +507,27 @@ struct HfCorrelatorDMesonPairs {
512507 return ;
513508 }
514509 for (const auto & candidate1 : selectedD0CandidatesGroupedMc) {
510+ auto ptCandidate1 = candidate1.pt ();
511+ auto yCandidate1 = hfHelper.yD0 (candidate1);
512+ float massD0Cand1 = hfHelper.invMassD0ToPiK (candidate1);
513+ float massD0barCand1 = hfHelper.invMassD0barToKPi (candidate1);
514+ auto prong0Cand1 = candidate1.template prong0_as <TracksWPid>();
515+ auto prong1Cand1 = candidate1.template prong1_as <TracksWPid>();
516+
515517 if (abs (hfHelper.yD0 (candidate1)) > yCandMax) {
516518 continue ;
517519 }
518520 if (ptCandMin >= 0 . && candidate1.pt () < ptCandMin) {
519521 continue ;
520522 }
521- auto prong0Cand1 = candidate1.template prong0_as <TracksWPid>();
522- auto prong1Cand1 = candidate1.template prong1_as <TracksWPid>();
523-
524- bool isSignalD0Cand1 = std::abs (hfHelper.invMassD0ToPiK (candidate1) - MassD0) < massCut;
525- bool isSignalD0barCand1 = std::abs (hfHelper.invMassD0barToKPi (candidate1) - MassD0Bar) < massCut;
523+ bool isSignalD0Cand1 = std::abs (massD0Cand1 - MassD0) < massCut;
524+ bool isSignalD0barCand1 = std::abs (massD0barCand1 - MassD0Bar) < massCut;
526525 if (selectSignalRegionOnly && !(isSignalD0Cand1 || isSignalD0barCand1)) {
527526 continue ;
528527 }
528+ if (!(candidate1.isSelD0 () >= selectionFlagD0 || candidate1.isSelD0bar () >= selectionFlagD0bar)) {
529+ continue ;
530+ }
529531
530532 auto candidateType1 = assignCandidateTypeD0<true >(candidate1); // Candidate type attribution
531533
@@ -544,21 +546,28 @@ struct HfCorrelatorDMesonPairs {
544546 }
545547
546548 for (auto candidate2 = candidate1 + 1 ; candidate2 != selectedD0CandidatesGroupedMc.end (); ++candidate2) {
549+ auto ptCandidate2 = candidate2.pt ();
550+ auto yCandidate2 = hfHelper.yD0 (candidate2);
551+ float massD0Cand2 = hfHelper.invMassD0ToPiK (candidate2);
552+ float massD0barCand2 = hfHelper.invMassD0barToKPi (candidate2);
553+ auto prong0Cand2 = candidate2.template prong0_as <TracksWPid>();
554+ auto prong1Cand2 = candidate2.template prong1_as <TracksWPid>();
555+
547556 if (abs (hfHelper.yD0 (candidate2)) > yCandMax) {
548557 continue ;
549558 }
550559 if (ptCandMin >= 0 . && candidate2.pt () < ptCandMin) {
551560 continue ;
552561 }
553- auto prong0Cand2 = candidate2. template prong0_as <TracksWPid>() ;
554- auto prong1Cand2 = candidate2. template prong1_as <TracksWPid>() ;
555- if (daughterTracksCutFlag && ((prong0Cand1 == prong0Cand2) || (prong1Cand1 == prong1Cand2) || (prong0Cand1 == prong1Cand2) || (prong1Cand1 == prong0Cand2) )) {
562+ bool isSignalD0Cand2 = std::abs (massD0Cand2 - MassD0) < massCut ;
563+ bool isSignalD0barCand2 = std::abs (massD0barCand2 - MassD0Bar) < massCut ;
564+ if (selectSignalRegionOnly && !(isSignalD0Cand2 || isSignalD0barCand2 )) {
556565 continue ;
557566 }
558-
559- bool isSignalD0Cand2 = std::abs (hfHelper. invMassD0ToPiK (candidate2) - MassD0) < massCut ;
560- bool isSignalD0barCand2 = std::abs (hfHelper. invMassD0barToKPi (candidate2) - MassD0Bar) < massCut;
561- if (selectSignalRegionOnly && !(isSignalD0Cand2 || isSignalD0barCand2 )) {
567+ if (!(candidate2. isSelD0 () >= selectionFlagD0 || candidate2. isSelD0bar () >= selectionFlagD0bar)) {
568+ continue ;
569+ }
570+ if (daughterTracksCutFlag && ((prong0Cand1 == prong0Cand2) || (prong1Cand1 == prong1Cand2) || (prong0Cand1 == prong1Cand2) || (prong1Cand1 == prong0Cand2) )) {
562571 continue ;
563572 }
564573 auto candidateType2 = assignCandidateTypeD0<true >(candidate2); // Candidate type attribution
@@ -609,7 +618,8 @@ struct HfCorrelatorDMesonPairs {
609618 } else if (isTrueDbarCand1 && isTrueDCand2) {
610619 registry.fill (HIST (" hSelectionStatus" ), 25 );
611620 }
612- fillEntry (candidate1, candidate2, isDCand1, isDbarCand1, isDCand2, isDbarCand2, candidateType1, candidateType2);
621+ fillEntry (isDCand1, isDbarCand1, isDCand2, isDbarCand2, candidateType1, candidateType2, yCandidate1, yCandidate2,
622+ ptCandidate1, ptCandidate2, massD0Cand1, massD0barCand1, massD0Cand2, massD0barCand2);
613623 entryD0PairMcInfo (originRec1, originRec2, matchedRec1, matchedRec2);
614624 } // end inner loop (Cand2)
615625 } // end outer loop (Cand1)
0 commit comments