|
SLIC
6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
|
Singleton manager class of LCIO configuration and output file operations. More...
#include <LcioManager.hh>
Public Types | |
| enum | EFileExistsAction { eInvalid = -1 , eFail = 0 , eDelete = 1 , eAppend = 2 } |
Public Types inherited from Module | |
| enum | ModuleStatus { eOkay = 0 , eNotInitialized = 1 , eBadState = 2 , eFatalError = 3 } |
Public Member Functions | |
| LcioManager () | |
| virtual | ~LcioManager () |
| void | addCollection (EVENT::LCCollection *collection, const std::string &name) |
| void | addCollection (EVENT::LCEvent *lcevent, EVENT::LCCollection *collection, const std::string &name) |
| void | beginRun (const G4Run *run) |
| IMPL::LCEventImpl * | createLCEvent () |
| IMPL::LCEventImpl * | createLCEvent (const G4Event *anEvent) |
| void | enableDumpEvent (bool p=true) |
| void | endEvent (const G4Event *anEvent) |
| void | endRun (const G4Run *run) |
| IMPL::LCEventImpl * | getCurrentLCEvent () |
| EFileExistsAction | getFileExistsAction () |
| LcioFileNamer * | getFileNamer () |
| std::string | getFullOutputPath (bool withExtension=false) |
| LcioHitsCollectionBuilder * | getHitsCollectionBuilder () |
| G4bool | getWriteCompleteEvent () |
| void | openLcioFile () |
| void | setAutonameFields (const std::vector< std::string > &fields) |
| void | setCurrentLCEvent (IMPL::LCEventImpl *anLCEvent) |
| void | setFileExistsAction (EFileExistsAction fea) |
| void | setFilename (const std::string &filename) |
| void | setPath (const std::string &path) |
| void | setRunNumber (int runNumber) |
| void | setStoreMomentum (bool s=true) |
| void | setWriteCompleteEvent (G4bool writeCompleteEvent) |
Public Member Functions inherited from Module | |
| virtual | ~Module () |
| virtual void | beginEvent (const G4Event *) |
| 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< LcioManager > | |
| Singleton () | |
| ~Singleton () | |
| void | release () |
Static Public Member Functions | |
| static EFileExistsAction | getFileExistsActionFromString (const std::string &fileExists) |
Static Public Member Functions inherited from Singleton< LcioManager > | |
| static LcioManager * | instance () |
Private Member Functions | |
| void | addActiveSubdetectors () |
| void | createHitsCollections () |
| void | createRunHeader (const G4Run *run) |
| void | createWriter () |
| void | deleteRunHeader () |
| void | deleteWriter () |
| void | makeAutoname () |
| void | setDetectorName () |
| void | setEventTimeStamp () |
Private Attributes | |
| bool | _writeCompleteEvent |
| std::vector< std::string > | m_currentAutonameFields |
| IMPL::LCEventImpl * | m_currentLCEvent |
| bool | m_enableDumpEvent |
| EFileExistsAction | m_fileExistsAction |
| std::string | m_filename |
| LcioHitsCollectionBuilder * | m_HCBuilder |
| LcioMessenger * | m_messenger |
| LcioFileNamer * | m_namer |
| std::string | m_path |
| IMPL::LCRunHeaderImpl * | m_runHdr |
| int | m_runNumber |
| bool | m_usingAutoname |
| IO::LCWriter * | m_writer |
| bool | m_writerIsOpen |
Static Private Attributes | |
| static std::string | m_defaultFileName = "slicEvents" |
Additional Inherited Members | |
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) | |
Singleton manager class of LCIO configuration and output file operations.
Definition at line 45 of file LcioManager.hh.
| enum EFileExistsAction |
Enum for setting what action to take when an output LCIO file already exists.
| Enumerator | |
|---|---|
| eInvalid | |
| eFail | |
| eDelete | |
| eAppend | |
Definition at line 52 of file LcioManager.hh.
| LcioManager | ( | ) |
Class constructor.
Definition at line 53 of file LcioManager.cc.
References LcioManager::createWriter(), LcioManager::m_defaultFileName, LcioManager::m_filename, LcioManager::m_HCBuilder, LcioManager::m_messenger, and LcioManager::m_namer.
|
virtual |
Class destructor.
Definition at line 72 of file LcioManager.cc.
References LcioManager::deleteWriter(), and LcioManager::m_messenger.
|
private |
Add the list of active subdetectors into the event header.
Definition at line 270 of file LcioManager.cc.
References LcioManager::m_runHdr.
Referenced by LcioManager::createRunHeader().
| void addCollection | ( | EVENT::LCCollection * | collection, |
| const std::string & | name | ||
| ) |
Add a collection the current LCEvent.
| [in] | The | collection. |
Definition at line 393 of file LcioManager.cc.
References LcioManager::getCurrentLCEvent().
| void addCollection | ( | EVENT::LCEvent * | lcevent, |
| EVENT::LCCollection * | collection, | ||
| const std::string & | name | ||
| ) |
Add a collection to the LCEvent.
| [in] | lcsevent | The LCEvent. |
| [in] | collection | The collection. |
| [in] | name | The name of the collection. |
Definition at line 389 of file LcioManager.cc.
|
virtual |
Begin of run hook.
| [in] | run | The run. |
Reimplemented from Module.
Definition at line 189 of file LcioManager.cc.
References LcioManager::createRunHeader(), RunManager::instance(), LcioManager::m_runHdr, LcioManager::m_runNumber, LcioManager::m_usingAutoname, LcioManager::m_writer, LcioManager::makeAutoname(), and LcioManager::openLcioFile().
|
private |
Create the hits collections using the current set of objects.
Definition at line 385 of file LcioManager.cc.
References LcioHitsCollectionBuilder::createHitCollectionsFromEvent(), LcioManager::m_currentLCEvent, and LcioManager::m_HCBuilder.
Referenced by LcioManager::endEvent().
| LCEventImpl * createLCEvent | ( | ) |
Create the LCEvent from the current G4Event.
Definition at line 353 of file LcioManager.cc.
| LCEventImpl * createLCEvent | ( | const G4Event * | anEvent | ) |
Create the LCEvent from the G4Event.
| [in] | anEvent | The input G4Event. |
Definition at line 317 of file LcioManager.cc.
References Singleton< MCParticleManager >::instance(), LcioManager::m_runHdr, and LcioManager::setCurrentLCEvent().
|
private |
Create the run header from the Geant4 run.
| [in] | run | The Geant4 run. |
Definition at line 240 of file LcioManager.cc.
References LcioManager::addActiveSubdetectors(), LcioManager::m_runHdr, LcioManager::m_runNumber, and LcioManager::setDetectorName().
Referenced by LcioManager::beginRun().
|
private |
Create the output LCWriter.
Definition at line 149 of file LcioManager.cc.
References LcioManager::m_writer.
Referenced by LcioManager::LcioManager().
|
private |
Delete the current run header.
Definition at line 263 of file LcioManager.cc.
References LcioManager::m_runHdr.
Referenced by LcioManager::endRun().
|
private |
Delete the current LCWriter.
Definition at line 153 of file LcioManager.cc.
References LcioManager::m_writer, and LcioManager::m_writerIsOpen.
Referenced by LcioManager::~LcioManager().
|
inline |
Enable dump event output for debugging.
| [in] | The | dump event setting. |
Definition at line 222 of file LcioManager.hh.
References LcioManager::m_enableDumpEvent.
Referenced by LcioMessenger::SetNewValue().
|
virtual |
End of event hook to write out an LCIO file.
| [in] | The | physics event. |
Reimplemented from Module.
Definition at line 357 of file LcioManager.cc.
References LcioManager::createHitsCollections(), LcioManager::m_currentLCEvent, LcioManager::m_enableDumpEvent, LcioManager::m_writer, and LcioManager::setEventTimeStamp().
|
virtual |
End of run hook.
| [in] | run | The run. |
Reimplemented from Module.
Definition at line 221 of file LcioManager.cc.
References LcioManager::deleteRunHeader(), LcioManager::eAppend, SlicApplication::eInteractive, RunManager::instance(), Singleton< SlicApplication >::instance(), LcioManager::m_fileExistsAction, LcioManager::m_writer, and LcioManager::m_writerIsOpen.
|
inline |
Get the current LCEvent.
Definition at line 167 of file LcioManager.hh.
References LcioManager::m_currentLCEvent.
Referenced by LcioManager::addCollection(), and LcioManager::setEventTimeStamp().
|
inline |
Get the file exists action.
Definition at line 198 of file LcioManager.hh.
References LcioManager::m_fileExistsAction.
|
static |
Get the FileExists enum value from a string.
| [in] | fileExists | The file exists string. |
Definition at line 130 of file LcioManager.cc.
References LcioManager::eAppend, LcioManager::eDelete, LcioManager::eFail, and LcioManager::eInvalid.
Referenced by LcioMessenger::SetNewValue().
|
inline |
Get the LcioFileNamer for automatically naming output files.
Definition at line 214 of file LcioManager.hh.
References LcioManager::m_namer.
| string getFullOutputPath | ( | bool | withExtension = false | ) |
Get the path plus the filename and optionally include the extension.
| [in] | withExtension | Whether or not to include the file extension. |
Definition at line 167 of file LcioManager.cc.
References LcioManager::m_filename, and LcioManager::m_path.
Referenced by LcioManager::openLcioFile().
|
inline |
Get the LcioHitsCollectionBuilder for creating output hit collections.
Definition at line 206 of file LcioManager.hh.
References LcioManager::m_HCBuilder.
Referenced by LcioMessenger::SetNewValue().
|
inline |
Definition at line 234 of file LcioManager.hh.
References LcioManager::_writeCompleteEvent.
|
private |
Make the LCIO output file name using the LcioFileNamer.
Definition at line 306 of file LcioManager.cc.
References Module::log(), LcioManager::m_currentAutonameFields, LcioManager::m_defaultFileName, LcioManager::m_namer, LcioFileNamer::makeFileName(), LogStream::okay(), LcioManager::setFilename(), and LogStream::warning().
Referenced by LcioManager::beginRun().
| void openLcioFile | ( | ) |
Open the output LCIO file.
Definition at line 81 of file LcioManager.cc.
References RunManager::abortRun(), LOG::done, LcioManager::eAppend, LcioManager::eDelete, LcioManager::eFail, SlicApplication::FAILED_DELETE_LCIO_FILE, LOG::fatal, FileUtil::fileExists(), LcioManager::getFullOutputPath(), LOG::head, RunManager::instance(), Module::log(), LcioManager::m_fileExistsAction, LcioManager::m_writer, LcioManager::m_writerIsOpen, LOG::name, LogStream::okay(), SlicApplication::OUTPUT_FILE_EXISTS, FileUtil::removeFile(), and LOG::sep.
Referenced by LcioManager::beginRun().
| void setAutonameFields | ( | const std::vector< std::string > & | fields | ) |
Set the list of fields to use for output file autonaming.
Definition at line 298 of file LcioManager.cc.
References LcioManager::m_currentAutonameFields, and LcioManager::m_usingAutoname.
Referenced by LcioMessenger::SetNewValue().
|
inline |
Set the current output LCIO event.
| [in] | anLCEvent | The LCIO event. |
Definition at line 159 of file LcioManager.hh.
References LcioManager::m_currentLCEvent.
Referenced by LcioManager::createLCEvent().
|
private |
Set the detector name in the current run header.
Definition at line 257 of file LcioManager.cc.
References Module::log(), LcioManager::m_runHdr, and LogStream::okay().
Referenced by LcioManager::createRunHeader().
|
private |
Set the time stamp in the current event header.
Definition at line 381 of file LcioManager.cc.
References LcioManager::getCurrentLCEvent(), and TimeUtil::getTimeNS().
Referenced by LcioManager::endEvent().
|
inline |
Set the file exists action.
| [in] | fea | The file exists action. |
Definition at line 183 of file LcioManager.hh.
References LOG::done, LcioManager::eInvalid, LOG::error, Module::log(), and LcioManager::m_fileExistsAction.
Referenced by LcioMessenger::SetNewValue().
| void setFilename | ( | const std::string & | filename | ) |
Set the output file name, which will be appended to the path.
Definition at line 285 of file LcioManager.cc.
References Module::log(), LcioManager::m_filename, and LogStream::okay().
Referenced by LcioManager::makeAutoname(), and LcioMessenger::SetNewValue().
| void setPath | ( | const std::string & | path | ) |
Set the output path.
Definition at line 279 of file LcioManager.cc.
References Module::log(), LcioManager::m_path, and LogStream::okay().
Referenced by LcioMessenger::SetNewValue().
| void setRunNumber | ( | int | runNumber | ) |
Set the current run number.
| [in] | runNumber | The run number. |
Definition at line 144 of file LcioManager.cc.
References Module::log(), LcioManager::m_runNumber, and LogStream::verbose().
Referenced by LcioMessenger::SetNewValue().
|
inline |
Set whether to store momentum in output hits.
| [in] | s | Setting for storing momentum in output hits. |
Definition at line 175 of file LcioManager.hh.
References LcioManager::m_HCBuilder, and LcioHitsCollectionBuilder::setStoreMomentum().
|
inline |
Enable writing complete event to MCParticle collection.
| [in] | writeCompleteEvent | Set to true to write complete event. |
Definition at line 230 of file LcioManager.hh.
References LcioManager::_writeCompleteEvent.
|
private |
Definition at line 325 of file LcioManager.hh.
Referenced by LcioManager::getWriteCompleteEvent(), and LcioManager::setWriteCompleteEvent().
|
private |
Definition at line 320 of file LcioManager.hh.
Referenced by LcioManager::makeAutoname(), and LcioManager::setAutonameFields().
|
private |
current LCEvent
Definition at line 306 of file LcioManager.hh.
Referenced by LcioManager::createHitsCollections(), LcioManager::endEvent(), LcioManager::getCurrentLCEvent(), and LcioManager::setCurrentLCEvent().
|
staticprivate |
Definition at line 319 of file LcioManager.hh.
Referenced by LcioManager::LcioManager(), and LcioManager::makeAutoname().
|
private |
Definition at line 322 of file LcioManager.hh.
Referenced by LcioManager::enableDumpEvent(), and LcioManager::endEvent().
|
private |
action when file exists
Definition at line 312 of file LcioManager.hh.
Referenced by LcioManager::endRun(), LcioManager::getFileExistsAction(), LcioManager::openLcioFile(), and LcioManager::setFileExistsAction().
|
private |
file info – filename
Definition at line 295 of file LcioManager.hh.
Referenced by LcioManager::LcioManager(), LcioManager::getFullOutputPath(), and LcioManager::setFilename().
|
private |
creation of HCs
Definition at line 303 of file LcioManager.hh.
Referenced by LcioManager::LcioManager(), LcioManager::createHitsCollections(), LcioManager::getHitsCollectionBuilder(), and LcioManager::setStoreMomentum().
|
private |
Definition at line 309 of file LcioManager.hh.
Referenced by LcioManager::LcioManager(), and LcioManager::~LcioManager().
|
private |
Definition at line 317 of file LcioManager.hh.
Referenced by LcioManager::LcioManager(), LcioManager::getFileNamer(), and LcioManager::makeAutoname().
|
private |
file info – path
Definition at line 297 of file LcioManager.hh.
Referenced by LcioManager::getFullOutputPath(), and LcioManager::setPath().
|
private |
run header
Definition at line 292 of file LcioManager.hh.
Referenced by LcioManager::addActiveSubdetectors(), LcioManager::beginRun(), LcioManager::createLCEvent(), LcioManager::createRunHeader(), LcioManager::deleteRunHeader(), and LcioManager::setDetectorName().
|
private |
starting run number
Definition at line 315 of file LcioManager.hh.
Referenced by LcioManager::beginRun(), LcioManager::createRunHeader(), and LcioManager::setRunNumber().
|
private |
Definition at line 324 of file LcioManager.hh.
Referenced by LcioManager::beginRun(), and LcioManager::setAutonameFields().
|
private |
writer
Definition at line 289 of file LcioManager.hh.
Referenced by LcioManager::beginRun(), LcioManager::createWriter(), LcioManager::deleteWriter(), LcioManager::endEvent(), LcioManager::endRun(), and LcioManager::openLcioFile().
|
private |
Definition at line 323 of file LcioManager.hh.
Referenced by LcioManager::deleteWriter(), LcioManager::endRun(), and LcioManager::openLcioFile().