From 1c2af0daa3a17eacdc37cb405a9200a2a72dd54d Mon Sep 17 00:00:00 2001 From: Luigi Dello Stritto Date: Fri, 31 May 2024 16:33:00 +0200 Subject: [PATCH] Splitting sel8 in the reco part --- .../TableProducer/candidateCreator2Prong.cxx | 6 ++- .../TableProducer/candidateCreator3Prong.cxx | 6 ++- .../TableProducer/candidateCreatorCascade.cxx | 6 ++- PWGHF/TableProducer/candidateCreatorDstar.cxx | 6 ++- .../candidateCreatorXic0Omegac0.cxx | 24 ++++++---- PWGHF/Utils/utilsEvSelHf.h | 46 +++++++++++++++---- 6 files changed, 71 insertions(+), 23 deletions(-) diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index ae67961f010..836e1df7df2 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -665,9 +665,13 @@ struct HfCandidateCreator2ProngExpressions { if (device.name.compare("hf-candidate-creator-2prong") == 0) { for (const auto& option : device.options) { if (option.name.compare("hfEvSel.useSel8Trigger") == 0) { - hfEvSelMc.useItsRoBorderCut = option.defaultValue.get(); + hfEvSelMc.useSel8Trigger = option.defaultValue.get(); + } else if (option.name.compare("hfEvSel.useTvxTrigger") == 0) { + hfEvSelMc.useTvxTrigger = option.defaultValue.get(); } else if (option.name.compare("hfEvSel.useTimeFrameBorderCut") == 0) { hfEvSelMc.useTimeFrameBorderCut = option.defaultValue.get(); + } else if (option.name.compare("hfEvSel.useItsRofBorderCut") == 0) { + hfEvSelMc.useItsRofBorderCut = option.defaultValue.get(); } else if (option.name.compare("hfEvSel.zPvPosMin") == 0) { hfEvSelMc.zPvPosMin = option.defaultValue.get(); } else if (option.name.compare("hfEvSel.zPvPosMax") == 0) { diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index a26f6b13cd2..2f9e6386a83 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -479,9 +479,13 @@ struct HfCandidateCreator3ProngExpressions { } else if (option.name.compare("createXic") == 0) { createXic = option.defaultValue.get(); } else if (option.name.compare("hfEvSel.useSel8Trigger") == 0) { - hfEvSelMc.useItsRoBorderCut = option.defaultValue.get(); + hfEvSelMc.useSel8Trigger = option.defaultValue.get(); + } else if (option.name.compare("hfEvSel.useTvxTrigger") == 0) { + hfEvSelMc.useTvxTrigger = option.defaultValue.get(); } else if (option.name.compare("hfEvSel.useTimeFrameBorderCut") == 0) { hfEvSelMc.useTimeFrameBorderCut = option.defaultValue.get(); + } else if (option.name.compare("hfEvSel.useItsRofBorderCut") == 0) { + hfEvSelMc.useItsRofBorderCut = option.defaultValue.get(); } else if (option.name.compare("hfEvSel.zPvPosMin") == 0) { hfEvSelMc.zPvPosMin = option.defaultValue.get(); } else if (option.name.compare("hfEvSel.zPvPosMax") == 0) { diff --git a/PWGHF/TableProducer/candidateCreatorCascade.cxx b/PWGHF/TableProducer/candidateCreatorCascade.cxx index e8df43ae473..72492fd2e2f 100644 --- a/PWGHF/TableProducer/candidateCreatorCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorCascade.cxx @@ -444,9 +444,13 @@ struct HfCandidateCreatorCascadeMc { if (device.name.compare("hf-candidate-creator-cascade") == 0) { for (const auto& option : device.options) { if (option.name.compare("hfEvSel.useSel8Trigger") == 0) { - hfEvSelMc.useItsRoBorderCut = option.defaultValue.get(); + hfEvSelMc.useSel8Trigger = option.defaultValue.get(); + } else if (option.name.compare("hfEvSel.useTvxTrigger") == 0) { + hfEvSelMc.useTvxTrigger = option.defaultValue.get(); } else if (option.name.compare("hfEvSel.useTimeFrameBorderCut") == 0) { hfEvSelMc.useTimeFrameBorderCut = option.defaultValue.get(); + } else if (option.name.compare("hfEvSel.useItsRofBorderCut") == 0) { + hfEvSelMc.useItsRofBorderCut = option.defaultValue.get(); } else if (option.name.compare("hfEvSel.zPvPosMin") == 0) { hfEvSelMc.zPvPosMin = option.defaultValue.get(); } else if (option.name.compare("hfEvSel.zPvPosMax") == 0) { diff --git a/PWGHF/TableProducer/candidateCreatorDstar.cxx b/PWGHF/TableProducer/candidateCreatorDstar.cxx index 68372f0029c..c9817cabb4d 100644 --- a/PWGHF/TableProducer/candidateCreatorDstar.cxx +++ b/PWGHF/TableProducer/candidateCreatorDstar.cxx @@ -516,9 +516,13 @@ struct HfCandidateCreatorDstarExpressions { if (device.name.compare("hf-candidate-creator-dstar") == 0) { for (const auto& option : device.options) { if (option.name.compare("hfEvSel.useSel8Trigger") == 0) { - hfEvSelMc.useItsRoBorderCut = option.defaultValue.get(); + hfEvSelMc.useSel8Trigger = option.defaultValue.get(); + } else if (option.name.compare("hfEvSel.useTvxTrigger") == 0) { + hfEvSelMc.useTvxTrigger = option.defaultValue.get(); } else if (option.name.compare("hfEvSel.useTimeFrameBorderCut") == 0) { hfEvSelMc.useTimeFrameBorderCut = option.defaultValue.get(); + } else if (option.name.compare("hfEvSel.useItsRofBorderCut") == 0) { + hfEvSelMc.useItsRofBorderCut = option.defaultValue.get(); } else if (option.name.compare("hfEvSel.zPvPosMin") == 0) { hfEvSelMc.zPvPosMin = option.defaultValue.get(); } else if (option.name.compare("hfEvSel.zPvPosMax") == 0) { diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx index 1c443ec1b6d..23c1f99707f 100644 --- a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx +++ b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx @@ -673,9 +673,13 @@ struct HfCandidateCreatorXic0Omegac0Mc { if (device.name.compare("hf-candidate-creator-xic0-omegac0") == 0) { for (const auto& option : device.options) { if (option.name.compare("hfEvSel.useSel8Trigger") == 0) { - hfEvSelMc.useItsRoBorderCut = option.defaultValue.get(); + hfEvSelMc.useSel8Trigger = option.defaultValue.get(); + } else if (option.name.compare("hfEvSel.useTvxTrigger") == 0) { + hfEvSelMc.useTvxTrigger = option.defaultValue.get(); } else if (option.name.compare("hfEvSel.useTimeFrameBorderCut") == 0) { hfEvSelMc.useTimeFrameBorderCut = option.defaultValue.get(); + } else if (option.name.compare("hfEvSel.useItsRofBorderCut") == 0) { + hfEvSelMc.useItsRofBorderCut = option.defaultValue.get(); } else if (option.name.compare("hfEvSel.zPvPosMin") == 0) { hfEvSelMc.zPvPosMin = option.defaultValue.get(); } else if (option.name.compare("hfEvSel.zPvPosMax") == 0) { @@ -894,16 +898,16 @@ struct HfCandidateCreatorXic0Omegac0Mc { if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the gen particle if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi) { - rowMCMatchGenXicToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, etaCharmBaryonGen, origin); - } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToXiPi) { - rowMCMatchGenOmegacToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, etaCharmBaryonGen, origin); - } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi) { - rowMCMatchGenToOmegaPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, etaCharmBaryonGen, origin); - } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaK) { - rowMCMatchGenToOmegaK(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, etaCharmBaryonGen, origin); - } - continue; + rowMCMatchGenXicToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, etaCharmBaryonGen, origin); + } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToXiPi) { + rowMCMatchGenOmegacToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, etaCharmBaryonGen, origin); + } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi) { + rowMCMatchGenToOmegaPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, etaCharmBaryonGen, origin); + } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaK) { + rowMCMatchGenToOmegaK(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, etaCharmBaryonGen, origin); } + continue; + } if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi) { // Xic → Xi pi diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index eca1bb4e450..d70b9d51b98 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -33,7 +33,9 @@ enum EventRejection { None = 0, Centrality, Trigger, + TvxTrigger, TimeFrameBorderCut, + ItsRofBorderCut, IsGoodZvtxFT0vsPV, NoSameBunchPileup, NumTracksInTimeRange, @@ -50,7 +52,9 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { o2::framework::Configurable centralityMax{"centralityMax", 100., "Maximum centrality"}; o2::framework::Configurable useSel8Trigger{"useSel8Trigger", true, "Apply the sel8 event selection"}; o2::framework::Configurable triggerClass{"triggerClass", -1, "Trigger class different from sel8 (e.g. kINT7 for Run2) used only if useSel8Trigger is false"}; + o2::framework::Configurable useTvxTrigger{"useTvxTrigger", true, "Apply TVX trigger sel"}; o2::framework::Configurable useTimeFrameBorderCut{"useTimeFrameBorderCut", true, "Apply TF border cut"}; + o2::framework::Configurable useItsRofBorderCut{"useItsRofBorderCut", true, "Apply ITS ROF border cut"}; o2::framework::Configurable useIsGoodZvtxFT0vsPV{"useIsGoodZvtxFT0vsPV", false, "Check consistency between PVz from central barrel with that from FT0 timing"}; o2::framework::Configurable useNoSameBunchPileup{"useNoSameBunchPileup", false, "Exclude collisions in bunches with more than 1 reco. PV"}; // POTENTIALLY BAD FOR BEAUTY ANALYSES o2::framework::Configurable useNumTracksInTimeRange{"useNumTracksInTimeRange", false, "Apply occupancy selection (num. ITS tracks with at least 5 clusters in +-100us from current collision)"}; @@ -87,7 +91,9 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { hCollisions->GetXaxis()->SetBinLabel(EventRejection::None + 1, "All"); hCollisions->GetXaxis()->SetBinLabel(EventRejection::Centrality + 1, "Centrality"); hCollisions->GetXaxis()->SetBinLabel(EventRejection::Trigger + 1, "Trigger"); + hCollisions->GetXaxis()->SetBinLabel(EventRejection::TvxTrigger + 1, "TVX Trigger"); hCollisions->GetXaxis()->SetBinLabel(EventRejection::TimeFrameBorderCut + 1, "TF border"); + hCollisions->GetXaxis()->SetBinLabel(EventRejection::ItsRofBorderCut + 1, "ITF ROF border"); hCollisions->GetXaxis()->SetBinLabel(EventRejection::IsGoodZvtxFT0vsPV + 1, "PV #it{z} consistency FT0 timing"); hCollisions->GetXaxis()->SetBinLabel(EventRejection::NoSameBunchPileup + 1, "No same-bunch pile-up"); // POTENTIALLY BAD FOR BEAUTY ANALYSES hCollisions->GetXaxis()->SetBinLabel(EventRejection::NumTracksInTimeRange + 1, "Occupancy"); @@ -129,10 +135,18 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { if ((useSel8Trigger && !collision.sel8()) || (!useSel8Trigger && triggerClass > -1 && !collision.alias_bit(triggerClass))) { SETBIT(rejectionMask, EventRejection::Trigger); } + /// TVX trigger selection + if (useTvxTrigger && !collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + SETBIT(rejectionMask, EventRejection::TvxTrigger); + } /// time frame border cut if (useTimeFrameBorderCut && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { SETBIT(rejectionMask, EventRejection::TimeFrameBorderCut); } + /// ITS rof border cut + if (useItsRofBorderCut && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + SETBIT(rejectionMask, EventRejection::ItsRofBorderCut); + } /// PVz consistency tracking - FT0 timing if (useIsGoodZvtxFT0vsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { SETBIT(rejectionMask, EventRejection::IsGoodZvtxFT0vsPV); @@ -196,9 +210,11 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { namespace o2::hf_evsel_mc { -// generated particles rejection types +// MC collision rejection types enum McCollisionRejection { None = 0, + Trigger, + TvxTrigger, TimeFrameBorderCut, ItsRoFrameBorderCut, PositionZ, @@ -207,29 +223,41 @@ enum McCollisionRejection { struct HfEventSelectionMc { // event selection parameters (in chronological order of application) - bool useItsRoBorderCut{false}; // Apply the ITS RO frame border cut + bool useSel8Trigger{false}; // Apply the Sel8 selection + bool useTvxTrigger{false}; // Apply the TVX trigger bool useTimeFrameBorderCut{true}; // Apply TF border cut + bool useItsRofBorderCut{false}; // Apply the ITS RO frame border cut float zPvPosMin{-1000.f}; // Minimum PV posZ (cm) float zPvPosMax{1000.f}; // Maximum PV posZ (cm) - /// \brief Function to apply event selections in HF analyses - /// \param mcCollision is the analysed mc collision + /// \brief Function to apply event selections to generated MC collisions + /// \param mcCollision MC collision to test against the selection criteria /// \return a bitmask with the event selections not satisfied by the analysed collision template - uint16_t getHfMcCollisionRejectionMask(TMcColl const& mcCollision) + uint8_t getHfMcCollisionRejectionMask(TMcColl const& mcCollision) { - uint8_t rejectionMask{0}; + uint16_t rejectionMask{0}; float zPv = mcCollision.posZ(); auto bc = mcCollision.template bc_as(); - /// ITS RO frame border cut - if (useItsRoBorderCut && !bc.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - SETBIT(rejectionMask, McCollisionRejection::ItsRoFrameBorderCut); + /// TVX trigger selection + if (useSel8Trigger && (!bc.selection_bit(o2::aod::evsel::kIsTriggerTVX) + || !bc.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) + || !bc.selection_bit(o2::aod::evsel::kNoITSROFrameBorder))) { + SETBIT(rejectionMask, McCollisionRejection::Trigger); + } + /// TVX trigger selection + if (useTvxTrigger && !bc.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + SETBIT(rejectionMask, McCollisionRejection::TvxTrigger); } /// time frame border cut if (useTimeFrameBorderCut && !bc.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { SETBIT(rejectionMask, McCollisionRejection::TimeFrameBorderCut); } + /// ITS RO frame border cut + if (useItsRofBorderCut && !bc.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + SETBIT(rejectionMask, McCollisionRejection::ItsRoFrameBorderCut); + } /// primary vertex z if (zPv < zPvPosMin || zPv > zPvPosMax) { SETBIT(rejectionMask, McCollisionRejection::PositionZ);