15 #include "lcdd/util/StringUtil.hh"
27 Module(
"EventSourceManager"), m_currentEventSource(0), m_filename(
""), m_fileIsSet(false),
28 m_newFilename(false), m_ngen(0), m_nskip(0), m_newSource(true), m_sourceType(eUnknown),
29 m_lorentzTransformationAngle(0.), m_zSmearingParam(0.), m_enablePrintEvent(false) {
66 if (fext ==
"slcio") {
70 else if (fext ==
"stdhep" || fext ==
"xdr") {
73 }
else if (fext ==
"lhe") {
106 }
else if (egt ==
eLCIO) {
108 }
else if (egt ==
eGPS) {
112 }
else if (egt ==
eLHE) {
120 std::string sl = StringUtil::toLower(s);
126 }
else if (sl ==
GPS) {
130 }
else if (sl ==
LCIO) {
132 }
else if (sl ==
LHE) {
190 }
else if (st ==
eGPS) {
194 }
else if (st ==
eLHE) {
223 log().
warning(
"Type of new event source is same as old; keeping old source.");
226 G4Exception(
"",
"", JustWarning,
"Event Source type is unknown.");
235 log().
error(
"The name <" + s +
"> is not a valid event source. New source was NOT created.");
332 G4GeneralParticleSource* gps = 0;
343 G4ParticleGun* gun = 0;
static EventAction * getEventAction()
virtual ~EventSourceManager()
static std::string PARTICLE_GUN
void endRun(const G4Run *run)
const std::string & getCurrentSourceName()
const std::string & getSourceNameFromType(ESourceType egt) const
static std::string STDHEP
void setFilename(const std::string &fileName)
ESourceType getSourceTypeFromName(const std::string &name) const
EventSource * getCurrentSource()
void resetCurrentEventSource()
const std::string & getFilename()
void setLorentzTransformationAngle(const G4double angle)
GeneratorMessenger * m_messenger
void deleteCurrentEventSource()
int getNumEventsGenerated()
void generateNextEvent(G4Event *evt)
G4GeneralParticleSource * getGPS()
void setEventSource(EventSource *eventSource)
unsigned int getSkipEvents()
void incrNumEventsGenerated()
void printNumEventsGenerated()
EventSource * m_currentEventSource
EventSource * m_particleGunSource
G4ParticleGun * getParticleGun()
void beginRun(const G4Run *run)
G4double m_lorentzTransformationAngle
ESourceType getSourceTypeFromFileExtension(const std::string &ext)
EventSource * createEventSource(ESourceType st)
static std::string UNKNOWN
void beginEvent(const G4Event *event)
void generate(G4Event *event)
G4bool m_enablePrintEvent
void endEvent(const G4Event *event)
ESourceType getCurrentSourceType()
void setSkipEvents(unsigned int n)
EventSourceWithInputFile * getFileSource()
void setSourceType(ESourceType est)
The virtual base class for a physics event source such as a StdHep file.
virtual void endRun(const G4Run *run)
virtual void generate(G4Event *event)=0
virtual void beginRun(const G4Run *run)
virtual void printCurrentEvent()=0
virtual void beginEvent(const G4Event *event)
virtual void endEvent(const G4Event *event)
static std::string extension(std::string filename)
Wrapper for Geant4's general particle source.
G4GeneralParticleSource * getGPS()
Geant4 commands related to event generation.
Top-level controller of LHE input.
Generates events from the MCParticle collection of an LCIO file.
void setOutputLevel(const LOG::ELevel &outputLevel)
Base class for slic code modules that provides common functionality, such as logging to an output str...
Wrapper for the Geant4 particle gun.
G4ParticleGun * getParticleGun()
static RunManager * instance()
Top-level controller of StdHep input.