@@ -66,7 +66,8 @@ struct HfTaskCorrelationDsHadrons {
6666 Configurable<std::vector<int >> classMl{" classMl" , {0 , 1 , 2 }, " Indexes of ML scores to be stored. Three indexes max." };
6767 Configurable<std::vector<double >> binsPtD{" binsPtD" , std::vector<double >{o2::analysis::hf_cuts_ds_to_k_k_pi::vecBinsPt}, " pT bin limits for candidate mass plots and efficiency" };
6868 Configurable<std::vector<double >> binsPtHadron{" binsPtHadron" , std::vector<double >{0.3 , 2 ., 4 ., 8 ., 12 ., 50 .}, " pT bin limits for assoc particle efficiency" };
69- Configurable<std::vector<double >> mlOutputPrompt{" mlOutputPrompt" , {0.5 , 0.5 , 0.5 , 0.5 }, " Machine learning scores for prompt" };
69+ Configurable<std::vector<double >> mlOutputPromptMin{" mlOutputPromptMin" , {0.5 , 0.5 , 0.5 , 0.5 }, " Machine learning scores for prompt" };
70+ Configurable<std::vector<double >> mlOutputPromptMax{" mlOutputPromptMax" , {1.0 , 1.0 , 1.0 , 1.0 }, " Machine learning scores for prompt" };
7071 Configurable<std::vector<double >> mlOutputBkg{" mlOutputBkg" , {0.5 , 0.5 , 0.5 , 0.5 }, " Machine learning scores for bkg" };
7172 Configurable<std::vector<double >> binsPtEfficiencyD{" binsPtEfficiencyD" , std::vector<double >{o2::analysis::hf_cuts_ds_to_k_k_pi::vecBinsPt}, " pT bin limits for D-meson efficiency" };
7273 Configurable<std::vector<double >> binsPtEfficiencyHad{" binsPtEfficiencyHad" , std::vector<double >{0.3 , 2 ., 4 ., 8 ., 12 ., 50 .}, " pT bin limits for associated particle efficiency" };
@@ -266,6 +267,12 @@ struct HfTaskCorrelationDsHadrons {
266267 }
267268 }
268269
270+ bool isSelectedCandidate (const int ptBinD, const float bdtScorePrompt, const float bdtScoreBkg)
271+ {
272+
273+ return (ptBinD != -1 && bdtScorePrompt >= mlOutputPromptMin->at (ptBinD) && bdtScorePrompt <= mlOutputPromptMax->at (ptBinD) && bdtScoreBkg <= mlOutputBkg->at (ptBinD));
274+ }
275+
269276 void processData (DsHadronPairWithMl const & pairEntries,
270277 aod::DsCandRecoInfo const & candidates)
271278 {
@@ -276,9 +283,10 @@ struct HfTaskCorrelationDsHadrons {
276283 float bdtScoreBkg = candidate.mlScoreBkg ();
277284 int ptBinD = o2::analysis::findBin (binsPtD, ptD);
278285
279- if (bdtScorePrompt < mlOutputPrompt-> at (ptBinD) || bdtScoreBkg > mlOutputBkg-> at (ptBinD )) {
286+ if (! isSelectedCandidate (ptBinD, bdtScorePrompt, bdtScoreBkg)) {
280287 continue ;
281288 }
289+
282290 double efficiencyWeightD = 1 .;
283291 if (applyEfficiency) {
284292 efficiencyWeightD = 1 . / efficiencyD->at (o2::analysis::findBin (binsPtEfficiencyD, ptD));
@@ -306,9 +314,10 @@ struct HfTaskCorrelationDsHadrons {
306314 int poolBin = pairEntry.poolBin ();
307315 int ptBinD = o2::analysis::findBin (binsPtD, ptD);
308316
309- if (bdtScorePrompt < mlOutputPrompt-> at (ptBinD) || bdtScoreBkg > mlOutputBkg-> at (ptBinD )) {
317+ if (! isSelectedCandidate (ptBinD, bdtScorePrompt, bdtScoreBkg)) {
310318 continue ;
311319 }
320+
312321 if (trackDcaXY > dcaXYTrackMax || trackDcaZ > dcaZTrackMax || trackTpcCrossedRows < nTpcCrossedRaws) {
313322 continue ;
314323 }
@@ -354,9 +363,10 @@ struct HfTaskCorrelationDsHadrons {
354363 int ptBinD = o2::analysis::findBin (binsPtD, ptD);
355364 bool isDsPrompt = candidate.isPrompt ();
356365
357- if (bdtScorePrompt < mlOutputPrompt-> at (ptBinD) || bdtScoreBkg > mlOutputBkg-> at (ptBinD )) {
366+ if (! isSelectedCandidate (ptBinD, bdtScorePrompt, bdtScoreBkg)) {
358367 continue ;
359368 }
369+
360370 double efficiencyWeightD = 1 .;
361371 if (applyEfficiency) {
362372 efficiencyWeightD = 1 . / efficiencyD->at (o2::analysis::findBin (binsPtEfficiencyD, ptD));
@@ -393,9 +403,10 @@ struct HfTaskCorrelationDsHadrons {
393403 int ptBinD = o2::analysis::findBin (binsPtD, ptD);
394404 bool isPhysicalPrimary = pairEntry.isPhysicalPrimary ();
395405
396- if (bdtScorePrompt < mlOutputPrompt-> at (ptBinD) || bdtScoreBkg > mlOutputBkg-> at (ptBinD )) {
406+ if (! isSelectedCandidate (ptBinD, bdtScorePrompt, bdtScoreBkg)) {
397407 continue ;
398408 }
409+
399410 if (trackDcaXY > dcaXYTrackMax || trackDcaZ > dcaZTrackMax || trackTpcCrossedRows < nTpcCrossedRaws) {
400411 continue ;
401412 }
@@ -415,9 +426,9 @@ struct HfTaskCorrelationDsHadrons {
415426 registry.fill (HIST (" hCorrel2DVsPtSignalRegionMcRec" ), deltaPhi, deltaEta, ptD, ptHadron, statusDsPrompt, poolBin, efficiencyWeight);
416427 if (isPhysicalPrimary) {
417428 registry.fill (HIST (" hCorrel2DVsPtPhysicalPrimaryMcRec" ), deltaPhi, deltaEta, ptD, ptHadron, statusDsPrompt, poolBin, efficiencyWeight);
418- if (statusDsPrompt == 1 && statusPromptHadron == 1 ) {
429+ if (statusDsPrompt == 1 && statusPromptHadron == RecoDecay::OriginType::Prompt ) {
419430 registry.fill (HIST (" hCorrel2DVsPtSignalRegionPromptDsPromptHadronMcRec" ), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight);
420- } else if (statusDsPrompt == 0 && statusPromptHadron == 2 ) {
431+ } else if (statusDsPrompt == 0 && statusPromptHadron == RecoDecay::OriginType::NonPrompt ) {
421432 registry.fill (HIST (" hCorrel2DVsPtSignalRegionNonPromptDsNonPromptHadronMcRec" ), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight);
422433 }
423434 }
@@ -457,12 +468,12 @@ struct HfTaskCorrelationDsHadrons {
457468 registry.fill (HIST (" hDeltaPhiPtIntMcGen" ), deltaPhi);
458469 if (isDsPrompt) {
459470 registry.fill (HIST (" hCorrel2DVsPtMcGenPrompt" ), deltaPhi, deltaEta, ptD, ptHadron, poolBin);
460- if (statusPromptHadron == 1 ) {
471+ if (statusPromptHadron == RecoDecay::OriginType::Prompt ) {
461472 registry.fill (HIST (" hCorrel2DVsPtMcGenPromptDsPromptHadron" ), deltaPhi, deltaEta, ptD, ptHadron, poolBin);
462473 }
463474 } else {
464475 registry.fill (HIST (" hCorrel2DVsPtMcGenNonPrompt" ), deltaPhi, deltaEta, ptD, ptHadron, poolBin);
465- if (statusPromptHadron == 2 ) {
476+ if (statusPromptHadron == RecoDecay::OriginType::NonPrompt ) {
466477 registry.fill (HIST (" hCorrel2DVsPtMcGenNonPromptDsNonPromptHadron" ), deltaPhi, deltaEta, ptD, ptHadron, poolBin);
467478 }
468479 }
@@ -487,9 +498,10 @@ struct HfTaskCorrelationDsHadrons {
487498 int poolBin = pairEntry.poolBin ();
488499 int ptBinD = o2::analysis::findBin (binsPtD, ptD);
489500
490- if (bdtScorePrompt < mlOutputPrompt-> at (ptBinD) || bdtScoreBkg > mlOutputBkg-> at (ptBinD )) {
501+ if (! isSelectedCandidate (ptBinD, bdtScorePrompt, bdtScoreBkg)) {
491502 continue ;
492503 }
504+
493505 if (trackDcaXY > dcaXYTrackMax || trackDcaZ > dcaZTrackMax || trackTpcCrossedRows < nTpcCrossedRaws) {
494506 continue ;
495507 }
@@ -586,9 +598,10 @@ struct HfTaskCorrelationDsHadrons {
586598 int ptBinD = o2::analysis::findBin (binsPtD, ptD);
587599 bool isPhysicalPrimary = pairEntry.isPhysicalPrimary ();
588600
589- if (bdtScorePrompt < mlOutputPrompt-> at (ptBinD) || bdtScoreBkg > mlOutputBkg-> at (ptBinD )) {
601+ if (! isSelectedCandidate (ptBinD, bdtScorePrompt, bdtScoreBkg)) {
590602 continue ;
591603 }
604+
592605 if (trackDcaXY > dcaXYTrackMax || trackDcaZ > dcaZTrackMax || trackTpcCrossedRows < nTpcCrossedRaws) {
593606 continue ;
594607 }
@@ -608,9 +621,9 @@ struct HfTaskCorrelationDsHadrons {
608621 registry.fill (HIST (" hCorrel2DVsPtSignalRegionMcRec" ), deltaPhi, deltaEta, ptD, ptHadron, statusDsPrompt, poolBin, efficiencyWeight);
609622 if (isPhysicalPrimary) {
610623 registry.fill (HIST (" hCorrel2DVsPtPhysicalPrimaryMcRec" ), deltaPhi, deltaEta, ptD, ptHadron, statusDsPrompt, poolBin, efficiencyWeight);
611- if (statusDsPrompt == 1 && statusPromptHadron == 1 ) {
624+ if (statusDsPrompt == 1 && statusPromptHadron == RecoDecay::OriginType::Prompt ) {
612625 registry.fill (HIST (" hCorrel2DVsPtSignalRegionPromptDsPromptHadronMcRec" ), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight);
613- } else if (statusDsPrompt == 0 && statusPromptHadron == 2 ) {
626+ } else if (statusDsPrompt == 0 && statusPromptHadron == RecoDecay::OriginType::NonPrompt ) {
614627 registry.fill (HIST (" hCorrel2DVsPtSignalRegionNonPromptDsNonPromptHadronMcRec" ), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight);
615628 }
616629 }
@@ -720,7 +733,7 @@ struct HfTaskCorrelationDsHadrons {
720733 outputMl[iclass] = candidate.mlProbDsToPiKK ()[classMl->at (iclass)];
721734 }
722735 }
723- if (outputMl[0 ] < mlOutputPrompt ->at (o2::analysis::findBin (binsPtD, candidate.pt ())) || outputMl[2 ] > mlOutputBkg->at (o2::analysis::findBin (binsPtD, candidate.pt ()))) {
736+ if (outputMl[0 ] < mlOutputPromptMin-> at ( o2::analysis::findBin (binsPtD, candidate. pt ())) || outputMl[ 0 ] < mlOutputPromptMax ->at (o2::analysis::findBin (binsPtD, candidate.pt ())) || outputMl[2 ] > mlOutputBkg->at (o2::analysis::findBin (binsPtD, candidate.pt ()))) {
724737 continue ;
725738 }
726739
@@ -802,7 +815,7 @@ struct HfTaskCorrelationDsHadrons {
802815 outputMl[iclass] = candidate.mlProbDsToPiKK ()[classMl->at (iclass)];
803816 }
804817 }
805- if (outputMl[0 ] < mlOutputPrompt ->at (o2::analysis::findBin (binsPtD, candidate.pt ())) || outputMl[2 ] > mlOutputBkg->at (o2::analysis::findBin (binsPtD, candidate.pt ()))) {
818+ if (outputMl[0 ] < mlOutputPromptMin-> at ( o2::analysis::findBin (binsPtD, candidate. pt ())) || outputMl[ 0 ] < mlOutputPromptMax ->at (o2::analysis::findBin (binsPtD, candidate.pt ())) || outputMl[2 ] > mlOutputBkg->at (o2::analysis::findBin (binsPtD, candidate.pt ()))) {
806819 continue ;
807820 }
808821 auto collision = candidate.template collision_as <soa::Join<aod::Collisions, aod::FT0Mults, aod::EvSels>>();
@@ -897,9 +910,9 @@ struct HfTaskCorrelationDsHadrons {
897910 }
898911 if (separateTrackOrigins) {
899912 int trackOrigin = RecoDecay::getCharmHadronOrigin (mcParticles, mcParticle, true );
900- if (trackOrigin == 1 ) { // charm orgin
913+ if (trackOrigin == RecoDecay::OriginType::Prompt ) { // charm orgin
901914 registry.fill (HIST (" hPtPrmPromptPartMcGen" ), mcParticle.pt ());
902- } else if (trackOrigin == 2 ) { // beauty origin
915+ } else if (trackOrigin == RecoDecay::OriginType::NonPrompt ) { // beauty origin
903916 registry.fill (HIST (" hPtPrmNonPromptPartMcGen" ), mcParticle.pt ());
904917 }
905918 }
@@ -938,9 +951,9 @@ struct HfTaskCorrelationDsHadrons {
938951 // check track origin
939952 if (separateTrackOrigins) {
940953 int trackOrigin = RecoDecay::getCharmHadronOrigin (mcParticles, mcParticle, true );
941- if (trackOrigin == 1 ) { // charm orgin
954+ if (trackOrigin == RecoDecay::OriginType::Prompt ) { // charm orgin
942955 registry.fill (HIST (" hPtPrmPromptPartMcRec" ), track.pt ());
943- } else if (trackOrigin == 2 ) { // beauty origin
956+ } else if (trackOrigin == RecoDecay::OriginType::NonPrompt ) { // beauty origin
944957 registry.fill (HIST (" hPtPrmNonPromptPartMcRec" ), track.pt ());
945958 }
946959 }
0 commit comments