ATLAS Offline Software
copyBeamParticles.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration.
3  */
12 #include "copyBeamParticles.h"
13 
14 
15 namespace TruthHelper {
16 
17 
18 // Copy beam particle information from inEvt to outEvt (HepMC2 only).
19 // Can't be done in copyemptyGenEvent because the beam particles
20 // must have already been added to outEvt.
21 void copyBeamParticles (const HepMC::GenEvent& inEvt [[maybe_unused]],
22  HepMC::GenEvent& outEvt [[maybe_unused]])
23 {
24 #ifndef HEPMC3
25  if (inEvt.valid_beam_particles()) {
26  std::pair<HepMC::GenParticle*,HepMC::GenParticle*> bp = inEvt.beam_particles();
27  outEvt.set_beam_particles (outEvt.barcode_to_particle (bp.first->barcode()),
28  outEvt.barcode_to_particle (bp.second->barcode()));
29  }
30 #endif
31 }
32 
33 
34 } // namespace TruthHelper
TruthHelper::copyBeamParticles
void copyBeamParticles(const HepMC::GenEvent &inEvt[[maybe_unused]], HepMC::GenEvent &outEvt[[maybe_unused]])
Definition: copyBeamParticles.cxx:21
TruthHelper
Definition: Generators/FlowAfterburner/FlowAfterburner/GenAccessIO.h:22
copyBeamParticles.h
Helper to copy beam particle information.