Skip to content

Commit 63a7c29

Browse files
authored
[PWGCF] Check MC HF decay and use dedicated efficiency bin (#11681)
1 parent 638065e commit 63a7c29

File tree

3 files changed

+31
-20
lines changed

3 files changed

+31
-20
lines changed

PWGCF/DataModel/CorrelationsDerived.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
#ifndef PWGCF_DATAMODEL_CORRELATIONSDERIVED_H_
1212
#define PWGCF_DATAMODEL_CORRELATIONSDERIVED_H_
1313

14-
#include <vector>
14+
#include "Common/DataModel/Centrality.h"
1515

1616
#include "Framework/ASoA.h"
1717
#include "Framework/AnalysisDataModel.h"
18-
#include "Common/DataModel/Centrality.h"
18+
19+
#include <vector>
1920

2021
namespace o2::aod
2122
{
@@ -150,11 +151,16 @@ namespace cf2prongmcpart
150151
{
151152
DECLARE_SOA_INDEX_COLUMN_FULL(CFParticleDaugh0, cfParticleDaugh0, int, CFMcParticles, "_0"); //! Index to prong 1 CFMcParticle
152153
DECLARE_SOA_INDEX_COLUMN_FULL(CFParticleDaugh1, cfParticleDaugh1, int, CFMcParticles, "_1"); //! Index to prong 2 CFMcParticle
154+
DECLARE_SOA_COLUMN(Decay, decay, uint8_t); //! Particle decay and flags
155+
enum ParticleDecayFlags {
156+
Prompt = 0x80
157+
};
153158
} // namespace cf2prongmcpart
154159
DECLARE_SOA_TABLE(CF2ProngMcParts, "AOD", "CF2PRONGMCPART", //! Table for the daughter particles of a 2-prong particle, to be joined with CFMcParticles
155160
o2::soa::Index<>,
156161
cf2prongmcpart::CFParticleDaugh0Id,
157-
cf2prongmcpart::CFParticleDaugh1Id)
162+
cf2prongmcpart::CFParticleDaugh1Id,
163+
cf2prongmcpart::Decay)
158164
using CF2ProngMcPart = CF2ProngMcParts::iterator;
159165

160166
} // namespace o2::aod

PWGCF/TableProducer/filter2Prong.cxx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,14 @@ struct Filter2Prong {
141141
}
142142
PROCESS_SWITCH(Filter2Prong, processData, "Process data D0 candidates", true);
143143

144-
void processMC(aod::McCollisions::iterator const&, aod::CFMcParticleRefs const& cfmcparticles, [[maybe_unused]] aod::McParticles const& mcparticles)
144+
using HFMCTrack = soa::Join<aod::McParticles, aod::HfCand2ProngMcGen>;
145+
void processMC(aod::McCollisions::iterator const&, aod::CFMcParticleRefs const& cfmcparticles, [[maybe_unused]] HFMCTrack const& mcparticles)
145146
{
146147
// The main filter outputs the primary MC particles. Here we just resolve the daughter indices that are needed for the efficiency matching.
147148
for (const auto& r : cfmcparticles) {
148-
const auto& mcParticle = r.mcParticle();
149-
if (mcParticle.daughtersIds().size() != 2) {
150-
output2ProngMcParts(-1, -1);
149+
const auto& mcParticle = r.mcParticle_as<HFMCTrack>();
150+
if ((mcParticle.flagMcMatchGen() & (1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) == 0 || mcParticle.daughtersIds().size() != 2) {
151+
output2ProngMcParts(-1, -1, aod::cf2prongtrack::Generic2Prong);
151152
continue;
152153
}
153154
int prongCFId[2] = {-1, -1};
@@ -159,7 +160,8 @@ struct Filter2Prong {
159160
}
160161
}
161162
}
162-
output2ProngMcParts(prongCFId[0], prongCFId[1]);
163+
output2ProngMcParts(prongCFId[0], prongCFId[1],
164+
(mcParticle.pdgCode() >= 0 ? aod::cf2prongtrack::D0ToPiK : aod::cf2prongtrack::D0barToKPi) | ((mcParticle.originMcGen() & RecoDecay::OriginType::Prompt) ? aod::cf2prongmcpart::Prompt : 0));
163165
}
164166
}
165167
PROCESS_SWITCH(Filter2Prong, processMC, "Process MC 2-prong daughters", false);

PWGCF/Tasks/correlations.cxx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -987,9 +987,11 @@ struct CorrelationTask {
987987
case 2212: // proton
988988
case -2212:
989989
return 2;
990-
default: // NOTE. The efficiency histogram is hardcoded to contain 4 species. Anything special will have the last slot.
991-
return 3;
992990
}
991+
if (std::find(cfgMcTriggerPDGs->begin(), cfgMcTriggerPDGs->end(), pdgCode) != cfgMcTriggerPDGs->end())
992+
return 4; // NOTE - if changed, the number in processMCEfficiency2Prong needs to be changed too since we skip the getSpecies call
993+
else // The efficiency histogram is hardcoded to contain 5 species. Anything special will have the 4th slot.
994+
return 3;
993995
}
994996

