| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# Algorithm Class Reference

`#include <GaudiKernel/Algorithm.h>`

Inheritance diagram for Algorithm:

[legend]
Collaboration diagram for Algorithm:

[legend]

List of all members.

## Detailed Description

Base class from which all concrete algorithm classes should be derived.

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 initialise() and afterwards (see the Gaudi user guide).

Author:
  Paul Maley

  Pere Mato

  David Quarrie

Date:
  1998

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
| The version of the algorithm.
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.
void | setOutputLevel (int level)
| Set the outputlevel for current algorithm.
IAuditorSvc * | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked.
IChronoStatSvc * | chronoSvc () const
| The standard Chrono & Stat service, Return a pointer to the service if present.
IChronoStatSvc * | chronoStatService () const
| Obsoleted name, kept due to the backwards compatibility.
IDataProviderSvc * | detSvc () const
| The standard detector data service.
IDataProviderSvc * | detDataService () const
| Obsoleted name, kept due to the backwards compatibility.
IConversionSvc * | detCnvSvc () const
| The standard detector data persistency conversion service.
IConversionSvc * | detDataCnvService () const
| Obsoleted name, kept due to the backwards compatibility.
IDataProviderSvc * | eventSvc () const
| The standard event data service.
IDataProviderSvc * | evtSvc () const
| shortcut for method eventSvc
IDataProviderSvc * | eventDataService () const
| Obsoleted name, kept due to the backwards compatibility.
IConversionSvc * | eventCnvSvc () const
| The standard event data persistency conversion service.
IConversionSvc * | eventDataCnvService () const
| Obsoleted name, kept due to the backwards compatibility.
IHistogramSvc * | histoSvc () const
| The standard histogram service.
IHistogramSvc * | histogramDataService () const
| Obsoleted name, kept due to the backwards compatibility.
IMessageSvc * | msgSvc () const
| The standard message service.
IMessageSvc * | messageService () const
| Obsoleted name, kept due to the backwards compatibility.
INTupleSvc * | ntupleSvc () const
| The standard N tuple service.
INTupleSvc * | ntupleService () const
| Obsoleted name, kept due to the backwards compatibility.
IRndmGenSvc * | randSvc () const
| AIDA-based NTuple service Returns a pointer to the AIDATuple service if present.
IToolSvc * | toolSvc () const
| The standard ToolSvc service, Return a pointer to the service if present.
IExceptionSvc * | exceptionSvc () const
| Get the exception Service.
ISvcLocator * | serviceLocator () const
| The standard service locator.
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.
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).
unsigned long | addRef ()
| Methods for IInterface::addRef().
unsigned long | release ()
| Methods for IInterface::release().
StatusCode | queryInterface (const InterfaceID &riid, void **)
| Methods for IInterface::queryInterface().
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 asignment operator: NO ASSIGNMENT ALLOWED.
## Private Attributes
long | m_refCount
| Counter for references to Algorithm.
std::string | m_name
| Algorithm's name for identification.
std::string | m_version
| Algorithm's version.
std::vector< Algorithm * > * | m_subAlgms
| Sub algorithms.
IMessageSvc * | m_MS
| Message service.
IDataProviderSvc * | m_EDS
| Event data service.
IConversionSvc * | m_ECS
| Event conversion service.
IDataProviderSvc * | m_DDS
| Detector data service.
IConversionSvc * | m_DCS
| Detector conversion service.
IHistogramSvc * | m_HDS
| Histogram data service.
INTupleSvc * | m_NTS
| N tuple service.
IChronoStatSvc * | m_CSS
| Chrono & Stat Service.
IRndmGenSvc * | m_RGS
| Random Number Generator Service.
IExceptionSvc * | m_EXS
| Exception Handler Service.
IAuditorSvc * | m_pAuditorSvc
| Auditor Service.
IToolSvc * | m_ptoolSvc
| ToolSvc Service.
IMonitorSvc * | m_pMonitorSvc
| Online Monitoring Service.
std::string | m_monitorSvcName
| Name to use for Monitor Service.
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.

## Constructor & Destructor Documentation

Algorithm::Algorithm | ( | const std::string & | name,
|  | ISvcLocator * | svcloc,
|  | const std::string & | version = `PACKAGE_VERSION` |
| ) |  |  |

Constructor.

Parameters:

  | name | The algorithm object's name
  | svcloc | A pointer to a service location service

Definition at line 28 of file Algorithm.cpp.

    00030   : m_refCount(0),
    00031     m_name(name),
    00032     m_version(version),
    00033     m_MS(0),
    00034     m_EDS(0),
    00035     m_ECS(0),
    00036     m_DDS(0),
    00037     m_DCS(0),
    00038     m_HDS(0),
    00039     m_NTS(0),
    00040     //AIDATupleSvc:
    00041     // m_ATS(0),
    00042     m_CSS(0),
    00043     m_RGS(0),
    00044     m_EXS(0),
    00045     m_pAuditorSvc(0),
    00046     m_ptoolSvc(0),
    00047     m_pMonitorSvc(NULL),
    00048     m_pSvcLocator(pSvcLocator),
    00049     m_filterPassed(true),
    00050     m_isEnabled(true),
    00051     m_isExecuted(false),
    00052     m_state(Gaudi::StateMachine::CONFIGURED),
    00053     m_targetState(Gaudi::StateMachine::CONFIGURED)
    00054 {
    00055   m_propertyMgr = new PropertyMgr();
    00056   m_subAlgms = new std::vector<Algorithm *>();
    00057
    00058   // Declare common Algorithm properties with their defaults
    00059   declareProperty( "OutputLevel",        m_outputLevel = MSG::NIL);
    00060   declareProperty( "Enable",             m_isEnabled = true);
    00061   declareProperty( "ErrorMax",           m_errorMax  = 1);
    00062   declareProperty( "ErrorCount",         m_errorCount = 0);
    00063   // Auditor monitoring properties
    00064
    00065   // Get the default setting for service auditing from the AppMgr
    00066   declareProperty( "AuditAlgorithms", m_auditInit );
    00067
    00068   IProperty *appMgr;
    00069   bool audit(false);
    00070   if (serviceLocator()->service("ApplicationMgr", appMgr, false).isSuccess()) {
    00071     const Property& prop = appMgr->getProperty("AuditAlgorithms");
    00072     Property &pr = const_cast<Property&>(prop);
    00073     if (m_name != "IncidentSvc") {
    00074       setProperty( pr ).ignore();
    00075     }
    00076     audit = m_auditInit.value();
    00077   }
    00078
    00079   declareProperty( "AuditInitialize"  , m_auditorInitialize   = audit ) ;
    00080   declareProperty( "AuditReinitialize", m_auditorReinitialize = audit ) ;
    00081   declareProperty( "AuditRestart"     , m_auditorRestart      = audit ) ;
    00082   declareProperty( "AuditExecute"     , m_auditorExecute      = audit ) ;
    00083   declareProperty( "AuditFinalize"    , m_auditorFinalize     = audit ) ;
    00084   declareProperty( "AuditBeginRun"    , m_auditorBeginRun     = audit ) ;
    00085   declareProperty( "AuditEndRun"      , m_auditorEndRun       = audit ) ;
    00086   declareProperty( "AuditStart"       , m_auditorStart        = audit ) ;
    00087   declareProperty( "AuditStop"        , m_auditorStop         = audit ) ;
    00088
    00089   declareProperty( "MonitorService"   , m_monitorSvcName      = "MonitorSvc" );
    00090
    00091   // update handlers.
    00092   m_outputLevel.declareUpdateHandler(&Algorithm::initOutputLevel, this);
    00093
    00094 }

Algorithm::~Algorithm | ( |  | ) | `[virtual]`

Destructor.

Definition at line 97 of file Algorithm.cpp.

    00097                       {
    00098   delete m_subAlgms;
    00099   delete m_propertyMgr;
    00100   if ( m_MS )  m_MS->release();
    00101   if ( m_EDS ) m_EDS->release();
    00102   if ( m_ECS ) m_ECS->release();
    00103   if ( m_DDS ) m_DDS->release();
    00104   if ( m_DCS ) m_DCS->release();
    00105   if ( m_HDS ) m_HDS->release();
    00106   if ( m_NTS ) m_NTS->release();
    00107   if ( m_CSS ) m_CSS->release();
    00108   if ( m_RGS ) m_RGS->release();
    00109   if ( m_pAuditorSvc ) m_pAuditorSvc->release();
    00110   if ( m_ptoolSvc ) m_ptoolSvc->release();
    00111   if ( m_pMonitorSvc ) { m_pMonitorSvc->undeclareAll(this); m_pMonitorSvc->release(); }
    00112 }

Algorithm::Algorithm | ( | const Algorithm & | a | ) | `[private]`

