@@ -66,6 +66,7 @@ std::vector<double> efficiencyDmeson(npTBinsEfficiency + 1);
6666
6767// / Dplus-Hadron correlation pair filling task, from pair tables - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth)
6868struct HfTaskCorrelationDplusHadrons {
69+ Configurable<bool > isPromptAnalysis{" isPromptAnalysis" , true , " Flag for prompt D+-hadron correlations" };
6970 Configurable<bool > fillHistoData{" fillHistoData" , true , " Flag for filling histograms in data processes" };
7071 Configurable<bool > fillHistoMcRec{" fillHistoMcRec" , true , " Flag for filling histograms in MC Rec processes" };
7172 Configurable<bool > fillHistoMcGen{" fillHistoMcGen" , true , " Flag for filling histograms in MC Gen processes" };
@@ -75,7 +76,7 @@ struct HfTaskCorrelationDplusHadrons {
7576 Configurable<int > selectionFlagDplus{" selectionFlagDplus" , 7 , " Selection Flag for D+" }; // 7 corresponds to topo+PID cuts
7677 Configurable<bool > selNoSameBunchPileUpColl{" selNoSameBunchPileUpColl" , true , " Flag for rejecting the collisions associated with the same bunch crossing" };
7778 Configurable<std::vector<int >> classMl{" classMl" , {0 , 1 , 2 }, " Indexes of ML scores to be stored. Three indexes max." };
78- Configurable<std::vector<double >> mlOutputPrompt{ " mlScorePrompt " , {0.5 , 0.5 , 0.5 , 0.5 }, " Machine learning scores for prompt" };
79+ Configurable<std::vector<double >> mlOutputPromptorFd{ " mlScorePromptorFd " , {0.5 , 0.5 , 0.5 , 0.5 }, " Machine learning scores for prompt or Feed-down " };
7980 Configurable<std::vector<double >> mlOutputBkg{" mlScoreBkg" , {0.5 , 0.5 , 0.5 , 0.5 }, " Machine learning scores for bkg" };
8081 // pT ranges for correlation plots: the default values are those embedded in hf_cuts_dplus_to_pi_k_pi (i.e. the mass pT bins), but can be redefined via json files
8182 Configurable<std::vector<double >> binsPtCorrelations{" binsPtCorrelations" , std::vector<double >{pTBinsCorrelations_v}, " pT bin limits for correlation plots" };
@@ -124,6 +125,8 @@ struct HfTaskCorrelationDplusHadrons {
124125 std::shared_ptr<TH1> mEfficiencyPrompt = nullptr ;
125126 std::shared_ptr<TH1> mEfficiencyFD = nullptr ;
126127 std::shared_ptr<TH1> mEfficiencyAssociated = nullptr ;
128+ std::shared_ptr<TH1> effD = nullptr ;
129+ int idxBdtScore = 1 ; // Index BDTScore 1 for Prompt and 2 for FD Analysis
127130
128131 HfHelper hfHelper;
129132
@@ -271,7 +274,9 @@ struct HfTaskCorrelationDplusHadrons {
271274 }
272275 LOGF (info, " Loaded associated efficiency histogram from %s" , associatedEffCcdbPath.value .c_str ());
273276 }
274-
277+ auto effD = isPromptAnalysis ? mEfficiencyPrompt : mEfficiencyFD ;
278+ idxBdtScore = isPromptAnalysis ? 1 : 2 ;
279+
275280 if (activateQA) {
276281 const int regionLimits = 6 ;
277282 std::string labels[regionLimits] = {" SigReg Left" , " SigReg Right" , " Left SB Low" , " Left SB Up" , " Right SB Low" , " Right SB Up" };
@@ -297,22 +302,24 @@ struct HfTaskCorrelationDplusHadrons {
297302 float massD = candidate.mD ();
298303 float ptD = candidate.ptD ();
299304 float bdtScorePrompt = candidate.mlScorePrompt ();
305+ float bdtScoreFd = candidate.mlScoreFd ();
300306 float bdtScoreBkg = candidate.mlScoreBkg ();
301307 int effBinD = o2::analysis::findBin (binsPtEfficiencyD, ptD);
308+ float bdtScorePromptorFd = isPromptAnalysis ? bdtScorePrompt: bdtScoreFd;
302309
303310 // reject entries outside pT ranges of interest
304311 if (ptD < binsPtEfficiencyD->front () || ptD > binsPtEfficiencyD->back ()) {
305312 continue ;
306313 }
307314
308- if (bdtScorePrompt < mlOutputPrompt ->at (effBinD) || bdtScoreBkg > mlOutputBkg->at (effBinD)) {
315+ if (bdtScorePromptorFd < mlOutputPromptorFd ->at (effBinD) || bdtScoreBkg > mlOutputBkg->at (effBinD)) {
309316 continue ;
310317 }
311318 double efficiencyWeightD = 1 .;
312319 if (applyEfficiency) {
313320 efficiencyWeightD = 1 . / efficiencyD->at (o2::analysis::findBin (binsPtEfficiencyD, ptD));
314321 if (loadAccXEffFromCCDB) {
315- efficiencyWeightD = 1 . / mEfficiencyPrompt ->GetBinContent (mEfficiencyPrompt ->FindBin (ptD));
322+ efficiencyWeightD = 1 . / effD ->GetBinContent (effD ->FindBin (ptD));
316323 }
317324 }
318325 registry.fill (HIST (" hMassDplusVsPt" ), massD, ptD, efficiencyWeightD);
@@ -328,6 +335,7 @@ struct HfTaskCorrelationDplusHadrons {
328335 float ptD = pairEntry.ptD ();
329336 float ptHadron = pairEntry.ptHadron ();
330337 float bdtScorePrompt = pairEntry.mlScorePrompt ();
338+ float bdtScoreFd = pairEntry.mlScoreFd ();
331339 float bdtScoreBkg = pairEntry.mlScoreBkg ();
332340 float trackDcaXY = pairEntry.trackDcaXY ();
333341 float trackDcaZ = pairEntry.trackDcaZ ();
@@ -336,13 +344,15 @@ struct HfTaskCorrelationDplusHadrons {
336344 double massD = pairEntry.mD ();
337345 int effBinD = o2::analysis::findBin (binsPtEfficiencyD, ptD);
338346 int pTBinD = o2::analysis::findBin (binsPtCorrelations, ptD);
347+ float bdtScorePromptorFd = isPromptAnalysis ? bdtScorePrompt: bdtScoreFd;
348+
339349
340350 // reject entries outside pT ranges of interest
341351 if (ptD < binsPtEfficiencyD->front () || ptD > binsPtEfficiencyD->back ()) {
342352 continue ;
343353 }
344354
345- if (bdtScorePrompt < mlOutputPrompt ->at (effBinD) || bdtScoreBkg > mlOutputBkg->at (effBinD)) {
355+ if (bdtScorePromptorFd < mlOutputPromptorFd ->at (effBinD) || bdtScoreBkg > mlOutputBkg->at (effBinD)) {
346356 continue ;
347357 }
348358 if (trackDcaXY > dcaXYTrackMax || trackDcaZ > dcaZTrackMax || trackTpcCrossedRows < nTpcCrossedRaws) {
@@ -352,7 +362,7 @@ struct HfTaskCorrelationDplusHadrons {
352362 if (applyEfficiency) {
353363 efficiencyWeight = 1 . / (efficiencyD->at (effBinD) * efficiencyHad->at (o2::analysis::findBin (binsPtEfficiencyHad, ptHadron)));
354364 if (loadAccXEffFromCCDB) {
355- efficiencyWeight = 1 . / (mEfficiencyPrompt ->GetBinContent (mEfficiencyPrompt ->FindBin (ptD)) * mEfficiencyAssociated ->GetBinContent (mEfficiencyAssociated ->FindBin (ptHadron)));
365+ efficiencyWeight = 1 . / (effD ->GetBinContent (effD ->FindBin (ptD)) * mEfficiencyAssociated ->GetBinContent (mEfficiencyAssociated ->FindBin (ptHadron)));
356366 }
357367 }
358368 // check if correlation entry belongs to signal region, sidebands or is outside both, and fill correlation plots
@@ -395,15 +405,18 @@ struct HfTaskCorrelationDplusHadrons {
395405 float massD = candidate.mD ();
396406 float ptD = candidate.ptD ();
397407 float bdtScorePrompt = candidate.mlScorePrompt ();
408+ float bdtScoreFd = candidate.mlScoreFd ();
398409 float bdtScoreBkg = candidate.mlScoreBkg ();
399410 int effBinD = o2::analysis::findBin (binsPtEfficiencyD, ptD);
400411 bool isDplusPrompt = candidate.isPrompt ();
412+ float bdtScorePromptorFd = isPromptAnalysis ? bdtScorePrompt: bdtScoreFd;
413+
401414
402415 // reject entries outside pT ranges of interest
403416 if (ptD < binsPtEfficiencyD->front () || ptD > binsPtEfficiencyD->back ())
404417 continue ;
405418
406- if (bdtScorePrompt < mlOutputPrompt ->at (effBinD) || bdtScoreBkg > mlOutputBkg->at (effBinD)) {
419+ if (bdtScorePromptorFd < mlOutputPromptorFd ->at (effBinD) || bdtScoreBkg > mlOutputBkg->at (effBinD)) {
407420 continue ;
408421 }
409422 double efficiencyWeightD = 1 .;
@@ -440,6 +453,7 @@ struct HfTaskCorrelationDplusHadrons {
440453 float ptHadron = pairEntry.ptHadron ();
441454 float massD = pairEntry.mD ();
442455 float bdtScorePrompt = pairEntry.mlScorePrompt ();
456+ float bdtScoreFd = pairEntry.mlScoreFd ();
443457 float bdtScoreBkg = pairEntry.mlScoreBkg ();
444458 bool isPhysicalPrimary = pairEntry.isPhysicalPrimary ();
445459 float trackDcaXY = pairEntry.trackDcaXY ();
@@ -450,12 +464,14 @@ struct HfTaskCorrelationDplusHadrons {
450464 int poolBin = pairEntry.poolBin ();
451465 int effBinD = o2::analysis::findBin (binsPtEfficiencyD, ptD);
452466 int pTBinD = o2::analysis::findBin (binsPtCorrelations, ptD);
467+ float bdtScorePromptorFd = isPromptAnalysis ? bdtScorePrompt: bdtScoreFd;
468+
453469
454470 // reject entries outside pT ranges of interest
455471 if (ptD < binsPtEfficiencyD->front () || ptD > binsPtEfficiencyD->back ())
456472 continue ;
457473
458- if (bdtScorePrompt < mlOutputPrompt ->at (effBinD) || bdtScoreBkg > mlOutputBkg->at (effBinD)) {
474+ if (bdtScorePromptorFd < mlOutputPromptorFd ->at (effBinD) || bdtScoreBkg > mlOutputBkg->at (effBinD)) {
459475 continue ;
460476 }
461477 if (trackDcaXY > dcaXYTrackMax || trackDcaZ > dcaZTrackMax || trackTpcCrossedRows < nTpcCrossedRaws) {
@@ -612,7 +628,7 @@ struct HfTaskCorrelationDplusHadrons {
612628 for (unsigned int iclass = 0 ; iclass < classMl->size (); iclass++) {
613629 outputMl[iclass] = candidate.mlProbDplusToPiKPi ()[classMl->at (iclass)];
614630 }
615- if (outputMl[0 ] > mlOutputBkg->at (o2::analysis::findBin (binsPtEfficiencyD, candidate.pt ())) || outputMl[1 ] < mlOutputPrompt ->at (o2::analysis::findBin (binsPtEfficiencyD, candidate.pt ()))) {
631+ if (outputMl[0 ] > mlOutputBkg->at (o2::analysis::findBin (binsPtEfficiencyD, candidate.pt ())) || outputMl[idxBdtScore ] < mlOutputPromptorFd ->at (o2::analysis::findBin (binsPtEfficiencyD, candidate.pt ()))) {
616632 continue ;
617633 }
618634 auto collision = candidate.template collision_as <soa::Join<aod::Collisions, aod::FT0Mults, aod::EvSels>>();
0 commit comments