#include <CommandLineProcessor.hh>


Definition at line 31 of file CommandLineProcessor.hh.
Public Types | |
| typedef std::pair< std::string, std::string > | OptionsPair |
| typedef std::vector < CommandLineProcessor::OptionsPair > | CommandLineArguments |
| typedef std::vector < CommandLineOption * > | OptionsList |
| enum | ModuleStatus { eOkay = 0, eNotInitialized = 1, eBadState = 2, eFatalError = 3 } |
Public Member Functions | |
| virtual | ~CommandLineProcessor () |
| CommandLineProcessor () | |
| void | process (int argc, char **argv) |
| void | printOptions () |
| void | printVersion () |
| CommandQueue * | getCommandQueue () |
| void | printUsage () |
| const std::string & | getName () const |
| const ModuleStatus | getStatus () const |
| virtual void | initialize () |
| virtual void | reset () |
| virtual void | cleanup () |
| bool | deleteOnExit () |
| LogStream & | log () |
| virtual void | beginEvent (const G4Event *) |
| virtual void | endEvent (const G4Event *) |
| virtual void | beginRun (const G4Run *) |
| virtual void | endRun (const G4Run *) |
| virtual void | preTracking (const G4Track *) |
| virtual void | postTracking (const G4Track *) |
| virtual void | stepping (const G4Step *) |
| G4ClassificationOfNewTrack | stackingClassifyNewTrack (const G4Track *) |
| void | stackingNewStage () |
| void | stackingPrepareNewEvent () |
| void | release () |
Static Public Member Functions | |
| static T * | instance () |
Public Attributes | |
| ModuleStatus | m_status |
| std::string | m_name |
| LogStream | m_log |
| bool | m_deleteOnExit |
Private Member Functions | |
| void | processOptions () |
| void | abort () |
| void | processOption (const std::string &) |
| void | addOption (CommandLineOption *) |
| CommandLineOption * | getCommandLineOption (const std::string &opt) |
| void | createOptionsString () |
| void | registerOptions () |
| bool | hasOption (const std::string &opt) |
Private Attributes | |
| CommandLineArguments | m_commandline |
| CommandQueue | m_g4q |
| OptionsList | m_cmds |
| int | m_help_flag |
| int | m_interactive_flag |
| int | m_version_flag |
| std::string | m_getoptOptions |
| typedef std::pair<std::string, std::string> slic::CommandLineProcessor::OptionsPair |
OptionsPair is a short option name and its associated arguments.
Definition at line 39 of file CommandLineProcessor.hh.
| typedef std::vector<CommandLineProcessor::OptionsPair> slic::CommandLineProcessor::CommandLineArguments |
CommandLineArguments is the list of options and arguments from the command line.
Definition at line 44 of file CommandLineProcessor.hh.
| typedef std::vector<CommandLineOption*> slic::CommandLineProcessor::OptionsList |
OptionsList is a list of CommandLineOption classes describing valid command line switches.
Definition at line 49 of file CommandLineProcessor.hh.
enum slic::Module::ModuleStatus [inherited] |
| slic::CommandLineProcessor::~CommandLineProcessor | ( | ) | [virtual] |
Definition at line 32 of file CommandLineProcessor.cc.
| slic::CommandLineProcessor::CommandLineProcessor | ( | ) |
Definition at line 22 of file CommandLineProcessor.cc.
References createOptionsString(), and registerOptions().
| void slic::CommandLineProcessor::process | ( | int | argc, | |
| char ** | argv | |||
| ) |
This is the primary function to process the raw arguments. Options that will cause an abort, e.g. '-h', '-v', and '-n', are handled explicitly so that the correct flag is set. Other arguments are handled generically and put into the CommandLineArguments vector, which associates a short option name with its arguments (if any). Options that can occur more than once, such as the '-m' command, get one entry per occurrence in the CommandLineArguments. getopt will check that the option is valid and that enough arguments were received, before the command is put into CommandLineArguments. After calling process(), the getCommandQueue() function can be used to retrieve the list of Geant4 macro commands that resulted from processing the raw command line arguments.
Definition at line 35 of file CommandLineProcessor.cc.
References abort(), slic::CommandQueue::add(), LOG::done, slic::Module::log(), m_commandline, m_g4q, m_getoptOptions, m_help_flag, m_interactive_flag, m_version_flag, printUsage(), printVersion(), processOptions(), and LOG::verbose.
Referenced by slic::SlicApplication::initialize().
| void slic::CommandLineProcessor::printOptions | ( | ) |
Print out the options table.
Definition at line 441 of file CommandLineProcessor.cc.
References LOG::done, slic::CommandLineOption::getDescription(), slic::CommandLineOption::getG4CommandString(), slic::CommandLineOption::getLongName(), slic::LogStream::getOutputStream(), slic::CommandLineOption::getShortName(), slic::Module::log(), m_cmds, and LOG::okay.
Referenced by printUsage().
| void slic::CommandLineProcessor::printVersion | ( | ) | [inline] |
Print the version information.
Definition at line 82 of file CommandLineProcessor.hh.
References LOG::done, slic::PackageInfo::getFullApplicationString(), slic::Module::log(), and LOG::okay.
Referenced by printUsage(), and process().
| CommandQueue* slic::CommandLineProcessor::getCommandQueue | ( | ) | [inline] |
Get the queue of Geant4 macro commands created from the command line arguments.
Definition at line 91 of file CommandLineProcessor.hh.
References m_g4q.
| void slic::CommandLineProcessor::printUsage | ( | ) |
Print the usage statement.
Definition at line 167 of file CommandLineProcessor.cc.
References LOG::done, slic::Module::log(), LOG::okay, printOptions(), and printVersion().
Referenced by process().
| void slic::CommandLineProcessor::processOptions | ( | ) | [private] |
Process all the command line arguments in correct order to create the queue of Geant4 commands.
Definition at line 383 of file CommandLineProcessor.cc.
References slic::CommandQueue::add(), hasOption(), m_g4q, m_interactive_flag, and processOption().
Referenced by process().
| void slic::CommandLineProcessor::abort | ( | ) | [inline, private] |
Abort the application before Geant4 starts, e.g. if usage or version are selected. This is not called if the command line arguments are invalid, as getopt will handle this and call exit() itself.
Definition at line 195 of file CommandLineProcessor.cc.
Referenced by process().
| void slic::CommandLineProcessor::processOption | ( | const std::string & | ) | [inline, private] |
Process a command line switch by adding the corresponding Geant4 macro command to the CommandQueue.
Referenced by processOptions().
| void slic::CommandLineProcessor::addOption | ( | CommandLineOption * | opt | ) | [inline, private] |
Add a command line option describing a command line switch, its full name, description, geant4 command, etc.
Definition at line 378 of file CommandLineProcessor.cc.
References m_cmds.
Referenced by registerOptions().
| CommandLineOption * slic::CommandLineProcessor::getCommandLineOption | ( | const std::string & | opt | ) | [inline, private] |
Find an option specification by its single letter designation (with no '-').
Definition at line 507 of file CommandLineProcessor.cc.
References m_cmds.
| void slic::CommandLineProcessor::createOptionsString | ( | ) | [inline, private] |
Automatically create the getopt options string from OptionsList and set the m_getoptOptions variable to this value.
Definition at line 535 of file CommandLineProcessor.cc.
References slic::CommandLineOption::getMaxArgs(), slic::CommandLineOption::getMinArgs(), slic::CommandLineOption::getShortName(), m_cmds, and m_getoptOptions.
Referenced by CommandLineProcessor().
| void slic::CommandLineProcessor::registerOptions | ( | ) | [inline, private] |
Register the list of valid command line options.
Definition at line 200 of file CommandLineProcessor.cc.
References addOption().
Referenced by CommandLineProcessor().
| bool slic::CommandLineProcessor::hasOption | ( | const std::string & | opt | ) | [inline, private] |
Returns true if the option was found in the command line arguments.
Definition at line 521 of file CommandLineProcessor.cc.
References m_commandline.
Referenced by processOptions().
| const std::string& slic::Module::getName | ( | ) | const [inline, inherited] |
Definition at line 48 of file Module.hh.
References slic::Module::m_name.
Referenced by slic::ModuleRegistry::deregisterModule(), slic::Module::Module(), slic::ModuleRegistry::registerModule(), and slic::Module::~Module().
| const ModuleStatus slic::Module::getStatus | ( | ) | const [inline, inherited] |
| virtual void slic::Module::initialize | ( | ) | [inline, virtual, inherited] |
| virtual void slic::Module::reset | ( | ) | [inline, virtual, inherited] |
Reimplemented in slic::EventSource, slic::EventSourceWithInputFile, slic::LcioManager, and slic::LcioMcpManager.
| virtual void slic::Module::cleanup | ( | void | ) | [inline, virtual, inherited] |
| bool slic::Module::deleteOnExit | ( | ) | [inline, inherited] |
| LogStream& slic::Module::log | ( | ) | [inline, inherited] |
Definition at line 70 of file Module.hh.
References slic::Module::m_log.
Referenced by slic::PhysicsListFactory::addBuilder(), slic::EventDebugger::addDebugEvent(), slic::LcioHitsCollectionBuilder::addMcpContribs(), slic::StdHepToLcioConvertor::addMcpDaughter(), slic::StdHepToLcioConvertor::addMcpParent(), slic::TrajectoryManager::addTrackIDToTrajectoryLink(), slic::EventAction::BeginOfEventAction(), slic::EventSourceWithInputFile::beginRun(), slic::StdHepToLcioConvertor::checkParentage(), slic::LcioMcpPrinter::colLabels(), slic::TrajectoryManager::copySecondaryTrackInformationFromParent(), slic::PhysicsListFactory::create(), slic::LcioMcpFactory::createDaughtersFromPrimary(), slic::EventSourceManager::createEventSource(), slic::LcioHitsCollectionBuilder::createHit(), slic::LcioHitsCollectionBuilder::createHitCollections(), slic::LcioMcpManager::createMcpCollection(), slic::LcioMcpFactory::createMcpFromInitialAndPrimary(), slic::StdHepToLcioConvertor::createMcpFromStdHep(), slic::StdHepLoader::dumpCurrentEvent(), slic::StdHepEventSource::dumpCurrentEvent(), slic::ParticleGunEventSource::dumpCurrentEvent(), slic::LcioEventSource::dumpCurrentEvent(), slic::GPSEventSource::dumpCurrentEvent(), slic::EventDebugger::execCleanupMacro(), slic::EventDebugger::execDebugMacro(), slic::StdHepToLcioConvertor::fillCurrentMcpCollectionFromStdHep(), slic::TrajectoryManager::fillTrackIDToTrajectoryMap(), slic::LcioMcpFilter::filterSimParticles(), slic::LcioHitsCollectionBuilder::findMcpHitContribByTrackID(), slic::TrajectoryManager::findTrajectory(), slic::LcioMcpPrinter::flagLabels(), slic::LcioMcpPrinter::foot(), slic::G4MagIntegratorStepperFactory::G4MagIntegratorStepperFactory(), slic::EventSourceManager::generate(), slic::LcioEventSource::getCurrentMcpLCCollection(), slic::LcioFileNamer::getFieldValue(), slic::TrajectoryManager::getNumberOfSecondariesAtEnd(), slic::EventSourceManager::getSourceTypeFromFileExtension(), slic::TrajectoryManager::handleSecondaryTrack(), slic::LcioMcpPrinter::head(), slic::SlicApplication::initialize(), slic::PhysicsListManager::initializePhysicsList(), slic::SlicApplication::initializeUI(), slic::LcioMcpPrinter::line(), slic::SlicMain::main(), slic::LcioManager::makeAutoname(), slic::StdHepToLcioConvertor::makeIndexVec(), slic::Module::Module(), slic::LcioEventSource::open(), slic::LcioManager::openLcioFile(), slic::StdHepLoader::openStdHepFile(), slic::TrajectoryManager::postTracking(), slic::TrajectoryManager::preTracking(), slic::ModuleRegistry::print(), slic::PhysicsListFactory::printAvailableLists(), slic::PrimaryGeneratorAction::printBeginEventMessage(), slic::RunAction::printBeginOfRunMessage(), slic::StdHepToLcioConvertor::printDaughters(), slic::EventAction::printEndEventMessage(), slic::RunAction::printEndOfRunMessage(), slic::StdHepToLcioConvertor::printIndex(), slic::LcioMcpMaps::printInitMcpToMcpMap(), slic::LcioMcpMaps::printMaps(), slic::LcioMcpPrinter::printMcp(), slic::LcioMcpPrinter::printMcpCollection(), slic::LcioMcpManager::printMcpCollection(), slic::LcioMcpMaps::printMcpToPrimaryMap(), slic::StdHepToLcioConvertor::printMothers(), slic::EventSourceManager::printNumEventsGenerated(), printOptions(), slic::CommandQueue::printOut(), slic::TrajectoryManager::printPhysVolDbg(), slic::TrajectoryManager::printSecondaries(), slic::SlicApplication::printSplashScreen(), slic::TrajectoryManager::printStatusFlags(), slic::TrajectoryManager::printTrack(), slic::StdHepToLcioConvertor::printTrack(), slic::TrajectoryManager::printTrackIDToTrajectoryMap(), slic::LcioMcpMaps::printTrackToMcpMap(), slic::TrajectoryManager::printTrajectory(), printUsage(), printVersion(), process(), slic::StdHepLoader::readNextEvent(), slic::LcioMcpManager::registerMcpCollection(), slic::ModuleRegistry::registerModule(), slic::SlicApplication::run(), slic::LcioMcpPrinter::sep(), slic::PhysicsListManager::setCurrentListName(), slic::LcioManager::setDetectorName(), slic::LcioManager::setFileExistsAction(), slic::EventSourceWithInputFile::setFilename(), slic::LcioHitsCollectionBuilder::setLongFlag(), slic::SlicApplicationMessenger::SetNewValue(), slic::PhysicsMessenger::SetNewValue(), slic::GeneratorMessenger::SetNewValue(), slic::FieldMessenger::SetNewValue(), slic::LcioHitsCollectionBuilder::setPDGFlag(), slic::LcioManager::setRunNumber(), slic::TrajectoryManager::setTrajectoryFinalStatus(), slic::StdHepToLcioConvertor::setupDaughters(), slic::EventSourceManager::setupEventSource(), slic::PhysicsListManager::setupOpticalProcesses(), slic::StdHepToLcioConvertor::setupParents(), slic::PhysicsListManager::setupUserLimitsProcesses(), slic::SlicApplication::SlicApplication(), slic::EventAction::startEventTimer(), slic::RunAction::startRunTimer(), slic::EventAction::stopEventTimer(), slic::RunAction::stopRunTimer(), slic::Module::~Module(), and slic::SlicApplication::~SlicApplication().
| virtual void slic::Module::beginEvent | ( | const G4Event * | ) | [inline, virtual, inherited] |
| virtual void slic::Module::endEvent | ( | const G4Event * | ) | [inline, virtual, inherited] |
Reimplemented in slic::EventDebugger, slic::EventSource, slic::EventSourceManager, slic::LcioManager, and slic::LcioMcpManager.
| virtual void slic::Module::beginRun | ( | const G4Run * | ) | [inline, virtual, inherited] |
| virtual void slic::Module::endRun | ( | const G4Run * | ) | [inline, virtual, inherited] |
Reimplemented in slic::EventSource, slic::EventSourceManager, and slic::LcioManager.
| virtual void slic::Module::preTracking | ( | const G4Track * | ) | [inline, virtual, inherited] |
| virtual void slic::Module::postTracking | ( | const G4Track * | ) | [inline, virtual, inherited] |
| virtual void slic::Module::stepping | ( | const G4Step * | ) | [inline, virtual, inherited] |
| G4ClassificationOfNewTrack slic::Module::stackingClassifyNewTrack | ( | const G4Track * | ) | [inline, inherited] |
| void slic::Module::stackingNewStage | ( | ) | [inline, inherited] |
| void slic::Module::stackingPrepareNewEvent | ( | ) | [inline, inherited] |
| T * Singleton< T >::instance | ( | ) | [inline, static, inherited] |
Definition at line 31 of file Singleton.hh.
References Singleton< T >::m_singleton.
Referenced by slic::LcioManager::addInitialMCParticleCollection(), slic::StdHepEventSource::beginEvent(), slic::LcioEventSource::beginEvent(), slic::EventAction::BeginOfEventAction(), slic::RunAction::BeginOfRunAction(), slic::EventSourceWithInputFile::beginRun(), slic::LcioMcpFactory::createFinalMcpCollection(), slic::LcioMcpFactory::createMcpFromPrimary(), slic::LcioManager::createRunHeader(), slic::LcioEventSource::dumpCurrentEvent(), slic::LcioManager::endEvent(), slic::EventAction::EndOfEventAction(), slic::RunAction::EndOfRunAction(), slic::LcioManager::endRun(), slic::StdHepEventSource::generate(), slic::LcioEventSource::generate(), slic::PrimaryGeneratorAction::GeneratePrimaries(), slic::LcioEventSource::getCurrentMcpLCCollection(), slic::LcioFileNamer::getFieldValue(), slic::SlicApplication::initialize(), slic::RunManager::InitializePhysics(), slic::PhysicsListManager::initializePhysicsList(), slic::LcioHitsCollectionBuilder::LcioHitsCollectionBuilder(), slic::LcioManager::LcioManager(), slic::LcioPrimaryGenerator::LcioPrimaryGenerator(), slic::SlicMain::main(), slic::LcioFileNamer::makeEventName(), slic::LcioFileNamer::makeEventNumberString(), slic::LcioFileNamer::makeFileBasedName(), slic::LcioFileNamer::makeGPSName(), slic::LcioFileNamer::makeGunName(), slic::Module::Module(), slic::PhysicsListManager::PhysicsListManager(), slic::SlicApplication::printUsage(), slic::SlicApplication::printVersion(), slic::SlicApplication::run(), slic::PhysicsMessenger::SetNewValue(), slic::LcioMcpMessenger::SetNewValue(), slic::GeneratorMessenger::SetNewValue(), slic::FieldMessenger::SetNewValue(), slic::EventDebuggerMessenger::SetNewValue(), slic::TrackingAction::TrackingAction(), slic::SteppingAction::UserSteppingAction(), slic::Module::~Module(), and slic::SlicApplication::~SlicApplication().
| void Singleton< T >::release | ( | ) | [inline, inherited] |
Definition at line 159 of file CommandLineProcessor.hh.
Referenced by getCommandQueue(), process(), and processOptions().
Definition at line 162 of file CommandLineProcessor.hh.
Referenced by addOption(), createOptionsString(), getCommandLineOption(), and printOptions().
int slic::CommandLineProcessor::m_help_flag [private] |
int slic::CommandLineProcessor::m_interactive_flag [private] |
Definition at line 166 of file CommandLineProcessor.hh.
Referenced by process(), and processOptions().
int slic::CommandLineProcessor::m_version_flag [private] |
std::string slic::CommandLineProcessor::m_getoptOptions [private] |
Definition at line 170 of file CommandLineProcessor.hh.
Referenced by createOptionsString(), and process().
ModuleStatus slic::Module::m_status [inherited] |
std::string slic::Module::m_name [inherited] |
Reimplemented in slic::EventSource.
Definition at line 111 of file Module.hh.
Referenced by slic::Module::getName(), and slic::Module::Module().
LogStream slic::Module::m_log [inherited] |
Definition at line 112 of file Module.hh.
Referenced by slic::Module::log(), and slic::Module::Module().
bool slic::Module::m_deleteOnExit [inherited] |
1.5.4