Private Copy constructor: NO COPY ALLOWED.

## Member Function Documentation

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.

Implements IAlgorithm.

Definition at line 192 of file Algorithm.cpp.

    00192                                {
    00193
    00194   // Bypass the startup if already running or disabled.
    00195   if ( Gaudi::StateMachine::RUNNING == FSMState() ||
    00196        !isEnabled() ) return StatusCode::SUCCESS;
    00197
    00198   m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::START,m_state);
    00199
    00200   // TODO: (MCl) where shoud we do this? initialize or start?
    00201   // Reset Error count
    00202   m_errorCount = 0;
    00203
    00204   StatusCode sc;
    00205   // Invoke start() method of the derived class inside a try/catch clause
    00206   try {
    00207     { // limit the scope of the guard
    00208       Gaudi::Guards::AuditorGuard guard(this,
    00209                                         // check if we want to audit the initialize
    00210                                         (m_auditorStart) ? auditorSvc() : 0,
    00211                                         IAuditor::Start);
    00212       // Invoke the start() method of the derived class
    00213       sc = start();
    00214     }
    00215     if( sc.isFailure() ) return StatusCode::FAILURE;
    00216
    00217     // Now start any sub-algorithms
    00218     std::vector<Algorithm *>::iterator it;
    00219     StatusCode result = StatusCode::SUCCESS;
    00220     for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00221       sc = (*it)->sysStart();
    00222       if( sc.isFailure() ) result = sc;
    00223     }
    00224     if( result.isFailure() ) {
    00225       MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
    00226       log << MSG::ERROR << " Error initializing one or several sub-algorithms"
    00227           << endreq;
    00228       return result;
    00229     }
    00230     // Update the state.
    00231     m_state = m_targetState;
    00232     return StatusCode::SUCCESS;
    00233   }
    00234   catch ( const GaudiException& Exception )  {
    00235     MsgStream log ( msgSvc() , name() );
    00236     log << MSG::FATAL << "in sysStart(): exception with tag=" << Exception.tag()
    00237         << " is caught" << endreq;
    00238     log << MSG::ERROR << Exception << endreq;
    00239     Stat stat( chronoSvc() , Exception.tag() );
    00240   }
    00241   catch( const std::exception& Exception ) {
    00242     MsgStream log ( msgSvc() , name() );
    00243     log << MSG::FATAL << "in sysStart(): standard std::exception is caught" << endreq;
    00244     log << MSG::ERROR << Exception.what()  << endreq;
    00245     Stat stat( chronoSvc() , "*std::exception*" );
    00246   }
    00247   catch(...) {
    00248     MsgStream log ( msgSvc() , name() );
    00249     log << MSG::FATAL << "in sysStart(): UNKNOWN Exception is caught" << endreq;
    00250     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00251   }
    00252
    00253   return StatusCode::FAILURE;
    00254 }

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.

Implements IAlgorithm.

Definition at line 115 of file Algorithm.cpp.

    00115                                     {
    00116
    00117   // Bypass the initialization if the algorithm
    00118   // has already been initialized.
    00119   if ( Gaudi::StateMachine::INITIALIZED <= FSMState() ) return StatusCode::SUCCESS;
    00120
    00121   // Set the Algorithm's properties
    00122   StatusCode sc = setProperties();
    00123   if( sc.isFailure() ) return StatusCode::FAILURE;
    00124
    00125   // Bypass the initialization if the algorithm is disabled.
    00126   // Need to do this after setProperties.
    00127   if ( !isEnabled( ) ) return StatusCode::SUCCESS;
    00128
    00129   m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::INITIALIZE,m_state);
    00130
    00131   // Check current outputLevel to evetually inform the MessagsSvc
    00132   //if( m_outputLevel != MSG::NIL ) {
    00133   setOutputLevel( m_outputLevel );
    00134   //}
    00135
    00136   // TODO: (MCl) where shoud we do this? initialize or start?
    00137   // Reset Error count
    00138   //m_errorCount = 0;
    00139
    00140   // Invoke initialize() method of the derived class inside a try/catch clause
    00141   try {
    00142     { // limit the scope of the guard
    00143       Gaudi::Guards::AuditorGuard guard(this,
    00144                                         // check if we want to audit the initialize
    00145                                         (m_auditorInitialize) ? auditorSvc() : 0,
    00146                                         IAuditor::Initialize);
    00147       // Invoke the initialize() method of the derived class
    00148       sc = initialize();
    00149     }
    00150     if( sc.isFailure() ) return StatusCode::FAILURE;
    00151
    00152     // Now initialize care of any sub-algorithms
    00153     std::vector<Algorithm *>::iterator it;
    00154     StatusCode result = StatusCode::SUCCESS;
    00155     for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00156       sc = (*it)->sysInitialize();
    00157       if( sc.isFailure() ) result = sc;
    00158     }
    00159     if( result.isFailure() ) {
    00160       MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
    00161       log << MSG::ERROR << " Error initializing one or several sub-algorithms"
    00162           << endreq;
    00163       return result;
    00164     }
    00165     // Update the state.
    00166     m_state = m_targetState;
    00167     return StatusCode::SUCCESS;
    00168   }
    00169   catch ( const GaudiException& Exception )  {
    00170     MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
    00171     log << MSG::FATAL << " Exception with tag=" << Exception.tag()
    00172         << " is caught " << endreq;
    00173     log << MSG::ERROR << Exception  << endreq;
    00174     Stat stat( chronoSvc() , Exception.tag() );
    00175   }
    00176   catch( const std::exception& Exception ) {
    00177     MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
    00178     log << MSG::FATAL << " Standard std::exception is caught " << endreq;
    00179     log << MSG::ERROR << Exception.what()  << endreq;
    00180     Stat stat( chronoSvc() , "*std::exception*" );
    00181   }
    00182   catch(...) {
    00183     MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
    00184     log << MSG::FATAL << "UNKNOWN Exception is caught " << endreq;
    00185     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00186   }
    00187
    00188   return StatusCode::FAILURE;
    00189 }

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.

Implements IAlgorithm.

Definition at line 257 of file Algorithm.cpp.

    00257                                       {
    00258
    00259   // Bypass the initialization if the algorithm is disabled.
    00260   if ( !isEnabled( ) ) return StatusCode::SUCCESS;
    00261
    00262   // Check that the current status is the correct one.
    00263   if ( Gaudi::StateMachine::INITIALIZED != FSMState() ) {
    00264     MsgStream log ( msgSvc() , name() );
    00265     log << MSG::ERROR
    00266         << "sysReinitialize(): cannot reinitialize algorithm not initialized"
    00267         << endreq;
    00268     return StatusCode::FAILURE;
    00269   }
    00270
    00271   // Check current outputLevel to evetually inform the MessagsSvc
    00272   //if( m_outputLevel != MSG::NIL ) {
    00273   setOutputLevel( m_outputLevel );
    00274   //}
    00275
    00276   // Reset Error count
    00277   // m_errorCount = 0; // done during start
    00278
    00279   StatusCode sc(StatusCode::SUCCESS,true);
    00280   // Invoke reinitialize() method of the derived class inside a try/catch clause
    00281   try {
    00282     { // limit the scope of the guard
    00283       Gaudi::Guards::AuditorGuard guard(this,
    00284                                         // check if we want to audit the initialize
    00285                                         (m_auditorReinitialize) ? auditorSvc() : 0,
    00286                                         IAuditor::ReInitialize);
    00287       // Invoke the reinitialize() method of the derived class
    00288       sc = reinitialize();
    00289     }
    00290     if( sc.isFailure() ) return StatusCode::FAILURE;
    00291
    00292     // Now initialize care of any sub-algorithms
    00293     std::vector<Algorithm *>::iterator it;
    00294     StatusCode result = StatusCode::SUCCESS;
    00295     for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00296       sc = (*it)->sysReinitialize();
    00297       if( sc.isFailure() ) result = sc;
    00298     }
    00299     if( result.isFailure() ) {
    00300       MsgStream log ( msgSvc() , name() );
    00301       log << MSG::ERROR
    00302           << "sysReinitialize(): Error reinitializing one or several sub-algorithms"
    00303           << endreq;
    00304       return result;
    00305     }
    00306     return StatusCode::SUCCESS;
    00307   }
    00308   catch ( const GaudiException& Exception )  {
    00309     MsgStream log ( msgSvc() , name() );
    00310     log << MSG::FATAL << "sysReinitialize(): Exception with tag=" << Exception.tag()
    00311         << " is caught" << endreq;
    00312     log << MSG::ERROR << Exception  << endreq;
    00313     Stat stat( chronoSvc() , Exception.tag() );
    00314   }
    00315   catch( const std::exception& Exception ) {
    00316     MsgStream log ( msgSvc() , name() );
    00317     log << MSG::FATAL << "sysReinitialize(): Standard std::exception is caught" << endreq;
    00318     log << MSG::ERROR << Exception.what()  << endreq;
    00319     Stat stat( chronoSvc() , "*std::exception*" );
    00320   }
    00321   catch(...) {
    00322     MsgStream log ( msgSvc() , name() );
    00323     log << MSG::FATAL << "sysReinitialize(): UNKNOWN Exception is caught" << endreq;
    00324     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00325   }
    00326
    00327   return StatusCode::FAILURE;
    00328 }

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.

