Skip to content

Commit f51b6e3

Browse files
authored
[PWGHF] Add D0 into correlatorFlowCharmHadrons (#12866)
1 parent 644fb83 commit f51b6e3

File tree

2 files changed

+70
-5
lines changed

2 files changed

+70
-5
lines changed

PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,17 @@ DECLARE_SOA_TABLE(DsCandSelInfos, "AOD", "DSCANDSELINFO", //! Table with Ds cand
8181
aod::hf_candidate_reduced::BdtScorePrompt,
8282
aod::hf_candidate_reduced::BdtScoreBkg);
8383

84-
DECLARE_SOA_TABLE(HfcRedCharmHads, "AOD", "HFCREDCHARMHAD", //! Table with charm hadron candidate info
84+
DECLARE_SOA_TABLE(HfcRedCharmHads2P, "AOD", "HFCREDCHARM2P", //! Table with 2-prong charm hadron candidate info
85+
soa::Index<>,
86+
aod::hf_candidate_reduced::HfcRedFlowCollId,
87+
aod::hf_candidate_reduced::PhiCand,
88+
aod::hf_candidate_reduced::EtaCand,
89+
aod::hf_candidate_reduced::PtCand,
90+
aod::hf_candidate_reduced::InvMassCharmHad,
91+
aod::hf_candidate_reduced::Prong0Id,
92+
aod::hf_candidate_reduced::Prong1Id);
93+
94+
DECLARE_SOA_TABLE(HfcRedCharmHads3P, "AOD", "HFCREDCHARM3P", //! Table with 3-prong charm hadron candidate info
8595
soa::Index<>,
8696
aod::hf_candidate_reduced::HfcRedFlowCollId,
8797
aod::hf_candidate_reduced::PhiCand,

PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
/// \brief CharmHadrons-Hadrons correlator tree creator for data and MC-reco analyses
1414
/// \author Marcello Di Costanzo <marcello.di.costanzo@cern.ch>, Politecnico and INFN Torino
1515
/// \author Stefano Politanò <stefano.politano@cern.ch>, CERN
16+
/// \author Wu Chuntai <chuntai.wu@cern.ch>, CCNU, INFN Padova, and Padova University
1617

1718
#include "PWGHF/Core/HfHelper.h"
1819
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
@@ -53,13 +54,16 @@ using namespace o2::hf_evsel;
5354
enum DecayChannel {
5455
DplusToPiKPi = 0,
5556
DsToKKPi,
56-
DsToPiKK
57+
DsToPiKK,
58+
D0ToPiK,
59+
D0ToKPi
5760
};
5861

5962
/// Code to select collisions with at least one Ds meson
6063
struct HfCorrelatorFlowCharmHadrons {
6164
Produces<aod::HfcRedFlowColls> rowCollisions;
62-
Produces<aod::HfcRedCharmHads> rowCharmCandidates;
65+
Produces<aod::HfcRedCharmHads2P> rowCharmCandidates2P;
66+
Produces<aod::HfcRedCharmHads3P> rowCharmCandidates3P;
6367
Produces<aod::HfcRedCharmMls> rowCharmCandidatesMl;
6468
Produces<aod::HfcRedTrkAssoc> rowAssocTrackReduced;
6569
Produces<aod::HfcRedTrkSels> rowAssocTrackSelInfo;
@@ -88,18 +92,23 @@ struct HfCorrelatorFlowCharmHadrons {
8892
using CollsWithCentMult = soa::Join<aod::Collisions, aod::EvSels, aod::FT0Mults, aod::FV0Mults, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentFV0As>;
8993
using CandDsDataWMl = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDsToKKPi, aod::HfMlDsToKKPi>>;
9094
using CandDplusDataWMl = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDplusToPiKPi, aod::HfMlDplusToPiKPi>>;
95+
using CandD0DataWMl = soa::Filtered<soa::Join<aod::HfCand2Prong, aod::HfSelD0, aod::HfMlD0>>;
9196
using TracksData = soa::Filtered<soa::Join<aod::TracksWDca, aod::TrackSelection, aod::TracksExtra>>;
9297

9398
Filter filterSelectDsCandidates = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag || aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag;
9499
Filter filterSelectDplusCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlag;
100+
Filter filterSelectD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag;
95101
Filter filterSelectTrackData = (nabs(aod::track::eta) < etaTrackMax) && (aod::track::pt > ptTrackMin) && (aod::track::pt < ptTrackMax) && (nabs(aod::track::dcaXY) < dcaXYTrackMax) && (nabs(aod::track::dcaZ) < dcaZTrackMax);
96102

97103
Preslice<CandDsDataWMl> candsDsPerCollWMl = aod::hf_cand::collisionId;
98104
Preslice<CandDplusDataWMl> candsDplusPerCollWMl = aod::hf_cand::collisionId;
105+
Preslice<CandD0DataWMl> candsD0PerCollWMl = aod::hf_cand::collisionId;
99106
Preslice<TracksData> trackIndicesPerColl = aod::track::collisionId;
100107

101108
Partition<CandDsDataWMl> selectedDsToKKPiWMl = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag;
102109
Partition<CandDsDataWMl> selectedDsToPiKKWMl = aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag;
110+
Partition<CandD0DataWMl> selectedD0ToPiKWMl = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag;
111+
Partition<CandD0DataWMl> selectedD0ToKPiWMl = aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag;
103112

104113
HistogramRegistry registry{"registry", {}};
105114

@@ -109,6 +118,10 @@ struct HfCorrelatorFlowCharmHadrons {
109118
massCharm = o2::constants::physics::MassDPlus;
110119
} else if (doprocessDsWithMl) {
111120
massCharm = o2::constants::physics::MassDS;
121+
} else if (doprocessD0WithMl) {
122+
massCharm = o2::constants::physics::MassD0;
123+
} else {
124+
LOG(fatal) << "No decay channel selected to process";
112125
}
113126

114127
hfEvSel.addHistograms(registry); // collision monitoring
@@ -163,6 +176,12 @@ struct HfCorrelatorFlowCharmHadrons {
163176
if constexpr (channel == DecayChannel::DplusToPiKPi) {
164177
return hfHelper.invMassDplusToPiKPi(candidate);
165178
}
179+
if constexpr (channel == DecayChannel::D0ToPiK) {
180+
return hfHelper.invMassD0ToPiK(candidate);
181+
}
182+
if constexpr (channel == DecayChannel::D0ToKPi) {
183+
return hfHelper.invMassD0barToKPi(candidate);
184+
}
166185
return -1.;
167186
}
168187

@@ -187,6 +206,16 @@ struct HfCorrelatorFlowCharmHadrons {
187206
outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)];
188207
}
189208
}
209+
if constexpr (channel == DecayChannel::D0ToPiK) {
210+
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) {
211+
outputMl[iclass] = candidate.mlProbD0()[classMl->at(iclass)];
212+
}
213+
}
214+
if constexpr (channel == DecayChannel::D0ToKPi) {
215+
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) {
216+
outputMl[iclass] = candidate.mlProbD0bar()[classMl->at(iclass)];
217+
}
218+
}
190219
return outputMl;
191220
}
192221

