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
357 changes: 180 additions & 177 deletions PWGHF/Core/DecayChannels.h

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions PWGHF/TableProducer/candidateCreator2Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -780,22 +780,22 @@
int depth = 2;
for (const auto& [chn, finalState] : finalStates2Prongs) {
std::array<int, 2> finalStateParts2Prong = std::array{finalState[0], finalState[1]};
if (finalState.size() == 3) { // Partly Reco 2-prong decays
if (finalState.size() == 3) { // Partly Reco 2-prong decays

Check failure on line 783 in PWGHF/TableProducer/candidateCreator2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (matchKinkedDecayTopology && matchInteractionsWithMaterial) {
indexRec = RecoDecay::getMatchedMCRec<false, false, true, true, true>(mcParticles, arrayDaughters, Pdg::kD0, finalStateParts2Prong, true, &sign, depth, &nKinkedTracks, &nInteractionsWithMaterial);
indexRec = RecoDecay::getMatchedMCRec<false, false, true, true, true>(mcParticles, arrayDaughters, Pdg::kD0, finalStateParts2Prong, true, &sign, depth, &nKinkedTracks, &nInteractionsWithMaterial);
} else if (matchKinkedDecayTopology && !matchInteractionsWithMaterial) {
indexRec = RecoDecay::getMatchedMCRec<false, false, true, true, false>(mcParticles, arrayDaughters, Pdg::kD0, finalStateParts2Prong, true, &sign, depth, &nKinkedTracks);
} else if (!matchKinkedDecayTopology && matchInteractionsWithMaterial) {
indexRec = RecoDecay::getMatchedMCRec<false, false, true, false, true>(mcParticles, arrayDaughters, Pdg::kD0, finalStateParts2Prong, true, &sign, depth, nullptr, &nInteractionsWithMaterial);
} else {
indexRec = RecoDecay::getMatchedMCRec<false, false, true, false, false>(mcParticles, arrayDaughters, Pdg::kD0, finalStateParts2Prong, true, &sign, depth);
}

if (indexRec > -1) {
auto motherParticle = mcParticles.rawIteratorAt(indexRec);
std::array<int, 3> finalStateParts2ProngAll = std::array{finalState[0], finalState[1], finalState[2]};
if (motherParticle.pdgCode() < 0) {
for (auto& part : finalStateParts2ProngAll) {

Check failure on line 798 in PWGHF/TableProducer/candidateCreator2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (part == kPi0) {
part = -part; // The Pi0 pdg code does not change between particle and antiparticle
}
Expand All @@ -805,15 +805,15 @@
indexRec = -1; // Reset indexRec if the generated decay does not match the reconstructed one does not match the reconstructed one
}
}
} else if (finalState.size() == 2) { // Fully Reco 2-prong decays
} else if (finalState.size() == 2) { // Fully Reco 2-prong decays

Check failure on line 808 in PWGHF/TableProducer/candidateCreator2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (matchKinkedDecayTopology && matchInteractionsWithMaterial) {
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true, true>(mcParticles, arrayDaughters, Pdg::kD0, finalStateParts2Prong, true, &sign, depth, &nKinkedTracks, &nInteractionsWithMaterial);
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true, true>(mcParticles, arrayDaughters, Pdg::kD0, finalStateParts2Prong, true, &sign, depth, &nKinkedTracks, &nInteractionsWithMaterial);
} else if (matchKinkedDecayTopology && !matchInteractionsWithMaterial) {
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true, false>(mcParticles, arrayDaughters, Pdg::kD0, finalStateParts2Prong, true, &sign, depth, &nKinkedTracks);
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true, false>(mcParticles, arrayDaughters, Pdg::kD0, finalStateParts2Prong, true, &sign, depth, &nKinkedTracks);
} else if (!matchKinkedDecayTopology && matchInteractionsWithMaterial) {
indexRec = RecoDecay::getMatchedMCRec<false, false, false, false, true>(mcParticles, arrayDaughters, Pdg::kD0, finalStateParts2Prong, true, &sign, depth, nullptr, &nInteractionsWithMaterial);
indexRec = RecoDecay::getMatchedMCRec<false, false, false, false, true>(mcParticles, arrayDaughters, Pdg::kD0, finalStateParts2Prong, true, &sign, depth, nullptr, &nInteractionsWithMaterial);
} else {
indexRec = RecoDecay::getMatchedMCRec<false, false, false, false, false>(mcParticles, arrayDaughters, Pdg::kD0, finalStateParts2Prong, true, &sign, depth);
indexRec = RecoDecay::getMatchedMCRec<false, false, false, false, false>(mcParticles, arrayDaughters, Pdg::kD0, finalStateParts2Prong, true, &sign, depth);
}
} else {
LOG(info) << "Final state size not supported: " << finalStateParts2Prong.size();
Expand Down
12 changes: 6 additions & 6 deletions PWGHF/TableProducer/candidateCreator3Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -957,9 +957,9 @@
auto finalStates = getDecayChannel3Prong(pdg);
for (const auto& [chn, finalState] : finalStates) {
std::array<int, 3> finalStateParts3Prong = std::array{finalState[0], finalState[1], finalState[2]};
if (finalState.size() > 3) { // Partly Reco 4-prong decays
if (finalState.size() > 3) { // Partly Reco 4-prong decays

Check failure on line 960 in PWGHF/TableProducer/candidateCreator3Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (matchKinkedDecayTopology && matchInteractionsWithMaterial) {
indexRec = RecoDecay::getMatchedMCRec<false, false, true, true, true>(mcParticles, arrayDaughters, pdg, finalStateParts3Prong, true, &sign, depth, &nKinkedTracks, &nInteractionsWithMaterial);
indexRec = RecoDecay::getMatchedMCRec<false, false, true, true, true>(mcParticles, arrayDaughters, pdg, finalStateParts3Prong, true, &sign, depth, &nKinkedTracks, &nInteractionsWithMaterial);
} else if (matchKinkedDecayTopology && !matchInteractionsWithMaterial) {
indexRec = RecoDecay::getMatchedMCRec<false, false, true, true, false>(mcParticles, arrayDaughters, pdg, finalStateParts3Prong, true, &sign, depth, &nKinkedTracks);
} else if (!matchKinkedDecayTopology && matchInteractionsWithMaterial) {
Expand All @@ -970,10 +970,10 @@

if (indexRec > -1) {
auto motherParticle = mcParticles.rawIteratorAt(indexRec);
if (finalState.size() == 4) { // Check if the final state has 4 particles

Check failure on line 973 in PWGHF/TableProducer/candidateCreator3Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
std::array<int, 4> finalStateParts3ProngAll = std::array{finalState[0], finalState[1], finalState[2], finalState[3]};
if (sign < 0) {
for (auto& part : finalStateParts3ProngAll) {

Check failure on line 976 in PWGHF/TableProducer/candidateCreator3Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (part == kPi0) {
part = -part; // The Pi0 pdg code does not change between particle and antiparticle
}
Expand All @@ -982,10 +982,10 @@
if (!RecoDecay::isMatchedMCGen(mcParticles, motherParticle, pdg, finalStateParts3ProngAll, true, &sign, depth)) {
indexRec = -1; // Reset indexRec if the generated decay does not match the reconstructed one is not matched
}
} else if (finalState.size() == 5) { // Check if the final state has 5 particles

Check failure on line 985 in PWGHF/TableProducer/candidateCreator3Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
std::array<int, 5> finalStateParts3ProngAll = std::array{finalState[0], finalState[1], finalState[2], finalState[3], finalState[4]};
if (sign < 0) {
for (auto& part : finalStateParts3ProngAll) {

Check failure on line 988 in PWGHF/TableProducer/candidateCreator3Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (part == kPi0) {
part = -part; // The Pi0 pdg code does not change between particle and antiparticle
}
Expand All @@ -996,7 +996,7 @@
}
}
}
} else if (finalState.size() == 3) { // Fully Reco 3-prong decays
} else if (finalState.size() == 3) { // Fully Reco 3-prong decays
if (matchKinkedDecayTopology && matchInteractionsWithMaterial) {
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true, true>(mcParticles, arrayDaughters, pdg, finalStateParts3Prong, true, &sign, depth, &nKinkedTracks, &nInteractionsWithMaterial);
} else if (matchKinkedDecayTopology && !matchInteractionsWithMaterial) {
Expand All @@ -1015,8 +1015,8 @@

// Flag the resonant decay channel
int resoMaxDepth = 1;
if (std::abs(mcParticles.rawIteratorAt(indexRec).pdgCode()) == Pdg::kDStar) {
resoMaxDepth = 2; // Flag D0 resonances
if (std::abs(mcParticles.rawIteratorAt(indexRec).pdgCode()) == Pdg::kDStar) {
resoMaxDepth = 2; // Flag D0 resonances
}
std::vector<int> arrResoDaughIndex = {};
RecoDecay::getDaughters(mcParticles.rawIteratorAt(indexRec), &arrResoDaughIndex, std::array{0}, resoMaxDepth);
Expand Down Expand Up @@ -1176,7 +1176,7 @@
rowMcMatchRec(flag, origin, swapping, channel, -1.f, 0, nKinkedTracks, nInteractionsWithMaterial);
}
}

for (const auto& mcCollision : mcCollisions) {

// Slice the particles table to get the particles for the current MC collision
Expand Down
6 changes: 3 additions & 3 deletions PWGHF/TableProducer/treeCreatorD0ToKPi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ struct HfTreeCreatorD0ToKPi {
}
for (const auto& candidate : candidates) {
if constexpr (onlyBkg) {
if ( TESTBIT(std::abs(candidate.flagMcMatchRec()), aod::hf_cand_2prong::DecayType::D0ToPiK) || (fillCorrBkgs && (candidate.flagMcMatchRec() != 0)) ) {
if (TESTBIT(std::abs(candidate.flagMcMatchRec()), aod::hf_cand_2prong::DecayType::D0ToPiK) || (fillCorrBkgs && (candidate.flagMcMatchRec() != 0))) {
continue;
}
if (downSampleBkgFactor < 1.) {
Expand All @@ -523,7 +523,7 @@ struct HfTreeCreatorD0ToKPi {
}
}
if constexpr (onlySig) {
if ( !(TESTBIT(std::abs(candidate.flagMcMatchRec()), aod::hf_cand_2prong::DecayType::D0ToPiK)) || (fillCorrBkgs && (candidate.flagMcMatchRec() != 0)) ) {
if (!(TESTBIT(std::abs(candidate.flagMcMatchRec()), aod::hf_cand_2prong::DecayType::D0ToPiK)) || (fillCorrBkgs && (candidate.flagMcMatchRec() != 0))) {
continue;
}
}
Expand Down Expand Up @@ -551,7 +551,7 @@ struct HfTreeCreatorD0ToKPi {
// Filling particle properties
rowCandidateFullParticles.reserve(mcParticles.size());
for (const auto& particle : mcParticles) {
if ( TESTBIT(std::abs(particle.flagMcMatchGen()), aod::hf_cand_2prong::DecayType::D0ToPiK) || (fillCorrBkgs && particle.flagMcMatchGen() != 0) ) {
if (TESTBIT(std::abs(particle.flagMcMatchGen()), aod::hf_cand_2prong::DecayType::D0ToPiK) || (fillCorrBkgs && particle.flagMcMatchGen() != 0)) {
rowCandidateFullParticles(
particle.mcCollisionId(),
particle.pt(),
Expand Down
3 changes: 1 addition & 2 deletions PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ DECLARE_SOA_TABLE(HfCandDpFullPs, "AOD", "HFCANDDPFULLP",
/// Writes the full information in an output TTree
struct HfTreeCreatorDplusToPiKPi {
Produces<o2::aod::HfCandDpFulls> rowCandidateFull;
Produces<o2::aod::HfCandDpFullEvs> rowCandidateFullEvents;
Produces<o2::aod::HfCandDpFullEvs> rowCandidateFullEvents;
Produces<o2::aod::HfCandDpFullPs> rowCandidateFullParticles;
Produces<o2::aod::HfCandDpLites> rowCandidateLite;
Produces<o2::aod::HfCandDpMls> rowCandidateMl;
Expand Down Expand Up @@ -611,7 +611,6 @@ struct HfTreeCreatorDplusToPiKPi {
}

PROCESS_SWITCH(HfTreeCreatorDplusToPiKPi, processMcSgnWCentMl, "Process MC signal with cent and ML info", false);

};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
Expand Down
16 changes: 8 additions & 8 deletions PWGHF/Utils/utilsMcGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void fillMcMatchGen2Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
bool matched = false;

for (const auto& [chn, finalState] : finalStates2Prongs) {
if (finalState.size() == 3) { // Partly Reco 3-prong decays
if (finalState.size() == 3) { // Partly Reco 3-prong decays
std::array<int, 3> finalStateParts = std::array{finalState[0], finalState[1], finalState[2]};
if (particle.pdgCode() < 0) {
for (auto& part : finalStateParts) {
Expand All @@ -71,7 +71,7 @@ void fillMcMatchGen2Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
}
}
matched = RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kD0, finalStateParts, true, &sign, maxDepth);
} else if (finalState.size() == 2) { // Fully Reco 3-prong decays
} else if (finalState.size() == 2) { // Fully Reco 3-prong decays
std::array<int, 2> finalStateParts = std::array{finalState[0], finalState[1]};
matched = RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kD0, finalStateParts, true, &sign, maxDepth);
} else {
Expand Down Expand Up @@ -165,12 +165,12 @@ void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
int maxDepth = 2;
bool matched = false;
if (motherPdgCode == Pdg::kDStar) {
maxDepth = 3; // D0 resonant decays are switched on
maxDepth = 3; // D0 resonant decays are switched on
}

std::vector<int> arrAllDaughtersIndex;
for (const auto& [chn, finalState] : finalStates) {
if (finalState.size() == 5) { // Partly Reco 3-prong decays
if (finalState.size() == 5) { // Partly Reco 3-prong decays
std::array<int, 5> finalStateParts = std::array{finalState[0], finalState[1], finalState[2], finalState[3], finalState[4]};
if (particle.pdgCode() < 0) {
for (auto& part : finalStateParts) {
Expand All @@ -181,7 +181,7 @@ void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
}
RecoDecay::getDaughters<false>(particle, &arrAllDaughtersIndex, finalStateParts, maxDepth);
matched = RecoDecay::isMatchedMCGen(mcParticles, particle, motherPdgCode, finalStateParts, true, &sign, -1);
} else if (finalState.size() == 4) { // Partly Reco 3-prong decays
} else if (finalState.size() == 4) { // Partly Reco 3-prong decays
std::array<int, 4> finalStateParts = std::array{finalState[0], finalState[1], finalState[2], finalState[3]};
if (particle.pdgCode() < 0) {
for (auto& part : finalStateParts) {
Expand All @@ -192,7 +192,7 @@ void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
}
RecoDecay::getDaughters<false>(particle, &arrAllDaughtersIndex, finalStateParts, maxDepth);
matched = RecoDecay::isMatchedMCGen(mcParticles, particle, motherPdgCode, finalStateParts, true, &sign, -1);
} else if (finalState.size() == 3) { // Fully Reco 3-prong decays
} else if (finalState.size() == 3) { // Fully Reco 3-prong decays
std::array<int, 3> finalStateParts = std::array{finalState[0], finalState[1], finalState[2]};
RecoDecay::getDaughters<false>(particle, &arrAllDaughtersIndex, finalStateParts, maxDepth);
matched = RecoDecay::isMatchedMCGen(mcParticles, particle, motherPdgCode, finalStateParts, true, &sign, maxDepth);
Expand All @@ -205,7 +205,7 @@ void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V
// Flag the resonant decay channel
int resoMaxDepth = 1;
std::vector<int> arrResoDaughIndex = {};
if (std::abs(motherPdgCode) == Pdg::kDStar) {
if (std::abs(motherPdgCode) == Pdg::kDStar) {
std::vector<int> arrResoDaughIndexDStar = {};
RecoDecay::getDaughters(particle, &arrResoDaughIndexDStar, std::array{0}, resoMaxDepth);
for (size_t iDaug = 0; iDaug < arrResoDaughIndexDStar.size(); iDaug++) {
Expand Down
Loading