Skip to content

Commit 1c6ef78

Browse files
committed
Correct bitmap matching in D0 tree creator
1 parent 07b9cd8 commit 1c6ef78

File tree

3 files changed

+34
-69
lines changed

3 files changed

+34
-69
lines changed

PWGHF/TableProducer/candidateCreator3Prong.cxx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,20 +1217,16 @@ struct HfCandidateCreator3ProngExpressions {
12171217
uint16_t rejectionMask{0};
12181218
int nSplitColl = 0;
12191219
if constexpr (centEstimator == CentralityEstimator::FT0C) {
1220-
// LOG(info) << "FT0C centrality estimator";
12211220
const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex());
12221221
rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, centEstimator>(mcCollision, collSlice, centrality);
12231222
} else if constexpr (centEstimator == CentralityEstimator::FT0M) {
1224-
// LOG(info) << "FT0M centrality estimator";
12251223
const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex());
12261224
nSplitColl = collSlice.size();
12271225
rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, centEstimator>(mcCollision, collSlice, centrality);
12281226
} else if constexpr (centEstimator == CentralityEstimator::None) {
1229-
// LOG(info) << "No centrality estimator";
12301227
const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex());
12311228
rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, centEstimator>(mcCollision, collSlice, centrality);
12321229
}
1233-
// LOG(info) << "CIAO3";
12341230
hfEvSelMc.fillHistograms<centEstimator>(mcCollision, rejectionMask, nSplitColl);
12351231
if (rejectionMask != 0) {
12361232
// at least one event selection not satisfied --> reject all gen particles from this collision
@@ -1239,17 +1235,12 @@ struct HfCandidateCreator3ProngExpressions {
12391235
}
12401236
continue;
12411237
}
1242-
// LOG(info) << "CIAO4";
12431238
if (matchCorrBkgs) {
1244-
// LOG(info) << "Filling MC match gen for correlated bkgs";
12451239
hf_mc_gen::fillMcMatchGen3Prong<true>(mcParticles, mcParticlesPerMcColl, rowMcMatchGen, rejectBackground);
12461240
} else {
1247-
// LOG(info) << "Filling MC match gen";
12481241
hf_mc_gen::fillMcMatchGen3Prong(mcParticles, mcParticlesPerMcColl, rowMcMatchGen, rejectBackground);
12491242
}
12501243
}
1251-
// LOG(info) << "BYE GEN MATCHING";
1252-
12531244
}
12541245

12551246
void processMc(aod::TracksWMc const& tracks,

PWGHF/TableProducer/treeCreatorD0ToKPi.cxx

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -242,19 +242,18 @@ struct HfTreeCreatorD0ToKPi {
242242
using SelectedCandidatesMcKfMl = soa::Filtered<soa::Join<aod::HfCand2ProngWPid, aod::HfCand2ProngKF, aod::HfCand2ProngMcRec, aod::HfSelD0, aod::HfMlD0>>;
243243
using MatchedGenCandidatesMc = soa::Filtered<soa::Join<aod::McParticles, aod::HfCand2ProngMcGen>>;
244244

245-
Filter filterSelectCandidates = aod::hf_sel_candidate_d0::isSelD0 >= -1 || aod::hf_sel_candidate_d0::isSelD0bar >= -1;
246-
Filter filterMcGenMatching = (nabs(aod::hf_cand_2prong::flagMcMatchGen) == static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK))) || (fillCorrBkgs && (nabs(aod::hf_cand_2prong::flagMcMatchGen) != 0));
245+
Filter filterSelectCandidates = aod::hf_sel_candidate_d0::isSelD0 >= 1 || aod::hf_sel_candidate_d0::isSelD0bar >= 1;
246+
Filter filterMcGenMatching = (nabs(aod::hf_cand_2prong::flagMcMatchGen) == aod::hf_cand_2prong::DecayType::D0ToPiK) || (fillCorrBkgs && (nabs(aod::hf_cand_2prong::flagMcMatchGen) != 0));
247247

