11#include <framework/core/FrameworkExceptions.h>
12#include <mdst/dataobjects/MCParticleGraph.h>
13#include <boost/tokenizer.hpp>
42 "Line %1%: Invalid daughter indices d1=%2%, d2=%3%, N=%4% (0<=d1<=d2<=N required)");
51 "Line %1%: Number of particles in event is %2% ! (This could mean EOF is reached.) ");
66 void open(
const std::string& filename);
93 typedef boost::tokenizer<boost::char_separator<char> >
tokenizer;
95 static const boost::char_separator<char>
sep;
Class to read Hepevt files and store the content in a MCParticle graph.
BELLE2_DEFINE_EXCEPTION(HepEvtHeaderNotValidError, "Line %1%: Event header not understood: %2%")
Exception is thrown if the header specifying the event header could not be parsed.
bool skipEvents(int n)
Skips a given number of events.
std::string getLine()
Returns the current line from the Hepevt ascii file.
BELLE2_DEFINE_EXCEPTION(HepEvtInvalidDaughterIndicesError, "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.
HepevtReader()
Constructor.
BELLE2_DEFINE_EXCEPTION(HepEvtParticleFormatError, "Line %1%: Particle format not understood, got %2% fields !")
Exception is thrown if the format of a line of the HepEvt file could not be parsed.
static const boost::char_separator< char > sep
The characters at which to split, defaults to ",; \t".
~HepevtReader()
Destructor.
int m_lineNr
The current line number within the ascii file.
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.
std::ifstream m_input
The input stream of the ascii file.
boost::tokenizer< boost::char_separator< char > > tokenizer
Just a typedef for simple use of the boost::tokenizer to split the lines.
int readEventHeader(int &eventID, double &eventWeight)
Reads the event header from the hepevt file.
int getEvent(MCParticleGraph &graph, double &weight)
Reads the next event and stores the result in the given MCParticle graph.
BELLE2_DEFINE_EXCEPTION(HepEvtCouldNotOpenFileError, "Could not open file %1% !")
Exception is thrown if the HepEvt file could not be opened.
BELLE2_DEFINE_EXCEPTION(HepEvtEmptyEventError, "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.
bool m_wrongSignPz
Bool to indicate that HER and LER were swapped.
void readParticle(MCParticleGraph::GraphParticle &particle)
Reads the information for a single particle from the Hepevt file.
BELLE2_DEFINE_EXCEPTION(HepEvtConvertFieldError, "Line %1%: Could not convert field %2%: %3%")
Exception is thrown if a field in the HepEvt file could not be converted to a number.
int m_nVirtual
The number of particles in each event with a set Virtual flag.
Class to represent Particle data in graph.
Class to build, validate and sort a particle decay chain.
Abstract base class for different kinds of events.