10#include <framework/core/FrameworkExceptions.h>
11#include <mdst/dataobjects/MCParticleGraph.h>
16#include "HepMC/GenEvent.h"
41 "Event %1%: Invalid daughter indices d1=%2%, d2=%3%, N=%4% (0<=d1<=d2<=N required)");
52 "Event %1%: Number of particles in event is %2% ! (This could mean EOF is reached.) ");
68 void open(
const std::string& filename);
Class to read HepMC files and store the content in a MCParticle graph.
void readNextEvent(HepMC::GenEvent &evt)
read the next event from the IO stream and write into evt
HepMCReader(const int minEvent=0, const int maxEvent=INT_MAX)
Constructor.
int countEvents(const std::string &filename)
Count events in 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.
BELLE2_DEFINE_EXCEPTION(HepMCConvertFieldError, "Event %1%: Could not convert field %2%: %3%")
Exception is thrown if a field in the HepMC file could not be converted to a number.
const int m_maxEvent
max events to process
BELLE2_DEFINE_EXCEPTION(HepMCEmptyEventError, "Event %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.
~HepMCReader()
Destructor.
BELLE2_DEFINE_EXCEPTION(HepMCHeaderNotValidError, "Event %1%: Event header not understood: %2%")
Exception is thrown if the header specifying the event header could not be parsed.
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.
int nextValidEvent(HepMC::GenEvent &evt)
Got to next event in bounds.
BELLE2_DEFINE_EXCEPTION(HepMCInvalidEventError, "Event is invalid.")
Exception is thrown if the format of a line of the HepMC file could not be parsed.
BELLE2_DEFINE_EXCEPTION(HepMCInvalidDaughterIndicesError, "Event %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(HepMCCouldNotOpenFileError, "Could not open file %1% !")
Exception is thrown if the HepMC file could not be opened.
const int m_minEvent
min event nr to process
int m_nVirtual
The number of particles in each event with a set Virtual flag.
BELLE2_DEFINE_EXCEPTION(HepMCParticleFormatError, "Event %1%: Particle format not understood, got %2% fields !")
Exception is thrown if the format of a line of the HepMC file could not be parsed.
Class to build, validate and sort a particle decay chain.
Abstract base class for different kinds of events.