HepMC event record
WriterRootTreeOPAL.cc
1 // -*- C++ -*-
2 //
3 #include "WriterRootTreeOPAL.h"
4 namespace HepMC
5 {
6 WriterRootTreeOPAL::WriterRootTreeOPAL(const std::string &filename,shared_ptr<GenRunInfo> run):WriterRootTree::WriterRootTree(filename,"h10","h10",run) {}
7 void WriterRootTreeOPAL::init_branches()
8 {
9  m_tree->Branch("Irun", &m_Irun);
10  m_tree->Branch("Ievnt", &m_Ievnt);
11  m_tree->Branch("Ebeam",&m_Ebeam);
12 }
14 {
15  m_Ievnt=evt.event_number();
16  if (evt.particles().size()>0) m_Ebeam=std::abs(evt.particles().at(0)->momentum().e());
18 }
19 void WriterRootTreeOPAL::set_run_number(const int nr) {m_Irun=nr;}
20 } // namespace HepMC
TTree * m_tree
Tree handler. Public to allow simple access, e.g. custom branches.
const std::vector< GenParticlePtr > & particles() const
Get list of particles (const)
int event_number() const
Get event number.
void write_event(const GenEvent &evt)
Write event evt to output target.
Stores event-related information.
Definition of template class SmartPointer.
void write_event(const GenEvent &evt)
Write event to file.