Skip to content

Commit

Permalink
Splitting sel8 in the reco part
Browse files Browse the repository at this point in the history
  • Loading branch information
Luigi Dello Stritto committed May 31, 2024
1 parent af80b31 commit 1c2af0d
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 23 deletions.
6 changes: 5 additions & 1 deletion PWGHF/TableProducer/candidateCreator2Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>();
hfEvSelMc.useSel8Trigger = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.useTvxTrigger") == 0) {
hfEvSelMc.useTvxTrigger = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.useTimeFrameBorderCut") == 0) {
hfEvSelMc.useTimeFrameBorderCut = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.useItsRofBorderCut") == 0) {
hfEvSelMc.useItsRofBorderCut = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.zPvPosMin") == 0) {
hfEvSelMc.zPvPosMin = option.defaultValue.get<float>();
} else if (option.name.compare("hfEvSel.zPvPosMax") == 0) {
Expand Down
6 changes: 5 additions & 1 deletion PWGHF/TableProducer/candidateCreator3Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,13 @@ struct HfCandidateCreator3ProngExpressions {
} else if (option.name.compare("createXic") == 0) {
createXic = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.useSel8Trigger") == 0) {
hfEvSelMc.useItsRoBorderCut = option.defaultValue.get<bool>();
hfEvSelMc.useSel8Trigger = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.useTvxTrigger") == 0) {
hfEvSelMc.useTvxTrigger = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.useTimeFrameBorderCut") == 0) {
hfEvSelMc.useTimeFrameBorderCut = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.useItsRofBorderCut") == 0) {
hfEvSelMc.useItsRofBorderCut = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.zPvPosMin") == 0) {
hfEvSelMc.zPvPosMin = option.defaultValue.get<float>();
} else if (option.name.compare("hfEvSel.zPvPosMax") == 0) {
Expand Down
6 changes: 5 additions & 1 deletion PWGHF/TableProducer/candidateCreatorCascade.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>();
hfEvSelMc.useSel8Trigger = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.useTvxTrigger") == 0) {
hfEvSelMc.useTvxTrigger = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.useTimeFrameBorderCut") == 0) {
hfEvSelMc.useTimeFrameBorderCut = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.useItsRofBorderCut") == 0) {
hfEvSelMc.useItsRofBorderCut = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.zPvPosMin") == 0) {
hfEvSelMc.zPvPosMin = option.defaultValue.get<float>();
} else if (option.name.compare("hfEvSel.zPvPosMax") == 0) {
Expand Down
6 changes: 5 additions & 1 deletion PWGHF/TableProducer/candidateCreatorDstar.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>();
hfEvSelMc.useSel8Trigger = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.useTvxTrigger") == 0) {
hfEvSelMc.useTvxTrigger = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.useTimeFrameBorderCut") == 0) {
hfEvSelMc.useTimeFrameBorderCut = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.useItsRofBorderCut") == 0) {
hfEvSelMc.useItsRofBorderCut = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.zPvPosMin") == 0) {
hfEvSelMc.zPvPosMin = option.defaultValue.get<float>();
} else if (option.name.compare("hfEvSel.zPvPosMax") == 0) {
Expand Down
24 changes: 14 additions & 10 deletions PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>();
hfEvSelMc.useSel8Trigger = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.useTvxTrigger") == 0) {
hfEvSelMc.useTvxTrigger = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.useTimeFrameBorderCut") == 0) {
hfEvSelMc.useTimeFrameBorderCut = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.useItsRofBorderCut") == 0) {
hfEvSelMc.useItsRofBorderCut = option.defaultValue.get<bool>();
} else if (option.name.compare("hfEvSel.zPvPosMin") == 0) {
hfEvSelMc.zPvPosMin = option.defaultValue.get<float>();
} else if (option.name.compare("hfEvSel.zPvPosMax") == 0) {
Expand Down Expand Up @@ -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
Expand Down
46 changes: 37 additions & 9 deletions PWGHF/Utils/utilsEvSelHf.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ enum EventRejection {
None = 0,
Centrality,
Trigger,
TvxTrigger,
TimeFrameBorderCut,
ItsRofBorderCut,
IsGoodZvtxFT0vsPV,
NoSameBunchPileup,
NumTracksInTimeRange,
Expand All @@ -50,7 +52,9 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
o2::framework::Configurable<float> centralityMax{"centralityMax", 100., "Maximum centrality"};
o2::framework::Configurable<bool> useSel8Trigger{"useSel8Trigger", true, "Apply the sel8 event selection"};
o2::framework::Configurable<int> triggerClass{"triggerClass", -1, "Trigger class different from sel8 (e.g. kINT7 for Run2) used only if useSel8Trigger is false"};
o2::framework::Configurable<bool> useTvxTrigger{"useTvxTrigger", true, "Apply TVX trigger sel"};
o2::framework::Configurable<bool> useTimeFrameBorderCut{"useTimeFrameBorderCut", true, "Apply TF border cut"};
o2::framework::Configurable<bool> useItsRofBorderCut{"useItsRofBorderCut", true, "Apply ITS ROF border cut"};
o2::framework::Configurable<bool> useIsGoodZvtxFT0vsPV{"useIsGoodZvtxFT0vsPV", false, "Check consistency between PVz from central barrel with that from FT0 timing"};
o2::framework::Configurable<bool> useNoSameBunchPileup{"useNoSameBunchPileup", false, "Exclude collisions in bunches with more than 1 reco. PV"}; // POTENTIALLY BAD FOR BEAUTY ANALYSES
o2::framework::Configurable<bool> useNumTracksInTimeRange{"useNumTracksInTimeRange", false, "Apply occupancy selection (num. ITS tracks with at least 5 clusters in +-100us from current collision)"};
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand All @@ -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 <typename TBc, typename TMcColl>
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<TBc>();

/// 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);
Expand Down

0 comments on commit 1c2af0d

Please sign in to comment.