248-
// Partition<SelectedCandidatesMc> reconstructedCandSig = nabs(aod::hf_cand_2prong::flagMcMatchRec) == static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK));
249-
Partition<SelectedCandidatesMc> reconstructedCandSig = nabs(aod::hf_cand_2prong::flagMcMatchRec) != 0;
250-
Partition<SelectedCandidatesMc> reconstructedCandBkg = nabs(aod::hf_cand_2prong::flagMcMatchRec) != static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK));
251-
Partition<SelectedCandidatesMcKf> reconstructedCandSigKF = nabs(aod::hf_cand_2prong::flagMcMatchRec) == static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK));
252-
Partition<SelectedCandidatesMcKf> reconstructedCandBkgKF = nabs(aod::hf_cand_2prong::flagMcMatchRec) != static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK));
248+
Partition<SelectedCandidatesMc> reconstructedCandSig = nabs(aod::hf_cand_2prong::flagMcMatchRec) == aod::hf_cand_2prong::DecayType::D0ToPiK || (fillCorrBkgs && nabs(aod::hf_cand_2prong::flagMcMatchRec) != 0);
249+
Partition<SelectedCandidatesMc> reconstructedCandBkg = nabs(aod::hf_cand_2prong::flagMcMatchRec) != aod::hf_cand_2prong::DecayType::D0ToPiK;
250+
Partition<SelectedCandidatesMcKf> reconstructedCandSigKF = nabs(aod::hf_cand_2prong::flagMcMatchRec) == aod::hf_cand_2prong::DecayType::D0ToPiK || (fillCorrBkgs && nabs(aod::hf_cand_2prong::flagMcMatchRec) != 0);
251+
Partition<SelectedCandidatesMcKf> reconstructedCandBkgKF = nabs(aod::hf_cand_2prong::flagMcMatchRec) != aod::hf_cand_2prong::DecayType::D0ToPiK;
253252

254-
Partition<SelectedCandidatesMcMl> reconstructedCandSigMl = nabs(aod::hf_cand_2prong::flagMcMatchRec) == static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK));
255-
Partition<SelectedCandidatesMcMl> reconstructedCandBkgMl = nabs(aod::hf_cand_2prong::flagMcMatchRec) != static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK));
256-
Partition<SelectedCandidatesMcKfMl> reconstructedCandSigKFMl = nabs(aod::hf_cand_2prong::flagMcMatchRec) == static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK));
257-
Partition<SelectedCandidatesMcKfMl> reconstructedCandBkgKFMl = nabs(aod::hf_cand_2prong::flagMcMatchRec) != static_cast<int8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK));
253+
Partition<SelectedCandidatesMcMl> reconstructedCandSigMl = nabs(aod::hf_cand_2prong::flagMcMatchRec) == aod::hf_cand_2prong::DecayType::D0ToPiK || (fillCorrBkgs && nabs(aod::hf_cand_2prong::flagMcMatchRec) != 0) || (fillCorrBkgs && nabs(aod::hf_cand_2prong::flagMcMatchRec) != 0);
254+
Partition<SelectedCandidatesMcMl> reconstructedCandBkgMl = nabs(aod::hf_cand_2prong::flagMcMatchRec) != aod::hf_cand_2prong::DecayType::D0ToPiK;
255+
Partition<SelectedCandidatesMcKfMl> reconstructedCandSigKFMl = nabs(aod::hf_cand_2prong::flagMcMatchRec) == aod::hf_cand_2prong::DecayType::D0ToPiK || (fillCorrBkgs && nabs(aod::hf_cand_2prong::flagMcMatchRec) != 0);
256+
Partition<SelectedCandidatesMcKfMl> reconstructedCandBkgKFMl = nabs(aod::hf_cand_2prong::flagMcMatchRec) != aod::hf_cand_2prong::DecayType::D0ToPiK;
258257