Implements IAlgorithm.

Definition at line 331 of file Algorithm.cpp.

    00331                                  {
    00332
    00333   // Bypass the initialization if the algorithm is disabled.
    00334   if ( !isEnabled( ) ) return StatusCode::SUCCESS;
    00335
    00336   // Check that the current status is the correct one.
    00337   if ( Gaudi::StateMachine::RUNNING != FSMState() ) {
    00338     MsgStream log ( msgSvc() , name() );
    00339     log << MSG::ERROR
    00340         << "sysRestart(): cannot restart algorithm not started"
    00341         << endreq;
    00342     return StatusCode::FAILURE;
    00343   }
    00344
    00345   // Check current outputLevel to evetually inform the MessagsSvc
    00346   //if( m_outputLevel != MSG::NIL ) {
    00347   setOutputLevel( m_outputLevel );
    00348   //}
    00349
    00350   // Reset Error count
    00351   m_errorCount = 0;
    00352
    00353   StatusCode sc(StatusCode::SUCCESS,true);
    00354   // Invoke reinitialize() method of the derived class inside a try/catch clause
    00355   try {
    00356     { // limit the scope of the guard
    00357       Gaudi::Guards::AuditorGuard guard(this,
    00358                                         // check if we want to audit the initialize
    00359                                         (m_auditorRestart) ? auditorSvc() : 0,
    00360                                         IAuditor::ReStart);
    00361       // Invoke the reinitialize() method of the derived class
    00362       sc = restart();
    00363     }
    00364     if( sc.isFailure() ) return StatusCode::FAILURE;
    00365
    00366     // Now initialize care of any sub-algorithms
    00367     std::vector<Algorithm *>::iterator it;
    00368     StatusCode result = StatusCode::SUCCESS;
    00369     for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00370       sc = (*it)->sysRestart();
    00371       if( sc.isFailure() ) result = sc;
    00372     }
    00373     if( result.isFailure() ) {
    00374       MsgStream log ( msgSvc() , name() );
    00375       log << MSG::ERROR
    00376           << "sysRestart(): Error restarting one or several sub-algorithms"
    00377           << endreq;
    00378       return result;
    00379     }
    00380     return StatusCode::SUCCESS;
    00381   }
    00382   catch ( const GaudiException& Exception )  {
    00383     MsgStream log ( msgSvc() , name() );
    00384     log << MSG::FATAL << "sysRestart(): Exception with tag=" << Exception.tag()
    00385         << " is caught" << endreq;
    00386     log << MSG::ERROR << Exception  << endreq;
    00387     Stat stat( chronoSvc() , Exception.tag() );
    00388   }
    00389   catch( const std::exception& Exception ) {
    00390     MsgStream log ( msgSvc() , name() );
    00391     log << MSG::FATAL << "sysRestart(): Standard std::exception is caught" << endreq;
    00392     log << MSG::ERROR << Exception.what()  << endreq;
    00393     Stat stat( chronoSvc() , "*std::exception*" );
    00394   }
    00395   catch(...) {
    00396     MsgStream log ( msgSvc() , name() );
    00397     log << MSG::FATAL << "sysRestart(): UNKNOWN Exception is caught" << endreq;
    00398     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00399   }
    00400
    00401   return StatusCode::FAILURE;
    00402 }

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.

Implements IAlgorithm.

Reimplemented in GaudiAlgorithm.

Definition at line 539 of file Algorithm.cpp.

    00539                                  {
    00540   if (!isEnabled()) {
    00541     MsgStream log ( msgSvc() , name() );
    00542     log << MSG::VERBOSE << ".sysExecute(): is not enabled. Skip execution" <<endreq;
    00543     return StatusCode::SUCCESS;
    00544   }
    00545
    00546   StatusCode status;
    00547
    00548   // Should performance profile be performed ?
    00549   // invoke execute() method of Algorithm class
    00550   //   and catch all uncaught exceptions
    00551
    00552   Gaudi::Guards::AuditorGuard guard(this,
    00553                                     // check if we want to audit the initialize
    00554                                     (m_auditorExecute) ? auditorSvc() : 0,
    00555                                     IAuditor::Execute,
    00556                                     status);
    00557   try {
    00558     status = execute();
    00559     setExecuted(true);  // set the executed flag
    00560
    00561     if (status.isFailure()) {
    00562       status = exceptionSvc()->handleErr(*this,status);
    00563     }
    00564
    00565   }
    00566   catch( const GaudiException& Exception ) {
    00567     setExecuted(true);  // set the executed flag
    00568
    00569     MsgStream log ( msgSvc() , name() + ".sysExecute()" );
    00570     if (Exception.code() == StatusCode::FAILURE) {
    00571       log << MSG::FATAL;
    00572     } else {
    00573       log << MSG::ERROR << " Recoverable";
    00574     }
    00575
    00576     log << " Exception with tag=" << Exception.tag()
    00577         << " is caught " << endreq;
    00578
    00579     log << MSG::ERROR << Exception  << endreq;
    00580
    00581     Stat stat( chronoSvc() , Exception.tag() ) ;
    00582     status = exceptionSvc()->handle(*this,Exception);
    00583   }
    00584   catch( const std::exception& Exception ) {
    00585     setExecuted(true);  // set the executed flag
    00586
    00587     MsgStream log ( msgSvc() , name() + ".sysExecute()" );
    00588     log << MSG::FATAL << " Standard std::exception is caught " << endreq;
    00589     log << MSG::ERROR << Exception.what()  << endreq;
    00590     Stat stat( chronoSvc() , "*std::exception*" ) ;
    00591     status = exceptionSvc()->handle(*this,Exception);
    00592   }
    00593   catch(...) {
    00594     setExecuted(true);  // set the executed flag
    00595
    00596     MsgStream log ( msgSvc() , name() + ".sysExecute()" );
    00597     log << MSG::FATAL << "UNKNOWN Exception is caught " << endreq;
    00598     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00599
    00600     status = exceptionSvc()->handle(*this);
    00601   }
    00602
    00603   if( status.isFailure() ) {
    00604     MsgStream log ( msgSvc() , name() );
    00605     // Increment the error count
    00606     m_errorCount++;
    00607     // Check if maximum is exeeded
    00608     if( m_errorCount < m_errorMax ) {
    00609       log << MSG::WARNING << "Continuing from error (cnt=" << m_errorCount
    00610           << ", max=" << m_errorMax << ")" << endreq;
    00611       // convert to success
    00612       status = StatusCode::SUCCESS;
    00613     }
    00614   }
    00615   return status;
    00616 }

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.

Implements IAlgorithm.

Definition at line 619 of file Algorithm.cpp.

    00619                               {
    00620
    00621   // Bypass the startup if already running or disabled.
    00622   if ( Gaudi::StateMachine::INITIALIZED == FSMState() ||
    00623        !isEnabled() ) return StatusCode::SUCCESS;
    00624
    00625   m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::STOP,m_state);
    00626
    00627   StatusCode sc;
    00628   // Invoke stop() method of the derived class inside a try/catch clause
    00629   try {
    00630     // Stop first any sub-algorithms (in reverse order)
    00631     std::vector<Algorithm *>::reverse_iterator it;
    00632     for (it = m_subAlgms->rbegin(); it != m_subAlgms->rend(); it++) {
    00633       (*it)->sysStop().ignore();
    00634     }
    00635     { // limit the scope of the guard
    00636       Gaudi::Guards::AuditorGuard guard(this,
    00637                                         // check if we want to audit the initialize
    00638                                         (m_auditorStop) ? auditorSvc() : 0,
    00639                                         IAuditor::Stop);
    00640
    00641       // Invoke the stop() method of the derived class
    00642       sc = stop();
    00643     }
    00644     if( sc.isFailure() ) return StatusCode::FAILURE;
    00645
    00646     // Update the state.
    00647     m_state = m_targetState;
    00648     return StatusCode::SUCCESS;
    00649   }
    00650   catch ( const GaudiException& Exception )  {
    00651     MsgStream log ( msgSvc() , name() );
    00652     log << MSG::FATAL << "in sysStop(): exception with tag=" << Exception.tag()
    00653         << " is caught" << endreq;
    00654     log << MSG::ERROR << Exception << endreq;
    00655     Stat stat( chronoSvc() , Exception.tag() );
    00656   }
    00657   catch( const std::exception& Exception ) {
    00658     MsgStream log ( msgSvc() , name() );
    00659     log << MSG::FATAL << "in sysStop(): standard std::exception is caught" << endreq;
    00660     log << MSG::ERROR << Exception.what()  << endreq;
    00661     Stat stat( chronoSvc() , "*std::exception*" );
    00662   }
    00663   catch(...) {
    00664     MsgStream log ( msgSvc() , name() );
    00665     log << MSG::FATAL << "in sysStop(): UNKNOWN Exception is caught" << endreq;
    00666     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00667   }
    00668
    00669   return StatusCode::FAILURE;
    00670 }

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.

