SLIC  6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
Public Types | Public Member Functions | Private Attributes | Static Private Attributes | List of all members
EventSourceManager Class Reference

This singleton is responsible for managing physics event sources. More...

#include <EventSourceManager.hh>

Inheritance diagram for EventSourceManager:
Module Singleton< EventSourceManager >

Public Types

enum  ESourceType {
  eUnknown = 0 , eStdHep , eLCIO , eGPS ,
  eParticleGun , eLHE
}
 
- Public Types inherited from Module
enum  ModuleStatus { eOkay = 0 , eNotInitialized = 1 , eBadState = 2 , eFatalError = 3 }
 

Public Member Functions

 EventSourceManager ()
 
virtual ~EventSourceManager ()
 
void beginEvent (const G4Event *event)
 
void beginRun (const G4Run *run)
 
EventSource * createEventSource (ESourceType st)
 
void deleteCurrentEventSource ()
 
void dumpCurrentEvent ()
 
void enablePrintEvent (G4bool enable)
 
void endEvent (const G4Event *event)
 
void endRun (const G4Run *run)
 
void generate (G4Event *event)
 
void generateNextEvent (G4Event *evt)
 
EventSource * getCurrentSource ()
 
const std::string & getCurrentSourceName ()
 
ESourceType getCurrentSourceType ()
 
const std::string & getFilename ()
 
EventSourceWithInputFile * getFileSource ()
 
G4GeneralParticleSource * getGPS ()
 
double getLorentzTransformationAngle ()
 
int getNumEventsGenerated ()
 
G4ParticleGun * getParticleGun ()
 
unsigned int getSkipEvents ()
 
const std::string & getSourceNameFromType (ESourceType egt) const
 
ESourceType getSourceTypeFromFileExtension (const std::string &ext)
 
ESourceType getSourceTypeFromName (const std::string &name) const
 
G4double getZSmearing ()
 
void incrNumEventsGenerated ()
 
bool isEOF ()
 
bool isFileSource ()
 
bool isNewFilename ()
 
bool isNewSource ()
 
bool isNewSource (ESourceType est)
 
void printNumEventsGenerated ()
 
void resetCurrentEventSource ()
 
void setEventSource (EventSource *eventSource)
 
void setFilename (const std::string &fileName)
 
void setLorentzTransformationAngle (const G4double angle)
 
void setSkipEvents (unsigned int n)
 
void setSourceType (const std::string &s)
 
void setSourceType (ESourceType est)
 
void setupEventSource ()
 
void setupEventSource (const std::string &sourceType)
 
void setupEventSource (ESourceType sourceType)
 
void setZSmearing (const G4double zSmear)
 
- Public Member Functions inherited from Module
virtual ~Module ()
 
virtual void cleanup ()
 
bool deleteOnExit ()
 
const std::string & getName () const
 
ModuleStatus getStatus () const
 
virtual void initialize ()
 
LogStream & log ()
 
virtual void postTracking (const G4Track *)
 
virtual void preTracking (const G4Track *)
 
virtual void reset ()
 
virtual void stepping (const G4Step *)
 
- Public Member Functions inherited from Singleton< EventSourceManager >
 Singleton ()
 
 ~Singleton ()
 
void release ()
 

Private Attributes

EventSource * m_currentEventSource
 
G4bool m_enablePrintEvent
 
bool m_fileIsSet
 
std::string m_filename
 
G4double m_lorentzTransformationAngle
 
GeneratorMessenger * m_messenger
 
bool m_newFilename
 
bool m_newSource
 
int m_ngen
 
unsigned int m_nskip
 
EventSource * m_particleGunSource
 
ESourceType m_sourceType
 
G4double m_zSmearingParam
 

Static Private Attributes

static std::string GPS = std::string("gps")
 
static std::string LCIO = std::string("lcio")
 
static std::string LHE = std::string("lhe")
 
static std::string PARTICLE_GUN = std::string("gun")
 
static std::string STDHEP = std::string("stdhep")
 
static std::string UNKNOWN = std::string("unknown")
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< EventSourceManager >
static EventSourceManager * instance ()
 
- Public Attributes inherited from Module
bool m_deleteOnExit
 
LogStream * m_log
 
std::string m_name
 
ModuleStatus m_status
 
- Protected Member Functions inherited from Module
 Module (const std::string &name, bool deleteOnExit=true, bool autoRegister=true)
 

Detailed Description

This singleton is responsible for managing physics event sources.

Definition at line 25 of file EventSourceManager.hh.

Member Enumeration Documentation

◆ ESourceType

Enum for different source types.

