20 std::vector<HepMC3::ConstGenParticlePtr> beams;
21 for (
const auto& particle : evt.
particles()) {
22 if (particle->status() == 4 && std::abs(particle->pid()) == 11)
23 { beams.push_back(particle);}
25 if (beams.size() == 2) {
26 m_Ebeam = std::abs(beams[0]->momentum().e());
Definition of class WriterRootTreeOPAL.
Stores event-related information.
int event_number() const
Get event number.
const std::vector< ConstGenParticlePtr > & particles() const
Get list of particles (const)
float m_Ebeam
Beam energy in GEV.
void set_run_number(const int nr)
Set run number.
void init_branches()
Init ROOT branches.
WriterRootTreeOPAL(const std::string &filename, std::shared_ptr< GenRunInfo > run=std::shared_ptr< GenRunInfo >())
Constructor.
void write_event(const GenEvent &evt)
Write event.
TTree * m_tree
Tree handler. Public to allow simple access, e.g. custom branches.
WriterRootTree(const std::string &filename, std::shared_ptr< GenRunInfo > run=std::shared_ptr< GenRunInfo >())
Default constructor.
void write_event(const GenEvent &evt) override
Write event to file.