Implements IAlgorithm.

Definition at line 672 of file Algorithm.cpp.

    00672                                   {
    00673
    00674   // Bypass the finalialization if the algorithm hasn't been initilized.
    00675   if ( Gaudi::StateMachine::CONFIGURED == FSMState() ||
    00676        !isEnabled() ) return StatusCode::SUCCESS;
    00677
    00678   m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::FINALIZE,m_state);
    00679
    00680   // Invoke finalize() method of the derived class inside a try/catch clause
    00681   StatusCode sc = StatusCode::SUCCESS;
    00682   try {
    00683     // Order changed (bug #3903 overview: finalize and nested algorithms)
    00684     // Finalize first any sub-algoithms (it can be done more than once)
    00685     std::vector<Algorithm *>::iterator it;
    00686     for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00687       (*it)->sysFinalize().ignore();
    00688     }
    00689
    00690     { // limit the scope of the guard
    00691       Gaudi::Guards::AuditorGuard guard(this,
    00692                                         // check if we want to audit the initialize
    00693                                         (m_auditorFinalize) ? auditorSvc() : 0,
    00694                                         IAuditor::Finalize);
    00695       // Invoke the finalize() method of the derived class
    00696       sc = finalize();
    00697     }
    00698     if( !sc.isSuccess() )  return StatusCode::FAILURE;
    00699
    00700     // Release all sub-algorithms
    00701     for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00702       (*it)->release();
    00703     }
    00704     // Indicate that this Algorithm has been finalized to prevent duplicate attempts
    00705     m_state = m_targetState;
    00706     return sc;
    00707   }
    00708   catch( const GaudiException& Exception ) {
    00709     MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
    00710     log << MSG::FATAL << " Exception with tag=" << Exception.tag()
    00711         << " is caught " << endreq;
    00712     log << MSG::ERROR << Exception  << endreq;
    00713     Stat stat( chronoSvc() , Exception.tag() ) ;
    00714   }
    00715   catch( const std::exception& Exception ) {
    00716     MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
    00717     log << MSG::FATAL << " Standard std::exception is caught " << endreq;
    00718     log << MSG::ERROR << Exception.what()  << endreq;
    00719     Stat stat( chronoSvc() , "*std::exception*" ) ;
    00720   }
    00721   catch( ... ) {
    00722     MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
    00723     log << MSG::FATAL << "UNKNOWN Exception is caught " << endreq;
    00724     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00725   }
    00726   return StatusCode::FAILURE ;
    00727 }

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.

Implements IAlgorithm.

Definition at line 405 of file Algorithm.cpp.

    00405                                   {
    00406
    00407   // Bypass the beginRun if the algorithm is disabled.
    00408   if ( !isEnabled( ) ) return StatusCode::SUCCESS;
    00409
    00410   // Check current outputLevel to evetually inform the MessagsSvc
    00411   //if( m_outputLevel != MSG::NIL ) {
    00412   setOutputLevel( m_outputLevel );
    00413   //}
    00414
    00415   // Reset Error count
    00416   m_errorCount = 0;
    00417
    00418   StatusCode sc;
    00419   // Invoke beginRun() method of the derived class inside a try/catch clause
    00420   try {
    00421     { // limit the scope of the guard
    00422       Gaudi::Guards::AuditorGuard guard(this,
    00423                                         // check if we want to audit the initialize
    00424                                         (m_auditorBeginRun) ? auditorSvc() : 0,
    00425                                         IAuditor::BeginRun);
    00426       // Invoke the beginRun() method of the derived class
    00427       sc = beginRun();
    00428     }
    00429     if( sc.isFailure() ) return StatusCode::FAILURE;
    00430
    00431     // Now call beginRun for any sub-algorithms
    00432     std::vector<Algorithm *>::iterator it;
    00433     StatusCode result = StatusCode::SUCCESS;
    00434     for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00435       sc = (*it)->sysBeginRun();
    00436       if( sc.isFailure() ) result = sc;
    00437     }
    00438     if( result.isFailure() ) {
    00439       MsgStream log ( msgSvc() , name() + ".sysBeginRun()" );
    00440       log << MSG::ERROR << " Error executing BeginRun for one or several sub-algorithms"
    00441           << endreq;
    00442       return result;
    00443     }
    00444     return StatusCode::SUCCESS;
    00445   }
    00446   catch ( const GaudiException& Exception )  {
    00447     MsgStream log ( msgSvc() , name() + ".sysBeginRun()" );
    00448     log << MSG::FATAL << " Exception with tag=" << Exception.tag()
    00449         << " is caught " << endreq;
    00450     log << MSG::ERROR << Exception  << endreq;
    00451     Stat stat( chronoSvc() , Exception.tag() );
    00452   }
    00453   catch( const std::exception& Exception ) {
    00454     MsgStream log ( msgSvc() , name() + ".sysBeginRun()" );
    00455     log << MSG::FATAL << " Standard std::exception is caught " << endreq;
    00456     log << MSG::ERROR << Exception.what()  << endreq;
    00457     Stat stat( chronoSvc() , "*std::exception*" );
    00458   }
    00459   catch(...) {
    00460     MsgStream log ( msgSvc() , name() + ".sysBeginRun()" );
    00461     log << MSG::FATAL << "UNKNOWN Exception is caught " << endreq;
    00462     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00463   }
    00464   return StatusCode::FAILURE;
    00465 }

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.

Implements IAlgorithm.

Definition at line 472 of file Algorithm.cpp.

    00472                                 {
    00473
    00474   // Bypass the endRun if the algorithm is disabled.
    00475   if ( !isEnabled( ) ) return StatusCode::SUCCESS;
    00476
    00477   // Check current outputLevel to eventually inform the MessagsSvc
    00478   //if( m_outputLevel != MSG::NIL ) {
    00479   setOutputLevel( m_outputLevel );
    00480   //}
    00481
    00482   // Reset Error count
    00483   m_errorCount = 0;
    00484
    00485   // Invoke endRun() method of the derived class inside a try/catch clause
    00486   StatusCode sc;
    00487   try {
    00488     { // limit the scope of the guard
    00489       Gaudi::Guards::AuditorGuard guard(this,
    00490                                         // check if we want to audit the initialize
    00491                                         (m_auditorEndRun) ? auditorSvc() : 0,
    00492                                         IAuditor::EndRun);
    00493       // Invoke the endRun() method of the derived class
    00494       sc = endRun();
    00495     }
    00496     if( sc.isFailure() ) return StatusCode::FAILURE;
    00497
    00498     // Now call endRun for any sub-algorithms
    00499     std::vector<Algorithm *>::iterator it;
    00500     StatusCode result = StatusCode::SUCCESS;
    00501     for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00502       sc = (*it)->sysEndRun();
    00503       if( sc.isFailure() ) result = sc;
    00504     }
    00505     if( result.isFailure() ) {
    00506       MsgStream log ( msgSvc() , name() + ".sysEndRun()" );
    00507       log << MSG::ERROR << " Error calling endRun for one or several sub-algorithms"
    00508           << endreq;
    00509       return result;
    00510     }
    00511     return StatusCode::SUCCESS;
    00512   }
    00513   catch ( const GaudiException& Exception )  {
    00514     MsgStream log ( msgSvc() , name() + ".sysEndRun()" );
    00515     log << MSG::FATAL << " Exception with tag=" << Exception.tag()
    00516         << " is caught " << endreq;
    00517     log << MSG::ERROR << Exception  << endreq;
    00518     Stat stat( chronoSvc() , Exception.tag() );
    00519   }
    00520   catch( const std::exception& Exception ) {
    00521     MsgStream log ( msgSvc() , name() + ".sysEndRun()" );
    00522     log << MSG::FATAL << " Standard std::exception is caught " << endreq;
    00523     log << MSG::ERROR << Exception.what()  << endreq;
    00524     Stat stat( chronoSvc() , "*std::exception*" );
    00525   }
    00526   catch(...) {
    00527     MsgStream log ( msgSvc() , name() + ".sysEndRun()" );
    00528     log << MSG::FATAL << "UNKNOWN Exception is caught " << endreq;
    00529     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00530   }
    00531   return StatusCode::FAILURE;
    00532 }

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.

