|
Gaudi Framework, version v21r7p1 |
| Home | Generated: 15 Feb 2010 |
#include <GaudiKernel/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< IAlgContextSvc > & | contextSvc () const |
| get Algorithm Context Service | |
| SmartIF< ISvcLocator > & | serviceLocator () const |
| The standard service locator. | |
| SmartIF< ISvcLocator > & | svcLoc () const |
| shortcut for method serviceLocator | |
| bool | registerContext () const |
| register for Algorithm Context Service? | |
| 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. | |
| SmartIF< IAlgContextSvc > | m_contextSvc |
| Algorithm Context Service. | |
| bool | m_registerContext |
| flag to register for Algorithm Context 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. | |
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 62 of file Algorithm.h.
| 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 29 of file Algorithm.cpp.
00031 : m_name(name), 00032 m_version(version), 00033 m_registerContext ( false ) , 00034 m_pSvcLocator(pSvcLocator), 00035 m_filterPassed(true), 00036 m_isEnabled(true), 00037 m_isExecuted(false), 00038 m_state(Gaudi::StateMachine::CONFIGURED), 00039 m_targetState(Gaudi::StateMachine::CONFIGURED) 00040 { 00041 m_propertyMgr = new PropertyMgr(); 00042 m_subAlgms = new std::vector<Algorithm *>(); 00043 00044 // Declare common Algorithm properties with their defaults 00045 declareProperty( "OutputLevel", m_outputLevel = MSG::NIL); 00046 declareProperty( "Enable", m_isEnabled = true); 00047 declareProperty( "ErrorMax", m_errorMax = 1); 00048 declareProperty( "ErrorCount", m_errorCount = 0); 00049 // Auditor monitoring properties 00050 00051 // Get the default setting for service auditing from the AppMgr 00052 declareProperty( "AuditAlgorithms", m_auditInit ); 00053 00054 bool audit(false); 00055 SmartIF<IProperty> appMgr(serviceLocator()->service("ApplicationMgr")); 00056 if (appMgr.isValid()) { 00057 const Property& prop = appMgr->getProperty("AuditAlgorithms"); 00058 Property &pr = const_cast<Property&>(prop); 00059 if (m_name != "IncidentSvc") { 00060 setProperty( pr ).ignore(); 00061 } 00062 audit = m_auditInit.value(); 00063 } 00064 00065 declareProperty( "AuditInitialize" , m_auditorInitialize = audit ) ; 00066 declareProperty( "AuditReinitialize", m_auditorReinitialize = audit ) ; 00067 declareProperty( "AuditRestart" , m_auditorRestart = audit ) ; 00068 declareProperty( "AuditExecute" , m_auditorExecute = audit ) ; 00069 declareProperty( "AuditFinalize" , m_auditorFinalize = audit ) ; 00070 declareProperty( "AuditBeginRun" , m_auditorBeginRun = audit ) ; 00071 declareProperty( "AuditEndRun" , m_auditorEndRun = audit ) ; 00072 declareProperty( "AuditStart" , m_auditorStart = audit ) ; 00073 declareProperty( "AuditStop" , m_auditorStop = audit ) ; 00074 00075 declareProperty( "MonitorService" , m_monitorSvcName = "MonitorSvc" ); 00076 00077 declareProperty 00078 ( "RegisterForContextService" , 00079 m_registerContext , 00080 "The flag to enforce the registration for Algorithm Context Service") ; 00081 00082 // update handlers. 00083 m_outputLevel.declareUpdateHandler(&Algorithm::initOutputLevel, this); 00084 00085 }
| Algorithm::~Algorithm | ( | ) | [virtual] |
Destructor.
Definition at line 88 of file Algorithm.cpp.
00088 { 00089 delete m_subAlgms; 00090 delete m_propertyMgr; 00091 }
| 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 180 of file Algorithm.cpp.
00180 { 00181 00182 // Bypass the startup if already running or disabled. 00183 if ( Gaudi::StateMachine::RUNNING == FSMState() || 00184 !isEnabled() ) return StatusCode::SUCCESS; 00185 00186 m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::START,m_state); 00187 00188 // TODO: (MCl) where shoud we do this? initialize or start? 00189 // Reset Error count 00190 m_errorCount = 0; 00191 00192 // lock the context service 00193 Gaudi::Utils::AlgContext cnt 00194 ( this , registerContext() ? contextSvc().get() : 0 ) ; 00195 00196 StatusCode sc; 00197 // Invoke start() method of the derived class inside a try/catch clause 00198 try 00199 { 00200 { // limit the scope of the guard 00201 Gaudi::Guards::AuditorGuard guard 00202 (this, 00203 // check if we want to audit the initialize 00204 (m_auditorStart) ? auditorSvc().get() : 0, 00205 IAuditor::Start); 00206 // Invoke the start() method of the derived class 00207 sc = start(); 00208 } 00209 if( sc.isFailure() ) return StatusCode::FAILURE; 00210 00211 // Now start any sub-algorithms 00212 std::vector<Algorithm *>::iterator it; 00213 StatusCode result = StatusCode::SUCCESS; 00214 for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) { 00215 sc = (*it)->sysStart(); 00216 if( sc.isFailure() ) result = sc; 00217 } 00218 if( result.isFailure() ) { 00219 MsgStream log ( msgSvc() , name() ); 00220 log << MSG::ERROR << " Error starting one or several sub-algorithms" 00221 << endmsg; 00222 return result; 00223 } 00224 // Update the state. 00225 m_state = m_targetState; 00226 return StatusCode::SUCCESS; 00227 } 00228 catch ( const GaudiException& Exception ) 00229 { 00230 MsgStream log ( msgSvc() , name() ); 00231 log << MSG::FATAL << "in sysStart(): exception with tag=" << Exception.tag() 00232 << " is caught" << endmsg; 00233 log << MSG::ERROR << Exception << endmsg; 00234 Stat stat( chronoSvc() , Exception.tag() ); 00235 } 00236 catch( const std::exception& Exception ) 00237 { 00238 MsgStream log ( msgSvc() , name() ); 00239 log << MSG::FATAL << "in sysStart(): standard std::exception is caught" << endmsg; 00240 log << MSG::ERROR << Exception.what() << endmsg; 00241 Stat stat( chronoSvc() , "*std::exception*" ); 00242 } 00243 catch(...) 00244 { 00245 MsgStream log ( msgSvc() , name() ); 00246 log << MSG::FATAL << "in sysStart(): UNKNOWN Exception is caught" << endmsg; 00247 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00248 } 00249 00250 return StatusCode::FAILURE; 00251 }
| 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 94 of file Algorithm.cpp.
00094 { 00095 00096 // Bypass the initialization if the algorithm 00097 // has already been initialized. 00098 if ( Gaudi::StateMachine::INITIALIZED <= FSMState() ) return StatusCode::SUCCESS; 00099 00100 // Set the Algorithm's properties 00101 StatusCode sc = setProperties(); 00102 if( sc.isFailure() ) return StatusCode::FAILURE; 00103 00104 // Bypass the initialization if the algorithm is disabled. 00105 // Need to do this after setProperties. 00106 if ( !isEnabled( ) ) return StatusCode::SUCCESS; 00107 00108 m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::INITIALIZE,m_state); 00109 00110 // Check current outputLevel to evetually inform the MessagsSvc 00111 //if( m_outputLevel != MSG::NIL ) { 00112 setOutputLevel( m_outputLevel ); 00113 //} 00114 00115 // TODO: (MCl) where shoud we do this? initialize or start? 00116 // Reset Error count 00117 //m_errorCount = 0; 00118 00119 // lock the context service 00120 Gaudi::Utils::AlgContext cnt 00121 ( this , registerContext() ? contextSvc().get() : 0 ) ; 00122 00123 // Invoke initialize() method of the derived class inside a try/catch clause 00124 try { 00125 00126 { // limit the scope of the guard 00127 Gaudi::Guards::AuditorGuard guard 00128 ( this, 00129 // check if we want to audit the initialize 00130 (m_auditorInitialize) ? auditorSvc().get() : 0, 00131 IAuditor::Initialize); 00132 // Invoke the initialize() method of the derived class 00133 sc = initialize(); 00134 } 00135 if( sc.isFailure() ) return StatusCode::FAILURE; 00136 00137 // Now initialize care of any sub-algorithms 00138 std::vector<Algorithm *>::iterator it; 00139 StatusCode result = StatusCode::SUCCESS; 00140 for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) { 00141 sc = (*it)->sysInitialize(); 00142 if( sc.isFailure() ) result = sc; 00143 } 00144 if( result.isFailure() ) { 00145 MsgStream log ( msgSvc() , name() ); 00146 log << MSG::ERROR << " Error initializing one or several sub-algorithms" 00147 << endmsg; 00148 return result; 00149 } 00150 // Update the state. 00151 m_state = m_targetState; 00152 return StatusCode::SUCCESS; 00153 } 00154 catch ( const GaudiException& Exception ) 00155 { 00156 MsgStream log ( msgSvc() , name() ) ; 00157 log << MSG::FATAL << " Exception with tag=" << Exception.tag() 00158 << " is caught " << endmsg; 00159 log << MSG::ERROR << Exception << endmsg; 00160 Stat stat( chronoSvc() , Exception.tag() ); 00161 } 00162 catch( const std::exception& Exception ) 00163 { 00164 MsgStream log ( msgSvc() , name() ) ; 00165 log << MSG::FATAL << " Standard std::exception is caught " << endmsg; 00166 log << MSG::ERROR << Exception.what() << endmsg; 00167 Stat stat( chronoSvc() , "*std::exception*" ); 00168 } 00169 catch(...) 00170 { 00171 MsgStream log ( msgSvc() , name() ) ; 00172 log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg; 00173 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00174 } 00175 00176 return StatusCode::FAILURE; 00177 }
| 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 254 of file Algorithm.cpp.
00254 { 00255 00256 // Bypass the initialization if the algorithm is disabled. 00257 if ( !isEnabled( ) ) return StatusCode::SUCCESS; 00258 00259 // Check that the current status is the correct one. 00260 if ( Gaudi::StateMachine::INITIALIZED != FSMState() ) { 00261 MsgStream log ( msgSvc() , name() ); 00262 log << MSG::ERROR 00263 << "sysReinitialize(): cannot reinitialize algorithm not initialized" 00264 << endmsg; 00265 return StatusCode::FAILURE; 00266 } 00267 00268 // Check current outputLevel to evetually inform the MessagsSvc 00269 //if( m_outputLevel != MSG::NIL ) { 00270 setOutputLevel( m_outputLevel ); 00271 //} 00272 00273 // Reset Error count 00274 // m_errorCount = 0; // done during start 00275 00276 // lock the context service 00277 Gaudi::Utils::AlgContext cnt 00278 ( this , registerContext() ? contextSvc().get() : 0 ) ; 00279 00280 StatusCode sc(StatusCode::SUCCESS,true); 00281 // Invoke reinitialize() method of the derived class inside a try/catch clause 00282 try { 00283 { // limit the scope of the guard 00284 Gaudi::Guards::AuditorGuard guard(this, 00285 // check if we want to audit the initialize 00286 (m_auditorReinitialize) ? auditorSvc().get() : 0, 00287 IAuditor::ReInitialize); 00288 // Invoke the reinitialize() method of the derived class 00289 sc = reinitialize(); 00290 } 00291 if( sc.isFailure() ) return StatusCode::FAILURE; 00292 00293 // Now initialize care of any sub-algorithms 00294 std::vector<Algorithm *>::iterator it; 00295 StatusCode result = StatusCode::SUCCESS; 00296 for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) { 00297 sc = (*it)->sysReinitialize(); 00298 if( sc.isFailure() ) result = sc; 00299 } 00300 if( result.isFailure() ) 00301 { 00302 MsgStream log ( msgSvc() , name() ); 00303 log << MSG::ERROR 00304 << "sysReinitialize(): Error reinitializing one or several sub-algorithms" 00305 << endmsg; 00306 return result; 00307 } 00308 return StatusCode::SUCCESS; 00309 } 00310 catch ( const GaudiException& Exception ) 00311 { 00312 MsgStream log ( msgSvc() , name() ); 00313 log << MSG::FATAL << "sysReinitialize(): Exception with tag=" << Exception.tag() 00314 << " is caught" << endmsg; 00315 log << MSG::ERROR << Exception << endmsg; 00316 Stat stat( chronoSvc() , Exception.tag() ); 00317 } 00318 catch( const std::exception& Exception ) 00319 { 00320 MsgStream log ( msgSvc() , name() ); 00321 log << MSG::FATAL << "sysReinitialize(): Standard std::exception is caught" << endmsg; 00322 log << MSG::ERROR << Exception.what() << endmsg; 00323 Stat stat( chronoSvc() , "*std::exception*" ); 00324 } 00325 catch(...) 00326 { 00327 MsgStream log ( msgSvc() , name() ); 00328 log << MSG::FATAL << "sysReinitialize(): UNKNOWN Exception is caught" << endmsg; 00329 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00330 } 00331 00332 return StatusCode::FAILURE; 00333 }
| 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 336 of file Algorithm.cpp.
00336 { 00337 00338 // Bypass the initialization if the algorithm is disabled. 00339 if ( !isEnabled( ) ) return StatusCode::SUCCESS; 00340 00341 // Check that the current status is the correct one. 00342 if ( Gaudi::StateMachine::RUNNING != FSMState() ) { 00343 MsgStream log ( msgSvc() , name() ); 00344 log << MSG::ERROR 00345 << "sysRestart(): cannot restart algorithm not started" 00346 << endmsg; 00347 return StatusCode::FAILURE; 00348 } 00349 00350 // Check current outputLevel to evetually inform the MessagsSvc 00351 //if( m_outputLevel != MSG::NIL ) { 00352 setOutputLevel( m_outputLevel ); 00353 //} 00354 00355 // Reset Error count 00356 m_errorCount = 0; 00357 00358 // lock the context service 00359 Gaudi::Utils::AlgContext cnt 00360 ( this , registerContext() ? contextSvc().get() : 0 ) ; 00361 00362 StatusCode sc(StatusCode::SUCCESS,true); 00363 // Invoke reinitialize() method of the derived class inside a try/catch clause 00364 try { 00365 { // limit the scope of the guard 00366 Gaudi::Guards::AuditorGuard guard(this, 00367 // check if we want to audit the initialize 00368 (m_auditorRestart) ? auditorSvc().get() : 0, 00369 IAuditor::ReStart); 00370 // Invoke the reinitialize() method of the derived class 00371 sc = restart(); 00372 } 00373 if( sc.isFailure() ) return StatusCode::FAILURE; 00374 00375 // Now initialize care of any sub-algorithms 00376 std::vector<Algorithm *>::iterator it; 00377 StatusCode result = StatusCode::SUCCESS; 00378 for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) { 00379 sc = (*it)->sysRestart(); 00380 if( sc.isFailure() ) result = sc; 00381 } 00382 if( result.isFailure() ) { 00383 MsgStream log ( msgSvc() , name() ); 00384 log << MSG::ERROR 00385 << "sysRestart(): Error restarting one or several sub-algorithms" 00386 << endmsg; 00387 return result; 00388 } 00389 return StatusCode::SUCCESS; 00390 } 00391 catch ( const GaudiException& Exception ) 00392 { 00393 MsgStream log ( msgSvc() , name() ); 00394 log << MSG::FATAL << "sysRestart(): Exception with tag=" << Exception.tag() 00395 << " is caught" << endmsg; 00396 log << MSG::ERROR << Exception << endmsg; 00397 Stat stat( chronoSvc() , Exception.tag() ); 00398 } 00399 catch( const std::exception& Exception ) 00400 { 00401 MsgStream log ( msgSvc() , name() ); 00402 log << MSG::FATAL << "sysRestart(): Standard std::exception is caught" << endmsg; 00403 log << MSG::ERROR << Exception.what() << endmsg; 00404 Stat stat( chronoSvc() , "*std::exception*" ); 00405 } 00406 catch(...) 00407 { 00408 MsgStream log ( msgSvc() , name() ); 00409 log << MSG::FATAL << "sysRestart(): UNKNOWN Exception is caught" << endmsg; 00410 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00411 } 00412 00413 return StatusCode::FAILURE; 00414 }
| 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 567 of file Algorithm.cpp.
00567 { 00568 if (!isEnabled()) { 00569 MsgStream log ( msgSvc() , name() ); 00570 log << MSG::VERBOSE << ".sysExecute(): is not enabled. Skip execution" <<endmsg; 00571 return StatusCode::SUCCESS; 00572 } 00573 00574 StatusCode status; 00575 00576 // Should performance profile be performed ? 00577 // invoke execute() method of Algorithm class 00578 // and catch all uncaught exceptions 00579 00580 // lock the context service 00581 Gaudi::Utils::AlgContext cnt 00582 ( this , registerContext() ? contextSvc().get() : 0 ) ; 00583 00584 Gaudi::Guards::AuditorGuard guard(this, 00585 // check if we want to audit the initialize 00586 (m_auditorExecute) ? auditorSvc().get() : 0, 00587 IAuditor::Execute, 00588 status); 00589 try { 00590 status = execute(); 00591 setExecuted(true); // set the executed flag 00592 00593 if (status.isFailure()) { 00594 status = exceptionSvc()->handleErr(*this,status); 00595 } 00596 00597 } 00598 catch( const GaudiException& Exception ) 00599 { 00600 setExecuted(true); // set the executed flag 00601 00602 MsgStream log ( msgSvc() , name() ); 00603 if (Exception.code() == StatusCode::FAILURE) { 00604 log << MSG::FATAL; 00605 } else { 00606 log << MSG::ERROR << " Recoverable"; 00607 } 00608 00609 log << " Exception with tag=" << Exception.tag() 00610 << " is caught " << endmsg; 00611 00612 log << MSG::ERROR << Exception << endmsg; 00613 00614 Stat stat( chronoSvc() , Exception.tag() ) ; 00615 status = exceptionSvc()->handle(*this,Exception); 00616 } 00617 catch( const std::exception& Exception ) 00618 { 00619 setExecuted(true); // set the executed flag 00620 00621 MsgStream log ( msgSvc() , name() ); 00622 log << MSG::FATAL << " Standard std::exception is caught " << endmsg; 00623 log << MSG::ERROR << Exception.what() << endmsg; 00624 Stat stat( chronoSvc() , "*std::exception*" ) ; 00625 status = exceptionSvc()->handle(*this,Exception); 00626 } 00627 catch(...) 00628 { 00629 setExecuted(true); // set the executed flag 00630 00631 MsgStream log ( msgSvc() , name() ); 00632 log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg; 00633 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00634 00635 status = exceptionSvc()->handle(*this); 00636 } 00637 00638 if( status.isFailure() ) { 00639 MsgStream log ( msgSvc() , name() ); 00640 // Increment the error count 00641 m_errorCount++; 00642 // Check if maximum is exeeded 00643 if( m_errorCount < m_errorMax ) { 00644 log << MSG::WARNING << "Continuing from error (cnt=" << m_errorCount 00645 << ", max=" << m_errorMax << ")" << endmsg; 00646 // convert to success 00647 status = StatusCode::SUCCESS; 00648 } 00649 } 00650 return status; 00651 }
| 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 654 of file Algorithm.cpp.
00654 { 00655 00656 // Bypass the startup if already running or disabled. 00657 if ( Gaudi::StateMachine::INITIALIZED == FSMState() || 00658 !isEnabled() ) return StatusCode::SUCCESS; 00659 00660 m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::STOP,m_state); 00661 00662 // lock the context service 00663 Gaudi::Utils::AlgContext cnt 00664 ( this , registerContext() ? contextSvc().get() : 0 ) ; 00665 00666 StatusCode sc; 00667 // Invoke stop() method of the derived class inside a try/catch clause 00668 try { 00669 // Stop first any sub-algorithms (in reverse order) 00670 std::vector<Algorithm *>::reverse_iterator it; 00671 for (it = m_subAlgms->rbegin(); it != m_subAlgms->rend(); it++) { 00672 (*it)->sysStop().ignore(); 00673 } 00674 { // limit the scope of the guard 00675 Gaudi::Guards::AuditorGuard guard(this, 00676 // check if we want to audit the initialize 00677 (m_auditorStop) ? auditorSvc().get() : 0, 00678 IAuditor::Stop); 00679 00680 // Invoke the stop() method of the derived class 00681 sc = stop(); 00682 } 00683 if( sc.isFailure() ) return StatusCode::FAILURE; 00684 00685 // Update the state. 00686 m_state = m_targetState; 00687 return StatusCode::SUCCESS; 00688 } 00689 catch ( const GaudiException& Exception ) { 00690 MsgStream log ( msgSvc() , name() ); 00691 log << MSG::FATAL << "in sysStop(): exception with tag=" << Exception.tag() 00692 << " is caught" << endmsg; 00693 log << MSG::ERROR << Exception << endmsg; 00694 Stat stat( chronoSvc() , Exception.tag() ); 00695 } 00696 catch( const std::exception& Exception ) { 00697 MsgStream log ( msgSvc() , name() ); 00698 log << MSG::FATAL << "in sysStop(): standard std::exception is caught" << endmsg; 00699 log << MSG::ERROR << Exception.what() << endmsg; 00700 Stat stat( chronoSvc() , "*std::exception*" ); 00701 } 00702 catch(...) { 00703 MsgStream log ( msgSvc() , name() ); 00704 log << MSG::FATAL << "in sysStop(): UNKNOWN Exception is caught" << endmsg; 00705 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00706 } 00707 00708 return StatusCode::FAILURE; 00709 }
| 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 711 of file Algorithm.cpp.
00711 { 00712 00713 // Bypass the finalialization if the algorithm hasn't been initilized. 00714 if ( Gaudi::StateMachine::CONFIGURED == FSMState() || 00715 !isEnabled() ) return StatusCode::SUCCESS; 00716 00717 m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::FINALIZE,m_state); 00718 00719 // lock the context service 00720 Gaudi::Utils::AlgContext cnt 00721 ( this , registerContext() ? contextSvc().get() : 0 ) ; 00722 00723 // Invoke finalize() method of the derived class inside a try/catch clause 00724 StatusCode sc = StatusCode::SUCCESS; 00725 try { 00726 // Order changed (bug #3903 overview: finalize and nested algorithms) 00727 // Finalize first any sub-algoithms (it can be done more than once) 00728 std::vector<Algorithm *>::iterator it; 00729 bool fail(false); 00730 for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) { 00731 if (!(*it)->sysFinalize().isSuccess()) { 00732 fail = true; 00733 } 00734 } 00735 00736 { // limit the scope of the guard 00737 Gaudi::Guards::AuditorGuard guard(this, 00738 // check if we want to audit the initialize 00739 (m_auditorFinalize) ? auditorSvc().get() : 0, 00740 IAuditor::Finalize); 00741 // Invoke the finalize() method of the derived class 00742 sc = finalize(); 00743 } 00744 if( !sc.isSuccess() || fail ) return StatusCode::FAILURE; 00745 00746 // Release all sub-algorithms 00747 for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) { 00748 (*it)->release(); 00749 } 00750 // Indicate that this Algorithm has been finalized to prevent duplicate attempts 00751 m_state = m_targetState; 00752 return sc; 00753 } 00754 catch( const GaudiException& Exception ) 00755 { 00756 MsgStream log ( msgSvc() , name() ); 00757 log << MSG::FATAL << " Exception with tag=" << Exception.tag() 00758 << " is caught " << endmsg; 00759 log << MSG::ERROR << Exception << endmsg; 00760 Stat stat( chronoSvc() , Exception.tag() ) ; 00761 } 00762 catch( const std::exception& Exception ) 00763 { 00764 MsgStream log ( msgSvc() , name() ); 00765 log << MSG::FATAL << " Standard std::exception is caught " << endmsg; 00766 log << MSG::ERROR << Exception.what() << endmsg; 00767 Stat stat( chronoSvc() , "*std::exception*" ) ; 00768 } 00769 catch( ... ) 00770 { 00771 MsgStream log ( msgSvc() , name() ); 00772 log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg; 00773 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00774 } 00775 return StatusCode::FAILURE ; 00776 }
| 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 417 of file Algorithm.cpp.
00417 { 00418 00419 // Bypass the beginRun if the algorithm is disabled. 00420 if ( !isEnabled( ) ) return StatusCode::SUCCESS; 00421 00422 // Check current outputLevel to evetually inform the MessagsSvc 00423 //if( m_outputLevel != MSG::NIL ) { 00424 setOutputLevel( m_outputLevel ); 00425 //} 00426 00427 // Reset Error count 00428 m_errorCount = 0; 00429 00430 // lock the context service 00431 Gaudi::Utils::AlgContext cnt 00432 ( this , registerContext() ? contextSvc().get() : 0 ) ; 00433 00434 StatusCode sc; 00435 // Invoke beginRun() method of the derived class inside a try/catch clause 00436 try { 00437 { // limit the scope of the guard 00438 Gaudi::Guards::AuditorGuard guard(this, 00439 // check if we want to audit the initialize 00440 (m_auditorBeginRun) ? auditorSvc().get() : 0, 00441 IAuditor::BeginRun); 00442 // Invoke the beginRun() method of the derived class 00443 sc = beginRun(); 00444 } 00445 if( sc.isFailure() ) return StatusCode::FAILURE; 00446 00447 // Now call beginRun for any sub-algorithms 00448 std::vector<Algorithm *>::iterator it; 00449 StatusCode result = StatusCode::SUCCESS; 00450 for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) { 00451 sc = (*it)->sysBeginRun(); 00452 if( sc.isFailure() ) result = sc; 00453 } 00454 if( result.isFailure() ) 00455 { 00456 MsgStream log ( msgSvc() , name() ); 00457 log << MSG::ERROR << " Error executing BeginRun for one or several sub-algorithms" 00458 << endmsg; 00459 return result; 00460 } 00461 return StatusCode::SUCCESS; 00462 } 00463 catch ( const GaudiException& Exception ) 00464 { 00465 MsgStream log ( msgSvc() , name() ); 00466 log << MSG::FATAL << " Exception with tag=" << Exception.tag() 00467 << " is caught " << endmsg; 00468 log << MSG::ERROR << Exception << endmsg; 00469 Stat stat( chronoSvc() , Exception.tag() ); 00470 } 00471 catch( const std::exception& Exception ) 00472 { 00473 MsgStream log ( msgSvc() , name() ); 00474 log << MSG::FATAL << " Standard std::exception is caught " << endmsg; 00475 log << MSG::ERROR << Exception.what() << endmsg; 00476 Stat stat( chronoSvc() , "*std::exception*" ); 00477 } 00478 catch(...) 00479 { 00480 MsgStream log ( msgSvc() , name() ); 00481 log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg; 00482 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00483 } 00484 return StatusCode::FAILURE; 00485 }
| 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 492 of file Algorithm.cpp.
00492 { 00493 00494 // Bypass the endRun if the algorithm is disabled. 00495 if ( !isEnabled( ) ) return StatusCode::SUCCESS; 00496 00497 // Check current outputLevel to eventually inform the MessagsSvc 00498 //if( m_outputLevel != MSG::NIL ) { 00499 setOutputLevel( m_outputLevel ); 00500 //} 00501 00502 // Reset Error count 00503 m_errorCount = 0; 00504 00505 // lock the context service 00506 Gaudi::Utils::AlgContext cnt 00507 ( this , registerContext() ? contextSvc().get() : 0 ) ; 00508 00509 // Invoke endRun() method of the derived class inside a try/catch clause 00510 StatusCode sc; 00511 try { 00512 { // limit the scope of the guard 00513 Gaudi::Guards::AuditorGuard guard(this, 00514 // check if we want to audit the initialize 00515 (m_auditorEndRun) ? auditorSvc().get() : 0, 00516 IAuditor::EndRun); 00517 // Invoke the endRun() method of the derived class 00518 sc = endRun(); 00519 } 00520 if( sc.isFailure() ) return StatusCode::FAILURE; 00521 00522 // Now call endRun for any sub-algorithms 00523 std::vector<Algorithm *>::iterator it; 00524 StatusCode result = StatusCode::SUCCESS; 00525 for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) { 00526 sc = (*it)->sysEndRun(); 00527 if( sc.isFailure() ) result = sc; 00528 } 00529 if( result.isFailure() ) 00530 { 00531 MsgStream log ( msgSvc() , name() ); 00532 log << MSG::ERROR << " Error calling endRun for one or several sub-algorithms" 00533 << endmsg; 00534 return result; 00535 } 00536 return StatusCode::SUCCESS; 00537 } 00538 catch ( const GaudiException& Exception ) 00539 { 00540 MsgStream log ( msgSvc() , name() ); 00541 log << MSG::FATAL << " Exception with tag=" << Exception.tag() 00542 << " is caught " << endmsg; 00543 log << MSG::ERROR << Exception << endmsg; 00544 Stat stat( chronoSvc() , Exception.tag() ); 00545 } 00546 catch( const std::exception& Exception ) 00547 { 00548 MsgStream log ( msgSvc() , name() ); 00549 log << MSG::FATAL << " Standard std::exception is caught " << endmsg; 00550 log << MSG::ERROR << Exception.what() << endmsg; 00551 Stat stat( chronoSvc() , "*std::exception*" ); 00552 } 00553 catch(...) 00554 { 00555 MsgStream log ( msgSvc() , name() ); 00556 log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg; 00557 Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00558 } 00559 return StatusCode::FAILURE; 00560 }
| 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 817 of file Algorithm.cpp.
00817 { 00818 return m_name; 00819 }
| const std::string & Algorithm::version | ( | ) | const [virtual] |
| virtual StatusCode Algorithm::configure | ( | ) | [inline, virtual] |
Dummy implementation of IStateful::configure() method.
Definition at line 148 of file Algorithm.h.
00148 { return StatusCode::SUCCESS ; }
| virtual StatusCode Algorithm::terminate | ( | ) | [inline, virtual] |
Dummy implementation of IStateful::terminate() method.
Definition at line 150 of file Algorithm.h.
00150 { 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 153 of file Algorithm.h.
00153 { 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 155 of file Algorithm.h.
00155 { 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 157 of file Algorithm.h.
00157 { 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 159 of file Algorithm.h.
00159 { return StatusCode::SUCCESS ; }
| StatusCode Algorithm::reinitialize | ( | ) | [virtual] |
the default (empty) implementation of IStateful::reinitialize() method
Reimplemented in Sequencer.
Definition at line 778 of file Algorithm.cpp.
00778 { 00779 /* @TODO 00780 * MCl 2008-10-23: the implementation of reinitialize as finalize+initialize 00781 * is causing too many problems 00782 * 00783 // Default implementation is finalize+initialize 00784 StatusCode sc = finalize(); 00785 if (sc.isFailure()) { 00786 MsgStream log ( msgSvc() , name() ); 00787 log << MSG::ERROR << "reinitialize(): cannot be finalized" << endmsg; 00788 return sc; 00789 } 00790 sc = initialize(); 00791 if (sc.isFailure()) { 00792 MsgStream log ( msgSvc() , name() ); 00793 log << MSG::ERROR << "reinitialize(): cannot be initialized" << endmsg; 00794 return sc; 00795 } 00796 */ 00797 return StatusCode::SUCCESS; 00798 }
| StatusCode Algorithm::restart | ( | ) | [virtual] |
the default (empty) implementation of IStateful::restart() method
Definition at line 800 of file Algorithm.cpp.
00800 { 00801 // Default implementation is stop+start 00802 StatusCode sc = stop(); 00803 if (sc.isFailure()) { 00804 MsgStream log ( msgSvc() , name() ); 00805 log << MSG::ERROR << "restart(): cannot be stopped" << endmsg; 00806 return sc; 00807 } 00808 sc = start(); 00809 if (sc.isFailure()) { 00810 MsgStream log ( msgSvc() , name() ); 00811 log << MSG::ERROR << "restart(): cannot be started" << endmsg; 00812 return sc; 00813 } 00814 return StatusCode::SUCCESS; 00815 }
| bool Algorithm::isExecuted | ( | ) | const [virtual] |
Has this algorithm been executed since the last reset?
Definition at line 825 of file Algorithm.cpp.
00825 { 00826 return m_isExecuted; 00827 }
| void Algorithm::setExecuted | ( | bool | state | ) | [virtual] |
Set the executed flag to the specified state.
Definition at line 829 of file Algorithm.cpp.
00829 { 00830 m_isExecuted = state; 00831 }
| 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 833 of file Algorithm.cpp.
00833 { 00834 m_isExecuted = false; 00835 m_filterPassed = true; 00836 }
| 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 487 of file Algorithm.cpp.
00487 { 00488 return StatusCode::SUCCESS; 00489 }
| 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 562 of file Algorithm.cpp.
00562 { 00563 return StatusCode::SUCCESS; 00564 }
| virtual Gaudi::StateMachine::State Algorithm::FSMState | ( | ) | const [inline, virtual] |
returns the current state of the algorithm
Definition at line 186 of file Algorithm.h.
00186 { 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 189 of file Algorithm.h.
00189 { return m_targetState; }
| bool Algorithm::isEnabled | ( | ) | const [virtual] |
Is this algorithm enabled or disabled?
Definition at line 838 of file Algorithm.cpp.
00838 { 00839 return m_isEnabled; 00840 }
| bool Algorithm::filterPassed | ( | ) | const [virtual] |
Did this algorithm pass or fail its filter criterion for the last event?
Definition at line 842 of file Algorithm.cpp.
00842 { 00843 return m_filterPassed; 00844 }
| void Algorithm::setFilterPassed | ( | bool | state | ) | [virtual] |
Set the filter passed flag to the specified state.
Definition at line 846 of file Algorithm.cpp.
00846 { 00847 m_filterPassed = state; 00848 }
| 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 203 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 209 of file Algorithm.h.
00210 { 00211 return service_i(svcType, svcName, T::interfaceID(), (void**)&psvc); 00212 }
| 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 1170 of file Algorithm.cpp.
01170 { 01171 const ServiceLocatorHelper helper(*serviceLocator(), *this); 01172 return helper.service(name, quiet, createIf); 01173 }
| 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 |
| m_CSS m_DCS m_ECS m_EXS m_RGS m_contextSvc SmartIF< IChronoStatSvc > & Algorithm::chronoStatService | ( | ) | const |
Obsoleted name, kept due to the backwards compatibility.
Definition at line 903 of file Algorithm.cpp.
00903 { 00904 return chronoSvc(); 00905 }
| 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 907 of file Algorithm.cpp.
00907 { 00908 return detSvc(); 00909 }
| 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 911 of file Algorithm.cpp.
00911 { 00912 return detCnvSvc(); 00913 }
| 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 253 of file Algorithm.h.
00253 { return eventSvc() ; }
| SmartIF< IDataProviderSvc > & Algorithm::eventDataService | ( | ) | const |
Obsoleted name, kept due to the backwards compatibility.
Definition at line 915 of file Algorithm.cpp.
00915 { 00916 return eventSvc(); 00917 }
| 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 919 of file Algorithm.cpp.
00919 { 00920 return eventCnvSvc(); 00921 }
| 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 923 of file Algorithm.cpp.
00923 { 00924 return histoSvc(); 00925 }
| 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 876 of file Algorithm.cpp.
00876 { 00877 if ( !m_MS.isValid() ) { 00878 //can not use service() method (infinite recursion!) 00879 m_MS = serviceLocator(); // default message service 00880 if( !m_MS.isValid() ) { 00881 throw GaudiException("Service [MessageSvc] not found", name(), StatusCode::FAILURE); 00882 } 00883 } 00884 return m_MS; 00885 }
| SmartIF< IMessageSvc > & Algorithm::messageService | ( | ) | const |
Obsoleted name, kept due to the backwards compatibility.
Definition at line 927 of file Algorithm.cpp.
00927 { 00928 return msgSvc(); 00929 }
| 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 931 of file Algorithm.cpp.
00931 { 00932 return ntupleSvc(); 00933 }
| 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<IAlgContextSvc>& Algorithm::contextSvc | ( | ) | const |
| 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 1071 of file Algorithm.cpp.
01071 { 01072 return *const_cast<SmartIF<ISvcLocator>*>(&m_pSvcLocator); 01073 }
| SmartIF<ISvcLocator>& Algorithm::svcLoc | ( | ) | const [inline] |
shortcut for method serviceLocator
Definition at line 315 of file Algorithm.h.
00315 { return serviceLocator() ; }
| bool Algorithm::registerContext | ( | ) | const [inline] |
register for Algorithm Context Service?
Definition at line 318 of file Algorithm.h.
00318 { return m_registerContext ; }
| 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 1096 of file Algorithm.cpp.
01098 { 01099 if( m_pSvcLocator == 0 ) return StatusCode::FAILURE; 01100 01101 SmartIF<IAlgManager> am(m_pSvcLocator); 01102 if ( !am.isValid() ) return StatusCode::FAILURE; 01103 01104 // Maybe modify the AppMgr interface to return Algorithm* ?? 01105 IAlgorithm *tmp; 01106 StatusCode sc = am->createAlgorithm 01107 (type, name+getGaudiThreadIDfromName(Algorithm::name()), tmp); 01108 if( sc.isFailure() ) return StatusCode::FAILURE; 01109 01110 try{ 01111 pSubAlgorithm = dynamic_cast<Algorithm*>(tmp); 01112 m_subAlgms->push_back(pSubAlgorithm); 01113 } catch(...){ 01114 sc = StatusCode::FAILURE; 01115 } 01116 return sc; 01117 }
| std::vector< Algorithm * > * Algorithm::subAlgorithms | ( | ) | const |
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition at line 850 of file Algorithm.cpp.
00850 { 00851 return m_subAlgms; 00852 }
| StatusCode Algorithm::setProperty | ( | const Property & | p | ) | [virtual] |
Implementation of IProperty::setProperty.
Definition at line 1121 of file Algorithm.cpp.
01121 { 01122 return m_propertyMgr->setProperty(p); 01123 }
| StatusCode Algorithm::setProperty | ( | const std::string & | s | ) | [virtual] |
Implementation of IProperty::setProperty.
Definition at line 1124 of file Algorithm.cpp.
01124 { 01125 return m_propertyMgr->setProperty(s); 01126 }
| StatusCode Algorithm::setProperty | ( | const std::string & | n, | |
| const std::string & | v | |||
| ) | [virtual] |
Implementation of IProperty::setProperty.
Definition at line 1127 of file Algorithm.cpp.
01127 { 01128 return m_propertyMgr->setProperty(n,v); 01129 }
| StatusCode Algorithm::getProperty | ( | Property * | p | ) | const [virtual] |
Implementation of IProperty::getProperty.
Definition at line 1130 of file Algorithm.cpp.
01130 { 01131 return m_propertyMgr->getProperty(p); 01132 }
| const Property & Algorithm::getProperty | ( | const std::string & | name | ) | const [virtual] |
Implementation of IProperty::getProperty.
Definition at line 1133 of file Algorithm.cpp.
01133 { 01134 return m_propertyMgr->getProperty(name); 01135 }
| StatusCode Algorithm::getProperty | ( | const std::string & | n, | |
| std::string & | v | |||
| ) | const [virtual] |
Implementation of IProperty::getProperty.
Definition at line 1136 of file Algorithm.cpp.
01136 { 01137 return m_propertyMgr->getProperty(n,v); 01138 }
| const std::vector< Property * > & Algorithm::getProperties | ( | ) | const [virtual] |
Implementation of IProperty::getProperties.
Definition at line 1139 of file Algorithm.cpp.
01139 { 01140 return m_propertyMgr->getProperties(); 01141 }
| 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 1076 of file Algorithm.cpp.
01076 { 01077 if( m_pSvcLocator != 0 ) { 01078 SmartIF<IJobOptionsSvc> jos(m_pSvcLocator->service("JobOptionsSvc")); 01079 if( jos.isValid() ) { 01080 // set first generic Properties 01081 StatusCode sc = jos->setMyProperties( getGaudiThreadGenericName(name()), this ); 01082 if( sc.isFailure() ) return StatusCode::FAILURE; 01083 01084 // set specific Properties 01085 if (isGaudiThreaded(name())) { 01086 if(jos->setMyProperties( name(), this ).isFailure()) { 01087 return StatusCode::FAILURE; 01088 } 01089 } 01090 return sc; 01091 } 01092 } 01093 return StatusCode::FAILURE; 01094 }
| 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 393 of file Algorithm.h.
00396 { 00397 return m_propertyMgr->declareProperty(name, property, doc); 00398 }
| Property* Algorithm::declareRemoteProperty | ( | const std::string & | name, | |
| IProperty * | rsvc, | |||
| const std::string & | rname = "" | |||
| ) | const [inline] |
Declare remote named properties.
Definition at line 402 of file Algorithm.h.
00405 { 00406 return m_propertyMgr -> declareRemoteProperty ( name , rsvc , rname ); 00407 }
| 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 418 of file Algorithm.h.
00419 { 00420 // If not already located try to locate it without forcing a creation 00421 if ( !m_pMonitorSvc.isValid() ){ 00422 m_pMonitorSvc = service(m_monitorSvcName, false, true); // do not create and be quiet 00423 } 00424 return m_pMonitorSvc; 00425 }
| 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 433 of file Algorithm.h.
00436 { 00437 IMonitorSvc* mS = monitorSvc().get(); 00438 if ( mS ) mS->declareInfo(name, var, desc, this); 00439 }
| 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 448 of file Algorithm.h.
00453 { 00454 IMonitorSvc* mS = monitorSvc().get(); 00455 if ( mS ) mS->declareInfo(name, format, var, size, desc, this); 00456 }
| 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 504 of file Algorithm.h.
00506 { return Gaudi::Utils::setProperty ( m_propertyMgr , name , value ) ; }
| bool Algorithm::isInitialized | ( | ) | const [inline, protected] |
Has the Algorithm already been initialized?
Definition at line 511 of file Algorithm.h.
00511 { return Gaudi::StateMachine::INITIALIZED == m_state; }
| bool Algorithm::isFinalized | ( | ) | const [inline, protected] |
Has the Algorithm already been finalized?
Definition at line 514 of file Algorithm.h.
00514 { return Gaudi::StateMachine::CONFIGURED == m_state; }
| int Algorithm::outputLevel | ( | ) | const [inline, protected] |
retrieve the Algorithm output level
Definition at line 517 of file Algorithm.h.
00517 { return (int)m_outputLevel ; }
| IntegerProperty& Algorithm::outputLevelProperty | ( | ) | [inline, protected] |
Accessor for the Message level property.
Definition at line 520 of file Algorithm.h.
00520 { return m_outputLevel; }
| void Algorithm::initOutputLevel | ( | Property & | prop | ) | [protected] |
callback for output level property
Protected Member Functions.
Definition at line 1147 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 1153 of file Algorithm.cpp.
01156 { 01157 const ServiceLocatorHelper helper(*serviceLocator(), *this); 01158 return helper.getService(svcName, createIf, iid, ppSvc); 01159 }
| StatusCode Algorithm::service_i | ( | const std::string & | svcType, | |
| const std::string & | svcName, | |||
| const InterfaceID & | iid, | |||
| void ** | ppSvc | |||
| ) | const [private] |
Definition at line 1162 of file Algorithm.cpp.
01165 { 01166 const ServiceLocatorHelper helper(*serviceLocator(), *this); 01167 return helper.createService(svcType, svcName, iid, ppSvc); 01168 }
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] |
SmartIF<IAlgContextSvc> Algorithm::m_contextSvc [mutable, private] |
bool Algorithm::m_registerContext [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] |