diff --git a/PWGLF/DataModel/cascqaanalysis.h b/PWGLF/DataModel/cascqaanalysis.h index 93081d09fca..3442c074305 100644 --- a/PWGLF/DataModel/cascqaanalysis.h +++ b/PWGLF/DataModel/cascqaanalysis.h @@ -87,7 +87,7 @@ DECLARE_SOA_COLUMN(BachHasTOF, bachhastof, int); DECLARE_SOA_COLUMN(PosPt, pospt, float); DECLARE_SOA_COLUMN(NegPt, negpt, float); DECLARE_SOA_COLUMN(BachPt, bachpt, float); -DECLARE_SOA_COLUMN(McPdgCode, mcPdgCode, int); //! -1 unknown +DECLARE_SOA_COLUMN(McPdgCode, mcPdgCode, int); //! 0 unknown/no MC association DECLARE_SOA_COLUMN(IsPrimary, isPrimary, int); //! -1 unknown, 0 not primary, 1 primary DECLARE_SOA_COLUMN(BachBaryonCosPA, bachBaryonCosPA, float); //! avoid bach-baryon correlated inv mass structure in analysis DECLARE_SOA_COLUMN(BachBaryonDCAxyToPV, bachBaryonDCAxyToPV, float); //! avoid bach-baryon correlated inv mass structure in analysis diff --git a/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx b/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx index 6ca9c40082b..8ec9142efc3 100644 --- a/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx +++ b/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx @@ -68,6 +68,7 @@ using namespace o2::aod::rctsel; using TrkPidInfo = soa::Join; using DauTracks = soa::Join; using LabeledCascades = soa::Join; +using BCsWithBcSels = soa::Join; struct Cascqaanalysis { @@ -119,6 +120,7 @@ struct Cascqaanalysis { Configurable isTriggerTVX{"isTriggerTVX", 1, "TVX trigger"}; Configurable isNoTimeFrameBorder{"isNoTimeFrameBorder", 1, "TF border cut"}; Configurable isNoITSROFrameBorder{"isNoITSROFrameBorder", 1, "ITS ROF border cut"}; + Configurable applyBcBorderCutsOnGen{"applyBcBorderCutsOnGen", false, "Apply enabled BC-level TF and ITS ROF border cuts on generated-level MC collisions"}; Configurable isNoCollInTimeRangeNarrow{"isNoCollInTimeRangeNarrow", 1, "No collisions in +-2us window"}; Configurable requireRCTFlagChecker{"requireRCTFlagChecker", true, "Check event quality in run condition table"}; @@ -221,7 +223,7 @@ struct Cascqaanalysis { void init(InitContext const&) { TString hCandidateCounterLabels[4] = {"All candidates", "passed topo cuts", "has associated MC particle", "associated with Xi(Omega)"}; - TString hNEventsMCLabels[6] = {"All", "z vrtx", "INEL", "INEL>0", "INEL>1", "Associated with rec. collision"}; + TString hNEventsMCLabels[7] = {"All", "z vrtx", "BC TF/ITS ROF border", "INEL", "INEL>0", "INEL>1", "Associated with rec. collision"}; TString hNEventsLabels[14] = {"All", "kIsTriggerTVX", "kNoTimeFrameBorder", "kNoITSROFrameBorder", "kIsVertexITSTPC", "kNoSameBunchPileup", "kIsGoodZvtxFT0vsPV", "isVertexTOFmatched", "kNoCollInTimeRangeNarrow", "z vrtx", "RCTFlagsChecker", "INEL", "INEL>0", "INEL>1"}; registry.add("hNEvents", "hNEvents", {HistType::kTH1D, {{14, 0.f, 14.f}}}); @@ -239,7 +241,7 @@ struct Cascqaanalysis { // Rec. lvl registry.add("fakeEvents", "fakeEvents", {HistType::kTH1F, {{1, -0.5f, 0.5f}}}); // Gen. lvl - registry.add("hNEventsMC", "hNEventsMC", {HistType::kTH1D, {{6, 0.0f, 6.0f}}}); + registry.add("hNEventsMC", "hNEventsMC", {HistType::kTH1D, {{7, 0.0f, 7.0f}}}); for (int n = 1; n <= registry.get(HIST("hNEventsMC"))->GetNbinsX(); n++) { registry.get(HIST("hNEventsMC"))->GetXaxis()->SetBinLabel(n, hNEventsMCLabels[n - 1]); } @@ -481,6 +483,21 @@ struct Cascqaanalysis { return true; } + template + bool acceptGeneratedEventBcBorderCuts(TBC const& bc) + { + if (!applyBcBorderCutsOnGen) { + return true; + } + if (isNoTimeFrameBorder && !bc.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + return false; + } + if (isNoITSROFrameBorder && !bc.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + return false; + } + return true; + } + void processData(soa::Join::iterator const& collision, @@ -546,7 +563,7 @@ struct Cascqaanalysis { posdau.tpcNClsFound(), negdau.tpcNClsFound(), bachelor.tpcNClsFound(), posdau.tpcNClsCrossedRows(), negdau.tpcNClsCrossedRows(), bachelor.tpcNClsCrossedRows(), posdau.hasTOF(), negdau.hasTOF(), bachelor.hasTOF(), - posdau.pt(), negdau.pt(), bachelor.pt(), -1, -1, casc.bachBaryonCosPA(), casc.bachBaryonDCAxyToPV(), evFlag, 1e3, 1e3); + posdau.pt(), negdau.pt(), bachelor.pt(), 0, -1, casc.bachBaryonCosPA(), casc.bachBaryonDCAxyToPV(), evFlag, 1e3, 1e3); } } } @@ -627,16 +644,16 @@ struct Cascqaanalysis { registry.fill(HIST("hCandidateCounter"), 1.5); // passed topo cuts nCandSel++; // Check mc association - float lPDG = 1e3; + int mcPdgCode = 0; float genPt = 1e3; float genY = 1e3; float isPrimary = -1; if (casc.has_mcParticle()) { registry.fill(HIST("hCandidateCounter"), 2.5); // has associated MC particle auto cascmc = casc.mcParticle(); + mcPdgCode = cascmc.pdgCode(); if (std::abs(cascmc.pdgCode()) == PDG_t::kXiMinus || std::abs(cascmc.pdgCode()) == PDG_t::kOmegaMinus) { registry.fill(HIST("hCandidateCounter"), 3.5); // associated with Xi or Omega - lPDG = cascmc.pdgCode(); isPrimary = cascmc.isPhysicalPrimary() ? 1 : 0; genPt = cascmc.pt(); genY = cascmc.y(); @@ -667,7 +684,7 @@ struct Cascqaanalysis { posdau.tpcNClsFound(), negdau.tpcNClsFound(), bachelor.tpcNClsFound(), posdau.tpcNClsCrossedRows(), negdau.tpcNClsCrossedRows(), bachelor.tpcNClsCrossedRows(), posdau.hasTOF(), negdau.hasTOF(), bachelor.hasTOF(), - posdau.pt(), negdau.pt(), bachelor.pt(), lPDG, isPrimary, casc.bachBaryonCosPA(), casc.bachBaryonDCAxyToPV(), evFlag, genPt, genY); + posdau.pt(), negdau.pt(), bachelor.pt(), mcPdgCode, isPrimary, casc.bachBaryonCosPA(), casc.bachBaryonDCAxyToPV(), evFlag, genPt, genY); } } } @@ -681,6 +698,7 @@ struct Cascqaanalysis { void processMCgen(soa::Join::iterator const& mcCollision, // mcCollision.centFV0A() to be added aod::McParticles const& mcParticles, const soa::SmallGroups>& collisions, + BCsWithBcSels const&, DauTracks const&) { // All generated collisions @@ -690,25 +708,29 @@ struct Cascqaanalysis { if (std::fabs(mcCollision.posZ()) > cutzvertex) { return; } - registry.fill(HIST("hZCollisionGen"), mcCollision.posZ()); registry.fill(HIST("hNEventsMC"), 1.5); + if (!acceptGeneratedEventBcBorderCuts(mcCollision.bc_as())) { + return; + } + registry.fill(HIST("hZCollisionGen"), mcCollision.posZ()); + registry.fill(HIST("hNEventsMC"), 2.5); // Define the type of generated MC collision EventTypeBin evType = kINEL; uint8_t flagsGen = 0; flagsGen |= o2::aod::myMCcascades::EvFlags::EvINEL; - registry.fill(HIST("hNEventsMC"), 2.5); + registry.fill(HIST("hNEventsMC"), 3.5); // Generated collision is INEL>0 if (pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) { flagsGen |= o2::aod::myMCcascades::EvFlags::EvINELgt0; evType = kINELgt0; - registry.fill(HIST("hNEventsMC"), 3.5); + registry.fill(HIST("hNEventsMC"), 4.5); } // Generated collision is INEL>1 if (pwglf::isINELgtNmc(mcParticles, 1, pdgDB)) { flagsGen |= o2::aod::myMCcascades::EvFlags::EvINELgt1; evType = kINELgt1; - registry.fill(HIST("hNEventsMC"), 4.5); + registry.fill(HIST("hNEventsMC"), 5.5); } registry.fill(HIST("hCentFT0M_genMC"), mcCollision.centFT0M(), evType); @@ -783,7 +805,7 @@ struct Cascqaanalysis { uint8_t flagsAssoc = 0; if (evtReconstructedAndINEL) { flagsAssoc |= o2::aod::myMCcascades::EvFlags::EvINEL; - registry.fill(HIST("hNEventsMC"), 5.5); + registry.fill(HIST("hNEventsMC"), 6.5); } if (evtReconstructedAndINELgt0) { flagsAssoc |= o2::aod::myMCcascades::EvFlags::EvINELgt0; diff --git a/PWGLF/Tasks/Strangeness/cascpostprocessing.cxx b/PWGLF/Tasks/Strangeness/cascpostprocessing.cxx index 94dafc57939..29ac791051d 100644 --- a/PWGLF/Tasks/Strangeness/cascpostprocessing.cxx +++ b/PWGLF/Tasks/Strangeness/cascpostprocessing.cxx @@ -106,6 +106,7 @@ struct LfCascpostprocessing { AxisSpec ptAxisTopoVar = {50, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec ptAxisPID = {50, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; ConfigurableAxis etaAxis{"etaAxis", {40, -2.0f, 2.0f}, "#eta"}; + AxisSpec pdgCodeAxis = {10001, -5000.5f, 5000.5f, "MC PDG code (0 = no MC assoc.)"}; ConfigurableAxis centFT0MAxis{"centFT0MAxis", {VARIABLE_WIDTH, 0., 0.01, 0.05, 0.1, 0.5, 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 101, 105.5}, @@ -238,6 +239,9 @@ struct LfCascpostprocessing { registry.add("hCascPlusMassvsPtBG", "hCascPlusMassvsPtBG", {HistType::kTH2F, {ptAxis, massAxis}}); registry.add("hCascMinusMassvsPtBG_FT0M", "hCascMinusMassvsPtBG_FT0M", {HistType::kTH3F, {ptAxis, massAxis, centFT0MAxis}}); registry.add("hCascPlusMassvsPtBG_FT0M", "hCascPlusMassvsPtBG_FT0M", {HistType::kTH3F, {ptAxis, massAxis, centFT0MAxis}}); + registry.add("hMisidentifiedCascPdgCode", "hMisidentifiedCascPdgCode", {HistType::kTH1F, {pdgCodeAxis}}); + registry.add("hMisidentifiedCascMinusPdgCode", "hMisidentifiedCascMinusPdgCode", {HistType::kTH1F, {pdgCodeAxis}}); + registry.add("hMisidentifiedCascPlusPdgCode", "hMisidentifiedCascPlusPdgCode", {HistType::kTH1F, {pdgCodeAxis}}); registry.add("hPtXiPlusTrue", "hPtXiPlusTrue", {HistType::kTH3F, {ptAxis, rapidityAxis, centFT0MAxis}}); registry.add("hPtXiMinusTrue", "hPtXiMinusTrue", {HistType::kTH3F, {ptAxis, rapidityAxis, centFT0MAxis}}); registry.add("hPtOmegaPlusTrue", "hPtOmegaPlusTrue", {HistType::kTH3F, {ptAxis, rapidityAxis, centFT0MAxis}}); @@ -514,6 +518,15 @@ struct LfCascpostprocessing { // registry.fill(HIST("hNegITSHits"), candidate.negitshits()); // registry.fill(HIST("hBachITSHits"), candidate.bachitshits()); + if (isMC && !isCorrectlyRec) { + registry.fill(HIST("hMisidentifiedCascPdgCode"), candidate.mcPdgCode()); + if (candidate.sign() < 0) { + registry.fill(HIST("hMisidentifiedCascMinusPdgCode"), candidate.mcPdgCode()); + } else if (candidate.sign() > 0) { + registry.fill(HIST("hMisidentifiedCascPlusPdgCode"), candidate.mcPdgCode()); + } + } + if (candidate.sign() < 0) { if (isMC) { if (isCorrectlyRec) {