Skip to content

Commit

Permalink
PWGJE: Fix loop over generated particles in generator studies
Browse files Browse the repository at this point in the history
  • Loading branch information
nstrangm committed Mar 6, 2024
1 parent e2e0b47 commit 9a586d9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion PWGJE/Tasks/mcgeneratorstudies.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ struct MCGeneratorStudies {
mHistManager.add("hpT_T0Triggered_EMCReadout_Unique", "Unique T0 triggered and EMC readout collisions", HistType::kTH1F, {pTAxis});
}

PresliceUnsorted<aod::McParticles> perMcCollision = aod::mcparticle::mcCollisionId;

void process(soa::Filtered<MyMCCollisions>::iterator const& collision, soa::Filtered<aod::McParticles> const& mcParticles)
{
bool isT0Triggered = collision.sel8();
Expand All @@ -68,7 +70,8 @@ struct MCGeneratorStudies {
}
}
}
for (auto& mcParticle : mcParticles) {
auto mcParticles_inColl = mcParticles.sliceBy(perMcCollision, collision.globalIndex());
for (auto& mcParticle : mcParticles_inColl) {
mHistManager.fill(HIST("hpT_all"), mcParticle.pt());
if (isT0Triggered) {
mHistManager.fill(HIST("hpT_T0Triggered"), mcParticle.pt());
Expand Down

0 comments on commit 9a586d9

Please sign in to comment.