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: small fixes in charm baryon tasks #6483

Merged
merged 11 commits into from
Jun 13, 2024
10 changes: 5 additions & 5 deletions PWGHF/DataModel/CandidateReconstructionTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ DECLARE_SOA_COLUMN(DebugGenLambda, debugGenLambda, int8_t);
DECLARE_SOA_COLUMN(OriginRec, originRec, int8_t);
DECLARE_SOA_COLUMN(OriginGen, originGen, int8_t);
DECLARE_SOA_COLUMN(PtCharmBaryonGen, ptCharmBaryonGen, float);
DECLARE_SOA_COLUMN(EtaCharmBaryonGen, etaCharmBaryonGen, float);
DECLARE_SOA_COLUMN(RapidityCharmBaryonGen, rapidityCharmBaryonGen, float);

// mapping of decay types
enum DecayType { XiczeroToXiPi = 0,
Expand Down Expand Up @@ -1309,16 +1309,16 @@ DECLARE_SOA_TABLE(HfToOmegaKMCRec, "AOD", "HFTOOMEKMCREC", //!
// table with results of generator level MC matching
DECLARE_SOA_TABLE(HfXicToXiPiMCGen, "AOD", "HFXICXIPIMCGEN", //!
hf_cand_xic0_omegac0::FlagMcMatchGen, hf_cand_xic0_omegac0::DebugGenCharmBar, hf_cand_xic0_omegac0::DebugGenCasc, hf_cand_xic0_omegac0::DebugGenLambda,
hf_cand_xic0_omegac0::PtCharmBaryonGen, hf_cand_xic0_omegac0::EtaCharmBaryonGen, hf_cand_xic0_omegac0::OriginGen, hf_cand::IdxBhadMotherPart, o2::soa::Marker<1>);
hf_cand_xic0_omegac0::PtCharmBaryonGen, hf_cand_xic0_omegac0::RapidityCharmBaryonGen, hf_cand_xic0_omegac0::OriginGen, hf_cand::IdxBhadMotherPart, o2::soa::Marker<1>);
DECLARE_SOA_TABLE(HfOmegacToXiPiMCGen, "AOD", "HFOMECXIPIMCGEN", //!
hf_cand_xic0_omegac0::FlagMcMatchGen, hf_cand_xic0_omegac0::DebugGenCharmBar, hf_cand_xic0_omegac0::DebugGenCasc, hf_cand_xic0_omegac0::DebugGenLambda,
hf_cand_xic0_omegac0::PtCharmBaryonGen, hf_cand_xic0_omegac0::EtaCharmBaryonGen, hf_cand_xic0_omegac0::OriginGen, hf_cand::IdxBhadMotherPart, o2::soa::Marker<2>);
hf_cand_xic0_omegac0::PtCharmBaryonGen, hf_cand_xic0_omegac0::RapidityCharmBaryonGen, hf_cand_xic0_omegac0::OriginGen, hf_cand::IdxBhadMotherPart, o2::soa::Marker<2>);
DECLARE_SOA_TABLE(HfToOmegaPiMCGen, "AOD", "HFTOOMEPIMCGEN", //!
hf_cand_xic0_omegac0::FlagMcMatchGen, hf_cand_xic0_omegac0::DebugGenCharmBar, hf_cand_xic0_omegac0::DebugGenCasc, hf_cand_xic0_omegac0::DebugGenLambda,
hf_cand_xic0_omegac0::PtCharmBaryonGen, hf_cand_xic0_omegac0::EtaCharmBaryonGen, hf_cand_xic0_omegac0::OriginGen, hf_cand::IdxBhadMotherPart, o2::soa::Marker<3>);
hf_cand_xic0_omegac0::PtCharmBaryonGen, hf_cand_xic0_omegac0::RapidityCharmBaryonGen, hf_cand_xic0_omegac0::OriginGen, hf_cand::IdxBhadMotherPart, o2::soa::Marker<3>);
DECLARE_SOA_TABLE(HfToOmegaKMCGen, "AOD", "HFTOOMEKMCGEN", //!
hf_cand_xic0_omegac0::FlagMcMatchGen, hf_cand_xic0_omegac0::DebugGenCharmBar, hf_cand_xic0_omegac0::DebugGenCasc, hf_cand_xic0_omegac0::DebugGenLambda,
hf_cand_xic0_omegac0::PtCharmBaryonGen, hf_cand_xic0_omegac0::EtaCharmBaryonGen, hf_cand_xic0_omegac0::OriginGen, hf_cand::IdxBhadMotherPart, o2::soa::Marker<4>);
hf_cand_xic0_omegac0::PtCharmBaryonGen, hf_cand_xic0_omegac0::RapidityCharmBaryonGen, hf_cand_xic0_omegac0::OriginGen, hf_cand::IdxBhadMotherPart, o2::soa::Marker<4>);

