Skip to content
Snippets Groups Projects

Generators: only count status 4 beam particles in FixHepMC

Merged Christian Gutschow requested to merge cgutscho/athena:fixhepmc_beams into master
1 file
+ 5
2
Compare changes
  • Side-by-side
  • Inline
@@ -45,11 +45,14 @@ StatusCode FixHepMC::execute() {
}
// Catch cases with more than 2 beam particles (16.11.2021)
auto beams_t = evt->beams();
std::vector<HepMC::GenParticlePtr> beams_t;
for (HepMC::GenParticlePtr p : evt->beams()) {
if (p->status() == 4) beams_t.push_back(p);
}
if (beams_t.size() > 2) {
ATH_MSG_INFO("Invalid number of beam particles " << beams_t.size() << ". Will try to fix.");
std::vector<HepMC::GenParticlePtr> bparttoremove;
for (auto bpart: beams_t) {
for (const auto& bpart : beams_t) {
if (bpart->id() == 0 && bpart->production_vertex()) bparttoremove.push_back(bpart);
}
for (auto bpart: bparttoremove) {
Loading