|
SLIC
6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
|
This singleton is responsible for managing physics event sources. More...
#include <EventSourceManager.hh>
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) | |
This singleton is responsible for managing physics event sources.
Definition at line 25 of file EventSourceManager.hh.
| enum ESourceType |
Enum for different source types.
| Enumerator | |
|---|---|
| eUnknown | |
| eStdHep | |
| eLCIO | |
| eGPS | |
| eParticleGun | |
| eLHE | |
Definition at line 32 of file EventSourceManager.hh.
|
virtual |
Class destructor.
Definition at line 40 of file EventSourceManager.cc.
Class constructor.
Definition at line 26 of file EventSourceManager.cc.
References LOG::always, Module::log(), EventSourceManager::m_messenger, EventSourceManager::m_particleGunSource, and LogStream::setOutputLevel().
|
virtual |
Begin event hook.
| [in] | event | The 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().
|
virtual |
Begin run hook.
| [in] | run | The Geant4 run. |
Reimplemented from Module.
Definition at line 259 of file EventSourceManager.cc.
References RunManager::abortRun(), EventSource::beginRun(), LOG::debug, LOG::done, LOG::fatal, SlicApplication::GENERATOR_NOT_SETUP, RunManager::instance(), Module::log(), EventSourceManager::m_currentEventSource, EventSourceManager::m_newFilename, EventSourceManager::m_ngen, LOG::name, and EventSourceManager::setupEventSource().
| EventSource * createEventSource | ( | ESourceType | st | ) |
Create an event source from a type.
Definition at line 184 of file EventSourceManager.cc.
References LOG::done, EventSourceManager::eGPS, EventSourceManager::eLCIO, EventSourceManager::eLHE, EventSourceManager::eParticleGun, LOG::error, EventSourceManager::eStdHep, EventSourceManager::eUnknown, EventSourceManager::getFilename(), EventSourceManager::getSourceNameFromType(), Module::log(), and EventSourceManager::m_particleGunSource.
Referenced by EventSourceManager::setupEventSource().
| 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().
| void dumpCurrentEvent | ( | ) |
Dump the current event.
Definition at line 147 of file EventSourceManager.cc.
References EventSourceManager::m_currentEventSource, and EventSource::printCurrentEvent().
|
inline |
Definition at line 293 of file EventSourceManager.hh.
References EventSourceManager::m_enablePrintEvent.
Referenced by GeneratorMessenger::SetNewValue().
|
virtual |
End event hook.
| [in] | event | The 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().
|
virtual |
End run hook.
| [in] | run | The Geant4 run. |
Reimplemented from Module.
Definition at line 290 of file EventSourceManager.cc.
References EventSource::endRun(), and EventSourceManager::m_currentEventSource.
| void generate | ( | G4Event * | event | ) |
Generate a Geant4 event.
| [in] | The | target Geant4 event. |
Definition at line 163 of file EventSourceManager.cc.
References LOG::done, LOG::error, EventSource::generate(), EventSourceManager::incrNumEventsGenerated(), EventSourceManager::isEOF(), Module::log(), EventSourceManager::m_currentEventSource, and EventSourceManager::m_filename.
Referenced by EventSourceManager::generateNextEvent().
| void generateNextEvent | ( | G4Event * | evt | ) |
Definition at line 351 of file EventSourceManager.cc.
References EventSourceManager::generate().
Referenced by PrimaryGeneratorAction::GeneratePrimaries().
| EventSource * getCurrentSource | ( | ) |
Get the current event source.
Definition at line 239 of file EventSourceManager.cc.
References EventSourceManager::m_currentEventSource.
| const std::string & getCurrentSourceName | ( | ) |
Get 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().
| EventSourceManager::ESourceType getCurrentSourceType | ( | ) |
Get the current source type.
Definition at line 139 of file EventSourceManager.cc.
References EventSourceManager::m_sourceType.
| const std::string & getFilename | ( | ) |
Get the current file name.
Definition at line 43 of file EventSourceManager.cc.
References EventSourceManager::m_filename.
Referenced by EventSourceManager::createEventSource().
| EventSourceWithInputFile * getFileSource | ( | ) |
Get the source with input file.
Definition at line 321 of file EventSourceManager.cc.
References EventSourceManager::isFileSource(), and EventSourceManager::m_currentEventSource.
| G4GeneralParticleSource * getGPS | ( | ) |
Get the GPS particle source.
Definition at line 329 of file EventSourceManager.cc.
References GPSEventSource::getGPS(), and EventSourceManager::m_currentEventSource.
|
inline |
Get the Lorentz transformation angle.
Definition at line 266 of file EventSourceManager.hh.
References EventSourceManager::m_lorentzTransformationAngle.
| int getNumEventsGenerated | ( | ) |
Get the number of events generated.
Definition at line 155 of file EventSourceManager.cc.
References EventSourceManager::m_ngen.
Referenced by RunManager::BeamOn().
| G4ParticleGun * getParticleGun | ( | ) |
Get the particle gun source.
Definition at line 340 of file EventSourceManager.cc.
References ParticleGunEventSource::getParticleGun(), and EventSourceManager::m_currentEventSource.
| unsigned int getSkipEvents | ( | ) |
Get the number of events to skip.
Definition at line 90 of file EventSourceManager.cc.
References EventSourceManager::m_nskip.
| const std::string & getSourceNameFromType | ( | ESourceType | egt | ) | const |
Get the source name string from a type.
Definition at line 103 of file EventSourceManager.cc.
References EventSourceManager::eGPS, EventSourceManager::eLCIO, EventSourceManager::eLHE, EventSourceManager::eParticleGun, EventSourceManager::eStdHep, EventSourceManager::GPS, EventSourceManager::LCIO, EventSourceManager::LHE, EventSourceManager::PARTICLE_GUN, EventSourceManager::STDHEP, and EventSourceManager::UNKNOWN.
Referenced by EventSourceManager::createEventSource(), and EventSourceManager::getCurrentSourceName().
| EventSourceManager::ESourceType getSourceTypeFromFileExtension | ( | const std::string & | ext | ) |
Determine the source type from a file extension.
| [in] | s | The file extension. |
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().
| EventSourceManager::ESourceType getSourceTypeFromName | ( | const std::string & | name | ) | const |
Get the source type from a name.
| [in] | name | The name of the source. |
Definition at line 119 of file EventSourceManager.cc.
References EventSourceManager::eGPS, EventSourceManager::eLCIO, EventSourceManager::eLHE, EventSourceManager::eParticleGun, EventSourceManager::eStdHep, EventSourceManager::eUnknown, EventSourceManager::GPS, EventSourceManager::LCIO, EventSourceManager::LHE, EventSourceManager::PARTICLE_GUN, and EventSourceManager::STDHEP.
Referenced by EventSourceManager::setSourceType(), and EventSourceManager::setupEventSource().
|
inline |
Get the Z smearing parameter.
Definition at line 289 of file EventSourceManager.hh.
References EventSourceManager::m_zSmearingParam.
| void incrNumEventsGenerated | ( | ) |
Increment the number of events generated.
Definition at line 159 of file EventSourceManager.cc.
References EventSourceManager::m_ngen.
Referenced by EventSourceManager::generate().
| bool isEOF | ( | ) |
Check if end of file has been reached for file-based sources.
Definition at line 298 of file EventSourceManager.cc.
References EventSourceWithInputFile::isEOF(), EventSourceManager::isFileSource(), and EventSourceManager::m_currentEventSource.
Referenced by EventSourceManager::generate(), and PrimaryGeneratorAction::GeneratePrimaries().
| bool isFileSource | ( | ) |
Check if source is file-based.
Definition at line 294 of file EventSourceManager.cc.
References EventSourceManager::eLCIO, EventSourceManager::eStdHep, and EventSourceManager::m_sourceType.
Referenced by EventSourceManager::getFileSource(), and EventSourceManager::isEOF().
| bool isNewFilename | ( | ) |
Check if the filename is different from the previous.
Definition at line 317 of file EventSourceManager.cc.
References EventSourceManager::m_newFilename.
| bool isNewSource | ( | ) |
Check if this is a new source which needs to be setup.
Definition at line 309 of file EventSourceManager.cc.
References EventSourceManager::m_newSource.
Referenced by EventSourceManager::setupEventSource().
| bool isNewSource | ( | ESourceType | est | ) |
Check if this is a new source by type.
Definition at line 313 of file EventSourceManager.cc.
References EventSourceManager::eUnknown, and EventSourceManager::m_sourceType.
| 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().
| 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().
| void setEventSource | ( | EventSource * | eventSource | ) |
Set the current event source.
| [in] | eventSource | The event source. |
Definition at line 172 of file EventSourceManager.cc.
References EventSourceManager::deleteCurrentEventSource(), and EventSourceManager::m_currentEventSource.
| void setFilename | ( | const std::string & | fileName | ) |
Set the current file name.
| [in] | fileName | The file name. |
Definition at line 47 of file EventSourceManager.cc.
References FileUtil::extension(), EventSourceManager::getSourceTypeFromFileExtension(), EventSourceManager::m_fileIsSet, EventSourceManager::m_filename, EventSourceManager::m_newFilename, and EventSourceManager::setupEventSource().
Referenced by GeneratorMessenger::SetNewValue().
| void setLorentzTransformationAngle | ( | const G4double | angle | ) |
Set the Lorentz transformation angle.
| [in] | angle | The Lorentz transformation angle. |
Definition at line 355 of file EventSourceManager.cc.
References LOG::always, LOG::done, Module::log(), and EventSourceManager::m_lorentzTransformationAngle.
| void setSkipEvents | ( | unsigned int | n | ) |
Set the number of events to skip.
| [in] | n | The number of events to skip. |
Definition at line 86 of file EventSourceManager.cc.
References EventSourceManager::m_nskip.
Referenced by GeneratorMessenger::SetNewValue().
| void setSourceType | ( | const std::string & | s | ) |
Set the source type to use.
| [in] | est | The event source type string. |
Definition at line 94 of file EventSourceManager.cc.
References EventSourceManager::getSourceTypeFromName(), and EventSourceManager::setSourceType().
| void setSourceType | ( | ESourceType | est | ) |
Set the source type to use.
| [in] | est | The event source type. |
Definition at line 98 of file EventSourceManager.cc.
References EventSourceManager::m_newSource, and EventSourceManager::m_sourceType.
Referenced by EventSourceManager::setSourceType().
| void setupEventSource | ( | ) |
Setup the current event source.
Definition at line 283 of file EventSourceManager.cc.
References EventSourceManager::createEventSource(), EventSourceManager::m_currentEventSource, EventSourceManager::m_newSource, and EventSourceManager::m_sourceType.
Referenced by EventSourceManager::beginRun(), EventSourceManager::setFilename(), GeneratorMessenger::SetNewValue(), and EventSourceManager::setupEventSource().
| void setupEventSource | ( | const std::string & | sourceType | ) |
Setup an event source from a type string.
| [in] | sourceType | The event source type string. |
Definition at line 230 of file EventSourceManager.cc.
References LogStream::error(), EventSourceManager::eUnknown, EventSourceManager::getSourceTypeFromName(), Module::log(), and EventSourceManager::setupEventSource().
| void setupEventSource | ( | ESourceType | sourceType | ) |
Setup an event source from a type.
| [in] | sourceType | The event source type. |
Definition at line 205 of file EventSourceManager.cc.
References EventSourceManager::createEventSource(), EventSourceManager::deleteCurrentEventSource(), EventSourceManager::eUnknown, EventSourceManager::getCurrentSourceName(), EventSourceManager::isNewSource(), Module::log(), EventSourceManager::m_currentEventSource, EventSourceManager::m_sourceType, LogStream::okay(), and LogStream::warning().
|
inline |
Set the Z smearing parameter.
| [in] | zSmear | The Z smearing parameter. |
Definition at line 280 of file EventSourceManager.hh.
References EventSourceManager::m_zSmearingParam.
|
staticprivate |
Definition at line 329 of file EventSourceManager.hh.
Referenced by EventSourceManager::getSourceNameFromType(), and EventSourceManager::getSourceTypeFromName().
|
staticprivate |
Definition at line 328 of file EventSourceManager.hh.
Referenced by EventSourceManager::getSourceNameFromType(), and EventSourceManager::getSourceTypeFromName().
|
staticprivate |
Definition at line 331 of file EventSourceManager.hh.
Referenced by EventSourceManager::getSourceNameFromType(), and EventSourceManager::getSourceTypeFromName().
|
private |
current event source
Definition at line 307 of file EventSourceManager.hh.
Referenced by EventSourceManager::beginEvent(), EventSourceManager::beginRun(), EventSourceManager::deleteCurrentEventSource(), EventSourceManager::dumpCurrentEvent(), EventSourceManager::endEvent(), EventSourceManager::endRun(), EventSourceManager::generate(), EventSourceManager::getCurrentSource(), EventSourceManager::getFileSource(), EventSourceManager::getGPS(), EventSourceManager::getParticleGun(), EventSourceManager::isEOF(), EventSourceManager::resetCurrentEventSource(), EventSourceManager::setEventSource(), and EventSourceManager::setupEventSource().
|
private |
Definition at line 343 of file EventSourceManager.hh.
Referenced by EventSourceManager::enablePrintEvent(), and EventSourceManager::endEvent().
|
private |
Definition at line 314 of file EventSourceManager.hh.
Referenced by EventSourceManager::setFilename().
|
private |
Definition at line 313 of file EventSourceManager.hh.
Referenced by EventSourceManager::generate(), EventSourceManager::getFilename(), EventSourceManager::getSourceTypeFromFileExtension(), and EventSourceManager::setFilename().
|
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().
|
private |
generator messenger
Definition at line 304 of file EventSourceManager.hh.
Referenced by EventSourceManager::EventSourceManager().
|
private |
Definition at line 315 of file EventSourceManager.hh.
Referenced by EventSourceManager::beginRun(), EventSourceManager::isNewFilename(), and EventSourceManager::setFilename().
|
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().
|
private |
num events generated on current generator
Definition at line 318 of file EventSourceManager.hh.
Referenced by EventSourceManager::beginRun(), EventSourceManager::getNumEventsGenerated(), EventSourceManager::incrNumEventsGenerated(), EventSourceManager::printNumEventsGenerated(), and EventSourceManager::resetCurrentEventSource().
|
private |
num events to skip
Definition at line 321 of file EventSourceManager.hh.
Referenced by EventSourceManager::getSkipEvents(), and EventSourceManager::setSkipEvents().
|
private |
ParticleGun source. Always enabled.
Definition at line 310 of file EventSourceManager.hh.
Referenced by EventSourceManager::EventSourceManager(), and EventSourceManager::createEventSource().
|
private |
source type
Definition at line 335 of file EventSourceManager.hh.
Referenced by EventSourceManager::getCurrentSourceName(), EventSourceManager::getCurrentSourceType(), EventSourceManager::isFileSource(), EventSourceManager::isNewSource(), EventSourceManager::setSourceType(), and EventSourceManager::setupEventSource().
|
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().
|
staticprivate |
Definition at line 330 of file EventSourceManager.hh.
Referenced by EventSourceManager::getSourceNameFromType(), and EventSourceManager::getSourceTypeFromName().
|
staticprivate |
Definition at line 327 of file EventSourceManager.hh.
Referenced by EventSourceManager::getSourceNameFromType(), and EventSourceManager::getSourceTypeFromName().
|
staticprivate |
Definition at line 332 of file EventSourceManager.hh.
Referenced by EventSourceManager::getSourceNameFromType().