Enumerator
eUnknown 
eStdHep 
eLCIO 
eGPS 
eParticleGun 
eLHE 

Definition at line 32 of file EventSourceManager.hh.

Constructor & Destructor Documentation

◆ ~EventSourceManager()

~EventSourceManager ( )
virtual

Class destructor.

Definition at line 40 of file EventSourceManager.cc.

◆ EventSourceManager()

Member Function Documentation

◆ beginEvent()

void beginEvent ( const G4Event *  event)
virtual

Begin event hook.

Parameters
[in]eventThe Geant4 event.

Reimplemented from Module.

Definition at line 243 of file EventSourceManager.cc.

References EventSource::beginEvent(), EventAction::getEventAction(), EventSourceManager::m_currentEventSource, and EventAction::startEventTimer().

Referenced by PrimaryGeneratorAction::GeneratePrimaries().

◆ beginRun()

void beginRun ( const G4Run *  run)
virtual

◆ createEventSource()

EventSource * createEventSource ( ESourceType  st)

◆ deleteCurrentEventSource()

void deleteCurrentEventSource ( )

Delete the current event source.

Definition at line 177 of file EventSourceManager.cc.

References EventSourceManager::m_currentEventSource.

Referenced by EventSourceManager::setEventSource(), and EventSourceManager::setupEventSource().

◆ dumpCurrentEvent()

void dumpCurrentEvent ( )

Dump the current event.

Definition at line 147 of file EventSourceManager.cc.

References EventSourceManager::m_currentEventSource, and EventSource::printCurrentEvent().

◆ enablePrintEvent()

void enablePrintEvent ( G4bool  enable)
inline

◆ endEvent()

void endEvent ( const G4Event *  event)
virtual

End event hook.

Parameters
[in]eventThe Geant4 event.

Reimplemented from Module.

Definition at line 251 of file EventSourceManager.cc.

References EventSource::endEvent(), EventSourceManager::m_currentEventSource, EventSourceManager::m_enablePrintEvent, and EventSource::printCurrentEvent().

◆ endRun()

void endRun ( const G4Run *  run)
virtual

End run hook.

Parameters
[in]runThe Geant4 run.

Reimplemented from Module.

Definition at line 290 of file EventSourceManager.cc.

References EventSource::endRun(), and EventSourceManager::m_currentEventSource.

◆ generate()

void generate ( G4Event *  event)

◆ generateNextEvent()

void generateNextEvent ( G4Event *  evt)

◆ getCurrentSource()

EventSource * getCurrentSource ( )

Get the current event source.

Returns
The current event source.

Definition at line 239 of file EventSourceManager.cc.

References EventSourceManager::m_currentEventSource.

◆ getCurrentSourceName()

const std::string & getCurrentSourceName ( )

Get the name of the current source.

Returns
The name of the current source.

Definition at line 143 of file EventSourceManager.cc.

References EventSourceManager::getSourceNameFromType(), and EventSourceManager::m_sourceType.

Referenced by EventSourceManager::setupEventSource().

◆ getCurrentSourceType()

EventSourceManager::ESourceType getCurrentSourceType ( )

Get the current source type.

Returns
The current source type.

Definition at line 139 of file EventSourceManager.cc.

References EventSourceManager::m_sourceType.

◆ getFilename()

const std::string & getFilename ( )

Get the current file name.

Returns
The file name.

Definition at line 43 of file EventSourceManager.cc.

References EventSourceManager::m_filename.

Referenced by EventSourceManager::createEventSource().

◆ getFileSource()

EventSourceWithInputFile * getFileSource ( )

Get the source with input file.

Returns
The source with an input file.

Definition at line 321 of file EventSourceManager.cc.

References EventSourceManager::isFileSource(), and EventSourceManager::m_currentEventSource.

◆ getGPS()

G4GeneralParticleSource * getGPS ( )

Get the GPS particle source.

Returns
The GPS particle source.

Definition at line 329 of file EventSourceManager.cc.

References GPSEventSource::getGPS(), and EventSourceManager::m_currentEventSource.

◆ getLorentzTransformationAngle()

double getLorentzTransformationAngle ( )
inline

Get the Lorentz transformation angle.

Returns
The Lorentz transformation angle.

Definition at line 266 of file EventSourceManager.hh.

References EventSourceManager::m_lorentzTransformationAngle.

◆ getNumEventsGenerated()

int getNumEventsGenerated ( )

Get the number of events generated.

Returns
The number of events generated.

Definition at line 155 of file EventSourceManager.cc.

References EventSourceManager::m_ngen.

Referenced by RunManager::BeamOn().

◆ getParticleGun()

G4ParticleGun * getParticleGun ( )

Get the particle gun source.