Implements INamedInterface.

Definition at line 768 of file Algorithm.cpp.

    00768                                        {
    00769   return m_name;
    00770 }

const std::string & Algorithm::version | ( |  | ) | const`[virtual]`

The version of the algorithm.

Implements IAlgorithm.

Definition at line 772 of file Algorithm.cpp.

    00772                                           {
    00773   return m_version;
    00774 }

virtual StatusCode Algorithm::configure | ( |  | ) | `[inline, virtual]`

Dummy implementation of IStateful::configure() method.

Implements IAlgorithm.

Definition at line 149 of file Algorithm.h.

    00149 { return StatusCode::SUCCESS ; }

virtual StatusCode Algorithm::terminate | ( |  | ) | `[inline, virtual]`

Dummy implementation of IStateful::terminate() method.

Implements IAlgorithm.

Definition at line 151 of file Algorithm.h.

    00151 { return StatusCode::SUCCESS ; }

virtual StatusCode Algorithm::initialize | ( |  | ) | `[inline, virtual]`

the default (empty) implementation of IStateful::initialize() method

Implements IAlgorithm.

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 154 of file Algorithm.h.

    00154 { return StatusCode::SUCCESS ; }

virtual StatusCode Algorithm::start | ( |  | ) | `[inline, virtual]`

the default (empty) implementation of IStateful::start() method

Implements IAlgorithm.

Reimplemented in Sequencer, and GaudiPython::PyAlgorithm.

Definition at line 156 of file Algorithm.h.

    00156 { return StatusCode::SUCCESS ; }

virtual StatusCode Algorithm::stop | ( |  | ) | `[inline, virtual]`

the default (empty) implementation of IStateful::stop() method

Implements IAlgorithm.

Reimplemented in Sequencer, GaudiPython::PyAlgorithm, and OutputFSRStream.

Definition at line 158 of file Algorithm.h.

    00158 { return StatusCode::SUCCESS ; }

virtual StatusCode Algorithm::finalize | ( | void |  | ) | `[inline, virtual]`

the default (empty) implementation of IStateful::finalize() method

Implements IAlgorithm.

Reimplemented in EventCounter, GaudiAlgorithm, GaudiHistoAlg, GaudiSequencer, GaudiTupleAlg, Prescaler, Sequencer, GaudiPython::PyAlgorithm, PartitionSwitchAlg, StoreExplorerAlg, CollectionCloneAlg, EvtCollectionStream, OutputFSRStream, OutputStream, TagCollectionStream, GaudiCommon< Algorithm >, GaudiHistos< GaudiAlgorithm >, and GaudiTuples< GaudiHistoAlg >.

Definition at line 160 of file Algorithm.h.

    00160 { return StatusCode::SUCCESS ; }

StatusCode Algorithm::reinitialize | ( |  | ) | `[virtual]`

the default (empty) implementation of IStateful::reinitialize() method

Implements IAlgorithm.

Reimplemented in Sequencer.

Definition at line 729 of file Algorithm.cpp.

    00729                                    {
    00730   /* @TODO
    00731    * MCl 2008-10-23: the implementation of reinitialize as finalize+initialize
    00732    *                 is causing too many problems
    00733    *
    00734   // Default implementation is finalize+initialize
    00735   StatusCode sc = finalize();
    00736   if (sc.isFailure()) {
    00737     MsgStream log ( msgSvc() , name() );
    00738     log << MSG::ERROR << "reinitialize(): cannot be finalized" << endreq;
    00739     return sc;
    00740   }
    00741   sc = initialize();
    00742   if (sc.isFailure()) {
    00743     MsgStream log ( msgSvc() , name() );
    00744     log << MSG::ERROR << "reinitialize(): cannot be initialized" << endreq;
    00745     return sc;
    00746   }
    00747   */
    00748   return StatusCode::SUCCESS;
    00749 }

StatusCode Algorithm::restart | ( |  | ) | `[virtual]`

the default (empty) implementation of IStateful::restart() method

Implements IAlgorithm.

Definition at line 751 of file Algorithm.cpp.

    00751                               {
    00752   // Default implementation is stop+start
    00753   StatusCode sc = stop();
    00754   if (sc.isFailure()) {
    00755     MsgStream log ( msgSvc() , name() );
    00756     log << MSG::ERROR << "restart(): cannot be stopped" << endreq;
    00757     return sc;
    00758   }
    00759   sc = start();
    00760   if (sc.isFailure()) {
    00761     MsgStream log ( msgSvc() , name() );
    00762     log << MSG::ERROR << "restart(): cannot be started" << endreq;
    00763     return sc;
    00764   }
    00765   return StatusCode::SUCCESS;
    00766 }

bool Algorithm::isExecuted | ( |  | ) | const`[virtual]`

Has this algorithm been executed since the last reset?

Implements IAlgorithm.

Definition at line 776 of file Algorithm.cpp.

    00776                                  {
    00777   return m_isExecuted;
    00778 }

void Algorithm::setExecuted | ( | bool | state | ) | `[virtual]`

Set the executed flag to the specified state.

Implements IAlgorithm.

Definition at line 780 of file Algorithm.cpp.

    00780                                         {
    00781   m_isExecuted = state;
    00782 }

void Algorithm::resetExecuted | ( |  | ) | `[virtual]`

Reset the executed state of the Algorithm for the duration of the current event.

Implements IAlgorithm.

Reimplemented in GaudiSequencer, and Sequencer.

Definition at line 784 of file Algorithm.cpp.

    00784                               {
    00785   m_isExecuted   = false;
    00786   m_filterPassed = true;
    00787 }

StatusCode Algorithm::beginRun | ( |  | ) | `[virtual]`

Algorithm begin run.

This method is called at the beginning of the event loop.

Implements IAlgorithm.

Reimplemented in GaudiSequencer, Sequencer, and GaudiPython::PyAlgorithm.

Definition at line 467 of file Algorithm.cpp.

    00467                                {
    00468   return StatusCode::SUCCESS;
    00469 }

StatusCode Algorithm::endRun | ( |  | ) | `[virtual]`

Algorithm end run. This method is called at the end of the event loop.

Implements IAlgorithm.

Reimplemented in GaudiSequencer, Sequencer, and GaudiPython::PyAlgorithm.

Definition at line 534 of file Algorithm.cpp.

    00534                              {
    00535   return StatusCode::SUCCESS;
    00536 }

virtual Gaudi::StateMachine::State Algorithm::FSMState | ( |  | ) | const`[inline, virtual]`

returns the current state of the algorithm

Implements IAlgorithm.

Definition at line 187 of file Algorithm.h.

    00187 { return m_state; }

virtual Gaudi::StateMachine::State Algorithm::targetFSMState | ( |  | ) | const`[inline, virtual]`

returns the state the algorithm will be in after the ongoing transition

Implements IStateful.

Definition at line 190 of file Algorithm.h.

    00190 { return m_targetState; }

bool Algorithm::isEnabled | ( |  | ) | const`[virtual]`

Is this algorithm enabled or disabled?

Implements IAlgorithm.

Definition at line 789 of file Algorithm.cpp.

    00789                                 {
    00790   return m_isEnabled;
    00791 }

bool Algorithm::filterPassed | ( |  | ) | const`[virtual]`

Did this algorithm pass or fail its filter criterion for the last event?

Implements IAlgorithm.

Definition at line 793 of file Algorithm.cpp.

    00793                                    {
    00794   return m_filterPassed;
    00795 }

void Algorithm::setFilterPassed | ( | bool | state | ) | `[virtual]`

Set the filter passed flag to the specified state.

Implements IAlgorithm.

Definition at line 797 of file Algorithm.cpp.

    00797                                             {
    00798   m_filterPassed = state;
    00799 }

template<class T>

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 204 of file Algorithm.h.

    00204                                                                   {
    00205     return service_i(name, createIf, T::interfaceID(), (void**)&psvc);
    00206   }

template<class T>

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 210 of file Algorithm.h.

    00211                                       {
    00212     return service_i(svcType, svcName, T::interfaceID(), (void**)&psvc);
    00213   }

void Algorithm::setOutputLevel | ( | int | level | ) |

Set the outputlevel for current algorithm.

Definition at line 805 of file Algorithm.cpp.

    00805                                           {
    00806   if ( 0 != msgSvc() )
    00807   {
    00808     if ( MSG::NIL != level )
    00809     { msgSvc()->setOutputLevel( name(), level ) ; }
    00810     m_outputLevel = msgSvc()->outputLevel( name() );
    00811   }
    00812 }

IAuditorSvc * Algorithm::auditorSvc | ( |  | ) | const

