Skip to content

Commit 67c8bd9

Browse files
authored
Merge branch 'AliceO2Group:master' into master
2 parents 21a2cb6 + c0cbb58 commit 67c8bd9

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

PWGCF/Tasks/correlations.cxx

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ struct CorrelationTask {
109109

110110
O2_DEFINE_CONFIGURABLE(cfgPtDepMLbkg, std::vector<float>, {}, "pT interval for ML training")
111111
O2_DEFINE_CONFIGURABLE(cfgPtCentDepMLbkgSel, std::vector<float>, {}, "Bkg ML selection")
112+
O2_DEFINE_CONFIGURABLE(cfgPtCentDepMLpromptSel, std::vector<float>, {}, "Prompt ML selection")
112113

113114
ConfigurableAxis axisVertex{"axisVertex", {7, -7, 7}, "vertex axis for histograms"};
114115
ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta phi axis for histograms"};
@@ -174,8 +175,14 @@ struct CorrelationTask {
174175

175176
void init(o2::framework::InitContext&)
176177
{
177-
if ((doprocessSame2ProngDerivedML || doprocessSame2Prong2ProngML || doprocessMixed2ProngDerivedML || doprocessMixed2Prong2ProngML) && (cfgPtDepMLbkg->empty() || cfgPtCentDepMLbkgSel->empty()))
178-
LOGF(fatal, "cfgPtDepMLbkg or cfgPtCentDepMLbkgSel can not be empty when ML 2-prong selections are used.");
178+
if (doprocessSame2ProngDerivedML || doprocessSame2Prong2ProngML || doprocessMixed2ProngDerivedML || doprocessMixed2Prong2ProngML || doprocessMCEfficiency2ProngML || doprocessMCReflection2ProngML) {
179+
if (cfgPtDepMLbkg->empty() || cfgPtCentDepMLbkgSel->empty())
180+
LOGF(fatal, "cfgPtDepMLbkg or cfgPtCentDepMLbkgSel can not be empty when ML 2-prong selections are used.");
181+
if (cfgPtDepMLbkg->size() != cfgPtCentDepMLbkgSel->size())
182+
LOGF(fatal, "cfgPtDepMLbkg and cfgPtCentDepMLbkgSel must be same size.");
183+
if (!cfgPtCentDepMLpromptSel->empty() && cfgPtCentDepMLpromptSel->size() != cfgPtDepMLbkg->size())
184+
LOGF(fatal, "cfgPtDepMLbkg and cfgPtCentDepMLpromptSel must be same size.");
185+
}
179186
registry.add("yields", "multiplicity/centrality vs pT vs eta", {HistType::kTH3F, {{100, 0, 100, "/multiplicity/centrality"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}});
180187
registry.add("etaphi", "multiplicity/centrality vs eta vs phi", {HistType::kTH3F, {{100, 0, 100, "multiplicity/centrality"}, {100, -2, 2, "#eta"}, {200, 0, o2::constants::math::TwoPI, "#varphi"}}});
181188
if (doprocessSame2ProngDerived || doprocessSame2ProngDerivedML || doprocessSame2Prong2Prong || doprocessSame2Prong2ProngML || doprocessMCSameDerived2Prong) {
@@ -326,7 +333,15 @@ struct CorrelationTask {
326333
{
327334
auto it = std::lower_bound(cfgPtDepMLbkg->begin(), cfgPtDepMLbkg->end(), track.pt());
328335
int idx = std::distance(cfgPtDepMLbkg->begin(), it) - 1;
329-
return !((track.decay() == 0 && track.mlProbD0()[0] > cfgPtCentDepMLbkgSel->at(idx)) || (track.decay() == 1 && track.mlProbD0bar()[0] > cfgPtCentDepMLbkgSel->at(idx)));
336+
return (track.decay() != aod::cf2prongtrack::D0ToPiK ||
337+
(track.mlProbD0()[0] < cfgPtCentDepMLbkgSel->at(idx) && // not background
338+
(cfgPtCentDepMLpromptSel->empty() ||
339+
track.mlProbD0()[1] > cfgPtCentDepMLpromptSel->at(idx)))) && // prompt
340+
341+
((track.decay() != aod::cf2prongtrack::D0barToKPi && track.decay() != aod::cf2prongtrack::D0barToKPiExclusive) ||
342+
(track.mlProbD0bar()[0] < cfgPtCentDepMLbkgSel->at(idx) && // not background
343+
(cfgPtCentDepMLpromptSel->empty() ||
344+
track.mlProbD0bar()[1] > cfgPtCentDepMLpromptSel->at(idx)))); // prompt
330345
}
331346

332347
template <class T>
@@ -571,7 +586,7 @@ struct CorrelationTask {
571586
}
572587

573588
if constexpr (std::experimental::is_detected<HasMcDecay, typename TTracks1::iterator>::value) {
574-
if (((track1.mcDecay() != aod::cf2prongtrack::D0ToPiK) && (track1.mcDecay() != aod::cf2prongtrack::D0barToKPiExclusive)) || (track1.decay() & aod::cf2prongmcpart::Prompt) == 0)
589+
if (((track1.mcDecay() != aod::cf2prongtrack::D0ToPiK) && (track1.mcDecay() != aod::cf2prongtrack::D0barToKPiExclusive)) || (!cfgPtCentDepMLpromptSel->empty() && (track1.decay() & aod::cf2prongmcpart::Prompt) == 0))
575590
continue;
576591
} else if constexpr (std::experimental::is_detected<HasDecay, typename TTracks1::iterator>::value) {
577592
if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast<uint32_t>(track1.decay()))) == 0u) {
@@ -654,7 +669,7 @@ struct CorrelationTask {
654669

655670
// If decay attributes are found for the second track/particle, we assume 2p-2p correlation
656671
if constexpr (std::experimental::is_detected<HasMcDecay, typename TTracks2::iterator>::value) {
657-
if ((((track2.mcDecay()) != aod::cf2prongtrack::D0ToPiK) && ((track2.mcDecay()) != aod::cf2prongtrack::D0barToKPiExclusive)) || (track2.decay() & aod::cf2prongmcpart::Prompt) == 0)
672+
if ((((track2.mcDecay()) != aod::cf2prongtrack::D0ToPiK) && ((track2.mcDecay()) != aod::cf2prongtrack::D0barToKPiExclusive)) || (!cfgPtCentDepMLpromptSel->empty() && (track2.decay() & aod::cf2prongmcpart::Prompt) == 0))
658673
continue;
659674
} else if constexpr (std::experimental::is_detected<HasDecay, typename TTracks2::iterator>::value) {
660675
if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast<uint32_t>(track2.decay()))) == 0u) {
@@ -1196,8 +1211,12 @@ struct CorrelationTask {
11961211
p2indexCache.clear();
11971212
for (const auto& mcParticle : mcParticles) {
11981213
if (std::find(cfgMcTriggerPDGs->begin(), cfgMcTriggerPDGs->end(), mcParticle.pdgCode()) != cfgMcTriggerPDGs->end()) {
1199-
if (((mcParticle.mcDecay() != aod::cf2prongtrack::D0ToPiK) && (mcParticle.mcDecay() != aod::cf2prongtrack::D0barToKPiExclusive)) || (mcParticle.decay() & aod::cf2prongmcpart::Prompt) == 0)
1214+
if ((mcParticle.mcDecay() != aod::cf2prongtrack::D0ToPiK) && (mcParticle.mcDecay() != aod::cf2prongtrack::D0barToKPiExclusive))
12001215
continue; // wrong decay channel
1216+
if constexpr (!reflectionSpec) {
1217+
if (!cfgPtCentDepMLpromptSel->empty() && (mcParticle.decay() & aod::cf2prongmcpart::Prompt) == 0)
1218+
continue;
1219+
}
12011220
if (mcParticle.cfParticleDaugh0Id() < 0 && mcParticle.cfParticleDaugh1Id() < 0)
12021221
continue; // daughters not found
12031222
if constexpr (!reflectionSpec)

0 commit comments

Comments
 (0)