Skip to content

Commit

Permalink
Merge pull request #21 from pbuehler/master
Browse files Browse the repository at this point in the history
Correct number of vertices in HepMC output
  • Loading branch information
nburmaso authored Dec 25, 2024
2 parents ee39474 + 1e46c12 commit 9e70f59
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/UpcGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,17 @@ void UpcGenerator::writeEvent(long int evt,
}

if (useHepMCOut) {
writerHepMC->writeEventInfo(evt, static_cast<int>(particles.size()), 1);
// compute number of vertices
int nVertices = -1;
int lastMotherId = -1;
for (auto mother : mothers) {
if (mother != lastMotherId) {
nVertices++;
lastMotherId = mother;
}
}
writerHepMC->writeEventInfo(evt, static_cast<int>(particles.size()), nVertices);

for (int i = 0; i < particles.size(); ++i) {
writerHepMC->writeParticleInfo(i + 1, mothers[i], pdgs[i],
particles[i].Px(), particles[i].Py(), particles[i].Pz(), particles[i].E(), particles[i].M(),
Expand Down

0 comments on commit 9e70f59

Please sign in to comment.