The standard auditor service.May not be invoked before sysInitialize() has been invoked.

Definition at line 814 of file Algorithm.cpp.

    00814                                          {
    00815   if ( 0 == m_pAuditorSvc ) {
    00816     StatusCode sc = service( "AuditorSvc", m_pAuditorSvc, true );
    00817     if( sc.isFailure() ) {
    00818       throw GaudiException("Service [AuditorSvc] not found", name(), sc);
    00819     }
    00820   }
    00821   return m_pAuditorSvc;
    00822 }

IChronoStatSvc * Algorithm::chronoSvc | ( |  | ) | const

The standard Chrono & Stat service, Return a pointer to the service if present.

Definition at line 824 of file Algorithm.cpp.

    00824                                            {
    00825   if ( 0 == m_CSS ) {
    00826     StatusCode sc = service( "ChronoStatSvc", m_CSS, true );
    00827     if( sc.isFailure() ) {
    00828       throw GaudiException("Service [ChronoStatSvc] not found", name(), sc);
    00829     }
    00830   }
    00831   return m_CSS;
    00832 }

IChronoStatSvc * Algorithm::chronoStatService | ( |  | ) | const

Obsoleted name, kept due to the backwards compatibility.

Definition at line 835 of file Algorithm.cpp.

    00835                                                    {
    00836   return chronoSvc();
    00837 }

IDataProviderSvc * Algorithm::detSvc | ( |  | ) | const

The standard detector data service.

May not be invoked before sysInitialize() has been invoked.

Definition at line 839 of file Algorithm.cpp.

    00839                                           {
    00840   if ( 0 == m_DDS ) {
    00841     StatusCode sc = service( "DetectorDataSvc", m_DDS, true );
    00842     if( sc.isFailure() ) {
    00843       throw GaudiException("Service [DetectorDataSvc] not found", name(), sc);
    00844     }
    00845   }
    00846   return m_DDS;
    00847 }

IDataProviderSvc * Algorithm::detDataService | ( |  | ) | const

Obsoleted name, kept due to the backwards compatibility.

Definition at line 849 of file Algorithm.cpp.

    00849                                                   {
    00850   return detSvc();
    00851 }

IConversionSvc * Algorithm::detCnvSvc | ( |  | ) | const

The standard detector data persistency conversion service.

May not be invoked before sysInitialize() has been invoked.

Definition at line 853 of file Algorithm.cpp.

    00853                                            {
    00854   if ( 0 == m_DCS ) {
    00855     StatusCode sc = service( "DetectorPersistencySvc", m_DCS, true );
    00856     if( sc.isFailure() ) {
    00857       throw GaudiException("Service [DetectorPersistencySvc] not found",
    00858                            name(), sc);
    00859     }
    00860   }
    00861   return m_DCS;
    00862 }

IConversionSvc * Algorithm::detDataCnvService | ( |  | ) | const

Obsoleted name, kept due to the backwards compatibility.

Definition at line 864 of file Algorithm.cpp.

    00864                                                    {
    00865   return detCnvSvc();
    00866 }

IDataProviderSvc * Algorithm::eventSvc | ( |  | ) | const

The standard event data service.

May not be invoked before sysInitialize() has been invoked.

Definition at line 868 of file Algorithm.cpp.

    00868                                             {
    00869   if ( 0 == m_EDS ) {
    00870     StatusCode sc = service( "EventDataSvc", m_EDS, true );
    00871     if( sc.isFailure() ) {
    00872       throw GaudiException("Service [EventDataSvc] not found", name(), sc);
    00873     }
    00874   }
    00875   return m_EDS;
    00876 }

IDataProviderSvc* Algorithm::evtSvc | ( |  | ) | const`[inline]`

shortcut for method eventSvc

Definition at line 251 of file Algorithm.h.

    00251 { return eventSvc() ; }

IDataProviderSvc * Algorithm::eventDataService | ( |  | ) | const

Obsoleted name, kept due to the backwards compatibility.

Definition at line 878 of file Algorithm.cpp.

    00878                                                     {
    00879   return eventSvc();
    00880 }

IConversionSvc * Algorithm::eventCnvSvc | ( |  | ) | const

The standard event data persistency conversion service.

May not be invoked before sysInitialize() has been invoked.

Definition at line 882 of file Algorithm.cpp.

    00882                                              {
    00883   if ( 0 == m_ECS ) {
    00884     StatusCode sc = service( "EventPersistencySvc", m_ECS, true );
    00885     if( sc.isFailure() ) {
    00886       throw GaudiException("Service [EventPersistencySvc] not found",
    00887                            name(), sc);
    00888     }
    00889   }
    00890   return m_ECS;
    00891 }

IConversionSvc * Algorithm::eventDataCnvService | ( |  | ) | const

Obsoleted name, kept due to the backwards compatibility.

Definition at line 893 of file Algorithm.cpp.

    00893                                                      {
    00894   return eventCnvSvc();
    00895 }

IHistogramSvc * Algorithm::histoSvc | ( |  | ) | const

The standard histogram service.

May not be invoked before sysInitialize() has been invoked.

Definition at line 897 of file Algorithm.cpp.

    00897                                          {
    00898   if ( 0 == m_HDS ) {
    00899     StatusCode sc = service( "HistogramDataSvc", m_HDS, true );
    00900     if( sc.isFailure() ) {
    00901       throw GaudiException("Service [HistogramDataSvc] not found", name(), sc);
    00902     }
    00903   }
    00904   return m_HDS;
    00905 }

IHistogramSvc * Algorithm::histogramDataService | ( |  | ) | const

Obsoleted name, kept due to the backwards compatibility.

Definition at line 907 of file Algorithm.cpp.

    00907                                                      {
    00908   return histoSvc();
    00909 }

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 921 of file Algorithm.cpp.

    00921                                      {
    00922   if ( 0 == m_MS ) {
    00923     //can not use service() method (infinite recursion!)
    00924     StatusCode sc = serviceLocator()->service( "MessageSvc", m_MS, true );
    00925     if( sc.isFailure() ) {
    00926       throw GaudiException("Service [MessageSvc] not found", name(), sc);
    00927     }
    00928   }
    00929   return m_MS;
    00930 }

IMessageSvc * Algorithm::messageService | ( |  | ) | const

Obsoleted name, kept due to the backwards compatibility.

Definition at line 933 of file Algorithm.cpp.

    00933                                              {
    00934   return msgSvc();
    00935 }

INTupleSvc * Algorithm::ntupleSvc | ( |  | ) | const

The standard N tuple service.

Returns a pointer to the N tuple service if present.

Definition at line 937 of file Algorithm.cpp.

    00937                                        {
    00938   if ( 0 == m_NTS ) {
    00939     StatusCode sc = service( "NTupleSvc", m_NTS, true );
    00940     if( sc.isFailure() ) {
    00941       throw GaudiException("Service [NTupleSvc] not found", name(), sc);
    00942     }
    00943   }
    00944   return m_NTS;
    00945 }

INTupleSvc * Algorithm::ntupleService | ( |  | ) | const

Obsoleted name, kept due to the backwards compatibility.

Definition at line 948 of file Algorithm.cpp.

    00948                                            {
    00949   return ntupleSvc();
    00950 }

IRndmGenSvc * Algorithm::randSvc | ( |  | ) | const

AIDA-based NTuple service Returns a pointer to the AIDATuple service if present.

The standard RandomGen service, Return a pointer to the service if present

Definition at line 964 of file Algorithm.cpp.

    00964                                       {
    00965   if ( 0 == m_RGS ) {
    00966     StatusCode sc = service( "RndmGenSvc", m_RGS, true );
    00967     if( sc.isFailure() ) {
    00968       throw GaudiException("Service [RndmGenSvc] not found", name(), sc);
    00969     }
    00970   }
    00971   return m_RGS;
    00972 }

IToolSvc * Algorithm::toolSvc | ( |  | ) | const

The standard ToolSvc service, Return a pointer to the service if present.

Definition at line 974 of file Algorithm.cpp.

    00974                                    {
    00975   if ( 0 == m_ptoolSvc ) {
    00976     StatusCode sc = service( "ToolSvc", m_ptoolSvc, true );
    00977     if( sc.isFailure() ) {
    00978       throw GaudiException("Service [ToolSvc] not found", name(), sc);
    00979     }
    00980   }
    00981   return m_ptoolSvc;
    00982 }

IExceptionSvc * Algorithm::exceptionSvc | ( |  | ) | const

Get the exception Service.

Definition at line 911 of file Algorithm.cpp.

    00911                                              {
    00912   if ( 0 == m_EXS ) {
    00913     StatusCode sc = service( "ExceptionSvc", m_EXS, true );
    00914     if( sc.isFailure() ) {
    00915       throw GaudiException("Service [ExceptionSvc] not found", name(), sc);
    00916     }
    00917   }
    00918   return m_EXS;
    00919 }

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 984 of file Algorithm.cpp.

    00984                                               {
    00985   return m_pSvcLocator;
    00986 }