Returns
The particle gun source.

Definition at line 340 of file EventSourceManager.cc.

References ParticleGunEventSource::getParticleGun(), and EventSourceManager::m_currentEventSource.

◆ getSkipEvents()

unsigned int getSkipEvents ( )

Get the number of events to skip.

Returns
The number of events to skip.

Definition at line 90 of file EventSourceManager.cc.

References EventSourceManager::m_nskip.

◆ getSourceNameFromType()

const std::string & getSourceNameFromType ( ESourceType  egt) const

◆ getSourceTypeFromFileExtension()

EventSourceManager::ESourceType getSourceTypeFromFileExtension ( const std::string &  ext)

Determine the source type from a file extension.

Parameters
[in]sThe file extension.
Returns
The event source type.

Definition at line 62 of file EventSourceManager.cc.

References LOG::done, EventSourceManager::eLCIO, EventSourceManager::eLHE, LOG::error, EventSourceManager::eStdHep, EventSourceManager::eUnknown, Module::log(), and EventSourceManager::m_filename.

Referenced by EventSourceManager::setFilename().

◆ getSourceTypeFromName()

EventSourceManager::ESourceType getSourceTypeFromName ( const std::string &  name) const

◆ getZSmearing()

G4double getZSmearing ( )
inline

Get the Z smearing parameter.

Returns
The Z smearing parameter.

Definition at line 289 of file EventSourceManager.hh.

References EventSourceManager::m_zSmearingParam.

◆ incrNumEventsGenerated()

void incrNumEventsGenerated ( )

Increment the number of events generated.

Definition at line 159 of file EventSourceManager.cc.

References EventSourceManager::m_ngen.

Referenced by EventSourceManager::generate().

◆ isEOF()

bool isEOF ( )

Check if end of file has been reached for file-based sources.

Returns
True if end of file has been reached; false if not.

Definition at line 298 of file EventSourceManager.cc.

References EventSourceWithInputFile::isEOF(), EventSourceManager::isFileSource(), and EventSourceManager::m_currentEventSource.

Referenced by EventSourceManager::generate(), and PrimaryGeneratorAction::GeneratePrimaries().

◆ isFileSource()

bool isFileSource ( )

Check if source is file-based.

Returns
True if source is file-based; false if not.

Definition at line 294 of file EventSourceManager.cc.

References EventSourceManager::eLCIO, EventSourceManager::eStdHep, and EventSourceManager::m_sourceType.

Referenced by EventSourceManager::getFileSource(), and EventSourceManager::isEOF().

◆ isNewFilename()

bool isNewFilename ( )

Check if the filename is different from the previous.

Returns
True if file name is new; false if not.

Definition at line 317 of file EventSourceManager.cc.

References EventSourceManager::m_newFilename.

◆ isNewSource() [1/2]

bool isNewSource ( )

Check if this is a new source which needs to be setup.

Returns
True if source is new for the run; false if not.

Definition at line 309 of file EventSourceManager.cc.

References EventSourceManager::m_newSource.

Referenced by EventSourceManager::setupEventSource().

◆ isNewSource() [2/2]

bool isNewSource ( ESourceType  est)

Check if this is a new source by type.

Returns
True if source type is new for the run; false if not.

Definition at line 313 of file EventSourceManager.cc.

References EventSourceManager::eUnknown, and EventSourceManager::m_sourceType.

◆ printNumEventsGenerated()

void printNumEventsGenerated ( )

Print the number of events generated.

Definition at line 151 of file EventSourceManager.cc.

References LOG::done, LOG::head, Module::log(), EventSourceManager::m_ngen, and LOG::okay.

Referenced by RunManager::BeamOn(), and GeneratorMessenger::SetNewValue().

◆ resetCurrentEventSource()

void resetCurrentEventSource ( )

Reset the current event source.

Definition at line 81 of file EventSourceManager.cc.

References EventSourceManager::m_currentEventSource, EventSourceManager::m_ngen, and EventSource::reset().

Referenced by GeneratorMessenger::SetNewValue().

◆ setEventSource()

void setEventSource ( EventSource *  eventSource)

Set the current event source.

Parameters
[in]eventSourceThe event source.

Definition at line 172 of file EventSourceManager.cc.

References EventSourceManager::deleteCurrentEventSource(), and EventSourceManager::m_currentEventSource.

◆ setFilename()

void setFilename ( const std::string &  fileName)

◆ setLorentzTransformationAngle()

void setLorentzTransformationAngle ( const G4double  angle)

Set the Lorentz transformation angle.

Parameters
[in]angleThe Lorentz transformation angle.

Definition at line 355 of file EventSourceManager.cc.

