Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PWGHF: fix generated candidate flagging & add cand. creator MC process w/o centrality sel. #6967

Merged
merged 7 commits into from
Jul 24, 2024
23 changes: 19 additions & 4 deletions PWGHF/TableProducer/candidateCreator2Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,11 @@ struct HfCandidateCreator2ProngExpressions {
// inspect for which zPvPosMax cut was set for reconstructed
void init(InitContext& initContext)
{
std::array<bool, 3> procCollisions = {doprocessMc, doprocessMcCentFT0C, doprocessMcCentFT0M};
if (std::accumulate(procCollisions.begin(), procCollisions.end(), 0) > 1) {
LOGP(fatal, "At most one process function for collision study can be enabled at a time.");
}

const auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
for (const DeviceSpec& device : workflows.devices) {
if (device.name.compare("hf-candidate-creator-2prong") == 0) {
Expand Down Expand Up @@ -752,15 +757,15 @@ struct HfCandidateCreator2ProngExpressions {

// Match generated particles.
for (const auto& particle : mcParticles) {
flag = 0;
origin = 0;
std::vector<int> idxBhadMothers{};
// Reject particles from background events
if (particle.fromBackgroundEvent() && rejectBackground) {
rowMcMatchGen(flag, origin, -1);
continue;
}

flag = 0;
origin = 0;
std::vector<int> idxBhadMothers{};

// Slice the collisions table to get the collision info for the current MC collision
auto mcCollision = particle.mcCollision();
float centrality{-1.f};
Expand Down Expand Up @@ -810,6 +815,16 @@ struct HfCandidateCreator2ProngExpressions {
}
}

void processMc(aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
McCollisionsFT0Cs const& collInfos,
aod::McCollisions const& mcCollisions,
BCsInfo const& BCsInfo)
{
runCreator2ProngMc<CentralityEstimator::None>(tracks, mcParticles, collInfos, mcCollisions, BCsInfo);
}
PROCESS_SWITCH(HfCandidateCreator2ProngExpressions, processMc, "Process MC - no centrality", true);

void processMcCentFT0C(aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
McCollisionsFT0Cs const& collInfos,
Expand Down
23 changes: 19 additions & 4 deletions PWGHF/TableProducer/candidateCreator3Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,10 @@ struct HfCandidateCreator3ProngExpressions {

void init(InitContext& initContext)
{
std::array<bool, 3> procCollisions = {doprocessMc, doprocessMcCentFT0C, doprocessMcCentFT0M};
if (std::accumulate(procCollisions.begin(), procCollisions.end(), 0) > 1) {
LOGP(fatal, "At most one process function for collision study can be enabled at a time.");
}

// inspect for which particle species the candidates were created and which zPvPosMax cut was set for reconstructed
const auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
Expand Down Expand Up @@ -638,15 +642,16 @@ struct HfCandidateCreator3ProngExpressions {

// Match generated particles.
for (const auto& particle : mcParticles) {
// Reject particles from background events
if (particle.fromBackgroundEvent() && rejectBackground) {
continue;
}
flag = 0;
origin = 0;
channel = 0;
arrDaughIndex.clear();
std::vector<int> idxBhadMothers{};
// Reject particles from background events
if (particle.fromBackgroundEvent() && rejectBackground) {
rowMcMatchGen(flag, origin, channel, -1);
continue;
}

// Slice the collisions table to get the collision info for the current MC collision
auto mcCollision = particle.mcCollision();
Expand Down Expand Up @@ -744,6 +749,16 @@ struct HfCandidateCreator3ProngExpressions {
}
}

void processMc(aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
McCollisionsFT0Cs const& collInfos,
aod::McCollisions const& mcCollisions,
BCsInfo const& BCsInfo)
{
runCreator3ProngMc<CentralityEstimator::None>(tracks, mcParticles, collInfos, mcCollisions, BCsInfo);
}
PROCESS_SWITCH(HfCandidateCreator3ProngExpressions, processMc, "Process MC - no centrality", true);

void processMcCentFT0C(aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
McCollisionsFT0Cs const& collInfos,
Expand Down
20 changes: 18 additions & 2 deletions PWGHF/TableProducer/candidateCreatorCascade.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ struct HfCandidateCreatorCascadeMc {
// inspect for which zPvPosMax cut was set for reconstructed
void init(InitContext& initContext)
{
std::array<bool, 3> procCollisions = {doprocessMc, doprocessMcCentFT0C, doprocessMcCentFT0M};
if (std::accumulate(procCollisions.begin(), procCollisions.end(), 0) > 1) {
LOGP(fatal, "At most one process function for collision study can be enabled at a time.");
}

const auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
for (const DeviceSpec& device : workflows.devices) {
if (device.name.compare("hf-candidate-creator-cascade") == 0) {
Expand Down Expand Up @@ -518,12 +523,13 @@ struct HfCandidateCreatorCascadeMc {

// Match generated particles.
for (const auto& particle : mcParticles) {
origin = 0;
std::vector<int> idxBhadMothers{};
// Reject particles from background events
if (particle.fromBackgroundEvent() && rejectBackground) {
rowMcMatchGen(sign, origin, -1);
continue;
}
origin = 0;
std::vector<int> idxBhadMothers{};

// Slice the collisions table to get the collision info for the current MC collision
auto mcCollision = particle.mcCollision();
Expand Down Expand Up @@ -577,6 +583,16 @@ struct HfCandidateCreatorCascadeMc {
}
}

void processMc(MyTracksWMc const& tracks,
aod::McParticles const& mcParticles,
McCollisionsFT0Cs const& collInfos,
aod::McCollisions const& mcCollisions,
BCsInfo const& BCsInfo)
{
runCreatorCascMc<CentralityEstimator::None>(tracks, mcParticles, collInfos, mcCollisions, BCsInfo);
}
PROCESS_SWITCH(HfCandidateCreatorCascadeMc, processMc, "Process MC - no centrality", true);

void processMcCentFT0C(MyTracksWMc const& tracks,
aod::McParticles const& mcParticles,
McCollisionsFT0Cs const& collInfos,
Expand Down
25 changes: 21 additions & 4 deletions PWGHF/TableProducer/candidateCreatorDstar.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,11 @@ struct HfCandidateCreatorDstarExpressions {
// inspect for which zPvPosMax cut was set for reconstructed
void init(InitContext& initContext)
{
std::array<bool, 3> procCollisions = {doprocessMc, doprocessMcCentFT0C, doprocessMcCentFT0M};
if (std::accumulate(procCollisions.begin(), procCollisions.end(), 0) > 1) {
LOGP(fatal, "At most one process function for collision study can be enabled at a time.");
}

const auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
for (const DeviceSpec& device : workflows.devices) {
if (device.name.compare("hf-candidate-creator-dstar") == 0) {
Expand Down Expand Up @@ -605,15 +610,17 @@ struct HfCandidateCreatorDstarExpressions {

// Match generated particles.
for (const auto& particle : mcParticles) {
// Reject particles from background events
if (particle.fromBackgroundEvent() && rejectBackground) {
continue;
}
flagDstar = 0;
flagD0 = 0;
originDstar = 0;
originD0 = 0;
std::vector<int> idxBhadMothers{};
// Reject particles from background events
if (particle.fromBackgroundEvent() && rejectBackground) {
rowsMcMatchGenDstar(flagDstar, originDstar, -1);
rowsMcMatchGenD0(flagD0, originD0, -1);
continue;
}

// Slice the collisions table to get the collision info for the current MC collision
auto mcCollision = particle.mcCollision();
Expand Down Expand Up @@ -660,6 +667,16 @@ struct HfCandidateCreatorDstarExpressions {
}
}

void processMc(aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
McCollisionsFT0Cs const& collInfos,
aod::McCollisions const& mcCollisions,
BCsInfo const& BCsInfo)
{
runCreatorDstarMc<CentralityEstimator::None>(tracks, mcParticles, collInfos, mcCollisions, BCsInfo);
}
PROCESS_SWITCH(HfCandidateCreatorDstarExpressions, processMc, "Process MC - no centrality", true);

void processMcCentFT0C(aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
McCollisionsFT0Cs const& collInfos,
Expand Down
82 changes: 78 additions & 4 deletions PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,23 @@ struct HfCandidateCreatorXic0Omegac0Mc {
// inspect for which zPvPosMax cut was set for reconstructed
void init(InitContext& initContext)
{
std::array<bool, 3> procCollisionsXicToXiPi{doprocessMcXicToXiPi, doprocessMcXicToXiPiFT0m, doprocessMcXicToXiPiFT0c};
if (std::accumulate(procCollisionsXicToXiPi.begin(), procCollisionsXicToXiPi.end(), 0) > 1) {
LOGP(fatal, "At most one process function for XicToXiPi collision study can be enabled at a time.");
}
std::array<bool, 3> procCollisionsOmegacToXiPi{doprocessMcOmegacToXiPi, doprocessMcOmegacToXiPiFT0m, doprocessMcOmegacToXiPiFT0c};
if (std::accumulate(procCollisionsOmegacToXiPi.begin(), procCollisionsOmegacToXiPi.end(), 0) > 1) {
LOGP(fatal, "At most one process function for OmegacToXiPi collision study can be enabled at a time.");
}
std::array<bool, 3> procCollisionsOmegacToOmegaPi{doprocessMcOmegacToOmegaPi, doprocessMcOmegacToOmegaPiFT0m, doprocessMcOmegacToOmegaPiFT0c};
if (std::accumulate(procCollisionsOmegacToOmegaPi.begin(), procCollisionsOmegacToOmegaPi.end(), 0) > 1) {
LOGP(fatal, "At most one process function for OmegacToOmegaPi collision study can be enabled at a time.");
}
std::array<bool, 3> procCollisionsOmegacToOmegaK{doprocessMcOmegacToOmegaK, doprocessMcOmegacToOmegaKFT0m, doprocessMcOmegacToOmegaKFT0c};
if (std::accumulate(procCollisionsOmegacToOmegaK.begin(), procCollisionsOmegacToOmegaK.end(), 0) > 1) {
LOGP(fatal, "At most one process function for OmegacToOmegaK collision study can be enabled at a time.");
}

const auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
for (const DeviceSpec& device : workflows.devices) {
if (device.name.compare("hf-candidate-creator-xic0-omegac0") == 0) {
Expand Down Expand Up @@ -914,10 +931,6 @@ struct HfCandidateCreatorXic0Omegac0Mc {

// Match generated particles.
for (const auto& particle : mcParticles) {
// Reject particles from background events
if (particle.fromBackgroundEvent() && rejectBackground) {
continue;
}
ptCharmBaryonGen = -999.;
rapidityCharmBaryonGen = -999.;
flag = 0;
Expand All @@ -928,6 +941,19 @@ struct HfCandidateCreatorXic0Omegac0Mc {
origin = RecoDecay::OriginType::None;
std::vector<int> idxBhadMothers{};

// Reject particles from background events
if (particle.fromBackgroundEvent() && rejectBackground) {
if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi) {
rowMCMatchGenXicToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, -1);
} else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToXiPi) {
rowMCMatchGenOmegacToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, -1);
} else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi) {
rowMCMatchGenToOmegaPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, -1);
} else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaK) {
rowMCMatchGenToOmegaK(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, -1);
}
continue;
}
// Slice the collisions table to get the collision info for the current MC collision
auto mcCollision = particle.mcCollision();
float centrality{-1.f};
Expand Down Expand Up @@ -1107,6 +1133,18 @@ struct HfCandidateCreatorXic0Omegac0Mc {
}
PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0Mc, processDoNoMc, "Do not run any MC process function", true);

void processMcXicToXiPi(aod::HfCandToXiPi const& candidates,
aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
aod::McCollisions const& mcColls,
aod::McCollisionLabels const& mcLabels,
McCollisionsFT0Ms const& collInfos,
BCsInfo const& bcs)
{
runXic0Omegac0Mc<CentralityEstimator::None, aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi>(candidates, tracks, mcParticles, collInfos, mcColls, mcLabels, bcs);
}
PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0Mc, processMcXicToXiPi, "Run Xic0 to xi pi MC process function - no centrality", true);

void processMcXicToXiPiFT0m(aod::HfCandToXiPi const& candidates,
aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
Expand All @@ -1131,6 +1169,18 @@ struct HfCandidateCreatorXic0Omegac0Mc {
}
PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0Mc, processMcXicToXiPiFT0c, "Run Xic0 to xi pi MC process function - FT0C", false);

void processMcOmegacToXiPi(aod::HfCandToXiPi const& candidates,
aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
aod::McCollisions const& mcColls,
aod::McCollisionLabels const& mcLabels,
McCollisionsFT0Ms const& collInfos,
BCsInfo const& bcs)
{
runXic0Omegac0Mc<CentralityEstimator::None, aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToXiPi>(candidates, tracks, mcParticles, collInfos, mcColls, mcLabels, bcs);
}
PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0Mc, processMcOmegacToXiPi, "Run Omegac0 to xi pi MC process function - FT0M", true);

void processMcOmegacToXiPiFT0m(aod::HfCandToXiPi const& candidates,
aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
Expand All @@ -1155,6 +1205,18 @@ struct HfCandidateCreatorXic0Omegac0Mc {
}
PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0Mc, processMcOmegacToXiPiFT0c, "Run Omegac0 to xi pi MC process function - FT0C", false);

void processMcOmegacToOmegaPi(aod::HfCandToOmegaPi const& candidates,
aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
aod::McCollisions const& mcColls,
aod::McCollisionLabels const& mcLabels,
McCollisionsFT0Ms const& collInfos,
BCsInfo const& bcs)
{
runXic0Omegac0Mc<CentralityEstimator::None, aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi>(candidates, tracks, mcParticles, collInfos, mcColls, mcLabels, bcs);
}
PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0Mc, processMcOmegacToOmegaPi, "Run Omegac0 to omega pi MC process function - no centrality", true);

void processMcOmegacToOmegaPiFT0m(aod::HfCandToOmegaPi const& candidates,
aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
Expand All @@ -1179,6 +1241,18 @@ struct HfCandidateCreatorXic0Omegac0Mc {
}
PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0Mc, processMcOmegacToOmegaPiFT0c, "Run Omegac0 to omega pi MC process function - FT0C", false);

void processMcOmegacToOmegaK(aod::HfCandToOmegaK const& candidates,
aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
aod::McCollisions const& mcColls,
aod::McCollisionLabels const& mcLabels,
McCollisionsFT0Ms const& collInfos,
BCsInfo const& bcs)
{
runXic0Omegac0Mc<CentralityEstimator::None, aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaK>(candidates, tracks, mcParticles, collInfos, mcColls, mcLabels, bcs);
}
PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0Mc, processMcOmegacToOmegaK, "Run Omegac0 to omega K MC process function - no centrality", true);

void processMcOmegacToOmegaKFT0m(aod::HfCandToOmegaK const& candidates,
aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
Expand Down
21 changes: 9 additions & 12 deletions PWGHF/Utils/utilsEvSelHf.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,11 @@ struct HfEventSelectionMc {
float zPv = mcCollision.posZ();
auto bc = mcCollision.template bc_as<TBc>();

float multiplicity{0.f};
for (const auto& collision : collSlice) {
float collCent{0.f};
float collMult{0.f};
if constexpr (centEstimator != o2::hf_centrality::CentralityEstimator::None) {
if constexpr (centEstimator != o2::hf_centrality::CentralityEstimator::None) {
float multiplicity{0.f};
for (const auto& collision : collSlice) {
float collCent{0.f};
float collMult{0.f};
if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0A) {
collCent = collision.centFT0A();
} else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0C) {
Expand All @@ -323,14 +323,11 @@ struct HfEventSelectionMc {
centrality = collCent;
multiplicity = collMult;
}
} else {
LOGP(fatal, "Unsupported centrality estimator!");
}
}

/// centrality selection
if (centrality < centralityMin || centrality > centralityMax) {
SETBIT(rejectionMask, EventRejection::Centrality);
/// centrality selection
if (centrality < centralityMin || centrality > centralityMax) {
SETBIT(rejectionMask, EventRejection::Centrality);
}
fgrosa marked this conversation as resolved.
Show resolved Hide resolved
}
/// Sel8 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))) {
Expand Down
Loading