ISvcLocator* Algorithm::svcLoc | ( |  | ) | const`[inline]`

shortcut for method serviceLocator

Definition at line 310 of file Algorithm.h.

    00310 { 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.

Parameters:

  | 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 1049 of file Algorithm.cpp.

    01051                                                                     {
    01052   if( 0 == m_pSvcLocator ) return StatusCode::FAILURE;
    01053
    01054   IAlgManager* am = 0;
    01055   IAlgManager** ptr = &am;
    01056   StatusCode sc = m_pSvcLocator->getService
    01057     ( "", IID_IAlgManager,(IInterface*&)*ptr );
    01058   if( sc.isFailure() ) return StatusCode::FAILURE;
    01059
    01060   // Maybe modify the AppMgr interface to return Algorithm* ??
    01061   IAlgorithm *tmp;
    01062   sc = am->createAlgorithm
    01063     (type, name+getGaudiThreadIDfromName(Algorithm::name()), tmp);
    01064   if( sc.isFailure() ) return StatusCode::FAILURE;
    01065   am->release();
    01066
    01067   try{
    01068     pSubAlgorithm = dynamic_cast<Algorithm*>(tmp);
    01069     m_subAlgms->push_back(pSubAlgorithm);
    01070   } catch(...){
    01071     sc = StatusCode::FAILURE;
    01072   }
    01073   return sc;
    01074 }

std::vector< Algorithm * > * Algorithm::subAlgorithms | ( |  | ) | const

List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.

Definition at line 801 of file Algorithm.cpp.

    00801                                                        {
    00802   return m_subAlgms;
    00803 }

StatusCode Algorithm::setProperty | ( | const Property & | p | ) | `[virtual]`

Implementation of IProperty::setProperty.

Implements IProperty.

Definition at line 1078 of file Algorithm.cpp.

    01078                                                    {
    01079   return m_propertyMgr->setProperty(p);
    01080 }

StatusCode Algorithm::setProperty | ( | const std::string & | s | ) | `[virtual]`

Implementation of IProperty::setProperty.

Implements IProperty.

Definition at line 1081 of file Algorithm.cpp.

    01081                                                     {
    01082   return m_propertyMgr->setProperty(s);
    01083 }

StatusCode Algorithm::setProperty | ( | const std::string & | n,
|  | const std::string & | v |
| ) |  |  | `[virtual]`

Implementation of IProperty::setProperty.

Implements IProperty.

Definition at line 1084 of file Algorithm.cpp.

    01084                                                                         {
    01085   return m_propertyMgr->setProperty(n,v);
    01086 }

StatusCode Algorithm::getProperty | ( | Property * | p | ) | const`[virtual]`

Implementation of IProperty::getProperty.

Implements IProperty.

Definition at line 1087 of file Algorithm.cpp.

    01087                                                    {
    01088   return m_propertyMgr->getProperty(p);
    01089 }

const Property & Algorithm::getProperty | ( | const std::string & | name | ) | const`[virtual]`

Implementation of IProperty::getProperty.

Implements IProperty.

Definition at line 1090 of file Algorithm.cpp.

    01090                                                                   {
    01091   return m_propertyMgr->getProperty(name);
    01092 }

StatusCode Algorithm::getProperty | ( | const std::string & | n,
|  | std::string & | v |
| ) |  |  | const`[virtual]`

Implementation of IProperty::getProperty.

Implements IProperty.

Definition at line 1093 of file Algorithm.cpp.

    01093                                                                          {
    01094   return m_propertyMgr->getProperty(n,v);
    01095 }

const std::vector< Property * > & Algorithm::getProperties | ( |  | ) | const`[virtual]`

Implementation of IProperty::getProperties.

Implements IProperty.

Definition at line 1096 of file Algorithm.cpp.

    01096                                                             {
    01097   return m_propertyMgr->getProperties();
    01098 }

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 1026 of file Algorithm.cpp.

    01026                                     {
    01027   if( 0 != m_pSvcLocator )    {
    01028     IJobOptionsSvc* jos = 0;
    01029     StatusCode sc = m_pSvcLocator->getService
    01030       ( "JobOptionsSvc", IID_IJobOptionsSvc, *pp_cast<IInterface>(&jos) );
    01031     if( sc.isSuccess() )    {
    01032       // set first generic Properties
    01033       sc = jos->setMyProperties( getGaudiThreadGenericName(name()), this );
    01034       if( sc.isFailure() ) return StatusCode::FAILURE;
    01035
    01036       // set specific Properties
    01037       if (isGaudiThreaded(name())) {
    01038         if(jos->setMyProperties( name(), this ).isFailure()) {
    01039           return StatusCode::FAILURE;
    01040         }
    01041       }
    01042       jos->release();
    01043       return sc;
    01044     }
    01045   }
    01046   return StatusCode::FAILURE;
    01047 }

template<class T>

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 ) ;

       }

See also:
  PropertyMgr

  PropertyMgr::declareProperty

Parameters:

  | name | the property name
  | proeprty | the property itself,
  | doc | the documentation string

Returns:
  the actual property objects

Definition at line 385 of file Algorithm.h.

    00388   {
    00389     return m_propertyMgr->declareProperty(name, property, doc);
    00390   }

Property* Algorithm::declareRemoteProperty | ( | const std::string & | name,
|  | IProperty * | rsvc,
|  | const std::string & | rname = `""` |
| ) |  |  | const`[inline]`

Declare remote named properties.

Definition at line 394 of file Algorithm.h.

    00397   {
    00398     return m_propertyMgr -> declareRemoteProperty ( name , rsvc , rname );
    00399   }

IMonitorSvc* Algorithm::monitorSvc | ( |  | ) | const`[inline]`

Access the monitor service.

Attention:
  Note that this method will return a NULL pointer if no monitor service is configured to be present. You must take this possibility into account when using the pointer

Returns:
  Pointer to the Monitor service

Return values:

  | NULL | No monitor service is present
  | non-NULL | A monitor service is present and available to be used

Definition at line 410 of file Algorithm.h.

    00411   {
    00412     // If not already located try to locate it without forcing a creation
    00413     if ( !m_pMonitorSvc ){
    00414       service_i( m_monitorSvcName, false,
    00415                  IMonitorSvc::interfaceID(), pp_cast<void>(&m_pMonitorSvc) );
    00416     }
    00417     return m_pMonitorSvc;
    00418   }

template<class T>

void Algorithm::declareInfo | ( | const std::string & | name,
|  | const T & | var,
|  | const std::string & | desc |
| ) |  |  | const`[inline]`

Declare monitoring information.

Parameters:

  | 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();
    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).

Parameters:

  | 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();
    00448     if ( mS ) mS->declareInfo(name, format, var, size, desc, this);
    00449   }

unsigned long Algorithm::addRef | ( |  | ) | `[virtual]`

Methods for IInterface::addRef().

Implements IInterface.

Definition at line 989 of file Algorithm.cpp.

    00989                                 {
    00990   return ++m_refCount;
    00991 }

unsigned long Algorithm::release | ( |  | ) | `[virtual]`

Methods for IInterface::release().

Implements IInterface.

Definition at line 993 of file Algorithm.cpp.

    00993                                  {
    00994   long count = --m_refCount;
    00995   if( count <= 0) {
    00996     delete this;
    00997   }
    00998   return count;
    00999 }

StatusCode Algorithm::queryInterface | ( | const InterfaceID & | riid,
|  | void ** | ppISvc |
| ) |  |  | `[virtual]`

Methods for IInterface::queryInterface().

Implements IInterface.

Reimplemented in PartitionSwitchAlg.

Definition at line 1003 of file Algorithm.cpp.

    01005 {
    01006   if ( 0 == ppISvc ) { return StatusCode::FAILURE ; }   // RETURN
    01007   //
    01008   if      ( IAlgorithm ::interfaceID()      . versionMatch ( iid ) )
    01009   { *ppISvc = static_cast<IAlgorithm*>      ( this ) ; }
    01010   else if ( IProperty  ::interfaceID()      . versionMatch ( iid ) )
    01011   { *ppISvc = static_cast<IProperty*>       ( this ) ; }
    01012   else if ( IStateful  ::interfaceID()      . versionMatch ( iid ) )
    01013   { *ppISvc = static_cast<IStateful*>       ( this ) ; }
    01014   else if ( INamedInterface ::interfaceID() . versionMatch ( iid ) )
    01015   { *ppISvc = static_cast<INamedInterface*> ( this ) ; }
    01016   else if ( IInterface ::interfaceID()      . versionMatch ( iid ) )
    01017   { *ppISvc = static_cast<IInterface*>      ( this ) ; }
    01018   else { *ppISvc = 0 ; return StatusCode::FAILURE; }    // RETURN
    01019   // increment the reference
    01020   addRef();
    01021
    01022   return StatusCode::SUCCESS;
    01023 }

