9#include <generators/modules/LHEInputModule.h>
11#include <framework/logging/Logger.h>
12#include <framework/datastore/DataStore.h>
13#include <framework/datastore/StoreArray.h>
28 setDescription(
"LHE file input. This module loads an event record from LHE format and store the content into the MCParticle collection. LHE format is a standard event record format to contain an event record in a Monte Carlo-independent format.");
34 "Boolean to indicate whether the event numbers from input file should be used.",
false);
38 addParam(
"useWeights",
m_useWeights,
"Set to 'true' to if generator weights should be propagated (not implemented yet).",
false);
39 addParam(
"nInitialParticles",
m_nInitial,
"Number of MCParticles at the beginning of the events that should be flagged c_Initial.",
42 "Number of MCParticles at the beginning of the events that should be flagged c_IsVirtual.", 0);
43 addParam(
"wrongSignPz",
m_wrongSignPz,
"Boolean to signal that directions of HER and LER were switched",
true);
45 "Mean decay length(mean lifetime * c) between displaced vertex to IP in the CM frame, default to be zero, unit in cm", 0.);
46 addParam(
"Rmin",
m_Rmin,
"Minimum of distance between displaced vertex to IP in CM frame", 0.);
47 addParam(
"Rmax",
m_Rmax,
"Maximum of distance between displaced vertex to IP in CM frame", 1000000.);
55 B2FATAL(
"The exp. and run numbers are not properly initialized: please set the 'expNum' and 'runNum' parameters of the LHEInput module.");
58 B2INFO(
"LHEInput acts as input module for this process. This means the exp., run and event numbers will be set by this module.");
64 B2FATAL(
"Invalid list of input files, no entries found.");
73 }
catch (runtime_error& e) {
87 TF1 fr(
"fr",
"exp(-x/[0])", 0, 1000000);
89 factor = fr.Integral(
m_Rmin,
m_Rmax) / fr.Integral(0, 1000000);
90 B2WARNING(
"Default range of R is changed, new range is from " <<
m_Rmin <<
"cm to " <<
m_Rmax <<
91 " cm. This will change the cross section by a factor of " << factor);
120 }
catch (LHEReader::LHEEmptyEventError&) {
121 B2DEBUG(100,
"Reached end of LHE file.");
129 }
catch (runtime_error& e) {
134 B2DEBUG(100,
"Reached end of all LHE files.");
136 }
catch (runtime_error& e) {
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
bool skipEvents(int n)
Skips a given number of events.
void setVirtualIndex(int index)
Set the maximum index of particles in each event that must be set as c_IsVirtual (1-based).
double m_Rmin
Minimum of vertex distance to IP.
int m_pdgDisplaced
PDG code of the displaced particle being studied.
void setInitialIndex(int index)
Set the maximum index of particles in each event that must be set as c_Initial (1-based).
double m_Rmax
Maximum of vertex distance to IP.
void open(const std::string &filename)
Opens an ascii file and prepares it for reading.
void closeCurrentInputFile()
Closes the current input file to allow opening the next one.
int getEvent(MCParticleGraph &graph, double &weight)
Reads the next event and stores the result in the given MCParticle graph.
bool m_wrongSignPz
Bool to indicate that HER and LER were swapped.
double m_meanDecayLength
Mean lifetime*c of displaced particle.
@ 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.
Accessor to arrays stored in the data store.
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.