9 #include <generators/modules/hepmcreader/HepmcInputModule.h>
11 #include <framework/logging/Logger.h>
12 #include <framework/datastore/DataStore.h>
13 #include <framework/datastore/StoreArray.h>
14 #include <framework/core/Environment.h>
21 HepMCInputModule::HepMCInputModule() :
Module(), m_evtNum(0), m_minEvent(-1), m_maxEvent(INT_MAX), m_totalEvents(-1)
24 setDescription(
"HepMC file input. This module loads an event record from HEPMC2 format and store the content into the MCParticle collection. HEPMC format is used by for example pythia8.");
34 addParam(
"useWeights",
m_useWeights,
"Set to 'true' to if generator weights should be propagated.",
false);
35 addParam(
"nVirtualParticles",
m_nVirtual,
"Number of particles at the beginning of the events that should be made virtual.", 0);
36 addParam(
"wrongSignPz",
m_wrongSignPz,
"Boolean to signal that directions of HER and LER were switched",
false);
37 addParam(
"makeMaster",
m_makeMaster,
"Boolean to indicate whether the event numbers from input file should be used.",
true);
45 B2FATAL(
"The exp. and run numbers are not properly initialized: please set the 'expNum' and 'runNum' parameters of the HepMCInput module.");
48 B2INFO(
"HepMCInput acts as input module for this process. This means the exp., run and event numbers will be set by this module.");
56 B2FATAL(
"Invalid list of input files, no entries found.");
65 }
catch (runtime_error& e) {
94 B2DEBUG(20,
"Setting exp " <<
m_expNum <<
" run " <<
m_runNum <<
" event " <<
id <<
".");
101 }
catch (HepMCReader::HepMCInvalidEventError&) {
102 B2DEBUG(20,
"Reached end of HepMC file.");
110 }
catch (runtime_error& e) {
115 B2DEBUG(20,
"Reached end of all HepMC files.");
117 }
catch (runtime_error& e) {
124 if (
m_evtNum !=
m_totalEvents) { B2WARNING(
"Eventnumber mismatch. (ignore if more than one file was read.)");}
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
static Environment & Instance()
Static method to get a reference to the Environment instance.
void setNumberOfMCEvents(unsigned int n)
Set number of generated events (for EventInfoSetter).
Class to read HepMC files and store the content in a MCParticle graph.
@ c_checkCyclic
Check for cyclic dependencies.
@ c_setDecayInfo
Set decay time and vertex.
void generateList(const std::string &name="", int options=c_setNothing)
Generates the MCParticle list and stores it in the StoreArray with the given name.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_Input
This module is an input module (reads data).
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
void clear()
Reset particles and decay information to make the class reusable.
Abstract base class for different kinds of events.