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
47 changes: 23 additions & 24 deletions PWGHF/TableProducer/candidateCreator2Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,41 +20,40 @@
#define HomogeneousField // o2-linter: disable=name/macro (required by KFParticle)
#endif

#include <memory>
#include <string>
#include <vector>

#include <KFParticleBase.h>
#include <KFParticle.h>
#include <KFPTrack.h>
#include <KFPVertex.h>
#include <KFVertex.h>
#include "PWGHF/Core/CentralityEstimation.h"
#include "PWGHF/Core/DecayChannels.h"
#include "PWGHF/Core/SelectorCuts.h"
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/Utils/utilsBfieldCCDB.h"
#include "PWGHF/Utils/utilsEvSelHf.h"
#include "PWGHF/Utils/utilsMcGen.h"
#include "PWGHF/Utils/utilsMcMatching.h"
#include "PWGHF/Utils/utilsPid.h"
#include "PWGHF/Utils/utilsTrkCandHf.h"
#include "PWGLF/DataModel/mcCentrality.h"

#include <TPDGCode.h>
#include "Common/Core/trackUtilities.h"
#include "Tools/KFparticle/KFUtilities.h"

#include "CommonConstants/PhysicsConstants.h"
#include "DCAFitter/DCAFitterN.h"
#include "Framework/AnalysisTask.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/runDataProcessing.h"
#include "Framework/RunningWorkflowInfo.h"
#include "Framework/runDataProcessing.h"
#include "ReconstructionDataFormats/DCA.h"

#include "Common/Core/trackUtilities.h"
#include "Tools/KFparticle/KFUtilities.h"
#include <TPDGCode.h>

#include "PWGLF/DataModel/mcCentrality.h"
#include <KFPTrack.h>
#include <KFPVertex.h>
#include <KFParticle.h>
#include <KFParticleBase.h>
#include <KFVertex.h>

#include "PWGHF/Core/CentralityEstimation.h"
#include "PWGHF/Core/SelectorCuts.h"
#include "PWGHF/Core/DecayChannels.h"
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/Utils/utilsBfieldCCDB.h"
#include "PWGHF/Utils/utilsEvSelHf.h"
#include "PWGHF/Utils/utilsMcGen.h"
#include "PWGHF/Utils/utilsPid.h"
#include "PWGHF/Utils/utilsTrkCandHf.h"
#include "PWGHF/Utils/utilsMcMatching.h"
#include <memory>
#include <string>
#include <vector>

using namespace o2;
using namespace o2::analysis;
Expand Down Expand Up @@ -784,7 +783,7 @@
// D0(bar) → π+ K−, π+ K− π0, π+ π−, π+ π− π0, K+ K−
for (const auto& [chn, finalState] : hf_cand_2prong::daughtersD0Main) {
std::array<int, 2> finalStateParts2Prong = std::array{finalState[0], finalState[1]};
if (finalState.size() == 3) { // Partly Reco 2-prong decays

Check failure on line 786 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, FinalStateDepth, &nKinkedTracks, &nInteractionsWithMaterial);
} else if (matchKinkedDecayTopology && !matchInteractionsWithMaterial) {
Expand All @@ -803,7 +802,7 @@
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

Check failure on line 805 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, FinalStateDepth, &nKinkedTracks, &nInteractionsWithMaterial);
} else if (matchKinkedDecayTopology && !matchInteractionsWithMaterial) {
Expand Down
55 changes: 27 additions & 28 deletions PWGHF/TableProducer/candidateCreator3Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,40 @@
#define HomogeneousField // o2-linter: disable=name/macro (required by KFParticle)
#endif

#include <memory>
#include <string>
#include <utility>
#include <vector>

#include <KFParticleBase.h>
#include <KFParticle.h>
#include <KFPTrack.h>
#include <KFPVertex.h>
#include <KFVertex.h>
#include "PWGHF/Core/CentralityEstimation.h"
#include "PWGHF/Core/DecayChannels.h"
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/Utils/utilsBfieldCCDB.h"
#include "PWGHF/Utils/utilsEvSelHf.h"
#include "PWGHF/Utils/utilsMcGen.h"
#include "PWGHF/Utils/utilsMcMatching.h"
#include "PWGHF/Utils/utilsPid.h"
#include "PWGHF/Utils/utilsTrkCandHf.h"
#include "PWGLF/DataModel/mcCentrality.h"

#include <TPDGCode.h>
#include "Common/Core/trackUtilities.h"
#include "Tools/KFparticle/KFUtilities.h"

#include "CommonConstants/PhysicsConstants.h"
#include "DCAFitter/DCAFitterN.h"
#include "Framework/AnalysisTask.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/runDataProcessing.h"
#include "Framework/RunningWorkflowInfo.h"
#include "Framework/runDataProcessing.h"
#include "ReconstructionDataFormats/DCA.h"

#include "Common/Core/trackUtilities.h"
#include "Tools/KFparticle/KFUtilities.h"
#include <TPDGCode.h>

#include "PWGLF/DataModel/mcCentrality.h"
#include <KFPTrack.h>
#include <KFPVertex.h>
#include <KFParticle.h>
#include <KFParticleBase.h>
#include <KFVertex.h>

#include "PWGHF/Core/CentralityEstimation.h"
#include "PWGHF/Core/DecayChannels.h"
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/Utils/utilsBfieldCCDB.h"
#include "PWGHF/Utils/utilsEvSelHf.h"
#include "PWGHF/Utils/utilsMcGen.h"
#include "PWGHF/Utils/utilsPid.h"
#include "PWGHF/Utils/utilsTrkCandHf.h"
#include "PWGHF/Utils/utilsMcMatching.h"
#include <memory>
#include <string>
#include <utility>
#include <vector>

using namespace o2;
using namespace o2::hf_evsel;
Expand Down Expand Up @@ -948,19 +947,19 @@
}