995997
// NOTE SmallGroups includes soa::Filtered always
@@ -1054,10 +1056,12 @@ struct CorrelationTask {
10541056
// Primaries
10551057
p2indexCache.clear();
10561058
for (const auto& mcParticle : mcParticles) {
1057-
if (mcParticle.isPhysicalPrimary() && std::find(cfgMcTriggerPDGs->begin(), cfgMcTriggerPDGs->end(), mcParticle.pdgCode()) != cfgMcTriggerPDGs->end()) {
1058-
same->getTrackHistEfficiency()->Fill(CorrelationContainer::MC, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), multiplicity, mcCollision.posZ());
1059+
if (std::find(cfgMcTriggerPDGs->begin(), cfgMcTriggerPDGs->end(), mcParticle.pdgCode()) != cfgMcTriggerPDGs->end()) {
1060+
if (mcParticle.decay() != aod::cf2prongtrack::D0ToPiK || mcParticle.decay() != aod::cf2prongtrack::D0barToKPi)
1061+
continue; // wrong decay channel
1062+
same->getTrackHistEfficiency()->Fill(CorrelationContainer::MC, mcParticle.eta(), mcParticle.pt(), 4, multiplicity, mcCollision.posZ());
10591063
if (mcParticle.cfParticleDaugh0Id() < 0 || mcParticle.cfParticleDaugh1Id() < 0)
1060-
continue;
1064+
continue; // daughters not found
10611065
p2indexCache.push_back(mcParticle.globalIndex());
10621066
}
10631067
}
@@ -1068,26 +1072,25 @@ struct CorrelationTask {
10681072
// Check if the mc particles of the prongs are found.
10691073
if (p2track.cfTrackProng0Id() < 0 || p2track.cfTrackProng1Id() < 0) {
10701074
// fake track
1071-
same->getTrackHistEfficiency()->Fill(CorrelationContainer::Fake, p2track.eta(), p2track.pt(), 0, multiplicity, mcCollision.posZ());
1075+
same->getTrackHistEfficiency()->Fill(CorrelationContainer::Fake, p2track.eta(), p2track.pt(), 4, multiplicity, mcCollision.posZ());
1076+
continue;
10721077
}
10731078
const auto& p0 = p2track.cfTrackProng0_as<aod::CFTracksWithLabel>();
10741079
const auto& p1 = p2track.cfTrackProng1_as<aod::CFTracksWithLabel>();
10751080
if (p0.has_cfMCParticle() && p1.has_cfMCParticle()) {
10761081
// find the 2-prong MC particle by the daughter MC particle IDs
10771082
auto m = std::find_if(p2indexCache.begin(), p2indexCache.end(), [&](const auto& t) -> bool {
10781083
const auto& mcParticle = mcParticles.iteratorAt(t - mcParticles.begin().globalIndex());
1079-
return p0.cfMCParticleId() == mcParticle.cfParticleDaugh0Id() && p1.cfMCParticleId() == mcParticle.cfParticleDaugh1Id();
1084+
return (p0.cfMCParticleId() == mcParticle.cfParticleDaugh0Id() && p1.cfMCParticleId() == mcParticle.cfParticleDaugh1Id()) || (p0.cfMCParticleId() == mcParticle.cfParticleDaugh1Id() && p1.cfMCParticleId() == mcParticle.cfParticleDaugh0Id());
10801085
});
10811086
if (m == p2indexCache.end())
10821087
continue;
10831088
const auto& mcParticle = mcParticles.iteratorAt(*m - mcParticles.begin().globalIndex());
1084-
if (mcParticle.isPhysicalPrimary()) {
1085-
same->getTrackHistEfficiency()->Fill(CorrelationContainer::RecoPrimaries, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), multiplicity, mcCollision.posZ());
1086-
}
1087-
same->getTrackHistEfficiency()->Fill(CorrelationContainer::RecoAll, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), multiplicity, mcCollision.posZ());
1089+
same->getTrackHistEfficiency()->Fill(CorrelationContainer::RecoPrimaries, mcParticle.eta(), mcParticle.pt(), 4, multiplicity, mcCollision.posZ());
1090+
same->getTrackHistEfficiency()->Fill(CorrelationContainer::RecoAll, mcParticle.eta(), mcParticle.pt(), 4, multiplicity, mcCollision.posZ());
10881091
} else {
10891092
// fake track
1090-
same->getTrackHistEfficiency()->Fill(CorrelationContainer::Fake, p2track.eta(), p2track.pt(), 0, multiplicity, mcCollision.posZ());
1093+
same->getTrackHistEfficiency()->Fill(CorrelationContainer::Fake, p2track.eta(), p2track.pt(), 4, multiplicity, mcCollision.posZ());
10911094
}
10921095
}
10931096
}

0 commit comments

Comments
 (0)