|
Gaudi Framework, version v21r4 |
| Home | Generated: 7 Sep 2009 |
#include <GaudiKernel/Algorithm.h>


In order for a concrete algorithm class to do anything useful the methods initialize(), execute() and finalize() should be overridden.
The base class provides utility methods for accessing standard services (event data service etc.); for declaring properties which may be configured by the job options service; and for creating sub algorithms. The only base class functionality which may be used in the constructor of a concrete algorithm is the declaration of member variables as properties. All other functionality, i.e. the use of services and the creation of sub-algorithms, may be used only in initialize() and afterwards (see the Gaudi user guide).
Definition at line 61 of file Algorithm.h.
Public Member Functions | |
| Algorithm (const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION) | |
| Constructor. | |
| virtual | ~Algorithm () |
| Destructor. | |
| virtual StatusCode | sysStart () |
| Reinitialization method invoked by the framework. | |
| virtual StatusCode | sysInitialize () |
| Initialization method invoked by the framework. | |
| virtual StatusCode | sysReinitialize () |
| Reinitialization method invoked by the framework. | |
| virtual StatusCode | sysRestart () |
| Restart method invoked by the framework. | |
| virtual StatusCode | sysExecute () |
| The actions to be performed by the algorithm on an event. | |
| virtual StatusCode | sysStop () |
| System stop. | |
| virtual StatusCode | sysFinalize () |
| System finalization. | |
| virtual StatusCode | sysBeginRun () |
| beginRun method invoked by the framework. | |
| virtual StatusCode | sysEndRun () |
| endRun method invoked by the framework. | |
| virtual const std::string & | name () const |
| The identifying name of the algorithm object. | |
| virtual const std::string & | version () const |
| virtual StatusCode | configure () |
| Dummy implementation of IStateful::configure() method. | |
| virtual StatusCode | terminate () |
| Dummy implementation of IStateful::terminate() method. | |
| virtual StatusCode | initialize () |
| the default (empty) implementation of IStateful::initialize() method | |
| virtual StatusCode | start () |
| the default (empty) implementation of IStateful::start() method | |
| virtual StatusCode | stop () |
| the default (empty) implementation of IStateful::stop() method | |
| virtual StatusCode | finalize () |
| the default (empty) implementation of IStateful::finalize() method | |
| virtual StatusCode | reinitialize () |
| the default (empty) implementation of IStateful::reinitialize() method | |
| virtual StatusCode | restart () |
| the default (empty) implementation of IStateful::restart() method | |
| virtual bool | isExecuted () const |
| Has this algorithm been executed since the last reset? | |
| virtual void | setExecuted (bool state) |
| Set the executed flag to the specified state. | |
| virtual void | resetExecuted () |
| Reset the executed state of the Algorithm for the duration of the current event. | |
| virtual StatusCode | beginRun () |
| Algorithm begin run. | |
| virtual StatusCode | endRun () |
| Algorithm end run. This method is called at the end of the event loop. | |
| virtual Gaudi::StateMachine::State | FSMState () const |
| returns the current state of the algorithm | |
| virtual Gaudi::StateMachine::State | targetFSMState () const |
| returns the state the algorithm will be in after the ongoing transition | |
| virtual bool | isEnabled () const |
| Is this algorithm enabled or disabled? | |
| virtual bool | filterPassed () const |
| Did this algorithm pass or fail its filter criterion for the last event? | |
| virtual void | setFilterPassed (bool state) |
| Set the filter passed flag to the specified state. | |
| template<class T> | |
| StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const |
| Access a service by name, creating it if it doesn't already exist. | |
| template<class T> | |
| StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const |
| Access a service by name and type, creating it if it doesn't already exist. | |
| SmartIF< IService > | service (const std::string &name, const bool createIf=true, const bool quiet=false) const |
| Return a pointer to the service identified by name (or "type/name"). | |
| void | setOutputLevel (int level) |
| Set the output level for current algorithm. | |
| SmartIF< IAuditorSvc > & | auditorSvc () const |
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. | |
| SmartIF< IChronoStatSvc > & | chronoSvc () const |
| The standard Chrono & Stat service, Return a pointer to the service if present. | |
| SmartIF< IChronoStatSvc > & | chronoStatService () const |
| Obsoleted name, kept due to the backwards compatibility. | |
| SmartIF< IDataProviderSvc > & | detSvc () const |
| The standard detector data service. | |
| SmartIF< IDataProviderSvc > & | detDataService () const |
| Obsoleted name, kept due to the backwards compatibility. | |
| SmartIF< IConversionSvc > & | detCnvSvc () const |
| The standard detector data persistency conversion service. | |
| SmartIF< IConversionSvc > & | detDataCnvService () const |
| Obsoleted name, kept due to the backwards compatibility. | |
| SmartIF< IDataProviderSvc > & | eventSvc () const |
| The standard event data service. | |
| SmartIF< IDataProviderSvc > & | evtSvc () const |
| shortcut for method eventSvc | |
| SmartIF< IDataProviderSvc > & | eventDataService () const |
| Obsoleted name, kept due to the backwards compatibility. | |
| SmartIF< IConversionSvc > & | eventCnvSvc () const |
| The standard event data persistency conversion service. | |
| SmartIF< IConversionSvc > & | eventDataCnvService () const |
| Obsoleted name, kept due to the backwards compatibility. | |
| SmartIF< IHistogramSvc > & | histoSvc () const |
| The standard histogram service. | |
| SmartIF< IHistogramSvc > & | histogramDataService () const |
| Obsoleted name, kept due to the backwards compatibility. | |
| SmartIF< IMessageSvc > & | msgSvc () const |
| The standard message service. | |
| SmartIF< IMessageSvc > & | messageService () const |
| Obsoleted name, kept due to the backwards compatibility. | |
| SmartIF< INTupleSvc > & | ntupleSvc () const |
| The standard N tuple service. | |
| SmartIF< INTupleSvc > & | ntupleService () const |
| Obsoleted name, kept due to the backwards compatibility. | |
| SmartIF< IRndmGenSvc > & | randSvc () const |
| AIDA-based NTuple service Returns a pointer to the AIDATuple service if present. | |
| SmartIF< IToolSvc > & | toolSvc () const |
| The standard ToolSvc service, Return a pointer to the service if present. | |
| SmartIF< IExceptionSvc > & | exceptionSvc () const |
| Get the exception Service. | |
| SmartIF< ISvcLocator > & | serviceLocator () const |
| The standard service locator. | |
| SmartIF< ISvcLocator > & | svcLoc () const |
| shortcut for method serviceLocator | |
| StatusCode | createSubAlgorithm (const std::string &type, const std::string &name, Algorithm *&pSubAlg) |
| Create a sub algorithm. | |
| std::vector< Algorithm * > * | subAlgorithms () const |
| List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms. | |
| virtual StatusCode | setProperty (const Property &p) |
| Implementation of IProperty::setProperty. | |
| virtual StatusCode | setProperty (const std::string &s) |
| Implementation of IProperty::setProperty. | |
| virtual StatusCode | setProperty (const std::string &n, const std::string &v) |
| Implementation of IProperty::setProperty. | |
| virtual StatusCode | getProperty (Property *p) const |
| Implementation of IProperty::getProperty. | |
| virtual const Property & | getProperty (const std::string &name) const |
| Implementation of IProperty::getProperty. | |
| virtual StatusCode | getProperty (const std::string &n, std::string &v) const |
| Implementation of IProperty::getProperty. | |
| virtual const std::vector < Property * > & | getProperties () const |
| Implementation of IProperty::getProperties. | |
| StatusCode | setProperties () |
| Set the algorithm's properties. | |
| template<class T> | |
| Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const |
| Declare the named property. | |
| Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const |
| Declare remote named properties. | |
| SmartIF< IMonitorSvc > & | monitorSvc () const |
| Access the monitor service. | |
| template<class T> | |
| void | declareInfo (const std::string &name, const T &var, const std::string &desc) const |
| Declare monitoring information. | |
| void | declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const |
| Declare monitoring information (special case). | |
| template<class TYPE> | |
| StatusCode | setProperty (const std::string &name, const TYPE &value) |
| set the property form the value | |
Protected Member Functions | |
| bool | isInitialized () const |
| Has the Algorithm already been initialized? | |
| bool | isFinalized () const |
| Has the Algorithm already been finalized? | |
| int | outputLevel () const |
| retrieve the Algorithm output level | |
| IntegerProperty & | outputLevelProperty () |
| Accessor for the Message level property. | |
| void | initOutputLevel (Property &prop) |
| callback for output level property | |
Private Member Functions | |
| StatusCode | service_i (const std::string &svcName, bool createIf, const InterfaceID &iid, void **ppSvc) const |
| implementation of service method | |
| StatusCode | service_i (const std::string &svcType, const std::string &svcName, const InterfaceID &iid, void **ppSvc) const |
| Algorithm (const Algorithm &a) | |
| Private Copy constructor: NO COPY ALLOWED. | |
| Algorithm & | operator= (const Algorithm &rhs) |
| Private assignment operator: NO ASSIGNMENT ALLOWED. | |
Private Attributes | |
| std::string | m_name |
| Algorithm's name for identification. | |
| std::string | m_version |
| Algorithm's version. | |
| std::vector< Algorithm * > * | m_subAlgms |
| Sub algorithms. | |
| SmartIF< IMessageSvc > | m_MS |
| Message service. | |
| SmartIF< IDataProviderSvc > | m_EDS |
| Event data service. | |
| SmartIF< IConversionSvc > | m_ECS |
| Event conversion service. | |
| SmartIF< IDataProviderSvc > | m_DDS |
| Detector data service. | |
| SmartIF< IConversionSvc > | m_DCS |
| Detector conversion service. | |
| SmartIF< IHistogramSvc > | m_HDS |
| Histogram data service. | |
| SmartIF< INTupleSvc > | m_NTS |
| N tuple service. | |
| SmartIF< IChronoStatSvc > | m_CSS |
| Chrono & Stat Service. | |
| SmartIF< IRndmGenSvc > | m_RGS |
| Random Number Generator Service. | |
| SmartIF< IExceptionSvc > | m_EXS |
| Exception Handler Service. | |
| SmartIF< IAuditorSvc > | m_pAuditorSvc |
| Auditor Service. | |
| SmartIF< IToolSvc > | m_ptoolSvc |
| ToolSvc Service. | |
| SmartIF< IMonitorSvc > | m_pMonitorSvc |
| Online Monitoring Service. | |
| std::string | m_monitorSvcName |
| Name to use for Monitor Service. | |
| SmartIF< ISvcLocator > | m_pSvcLocator |
| Pointer to service locator service. | |
| PropertyMgr * | m_propertyMgr |
| For management of properties. | |
| IntegerProperty | m_outputLevel |
| Algorithm output level. | |
| int | m_errorMax |
| Algorithm Max number of errors. | |
| int | m_errorCount |
| Algorithm error counter. | |
| BooleanProperty | m_auditInit |
| global flag for auditors | |
| bool | m_auditorInitialize |
| flag for auditors in "initialize()" | |
| bool | m_auditorReinitialize |
| flag for auditors in "Reinitialize()" | |
| bool | m_auditorRestart |
| flag for auditors in "Restart()" | |
| bool | m_auditorExecute |
| flag for auditors in "execute()" | |
| bool | m_auditorFinalize |
| flag for auditors in "finalize()" | |
| bool | m_auditorBeginRun |
| flag for auditors in "beginRun()" | |
| bool | m_auditorEndRun |
| flag for auditors in "endRun()" | |
| bool | m_auditorStart |
| flag for auditors in "initialize()" | |
| bool | m_auditorStop |
| flag for auditors in "Reinitialize()" | |
| bool | m_filterPassed |
| Filter passed flag. | |
| bool | m_isEnabled |
| Algorithm is enabled flag. | |
| bool | m_isExecuted |
| Algorithm is executed flag. | |
| Gaudi::StateMachine::State | m_state |
| Algorithm has been initialized flag. | |
| Gaudi::StateMachine::State | m_targetState |
| Algorithm has been initialized flag. | |
| bool | m_isFinalized |
| Algorithm has been finalized flag. | |
| Algorithm::Algorithm | ( | const std::string & | name, | |
| ISvcLocator * | svcloc, | |||
| const std::string & | version = PACKAGE_VERSION | |||
| ) |
Constructor.
| name | The algorithm object's name | |
| svcloc | A pointer to a service location service |
Definition at line 28 of file Algorithm.cpp.
00030 : m_name(name), 00031 m_version(version), 00032 m_pSvcLocator(pSvcLocator), 00033 m_filterPassed(true), 00034 m_isEnabled(true), 00035 m_isExecuted(false), 00036 m_state(Gaudi::StateMachine::CONFIGURED), 00037 m_targetState(Gaudi::StateMachine::CONFIGURED) 00038 { 00039 m_propertyMgr = new PropertyMgr(); 00040 m_subAlgms = new std::vector<Algorithm *>(); 00041 00042 // Declare common Algorithm properties with their defaults 00043 declareProperty( "OutputLevel", m_outputLevel = MSG::NIL); 00044 declareProperty( "Enable", m_isEnabled = true); 00045 declareProperty( "ErrorMax", m_errorMax = 1); 00046 declareProperty( "ErrorCount", m_errorCount = 0); 00047 // Auditor monitoring properties 00048 00049 // Get the default setting for service auditing from the AppMgr 00050 declareProperty( "AuditAlgorithms", m_auditInit ); 00051 00052 bool audit(false); 00053 SmartIF<IProperty> appMgr(serviceLocator()->service("ApplicationMgr")); 00054 if (appMgr.isValid()) { 00055 const Property& prop = appMgr->getProperty("AuditAlgorithms"); 00056 Property &pr = const_cast<Property&>(prop); 00057 if (m_name != "IncidentSvc") { 00058 setProperty( pr ).ignore(); 00059 } 00060 audit = m_auditInit.value(); 00061 } 00062 00063 declareProperty( "AuditInitialize" , m_auditorInitialize = audit ) ; 00064 declareProperty( "AuditReinitialize", m_auditorReinitialize = audit ) ; 00065 declareProperty( "AuditRestart" , m_auditorRestart = audit ) ; 00066 declareProperty( "AuditExecute" , m_auditorExecute = audit ) ; 00067 declareProperty( "AuditFinalize" , m_auditorFinalize = audit ) ; 00068 declareProperty( "AuditBeginRun" , m_auditorBeginRun = audit ) ; 00069 declareProperty( "AuditEndRun" , m_auditorEndRun = audit ) ; 00070 declareProperty( "AuditStart" , m_auditorStart = audit ) ; 00071 declareProperty( "AuditStop" , m_auditorStop = audit ) ; 00072 00073 declareProperty( "MonitorService" , m_monitorSvcName = "MonitorSvc" ); 00074 00075 // update handlers. 00076 m_outputLevel.declareUpdateHandler(&Algorithm::initOutputLevel, this); 00077 00078 }
| Algorithm::~Algorithm | ( | ) | [virtual] |
Destructor.
Definition at line 81 of file Algorithm.cpp.
00081 { 00082 delete m_subAlgms; 00083 delete m_propertyMgr; 00084 }
| Algorithm::Algorithm | ( | const Algorithm & | a | ) | [private] |
Private Copy constructor: NO COPY ALLOWED.
| StatusCode Algorithm::sysStart | ( | ) | [virtual] |
Reinitialization method invoked by the framework.
This method is responsible for any reinitialization required by the framework itself. It will in turn invoke the reinitialize() method of the derived algorithm, and of any sub-algorithms which it creates.
Definition at line 164 of file Algorithm.cpp.
00164 { 00165 00166 // Bypass the startup if already running or disabled. 00167 if ( Gaudi::StateMachine::RUNNING == FSMState() || 00168 !isEnabled() ) return StatusCode::SUCCESS; 00169 00170 m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::START,m_state); 00171 00172 // TODO: (MCl) where shoud we do this? initialize or start? 00173 // Reset Error count 00174 m_errorCount = 0; 00175 00176 StatusCode sc; 00177 // Invoke start() method of the derived class inside a try/catch clause 00178 try { 00179 { // limit the scope of the guard 00180 Gaudi::Guards::AuditorGuard guard(this, 00181 // check if we want to audit the initialize 00182 (m_auditorStart) ? auditorSvc().get() : 0, 00183 IAuditor::Start); 00184 // Invoke the start() method of the derived class 00185 sc = start(); 00186 } 00187 if( sc.isFailure() ) return StatusCode::FAILURE; 00188 00189 // Now start any sub-algorithms 00190 std::vector<Algorithm *>::iterator it; 00191 StatusCode result = StatusCode::SUCCESS; 00192 for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) { 00193 sc = (*it)->sysStart(); 00194 if( sc.isFailure() ) result = sc; 00195 } 00196 if( result.isFailure() ) { 00197 MsgStream log ( msgSvc() , name() + ".sysInitialize()" ); 00198 log << MSG::ERROR << " Error initializing one or several sub-algorithms" 00199 << endmsg; 00200 return result; 00201 } 00202 // Update the state. 00203 m_state = m_targetState; 00204 return StatusCode::SUCCESS; 00205 } 00206 catch ( const GaudiException& Exception ) { 00207 MsgStream log ( msgSvc() , name() ); 00208 log << MSG::FATAL << "in sysStart(): exception with tag=" << Exception.tag() 00209 << " is caught" << endmsg; 00210 log << MSG::ERROR << Exception << endmsg; 00211 Stat stat( chronoSvc() , Exception.tag() ); 00212 } 00213 catch( const std::exception& Exception ) { 00214 MsgStream log ( msgSvc() , name() ); 00215 log << MSG::FATAL << "in sysStart(): standard std::exception is caught" << endmsg; 00216 log << MSG::ERROR << Exception.what() << endmsg; 00217 Stat stat( chronoSvc() , "*std::exception*" ); 00218 } 00219 catch(...) { 00220 MsgStream log ( msgSvc() , name() ); 00221 log << MSG::FATAL << "in sysStart(): UNKNOWN Exception is caught" << endmsg; 00222 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00223 } 00224 00225 return StatusCode::FAILURE; 00226 }
| StatusCode Algorithm::sysInitialize | ( | ) | [virtual] |
Initialization method invoked by the framework.
This method is responsible for any bookkeeping of initialization required by the framework itself. It will in turn invoke the initialize() method of the derived algorithm, and of any sub-algorithms which it creates.
Definition at line 87 of file Algorithm.cpp.
00087 { 00088 00089 // Bypass the initialization if the algorithm 00090 // has already been initialized. 00091 if ( Gaudi::StateMachine::INITIALIZED <= FSMState() ) return StatusCode::SUCCESS; 00092 00093 // Set the Algorithm's properties 00094 StatusCode sc = setProperties(); 00095 if( sc.isFailure() ) return StatusCode::FAILURE; 00096 00097 // Bypass the initialization if the algorithm is disabled. 00098 // Need to do this after setProperties. 00099 if ( !isEnabled( ) ) return StatusCode::SUCCESS; 00100 00101 m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::INITIALIZE,m_state); 00102 00103 // Check current outputLevel to evetually inform the MessagsSvc 00104 //if( m_outputLevel != MSG::NIL ) { 00105 setOutputLevel( m_outputLevel ); 00106 //} 00107 00108 // TODO: (MCl) where shoud we do this? initialize or start? 00109 // Reset Error count 00110 //m_errorCount = 0; 00111 00112 // Invoke initialize() method of the derived class inside a try/catch clause 00113 try { 00114 { // limit the scope of the guard 00115 Gaudi::Guards::AuditorGuard guard(this, 00116 // check if we want to audit the initialize 00117 (m_auditorInitialize) ? auditorSvc().get() : 0, 00118 IAuditor::Initialize); 00119 // Invoke the initialize() method of the derived class 00120 sc = initialize(); 00121 } 00122 if( sc.isFailure() ) return StatusCode::FAILURE; 00123 00124 // Now initialize care of any sub-algorithms 00125 std::vector<Algorithm *>::iterator it; 00126 StatusCode result = StatusCode::SUCCESS; 00127 for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) { 00128 sc = (*it)->sysInitialize(); 00129 if( sc.isFailure() ) result = sc; 00130 } 00131 if( result.isFailure() ) { 00132 MsgStream log ( msgSvc() , name() + ".sysInitialize()" ); 00133 log << MSG::ERROR << " Error initializing one or several sub-algorithms" 00134 << endmsg; 00135 return result; 00136 } 00137 // Update the state. 00138 m_state = m_targetState; 00139 return StatusCode::SUCCESS; 00140 } 00141 catch ( const GaudiException& Exception ) { 00142 MsgStream log ( msgSvc() , name() + ".sysInitialize()" ); 00143 log << MSG::FATAL << " Exception with tag=" << Exception.tag() 00144 << " is caught " << endmsg; 00145 log << MSG::ERROR << Exception << endmsg; 00146 Stat stat( chronoSvc() , Exception.tag() ); 00147 } 00148 catch( const std::exception& Exception ) { 00149 MsgStream log ( msgSvc() , name() + ".sysInitialize()" ); 00150 log << MSG::FATAL << " Standard std::exception is caught " << endmsg; 00151 log << MSG::ERROR << Exception.what() << endmsg; 00152 Stat stat( chronoSvc() , "*std::exception*" ); 00153 } 00154 catch(...) { 00155 MsgStream log ( msgSvc() , name() + ".sysInitialize()" ); 00156 log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg; 00157 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00158 } 00159 00160 return StatusCode::FAILURE; 00161 }
| StatusCode Algorithm::sysReinitialize | ( | ) | [virtual] |
Reinitialization method invoked by the framework.
This method is responsible for any reinitialization required by the framework itself. It will in turn invoke the reinitialize() method of the derived algorithm, and of any sub-algorithms which it creates.
Definition at line 229 of file Algorithm.cpp.
00229 { 00230 00231 // Bypass the initialization if the algorithm is disabled. 00232 if ( !isEnabled( ) ) return StatusCode::SUCCESS; 00233 00234 // Check that the current status is the correct one. 00235 if ( Gaudi::StateMachine::INITIALIZED != FSMState() ) { 00236 MsgStream log ( msgSvc() , name() ); 00237 log << MSG::ERROR 00238 << "sysReinitialize(): cannot reinitialize algorithm not initialized" 00239 << endmsg; 00240 return StatusCode::FAILURE; 00241 } 00242 00243 // Check current outputLevel to evetually inform the MessagsSvc 00244 //if( m_outputLevel != MSG::NIL ) { 00245 setOutputLevel( m_outputLevel ); 00246 //} 00247 00248 // Reset Error count 00249 // m_errorCount = 0; // done during start 00250 00251 StatusCode sc(StatusCode::SUCCESS,true); 00252 // Invoke reinitialize() method of the derived class inside a try/catch clause 00253 try { 00254 { // limit the scope of the guard 00255 Gaudi::Guards::AuditorGuard guard(this, 00256 // check if we want to audit the initialize 00257 (m_auditorReinitialize) ? auditorSvc().get() : 0, 00258 IAuditor::ReInitialize); 00259 // Invoke the reinitialize() method of the derived class 00260 sc = reinitialize(); 00261 } 00262 if( sc.isFailure() ) return StatusCode::FAILURE; 00263 00264 // Now initialize care of any sub-algorithms 00265 std::vector<Algorithm *>::iterator it; 00266 StatusCode result = StatusCode::SUCCESS; 00267 for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) { 00268 sc = (*it)->sysReinitialize(); 00269 if( sc.isFailure() ) result = sc; 00270 } 00271 if( result.isFailure() ) { 00272 MsgStream log ( msgSvc() , name() ); 00273 log << MSG::ERROR 00274 << "sysReinitialize(): Error reinitializing one or several sub-algorithms" 00275 << endmsg; 00276 return result; 00277 } 00278 return StatusCode::SUCCESS; 00279 } 00280 catch ( const GaudiException& Exception ) { 00281 MsgStream log ( msgSvc() , name() ); 00282 log << MSG::FATAL << "sysReinitialize(): Exception with tag=" << Exception.tag() 00283 << " is caught" << endmsg; 00284 log << MSG::ERROR << Exception << endmsg; 00285 Stat stat( chronoSvc() , Exception.tag() ); 00286 } 00287 catch( const std::exception& Exception ) { 00288 MsgStream log ( msgSvc() , name() ); 00289 log << MSG::FATAL << "sysReinitialize(): Standard std::exception is caught" << endmsg; 00290 log << MSG::ERROR << Exception.what() << endmsg; 00291 Stat stat( chronoSvc() , "*std::exception*" ); 00292 } 00293 catch(...) { 00294 MsgStream log ( msgSvc() , name() ); 00295 log << MSG::FATAL << "sysReinitialize(): UNKNOWN Exception is caught" << endmsg; 00296 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00297 } 00298 00299 return StatusCode::FAILURE; 00300 }
| StatusCode Algorithm::sysRestart | ( | ) | [virtual] |
Restart method invoked by the framework.
It will in turn invoke the restart() method of the derived algorithm, and of any sub-algorithms which it creates.
Definition at line 303 of file Algorithm.cpp.
00303 { 00304 00305 // Bypass the initialization if the algorithm is disabled. 00306 if ( !isEnabled( ) ) return StatusCode::SUCCESS; 00307 00308 // Check that the current status is the correct one. 00309 if ( Gaudi::StateMachine::RUNNING != FSMState() ) { 00310 MsgStream log ( msgSvc() , name() ); 00311 log << MSG::ERROR 00312 << "sysRestart(): cannot restart algorithm not started" 00313 << endmsg; 00314 return StatusCode::FAILURE; 00315 } 00316 00317 // Check current outputLevel to evetually inform the MessagsSvc 00318 //if( m_outputLevel != MSG::NIL ) { 00319 setOutputLevel( m_outputLevel ); 00320 //} 00321 00322 // Reset Error count 00323 m_errorCount = 0; 00324 00325 StatusCode sc(StatusCode::SUCCESS,true); 00326 // Invoke reinitialize() method of the derived class inside a try/catch clause 00327 try { 00328 { // limit the scope of the guard 00329 Gaudi::Guards::AuditorGuard guard(this, 00330 // check if we want to audit the initialize 00331 (m_auditorRestart) ? auditorSvc().get() : 0, 00332 IAuditor::ReStart); 00333 // Invoke the reinitialize() method of the derived class 00334 sc = restart(); 00335 } 00336 if( sc.isFailure() ) return StatusCode::FAILURE; 00337 00338 // Now initialize care of any sub-algorithms 00339 std::vector<Algorithm *>::iterator it; 00340 StatusCode result = StatusCode::SUCCESS; 00341 for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) { 00342 sc = (*it)->sysRestart(); 00343 if( sc.isFailure() ) result = sc; 00344 } 00345 if( result.isFailure() ) { 00346 MsgStream log ( msgSvc() , name() ); 00347 log << MSG::ERROR 00348 << "sysRestart(): Error restarting one or several sub-algorithms" 00349 << endmsg; 00350 return result; 00351 } 00352 return StatusCode::SUCCESS; 00353 } 00354 catch ( const GaudiException& Exception ) { 00355 MsgStream log ( msgSvc() , name() ); 00356 log << MSG::FATAL << "sysRestart(): Exception with tag=" << Exception.tag() 00357 << " is caught" << endmsg; 00358 log << MSG::ERROR << Exception << endmsg; 00359 Stat stat( chronoSvc() , Exception.tag() ); 00360 } 00361 catch( const std::exception& Exception ) { 00362 MsgStream log ( msgSvc() , name() ); 00363 log << MSG::FATAL << "sysRestart(): Standard std::exception is caught" << endmsg; 00364 log << MSG::ERROR << Exception.what() << endmsg; 00365 Stat stat( chronoSvc() , "*std::exception*" ); 00366 } 00367 catch(...) { 00368 MsgStream log ( msgSvc() , name() ); 00369 log << MSG::FATAL << "sysRestart(): UNKNOWN Exception is caught" << endmsg; 00370 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00371 } 00372 00373 return StatusCode::FAILURE; 00374 }
| StatusCode Algorithm::sysExecute | ( | ) | [virtual] |
The actions to be performed by the algorithm on an event.
This method is invoked once per event for top level algorithms by the application manager. This method invokes execute() method. For sub-algorithms either the sysExecute() method or execute() method must be EXPLICITLY invoked by the parent algorithm.
Reimplemented in GaudiAlgorithm.
Definition at line 511 of file Algorithm.cpp.
00511 { 00512 if (!isEnabled()) { 00513 MsgStream log ( msgSvc() , name() ); 00514 log << MSG::VERBOSE << ".sysExecute(): is not enabled. Skip execution" <<endmsg; 00515 return StatusCode::SUCCESS; 00516 } 00517 00518 StatusCode status; 00519 00520 // Should performance profile be performed ? 00521 // invoke execute() method of Algorithm class 00522 // and catch all uncaught exceptions 00523 00524 Gaudi::Guards::AuditorGuard guard(this, 00525 // check if we want to audit the initialize 00526 (m_auditorExecute) ? auditorSvc().get() : 0, 00527 IAuditor::Execute, 00528 status); 00529 try { 00530 status = execute(); 00531 setExecuted(true); // set the executed flag 00532 00533 if (status.isFailure()) { 00534 status = exceptionSvc()->handleErr(*this,status); 00535 } 00536 00537 } 00538 catch( const GaudiException& Exception ) { 00539 setExecuted(true); // set the executed flag 00540 00541 MsgStream log ( msgSvc() , name() + ".sysExecute()" ); 00542 if (Exception.code() == StatusCode::FAILURE) { 00543 log << MSG::FATAL; 00544 } else { 00545 log << MSG::ERROR << " Recoverable"; 00546 } 00547 00548 log << " Exception with tag=" << Exception.tag() 00549 << " is caught " << endmsg; 00550 00551 log << MSG::ERROR << Exception << endmsg; 00552 00553 Stat stat( chronoSvc() , Exception.tag() ) ; 00554 status = exceptionSvc()->handle(*this,Exception); 00555 } 00556 catch( const std::exception& Exception ) { 00557 setExecuted(true); // set the executed flag 00558 00559 MsgStream log ( msgSvc() , name() + ".sysExecute()" ); 00560 log << MSG::FATAL << " Standard std::exception is caught " << endmsg; 00561 log << MSG::ERROR << Exception.what() << endmsg; 00562 Stat stat( chronoSvc() , "*std::exception*" ) ; 00563 status = exceptionSvc()->handle(*this,Exception); 00564 } 00565 catch(...) { 00566 setExecuted(true); // set the executed flag 00567 00568 MsgStream log ( msgSvc() , name() + ".sysExecute()" ); 00569 log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg; 00570 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00571 00572 status = exceptionSvc()->handle(*this); 00573 } 00574 00575 if( status.isFailure() ) { 00576 MsgStream log ( msgSvc() , name() ); 00577 // Increment the error count 00578 m_errorCount++; 00579 // Check if maximum is exeeded 00580 if( m_errorCount < m_errorMax ) { 00581 log << MSG::WARNING << "Continuing from error (cnt=" << m_errorCount 00582 << ", max=" << m_errorMax << ")" << endmsg; 00583 // convert to success 00584 status = StatusCode::SUCCESS; 00585 } 00586 } 00587 return status; 00588 }
| StatusCode Algorithm::sysStop | ( | ) | [virtual] |
System stop.
This method invokes the stop() method of a concrete algorithm and the stop() methods of all of that algorithm's sub algorithms.
Definition at line 591 of file Algorithm.cpp.
00591 { 00592 00593 // Bypass the startup if already running or disabled. 00594 if ( Gaudi::StateMachine::INITIALIZED == FSMState() || 00595 !isEnabled() ) return StatusCode::SUCCESS; 00596 00597 m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::STOP,m_state); 00598 00599 StatusCode sc; 00600 // Invoke stop() method of the derived class inside a try/catch clause 00601 try { 00602 // Stop first any sub-algorithms (in reverse order) 00603 std::vector<Algorithm *>::reverse_iterator it; 00604 for (it = m_subAlgms->rbegin(); it != m_subAlgms->rend(); it++) { 00605 (*it)->sysStop().ignore(); 00606 } 00607 { // limit the scope of the guard 00608 Gaudi::Guards::AuditorGuard guard(this, 00609 // check if we want to audit the initialize 00610 (m_auditorStop) ? auditorSvc().get() : 0, 00611 IAuditor::Stop); 00612 00613 // Invoke the stop() method of the derived class 00614 sc = stop(); 00615 } 00616 if( sc.isFailure() ) return StatusCode::FAILURE; 00617 00618 // Update the state. 00619 m_state = m_targetState; 00620 return StatusCode::SUCCESS; 00621 } 00622 catch ( const GaudiException& Exception ) { 00623 MsgStream log ( msgSvc() , name() ); 00624 log << MSG::FATAL << "in sysStop(): exception with tag=" << Exception.tag() 00625 << " is caught" << endmsg; 00626 log << MSG::ERROR << Exception << endmsg; 00627 Stat stat( chronoSvc() , Exception.tag() ); 00628 } 00629 catch( const std::exception& Exception ) { 00630 MsgStream log ( msgSvc() , name() ); 00631 log << MSG::FATAL << "in sysStop(): standard std::exception is caught" << endmsg; 00632 log << MSG::ERROR << Exception.what() << endmsg; 00633 Stat stat( chronoSvc() , "*std::exception*" ); 00634 } 00635 catch(...) { 00636 MsgStream log ( msgSvc() , name() ); 00637 log << MSG::FATAL << "in sysStop(): UNKNOWN Exception is caught" << endmsg; 00638 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00639 } 00640 00641 return StatusCode::FAILURE; 00642 }
| StatusCode Algorithm::sysFinalize | ( | ) | [virtual] |
System finalization.
This method invokes the finalize() method of a concrete algorithm and the finalize() methods of all of that algorithm's sub algorithms.
Definition at line 644 of file Algorithm.cpp.
00644 { 00645 00646 // Bypass the finalialization if the algorithm hasn't been initilized. 00647 if ( Gaudi::StateMachine::CONFIGURED == FSMState() || 00648 !isEnabled() ) return StatusCode::SUCCESS; 00649 00650 m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::FINALIZE,m_state); 00651 00652 // Invoke finalize() method of the derived class inside a try/catch clause 00653 StatusCode sc = StatusCode::SUCCESS; 00654 try { 00655 // Order changed (bug #3903 overview: finalize and nested algorithms) 00656 // Finalize first any sub-algoithms (it can be done more than once) 00657 std::vector<Algorithm *>::iterator it; 00658 bool fail(false); 00659 for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) { 00660 if (!(*it)->sysFinalize().isSuccess()) { 00661 fail = true; 00662 } 00663 } 00664 00665 { // limit the scope of the guard 00666 Gaudi::Guards::AuditorGuard guard(this, 00667 // check if we want to audit the initialize 00668 (m_auditorFinalize) ? auditorSvc().get() : 0, 00669 IAuditor::Finalize); 00670 // Invoke the finalize() method of the derived class 00671 sc = finalize(); 00672 } 00673 if( !sc.isSuccess() || fail ) return StatusCode::FAILURE; 00674 00675 // Release all sub-algorithms 00676 for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) { 00677 (*it)->release(); 00678 } 00679 // Indicate that this Algorithm has been finalized to prevent duplicate attempts 00680 m_state = m_targetState; 00681 return sc; 00682 } 00683 catch( const GaudiException& Exception ) { 00684 MsgStream log ( msgSvc() , name() + ".sysFinalize()" ); 00685 log << MSG::FATAL << " Exception with tag=" << Exception.tag() 00686 << " is caught " << endmsg; 00687 log << MSG::ERROR << Exception << endmsg; 00688 Stat stat( chronoSvc() , Exception.tag() ) ; 00689 } 00690 catch( const std::exception& Exception ) { 00691 MsgStream log ( msgSvc() , name() + ".sysFinalize()" ); 00692 log << MSG::FATAL << " Standard std::exception is caught " << endmsg; 00693 log << MSG::ERROR << Exception.what() << endmsg; 00694 Stat stat( chronoSvc() , "*std::exception*" ) ; 00695 } 00696 catch( ... ) { 00697 MsgStream log ( msgSvc() , name() + ".sysFinalize()" ); 00698 log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg; 00699 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00700 } 00701 return StatusCode::FAILURE ; 00702 }
| StatusCode Algorithm::sysBeginRun | ( | ) | [virtual] |
beginRun method invoked by the framework.
This method is responsible for any beginRun actions required by the framework itself. It will in turn invoke the beginRun() method of the derived algorithm, and of any sub-algorithms which it creates.
Definition at line 377 of file Algorithm.cpp.
00377 { 00378 00379 // Bypass the beginRun if the algorithm is disabled. 00380 if ( !isEnabled( ) ) return StatusCode::SUCCESS; 00381 00382 // Check current outputLevel to evetually inform the MessagsSvc 00383 //if( m_outputLevel != MSG::NIL ) { 00384 setOutputLevel( m_outputLevel ); 00385 //} 00386 00387 // Reset Error count 00388 m_errorCount = 0; 00389 00390 StatusCode sc; 00391 // Invoke beginRun() method of the derived class inside a try/catch clause 00392 try { 00393 { // limit the scope of the guard 00394 Gaudi::Guards::AuditorGuard guard(this, 00395 // check if we want to audit the initialize 00396 (m_auditorBeginRun) ? auditorSvc().get() : 0, 00397 IAuditor::BeginRun); 00398 // Invoke the beginRun() method of the derived class 00399 sc = beginRun(); 00400 } 00401 if( sc.isFailure() ) return StatusCode::FAILURE; 00402 00403 // Now call beginRun for any sub-algorithms 00404 std::vector<Algorithm *>::iterator it; 00405 StatusCode result = StatusCode::SUCCESS; 00406 for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) { 00407 sc = (*it)->sysBeginRun(); 00408 if( sc.isFailure() ) result = sc; 00409 } 00410 if( result.isFailure() ) { 00411 MsgStream log ( msgSvc() , name() + ".sysBeginRun()" ); 00412 log << MSG::ERROR << " Error executing BeginRun for one or several sub-algorithms" 00413 << endmsg; 00414 return result; 00415 } 00416 return StatusCode::SUCCESS; 00417 } 00418 catch ( const GaudiException& Exception ) { 00419 MsgStream log ( msgSvc() , name() + ".sysBeginRun()" ); 00420 log << MSG::FATAL << " Exception with tag=" << Exception.tag() 00421 << " is caught " << endmsg; 00422 log << MSG::ERROR << Exception << endmsg; 00423 Stat stat( chronoSvc() , Exception.tag() ); 00424 } 00425 catch( const std::exception& Exception ) { 00426 MsgStream log ( msgSvc() , name() + ".sysBeginRun()" ); 00427 log << MSG::FATAL << " Standard std::exception is caught " << endmsg; 00428 log << MSG::ERROR << Exception.what() << endmsg; 00429 Stat stat( chronoSvc() , "*std::exception*" ); 00430 } 00431 catch(...) { 00432 MsgStream log ( msgSvc() , name() + ".sysBeginRun()" ); 00433 log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg; 00434 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00435 } 00436 return StatusCode::FAILURE; 00437 }
| StatusCode Algorithm::sysEndRun | ( | ) | [virtual] |
endRun method invoked by the framework.
This method is responsible for any endRun actions required by the framework itself. It will in turn invoke the endRun() method of the derived algorithm, and of any sub-algorithms which it creates.
Definition at line 444 of file Algorithm.cpp.
00444 { 00445 00446 // Bypass the endRun if the algorithm is disabled. 00447 if ( !isEnabled( ) ) return StatusCode::SUCCESS; 00448 00449 // Check current outputLevel to eventually inform the MessagsSvc 00450 //if( m_outputLevel != MSG::NIL ) { 00451 setOutputLevel( m_outputLevel ); 00452 //} 00453 00454 // Reset Error count 00455 m_errorCount = 0; 00456 00457 // Invoke endRun() method of the derived class inside a try/catch clause 00458 StatusCode sc; 00459 try { 00460 { // limit the scope of the guard 00461 Gaudi::Guards::AuditorGuard guard(this, 00462 // check if we want to audit the initialize 00463 (m_auditorEndRun) ? auditorSvc().get() : 0, 00464 IAuditor::EndRun); 00465 // Invoke the endRun() method of the derived class 00466 sc = endRun(); 00467 } 00468 if( sc.isFailure() ) return StatusCode::FAILURE; 00469 00470 // Now call endRun for any sub-algorithms 00471 std::vector<Algorithm *>::iterator it; 00472 StatusCode result = StatusCode::SUCCESS; 00473 for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) { 00474 sc = (*it)->sysEndRun(); 00475 if( sc.isFailure() ) result = sc; 00476 } 00477 if( result.isFailure() ) { 00478 MsgStream log ( msgSvc() , name() + ".sysEndRun()" ); 00479 log << MSG::ERROR << " Error calling endRun for one or several sub-algorithms" 00480 << endmsg; 00481 return result; 00482 } 00483 return StatusCode::SUCCESS; 00484 } 00485 catch ( const GaudiException& Exception ) { 00486 MsgStream log ( msgSvc() , name() + ".sysEndRun()" ); 00487 log << MSG::FATAL << " Exception with tag=" << Exception.tag() 00488 << " is caught " << endmsg; 00489 log << MSG::ERROR << Exception << endmsg; 00490 Stat stat( chronoSvc() , Exception.tag() ); 00491 } 00492 catch( const std::exception& Exception ) { 00493 MsgStream log ( msgSvc() , name() + ".sysEndRun()" ); 00494 log << MSG::FATAL << " Standard std::exception is caught " << endmsg; 00495 log << MSG::ERROR << Exception.what() << endmsg; 00496 Stat stat( chronoSvc() , "*std::exception*" ); 00497 } 00498 catch(...) { 00499 MsgStream log ( msgSvc() , name() + ".sysEndRun()" ); 00500 log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg; 00501 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00502 } 00503 return StatusCode::FAILURE; 00504 }
| const std::string & Algorithm::name | ( | ) | const [virtual] |
The identifying name of the algorithm object.
This is the name of a particular instantiation of an algorithm object as opposed to the name of the algorithm itself, e.g. "LinearTrackFit" may be the name of a concrete algorithm class, whereas "ApproxTrackFit" and "BestTrackFit" may be two instantiations of the class configured to find tracks with different fit criteria.
Definition at line 743 of file Algorithm.cpp.
00743 { 00744 return m_name; 00745 }
| const std::string & Algorithm::version | ( | ) | const [virtual] |
| virtual StatusCode Algorithm::configure | ( | ) | [inline, virtual] |
Dummy implementation of IStateful::configure() method.
Definition at line 147 of file Algorithm.h.
00147 { return StatusCode::SUCCESS ; }
| virtual StatusCode Algorithm::terminate | ( | ) | [inline, virtual] |
Dummy implementation of IStateful::terminate() method.
Definition at line 149 of file Algorithm.h.
00149 { return StatusCode::SUCCESS ; }
| virtual StatusCode Algorithm::initialize | ( | ) | [inline, virtual] |
the default (empty) implementation of IStateful::initialize() method
Reimplemented in EventCounter, GaudiAlgorithm, GaudiHistoAlg, GaudiSequencer, GaudiTupleAlg, Prescaler, Sequencer, GaudiPython::PyAlgorithm, PartitionSwitchAlg, StoreExplorerAlg, CollectionCloneAlg, EvtCollectionStream, OutputStream, TagCollectionStream, GaudiCommon< Algorithm >, GaudiHistos< GaudiAlgorithm >, and GaudiTuples< GaudiHistoAlg >.
Definition at line 152 of file Algorithm.h.
00152 { return StatusCode::SUCCESS ; }
| virtual StatusCode Algorithm::start | ( | ) | [inline, virtual] |
the default (empty) implementation of IStateful::start() method
Reimplemented in Sequencer, and GaudiPython::PyAlgorithm.
Definition at line 154 of file Algorithm.h.
00154 { return StatusCode::SUCCESS ; }
| virtual StatusCode Algorithm::stop | ( | ) | [inline, virtual] |
the default (empty) implementation of IStateful::stop() method
Reimplemented in Sequencer, and GaudiPython::PyAlgorithm.
Definition at line 156 of file Algorithm.h.
00156 { return StatusCode::SUCCESS ; }
| virtual StatusCode Algorithm::finalize | ( | void | ) | [inline, virtual] |
the default (empty) implementation of IStateful::finalize() method
Reimplemented in EventCounter, GaudiAlgorithm, GaudiHistoAlg, GaudiSequencer, GaudiTupleAlg, Prescaler, Sequencer, GaudiPython::PyAlgorithm, PartitionSwitchAlg, StoreExplorerAlg, CollectionCloneAlg, EvtCollectionStream, OutputStream, RecordStream, RunRecordStream, TagCollectionStream, GaudiCommon< Algorithm >, GaudiHistos< GaudiAlgorithm >, and GaudiTuples< GaudiHistoAlg >.
Definition at line 158 of file Algorithm.h.
00158 { return StatusCode::SUCCESS ; }
| StatusCode Algorithm::reinitialize | ( | ) | [virtual] |
the default (empty) implementation of IStateful::reinitialize() method
Reimplemented in Sequencer.
Definition at line 704 of file Algorithm.cpp.
00704 { 00705 /* @TODO 00706 * MCl 2008-10-23: the implementation of reinitialize as finalize+initialize 00707 * is causing too many problems 00708 * 00709 // Default implementation is finalize+initialize 00710 StatusCode sc = finalize(); 00711 if (sc.isFailure()) { 00712 MsgStream log ( msgSvc() , name() ); 00713 log << MSG::ERROR << "reinitialize(): cannot be finalized" << endmsg; 00714 return sc; 00715 } 00716 sc = initialize(); 00717 if (sc.isFailure()) { 00718 MsgStream log ( msgSvc() , name() ); 00719 log << MSG::ERROR << "reinitialize(): cannot be initialized" << endmsg; 00720 return sc; 00721 } 00722 */ 00723 return StatusCode::SUCCESS; 00724 }
| StatusCode Algorithm::restart | ( | ) | [virtual] |
the default (empty) implementation of IStateful::restart() method
Definition at line 726 of file Algorithm.cpp.
00726 { 00727 // Default implementation is stop+start 00728 StatusCode sc = stop(); 00729 if (sc.isFailure()) { 00730 MsgStream log ( msgSvc() , name() ); 00731 log << MSG::ERROR << "restart(): cannot be stopped" << endmsg; 00732 return sc; 00733 } 00734 sc = start(); 00735 if (sc.isFailure()) { 00736 MsgStream log ( msgSvc() , name() ); 00737 log << MSG::ERROR << "restart(): cannot be started" << endmsg; 00738 return sc; 00739 } 00740 return StatusCode::SUCCESS; 00741 }
| bool Algorithm::isExecuted | ( | ) | const [virtual] |
Has this algorithm been executed since the last reset?
Definition at line 751 of file Algorithm.cpp.
00751 { 00752 return m_isExecuted; 00753 }
| void Algorithm::setExecuted | ( | bool | state | ) | [virtual] |
Set the executed flag to the specified state.
Definition at line 755 of file Algorithm.cpp.
00755 { 00756 m_isExecuted = state; 00757 }
| void Algorithm::resetExecuted | ( | ) | [virtual] |
Reset the executed state of the Algorithm for the duration of the current event.
Reimplemented in GaudiSequencer, and Sequencer.
Definition at line 759 of file Algorithm.cpp.
00759 { 00760 m_isExecuted = false; 00761 m_filterPassed = true; 00762 }
| StatusCode Algorithm::beginRun | ( | ) | [virtual] |
Algorithm begin run.
This method is called at the beginning of the event loop.
Reimplemented in GaudiSequencer, Sequencer, and GaudiPython::PyAlgorithm.
Definition at line 439 of file Algorithm.cpp.
00439 { 00440 return StatusCode::SUCCESS; 00441 }
| StatusCode Algorithm::endRun | ( | ) | [virtual] |
Algorithm end run. This method is called at the end of the event loop.
Reimplemented in GaudiSequencer, Sequencer, and GaudiPython::PyAlgorithm.
Definition at line 506 of file Algorithm.cpp.
00506 { 00507 return StatusCode::SUCCESS; 00508 }
| virtual Gaudi::StateMachine::State Algorithm::FSMState | ( | ) | const [inline, virtual] |
returns the current state of the algorithm
Definition at line 185 of file Algorithm.h.
00185 { return m_state; }
| virtual Gaudi::StateMachine::State Algorithm::targetFSMState | ( | ) | const [inline, virtual] |
returns the state the algorithm will be in after the ongoing transition
Definition at line 188 of file Algorithm.h.
00188 { return m_targetState; }
| bool Algorithm::isEnabled | ( | ) | const [virtual] |
Is this algorithm enabled or disabled?
Definition at line 764 of file Algorithm.cpp.
00764 { 00765 return m_isEnabled; 00766 }
| bool Algorithm::filterPassed | ( | ) | const [virtual] |
Did this algorithm pass or fail its filter criterion for the last event?
Definition at line 768 of file Algorithm.cpp.
00768 { 00769 return m_filterPassed; 00770 }
| void Algorithm::setFilterPassed | ( | bool | state | ) | [virtual] |
Set the filter passed flag to the specified state.
Definition at line 772 of file Algorithm.cpp.
00772 { 00773 m_filterPassed = state; 00774 }
| StatusCode Algorithm::service | ( | const std::string & | name, | |
| T *& | psvc, | |||
| bool | createIf = true | |||
| ) | const [inline] |
Access a service by name, creating it if it doesn't already exist.
Definition at line 202 of file Algorithm.h.
| StatusCode Algorithm::service | ( | const std::string & | svcType, | |
| const std::string & | svcName, | |||
| T *& | psvc | |||
| ) | const [inline] |
Access a service by name and type, creating it if it doesn't already exist.
Definition at line 208 of file Algorithm.h.
00209 { 00210 return service_i(svcType, svcName, T::interfaceID(), (void**)&psvc); 00211 }
| SmartIF< IService > Algorithm::service | ( | const std::string & | name, | |
| const bool | createIf = true, |
|||
| const bool | quiet = false | |||
| ) | const |
Return a pointer to the service identified by name (or "type/name").
Definition at line 1094 of file Algorithm.cpp.
01094 { 01095 const ServiceLocatorHelper helper(*serviceLocator(), *this); 01096 return helper.service(name, quiet, createIf); 01097 }
| void Algorithm::setOutputLevel | ( | int | level | ) |
| SmartIF<IAuditorSvc>& Algorithm::auditorSvc | ( | ) | const |
The standard auditor service.May not be invoked before sysInitialize() has been invoked.
| SmartIF<IChronoStatSvc>& Algorithm::chronoSvc | ( | ) | const |
| SmartIF<IChronoStatSvc>& Algorithm::chronoStatService | ( | ) | const |
Obsoleted name, kept due to the backwards compatibility.
| SmartIF<IDataProviderSvc>& Algorithm::detSvc | ( | ) | const |
The standard detector data service.
May not be invoked before sysInitialize() has been invoked.
| SmartIF< IDataProviderSvc > & Algorithm::detDataService | ( | ) | const |
Obsoleted name, kept due to the backwards compatibility.
Definition at line 831 of file Algorithm.cpp.
00831 { 00832 return detSvc(); 00833 }
| SmartIF<IConversionSvc>& Algorithm::detCnvSvc | ( | ) | const |
The standard detector data persistency conversion service.
May not be invoked before sysInitialize() has been invoked.
| SmartIF< IConversionSvc > & Algorithm::detDataCnvService | ( | ) | const |
Obsoleted name, kept due to the backwards compatibility.
Definition at line 835 of file Algorithm.cpp.
00835 { 00836 return detCnvSvc(); 00837 }
| SmartIF<IDataProviderSvc>& Algorithm::eventSvc | ( | ) | const |
The standard event data service.
May not be invoked before sysInitialize() has been invoked.
| SmartIF<IDataProviderSvc>& Algorithm::evtSvc | ( | ) | const [inline] |
shortcut for method eventSvc
Definition at line 252 of file Algorithm.h.
00252 { return eventSvc() ; }
| SmartIF< IDataProviderSvc > & Algorithm::eventDataService | ( | ) | const |
Obsoleted name, kept due to the backwards compatibility.
Definition at line 839 of file Algorithm.cpp.
00839 { 00840 return eventSvc(); 00841 }
| SmartIF<IConversionSvc>& Algorithm::eventCnvSvc | ( | ) | const |
The standard event data persistency conversion service.
May not be invoked before sysInitialize() has been invoked.
| SmartIF< IConversionSvc > & Algorithm::eventDataCnvService | ( | ) | const |
Obsoleted name, kept due to the backwards compatibility.
Definition at line 843 of file Algorithm.cpp.
00843 { 00844 return eventCnvSvc(); 00845 }
| SmartIF<IHistogramSvc>& Algorithm::histoSvc | ( | ) | const |
The standard histogram service.
May not be invoked before sysInitialize() has been invoked.
| SmartIF< IHistogramSvc > & Algorithm::histogramDataService | ( | ) | const |
Obsoleted name, kept due to the backwards compatibility.
Definition at line 847 of file Algorithm.cpp.
00847 { 00848 return histoSvc(); 00849 }
| SmartIF< IMessageSvc > & Algorithm::msgSvc | ( | ) | const |
The standard message service.
Returns a pointer to the standard message service. May not be invoked before sysInitialize() has been invoked.
Definition at line 802 of file Algorithm.cpp.
00802 { 00803 if ( !m_MS.isValid() ) { 00804 //can not use service() method (infinite recursion!) 00805 m_MS = serviceLocator(); // default message service 00806 if( !m_MS.isValid() ) { 00807 throw GaudiException("Service [MessageSvc] not found", name(), StatusCode::FAILURE); 00808 } 00809 } 00810 return m_MS; 00811 }
| SmartIF< IMessageSvc > & Algorithm::messageService | ( | ) | const |
Obsoleted name, kept due to the backwards compatibility.
Definition at line 851 of file Algorithm.cpp.
00851 { 00852 return msgSvc(); 00853 }
| SmartIF<INTupleSvc>& Algorithm::ntupleSvc | ( | ) | const |
The standard N tuple service.
Returns a pointer to the N tuple service if present.
| SmartIF< INTupleSvc > & Algorithm::ntupleService | ( | ) | const |
Obsoleted name, kept due to the backwards compatibility.
Definition at line 855 of file Algorithm.cpp.
00855 { 00856 return ntupleSvc(); 00857 }
| SmartIF<IRndmGenSvc>& Algorithm::randSvc | ( | ) | const |
The standard ToolSvc service, Return a pointer to the service if present.
| SmartIF<IExceptionSvc>& Algorithm::exceptionSvc | ( | ) | const |
Get the exception Service.
| SmartIF< ISvcLocator > & Algorithm::serviceLocator | ( | ) | const |
The standard service locator.
Returns a pointer to the service locator service. This service may be used by an algorithm to request any services it requires in addition to those provided by default.
Definition at line 995 of file Algorithm.cpp.
00995 { 00996 return *const_cast<SmartIF<ISvcLocator>*>(&m_pSvcLocator); 00997 }
| SmartIF<ISvcLocator>& Algorithm::svcLoc | ( | ) | const [inline] |
shortcut for method serviceLocator
Definition at line 311 of file Algorithm.h.
00311 { return serviceLocator() ; }
| StatusCode Algorithm::createSubAlgorithm | ( | const std::string & | type, | |
| const std::string & | name, | |||
| Algorithm *& | pSubAlg | |||
| ) |
Create a sub algorithm.
A call to this method creates a child algorithm object. Note that the returned pointer is to Algorithm (as opposed to IAlgorithm), and thus the methods of IProperty are also available for the direct setting of the sub-algorithm's properties. Using this mechanism instead of creating daughter algorithms directly via the new operator is prefered since then the framework may take care of all of the necessary book-keeping.
| type | The concrete algorithm class of the sub algorithm | |
| name | The name to be given to the sub algorithm | |
| pSubAlg | Set to point to the newly created algorithm object |
Definition at line 1020 of file Algorithm.cpp.
01022 { 01023 if( m_pSvcLocator == 0 ) return StatusCode::FAILURE; 01024 01025 SmartIF<IAlgManager> am(m_pSvcLocator); 01026 if ( !am.isValid() ) return StatusCode::FAILURE; 01027 01028 // Maybe modify the AppMgr interface to return Algorithm* ?? 01029 IAlgorithm *tmp; 01030 StatusCode sc = am->createAlgorithm 01031 (type, name+getGaudiThreadIDfromName(Algorithm::name()), tmp); 01032 if( sc.isFailure() ) return StatusCode::FAILURE; 01033 01034 try{ 01035 pSubAlgorithm = dynamic_cast<Algorithm*>(tmp); 01036 m_subAlgms->push_back(pSubAlgorithm); 01037 } catch(...){ 01038 sc = StatusCode::FAILURE; 01039 } 01040 return sc; 01041 }
| std::vector< Algorithm * > * Algorithm::subAlgorithms | ( | ) | const |
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition at line 776 of file Algorithm.cpp.
00776 { 00777 return m_subAlgms; 00778 }
| StatusCode Algorithm::setProperty | ( | const Property & | p | ) | [virtual] |
Implementation of IProperty::setProperty.
Definition at line 1045 of file Algorithm.cpp.
01045 { 01046 return m_propertyMgr->setProperty(p); 01047 }
| StatusCode Algorithm::setProperty | ( | const std::string & | s | ) | [virtual] |
Implementation of IProperty::setProperty.
Definition at line 1048 of file Algorithm.cpp.
01048 { 01049 return m_propertyMgr->setProperty(s); 01050 }
| StatusCode Algorithm::setProperty | ( | const std::string & | n, | |
| const std::string & | v | |||
| ) | [virtual] |
Implementation of IProperty::setProperty.
Definition at line 1051 of file Algorithm.cpp.
01051 { 01052 return m_propertyMgr->setProperty(n,v); 01053 }
| StatusCode Algorithm::getProperty | ( | Property * | p | ) | const [virtual] |
Implementation of IProperty::getProperty.
Definition at line 1054 of file Algorithm.cpp.
01054 { 01055 return m_propertyMgr->getProperty(p); 01056 }
| const Property & Algorithm::getProperty | ( | const std::string & | name | ) | const [virtual] |
Implementation of IProperty::getProperty.
Definition at line 1057 of file Algorithm.cpp.
01057 { 01058 return m_propertyMgr->getProperty(name); 01059 }
| StatusCode Algorithm::getProperty | ( | const std::string & | n, | |
| std::string & | v | |||
| ) | const [virtual] |
Implementation of IProperty::getProperty.
Definition at line 1060 of file Algorithm.cpp.
01060 { 01061 return m_propertyMgr->getProperty(n,v); 01062 }
| const std::vector< Property * > & Algorithm::getProperties | ( | ) | const [virtual] |
Implementation of IProperty::getProperties.
Definition at line 1063 of file Algorithm.cpp.
01063 { 01064 return m_propertyMgr->getProperties(); 01065 }
| StatusCode Algorithm::setProperties | ( | ) |
Set the algorithm's properties.
This method requests the job options service to set the values of any declared properties. The method is invoked from within sysInitialize() by the framework and does not need to be explicitly called by a concrete algorithm.
Definition at line 1000 of file Algorithm.cpp.
01000 { 01001 if( m_pSvcLocator != 0 ) { 01002 SmartIF<IJobOptionsSvc> jos(m_pSvcLocator->service("JobOptionsSvc")); 01003 if( jos.isValid() ) { 01004 // set first generic Properties 01005 StatusCode sc = jos->setMyProperties( getGaudiThreadGenericName(name()), this ); 01006 if( sc.isFailure() ) return StatusCode::FAILURE; 01007 01008 // set specific Properties 01009 if (isGaudiThreaded(name())) { 01010 if(jos->setMyProperties( name(), this ).isFailure()) { 01011 return StatusCode::FAILURE; 01012 } 01013 } 01014 return sc; 01015 } 01016 } 01017 return StatusCode::FAILURE; 01018 }
| Property* Algorithm::declareProperty | ( | const std::string & | name, | |
| T & | property, | |||
| const std::string & | doc = "none" | |||
| ) | const [inline] |
Declare the named property.
MyAlg ( const std::string& name , ISvcLocator* pSvc ) : Algorithm ( name , pSvc ) , m_property1 ( ... ) , m_property2 ( ... ) { // declare the property declareProperty( "Property1" , m_property1 , "Doc fro property #1" ) ; // declare the property and attach the handler to it declareProperty( "Property2" , m_property2 , "Doc for property #2" ) -> declareUpdateHandler( &MyAlg::handler_2 ) ; }
| name | the property name | |
| property | the property itself, | |
| doc | the documentation string |
Definition at line 386 of file Algorithm.h.
00389 { 00390 return m_propertyMgr->declareProperty(name, property, doc); 00391 }
| Property* Algorithm::declareRemoteProperty | ( | const std::string & | name, | |
| IProperty * | rsvc, | |||
| const std::string & | rname = "" | |||
| ) | const [inline] |
Declare remote named properties.
Definition at line 395 of file Algorithm.h.
00398 { 00399 return m_propertyMgr -> declareRemoteProperty ( name , rsvc , rname ); 00400 }
| SmartIF<IMonitorSvc>& Algorithm::monitorSvc | ( | ) | const [inline] |
Access the monitor service.
| NULL | No monitor service is present | |
| non-NULL | A monitor service is present and available to be used |
Definition at line 411 of file Algorithm.h.
00412 { 00413 // If not already located try to locate it without forcing a creation 00414 if ( !m_pMonitorSvc.isValid() ){ 00415 m_pMonitorSvc = service(m_monitorSvcName, false, true); // do not create and be quiet 00416 } 00417 return m_pMonitorSvc; 00418 }
| void Algorithm::declareInfo | ( | const std::string & | name, | |
| const T & | var, | |||
| const std::string & | desc | |||
| ) | const [inline] |
Declare monitoring information.
| name | Monitoring information name known to the external system | |
| var | Monitoring Listener address (the item to monitor...) | |
| desc | Textual description of the information being monitored |
Definition at line 426 of file Algorithm.h.
00429 { 00430 IMonitorSvc* mS = monitorSvc().get(); 00431 if ( mS ) mS->declareInfo(name, var, desc, this); 00432 }
| void Algorithm::declareInfo | ( | const std::string & | name, | |
| const std::string & | format, | |||
| const void * | var, | |||
| int | size, | |||
| const std::string & | desc | |||
| ) | const [inline] |
Declare monitoring information (special case).
| name | Monitoring information name known to the external system | |
| format | Format information | |
| var | Monitoring Listener address | |
| size | Monitoring Listener address size | |
| desc | Textual description of the information being monitored |
Definition at line 441 of file Algorithm.h.
00446 { 00447 IMonitorSvc* mS = monitorSvc().get(); 00448 if ( mS ) mS->declareInfo(name, format, var, size, desc, this); 00449 }
| StatusCode Algorithm::setProperty | ( | const std::string & | name, | |
| const TYPE & | value | |||
| ) | [inline] |
set the property form the value
std::vector<double> data = ... ; setProperty( "Data" , data ) ; std::map<std::string,double> cuts = ... ; setProperty( "Cuts" , cuts ) ; std::map<std::string,std::string> dict = ... ; setProperty( "Dictionary" , dict ) ;
Note: the interface IProperty allows setting of the properties either directly from other properties or from strings only
This is very convenient in resetting of the default properties in the derived classes. E.g. without this method one needs to convert everything into strings to use IProperty::setProperty
setProperty ( "OutputLevel" , "1" ) ; setProperty ( "Enable" , "True" ) ; setProperty ( "ErrorMax" , "10" ) ;
For simple cases it is more or less ok, but for complicated properties it is just ugly..
| name | name of the property | |
| value | value of the property |
Definition at line 497 of file Algorithm.h.
00499 { return Gaudi::Utils::setProperty ( m_propertyMgr , name , value ) ; }
| bool Algorithm::isInitialized | ( | ) | const [inline, protected] |
Has the Algorithm already been initialized?
Definition at line 504 of file Algorithm.h.
00504 { return Gaudi::StateMachine::INITIALIZED == m_state; }
| bool Algorithm::isFinalized | ( | ) | const [inline, protected] |
Has the Algorithm already been finalized?
Definition at line 507 of file Algorithm.h.
00507 { return Gaudi::StateMachine::CONFIGURED == m_state; }
| int Algorithm::outputLevel | ( | ) | const [inline, protected] |
retrieve the Algorithm output level
Definition at line 510 of file Algorithm.h.
00510 { return (int)m_outputLevel ; }
| IntegerProperty& Algorithm::outputLevelProperty | ( | ) | [inline, protected] |
Accessor for the Message level property.
Definition at line 513 of file Algorithm.h.
00513 { return m_outputLevel; }
| void Algorithm::initOutputLevel | ( | Property & | prop | ) | [protected] |
callback for output level property
Protected Member Functions.
Definition at line 1071 of file Algorithm.cpp.
| StatusCode Algorithm::service_i | ( | const std::string & | svcName, | |
| bool | createIf, | |||
| const InterfaceID & | iid, | |||
| void ** | ppSvc | |||
| ) | const [private] |
implementation of service method
Definition at line 1077 of file Algorithm.cpp.
01080 { 01081 const ServiceLocatorHelper helper(*serviceLocator(), *this); 01082 return helper.getService(svcName, createIf, iid, ppSvc); 01083 }
| StatusCode Algorithm::service_i | ( | const std::string & | svcType, | |
| const std::string & | svcName, | |||
| const InterfaceID & | iid, | |||
| void ** | ppSvc | |||
| ) | const [private] |
Definition at line 1086 of file Algorithm.cpp.
01089 { 01090 const ServiceLocatorHelper helper(*serviceLocator(), *this); 01091 return helper.createService(svcType, svcName, iid, ppSvc); 01092 }
Private assignment operator: NO ASSIGNMENT ALLOWED.
std::string Algorithm::m_name [private] |
std::string Algorithm::m_version [private] |
std::vector<Algorithm *>* Algorithm::m_subAlgms [private] |
SmartIF<IMessageSvc> Algorithm::m_MS [mutable, private] |
SmartIF<IDataProviderSvc> Algorithm::m_EDS [mutable, private] |
SmartIF<IConversionSvc> Algorithm::m_ECS [mutable, private] |
SmartIF<IDataProviderSvc> Algorithm::m_DDS [mutable, private] |
SmartIF<IConversionSvc> Algorithm::m_DCS [mutable, private] |
SmartIF<IHistogramSvc> Algorithm::m_HDS [mutable, private] |
SmartIF<INTupleSvc> Algorithm::m_NTS [mutable, private] |
SmartIF<IChronoStatSvc> Algorithm::m_CSS [mutable, private] |
SmartIF<IRndmGenSvc> Algorithm::m_RGS [mutable, private] |
SmartIF<IExceptionSvc> Algorithm::m_EXS [mutable, private] |
SmartIF<IAuditorSvc> Algorithm::m_pAuditorSvc [mutable, private] |
SmartIF<IToolSvc> Algorithm::m_ptoolSvc [mutable, private] |
SmartIF<IMonitorSvc> Algorithm::m_pMonitorSvc [mutable, private] |
std::string Algorithm::m_monitorSvcName [private] |
SmartIF<ISvcLocator> Algorithm::m_pSvcLocator [private] |
PropertyMgr* Algorithm::m_propertyMgr [private] |
IntegerProperty Algorithm::m_outputLevel [private] |
int Algorithm::m_errorMax [private] |
int Algorithm::m_errorCount [private] |
BooleanProperty Algorithm::m_auditInit [private] |
bool Algorithm::m_auditorInitialize [private] |
bool Algorithm::m_auditorReinitialize [private] |
bool Algorithm::m_auditorRestart [private] |
bool Algorithm::m_auditorExecute [private] |
bool Algorithm::m_auditorFinalize [private] |
bool Algorithm::m_auditorBeginRun [private] |
bool Algorithm::m_auditorEndRun [private] |
bool Algorithm::m_auditorStart [private] |
bool Algorithm::m_auditorStop [private] |
bool Algorithm::m_filterPassed [private] |
bool Algorithm::m_isEnabled [private] |
bool Algorithm::m_isExecuted [private] |
Gaudi::StateMachine::State Algorithm::m_state [private] |
bool Algorithm::m_isFinalized [private] |