Skip to content

Commit

Permalink
fix mother/daughter IDs for more than one event per timeframe
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSamitz committed Dec 10, 2023
1 parent 93b31c4 commit f0b72e9
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions run/o2sim_mctracks_to_aod.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct MctracksToAod {
}
// TODO: include BC simulation
auto bcCounter = 0UL;
int trackCounter = 0;
for (auto i = 0U; i < Nparts; ++i) {
auto record = sampler.generateCollisionTime();
auto mcheader = pc.inputs().get<o2::dataformats::MCEventHeader*>("mcheader", i);
Expand Down Expand Up @@ -118,19 +119,19 @@ struct MctracksToAod {
int daughters[2];

if (mctrack.getMotherTrackId() >= 0) {
mothers.push_back(mctrack.getMotherTrackId());
mothers.push_back(mctrack.getMotherTrackId() + trackCounter);
}
if (mctrack.getSecondMotherTrackId() >= 0) {
mothers.push_back(mctrack.getSecondMotherTrackId());
mothers.push_back(mctrack.getSecondMotherTrackId() + trackCounter);
}
daughters[0] = -1;
daughters[1] = -1;
if (mctrack.getFirstDaughterTrackId() >= 0 && mctrack.getLastDaughterTrackId() >= 0) {
daughters[0] = mctrack.getFirstDaughterTrackId();
daughters[1] = mctrack.getLastDaughterTrackId();
daughters[0] = mctrack.getFirstDaughterTrackId() + trackCounter;
daughters[1] = mctrack.getLastDaughterTrackId() + trackCounter;
} else if (mctrack.getFirstDaughterTrackId() >= 0) {
daughters[0] = mctrack.getFirstDaughterTrackId();
daughters[1] = mctrack.getLastDaughterTrackId();
daughters[0] = mctrack.getFirstDaughterTrackId() + trackCounter;
daughters[1] = mctrack.getLastDaughterTrackId() + trackCounter;
}
int PdgCode = mctrack.GetPdgCode();
int statusCode = 0;
Expand Down Expand Up @@ -169,6 +170,7 @@ struct MctracksToAod {
z,
t);
}
trackCounter = trackCounter + mctracks.size();
}
++timeframe;
pc.outputs().snapshot(Output{"TFF", "TFFilename", 0}, "");
Expand Down

0 comments on commit f0b72e9

Please sign in to comment.