if (matchCorrBkgs) {
indexRec = -1; // Index of the matched reconstructed candidate
constexpr int MaxDepth = 2; // Depth for final state matching
constexpr int ResoMaxDepth = 1; // Depth for resonant decay matching
indexRec = -1; // Index of the matched reconstructed candidate
constexpr int MaxDepth = 2; // Depth for final state matching
constexpr int ResoMaxDepth = 1; // Depth for resonant decay matching

for (const auto& pdg : mothersCorrBkgsPdgs.value) {
int depth = MaxDepth;
if (pdg == Pdg::kDStar) {
depth = MaxDepth+1; // D0 resonant decays are active
depth = MaxDepth + 1; // D0 resonant decays are active
}
auto finalStates = getDecayChannelMain(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

Check failure on line 962 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);
} else if (matchKinkedDecayTopology && !matchInteractionsWithMaterial) {
Expand All @@ -973,13 +972,13 @@

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

Check failure on line 975 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]};
convertPi0ToAntiPi0(motherParticle.pdgCode(), finalStateParts3ProngAll);
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 981 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]};
convertPi0ToAntiPi0(motherParticle.pdgCode(), finalStateParts3ProngAll);
if (!RecoDecay::isMatchedMCGen(mcParticles, motherParticle, pdg, finalStateParts3ProngAll, true, &sign, depth)) {
Expand All @@ -987,7 +986,7 @@
}
}
}
} else if (finalState.size() == 3) { // Fully Reco 3-prong decays

Check failure on line 989 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, false, true, true>(mcParticles, arrayDaughters, pdg, finalStateParts3Prong, true, &sign, depth, &nKinkedTracks, &nInteractionsWithMaterial);
} else if (matchKinkedDecayTopology && !matchInteractionsWithMaterial) {
Expand Down
29 changes: 15 additions & 14 deletions PWGHF/Utils/utilsMcGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,22 @@
#ifndef PWGHF_UTILS_UTILSMCGEN_H_
#define PWGHF_UTILS_UTILSMCGEN_H_

#include <Rtypes.h>
#include <TPDGCode.h>
#include "PWGHF/Core/DecayChannels.h"
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/Utils/utilsMcMatching.h"

#include "Common/Core/RecoDecay.h"

#include <CommonConstants/PhysicsConstants.h>

#include <TPDGCode.h>

#include <Rtypes.h>

#include <array>
#include <cstdint>
#include <vector>

#include "Common/Core/RecoDecay.h"

#include "PWGHF/Core/DecayChannels.h"
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/Utils/utilsMcMatching.h"

namespace hf_mc_gen
{

Expand All @@ -54,16 +55,16 @@
continue;
}
if (matchCorrBkgs) {
constexpr int MaxDepth = 2; // Depth for final state matching
constexpr int ResoMaxDepth = 1; // Depth for resonant decay matching
constexpr int MaxDepth = 2; // Depth for final state matching
constexpr int ResoMaxDepth = 1; // Depth for resonant decay matching
bool matched = false;

for (const auto& [chn, finalState] : o2::hf_decay::hf_cand_2prong::daughtersD0Main) {
if (finalState.size() == 3) { // Partly Reco 3-prong decays

Check failure on line 63 in PWGHF/Utils/utilsMcGen.h

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, 3> finalStateParts = std::array{finalState[0], finalState[1], finalState[2]};
o2::hf_decay::convertPi0ToAntiPi0(particle.pdgCode(), finalStateParts);
matched = RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kD0, finalStateParts, true, &sign, MaxDepth);
} else if (finalState.size() == 2) { // Fully Reco 2-prong decays

Check failure on line 67 in PWGHF/Utils/utilsMcGen.h

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, 2> finalStateParts = std::array{finalState[0], finalState[1]};
matched = RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kD0, finalStateParts, true, &sign, MaxDepth);
} else {
Expand Down Expand Up @@ -152,25 +153,25 @@
continue; // Skip if the particle PDG code does not match the mother PDG code
}
auto finalStates = o2::hf_decay::hf_cand_3prong::getDecayChannelMain(motherPdgCode);
constexpr int MaxDepth = 2; // Depth for final state matching
constexpr int ResoMaxDepth = 1; // Depth for resonant decay matching
constexpr int MaxDepth = 2; // Depth for final state matching
constexpr int ResoMaxDepth = 1; // Depth for resonant decay matching

int maxDepth = MaxDepth;
bool matched = false;
if (motherPdgCode == Pdg::kDStar) {
maxDepth = MaxDepth+1; // D0 resonant decays are switched on
maxDepth = MaxDepth + 1; // 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 from 5-prong decays

Check failure on line 167 in PWGHF/Utils/utilsMcGen.h

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> finalStateParts = std::array{finalState[0], finalState[1], finalState[2], finalState[3], finalState[4]};
o2::hf_decay::convertPi0ToAntiPi0(particle.pdgCode(), finalStateParts);
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 from 4-prong decays

Check failure on line 172 in PWGHF/Utils/utilsMcGen.h

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> finalStateParts = std::array{finalState[0], finalState[1], finalState[2], finalState[3]};
o2::hf_decay::convertPi0ToAntiPi0(particle.pdgCode(), finalStateParts);
o2::hf_decay::convertPi0ToAntiPi0(particle.pdgCode(), finalStateParts);
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
Expand Down
15 changes: 7 additions & 8 deletions PWGHF/Utils/utilsMcMatching.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ namespace hf_cand_3prong

// D±
static const std::unordered_map<DecayChannelMain, const std::vector<int>> daughtersDplusMain{
{DecayChannelMain::DplusToPiKPi, {+kKMinus, +kKPlus, +kPiPlus}},
{DecayChannelMain::DplusToPiKK, {+kKMinus, +kPiPlus, +kPiPlus}},
{DecayChannelMain::DplusToPiKPiPi0, {+kKMinus, +kPiPlus, +kPiPlus, +kPi0}},
{DecayChannelMain::DplusToPiPiPi, {+kPiMinus, +kPiPlus, +kPiPlus}},
};
{DecayChannelMain::DplusToPiKPi, {+kKMinus, +kKPlus, +kPiPlus}},
{DecayChannelMain::DplusToPiKK, {+kKMinus, +kPiPlus, +kPiPlus}},
{DecayChannelMain::DplusToPiKPiPi0, {+kKMinus, +kPiPlus, +kPiPlus, +kPi0}},
{DecayChannelMain::DplusToPiPiPi, {+kPiMinus, +kPiPlus, +kPiPlus}},
};

static const std::unordered_map<DecayChannelResonant, const std::array<int, 2>> daughtersDplusResonant{
{DecayChannelResonant::DplusToPhiPi, {+o2::constants::physics::kPhi, +kPiPlus}},
Expand Down Expand Up @@ -120,8 +120,7 @@ static const std::unordered_map<DecayChannelMain, const std::vector<int>> daught
{DecayChannelMain::LcToPKPi, {+kProton, +kKMinus, +kPiPlus}},
{DecayChannelMain::LcToPKPiPi0, {+kProton, +kKMinus, +kPiPlus, +kPi0}},
{DecayChannelMain::LcToPPiPi, {+kProton, +kPiMinus, +kPiPlus}},
{DecayChannelMain::LcToPKK, {+kProton, +kKMinus, +kKPlus}}
};
{DecayChannelMain::LcToPKK, {+kProton, +kKMinus, +kKPlus}}};

static const std::unordered_map<DecayChannelResonant, const std::array<int, 2>> daughtersLcResonant{
{DecayChannelResonant::LcToPKstar0, {+o2::constants::physics::kK0Star892, +kProton}},
Expand Down Expand Up @@ -257,7 +256,7 @@ template <std::size_t N>
inline void convertPi0ToAntiPi0(const int partPdgCode, std::array<int, N>& arrPdgIndexes)
{
if (partPdgCode < 0) {
for (auto& part : arrPdgIndexes) { // o2-linter: disable=const-ref-in-for-loop (int elements)
for (auto& part : arrPdgIndexes) { // o2-linter: disable=const-ref-in-for-loop (int elements)
if (part == kPi0) {
part = -part; // The Pi0 pdg code does not change between particle and antiparticle
}
Expand Down
Loading