Skip to content

Commit c117f74

Browse files
authored
Rename and fix(correlatorHfeHadrons): select only primary Particle after PID for correlation
1 parent 2758ffb commit c117f74

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ struct HfCorrelatorHfeHadrons {
186186
}
187187

188188
// Electron-hadron Correlation
189-
template <bool isMc, typename TracksType, typename ElectronType, typename CollisionType, typename BcType, typename McParticles>
190-
void fillCorrelation(CollisionType const& collision, ElectronType const& electrons, TracksType const& tracks, BcType const&, McParticles const&)
189+
template <bool IsMc, typename TracksType, typename ElectronType, typename CollisionType, typename BcType, typename McParticlesType>
190+
void fillCorrelation(CollisionType const& collision, ElectronType const& electrons, TracksType const& tracks, BcType const&, McParticlesType const&)
191191
{
192192
if (!(isRun3 ? collision.sel8() : (collision.sel7() && collision.alias_bit(kINT7)))) {
193193
return;
@@ -215,7 +215,7 @@ struct HfCorrelatorHfeHadrons {
215215
}
216216

217217
// Mc rec hadron efficiency
218-
if constexpr (isMc) {
218+
if constexpr (IsMc) {
219219
if (hTrack.has_mcParticle()) {
220220
auto mcParticle = hTrack.template mcParticle_as<aod::McParticles>();
221221
if ((std::abs(mcParticle.pdgCode()) != kElectron) && (std::abs(mcParticle.pdgCode()) != kMuonMinus) && (std::abs(mcParticle.pdgCode()) != kPiPlus) && (std::abs(mcParticle.pdgCode()) != kKPlus) && (std::abs(mcParticle.pdgCode()) != kProton)) {
@@ -227,19 +227,15 @@ struct HfCorrelatorHfeHadrons {
227227

228228
registry.fill(HIST("hptHadronMcRecPrimary"), hTrack.pt());
229229

230-
if (std::abs(mcParticle.pdgCode()) != kElectron) {
230+
if (std::abs(mcParticle.pdgCode()) == kElectron) {
231231
registry.fill(HIST("hMCRecptEleHadron"), hTrack.pt());
232-
}
233-
if (std::abs(mcParticle.pdgCode()) != kMuonMinus) {
232+
} else if (std::abs(mcParticle.pdgCode()) == kMuonMinus) {
234233
registry.fill(HIST("hMCRecptMuonHadron"), hTrack.pt());
235-
}
236-
if (std::abs(mcParticle.pdgCode()) != kPiPlus) {
234+
} else if (std::abs(mcParticle.pdgCode()) == kPiPlus) {
237235
registry.fill(HIST("hMCRecptPionHadron"), hTrack.pt());
238-
}
239-
if (std::abs(mcParticle.pdgCode()) != kKPlus) {
236+
} else if (std::abs(mcParticle.pdgCode()) == kKPlus) {
240237
registry.fill(HIST("hMCRecptKaonHadron"), hTrack.pt());
241-
}
242-
if (std::abs(mcParticle.pdgCode()) != kProton) {
238+
} else if (std::abs(mcParticle.pdgCode()) == kProton) {
243239
registry.fill(HIST("hMCRecptProtonHadron"), hTrack.pt());
244240
}
245241
}
@@ -467,19 +463,15 @@ struct HfCorrelatorHfeHadrons {
467463

468464
registry.fill(HIST("hMCgenptHadronprimary"), particleMc.pt());
469465

470-
if (std::abs(particleMc.pdgCode()) != kElectron) {
466+
if (std::abs(particleMc.pdgCode()) == kElectron) {
471467
registry.fill(HIST("hMCgenptEleHadron"), particleMc.pt());
472-
}
473-
if (std::abs(particleMc.pdgCode()) != kMuonMinus) {
468+
} else if (std::abs(particleMc.pdgCode()) == kMuonMinus) {
474469
registry.fill(HIST("hMCgenptMuonHadron"), particleMc.pt());
475-
}
476-
if (std::abs(particleMc.pdgCode()) != kPiPlus) {
470+
} else if (std::abs(particleMc.pdgCode()) == kPiPlus) {
477471
registry.fill(HIST("hMCgenptPionHadron"), particleMc.pt());
478-
}
479-
if (std::abs(particleMc.pdgCode()) != kKPlus) {
472+
} else if (std::abs(particleMc.pdgCode()) == kKPlus) {
480473
registry.fill(HIST("hMCgenptKaonHadron"), particleMc.pt());
481-
}
482-
if (std::abs(particleMc.pdgCode()) != kProton) {
474+
} else if (std::abs(particleMc.pdgCode()) == kProton) {
483475
registry.fill(HIST("hMCgenptProtonHadron"), particleMc.pt());
484476
}
485477
}

0 commit comments

Comments
 (0)