// specific chic candidate properties
namespace hf_cand_chic
Expand Down
68 changes: 34 additions & 34 deletions PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ struct HfCandidateCreatorXic0Omegac0Mc {
BCsInfo const&)
{
float ptCharmBaryonGen = -999.;
float etaCharmBaryonGen = -999.;
float rapidityCharmBaryonGen = -999.;
int indexRec = -1;
int indexRecCharmBaryon = -1;
int8_t sign = -9;
Expand Down Expand Up @@ -758,9 +758,9 @@ struct HfCandidateCreatorXic0Omegac0Mc {
// Check whether the charm baryon is non-prompt (from a b quark).
if (flag != 0) {
auto particle = mcParticles.rawIteratorAt(indexRecCharmBaryon);
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, true, &idxBhadMothers);
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers);
}
if (origin == RecoDecay::OriginType::NonPrompt && idxBhadMothers.size() > 0) {
if (origin == RecoDecay::OriginType::NonPrompt) {
auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0]);
rowMCMatchRecXicToXiPi(flag, debug, origin, collisionMatched, bHadMother.pt(), bHadMother.pdgCode());
} else {
Expand Down Expand Up @@ -797,9 +797,9 @@ struct HfCandidateCreatorXic0Omegac0Mc {
// Check whether the charm baryon is non-prompt (from a b quark).
if (flag != 0) {
auto particle = mcParticles.rawIteratorAt(indexRecCharmBaryon);
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, true, &idxBhadMothers);
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers);
}
if (origin == RecoDecay::OriginType::NonPrompt && idxBhadMothers.size() > 0) {
if (origin == RecoDecay::OriginType::NonPrompt) {
auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0]);
rowMCMatchRecOmegacToXiPi(flag, debug, origin, collisionMatched, bHadMother.pt(), bHadMother.pdgCode());
} else {
Expand Down Expand Up @@ -836,9 +836,9 @@ struct HfCandidateCreatorXic0Omegac0Mc {
// Check whether the charm baryon is non-prompt (from a b quark).
if (flag != 0) {
auto particle = mcParticles.rawIteratorAt(indexRecCharmBaryon);
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, true, &idxBhadMothers);
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers);
}
if (origin == RecoDecay::OriginType::NonPrompt && idxBhadMothers.size() > 0) {
if (origin == RecoDecay::OriginType::NonPrompt) {
auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0]);
rowMCMatchRecToOmegaPi(flag, debug, origin, collisionMatched, bHadMother.pt(), bHadMother.pdgCode());
} else {
Expand Down Expand Up @@ -875,9 +875,9 @@ struct HfCandidateCreatorXic0Omegac0Mc {
// Check whether the charm baryon is non-prompt (from a b quark).
if (flag != 0) {
auto particle = mcParticles.rawIteratorAt(indexRecCharmBaryon);
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, true, &idxBhadMothers);
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers);
}
if (origin == RecoDecay::OriginType::NonPrompt && idxBhadMothers.size() > 0) {
if (origin == RecoDecay::OriginType::NonPrompt) {
auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0]);
rowMCMatchRecToOmegaK(flag, debug, origin, collisionMatched, bHadMother.pt(), bHadMother.pdgCode());
} else {
Expand All @@ -892,7 +892,7 @@ struct HfCandidateCreatorXic0Omegac0Mc {
// Match generated particles.
for (const auto& particle : mcParticles) {
ptCharmBaryonGen = -999.;
etaCharmBaryonGen = -999.;
rapidityCharmBaryonGen = -999.;
flag = 0;
sign = -9;
debugGenCharmBar = 0;
Expand All @@ -907,13 +907,13 @@ 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, -1);
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, etaCharmBaryonGen, origin, -1);
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, etaCharmBaryonGen, origin, -1);
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, etaCharmBaryonGen, origin, -1);
rowMCMatchGenToOmegaK(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, -1);
}
continue;
}
Expand All @@ -923,7 +923,7 @@ struct HfCandidateCreatorXic0Omegac0Mc {
if (RecoDecay::isMatchedMCGen<false, true>(mcParticles, particle, pdgCodeXic0, std::array{pdgCodeXiMinus, pdgCodePiPlus}, true, &sign)) {
debugGenCharmBar = 1;
ptCharmBaryonGen = particle.pt();
etaCharmBaryonGen = particle.eta();
rapidityCharmBaryonGen = particle.y();
for (const auto& daughterCharm : particle.daughters_as<aod::McParticles>()) {
if (std::abs(daughterCharm.pdgCode()) != pdgCodeXiMinus) {
continue;
Expand All @@ -946,20 +946,20 @@ struct HfCandidateCreatorXic0Omegac0Mc {
}
// Check whether the charm baryon is non-prompt (from a b quark)
if (flag != 0) {
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, true, &idxBhadMothers);
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers);
}
if (origin == RecoDecay::OriginType::NonPrompt && idxBhadMothers.size() > 0) {
rowMCMatchGenXicToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, etaCharmBaryonGen, origin, idxBhadMothers[0]);
if (origin == RecoDecay::OriginType::NonPrompt) {
rowMCMatchGenXicToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, idxBhadMothers[0]);
} else {
rowMCMatchGenXicToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, etaCharmBaryonGen, origin, -1);
rowMCMatchGenXicToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, -1);
}

} else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToXiPi) {
// Omegac → Xi pi
if (RecoDecay::isMatchedMCGen<false, true>(mcParticles, particle, pdgCodeOmegac0, std::array{pdgCodeXiMinus, pdgCodePiPlus}, true, &sign)) {
debugGenCharmBar = 1;
ptCharmBaryonGen = particle.pt();
etaCharmBaryonGen = particle.eta();
rapidityCharmBaryonGen = particle.y();
for (const auto& daughterCharm : particle.daughters_as<aod::McParticles>()) {
if (std::abs(daughterCharm.pdgCode()) != pdgCodeXiMinus) {
continue;
Expand All @@ -982,20 +982,20 @@ struct HfCandidateCreatorXic0Omegac0Mc {
}
// Check whether the charm baryon is non-prompt (from a b quark)
if (flag != 0) {
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, true, &idxBhadMothers);
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers);
}
if (origin == RecoDecay::OriginType::NonPrompt && idxBhadMothers.size() > 0) {
rowMCMatchGenOmegacToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, etaCharmBaryonGen, origin, idxBhadMothers[0]);
if (origin == RecoDecay::OriginType::NonPrompt) {
rowMCMatchGenOmegacToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, idxBhadMothers[0]);
} else {
rowMCMatchGenOmegacToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, etaCharmBaryonGen, origin, -1);
rowMCMatchGenOmegacToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, -1);
}

} else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi) {
// Omegac → Omega pi
if (RecoDecay::isMatchedMCGen<false, true>(mcParticles, particle, pdgCodeOmegac0, std::array{pdgCodeOmegaMinus, pdgCodePiPlus}, true, &sign)) {
debugGenCharmBar = 1;
ptCharmBaryonGen = particle.pt();
etaCharmBaryonGen = particle.eta();
rapidityCharmBaryonGen = particle.y();
for (const auto& daughterCharm : particle.daughters_as<aod::McParticles>()) {
if (std::abs(daughterCharm.pdgCode()) != pdgCodeOmegaMinus) {
continue;
Expand All @@ -1018,20 +1018,20 @@ struct HfCandidateCreatorXic0Omegac0Mc {
}
// Check whether the charm baryon is non-prompt (from a b quark)
if (flag != 0) {
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, true, &idxBhadMothers);
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers);
}
if (origin == RecoDecay::OriginType::NonPrompt && idxBhadMothers.size() > 0) {
rowMCMatchGenToOmegaPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, etaCharmBaryonGen, origin, idxBhadMothers[0]);
if (origin == RecoDecay::OriginType::NonPrompt) {
rowMCMatchGenToOmegaPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, idxBhadMothers[0]);
} else {
rowMCMatchGenToOmegaPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, etaCharmBaryonGen, origin, -1);
rowMCMatchGenToOmegaPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, -1);
}

} else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaK) {
// Omegac → Omega K
if (RecoDecay::isMatchedMCGen<false, true>(mcParticles, particle, pdgCodeOmegac0, std::array{pdgCodeOmegaMinus, pdgCodeKaonPlus}, true, &sign)) {
debugGenCharmBar = 1;
ptCharmBaryonGen = particle.pt();
etaCharmBaryonGen = particle.eta();
rapidityCharmBaryonGen = particle.y();
for (const auto& daughterCharm : particle.daughters_as<aod::McParticles>()) {
if (std::abs(daughterCharm.pdgCode()) != pdgCodeOmegaMinus) {
continue;
Expand All @@ -1054,12 +1054,12 @@ struct HfCandidateCreatorXic0Omegac0Mc {
}
// Check whether the charm baryon is non-prompt (from a b quark)
if (flag != 0) {
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, true, &idxBhadMothers);
origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers);
}
if (origin == RecoDecay::OriginType::NonPrompt && idxBhadMothers.size() > 0) {
rowMCMatchGenToOmegaK(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, etaCharmBaryonGen, origin, idxBhadMothers[0]);
if (origin == RecoDecay::OriginType::NonPrompt) {
rowMCMatchGenToOmegaK(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, idxBhadMothers[0]);
} else {
rowMCMatchGenToOmegaK(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, etaCharmBaryonGen, origin, -1);
rowMCMatchGenToOmegaK(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, -1);
}
}
} // close loop on MCParticles
Expand Down
25 changes: 16 additions & 9 deletions PWGHF/Tasks/taskMcEfficiencyToXiPi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@
#include "Common/Core/RecoDecay.h"
#include "Common/DataModel/TrackSelectionTables.h"

#include "PWGHF/Core/CentralityEstimation.h"
#include "PWGHF/Core/SelectorCuts.h"
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/DataModel/CandidateSelectionTables.h"
#include "PWGHF/Utils/utilsEvSelHf.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The additional includes could be removed now


using namespace o2;
using namespace o2::analysis;
Expand All @@ -34,6 +37,9 @@ using namespace o2::framework;
using namespace o2::framework::expressions;

struct HfTaskMcEfficiencyToXiPi {

o2::hf_evsel::HfEventSelectionMc hfEvSelMc; // mc event selection and monitoring
fcatalan92 marked this conversation as resolved.
Show resolved Hide resolved

Configurable<float> rapidityCharmBaryonMax{"rapidityCharmBaryonMax", 0.5, "Max absolute value of rapidity for charm baryon"};
Configurable<float> acceptanceEtaLf{"acceptanceEtaLf", 1.0, "Max absolute value of eta for LF daughters"};
Configurable<float> acceptancePtPionFromCascade{"acceptancePtPionFromCascade", 0.2, "Min value of pt for pion <-- cascade"};
Expand All @@ -43,8 +49,6 @@ struct HfTaskMcEfficiencyToXiPi {
Configurable<int> nClustersTpcMin{"nClustersTpcMin", 70, "Minimum number of TPC clusters requirement for pion <-- charm baryon"};
Configurable<int> nClustersItsMin{"nClustersItsMin", 3, "Minimum number of ITS clusters requirement for pion <- charm baryon"};

Configurable<bool> rejGenTFAndITSROFBorders{"rejGenTFAndITSROFBorders", true, "Reject generated particles coming from bc close to TF and ITSROF borders"};

ConfigurableAxis axisPt{"axisPt", {200, 0, 20}, "pT axis"};
ConfigurableAxis axisMass{"axisMass", {900, 2.1, 3}, "m_inv axis"};

Expand Down Expand Up @@ -83,6 +87,8 @@ struct HfTaskMcEfficiencyToXiPi {
LOGF(fatal, "Both processOmegac0 and processXic0 enabled, please choose ONLY one!");
}

hfEvSelMc.addHistograms(registry); // particles monitoring
fcatalan92 marked this conversation as resolved.
Show resolved Hide resolved

auto hCandidates = registry.add<StepTHn>("hCandidates", "Candidate count at different steps", {HistType::kStepTHnF, {axisPt, axisMass, {2, -0.5, 1.5, "collision matched"}, {RecoDecay::OriginType::NonPrompt + 1, +RecoDecay::OriginType::None - 0.5, +RecoDecay::OriginType::NonPrompt + 0.5}}, kHFNSteps});
hCandidates->GetAxis(0)->SetTitle("#it{p}_{T} (GeV/#it{c})");
hCandidates->GetAxis(1)->SetTitle("#it{m}_{inv} (GeV/#it{c}^{2})");
Expand Down Expand Up @@ -212,13 +218,14 @@ struct HfTaskMcEfficiencyToXiPi {

for (const auto& mcParticle : genParticles) {

// accept only mc particles coming from bc that are far away from TF border and ITSROFrame
if (rejGenTFAndITSROFBorders) {
auto coll = mcParticle.template mcCollision_as<aod::McCollisions>();
auto bc = coll.template bc_as<BCsInfo>();
if (!bc.selection_bit(o2::aod::evsel::kNoITSROFrameBorder) || !bc.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) {
continue;
}
// auto coll = mcParticle.template mcCollision_as<aod::McCollisions>();
// auto bc = coll.template bc_as<BCsInfo>();
auto mcColl = mcParticle.mcCollision();
const auto rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo>(mcColl);
hfEvSelMc.fillHistograms(rejectionMask);
if (rejectionMask != 0) {
/// at least one event selection not satisfied --> reject the gen particle
continue;
}

// check if I am treating the desired charm baryon
Expand Down
Loading