@@ -201,8 +230,11 @@ struct HfCorrelatorFlowCharmHadrons {
201230
continue;
202231
}
203232
double massCand = getCandMass<channel>(candidate);
204-
rowCharmCandidates(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id());
205-
233+
if constexpr (channel == DecayChannel::D0ToKPi || channel == DecayChannel::D0ToPiK) {
234+
rowCharmCandidates2P(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id());
235+
} else {
236+
rowCharmCandidates3P(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id());
237+
}
206238
std::vector<float> outputMl = getCandMlScores<channel>(candidate);
207239
rowCharmCandidatesMl(indexRedColl, outputMl[0], outputMl[1]);
208240
}
@@ -266,6 +298,29 @@ struct HfCorrelatorFlowCharmHadrons {
266298
}
267299
}
268300
PROCESS_SWITCH(HfCorrelatorFlowCharmHadrons, processDsWithMl, "Process Ds candidates with ML info", false);
301+
302+
// D0 with ML selections
303+
void processD0WithMl(CollsWithCentMult const& colls,
304+
TracksData const& tracks,
305+
CandD0DataWMl const&)
306+
{
307+
for (const auto& coll : colls) {
308+
auto thisCollId = coll.globalIndex();
309+
auto candsD0ToPiKWMl = selectedD0ToPiKWMl->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache);
310+
auto candsD0ToKPiWMl = selectedD0ToKPiWMl->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache);
311+
if (forceCharmInCollision && candsD0ToPiKWMl.size() < 1 && candsD0ToKPiWMl.size() < 1) {
312+
continue;
313+
}
314+
if (!checkAndFillCollision(coll)) {
315+
continue;
316+
}
317+
auto trackIdsThisColl = tracks.sliceBy(trackIndicesPerColl, thisCollId);
318+
fillCharmHadronTables<DecayChannel::D0ToPiK>(candsD0ToPiKWMl);
319+
fillCharmHadronTables<DecayChannel::D0ToKPi>(candsD0ToKPiWMl);
320+
fillTracksTables(trackIdsThisColl);
321+
}
322+
}
323+
PROCESS_SWITCH(HfCorrelatorFlowCharmHadrons, processD0WithMl, "Process D0 candidates with ML info", false);
269324
};
270325

271326
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)