References LOG::always, LOG::done, Module::log(), and EventSourceManager::m_lorentzTransformationAngle.

◆ setSkipEvents()

void setSkipEvents ( unsigned int  n)

Set the number of events to skip.

Parameters
[in]nThe number of events to skip.

Definition at line 86 of file EventSourceManager.cc.

References EventSourceManager::m_nskip.

Referenced by GeneratorMessenger::SetNewValue().

◆ setSourceType() [1/2]

void setSourceType ( const std::string &  s)

Set the source type to use.

Parameters
[in]estThe event source type string.

Definition at line 94 of file EventSourceManager.cc.

References EventSourceManager::getSourceTypeFromName(), and EventSourceManager::setSourceType().

◆ setSourceType() [2/2]

void setSourceType ( ESourceType  est)

Set the source type to use.

Parameters
[in]estThe event source type.

Definition at line 98 of file EventSourceManager.cc.

References EventSourceManager::m_newSource, and EventSourceManager::m_sourceType.

Referenced by EventSourceManager::setSourceType().

◆ setupEventSource() [1/3]

void setupEventSource ( )

◆ setupEventSource() [2/3]

void setupEventSource ( const std::string &  sourceType)

Setup an event source from a type string.

Parameters
[in]sourceTypeThe event source type string.

Definition at line 230 of file EventSourceManager.cc.

References LogStream::error(), EventSourceManager::eUnknown, EventSourceManager::getSourceTypeFromName(), Module::log(), and EventSourceManager::setupEventSource().

◆ setupEventSource() [3/3]

void setupEventSource ( ESourceType  sourceType)

◆ setZSmearing()

void setZSmearing ( const G4double  zSmear)
inline

Set the Z smearing parameter.

Parameters
[in]zSmearThe Z smearing parameter.

Definition at line 280 of file EventSourceManager.hh.

References EventSourceManager::m_zSmearingParam.

Member Data Documentation

◆ GPS

std::string GPS = std::string("gps")
staticprivate

◆ LCIO

std::string LCIO = std::string("lcio")
staticprivate

◆ LHE

std::string LHE = std::string("lhe")
staticprivate

◆ m_currentEventSource

EventSource* m_currentEventSource
private

◆ m_enablePrintEvent

G4bool m_enablePrintEvent
private

◆ m_fileIsSet

bool m_fileIsSet
private

Definition at line 314 of file EventSourceManager.hh.

Referenced by EventSourceManager::setFilename().

◆ m_filename

std::string m_filename
private

◆ m_lorentzTransformationAngle

G4double m_lorentzTransformationAngle
private

Lorentz transformation angle which will be applied to event.

Definition at line 338 of file EventSourceManager.hh.

Referenced by EventSourceManager::getLorentzTransformationAngle(), and EventSourceManager::setLorentzTransformationAngle().

◆ m_messenger

GeneratorMessenger* m_messenger
private

generator messenger

Definition at line 304 of file EventSourceManager.hh.

Referenced by EventSourceManager::EventSourceManager().

◆ m_newFilename

bool m_newFilename
private

◆ m_newSource

bool m_newSource
private

need to setup a new source new run?

Definition at line 324 of file EventSourceManager.hh.

Referenced by EventSourceManager::isNewSource(), EventSourceManager::setSourceType(), and EventSourceManager::setupEventSource().

◆ m_ngen

int m_ngen
private

◆ m_nskip

unsigned int m_nskip
private

num events to skip

Definition at line 321 of file EventSourceManager.hh.

Referenced by EventSourceManager::getSkipEvents(), and EventSourceManager::setSkipEvents().

◆ m_particleGunSource

EventSource* m_particleGunSource
private

ParticleGun source. Always enabled.

Definition at line 310 of file EventSourceManager.hh.

Referenced by EventSourceManager::EventSourceManager(), and EventSourceManager::createEventSource().

◆ m_sourceType

ESourceType m_sourceType
private

◆ m_zSmearingParam

G4double m_zSmearingParam
private

Parameter which will be used to smear vertex Z position.

Definition at line 341 of file EventSourceManager.hh.

Referenced by EventSourceManager::getZSmearing(), and EventSourceManager::setZSmearing().

◆ PARTICLE_GUN

std::string PARTICLE_GUN = std::string("gun")
staticprivate

◆ STDHEP

std::string STDHEP = std::string("stdhep")
staticprivate

◆ UNKNOWN

std::string UNKNOWN = std::string("unknown")
staticprivate

Definition at line 332 of file EventSourceManager.hh.

Referenced by EventSourceManager::getSourceNameFromType().


The documentation for this class was generated from the following files: