Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 153 additions & 55 deletions PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,21 @@ struct HfTaskXic0ToXiPi {

void init(InitContext&)
{
std::array<bool, 16> doprocess{doprocessDataWithDCAFitter, doprocessDataWithDCAFitterMl, doprocessDataWithDCAFitterFT0C, doprocessDataWithDCAFitterFT0M, doprocessDataWithDCAFitterMlFT0C, doprocessDataWithDCAFitterMlFT0M,
std::array<bool, 18> doprocess{doprocessDataWithDCAFitter, doprocessDataWithDCAFitterMl, doprocessDataWithDCAFitterFT0C, doprocessDataWithDCAFitterFT0M, doprocessDataWithDCAFitterMlFT0C, doprocessDataWithDCAFitterMlFT0M,
doprocessDataWithKFParticle, doprocessDataWithKFParticleMl, doprocessDataWithKFParticleFT0C, doprocessDataWithKFParticleFT0M, doprocessDataWithKFParticleMlFT0C, doprocessDataWithKFParticleMlFT0M,
doprocessMcWithKFParticle, doprocessMcWithKFParticleMl, doprocessMcWithDCAFitter, doprocessMcWithDCAFitterMl};
doprocessMcWithKFParticle, doprocessMcWithKFParticleMl, doprocessMcWithDCAFitter, doprocessMcWithDCAFitterMl, doprocessMcWithKFParticleNoCent, doprocessMcWithKFParticleMlNoCent};
if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) {
LOGP(fatal, "One and only one process function should be enabled at a time.");
}

bool const isMlProcess = doprocessDataWithDCAFitterMl || doprocessDataWithDCAFitterMlFT0C || doprocessDataWithDCAFitterMlFT0M ||
doprocessDataWithKFParticleMl || doprocessDataWithKFParticleMlFT0C || doprocessDataWithKFParticleMlFT0M ||
doprocessMcWithDCAFitterMl || doprocessMcWithKFParticleMl || doprocessMcWithKFParticleMlNoCent;
if (applyMl.value != isMlProcess) {
LOGP(fatal, "applyMl must match the selected process function (Ml or non-Ml).");
}

bool const isMcNoCent = doprocessMcWithKFParticleNoCent || doprocessMcWithKFParticleMlNoCent;
const AxisSpec thnAxisMass{thnConfigAxisMass, "inv. mass (#Xi#pi) (GeV/#it{c}^{2})"};
const AxisSpec thnAxisPt{thnConfigAxisPt, "#it{p}_{T} (GeV/#it{c})"};
const AxisSpec thnAxisPtB{thnConfigAxisPtB, "#it{p}_{T}^{B} (GeV/#it{c})"};
Expand All @@ -127,8 +135,12 @@ struct HfTaskXic0ToXiPi {
const AxisSpec thnAxisNumPvContr{thnConfigAxisNumPvContr, "Number of PV contributors"};
const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality percentile"};

if (doprocessMcWithKFParticle || doprocessMcWithKFParticleMl || doprocessMcWithDCAFitter || doprocessMcWithDCAFitterMl) {
std::vector<AxisSpec> const axesAcc = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisCent, thnAxisNumPvContr};
if (doprocessMcWithKFParticle || doprocessMcWithKFParticleMl || doprocessMcWithDCAFitter || doprocessMcWithDCAFitterMl || isMcNoCent) {
std::vector<AxisSpec> axesAcc = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin};
if (!isMcNoCent) {
axesAcc.push_back(thnAxisCent);
}
axesAcc.push_back(thnAxisNumPvContr);
registry.add("hSparseAcc", "Thn for generated Xic0 from charm and beauty", HistType::kTHnSparseD, axesAcc);
registry.get<THnSparse>(HIST("hSparseAcc"))->Sumw2();

Expand All @@ -139,11 +151,13 @@ struct HfTaskXic0ToXiPi {
}

std::vector<AxisSpec> axes = {thnAxisMass, thnAxisPt, thnAxisY};
if (doprocessMcWithKFParticle || doprocessMcWithKFParticleMl || doprocessMcWithDCAFitter || doprocessMcWithDCAFitterMl) {
if (doprocessMcWithKFParticle || doprocessMcWithKFParticleMl || doprocessMcWithDCAFitter || doprocessMcWithDCAFitterMl || isMcNoCent) {
axes.push_back(thnAxisPtB);
axes.push_back(thnAxisOrigin);
axes.push_back(thnAxisMatchFlag);
axes.push_back(thnAxisCent);
if (!isMcNoCent) {
axes.push_back(thnAxisCent);
}
axes.push_back(thnAxisNumPvContr);
}
if (applyMl) {
Expand All @@ -157,7 +171,6 @@ struct HfTaskXic0ToXiPi {
}
if (fillCent) {
const AxisSpec thnAxisPromptScore{thnConfigAxisPromptScore, "BDT score prompt."};
const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality."};
const AxisSpec thnAxisPtPion{thnConfigAxisPtPion, "Pt of Pion from Xic0."};
std::vector<AxisSpec> const axesWithBdtCent = {thnAxisPromptScore, thnAxisMass, thnAxisPt, thnAxisY, thnAxisCent, thnAxisPtPion, thnConfigAxisNumPvContr};
std::vector<AxisSpec> const axesWithCent = {thnAxisMass, thnAxisPt, thnAxisY, thnAxisCent, thnAxisPtPion, thnConfigAxisNumPvContr};
Expand Down Expand Up @@ -244,7 +257,7 @@ struct HfTaskXic0ToXiPi {
}
}

template <bool UseKfParticle, bool ApplyMl, typename CandType, typename CollType, typename McCollisionWithCents>
template <bool UseKfParticle, bool ApplyMl, bool UseCentrality = true, typename CandType, typename CollType, typename McCollisionWithCents>
void processMc(const CandType& candidates,
Xic0Gen const& mcParticles,
TracksMc const&,
Expand All @@ -268,30 +281,56 @@ struct HfTaskXic0ToXiPi {

auto collision = candidate.template collision_as<CollType>();
auto numPvContributors = collision.numContrib();
float const mcCent = o2::hf_centrality::getCentralityColl(collision.template mcCollision_as<McCollisionWithCents>());
float mcCent = -1.f;
if constexpr (UseCentrality) {
mcCent = o2::hf_centrality::getCentralityColl(collision.template mcCollision_as<McCollisionWithCents>());
}

double const ptXic = RecoDecay::pt(candidate.pxCharmBaryon(), candidate.pyCharmBaryon());
if constexpr (ApplyMl) {
registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsXic0Type"),
candidate.mlProbToXiPi()[0],
candidate.invMassCharmBaryon(),
ptXic,
yCharmBaryon,
candidate.ptBhadMotherPart(),
candidate.originMcRec(),
candidate.flagMcMatchRec(),
mcCent,
numPvContributors);
if constexpr (UseCentrality) {
registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsXic0Type"),
candidate.mlProbToXiPi()[0],
candidate.invMassCharmBaryon(),
ptXic,
yCharmBaryon,
candidate.ptBhadMotherPart(),
candidate.originMcRec(),
candidate.flagMcMatchRec(),
mcCent,
numPvContributors);
} else {
registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsXic0Type"),
candidate.mlProbToXiPi()[0],
candidate.invMassCharmBaryon(),
ptXic,
yCharmBaryon,
candidate.ptBhadMotherPart(),
candidate.originMcRec(),
candidate.flagMcMatchRec(),
numPvContributors);
}
} else {
registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsXic0Type"),
candidate.invMassCharmBaryon(),
ptXic,
yCharmBaryon,
candidate.ptBhadMotherPart(),
candidate.originMcRec(),
candidate.flagMcMatchRec(),
mcCent,
numPvContributors);
if constexpr (UseCentrality) {
registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsXic0Type"),
candidate.invMassCharmBaryon(),
ptXic,
yCharmBaryon,
candidate.ptBhadMotherPart(),
candidate.originMcRec(),
candidate.flagMcMatchRec(),
mcCent,
numPvContributors);
} else {
registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsXic0Type"),
candidate.invMassCharmBaryon(),
ptXic,
yCharmBaryon,
candidate.ptBhadMotherPart(),
candidate.originMcRec(),
candidate.flagMcMatchRec(),
numPvContributors);
}
}
}

