Belle II Software development
|
Class to read LHE files and store the content in a MCParticle graph. More...
#include <LHEReader.h>
Public Member Functions | |
BELLE2_DEFINE_EXCEPTION (LHECouldNotOpenFileError, "Could not open file %1% !") | |
Exception is thrown if the LHE file could not be opened. | |
BELLE2_DEFINE_EXCEPTION (LHEInvalidDaughterIndicesError, "Line %1%: Invalid daughter indices d1=%2%, d2=%3%, N=%4% (0<=d1<=d2<=N required)") | |
Exception is thrown if the given indices of the daughters are not valid. | |
BELLE2_DEFINE_EXCEPTION (LHEHeaderNotValidError, "Line %1%: Event header not understood: %2%") | |
Exception is thrown if the header specifying the event header could not be parsed. | |
BELLE2_DEFINE_EXCEPTION (LHEConvertFieldError, "Line %1%: Could not convert field %2%: %3%") | |
Exception is thrown if a field in the LHE file could not be converted to a number. | |
BELLE2_DEFINE_EXCEPTION (LHEParticleFormatError, "Line %1%: Particle format not understood, got %2% fields !") | |
Exception is thrown if the format of a line of the LHE file could not be parsed. | |
BELLE2_DEFINE_EXCEPTION (LHEEmptyEventError, "Line %1%: Number of particles in event is %2% ! (This could mean EOF is reached.) ") | |
Exception is thrown if the number of particles for this event is 0 or less. | |
LHEReader () | |
Constructor. | |
~LHEReader () | |
Destructor. | |
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 | skipEvents (int n) |
Skips a given number of events. | |
void | setInitialIndex (int index) |
Set the maximum index of particles in each event that must be set as c_Initial (1-based). | |
void | setVirtualIndex (int index) |
Set the maximum index of particles in each event that must be set as c_IsVirtual (1-based). | |
Public Attributes | |
bool | m_wrongSignPz |
Bool to indicate that HER and LER were swapped. | |
double | m_meanDecayLength = 0. |
Mean lifetime*c of displaced particle. | |
double | m_Rmin = 0. |
Minimum of vertex distance to IP. | |
double | m_Rmax = 0. |
Maximum of vertex distance to IP. | |
int | m_pdgDisplaced = 0 |
PDG code of the displaced particle being studied. | |
Protected Types | |
typedef boost::tokenizer< boost::char_separator< char > > | tokenizer |
Just a typedef for simple use of the boost::tokenizer to split the lines. | |
Protected Member Functions | |
std::string | getLine () |
Returns the current line from the LHE ascii file. | |
int | readEventHeader (double &eventWeight) |
Reads the event header from the hepevt file. | |
int | readParticle (MCParticleGraph::GraphParticle &particle) |
Reads the information for a single particle from the LHE file. | |
Protected Attributes | |
int | m_lineNr |
The current line number within the ascii file. | |
std::ifstream | m_input |
The input stream of the ascii file. | |
int | m_indexInitial |
Maximum index of particles in each event that must be set as c_Initial (1-based). | |
int | m_indexVirtual |
Maximum index of particles in each event that must be set as c_IsVirtual (1-based). | |
Static Protected Attributes | |
static const boost::char_separator< char > | sep |
The characters at which to split, defaults to ",; \t". | |
Class to read LHE files and store the content in a MCParticle graph.
The class is very similar to the HepEvt Reader
The events are read sequentially with the option of skipping a certain number of events. Random access of events is not possible.
Definition at line 31 of file LHEReader.h.
|
protected |
Just a typedef for simple use of the boost::tokenizer to split the lines.
Definition at line 110 of file LHEReader.h.
|
inline |
Constructor.
Definition at line 52 of file LHEReader.h.
|
inline |
Destructor.
Definition at line 62 of file LHEReader.h.
BELLE2_DEFINE_EXCEPTION | ( | LHEEmptyEventError | , |
"Line %1%: Number of particles in event is %2% ! (This could mean EOF is reached.) " | |||
) |
Exception is thrown if the number of particles for this event is 0 or less.
|
inline |
Closes the current input file to allow opening the next one.
Definition at line 73 of file LHEReader.h.
int getEvent | ( | MCParticleGraph & | graph, |
double & | weight | ||
) |
Reads the next event and stores the result in the given MCParticle graph.
graph | Reference to the graph which should be filled with the information from the LHE file. |
weight | Reference to the event weight which can be filled from the file. |
Definition at line 36 of file LHEReader.cc.
|
protected |
Returns the current line from the LHE ascii file.
Definition at line 130 of file LHEReader.cc.
void open | ( | const std::string & | filename | ) |
Opens an ascii file and prepares it for reading.
filename | The filename of the LHE ascii file which should be read. |
Definition at line 28 of file LHEReader.cc.
|
protected |
Reads the event header from the hepevt file.
eventWeight | reference to the eventWeight which can both be read from the file. |
Definition at line 149 of file LHEReader.cc.
|
protected |
Reads the information for a single particle from the LHE file.
particle | Reference to the particle which will be filled with the information from the LHE file. |
Definition at line 196 of file LHEReader.cc.
|
inline |
Set the maximum index of particles in each event that must be set as c_Initial (1-based).
[in] | index | Maximum index for c_Initial. |
Definition at line 94 of file LHEReader.h.
|
inline |
Set the maximum index of particles in each event that must be set as c_IsVirtual (1-based).
[in] | index | Maximum index for c_IsVirtual. |
Definition at line 100 of file LHEReader.h.
bool skipEvents | ( | int | n | ) |
Skips a given number of events.
n | The number of events which should be skipped. |
Definition at line 112 of file LHEReader.cc.
|
protected |
Maximum index of particles in each event that must be set as c_Initial (1-based).
Definition at line 140 of file LHEReader.h.
|
protected |
Maximum index of particles in each event that must be set as c_IsVirtual (1-based).
Definition at line 142 of file LHEReader.h.
|
protected |
The input stream of the ascii file.
Definition at line 115 of file LHEReader.h.
|
protected |
The current line number within the ascii file.
Definition at line 114 of file LHEReader.h.
double m_meanDecayLength = 0. |
Mean lifetime*c of displaced particle.
Definition at line 103 of file LHEReader.h.
int m_pdgDisplaced = 0 |
PDG code of the displaced particle being studied.
Definition at line 106 of file LHEReader.h.
double m_Rmax = 0. |
Maximum of vertex distance to IP.
Definition at line 105 of file LHEReader.h.
double m_Rmin = 0. |
Minimum of vertex distance to IP.
Definition at line 104 of file LHEReader.h.
bool m_wrongSignPz |
Bool to indicate that HER and LER were swapped.
Definition at line 102 of file LHEReader.h.
|
staticprotected |
The characters at which to split, defaults to ",; \t".
Definition at line 112 of file LHEReader.h.