@@ -63,6 +63,7 @@ struct HfTaskDstarToD0Pi {
6363 Configurable<bool > studyD0ToPiKPi0{" studyD0ToPiKPi0" , false , " Flag to study D*->D0(piKpi0)pi channel" };
6464 Configurable<bool > ptShapeStudy{" ptShapeStudy" , false , " Flag to enable pT shape study" };
6565 Configurable<bool > useWeightOnline{" useWeightOnline" , false , " Flag to enable use of weights for pT shape study online" };
66+ Configurable<bool > studySoftPiFraction{" studySoftPiFraction" , false , " Flag to enable study of soft pion fraction, currently implemented for ML-based analysis only" };
6667
6768 // CCDB configuration
6869 Configurable<std::string> ccdbUrl{" ccdbUrl" , " http://alice-ccdb.cern.ch" , " url of the ccdb repository" };
@@ -82,7 +83,7 @@ struct HfTaskDstarToD0Pi {
8283 std::vector<TH1D*> hWeights;
8384 int const nWeights = 2 ; // prompt and non-prompt weights
8485 std::vector<std::string> const weightHistNames = {" promptWeightVsPt" , " nonPromptWeightVsPt" };
85- enum weightType {
86+ enum WeightType {
8687 Prompt = 0 ,
8788 NonPrompt = 1
8889 };
@@ -368,27 +369,27 @@ struct HfTaskDstarToD0Pi {
368369 // Ensure hWeights is properly sized
369370 hWeights.resize (nWeights); // prompt and non-prompt
370371
371- hWeights[weightType ::Prompt] = dynamic_cast <TH1D*>(weightFile->Get (weightHistNames[weightType ::Prompt].c_str ()));
372- hWeights[weightType ::NonPrompt] = dynamic_cast <TH1D*>(weightFile->Get (weightHistNames[weightType ::NonPrompt].c_str ()));
373- if (hWeights[weightType ::Prompt] == nullptr ) {
374- LOGF (fatal, " Histogram %s not found in weight file!" , weightHistNames[weightType ::Prompt].c_str ());
372+ hWeights[WeightType ::Prompt] = dynamic_cast <TH1D*>(weightFile->Get (weightHistNames[WeightType ::Prompt].c_str ()));
373+ hWeights[WeightType ::NonPrompt] = dynamic_cast <TH1D*>(weightFile->Get (weightHistNames[WeightType ::NonPrompt].c_str ()));
374+ if (hWeights[WeightType ::Prompt] == nullptr ) {
375+ LOGF (fatal, " Histogram %s not found in weight file!" , weightHistNames[WeightType ::Prompt].c_str ());
375376 return ;
376377 }
377- if (hWeights[weightType ::NonPrompt] == nullptr ) {
378- LOGF (fatal, " Histogram %s not found in weight file!" , weightHistNames[weightType ::NonPrompt].c_str ());
378+ if (hWeights[WeightType ::NonPrompt] == nullptr ) {
379+ LOGF (fatal, " Histogram %s not found in weight file!" , weightHistNames[WeightType ::NonPrompt].c_str ());
379380 return ;
380381 }
381382 // checking if bin wdith of weight histograms are not finner than pT axis of Dstar
382- if (hWeights[weightType ::Prompt]->GetXaxis ()->GetBinWidth (1 ) >= vecPtBins[1 ] - vecPtBins[0 ]) {
383+ if (hWeights[WeightType ::Prompt]->GetXaxis ()->GetBinWidth (1 ) >= vecPtBins[1 ] - vecPtBins[0 ]) {
383384 LOGF (fatal, " Bin width of weight histogram should be finer than pT axis of Dstar!" );
384385 return ;
385386 }
386- if (hWeights[weightType ::NonPrompt]->GetXaxis ()->GetBinWidth (1 ) >= vecPtBins[1 ] - vecPtBins[0 ]) {
387+ if (hWeights[WeightType ::NonPrompt]->GetXaxis ()->GetBinWidth (1 ) >= vecPtBins[1 ] - vecPtBins[0 ]) {
387388 LOGF (fatal, " Bin width of weight histogram should be finer than pT axis of Dstar!" );
388389 return ;
389390 }
390- hWeights[weightType ::Prompt]->SetDirectory (nullptr );
391- hWeights[weightType ::NonPrompt]->SetDirectory (nullptr );
391+ hWeights[WeightType ::Prompt]->SetDirectory (nullptr );
392+ hWeights[WeightType ::NonPrompt]->SetDirectory (nullptr );
392393
393394 weightFile->Close ();
394395 delete weightFile;
@@ -397,6 +398,10 @@ struct HfTaskDstarToD0Pi {
397398 return ;
398399 }
399400 }
401+
402+ if (studySoftPiFraction && doprocessDataWML) {
403+ registry.add (" SoftPiFraction/hPtSoftPiVsPtDtstarVsCentVsBDTScore" , " Pt of Soft Pi vs Pt of D* vs Centrality vs BDT Score" , {HistType::kTHnSparseF , {{100 , 0.1 , 1.0 }, {vecPtBins, " #it{p}_{T} of Soft Pi (GeV/#it{c})" }, {axisCentrality}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}, true );
404+ }
400405 }
401406
402407 // Comparator function to sort based on the second argument of a tuple
@@ -475,6 +480,9 @@ struct HfTaskDstarToD0Pi {
475480 if constexpr (ApplyMl) {
476481 auto mlBdtScore = candDstar.mlProbDstarToD0Pi ();
477482 registry.fill (HIST (" Yield/hDeltaInvMassVsPtVsCentVsBDTScore" ), deltaMDstar, candDstar.pt (), centrality, mlBdtScore[0 ], mlBdtScore[1 ], mlBdtScore[2 ], invD0);
483+ if (studySoftPiFraction) {
484+ registry.fill (HIST (" SoftPiFraction/hPtSoftPiVsPtDtstarVsCentVsBDTScore" ), candDstar.ptSoftPi (), candDstar.pt (), centrality, mlBdtScore[0 ], mlBdtScore[1 ], mlBdtScore[2 ]);
485+ }
478486 }
479487
480488 if (doprocessDataWoML) {
@@ -568,8 +576,8 @@ struct HfTaskDstarToD0Pi {
568576 LOGF (fatal, " Weight histograms are not initialized or empty. Check CCDB path or weight file." );
569577 return ;
570578 }
571- ptShapeWeightValues[weightType ::Prompt] = hWeights[weightType ::Prompt]->GetBinContent (hWeights[weightType ::Prompt]->FindBin (ptDstarRecSig));
572- ptShapeWeightValues[weightType ::NonPrompt] = hWeights[weightType ::NonPrompt]->GetBinContent (hWeights[weightType ::NonPrompt]->FindBin (ptMother));
579+ ptShapeWeightValues[WeightType ::Prompt] = hWeights[WeightType ::Prompt]->GetBinContent (hWeights[WeightType ::Prompt]->FindBin (ptDstarRecSig));
580+ ptShapeWeightValues[WeightType ::NonPrompt] = hWeights[WeightType ::NonPrompt]->GetBinContent (hWeights[WeightType ::NonPrompt]->FindBin (ptMother));
573581 }
574582
575583 if (qaEnabled) {
@@ -581,9 +589,9 @@ struct HfTaskDstarToD0Pi {
581589 auto bdtScore = candDstarMcRec.mlProbDstarToD0Pi ();
582590 registry.fill (HIST (" Efficiency/hPtVsCentVsBDTScoreVsPvContribRecSig" ), ptDstarRecSig, centrality, bdtScore[0 ], bdtScore[1 ], bdtScore[2 ], nPVContributors, weightValue);
583591 if (candDstarMcRec.originMcRec () == RecoDecay::OriginType::Prompt) {
584- registry.fill (HIST (" Efficiency/hPtPromptVsCentVsBDTScorePvContribRecSig" ), ptDstarRecSig, centrality, bdtScore[0 ], bdtScore[1 ], bdtScore[2 ], nPVContributors, ptShapeWeightValues[weightType ::Prompt]);
592+ registry.fill (HIST (" Efficiency/hPtPromptVsCentVsBDTScorePvContribRecSig" ), ptDstarRecSig, centrality, bdtScore[0 ], bdtScore[1 ], bdtScore[2 ], nPVContributors, ptShapeWeightValues[WeightType ::Prompt]);
585593 } else if (candDstarMcRec.originMcRec () == RecoDecay::OriginType::NonPrompt) {
586- registry.fill (HIST (" Efficiency/hPtNonPrompRectVsCentVsBDTScorePvContribRecSig" ), ptDstarRecSig, centrality, bdtScore[0 ], bdtScore[1 ], bdtScore[2 ], nPVContributors, ptShapeWeightValues[weightType ::NonPrompt]);
594+ registry.fill (HIST (" Efficiency/hPtNonPrompRectVsCentVsBDTScorePvContribRecSig" ), ptDstarRecSig, centrality, bdtScore[0 ], bdtScore[1 ], bdtScore[2 ], nPVContributors, ptShapeWeightValues[WeightType ::NonPrompt]);
587595 }
588596 if (ptShapeStudy && !useWeightOnline) {
589597 if (candDstarMcRec.originMcRec () == RecoDecay::OriginType::Prompt) {
@@ -596,9 +604,9 @@ struct HfTaskDstarToD0Pi {
596604 auto bdtScore = candDstarMcRec.mlProbDstarToD0Pi ();
597605 registry.fill (HIST (" Efficiency/hPtVsBDTScoreRecSig" ), ptDstarRecSig, bdtScore[0 ], bdtScore[1 ], bdtScore[2 ], weightValue);
598606 if (candDstarMcRec.originMcRec () == RecoDecay::OriginType::Prompt) {
599- registry.fill (HIST (" Efficiency/hPtPromptVsBDTScoreRecSig" ), ptDstarRecSig, bdtScore[0 ], bdtScore[1 ], bdtScore[2 ], ptShapeWeightValues[weightType ::Prompt]);
607+ registry.fill (HIST (" Efficiency/hPtPromptVsBDTScoreRecSig" ), ptDstarRecSig, bdtScore[0 ], bdtScore[1 ], bdtScore[2 ], ptShapeWeightValues[WeightType ::Prompt]);
600608 } else if (candDstarMcRec.originMcRec () == RecoDecay::OriginType::NonPrompt) {
601- registry.fill (HIST (" Efficiency/hPtNonPromptVsBDTScoreRecSig" ), ptDstarRecSig, bdtScore[0 ], bdtScore[1 ], bdtScore[2 ], ptShapeWeightValues[weightType ::NonPrompt]);
609+ registry.fill (HIST (" Efficiency/hPtNonPromptVsBDTScoreRecSig" ), ptDstarRecSig, bdtScore[0 ], bdtScore[1 ], bdtScore[2 ], ptShapeWeightValues[WeightType ::NonPrompt]);
602610 }
603611 if (ptShapeStudy && !useWeightOnline) {
604612 if (candDstarMcRec.originMcRec () == RecoDecay::OriginType::Prompt) {
@@ -612,9 +620,9 @@ struct HfTaskDstarToD0Pi {
612620 if (isCentStudy) {
613621 registry.fill (HIST (" Efficiency/hPtVsCentVsPvContribRecSig" ), ptDstarRecSig, centrality, nPVContributors, weightValue);
614622 if (candDstarMcRec.originMcRec () == RecoDecay::OriginType::Prompt) {
615- registry.fill (HIST (" Efficiency/hPtPromptVsCentVsPvContribRecSig" ), ptDstarRecSig, centrality, nPVContributors, ptShapeWeightValues[weightType ::Prompt]);
623+ registry.fill (HIST (" Efficiency/hPtPromptVsCentVsPvContribRecSig" ), ptDstarRecSig, centrality, nPVContributors, ptShapeWeightValues[WeightType ::Prompt]);
616624 } else if (candDstarMcRec.originMcRec () == RecoDecay::OriginType::NonPrompt) {
617- registry.fill (HIST (" Efficiency/hPtNonPromptVsCentVsPvContribRecSig" ), ptDstarRecSig, centrality, nPVContributors, ptShapeWeightValues[weightType ::NonPrompt]);
625+ registry.fill (HIST (" Efficiency/hPtNonPromptVsCentVsPvContribRecSig" ), ptDstarRecSig, centrality, nPVContributors, ptShapeWeightValues[WeightType ::NonPrompt]);
618626 }
619627 if (ptShapeStudy && !useWeightOnline) {
620628 if (candDstarMcRec.originMcRec () == RecoDecay::OriginType::Prompt) {
@@ -626,9 +634,9 @@ struct HfTaskDstarToD0Pi {
626634 } else {
627635 registry.fill (HIST (" Efficiency/hPtVsPvContribRecSig" ), ptDstarRecSig, nPVContributors, weightValue);
628636 if (candDstarMcRec.originMcRec () == RecoDecay::OriginType::Prompt) {
629- registry.fill (HIST (" Efficiency/hPtPromptVsPvContribRecSig" ), ptDstarRecSig, nPVContributors, ptShapeWeightValues[weightType ::Prompt]);
637+ registry.fill (HIST (" Efficiency/hPtPromptVsPvContribRecSig" ), ptDstarRecSig, nPVContributors, ptShapeWeightValues[WeightType ::Prompt]);
630638 } else if (candDstarMcRec.originMcRec () == RecoDecay::OriginType::NonPrompt) {
631- registry.fill (HIST (" Efficiency/hPtNonPromptVsPvContribRecSig" ), ptDstarRecSig, nPVContributors, ptShapeWeightValues[weightType ::NonPrompt]);
639+ registry.fill (HIST (" Efficiency/hPtNonPromptVsPvContribRecSig" ), ptDstarRecSig, nPVContributors, ptShapeWeightValues[WeightType ::NonPrompt]);
632640 }
633641 if (ptShapeStudy && !useWeightOnline) {
634642 if (candDstarMcRec.originMcRec () == RecoDecay::OriginType::Prompt) {
@@ -782,8 +790,8 @@ struct HfTaskDstarToD0Pi {
782790 LOGF (fatal, " Weight histograms are not initialized or empty. Check CCDB path or weight file." );
783791 return ;
784792 }
785- ptShapeWeightValues[weightType ::Prompt] = hWeights[weightType ::Prompt]->GetBinContent (hWeights[weightType ::Prompt]->FindBin (ptGen));
786- ptShapeWeightValues[weightType ::NonPrompt] = hWeights[weightType ::NonPrompt]->GetBinContent (hWeights[weightType ::NonPrompt]->FindBin (ptBMother));
793+ ptShapeWeightValues[WeightType ::Prompt] = hWeights[WeightType ::Prompt]->GetBinContent (hWeights[WeightType ::Prompt]->FindBin (ptGen));
794+ ptShapeWeightValues[WeightType ::NonPrompt] = hWeights[WeightType ::NonPrompt]->GetBinContent (hWeights[WeightType ::NonPrompt]->FindBin (ptBMother));
787795 }
788796
789797 registry.fill (HIST (" Efficiency/hPtVsYDstarGen" ), ptGen, yGen, weightValue);
@@ -798,20 +806,20 @@ struct HfTaskDstarToD0Pi {
798806
799807 // Prompt
800808 if (mcParticle.originMcGen () == RecoDecay::OriginType::Prompt) {
801- registry.fill (HIST (" Efficiency/hPtVsYPromptDstarGen" ), ptGen, yGen, ptShapeWeightValues[weightType ::Prompt]);
809+ registry.fill (HIST (" Efficiency/hPtVsYPromptDstarGen" ), ptGen, yGen, ptShapeWeightValues[WeightType ::Prompt]);
802810 if (isCentStudy) {
803- registry.fill (HIST (" Efficiency/hPtPromptVsCentVsPvContribGen" ), ptGen, centFT0MGen, pvContributors, ptShapeWeightValues[weightType ::Prompt]);
811+ registry.fill (HIST (" Efficiency/hPtPromptVsCentVsPvContribGen" ), ptGen, centFT0MGen, pvContributors, ptShapeWeightValues[WeightType ::Prompt]);
804812 } else {
805- registry.fill (HIST (" Efficiency/hPtPromptVsGen" ), ptGen, ptShapeWeightValues[weightType ::Prompt]);
813+ registry.fill (HIST (" Efficiency/hPtPromptVsGen" ), ptGen, ptShapeWeightValues[WeightType ::Prompt]);
806814 }
807815 // Non-Prompt
808816 } else if (mcParticle.originMcGen () == RecoDecay::OriginType::NonPrompt) {
809- registry.fill (HIST (" Efficiency/hPtVsYNonPromptDstarGen" ), ptGen, yGen, ptShapeWeightValues[weightType ::NonPrompt]);
817+ registry.fill (HIST (" Efficiency/hPtVsYNonPromptDstarGen" ), ptGen, yGen, ptShapeWeightValues[WeightType ::NonPrompt]);
810818 if (isCentStudy) {
811- registry.fill (HIST (" Efficiency/hPtNonPromptVsCentVsPvContribGen" ), ptGen, centFT0MGen, pvContributors, ptShapeWeightValues[weightType ::NonPrompt]);
819+ registry.fill (HIST (" Efficiency/hPtNonPromptVsCentVsPvContribGen" ), ptGen, centFT0MGen, pvContributors, ptShapeWeightValues[WeightType ::NonPrompt]);
812820
813821 } else {
814- registry.fill (HIST (" Efficiency/hPtNonPromptVsGen" ), ptGen, ptShapeWeightValues[weightType ::NonPrompt]);
822+ registry.fill (HIST (" Efficiency/hPtNonPromptVsGen" ), ptGen, ptShapeWeightValues[WeightType ::NonPrompt]);
815823 }
816824 }
817825 if (ptShapeStudy && !useWeightOnline) {
0 commit comments