From f92fe12965e2ac6d4dba1dd0ed8dd606eac4662a Mon Sep 17 00:00:00 2001 From: Alexandre Bigot Date: Fri, 26 May 2023 07:04:39 +0200 Subject: [PATCH 1/4] Add checks for background in MC --- PWGHF/Core/SelectorCuts.h | 1 + PWGHF/D2H/Tasks/taskB0.cxx | 168 +++++++++++------- .../DataModel/CandidateReconstructionTables.h | 5 + PWGHF/TableProducer/candidateCreatorB0.cxx | 97 ++++++---- .../candidateSelectorB0ToDPi.cxx | 40 +---- 5 files changed, 180 insertions(+), 131 deletions(-) diff --git a/PWGHF/Core/SelectorCuts.h b/PWGHF/Core/SelectorCuts.h index a9d746a6915..16d1fc0617e 100644 --- a/PWGHF/Core/SelectorCuts.h +++ b/PWGHF/Core/SelectorCuts.h @@ -43,6 +43,7 @@ enum Code { kB0 = 511, kB0Bar = -511, kBPlus = 521, + kBS = 531, kX3872 = 9920443, kSigmaC0 = 4112, kSigmaCPlusPlus = 4222, diff --git a/PWGHF/D2H/Tasks/taskB0.cxx b/PWGHF/D2H/Tasks/taskB0.cxx index 4f3a277e73f..df2997745c3 100644 --- a/PWGHF/D2H/Tasks/taskB0.cxx +++ b/PWGHF/D2H/Tasks/taskB0.cxx @@ -35,10 +35,11 @@ using namespace o2::framework::expressions; struct HfTaskB0 { Configurable selectionFlagB0{"selectionFlagB0", 1, "Selection Flag for B0"}; Configurable yCandMax{"yCandMax", 1.44, "max. cand. rapidity"}; + Configurable etaTrackMax{"etaTrackMax", 0.8, "max. track pseudo-rapidity"}; + Configurable ptTrackMin{"ptTrackMin", 0.1, "min. track transverse momentum"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_b0_to_d_pi::vecBinsPt}, "pT bin limits"}; - - float etaMaxAcceptance = 0.8; - float ptMinAcceptance = 0.1; + // MC checks + Configurable checkDecayTypeMc{"checkDecayTypeMc", false, "Flag to enable DecayType histogram"}; using TracksWithSel = soa::Join; @@ -52,70 +53,88 @@ struct HfTaskB0 { void init(o2::framework::InitContext&) { - registry.add("hMass", "B^{0} candidates;inv. mass D^{#minus}#pi^{#plus} (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{500, 0., 10.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLength", "B^{0} candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 0.4}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLengthXY", "B^{0} candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 0.4}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong0", "B^{0} candidates;prong 0 (D^{#minus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -0.05, 0.05}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong1", "B^{0} candidates;prong 1 (#pi^{#plus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -0.05, 0.05}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCPA", "B^{0} candidates;B^{0} candidate cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hEta", "B^{0} candidates;B^{0} candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hRapidity", "B^{0} candidates;B^{0} candidate #it{y};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hImpParErr", "B^{0} candidates;B^{0} candidate impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLenErr", "B^{0} candidates;B^{0} candidate decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLenXYErr", "B^{0} candidates;B^{0} candidate decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hIPProd", "B^{0} candidates;B^{0} candidate impact parameter product;entries", {HistType::kTH2F, {{100, -0.5, 0.5}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hInvMassD", "B^{0} candidates;prong0, D^{#minus} inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0, 5}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - - registry.add("hEtaGen", "MC particles (generated);B^{0} candidate #it{#eta}^{gen};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hYGen", "MC particles (generated);B^{0} candidate #it{y}^{gen};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hEtaGenWithProngsInAcceptance", "MC particles (generated-daughters in acceptance);B^{0} candidate #it{#eta}^{gen};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hYGenWithProngsInAcceptance", "MC particles (generated-daughters in acceptance);B^{0} candidate #it{y}^{gen};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hPtProng0Gen", "MC particles (generated);prong 0 (D^{#minus}) #it{p}_{T}^{gen} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hPtProng1Gen", "MC particles (generated);prong 1 (#pi^{-}) #it{p}_{T}^{gen} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hYProng0Gen", "MC particles (generated);prong 0 (D^{#minus}) #it{y}^{gen};entries", {HistType::kTH2F, {{100, -2, 2}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hYProng1Gen", "MC particles (generated);prong 1 (#pi^{-}) #it{y}^{gen};entries", {HistType::kTH2F, {{100, -2, 2}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hEtaProng0Gen", "MC particles (generated);prong 0 (B^{0}) #it{#eta}^{gen};entries", {HistType::kTH2F, {{100, -2, 2}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hEtaProng1Gen", "MC particles (generated);prong 1 (#pi^{-}) #it{#eta}^{gen};entries", {HistType::kTH2F, {{100, -2, 2}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCPARecSig", "B^{0} candidates (matched);B^{0} candidate cosine of pointing angle;entries", {HistType::kTH2F, {{220, 0., 1.1}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCPARecBg", "B^{0} candidates (unmatched);B^{0} candidate cosine of pointing angle;entries", {HistType::kTH2F, {{220, 0., 1.1}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCPAxyRecSig", "B^{0} candidates (matched);B^{0} candidate CPAxy;entries", {HistType::kTH2F, {{220, 0., 1.1}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCPAxyRecBg", "B^{0} candidates (unmatched);B^{0} candidate CPAxy;entries", {HistType::kTH2F, {{220, 0., 1.1}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCPADRecSig", "B^{0} candidates (matched);prong 0 (D^{#minus}) cosine of pointing angle;entries", {HistType::kTH2F, {{220, 0., 1.1}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCPADRecBg", "B^{0} candidates (unmatched);prong 0 (D^{#minus}) cosine of pointing angle;entries", {HistType::kTH2F, {{220, 0., 1.1}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hEtaRecSig", "B^{0} candidates (matched);B^{0} candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hEtaRecBg", "B^{0} candidates (unmatched);B^{0} candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hRapidityRecSig", "B^{0} candidates (matched);B^{0} candidate #it{y};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hRapidityRecBg", "B^{0} candidates (unmatched);B^{0} candidate #it{#y};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - - registry.add("hPtProng0RecSig", "B^{0} candidates (matched);prong 0 (D^{#minus}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hPtProng1RecSig", "B^{0} candidates (matched);prong 1 (#pi^{#minus}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hPtProng0RecBg", "B^{0} candidates (unmatched);prong 0 (D^{#minus}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hPtProng1RecBg", "B^{0} candidates (unmatched);prong 1 (#pi^{#minus}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassRecSig", "B^{0} candidates (matched);inv. mass D^{#minus}#pi^{+} (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{300, 4.0, 7.00}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassRecBg", "B^{0} candidates (unmatched);inv. mass D^{#minus}#pi^{+} (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{300, 4.0, 7.0}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong0RecSig", "B^{0} candidates (matched);prong 0 (D^{#minus}}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.05, 0.05}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong1RecSig", "B^{0} candidates (matched);prong 1 (#pi^{#minus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.05, 0.05}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong0RecBg", "B^{0} candidates (unmatched);prong 0 (D^{#minus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.05, 0.05}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong1RecBg", "B^{0} candidates (unmatched);prong 1 (#pi^{#minus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.05, 0.05}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLengthRecSig", "B^{0} candidates (matched);B^{0} candidate decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.5}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLengthXYRecSig", "B^{0} candidates (matched);B^{0} candidate decay length xy (cm);entries", {HistType::kTH2F, {{100, 0., 0.5}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLengthRecBg", "B^{0} candidates (unmatched);B^{0} candidate decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.5}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLengthXYRecBg", "B^{0} candidates (unmatched);B^{0} candidate decay length xy(cm);entries", {HistType::kTH2F, {{100, 0., 0.5}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLengthDRecSig", "B^{0} candidates (matched);B^{0} candidate decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.5}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLengthDRecBg", "B^{0} candidates (unmatched);B^{0} candidate decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.5}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLengthNormRecSig", "B^{0} candidates (matched);B^{0} candidate decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.5}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLengthNormRecBg", "B^{0} candidates (unmatched);B^{0} candidate decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.5}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hImpParProdB0RecSig", "B^{0} candidates (matched);B^{0} candidate impact parameter product ;entries", {HistType::kTH2F, {{100, -0.01, 0.01}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hImpParProdB0RecBg", "B^{0} candidates (unmatched);B^{0} candidate impact parameter product ;entries", {HistType::kTH2F, {{100, -0.01, 0.01}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - - registry.add("hChi2PCARecSig", "B^{0} candidates (matched);sum of distances of the secondary vertex to its prongs;entries", {HistType::kTH2F, {{240, -0.01, 0.1}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hChi2PCARecBg", "B^{0} candidates (unmatched);sum of distances of the secondary vertex to its prongs;entries", {HistType::kTH2F, {{240, -0.01, 0.1}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + static const AxisSpec axisMassB0 = {300, 4.5, 6.0, "inv. mass (GeV/#it{c}^{2})"}; + static const AxisSpec axisPt = {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}; + + registry.add("hMass", "B^{0} candidates;inv. mass D^{#minus}#pi^{#plus} (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {axisMassB0, axisPt}}); + registry.add("hDecLength", "B^{0} candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 0.4}, axisPt}}); + registry.add("hDecLengthXY", "B^{0} candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 0.4}, axisPt}}); + registry.add("hd0Prong0", "B^{0} candidates;prong 0 (D^{#minus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -0.05, 0.05}, axisPt}}); + registry.add("hd0Prong1", "B^{0} candidates;prong 1 (#pi^{#plus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -0.05, 0.05}, axisPt}}); + registry.add("hCPA", "B^{0} candidates;B^{0} candidate cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, axisPt}}); + registry.add("hEta", "B^{0} candidates;B^{0} candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, axisPt}}); + registry.add("hRapidity", "B^{0} candidates;B^{0} candidate #it{y};entries", {HistType::kTH2F, {{100, -2., 2.}, axisPt}}); + registry.add("hImpParErr", "B^{0} candidates;B^{0} candidate impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, axisPt}}); + registry.add("hDecLenErr", "B^{0} candidates;B^{0} candidate decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, axisPt}}); + registry.add("hDecLenXYErr", "B^{0} candidates;B^{0} candidate decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, axisPt}}); + registry.add("hIPProd", "B^{0} candidates;B^{0} candidate impact parameter product;entries", {HistType::kTH2F, {{100, -0.5, 0.5}, axisPt}}); + registry.add("hInvMassD", "B^{0} candidates;prong0, D^{#minus} inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0, 5}, axisPt}}); + + registry.add("hEtaGen", "MC particles (generated);B^{0} candidate #it{#eta}^{gen};entries", {HistType::kTH2F, {{100, -2., 2.}, axisPt}}); + registry.add("hYGen", "MC particles (generated);B^{0} candidate #it{y}^{gen};entries", {HistType::kTH2F, {{100, -2., 2.}, axisPt}}); + registry.add("hEtaGenWithProngsInAcceptance", "MC particles (generated-daughters in acceptance);B^{0} candidate #it{#eta}^{gen};entries", {HistType::kTH2F, {{100, -2., 2.}, axisPt}}); + registry.add("hYGenWithProngsInAcceptance", "MC particles (generated-daughters in acceptance);B^{0} candidate #it{y}^{gen};entries", {HistType::kTH2F, {{100, -2., 2.}, axisPt}}); + registry.add("hPtProng0Gen", "MC particles (generated);prong 0 (D^{#minus}) #it{p}_{T}^{gen} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, axisPt}}); + registry.add("hPtProng1Gen", "MC particles (generated);prong 1 (#pi^{-}) #it{p}_{T}^{gen} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, axisPt}}); + registry.add("hYProng0Gen", "MC particles (generated);prong 0 (D^{#minus}) #it{y}^{gen};entries", {HistType::kTH2F, {{100, -2, 2}, axisPt}}); + registry.add("hYProng1Gen", "MC particles (generated);prong 1 (#pi^{-}) #it{y}^{gen};entries", {HistType::kTH2F, {{100, -2, 2}, axisPt}}); + registry.add("hEtaProng0Gen", "MC particles (generated);prong 0 (B^{0}) #it{#eta}^{gen};entries", {HistType::kTH2F, {{100, -2, 2}, axisPt}}); + registry.add("hEtaProng1Gen", "MC particles (generated);prong 1 (#pi^{-}) #it{#eta}^{gen};entries", {HistType::kTH2F, {{100, -2, 2}, axisPt}}); + registry.add("hCPARecSig", "B^{0} candidates (matched);B^{0} candidate cosine of pointing angle;entries", {HistType::kTH2F, {{220, 0., 1.1}, axisPt}}); + registry.add("hCPARecBg", "B^{0} candidates (unmatched);B^{0} candidate cosine of pointing angle;entries", {HistType::kTH2F, {{220, 0., 1.1}, axisPt}}); + registry.add("hCPAxyRecSig", "B^{0} candidates (matched);B^{0} candidate CPAxy;entries", {HistType::kTH2F, {{220, 0., 1.1}, axisPt}}); + registry.add("hCPAxyRecBg", "B^{0} candidates (unmatched);B^{0} candidate CPAxy;entries", {HistType::kTH2F, {{220, 0., 1.1}, axisPt}}); + registry.add("hCPADRecSig", "B^{0} candidates (matched);prong 0 (D^{#minus}) cosine of pointing angle;entries", {HistType::kTH2F, {{220, 0., 1.1}, axisPt}}); + registry.add("hCPADRecBg", "B^{0} candidates (unmatched);prong 0 (D^{#minus}) cosine of pointing angle;entries", {HistType::kTH2F, {{220, 0., 1.1}, axisPt}}); + registry.add("hEtaRecSig", "B^{0} candidates (matched);B^{0} candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, axisPt}}); + registry.add("hEtaRecBg", "B^{0} candidates (unmatched);B^{0} candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, axisPt}}); + registry.add("hRapidityRecSig", "B^{0} candidates (matched);B^{0} candidate #it{y};entries", {HistType::kTH2F, {{100, -2., 2.}, axisPt}}); + registry.add("hRapidityRecBg", "B^{0} candidates (unmatched);B^{0} candidate #it{#y};entries", {HistType::kTH2F, {{100, -2., 2.}, axisPt}}); + + registry.add("hPtProng0RecSig", "B^{0} candidates (matched);prong 0 (D^{#minus}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, axisPt}}); + registry.add("hPtProng1RecSig", "B^{0} candidates (matched);prong 1 (#pi^{#minus}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, axisPt}}); + registry.add("hPtProng0RecBg", "B^{0} candidates (unmatched);prong 0 (D^{#minus}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, axisPt}}); + registry.add("hPtProng1RecBg", "B^{0} candidates (unmatched);prong 1 (#pi^{#minus}) #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, axisPt}}); + registry.add("hMassRecSig", "B^{0} candidates (matched);inv. mass D^{#minus}#pi^{+} (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{300, 4.0, 7.00}, axisPt}}); + registry.add("hMassRecBg", "B^{0} candidates (unmatched);inv. mass D^{#minus}#pi^{+} (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{300, 4.0, 7.0}, axisPt}}); + registry.add("hd0Prong0RecSig", "B^{0} candidates (matched);prong 0 (D^{#minus}}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.05, 0.05}, axisPt}}); + registry.add("hd0Prong1RecSig", "B^{0} candidates (matched);prong 1 (#pi^{#minus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.05, 0.05}, axisPt}}); + registry.add("hd0Prong0RecBg", "B^{0} candidates (unmatched);prong 0 (D^{#minus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.05, 0.05}, axisPt}}); + registry.add("hd0Prong1RecBg", "B^{0} candidates (unmatched);prong 1 (#pi^{#minus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.05, 0.05}, axisPt}}); + registry.add("hDecLengthRecSig", "B^{0} candidates (matched);B^{0} candidate decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.5}, axisPt}}); + registry.add("hDecLengthXYRecSig", "B^{0} candidates (matched);B^{0} candidate decay length xy (cm);entries", {HistType::kTH2F, {{100, 0., 0.5}, axisPt}}); + registry.add("hDecLengthRecBg", "B^{0} candidates (unmatched);B^{0} candidate decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.5}, axisPt}}); + registry.add("hDecLengthXYRecBg", "B^{0} candidates (unmatched);B^{0} candidate decay length xy(cm);entries", {HistType::kTH2F, {{100, 0., 0.5}, axisPt}}); + registry.add("hDecLengthDRecSig", "B^{0} candidates (matched);B^{0} candidate decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.5}, axisPt}}); + registry.add("hDecLengthDRecBg", "B^{0} candidates (unmatched);B^{0} candidate decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.5}, axisPt}}); + registry.add("hDecLengthNormRecSig", "B^{0} candidates (matched);B^{0} candidate decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.5}, axisPt}}); + registry.add("hDecLengthNormRecBg", "B^{0} candidates (unmatched);B^{0} candidate decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.5}, axisPt}}); + registry.add("hImpParProdB0RecSig", "B^{0} candidates (matched);B^{0} candidate impact parameter product ;entries", {HistType::kTH2F, {{100, -0.01, 0.01}, axisPt}}); + registry.add("hImpParProdB0RecBg", "B^{0} candidates (unmatched);B^{0} candidate impact parameter product ;entries", {HistType::kTH2F, {{100, -0.01, 0.01}, axisPt}}); + + registry.add("hChi2PCARecSig", "B^{0} candidates (matched);sum of distances of the secondary vertex to its prongs;entries", {HistType::kTH2F, {{240, -0.01, 0.1}, axisPt}}); + registry.add("hChi2PCARecBg", "B^{0} candidates (unmatched);sum of distances of the secondary vertex to its prongs;entries", {HistType::kTH2F, {{240, -0.01, 0.1}, axisPt}}); registry.add("hPtRecSig", "B0 candidates (matched);candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0., 30.}}}); registry.add("hPtRecBg", "B0 candidates (unmatched);candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0., 30.}}}); registry.add("hPtGenSig", "B0 candidates (gen+rec);candidate #it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0., 10.}}}); registry.add("hPtGen", "MC particles (generated);candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0., 30.}}}); + registry.add("hPtGenWithRapidityBelowHalf", "MC particles (generated - |#it{y}^{gen}|<0.5);candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0., 30.}}}); registry.add("hPtGenWithProngsInAcceptance", "MC particles (generated-daughters in acceptance);candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0., 30.}}}); + + if (checkDecayTypeMc) { + constexpr uint8_t kNBinsDecayTypeMc = DecayTypeMc::NDecayTypeMc; + TString labels[kNBinsDecayTypeMc]; + labels[DecayTypeMc::B0ToDPiAndDToPiKPi] = "B^{0} #rightarrow (D^{#minus} #rightarrow #pi^{#minus} K^{#plus} #pi^{#minus}) #pi^{#plus}"; + labels[DecayTypeMc::B0ToDsPiAndDsToKKPi] = "B^{0} #rightarrow (D^{#minus}_{s} #rightarrow K^{#minus} K^{#plus} #pi^{#minus}) #pi^{#plus}"; + labels[DecayTypeMc::PartlyRecoDecay] = "Partly reconstructed decay channel"; + labels[DecayTypeMc::OtherDecay] = "Other decays"; + static const AxisSpec axisDecayType = {kNBinsDecayTypeMc, 0.5, kNBinsDecayTypeMc + 0.5, ""}; + registry.add("hDecayTypeMc", "DecayType", {HistType::kTH3F, {axisDecayType, axisMassB0, axisPt}}); + for (uint8_t iBin = 0; iBin < kNBinsDecayTypeMc; ++iBin) { + registry.get(HIST("hDecayTypeMc"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin]); + } + } } /// Selection of B0 daughter in geometrical acceptance @@ -125,7 +144,7 @@ struct HfTaskB0 { template bool isProngInAcceptance(const T& etaProng, const T& ptProng) { - return std::abs(etaProng) <= etaMaxAcceptance && ptProng >= ptMinAcceptance; + return std::abs(etaProng) <= etaTrackMax && ptProng >= ptTrackMin; } void process(soa::Filtered> const& candidates, soa::Join const&, TracksWithSel const&) @@ -179,9 +198,11 @@ struct HfTaskB0 { } auto ptCandB0 = candidate.pt(); - auto candD = candidate.prong0_as>(); - if (TESTBIT(std::abs(candidate.flagMcMatchRec()), hf_cand_b0::DecayType::B0ToDPi)) { + auto invMassCandB0 = invMassB0ToDPi(candidate); + int flagMcMatchRecB0 = std::abs(candidate.flagMcMatchRec()); + + if (TESTBIT(flagMcMatchRecB0, hf_cand_b0::DecayTypeMc::B0ToDPiAndDToPiKPi)) { auto indexMother = RecoDecay::getMother(particlesMc, candidate.prong1_as().mcParticle_as>(), pdg::Code::kB0, true); auto particleMother = particlesMc.rawIteratorAt(indexMother); @@ -203,6 +224,10 @@ struct HfTaskB0 { registry.fill(HIST("hCPADRecSig"), candD.cpa(), ptCandB0); registry.fill(HIST("hDecLengthDRecSig"), candD.decayLength(), ptCandB0); registry.fill(HIST("hChi2PCARecSig"), candidate.chi2PCA(), ptCandB0); + + if (checkDecayTypeMc) { + registry.fill(HIST("hDecayTypeMc"), 1 + DecayTypeMc::B0ToDPiAndDToPiKPi, invMassCandB0, ptCandB0); + } } else { registry.fill(HIST("hPtRecBg"), ptCandB0); registry.fill(HIST("hCPARecBg"), candidate.cpa(), ptCandB0); @@ -221,6 +246,16 @@ struct HfTaskB0 { registry.fill(HIST("hCPADRecBg"), candD.cpa(), ptCandB0); registry.fill(HIST("hDecLengthDRecBg"), candD.decayLength(), ptCandB0); registry.fill(HIST("hChi2PCARecBg"), candidate.chi2PCA(), ptCandB0); + + if (checkDecayTypeMc) { + if (TESTBIT(flagMcMatchRecB0, DecayTypeMc::B0ToDsPiAndDsToKKPi)) { // B0 → Ds- π+ → (K- K+ π-) π+ + registry.fill(HIST("hDecayTypeMc"), 1 + DecayTypeMc::B0ToDsPiAndDsToKKPi, invMassCandB0, ptCandB0); + } else if (TESTBIT(flagMcMatchRecB0, DecayTypeMc::PartlyRecoDecay)) { // Partly reconstructed decay channel + registry.fill(HIST("hDecayTypeMc"), 1 + DecayTypeMc::PartlyRecoDecay, invMassCandB0, ptCandB0); + } else { + registry.fill(HIST("hDecayTypeMc"), 1 + OtherDecay, invMassCandB0, ptCandB0); + } + } } } // rec @@ -260,6 +295,11 @@ struct HfTaskB0 { registry.fill(HIST("hYGen"), yParticle, ptParticle); registry.fill(HIST("hEtaGen"), particle.eta(), ptParticle); + // generated B0 with |y|<0.5 + if (std::abs(yParticle) < 0.5) { + registry.fill(HIST("hPtGenWithRapidityBelowHalf"), ptParticle); + } + // reject B0 daughters that are not in geometrical acceptance if (!isProngInAcceptance(etaProngs[0], ptProngs[0]) || !isProngInAcceptance(etaProngs[1], ptProngs[1])) { continue; diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index 06e021f14a6..864151adf84 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -1793,6 +1793,11 @@ DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mi // mapping of decay types enum DecayType { B0ToDPi }; +enum DecayTypeMc : uint8_t { B0ToDPiAndDToPiKPi = 0, + B0ToDsPiAndDsToKKPi, + PartlyRecoDecay, + OtherDecay, + NDecayTypeMc }; // B0(B0bar) → D∓ π± template auto ctB0(const T& candidate) diff --git a/PWGHF/TableProducer/candidateCreatorB0.cxx b/PWGHF/TableProducer/candidateCreatorB0.cxx index 153164ecd84..74979940863 100644 --- a/PWGHF/TableProducer/candidateCreatorB0.cxx +++ b/PWGHF/TableProducer/candidateCreatorB0.cxx @@ -35,22 +35,9 @@ using namespace o2::aod::hf_cand_3prong; using namespace o2::aod::hf_cand_b0; // from CandidateReconstructionTables.h using namespace o2::framework::expressions; -// FIXME: store B0 creator configurable (until https://alice.its.cern.ch/jira/browse/O2-3582 solved) -namespace o2::aod -{ -namespace hf_cand_b0_config -{ -DECLARE_SOA_COLUMN(MySelectionFlagD, mySelectionFlagD, int); -} // namespace hf_cand_b0_config - -DECLARE_SOA_TABLE(HfCandB0Config, "AOD", "HFCANDB0CONFIG", //! - hf_cand_b0_config::MySelectionFlagD); -} // namespace o2::aod - /// Reconstruction of B0 candidates struct HfCandidateCreatorB0 { Produces rowCandidateBase; // table defined in CandidateReconstructionTables.h - Produces rowCandidateConfig; // vertexing // Configurable bz{"bz", 5., "magnetic field"}; @@ -68,8 +55,6 @@ struct HfCandidateCreatorB0 { Configurable> cutsTrackPionDCA{"cutsTrackPionDCA", {hf_cuts_single_track::cutsTrack[0], hf_cuts_single_track::nBinsPtTrack, hf_cuts_single_track::nCutVarsTrack, hf_cuts_single_track::labelsPtTrack, hf_cuts_single_track::labelsCutVarTrack}, "Single-track selections per pT bin for pions"}; Configurable invMassWindowB0{"invMassWindowB0", 0.3, "invariant-mass window for B0 candidates"}; Configurable selectionFlagD{"selectionFlagD", 1, "Selection Flag for D"}; - // FIXME: store B0 creator configurable (until https://alice.its.cern.ch/jira/browse/O2-3582 solved) - bool isHfCandB0ConfigFilled = false; // magnetic field setting from CCDB Configurable isRun2{"isRun2", false, "enable Run 2 or Run 3 GRP objects for magnetic field"}; Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -143,12 +128,6 @@ struct HfCandidateCreatorB0 { TracksWithSel const&, aod::BCsWithTimestamps const&) { - // FIXME: store B0 creator configurable (until https://alice.its.cern.ch/jira/browse/O2-3582 solved) - if (!isHfCandB0ConfigFilled) { - int mySelectionFlagD = selectionFlagD; - rowCandidateConfig(mySelectionFlagD); - isHfCandB0ConfigFilled = true; - } // Initialise fitter for B vertex (2-prong vertex filter) o2::vertexing::DCAFitterN<2> df2; // df2.setBz(bz); @@ -357,7 +336,7 @@ struct HfCandidateCreatorB0Expressions { void processMc(aod::HfCand3Prong const& dplus, aod::BigTracksMC const& tracks, - aod::McParticles const& particlesMC) + aod::McParticles const& particlesMc) { rowCandidateB0->bindExternalIndices(&tracks); rowCandidateB0->bindExternalIndices(&dplus); @@ -376,20 +355,21 @@ struct HfCandidateCreatorB0Expressions { origin = 0; debug = 0; auto candD = candidate.prong0(); - auto arrayDaughters = array{candD.prong0_as(), - candD.prong1_as(), - candD.prong2_as(), - candidate.prong1_as()}; + auto arrayDaughtersB0 = array{candD.prong0_as(), + candD.prong1_as(), + candD.prong2_as(), + candidate.prong1_as()}; auto arrayDaughtersD = array{candD.prong0_as(), candD.prong1_as(), candD.prong2_as()}; + // B0 → D- π+ → (π- K+ π-) π+ // Printf("Checking B0 → D- π+"); - indexRec = RecoDecay::getMatchedMCRec(particlesMC, arrayDaughters, pdg::Code::kB0, array{-kPiPlus, +kKPlus, -kPiPlus, +kPiPlus}, true, &sign, 2); + indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrayDaughtersB0, pdg::Code::kB0, array{-kPiPlus, +kKPlus, -kPiPlus, +kPiPlus}, true, &sign, 3); if (indexRec > -1) { // D- → π- K+ π- // Printf("Checking D- → π- K+ π-"); - indexRec = RecoDecay::getMatchedMCRec(particlesMC, arrayDaughtersD, pdg::Code::kDMinus, array{-kPiPlus, +kKPlus, -kPiPlus}, true, &sign, 2); + indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrayDaughtersD, pdg::Code::kDMinus, array{-kPiPlus, +kKPlus, -kPiPlus}, true, &sign, 2); if (indexRec > -1) { flag = sign * BIT(hf_cand_b0::DecayType::B0ToDPi); } else { @@ -397,20 +377,73 @@ struct HfCandidateCreatorB0Expressions { LOGF(info, "WARNING: B0 in decays in the expected final state but the condition on the intermediate state is not fulfilled"); } } + + // B0 → Ds- π+ → (K- K+ π-) π+ + if (!flag) { + indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrayDaughtersB0, pdg::Code::kB0, array{-kKPlus, +kKPlus, -kPiPlus, +kPiPlus}, true, &sign, 3); + if (indexRec > -1) { + // Ds- → K- K+ π- + indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrayDaughtersD, -pdg::Code::kDS, array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2); + if (indexRec > -1) { + flag = sign * BIT(hf_cand_b0::DecayTypeMc::B0ToDsPiAndDsToKKPi); + } + } + } + + // Partly reconstructed decays, i.e. the 4 prongs have a common b-hadron ancestor + // convention: final state particles are prong0,1,2,3 + if (!flag) { + auto particleProng0 = arrayDaughtersB0[0].mcParticle_as(); + auto particleProng1 = arrayDaughtersB0[1].mcParticle_as(); + auto particleProng2 = arrayDaughtersB0[2].mcParticle_as(); + auto particleProng3 = arrayDaughtersB0[3].mcParticle_as(); + // b-hadron hypothesis + std::array bHadronMotherHypos = {pdg::Code::kB0, pdg::Code::kBS, pdg::Code::kLambdaB0}; + int indexProng0BMother = -1; + int indexProng1BMother = -1; + int indexProng2BMother = -1; + int indexProng3BMother = -1; + + for (const auto& bHadronMotherHypo : bHadronMotherHypos) { + int index0Mother = RecoDecay::getMother(particlesMc, particleProng0, bHadronMotherHypo, true); + int index1Mother = RecoDecay::getMother(particlesMc, particleProng1, bHadronMotherHypo, true); + int index2Mother = RecoDecay::getMother(particlesMc, particleProng2, bHadronMotherHypo, true); + int index3Mother = RecoDecay::getMother(particlesMc, particleProng3, bHadronMotherHypo, true); + if (index0Mother > -1) { + indexProng0BMother = index0Mother; + } + if (index1Mother > -1) { + indexProng1BMother = index1Mother; + } + if (index2Mother > -1) { + indexProng2BMother = index2Mother; + } + if (index3Mother > -1) { + indexProng3BMother = index3Mother; + } + } + // look for common b-hadron ancestor + if (indexProng0BMother > -1 && indexProng1BMother > -1 && indexProng2BMother > -1 && indexProng3BMother > -1) { + if (indexProng0BMother == indexProng1BMother && indexProng1BMother == indexProng2BMother && indexProng2BMother == indexProng3BMother) { + flag = BIT(hf_cand_b0::DecayTypeMc::PartlyRecoDecay); + } + } + } + rowMcMatchRec(flag, origin, debug); } // rec // Match generated particles. - for (auto const& particle : particlesMC) { + for (auto const& particle : particlesMc) { // Printf("New gen. candidate"); flag = 0; origin = 0; // B0 → D- π+ - if (RecoDecay::isMatchedMCGen(particlesMC, particle, pdg::Code::kB0, array{-static_cast(pdg::Code::kDPlus), +kPiPlus}, true)) { + if (RecoDecay::isMatchedMCGen(particlesMc, particle, pdg::Code::kB0, array{-static_cast(pdg::Code::kDPlus), +kPiPlus}, true)) { // Match D- -> π- K+ π- - auto candDMC = particlesMC.rawIteratorAt(particle.daughtersIds().front()); + auto candDMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); // Printf("Checking D- -> π- K+ π-"); - if (RecoDecay::isMatchedMCGen(particlesMC, candDMC, -static_cast(pdg::Code::kDPlus), array{-kPiPlus, +kKPlus, -kPiPlus}, true, &sign)) { + if (RecoDecay::isMatchedMCGen(particlesMc, candDMC, -static_cast(pdg::Code::kDPlus), array{-kPiPlus, +kKPlus, -kPiPlus}, true, &sign)) { flag = sign * BIT(hf_cand_b0::DecayType::B0ToDPi); } } diff --git a/PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx b/PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx index a51585e1ba9..96152ad2f26 100644 --- a/PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx @@ -16,7 +16,7 @@ #include "Common/Core/TrackSelectorPID.h" #include "Framework/runDataProcessing.h" -// #include "Framework/RunningWorkflowInfo.h" +#include "Framework/RunningWorkflowInfo.h" #include "Framework/AnalysisTask.h" #include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" @@ -30,18 +30,6 @@ using namespace o2::analysis; using namespace o2::aod::hf_cand_2prong; using namespace o2::analysis::hf_cuts_b0_to_d_pi; // from SelectorCuts.h -// FIXME: store B0 creator configurable (until https://alice.its.cern.ch/jira/browse/O2-3582 solved) -namespace o2::aod -{ -namespace hf_cand_b0_config -{ -DECLARE_SOA_COLUMN(MySelectionFlagD, mySelectionFlagD, int); -} // namespace hf_cand_b0_config - -DECLARE_SOA_TABLE(HfCandB0Config, "AOD", "HFCANDB0CONFIG", //! - hf_cand_b0_config::MySelectionFlagD); -} // namespace o2::aod - struct HfCandidateSelectorB0ToDPi { Produces hfSelB0ToDPiCandidate; // table defined in CandidateSelectionTables.h @@ -67,8 +55,6 @@ struct HfCandidateSelectorB0ToDPi { Configurable activateQA{"activateQA", false, "Flag to enable QA histogram"}; // check if selectionFlagD (defined in candidateCreatorB0.cxx) and usePid configurables are in sync bool selectionFlagDAndUsePidInSync = true; - // FIXME: store B0 creator configurable (until https://alice.its.cern.ch/jira/browse/O2-3582 solved) - int mySelectionFlagD = -1; TrackSelectorPID selectorPion; @@ -76,7 +62,7 @@ struct HfCandidateSelectorB0ToDPi { HistogramRegistry registry{"registry"}; - void init(InitContext const& initContext) + void init(InitContext& initContext) { if (usePid) { selectorPion.setPDG(kPiPlus); @@ -102,8 +88,7 @@ struct HfCandidateSelectorB0ToDPi { } } - // FIXME: will be uncommented once https://alice.its.cern.ch/jira/browse/O2-3582 is solved - /*int selectionFlagD = -1; + int selectionFlagD = -1; auto& workflows = initContext.services().get(); for (DeviceSpec const& device : workflows.devices) { if (device.name.compare("hf-candidate-creator-b0") == 0) { @@ -123,27 +108,12 @@ struct HfCandidateSelectorB0ToDPi { if (!usePid && TESTBIT(selectionFlagD, SelectionStep::RecoPID)) { selectionFlagDAndUsePidInSync = false; LOG(warning) << "No PID selections required on B0 daughters (usePid=false) but PID selections on D candidates were required a priori (selectionFlagD=7). Set selectionFlagD<7 in hf-candidate-creator-b0"; - }*/ + } } void process(aod::HfCandB0 const& hfCandsB0, - TracksPIDWithSel const&, - HfCandB0Config const& configs) + TracksPIDWithSel const&) { - // FIXME: get B0 creator configurable (until https://alice.its.cern.ch/jira/browse/O2-3582 solved) - for (const auto& config : configs) { - mySelectionFlagD = config.mySelectionFlagD(); - - if (usePid && !TESTBIT(mySelectionFlagD, SelectionStep::RecoPID)) { - selectionFlagDAndUsePidInSync = false; - LOG(warning) << "PID selections required on B0 daughters (usePid=true) but no PID selections on D candidates were required a priori (selectionFlagD<7). Set selectionFlagD=7 in hf-candidate-creator-b0"; - } - if (!usePid && TESTBIT(mySelectionFlagD, SelectionStep::RecoPID)) { - selectionFlagDAndUsePidInSync = false; - LOG(warning) << "No PID selections required on B0 daughters (usePid=false) but PID selections on D candidates were required a priori (selectionFlagD=7). Set selectionFlagD<7 in hf-candidate-creator-b0"; - } - } - for (const auto& hfCandB0 : hfCandsB0) { int statusB0ToDPi = 0; auto ptCandB0 = hfCandB0.pt(); From 86ab3c5407cf6a6037077014f04911116b7a415f Mon Sep 17 00:00:00 2001 From: Alexandre Bigot Date: Sat, 27 May 2023 18:38:19 +0200 Subject: [PATCH 2/4] Add Fabrizio's comments --- PWGHF/TableProducer/candidateCreatorB0.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PWGHF/TableProducer/candidateCreatorB0.cxx b/PWGHF/TableProducer/candidateCreatorB0.cxx index 74979940863..d65c650121c 100644 --- a/PWGHF/TableProducer/candidateCreatorB0.cxx +++ b/PWGHF/TableProducer/candidateCreatorB0.cxx @@ -374,7 +374,7 @@ struct HfCandidateCreatorB0Expressions { flag = sign * BIT(hf_cand_b0::DecayType::B0ToDPi); } else { debug = 1; - LOGF(info, "WARNING: B0 in decays in the expected final state but the condition on the intermediate state is not fulfilled"); + LOGF(debug, "WARNING: B0 in decays in the expected final state but the condition on the intermediate state is not fulfilled"); } } @@ -393,10 +393,10 @@ struct HfCandidateCreatorB0Expressions { // Partly reconstructed decays, i.e. the 4 prongs have a common b-hadron ancestor // convention: final state particles are prong0,1,2,3 if (!flag) { - auto particleProng0 = arrayDaughtersB0[0].mcParticle_as(); - auto particleProng1 = arrayDaughtersB0[1].mcParticle_as(); - auto particleProng2 = arrayDaughtersB0[2].mcParticle_as(); - auto particleProng3 = arrayDaughtersB0[3].mcParticle_as(); + auto particleProng0 = arrayDaughtersB0[0].mcParticle(); + auto particleProng1 = arrayDaughtersB0[1].mcParticle(); + auto particleProng2 = arrayDaughtersB0[2].mcParticle(); + auto particleProng3 = arrayDaughtersB0[3].mcParticle(); // b-hadron hypothesis std::array bHadronMotherHypos = {pdg::Code::kB0, pdg::Code::kBS, pdg::Code::kLambdaB0}; int indexProng0BMother = -1; From eeae3bba10acb6f2fda18e50b94da4e4654a6551 Mon Sep 17 00:00:00 2001 From: Alexandre Bigot Date: Tue, 30 May 2023 22:33:12 +0200 Subject: [PATCH 3/4] Add Vit's comments --- PWGHF/D2H/Tasks/taskB0.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/D2H/Tasks/taskB0.cxx b/PWGHF/D2H/Tasks/taskB0.cxx index df2997745c3..75c21f24e41 100644 --- a/PWGHF/D2H/Tasks/taskB0.cxx +++ b/PWGHF/D2H/Tasks/taskB0.cxx @@ -51,7 +51,7 @@ struct HfTaskB0 { {"hPtProng1", "B0 candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 10.}}}}, {"hPtCand", "B0 candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0., 50.}}}}}}; - void init(o2::framework::InitContext&) + void init(InitContext const&) { static const AxisSpec axisMassB0 = {300, 4.5, 6.0, "inv. mass (GeV/#it{c}^{2})"}; static const AxisSpec axisPt = {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}; From fcdd9bddbae1a9fd5ff0b01d31f94062d6743ad4 Mon Sep 17 00:00:00 2001 From: Alexander Bigot Date: Sat, 3 Jun 2023 20:58:26 +0200 Subject: [PATCH 4/4] Add Fabio's comments --- PWGHF/D2H/Tasks/taskB0.cxx | 16 +++++----- .../DataModel/CandidateReconstructionTables.h | 4 +-- PWGHF/TableProducer/candidateCreatorB0.cxx | 32 ++++++------------- 3 files changed, 19 insertions(+), 33 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskB0.cxx b/PWGHF/D2H/Tasks/taskB0.cxx index 75c21f24e41..c2c43071636 100644 --- a/PWGHF/D2H/Tasks/taskB0.cxx +++ b/PWGHF/D2H/Tasks/taskB0.cxx @@ -117,7 +117,7 @@ struct HfTaskB0 { registry.add("hPtRecSig", "B0 candidates (matched);candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0., 30.}}}); registry.add("hPtRecBg", "B0 candidates (unmatched);candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0., 30.}}}); - registry.add("hPtGenSig", "B0 candidates (gen+rec);candidate #it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0., 10.}}}); + registry.add("hPtGenSig", "B0 candidates (gen+rec);candidate #it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0., 30.}}}); registry.add("hPtGen", "MC particles (generated);candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0., 30.}}}); registry.add("hPtGenWithRapidityBelowHalf", "MC particles (generated - |#it{y}^{gen}|<0.5);candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0., 30.}}}); registry.add("hPtGenWithProngsInAcceptance", "MC particles (generated-daughters in acceptance);candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0., 30.}}}); @@ -125,8 +125,8 @@ struct HfTaskB0 { if (checkDecayTypeMc) { constexpr uint8_t kNBinsDecayTypeMc = DecayTypeMc::NDecayTypeMc; TString labels[kNBinsDecayTypeMc]; - labels[DecayTypeMc::B0ToDPiAndDToPiKPi] = "B^{0} #rightarrow (D^{#minus} #rightarrow #pi^{#minus} K^{#plus} #pi^{#minus}) #pi^{#plus}"; - labels[DecayTypeMc::B0ToDsPiAndDsToKKPi] = "B^{0} #rightarrow (D^{#minus}_{s} #rightarrow K^{#minus} K^{#plus} #pi^{#minus}) #pi^{#plus}"; + labels[DecayTypeMc::B0ToDplusPiToPiKPiPi] = "B^{0} #rightarrow (D^{#minus} #rightarrow #pi^{#minus} K^{#plus} #pi^{#minus}) #pi^{#plus}"; + labels[DecayTypeMc::B0ToDsPiToKKPiPi] = "B^{0} #rightarrow (D^{#minus}_{s} #rightarrow K^{#minus} K^{#plus} #pi^{#minus}) #pi^{#plus}"; labels[DecayTypeMc::PartlyRecoDecay] = "Partly reconstructed decay channel"; labels[DecayTypeMc::OtherDecay] = "Other decays"; static const AxisSpec axisDecayType = {kNBinsDecayTypeMc, 0.5, kNBinsDecayTypeMc + 0.5, ""}; @@ -202,7 +202,7 @@ struct HfTaskB0 { auto invMassCandB0 = invMassB0ToDPi(candidate); int flagMcMatchRecB0 = std::abs(candidate.flagMcMatchRec()); - if (TESTBIT(flagMcMatchRecB0, hf_cand_b0::DecayTypeMc::B0ToDPiAndDToPiKPi)) { + if (TESTBIT(flagMcMatchRecB0, hf_cand_b0::DecayTypeMc::B0ToDplusPiToPiKPiPi)) { auto indexMother = RecoDecay::getMother(particlesMc, candidate.prong1_as().mcParticle_as>(), pdg::Code::kB0, true); auto particleMother = particlesMc.rawIteratorAt(indexMother); @@ -226,7 +226,7 @@ struct HfTaskB0 { registry.fill(HIST("hChi2PCARecSig"), candidate.chi2PCA(), ptCandB0); if (checkDecayTypeMc) { - registry.fill(HIST("hDecayTypeMc"), 1 + DecayTypeMc::B0ToDPiAndDToPiKPi, invMassCandB0, ptCandB0); + registry.fill(HIST("hDecayTypeMc"), 1 + DecayTypeMc::B0ToDplusPiToPiKPiPi, invMassCandB0, ptCandB0); } } else { registry.fill(HIST("hPtRecBg"), ptCandB0); @@ -248,12 +248,12 @@ struct HfTaskB0 { registry.fill(HIST("hChi2PCARecBg"), candidate.chi2PCA(), ptCandB0); if (checkDecayTypeMc) { - if (TESTBIT(flagMcMatchRecB0, DecayTypeMc::B0ToDsPiAndDsToKKPi)) { // B0 → Ds- π+ → (K- K+ π-) π+ - registry.fill(HIST("hDecayTypeMc"), 1 + DecayTypeMc::B0ToDsPiAndDsToKKPi, invMassCandB0, ptCandB0); + if (TESTBIT(flagMcMatchRecB0, DecayTypeMc::B0ToDsPiToKKPiPi)) { // B0 → Ds- π+ → (K- K+ π-) π+ + registry.fill(HIST("hDecayTypeMc"), 1 + DecayTypeMc::B0ToDsPiToKKPiPi, invMassCandB0, ptCandB0); } else if (TESTBIT(flagMcMatchRecB0, DecayTypeMc::PartlyRecoDecay)) { // Partly reconstructed decay channel registry.fill(HIST("hDecayTypeMc"), 1 + DecayTypeMc::PartlyRecoDecay, invMassCandB0, ptCandB0); } else { - registry.fill(HIST("hDecayTypeMc"), 1 + OtherDecay, invMassCandB0, ptCandB0); + registry.fill(HIST("hDecayTypeMc"), 1 + DecayTypeMc::OtherDecay, invMassCandB0, ptCandB0); } } } diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index 864151adf84..f74f2b96506 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -1793,8 +1793,8 @@ DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mi // mapping of decay types enum DecayType { B0ToDPi }; -enum DecayTypeMc : uint8_t { B0ToDPiAndDToPiKPi = 0, - B0ToDsPiAndDsToKKPi, +enum DecayTypeMc : uint8_t { B0ToDplusPiToPiKPiPi = 0, + B0ToDsPiToKKPiPi, PartlyRecoDecay, OtherDecay, NDecayTypeMc }; diff --git a/PWGHF/TableProducer/candidateCreatorB0.cxx b/PWGHF/TableProducer/candidateCreatorB0.cxx index d65c650121c..02d8e58bbf9 100644 --- a/PWGHF/TableProducer/candidateCreatorB0.cxx +++ b/PWGHF/TableProducer/candidateCreatorB0.cxx @@ -371,7 +371,7 @@ struct HfCandidateCreatorB0Expressions { // Printf("Checking D- → π- K+ π-"); indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrayDaughtersD, pdg::Code::kDMinus, array{-kPiPlus, +kKPlus, -kPiPlus}, true, &sign, 2); if (indexRec > -1) { - flag = sign * BIT(hf_cand_b0::DecayType::B0ToDPi); + flag = sign * BIT(hf_cand_b0::DecayTypeMc::B0ToDplusPiToPiKPiPi); } else { debug = 1; LOGF(debug, "WARNING: B0 in decays in the expected final state but the condition on the intermediate state is not fulfilled"); @@ -385,7 +385,7 @@ struct HfCandidateCreatorB0Expressions { // Ds- → K- K+ π- indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrayDaughtersD, -pdg::Code::kDS, array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2); if (indexRec > -1) { - flag = sign * BIT(hf_cand_b0::DecayTypeMc::B0ToDsPiAndDsToKKPi); + flag = sign * BIT(hf_cand_b0::DecayTypeMc::B0ToDsPiToKKPiPi); } } } @@ -399,33 +399,19 @@ struct HfCandidateCreatorB0Expressions { auto particleProng3 = arrayDaughtersB0[3].mcParticle(); // b-hadron hypothesis std::array bHadronMotherHypos = {pdg::Code::kB0, pdg::Code::kBS, pdg::Code::kLambdaB0}; - int indexProng0BMother = -1; - int indexProng1BMother = -1; - int indexProng2BMother = -1; - int indexProng3BMother = -1; for (const auto& bHadronMotherHypo : bHadronMotherHypos) { int index0Mother = RecoDecay::getMother(particlesMc, particleProng0, bHadronMotherHypo, true); int index1Mother = RecoDecay::getMother(particlesMc, particleProng1, bHadronMotherHypo, true); int index2Mother = RecoDecay::getMother(particlesMc, particleProng2, bHadronMotherHypo, true); int index3Mother = RecoDecay::getMother(particlesMc, particleProng3, bHadronMotherHypo, true); - if (index0Mother > -1) { - indexProng0BMother = index0Mother; - } - if (index1Mother > -1) { - indexProng1BMother = index1Mother; - } - if (index2Mother > -1) { - indexProng2BMother = index2Mother; - } - if (index3Mother > -1) { - indexProng3BMother = index3Mother; - } - } - // look for common b-hadron ancestor - if (indexProng0BMother > -1 && indexProng1BMother > -1 && indexProng2BMother > -1 && indexProng3BMother > -1) { - if (indexProng0BMother == indexProng1BMother && indexProng1BMother == indexProng2BMother && indexProng2BMother == indexProng3BMother) { - flag = BIT(hf_cand_b0::DecayTypeMc::PartlyRecoDecay); + + // look for common b-hadron ancestor + if (index0Mother > -1 && index1Mother > -1 && index2Mother > -1 && index3Mother > -1) { + if (index0Mother == index1Mother && index1Mother == index2Mother && index2Mother == index3Mother) { + flag = BIT(hf_cand_b0::DecayTypeMc::PartlyRecoDecay); + break; + } } } }