Skip to content

Commit bcc70d4

Browse files
committed
Add possibility to run more loops on MC particles in dataCreatorCharmHadPiReduced
1 parent ebc2471 commit bcc70d4

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ struct HfDataCreatorCharmHadPiReduced {
177177
Configurable<double> invMassWindowCharmHadPi{"invMassWindowCharmHadPi", 0.3, "invariant-mass window for CharmHad-Pi pair preselections (GeV/c2)"};
178178
// MC extra
179179
Configurable<bool> checkDecayTypeMc{"checkDecayTypeMc", false, "flag to enable MC checks on decay type"};
180+
Configurable<int> nMcLoops{"nMcLoops", 0, "number of extra loops over generated particles per MC collision"};
180181
} configs;
181182
// vertexing
182183
struct : o2::framework::ConfigurableGroup {
@@ -394,6 +395,9 @@ struct HfDataCreatorCharmHadPiReduced {
394395
hCandidatesLc = registry.add<TH1>("hCandidatesLc", "Lc candidate counter", {HistType::kTH1D, {axisCands}});
395396
hCandidatesD0FromDstar = registry.add<TH1>("hCandidatesD0FromDstar", "D0 from D* candidate counter", {HistType::kTH1D, {axisCands}});
396397
hCandidatesBHadron = registry.add<TH1>("hCandidatesBHadron", "B hadron candidate counter", {HistType::kTH1D, {axisCands}});
398+
if (configs.nMcLoops > 0) {
399+
registry.add("hNMatchedMcLoops", "matches found in extra MC loops;matches per MC collision;entries", {HistType::kTH1D, {{100, -0.5, 99.5}}});
400+
}
397401

398402
setLabelHistoCands(hCandidatesD0);
399403
setLabelHistoCands(hCandidatesDPlus);
@@ -1793,6 +1797,20 @@ struct HfDataCreatorCharmHadPiReduced {
17931797
ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M);
17941798
}
17951799
} // gen
1800+
1801+
// extra loops over generated particles (increases CPU time)
1802+
if (configs.nMcLoops > 0) {
1803+
int nMatched{0};
1804+
for (int iLoop = 0; iLoop < configs.nMcLoops; ++iLoop) {
1805+
for (const auto& particle : mcParticlesPerMcColl) {
1806+
nMatched += RecoDecay::isMatchedMCGen<true>(particlesMc, particle, Pdg::kB0, std::array{-static_cast<int>(Pdg::kDPlus), +kPiPlus}, true);
1807+
nMatched += RecoDecay::isMatchedMCGen<true>(particlesMc, particle, Pdg::kBPlus, std::array{-static_cast<int>(Pdg::kDPlus), +kPiPlus}, true);
1808+
nMatched += RecoDecay::isMatchedMCGen<true>(particlesMc, particle, Pdg::kBS, std::array{-static_cast<int>(Pdg::kDPlus), +kPiPlus}, true);
1809+
nMatched += RecoDecay::isMatchedMCGen<true>(particlesMc, particle, Pdg::kLambdaB0, std::array{-static_cast<int>(Pdg::kDPlus), +kPiPlus}, true);
1810+
}
1811+
}
1812+
registry.fill(HIST("hNMatchedMcLoops"), nMatched);
1813+
}
17961814
}
17971815

17981816
////////////////////////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)