259258
void init(InitContext const&)
260259
{
@@ -514,9 +513,9 @@ struct HfTreeCreatorD0ToKPi {
514513
LOG(info) << "Processing " << candidates.size() << " candidates";
515514
for (const auto& candidate : candidates) {
516515
if constexpr (onlyBkg) {
517-
// if (TESTBIT(std::abs(candidate.flagMcMatchRec()), aod::hf_cand_2prong::DecayType::D0ToPiK)) {
518-
// continue;
519-
// }
516+
if ( (std::abs(candidate.flagMcMatchRec() == aod::hf_cand_2prong::DecayType::D0ToPiK)) || (fillCorrBkgs && (candidate.flagMcMatchRec() != 0)) ) {
517+
continue;
518+
}
520519
if (downSampleBkgFactor < 1.) {
521520
float pseudoRndm = candidate.ptProng0() * 1000. - static_cast<int64_t>(candidate.ptProng0() * 1000);
522521
if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) {
@@ -525,9 +524,9 @@ struct HfTreeCreatorD0ToKPi {
525524
}
526525
}
527526
if constexpr (onlySig) {
528-
// if (!TESTBIT(std::abs(candidate.flagMcMatchRec()), aod::hf_cand_2prong::DecayType::D0ToPiK)) {
529-
// continue;
530-
// }
527+
if ( !(std::abs(candidate.flagMcMatchRec()) == aod::hf_cand_2prong::DecayType::D0ToPiK) || (fillCorrBkgs && (candidate.flagMcMatchRec() != 0)) ) {
528+
continue;
529+
}
531530
}
532531
double yD = hfHelper.yD0(candidate);
533532
double eD = hfHelper.eD0(candidate);
@@ -543,19 +542,17 @@ struct HfTreeCreatorD0ToKPi {
543542
massD0bar = hfHelper.invMassD0barToKPi(candidate);
544543
}
545544
if (candidate.isSelD0()) {
546-
LOG(info) << "Filling D0 candidate with mass: " << massD0 << ", pt: " << candidate.pt() << ", y: " << yD;
547545
fillTable<applyMl>(candidate, 0, massD0, topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.flagMcDecayChanRec(), candidate.originMcRec());
548546
}
549547
if (candidate.isSelD0bar()) {
550-
LOG(info) << "Filling D0 candidate with mass: " << massD0 << ", pt: " << candidate.pt() << ", y: " << yD;
551548
fillTable<applyMl>(candidate, 1, massD0bar, topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.flagMcDecayChanRec(), candidate.originMcRec());
552549
}
553550
}
554551

555552
// Filling particle properties
556553
rowCandidateFullParticles.reserve(mcParticles.size());
557554
for (const auto& particle : mcParticles) {
558-
// if (TESTBIT(std::abs(particle.flagMcMatchGen()), aod::hf_cand_2prong::DecayType::D0ToPiK)) {
555+
if ((nabs(aod::hf_cand_2prong::flagMcMatchGen) == aod::hf_cand_2prong::DecayType::D0ToPiK) || (fillCorrBkgs && (nabs(aod::hf_cand_2prong::flagMcMatchGen) != 0))) {
559556
rowCandidateFullParticles(
560557
particle.mcCollisionId(),
561558
particle.pt(),
@@ -566,7 +563,7 @@ struct HfTreeCreatorD0ToKPi {
566563
particle.flagMcDecayChanGen(),
567564
particle.originMcGen(),
568565
particle.globalIndex());
569-
// }
566+
}
570567
}
571568
}
572569

@@ -621,10 +618,6 @@ struct HfTreeCreatorD0ToKPi {
621618
aod::Tracks const& tracks,
622619
aod::BCs const& bcs)
623620
{
624-
LOG(info) << "Processing MC with DCAFitterN for all candidates";
625-
LOG(info) << "Number of candidates: " << candidates.size();
626-
LOG(info) << "Number of MC particles: " << mcParticles.size();
627-
LOG(info) << "Number of collisions: " << collisions.size();
628621
processMc<aod::hf_cand::VertexerType::DCAFitter, false, false, false>(collisions, mcCollisions, candidates, mcParticles, tracks, bcs);
629622
}
630623
PROCESS_SWITCH(HfTreeCreatorD0ToKPi, processMcWithDCAFitterAll, "Process MC with DCAFitterN", false);

PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ struct HfTreeCreatorDplusToPiKPi {
266266
using SelectedCandidatesMc = soa::Filtered<soa::Join<aod::HfCand3ProngWPidPiKa, aod::HfCand3ProngMcRec, aod::HfSelDplusToPiKPi>>;
267267
using MatchedGenCandidatesMc = soa::Filtered<soa::Join<aod::McParticles, aod::HfCand3ProngMcGen>>;
268268
using SelectedCandidatesMcWithMl = soa::Filtered<soa::Join<aod::HfCand3ProngWPidPiKa, aod::HfCand3ProngMcRec, aod::HfSelDplusToPiKPi, aod::HfMlDplusToPiKPi>>;
269-
// using MatchedGenCandidatesMcCorrBkgs = soa::Join<aod::McParticles, aod::HfCand3ProngMcGen>;
270-
// using SelectedCandidatesMcCorrBkgsWithMl = soa::Join<aod::HfCand3ProngWPidPiKaPr, aod::HfCand3ProngMcRec, aod::HfSelDplusToPiKPi, aod::HfMlDplusToPiKPi>;
271269
using TracksWPid = soa::Join<aod::Tracks, aod::TracksPidPi, aod::PidTpcTofFullPi, aod::TracksPidKa, aod::PidTpcTofFullKa>;
272270

273271
using CollisionsCent = soa::Join<aod::Collisions, aod::CentFT0Cs, aod::CentFT0Ms>;
@@ -278,7 +276,6 @@ struct HfTreeCreatorDplusToPiKPi {
278276
Partition<SelectedCandidatesMc> reconstructedCandSig = (nabs(aod::hf_cand_3prong::flagMcMatchRec) == static_cast<int8_t>(hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi)) || (fillCorrBkgs && (nabs(o2::aod::hf_cand_3prong::flagMcMatchRec) != 0));
279277
Partition<SelectedCandidatesMc> reconstructedCandBkg = nabs(aod::hf_cand_3prong::flagMcMatchRec) != static_cast<int8_t>(hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi);
280278
Partition<SelectedCandidatesMcWithMl> reconstructedCandSigMl = (nabs(aod::hf_cand_3prong::flagMcMatchRec) == static_cast<int8_t>(hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi)) || (fillCorrBkgs && (nabs(o2::aod::hf_cand_3prong::flagMcMatchRec) != 0));
281-
// Partition<SelectedCandidatesMcCorrBkgsWithMl> reconstructedCandCorrBkgsMl = nabs(aod::hf_cand_3prong::flagMcMatchRec) != 0; // static_cast<int8_t>(hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi);
282279

283280
void init(InitContext const&)
284281
{
@@ -548,10 +545,6 @@ struct HfTreeCreatorDplusToPiKPi {
548545
// Filling particle properties
549546
rowCandidateFullParticles.reserve(particles.size());
550547
for (const auto& particle : particles) {
551-
// LOG(info) << "Filling particle with pt: " << particle.pt() << ", eta: " << particle.eta() << ", phi: " << particle.phi();
552-
// LOG(info) << "Flag MC match gen: " << static_cast<int>(particle.flagMcMatchGen());
553-
// LOG(info) << "Flag MC decay chan gen: " << static_cast<int>(particle.flagMcDecayChanGen());
554-
// LOG(info) << "Origin MC gen: " << static_cast<int>(particle.originMcGen());
555548
rowCandidateFullParticles(
556549
particle.mcCollision().bcId(),
557550
particle.pt(),
@@ -599,39 +592,27 @@ struct HfTreeCreatorDplusToPiKPi {
599592
PROCESS_SWITCH(HfTreeCreatorDplusToPiKPi, processMcWCent, "Process MC with cent", false);
600593

601594
void processMcSgnWMl(aod::Collisions const& collisions,
602-
aod::McCollisions const& mccollisions,
603-
SelectedCandidatesMcWithMl const&,
604-
MatchedGenCandidatesMc const& particles,
605-
TracksWPid const& tracks)
606-
{
607-
fillMcTables<true>(collisions, mccollisions, reconstructedCandSigMl, particles, tracks);
608-
}
595+
aod::McCollisions const& mccollisions,
596+
SelectedCandidatesMcWithMl const&,
597+
MatchedGenCandidatesMc const& particles,
598+
TracksWPid const& tracks)
599+
{
600+
fillMcTables<true>(collisions, mccollisions, reconstructedCandSigMl, particles, tracks);
601+
}
609602

610-
PROCESS_SWITCH(HfTreeCreatorDplusToPiKPi, processMcSgnWMl, "Process MC signal with ML info", false);
603+
PROCESS_SWITCH(HfTreeCreatorDplusToPiKPi, processMcSgnWMl, "Process MC signal with ML info", false);
611604

612605
void processMcSgnWCentMl(CollisionsCent const& collisions,
613-
aod::McCollisions const& mccollisions,
614-
SelectedCandidatesMcWithMl const&,
615-
MatchedGenCandidatesMc const& particles,
616-
TracksWPid const& tracks)
617-
{
618-
fillMcTables<true>(collisions, mccollisions, reconstructedCandSigMl, particles, tracks);
619-
}
620-
621-
PROCESS_SWITCH(HfTreeCreatorDplusToPiKPi, processMcSgnWCentMl, "Process MC signal with cent and ML info", false);
622-
623-
void processMcCorrBkgsSgnWCentMl(aod::Collisions const& collisions,
624-
aod::McCollisions const& mccollisions,
625-
SelectedCandidatesMcWithMl const&, // SelectedCandidatesMcCorrBkgsWithMl const&, // SelectedCandidatesMcCorrBkgsWithMl const&,
626-
MatchedGenCandidatesMc const& particles, // MatchedGenCandidatesMcCorrBkgs const& particles,
627-
TracksWPid const& tracks)
628-
{
629-
LOG(info) << "processMcCorrBkgsSgnWCentMl with " << reconstructedCandSigMl.size() << " reco particles";
630-
LOG(info) << "processMcCorrBkgsSgnWCentMl with " << particles.size() << " generated particles";
631-
fillMcTables(collisions, mccollisions, reconstructedCandSigMl, particles, tracks);
606+
aod::McCollisions const& mccollisions,
607+
SelectedCandidatesMcWithMl const&,
608+
MatchedGenCandidatesMc const& particles,
609+
TracksWPid const& tracks)
610+
{
611+
fillMcTables<true>(collisions, mccollisions, reconstructedCandSigMl, particles, tracks);
632612
}
633613

634-
PROCESS_SWITCH(HfTreeCreatorDplusToPiKPi, processMcCorrBkgsSgnWCentMl, "Process MC correlated bkgs with cent and ML info", false);
614+
PROCESS_SWITCH(HfTreeCreatorDplusToPiKPi, processMcSgnWCentMl, "Process MC signal with cent and ML info", false);
615+
635616
};
636617

637618
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)