template<class TYPE>

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 convinient 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..

Parameters:

  | name | name of the property
  | value | value of the property

See also:
  Gaudi::Utils::setProperty

Author:
  Vanya BELYAEV ibelyaev@physics.syr.edu

Date:
  2007-05-13

Definition at line 503 of file Algorithm.h.

    00505   { return Gaudi::Utils::setProperty ( m_propertyMgr , name , value ) ; }

bool Algorithm::isInitialized | ( |  | ) | const`[inline, protected, virtual]`

Has the Algorithm already been initialized?

Implements IAlgorithm.

Definition at line 510 of file Algorithm.h.

    00510 { return Gaudi::StateMachine::INITIALIZED == m_state; }

bool Algorithm::isFinalized | ( |  | ) | const`[inline, protected, virtual]`

Has the Algorithm already been finalized?

Implements IAlgorithm.

Definition at line 513 of file Algorithm.h.

    00513 { return Gaudi::StateMachine::CONFIGURED == m_state; }

int Algorithm::outputLevel | ( |  | ) | const`[inline, protected]`

retrieve the Algorithm output level

Definition at line 516 of file Algorithm.h.

    00516 { return (int)m_outputLevel ; }

IntegerProperty& Algorithm::outputLevelProperty | ( |  | ) | `[inline, protected]`

Accessor for the Message level property.

Definition at line 519 of file Algorithm.h.

    00519 { return m_outputLevel; }

void Algorithm::initOutputLevel | ( | Property & | prop | ) | `[protected]`

callback for output level property

Protected Member Functions.

Definition at line 1104 of file Algorithm.cpp.

    01105 {
    01106   // do nothing... yet ?
    01107 }

StatusCode Algorithm::service_i | ( | const std::string & | svcName,
|  | bool | createIf,
|  | const InterfaceID & | iid,
|  | void ** | ppSvc |
| ) |  |  | const`[private]`

implementation of service method

Definition at line 1110 of file Algorithm.cpp.

    01113                                          {
    01114   MsgStream log(msgSvc(), name());
    01115   ServiceLocatorHelper helper(*serviceLocator(), log, name());
    01116   return helper.getService(svcName, createIf, iid, ppSvc);
    01117 }

StatusCode Algorithm::service_i | ( | const std::string & | svcType,
|  | const std::string & | svcName,
|  | const InterfaceID & | iid,
|  | void ** | ppSvc |
| ) |  |  | const`[private]`

Definition at line 1120 of file Algorithm.cpp.

    01123                                          {
    01124
    01125   MsgStream log(msgSvc(), name());
    01126   ServiceLocatorHelper helper(*serviceLocator(), log, name());
    01127   return  helper.createService(svcType, svcName, iid, ppSvc);
    01128 }

Algorithm& Algorithm::operator= | ( | const Algorithm & | rhs | ) | `[private]`

Private asignment operator: NO ASSIGNMENT ALLOWED.

## Member Data Documentation

long Algorithm::m_refCount`[private]`

Counter for references to Algorithm.

Definition at line 527 of file Algorithm.h.

std::string Algorithm::m_name`[private]`

Algorithm's name for identification.

Definition at line 528 of file Algorithm.h.

std::string Algorithm::m_version`[private]`

Algorithm's version.

Definition at line 529 of file Algorithm.h.

std::vector<Algorithm *>* Algorithm::m_subAlgms`[private]`

Sub algorithms.

Definition at line 530 of file Algorithm.h.

IMessageSvc* Algorithm::m_MS`[mutable, private]`

Message service.

Definition at line 532 of file Algorithm.h.

IDataProviderSvc* Algorithm::m_EDS`[mutable, private]`

Event data service.

Definition at line 533 of file Algorithm.h.

IConversionSvc* Algorithm::m_ECS`[mutable, private]`

Event conversion service.

Definition at line 534 of file Algorithm.h.

IDataProviderSvc* Algorithm::m_DDS`[mutable, private]`

Detector data service.

Definition at line 535 of file Algorithm.h.

IConversionSvc* Algorithm::m_DCS`[mutable, private]`

Detector conversion service.

Definition at line 536 of file Algorithm.h.

IHistogramSvc* Algorithm::m_HDS`[mutable, private]`

Histogram data service.

Definition at line 537 of file Algorithm.h.

INTupleSvc* Algorithm::m_NTS`[mutable, private]`

N tuple service.

Definition at line 538 of file Algorithm.h.

IChronoStatSvc* Algorithm::m_CSS`[mutable, private]`

Chrono & Stat Service.

Definition at line 540 of file Algorithm.h.

IRndmGenSvc* Algorithm::m_RGS`[mutable, private]`

Random Number Generator Service.

Definition at line 541 of file Algorithm.h.

IExceptionSvc* Algorithm::m_EXS`[mutable, private]`

Exception Handler Service.

Definition at line 542 of file Algorithm.h.

IAuditorSvc* Algorithm::m_pAuditorSvc`[mutable, private]`

Auditor Service.

Definition at line 543 of file Algorithm.h.

IToolSvc* Algorithm::m_ptoolSvc`[mutable, private]`

ToolSvc Service.

Definition at line 544 of file Algorithm.h.

IMonitorSvc* Algorithm::m_pMonitorSvc`[mutable, private]`

Online Monitoring Service.

Definition at line 545 of file Algorithm.h.

std::string Algorithm::m_monitorSvcName`[private]`

Name to use for Monitor Service.

Definition at line 546 of file Algorithm.h.

ISvcLocator* Algorithm::m_pSvcLocator`[private]`

Pointer to service locator service.

Definition at line 547 of file Algorithm.h.

PropertyMgr* Algorithm::m_propertyMgr`[private]`

For management of properties.

Definition at line 548 of file Algorithm.h.

IntegerProperty Algorithm::m_outputLevel`[private]`

Algorithm output level.

Definition at line 549 of file Algorithm.h.

int Algorithm::m_errorMax`[private]`

Algorithm Max number of errors.

Definition at line 550 of file Algorithm.h.

int Algorithm::m_errorCount`[private]`

Algorithm error counter.

Definition at line 551 of file Algorithm.h.

BooleanProperty Algorithm::m_auditInit`[private]`

global flag for auditors

Definition at line 552 of file Algorithm.h.

bool Algorithm::m_auditorInitialize`[private]`

flag for auditors in "initialize()"

Definition at line 553 of file Algorithm.h.

bool Algorithm::m_auditorReinitialize`[private]`

flag for auditors in "Reinitialize()"

Definition at line 554 of file Algorithm.h.

bool Algorithm::m_auditorRestart`[private]`

flag for auditors in "Restart()"

Definition at line 555 of file Algorithm.h.

bool Algorithm::m_auditorExecute`[private]`

flag for auditors in "execute()"

Definition at line 556 of file Algorithm.h.

bool Algorithm::m_auditorFinalize`[private]`

flag for auditors in "finalize()"

Definition at line 557 of file Algorithm.h.

bool Algorithm::m_auditorBeginRun`[private]`

flag for auditors in "beginRun()"

Definition at line 558 of file Algorithm.h.

bool Algorithm::m_auditorEndRun`[private]`

flag for auditors in "endRun()"

Definition at line 559 of file Algorithm.h.

bool Algorithm::m_auditorStart`[private]`

flag for auditors in "initialize()"

Definition at line 560 of file Algorithm.h.

bool Algorithm::m_auditorStop`[private]`

flag for auditors in "Reinitialize()"

Definition at line 561 of file Algorithm.h.

bool Algorithm::m_filterPassed`[private]`

Filter passed flag.

Definition at line 562 of file Algorithm.h.

bool Algorithm::m_isEnabled`[private]`

Algorithm is enabled flag.

Definition at line 563 of file Algorithm.h.

bool Algorithm::m_isExecuted`[private]`

Algorithm is executed flag.

Definition at line 564 of file Algorithm.h.

Gaudi::StateMachine::State Algorithm::m_state`[private]`

Algorithm has been initialized flag.

Definition at line 565 of file Algorithm.h.

Gaudi::StateMachine::State Algorithm::m_targetState`[private]`

Algorithm has been initialized flag.

Definition at line 566 of file Algorithm.h.

bool Algorithm::m_isFinalized`[private]`

Algorithm has been finalized flag.

Definition at line 567 of file Algorithm.h.

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r3/GaudiKernel/GaudiKernel/Algorithm.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r3/GaudiKernel/src/Lib/Algorithm.cpp