ATLAS Offline Software
Loading...
Searching...
No Matches
copyBeamParticles.cxx
Go to the documentation of this file.
1/*
2 * Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration.
3 */
10
11
12#include "copyBeamParticles.h"
13
14
15namespace 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.
21void 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
Helper to copy beam particle information.
void copyBeamParticles(const HepMC::GenEvent &inEvt, HepMC::GenEvent &outEvt)