Expand All @@ -310,48 +349,87 @@ struct HfTaskXic0ToXiPi {
for (const auto& recCol : recoCollsPerMcColl) {
maxNumContrib = recCol.numContrib() > maxNumContrib ? recCol.numContrib() : maxNumContrib;
}
float const mcCent = o2::hf_centrality::getCentralityColl(mcCollision);

if (particle.originMcGen() == RecoDecay::OriginType::Prompt) {
registry.fill(HIST("hSparseAcc"),
ptGen,
-1.,
yGen,
RecoDecay::OriginType::Prompt,
mcCent,
maxNumContrib);
} else {
float const ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt();
registry.fill(HIST("hSparseAcc"),
ptGen,
ptGenB,
yGen,
RecoDecay::OriginType::NonPrompt,
mcCent,
maxNumContrib);
float mcCent = -1.f;
if constexpr (UseCentrality) {
mcCent = o2::hf_centrality::getCentralityColl(mcCollision);
}

registry.fill(HIST("hNumRecoCollPerMcColl"), recoCollsPerMcColl.size());

// fill sparse only for gen particles associated to a reconstructed collision
if (recoCollsPerMcColl.size() >= 1) {
if (particle.originMcGen() == RecoDecay::OriginType::Prompt) {
registry.fill(HIST("hSparseAccWithRecoColl"),
if (particle.originMcGen() == RecoDecay::OriginType::Prompt) {
if constexpr (UseCentrality) {
registry.fill(HIST("hSparseAcc"),
ptGen,
-1.,
yGen,
RecoDecay::OriginType::Prompt,
mcCent,
maxNumContrib);
} else {
float const ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt();
registry.fill(HIST("hSparseAccWithRecoColl"),
registry.fill(HIST("hSparseAcc"),
ptGen,
-1.,
yGen,
RecoDecay::OriginType::Prompt,
maxNumContrib);
}
} else {
float const ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt();
if constexpr (UseCentrality) {
registry.fill(HIST("hSparseAcc"),
ptGen,
ptGenB,
yGen,
RecoDecay::OriginType::NonPrompt,
mcCent,
maxNumContrib);
} else {
registry.fill(HIST("hSparseAcc"),
ptGen,
ptGenB,
yGen,
RecoDecay::OriginType::NonPrompt,
maxNumContrib);
}
}

registry.fill(HIST("hNumRecoCollPerMcColl"), recoCollsPerMcColl.size());

// fill sparse only for gen particles associated to a reconstructed collision
if (recoCollsPerMcColl.size() >= 1) {
if (particle.originMcGen() == RecoDecay::OriginType::Prompt) {
if constexpr (UseCentrality) {
registry.fill(HIST("hSparseAccWithRecoColl"),
ptGen,
-1.,
yGen,
RecoDecay::OriginType::Prompt,
mcCent,
maxNumContrib);
} else {
registry.fill(HIST("hSparseAccWithRecoColl"),
ptGen,
-1.,
yGen,
RecoDecay::OriginType::Prompt,
maxNumContrib);
}
} else {
float const ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt();
if constexpr (UseCentrality) {
registry.fill(HIST("hSparseAccWithRecoColl"),
ptGen,
ptGenB,
yGen,
RecoDecay::OriginType::NonPrompt,
mcCent,
maxNumContrib);
} else {
registry.fill(HIST("hSparseAccWithRecoColl"),
ptGen,
ptGenB,
yGen,
RecoDecay::OriginType::NonPrompt,
maxNumContrib);
}
}
}
}
Expand Down Expand Up @@ -552,6 +630,26 @@ struct HfTaskXic0ToXiPi {
processMc<true, true>(xic0CandidatesMlMcKf, mcParticles, tracks, collisions, mcCollisions);
}
PROCESS_SWITCH(HfTaskXic0ToXiPi, processMcWithKFParticleMl, "Process MC with KFParticle and ML selections", false);

void processMcWithKFParticleNoCent(Xic0CandsMcKF const& xic0CandidatesMcKf,
Xic0Gen const& mcParticles,
TracksMc const& tracks,
CollisionsWithMcLabels const& collisions,
aod::McCollisions const& mcCollisions)
{
processMc<true, false, false>(xic0CandidatesMcKf, mcParticles, tracks, collisions, mcCollisions);
}
PROCESS_SWITCH(HfTaskXic0ToXiPi, processMcWithKFParticleNoCent, "Process MC without centrality with KFParticle", false);

void processMcWithKFParticleMlNoCent(Xic0CandsMlMcKF const& xic0CandidatesMlMcKf,
Xic0Gen const& mcParticles,
TracksMc const& tracks,
CollisionsWithMcLabels const& collisions,
aod::McCollisions const& mcCollisions)
{
processMc<true, true, false>(xic0CandidatesMlMcKf, mcParticles, tracks, collisions, mcCollisions);
}
PROCESS_SWITCH(HfTaskXic0ToXiPi, processMcWithKFParticleMlNoCent, "Process MC without centrality with KFParticle and ML scores", false);
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
Expand Down
24 changes: 23 additions & 1 deletion PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2356,7 +2356,7 @@ struct HfCandidateCreatorXic0Omegac0Mc {
// inspect for which zPvPosMax cut was set for reconstructed
void init(InitContext& initContext)
{
std::array<bool, 5> procCollisionsXicToXiPi{doprocessMcXicToXiPi, doprocessMcXicToXiPiFT0m, doprocessMcXicToXiPiFT0c, doprocessMcXicToXiPiKf, doprocessMcXicToXiPiKfQa};
std::array<bool, 7> procCollisionsXicToXiPi{doprocessMcXicToXiPi, doprocessMcXicToXiPiFT0m, doprocessMcXicToXiPiFT0c, doprocessMcXicToXiPiKf, doprocessMcXicToXiPiKfQa, doprocessMcXicToXiPiKfFT0m, doprocessMcXicToXiPiKfFT0c};
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.");
}
Expand Down Expand Up @@ -3282,6 +3282,28 @@ struct HfCandidateCreatorXic0Omegac0Mc {
}
PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0Mc, processMcXicToXiPiKf, "Run Xic0 to xi pi MC process function - no centrality", false);

void processMcXicToXiPiKfFT0m(aod::HfCandToXiPiKf const& candidates,
MyTracksWMc const& tracks,
aod::McParticles const& mcParticles,
McCollisionsCentFT0Ms const& mcColls,
McCollisionsFT0Ms const& collsWithMcLabels,
BCsInfo const& bcs)
{
runXic0Omegac0Mc<CentralityEstimator::FT0M, aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi>(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs);
}
PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0Mc, processMcXicToXiPiKfFT0m, "Run Xic0 to xi pi KFParticle MC process function - FT0M", false);

void processMcXicToXiPiKfFT0c(aod::HfCandToXiPiKf const& candidates,
MyTracksWMc const& tracks,
aod::McParticles const& mcParticles,
soa::Join<aod::McCollisions, aod::MultsExtraMC> const& mcColls,
McCollisionsFT0Cs const& collsWithMcLabels,
BCsInfo const& bcs)
{
runXic0Omegac0Mc<CentralityEstimator::FT0C, aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi>(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs);
}
PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0Mc, processMcXicToXiPiKfFT0c, "Run Xic0 to xi pi KFParticle MC process function - FT0C", false);

void processMcXicToXiPiKfQa(aod::HfCandToXiPiKfQa const& candidates,
MyTracksWMc const& tracks,
aod::McParticles const& mcParticles,
Expand Down
1 change: 1 addition & 0 deletions PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ struct HfCandidateSelectorXic0ToXiPiKf {
hfMlToXiPi(outputMlXic0ToXiPiKf);
} else {
isSelectedMlXic0 = hfMlResponse.isSelectedMl(inputFeaturesXic0, ptCand, outputMlXic0ToXiPiKf);
resultSelections = isSelectedMlXic0;
registry.fill(HIST("hSelMlXic0"), isSelectedMlXic0);
hfMlToXiPi(outputMlXic0ToXiPiKf);
}
Expand Down
Loading