| # Gaudi Framework, version v23r1 |

Home |  | Generated: Wed Feb 29 2012

# Algorithm.cpp

Go to the documentation of this file.

    00001 #include "GaudiKernel/Kernel.h"
    00002 #include "GaudiKernel/ISvcLocator.h"
    00003 #include "GaudiKernel/IMessageSvc.h"
    00004 #include "GaudiKernel/IJobOptionsSvc.h"
    00005 #include "GaudiKernel/IAlgManager.h"
    00006 #include "GaudiKernel/IAuditorSvc.h"
    00007 #include "GaudiKernel/IDataProviderSvc.h"
    00008 #include "GaudiKernel/IConversionSvc.h"
    00009 #include "GaudiKernel/IHistogramSvc.h"
    00010 #include "GaudiKernel/INTupleSvc.h"
    00011 #include "GaudiKernel/IRndmGenSvc.h"
    00012 #include "GaudiKernel/IToolSvc.h"
    00013 #include "GaudiKernel/IExceptionSvc.h"
    00014 #include "GaudiKernel/IAlgContextSvc.h"
    00015 #include "GaudiKernel/IProperty.h"
    00016
    00017 #include "GaudiKernel/Algorithm.h"
    00018 #include "GaudiKernel/PropertyMgr.h"
    00019 #include "GaudiKernel/MsgStream.h"
    00020 #include "GaudiKernel/Chrono.h"
    00021 #include "GaudiKernel/Stat.h"
    00022 #include "GaudiKernel/GaudiException.h"
    00023 #include "GaudiKernel/ServiceLocatorHelper.h"
    00024 #include "GaudiKernel/ThreadGaudi.h"
    00025 #include "GaudiKernel/Guards.h"
    00026
    00027 // Constructor
    00028 Algorithm::Algorithm( const std::string& name, ISvcLocator *pSvcLocator,
    00029                       const std::string& version)
    00030   : m_name(name),
    00031     m_version(version),
    00032     m_registerContext ( false ) ,
    00033     m_pSvcLocator(pSvcLocator),
    00034     m_filterPassed(true),
    00035     m_isEnabled(true),
    00036     m_isExecuted(false),
    00037     m_state(Gaudi::StateMachine::CONFIGURED),
    00038     m_targetState(Gaudi::StateMachine::CONFIGURED)
    00039 {
    00040   m_propertyMgr = new PropertyMgr();
    00041   m_subAlgms = new std::vector<Algorithm *>();
    00042
    00043   // Declare common Algorithm properties with their defaults
    00044   declareProperty( "OutputLevel",        m_outputLevel = MSG::NIL);
    00045   declareProperty( "Enable",             m_isEnabled = true);
    00046   declareProperty( "ErrorMax",           m_errorMax  = 1);
    00047   declareProperty( "ErrorCount",         m_errorCount = 0);
    00048   // Auditor monitoring properties
    00049
    00050   // Get the default setting for service auditing from the AppMgr
    00051   declareProperty( "AuditAlgorithms", m_auditInit );
    00052
    00053   bool audit(false);
    00054   SmartIF<IProperty> appMgr(serviceLocator()->service("ApplicationMgr"));
    00055   if (appMgr.isValid()) {
    00056     const Property& prop = appMgr->getProperty("AuditAlgorithms");
    00057     Property &pr = const_cast<Property&>(prop);
    00058     if (m_name != "IncidentSvc") {
    00059       setProperty( pr ).ignore();
    00060     }
    00061     audit = m_auditInit.value();
    00062   }
    00063
    00064   declareProperty( "AuditInitialize"  , m_auditorInitialize   = audit ) ;
    00065   declareProperty( "AuditReinitialize", m_auditorReinitialize = audit ) ;
    00066   declareProperty( "AuditRestart"     , m_auditorRestart      = audit ) ;
    00067   declareProperty( "AuditExecute"     , m_auditorExecute      = audit ) ;
    00068   declareProperty( "AuditFinalize"    , m_auditorFinalize     = audit ) ;
    00069   declareProperty( "AuditBeginRun"    , m_auditorBeginRun     = audit ) ;
    00070   declareProperty( "AuditEndRun"      , m_auditorEndRun       = audit ) ;
    00071   declareProperty( "AuditStart"       , m_auditorStart        = audit ) ;
    00072   declareProperty( "AuditStop"        , m_auditorStop         = audit ) ;
    00073
    00074   declareProperty( "MonitorService"   , m_monitorSvcName      = "MonitorSvc" );
    00075
    00076   declareProperty
    00077     ( "RegisterForContextService" ,
    00078       m_registerContext  ,
    00079       "The flag to enforce the registration for Algorithm Context Service") ;
    00080
    00081   // update handlers.
    00082   m_outputLevel.declareUpdateHandler(&Algorithm::initOutputLevel, this);
    00083
    00084 }
    00085
    00086 // Default Destructor
    00087 Algorithm::~Algorithm() {
    00088   delete m_subAlgms;
    00089   delete m_propertyMgr;
    00090 }
    00091
    00092 // IAlgorithm implementation
    00093 StatusCode Algorithm::sysInitialize() {
    00094
    00095   // Bypass the initialization if the algorithm
    00096   // has already been initialized.
    00097   if ( Gaudi::StateMachine::INITIALIZED <= FSMState() ) return StatusCode::SUCCESS;
    00098
    00099   // Set the Algorithm's properties
    00100   StatusCode sc = setProperties();
    00101   if( sc.isFailure() ) return StatusCode::FAILURE;
    00102
    00103   // Bypass the initialization if the algorithm is disabled.
    00104   // Need to do this after setProperties.
    00105   if ( !isEnabled( ) ) return StatusCode::SUCCESS;
    00106
    00107   m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::INITIALIZE,m_state);
    00108
    00109   // Check current outputLevel to eventually inform the MessagsSvc
    00110   //if( m_outputLevel != MSG::NIL ) {
    00111   setOutputLevel( m_outputLevel );
    00112   //}
    00113
    00114   // TODO: (MCl) where shoud we do this? initialize or start?
    00115   // Reset Error count
    00116   //m_errorCount = 0;
    00117
    00118   // lock the context service
    00119   Gaudi::Utils::AlgContext cnt
    00120     ( this , registerContext() ? contextSvc().get() : 0 ) ;
    00121
    00122   // Invoke initialize() method of the derived class inside a try/catch clause
    00123   try {
    00124
    00125     { // limit the scope of the guard
    00126       Gaudi::Guards::AuditorGuard guard
    00127         ( this,
    00128           // check if we want to audit the initialize
    00129           (m_auditorInitialize) ? auditorSvc().get() : 0,
    00130           IAuditor::Initialize);
    00131       // Invoke the initialize() method of the derived class
    00132       sc = initialize();
    00133     }
    00134     if( sc.isSuccess() ) {
    00135
    00136       // Now initialize care of any sub-algorithms
    00137       std::vector<Algorithm *>::iterator it;
    00138       bool fail(false);
    00139       for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00140         if ((*it)->sysInitialize().isFailure()) fail = true;
    00141       }
    00142       if( fail ) {
    00143         sc = StatusCode::FAILURE;
    00144         MsgStream log ( msgSvc() , name() );
    00145         log << MSG::ERROR << " Error initializing one or several sub-algorithms"
    00146             << endmsg;
    00147       } else {
    00148         // Update the state.
    00149         m_state = m_targetState;
    00150       }
    00151     }
    00152   }
    00153   catch ( const GaudiException& Exception )
    00154   {
    00155     MsgStream log ( msgSvc() , name() ) ;
    00156     log << MSG::FATAL << " Exception with tag=" << Exception.tag()
    00157         << " is caught " << endmsg;
    00158     log << MSG::ERROR << Exception  << endmsg;
    00159     Stat stat( chronoSvc() , Exception.tag() );
    00160     sc = StatusCode::FAILURE;
    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     sc = StatusCode::FAILURE;
    00169   }
    00170   catch(...)
    00171   {
    00172     MsgStream log ( msgSvc() , name() ) ;
    00173     log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
    00174     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00175     sc = StatusCode::FAILURE;
    00176   }
    00177
    00178   return sc;
    00179 }
    00180
    00181 // IAlgorithm implementation
    00182 StatusCode Algorithm::sysStart() {
    00183
    00184   // Bypass the startup if already running or disabled.
    00185   if ( Gaudi::StateMachine::RUNNING == FSMState() ||
    00186        !isEnabled() ) return StatusCode::SUCCESS;
    00187
    00188   m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::START,m_state);
    00189
    00190   // TODO: (MCl) where shoud we do this? initialize or start?
    00191   // Reset Error count
    00192   m_errorCount = 0;
    00193
    00194   // lock the context service
    00195   Gaudi::Utils::AlgContext cnt
    00196     ( this , registerContext() ? contextSvc().get() : 0 ) ;
    00197
    00198   StatusCode sc(StatusCode::FAILURE);
    00199   // Invoke start() method of the derived class inside a try/catch clause
    00200   try
    00201   {
    00202     { // limit the scope of the guard
    00203       Gaudi::Guards::AuditorGuard guard
    00204         (this,
    00205          // check if we want to audit the initialize
    00206          (m_auditorStart) ? auditorSvc().get() : 0,
    00207          IAuditor::Start);
    00208       // Invoke the start() method of the derived class
    00209       sc = start();
    00210     }
    00211     if( sc.isSuccess() ) {
    00212
    00213       // Now start any sub-algorithms
    00214       std::vector<Algorithm *>::iterator it;
    00215       bool fail(false);
    00216       for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00217         if ((*it)->sysStart().isFailure()) fail = true;
    00218       }
    00219       if( fail ) {
    00220         sc = StatusCode::FAILURE;
    00221         MsgStream log ( msgSvc() , name() );
    00222         log << MSG::ERROR << " Error starting one or several sub-algorithms"
    00223             << endmsg;
    00224       } else {
    00225         // Update the state.
    00226         m_state = m_targetState;
    00227       }
    00228     }
    00229   }
    00230   catch ( const GaudiException& Exception )
    00231   {
    00232     MsgStream log ( msgSvc() , name() );
    00233     log << MSG::FATAL << "in sysStart(): exception with tag=" << Exception.tag()
    00234         << " is caught" << endmsg;
    00235     log << MSG::ERROR << Exception << endmsg;
    00236     Stat stat( chronoSvc() , Exception.tag() );
    00237     sc = StatusCode::FAILURE;
    00238   }
    00239   catch( const std::exception& Exception )
    00240   {
    00241     MsgStream log ( msgSvc() , name() );
    00242     log << MSG::FATAL << "in sysStart(): standard std::exception is caught" << endmsg;
    00243     log << MSG::ERROR << Exception.what()  << endmsg;
    00244     Stat stat( chronoSvc() , "*std::exception*" );
    00245     sc = StatusCode::FAILURE;
    00246   }
    00247   catch(...)
    00248   {
    00249     MsgStream log ( msgSvc() , name() );
    00250     log << MSG::FATAL << "in sysStart(): UNKNOWN Exception is caught" << endmsg;
    00251     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00252     sc = StatusCode::FAILURE;
    00253   }
    00254
    00255   return sc;
    00256 }
    00257
    00258 // IAlgorithm implementation
    00259 StatusCode Algorithm::sysReinitialize() {
    00260
    00261   // Bypass the initialization if the algorithm is disabled.
    00262   if ( !isEnabled( ) ) return StatusCode::SUCCESS;
    00263
    00264   // Check that the current status is the correct one.
    00265   if ( Gaudi::StateMachine::INITIALIZED != FSMState() ) {
    00266     MsgStream log ( msgSvc() , name() );
    00267     log << MSG::ERROR
    00268         << "sysReinitialize(): cannot reinitialize algorithm not initialized"
    00269         << endmsg;
    00270     return StatusCode::FAILURE;
    00271   }
    00272
    00273   // Check current outputLevel to evetually inform the MessagsSvc
    00274   //if( m_outputLevel != MSG::NIL ) {
    00275   setOutputLevel( m_outputLevel );
    00276   //}
    00277
    00278   // Reset Error count
    00279   // m_errorCount = 0; // done during start
    00280
    00281   // lock the context service
    00282   Gaudi::Utils::AlgContext cnt
    00283     ( this , registerContext() ? contextSvc().get() : 0 ) ;
    00284
    00285   StatusCode sc(StatusCode::SUCCESS);
    00286   // Invoke reinitialize() method of the derived class inside a try/catch clause
    00287   try {
    00288     { // limit the scope of the guard
    00289       Gaudi::Guards::AuditorGuard guard(this,
    00290                                         // check if we want to audit the initialize
    00291                                         (m_auditorReinitialize) ? auditorSvc().get() : 0,
    00292                                         IAuditor::ReInitialize);
    00293       // Invoke the reinitialize() method of the derived class
    00294       sc = reinitialize();
    00295     }
    00296     if( sc.isSuccess() ) {
    00297
    00298       // Now initialize care of any sub-algorithms
    00299       std::vector<Algorithm *>::iterator it;
    00300       bool fail(false);
    00301       for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00302         if((*it)->sysReinitialize().isFailure()) fail = true;
    00303       }
    00304
    00305       if (fail) {
    00306         sc = StatusCode::FAILURE;
    00307         MsgStream log ( msgSvc() , name() );
    00308         log << MSG::ERROR
    00309             << "sysReinitialize(): Error reinitializing one or several "
    00310             << "sub-algorithms" << endmsg;
    00311       }
    00312     }
    00313   }
    00314   catch ( const GaudiException& Exception )
    00315   {
    00316     MsgStream log ( msgSvc() , name() );
    00317     log << MSG::FATAL << "sysReinitialize(): Exception with tag=" << Exception.tag()
    00318         << " is caught" << endmsg;
    00319     log << MSG::ERROR << Exception  << endmsg;
    00320     Stat stat( chronoSvc() , Exception.tag() );
    00321     sc = StatusCode::FAILURE;
    00322   }
    00323   catch( const std::exception& Exception )
    00324   {
    00325     MsgStream log ( msgSvc() , name() );
    00326     log << MSG::FATAL << "sysReinitialize(): Standard std::exception is caught" << endmsg;
    00327     log << MSG::ERROR << Exception.what()  << endmsg;
    00328     Stat stat( chronoSvc() , "*std::exception*" );
    00329     sc = StatusCode::FAILURE;
    00330   }
    00331   catch(...)
    00332   {
    00333     MsgStream log ( msgSvc() , name() );
    00334     log << MSG::FATAL << "sysReinitialize(): UNKNOWN Exception is caught" << endmsg;
    00335     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00336     sc = StatusCode::FAILURE;
    00337   }
    00338
    00339   return sc;
    00340 }
    00341
    00342 // IAlgorithm implementation
    00343 StatusCode Algorithm::sysRestart() {
    00344
    00345   // Bypass the initialization if the algorithm is disabled.
    00346   if ( !isEnabled( ) ) return StatusCode::SUCCESS;
    00347
    00348   // Check that the current status is the correct one.
    00349   if ( Gaudi::StateMachine::RUNNING != FSMState() ) {
    00350     MsgStream log ( msgSvc() , name() );
    00351     log << MSG::ERROR
    00352         << "sysRestart(): cannot restart algorithm not started"
    00353         << endmsg;
    00354     return StatusCode::FAILURE;
    00355   }
    00356
    00357   // Check current outputLevel to evetually inform the MessagsSvc
    00358   //if( m_outputLevel != MSG::NIL ) {
    00359   setOutputLevel( m_outputLevel );
    00360   //}
    00361
    00362   // Reset Error count
    00363   m_errorCount = 0;
    00364
    00365   // lock the context service
    00366   Gaudi::Utils::AlgContext cnt
    00367     ( this , registerContext() ? contextSvc().get() : 0 ) ;
    00368
    00369   StatusCode sc(StatusCode::FAILURE);
    00370   // Invoke reinitialize() method of the derived class inside a try/catch clause
    00371   try {
    00372     { // limit the scope of the guard
    00373       Gaudi::Guards::AuditorGuard guard(this,
    00374                                         // check if we want to audit the initialize
    00375                                         (m_auditorRestart) ? auditorSvc().get() : 0,
    00376                                         IAuditor::ReStart);
    00377       // Invoke the reinitialize() method of the derived class
    00378       sc = restart();
    00379     }
    00380     if( sc.isSuccess() ) {
    00381
    00382       // Now initialize care of any sub-algorithms
    00383       std::vector<Algorithm *>::iterator it;
    00384       bool fail(false);
    00385       for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00386         if ((*it)->sysRestart().isFailure()) fail = true;
    00387       }
    00388       if( fail ) {
    00389         sc = StatusCode::FAILURE;
    00390         MsgStream log ( msgSvc() , name() );
    00391         log << MSG::ERROR
    00392             << "sysRestart(): Error restarting one or several sub-algorithms"
    00393             << endmsg;
    00394       }
    00395     }
    00396   }
    00397   catch ( const GaudiException& Exception )
    00398   {
    00399     MsgStream log ( msgSvc() , name() );
    00400     log << MSG::FATAL << "sysRestart(): Exception with tag=" << Exception.tag()
    00401         << " is caught" << endmsg;
    00402     log << MSG::ERROR << Exception  << endmsg;
    00403     Stat stat( chronoSvc() , Exception.tag() );
    00404     sc = StatusCode::FAILURE;
    00405   }
    00406   catch( const std::exception& Exception )
    00407   {
    00408     MsgStream log ( msgSvc() , name() );
    00409     log << MSG::FATAL << "sysRestart(): Standard std::exception is caught" << endmsg;
    00410     log << MSG::ERROR << Exception.what()  << endmsg;
    00411     Stat stat( chronoSvc() , "*std::exception*" );
    00412     sc = StatusCode::FAILURE;
    00413   }
    00414   catch(...)
    00415   {
    00416     MsgStream log ( msgSvc() , name() );
    00417     log << MSG::FATAL << "sysRestart(): UNKNOWN Exception is caught" << endmsg;
    00418     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00419     sc = StatusCode::FAILURE;
    00420   }
    00421
    00422   return sc;
    00423 }
    00424
    00425 // IAlgorithm implementation
    00426 StatusCode Algorithm::sysBeginRun() {
    00427
    00428   // Bypass the beginRun if the algorithm is disabled.
    00429   if ( !isEnabled( ) ) return StatusCode::SUCCESS;
    00430
    00431   // Check current outputLevel to evetually inform the MessagsSvc
    00432   //if( m_outputLevel != MSG::NIL ) {
    00433   setOutputLevel( m_outputLevel );
    00434   //}
    00435
    00436   // Reset Error count
    00437   m_errorCount = 0;
    00438
    00439   // lock the context service
    00440   Gaudi::Utils::AlgContext cnt
    00441     ( this , registerContext() ? contextSvc().get() : 0 ) ;
    00442
    00443   StatusCode sc(StatusCode::FAILURE);
    00444   // Invoke beginRun() method of the derived class inside a try/catch clause
    00445   try {
    00446     { // limit the scope of the guard
    00447       Gaudi::Guards::AuditorGuard guard(this,
    00448                                         // check if we want to audit the initialize
    00449                                         (m_auditorBeginRun) ? auditorSvc().get() : 0,
    00450                                         IAuditor::BeginRun);
    00451       // Invoke the beginRun() method of the derived class
    00452       sc = beginRun();
    00453     }
    00454     if( sc.isSuccess() ) {
    00455
    00456       // Now call beginRun for any sub-algorithms
    00457       std::vector<Algorithm *>::iterator it;
    00458       bool fail(false);
    00459       for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00460         if((*it)->sysBeginRun().isFailure()) fail = true;
    00461       }
    00462       if( fail ) {
    00463         sc = StatusCode::FAILURE;
    00464         MsgStream log ( msgSvc() , name() );
    00465         log << MSG::ERROR << " Error executing BeginRun for one or several sub-algorithms"
    00466           << endmsg;
    00467       }
    00468     }
    00469   }
    00470   catch ( const GaudiException& Exception )
    00471   {
    00472     MsgStream log ( msgSvc() , name() );
    00473     log << MSG::FATAL << " Exception with tag=" << Exception.tag()
    00474         << " is caught " << endmsg;
    00475     log << MSG::ERROR << Exception  << endmsg;
    00476     Stat stat( chronoSvc() , Exception.tag() );
    00477     sc = StatusCode::FAILURE;
    00478   }
    00479   catch( const std::exception& Exception )
    00480   {
    00481     MsgStream log ( msgSvc() , name() );
    00482     log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
    00483     log << MSG::ERROR << Exception.what()  << endmsg;
    00484     Stat stat( chronoSvc() , "*std::exception*" );
    00485     sc = StatusCode::FAILURE;
    00486   }
    00487   catch(...)
    00488   {
    00489     MsgStream log ( msgSvc() , name() );
    00490     log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
    00491     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00492     sc = StatusCode::FAILURE;
    00493   }
    00494   return sc;
    00495 }
    00496
    00497 StatusCode Algorithm::beginRun() {
    00498   return StatusCode::SUCCESS;
    00499 }
    00500
    00501 // IAlgorithm implementation
    00502 StatusCode Algorithm::sysEndRun() {
    00503
    00504   // Bypass the endRun if the algorithm is disabled.
    00505   if ( !isEnabled( ) ) return StatusCode::SUCCESS;
    00506
    00507   // Check current outputLevel to eventually inform the MessagsSvc
    00508   //if( m_outputLevel != MSG::NIL ) {
    00509   setOutputLevel( m_outputLevel );
    00510   //}
    00511
    00512   // Reset Error count
    00513   m_errorCount = 0;
    00514
    00515   // lock the context service
    00516   Gaudi::Utils::AlgContext cnt
    00517     ( this , registerContext() ? contextSvc().get() : 0 ) ;
    00518
    00519   // Invoke endRun() method of the derived class inside a try/catch clause
    00520   StatusCode sc(StatusCode::FAILURE);
    00521   try {
    00522     { // limit the scope of the guard
    00523       Gaudi::Guards::AuditorGuard guard(this,
    00524                                         // check if we want to audit the initialize
    00525                                         (m_auditorEndRun) ? auditorSvc().get() : 0,
    00526                                         IAuditor::EndRun);
    00527       // Invoke the endRun() method of the derived class
    00528       sc = endRun();
    00529     }
    00530     if( sc.isSuccess() ) {
    00531
    00532       // Now call endRun for any sub-algorithms
    00533       std::vector<Algorithm *>::iterator it;
    00534       bool fail(false);
    00535       for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00536         if ((*it)->sysEndRun().isFailure()) fail = true;
    00537       }
    00538       if( fail ) {
    00539         sc = StatusCode::FAILURE;
    00540         MsgStream log ( msgSvc() , name() );
    00541         log << MSG::ERROR << " Error calling endRun for one or several sub-algorithms"
    00542             << endmsg;
    00543       }
    00544     }
    00545   }
    00546   catch ( const GaudiException& Exception )
    00547   {
    00548     MsgStream log ( msgSvc() , name() );
    00549     log << MSG::FATAL << " Exception with tag=" << Exception.tag()
    00550         << " is caught " << endmsg;
    00551     log << MSG::ERROR << Exception  << endmsg;
    00552     Stat stat( chronoSvc() , Exception.tag() );
    00553     sc = StatusCode::FAILURE;
    00554   }
    00555   catch( const std::exception& Exception )
    00556   {
    00557     MsgStream log ( msgSvc() , name() );
    00558     log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
    00559     log << MSG::ERROR << Exception.what()  << endmsg;
    00560     Stat stat( chronoSvc() , "*std::exception*" );
    00561     sc = StatusCode::FAILURE;
    00562   }
    00563   catch(...)
    00564   {
    00565     MsgStream log ( msgSvc() , name() );
    00566     log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
    00567     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00568     sc = StatusCode::FAILURE;
    00569   }
    00570   return sc;
    00571 }
    00572
    00573 StatusCode Algorithm::endRun() {
    00574   return StatusCode::SUCCESS;
    00575 }
    00576
    00577
    00578 StatusCode Algorithm::sysExecute() {
    00579   if (!isEnabled()) {
    00580     if (UNLIKELY(m_outputLevel <= MSG::VERBOSE)) {
    00581       MsgStream log ( msgSvc() , name() );
    00582       log << MSG::VERBOSE << ".sysExecute(): is not enabled. Skip execution" << endmsg;
    00583     }
    00584     return StatusCode::SUCCESS;
    00585   }
    00586
    00587   StatusCode status;
    00588
    00589   // Should performance profile be performed ?
    00590   // invoke execute() method of Algorithm class
    00591   //   and catch all uncaught exceptions
    00592
    00593   // lock the context service
    00594   Gaudi::Utils::AlgContext cnt
    00595     ( this , registerContext() ? contextSvc().get() : 0 ) ;
    00596
    00597   Gaudi::Guards::AuditorGuard guard(this,
    00598                                     // check if we want to audit the initialize
    00599                                     (m_auditorExecute) ? auditorSvc().get() : 0,
    00600                                     IAuditor::Execute,
    00601                                     status);
    00602   try {
    00603     status = execute();
    00604     setExecuted(true);  // set the executed flag
    00605
    00606     if (status.isFailure()) {
    00607       status = exceptionSvc()->handleErr(*this,status);
    00608     }
    00609
    00610   }
    00611   catch( const GaudiException& Exception )
    00612   {
    00613     setExecuted(true);  // set the executed flag
    00614
    00615     MsgStream log ( msgSvc() , name() );
    00616     if (Exception.code() == StatusCode::FAILURE) {
    00617       log << MSG::FATAL;
    00618     } else {
    00619       log << MSG::ERROR << " Recoverable";
    00620     }
    00621
    00622     log << " Exception with tag=" << Exception.tag()
    00623         << " is caught " << endmsg;
    00624
    00625     log << MSG::ERROR << Exception  << endmsg;
    00626
    00627     Stat stat( chronoSvc() , Exception.tag() ) ;
    00628     status = exceptionSvc()->handle(*this,Exception);
    00629   }
    00630   catch( const std::exception& Exception )
    00631   {
    00632     setExecuted(true);  // set the executed flag
    00633
    00634     MsgStream log ( msgSvc() , name() );
    00635     log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
    00636     log << MSG::ERROR << Exception.what()  << endmsg;
    00637     Stat stat( chronoSvc() , "*std::exception*" ) ;
    00638     status = exceptionSvc()->handle(*this,Exception);
    00639   }
    00640   catch(...)
    00641   {
    00642     setExecuted(true);  // set the executed flag
    00643
    00644     MsgStream log ( msgSvc() , name() );
    00645     log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
    00646     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00647
    00648     status = exceptionSvc()->handle(*this);
    00649   }
    00650
    00651   if( status.isFailure() ) {
    00652     MsgStream log ( msgSvc() , name() );
    00653     // Increment the error count
    00654     m_errorCount++;
    00655     // Check if maximum is exeeded
    00656     if( m_errorCount < m_errorMax ) {
    00657       log << MSG::WARNING << "Continuing from error (cnt=" << m_errorCount
    00658           << ", max=" << m_errorMax << ")" << endmsg;
    00659       // convert to success
    00660       status = StatusCode::SUCCESS;
    00661     }
    00662   }
    00663   return status;
    00664 }
    00665
    00666 // IAlgorithm implementation
    00667 StatusCode Algorithm::sysStop() {
    00668
    00669   // Bypass the startup if already running or disabled.
    00670   if ( Gaudi::StateMachine::INITIALIZED == FSMState() ||
    00671        !isEnabled() ) return StatusCode::SUCCESS;
    00672
    00673   m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::STOP,m_state);
    00674
    00675   // lock the context service
    00676   Gaudi::Utils::AlgContext cnt
    00677     ( this , registerContext() ? contextSvc().get() : 0 ) ;
    00678
    00679   StatusCode sc(StatusCode::FAILURE);
    00680   // Invoke stop() method of the derived class inside a try/catch clause
    00681   try {
    00682     // Stop first any sub-algorithms (in reverse order)
    00683     std::vector<Algorithm *>::iterator it;
    00684     for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00685       (*it)->sysStop().ignore();
    00686     }
    00687     { // limit the scope of the guard
    00688       Gaudi::Guards::AuditorGuard guard(this,
    00689                                         // check if we want to audit the initialize
    00690                                         (m_auditorStop) ? auditorSvc().get() : 0,
    00691                                         IAuditor::Stop);
    00692
    00693       // Invoke the stop() method of the derived class
    00694       sc = stop();
    00695     }
    00696     if( sc.isSuccess() ) {
    00697       // Update the state.
    00698       m_state = m_targetState;
    00699     }
    00700   }
    00701   catch ( const GaudiException& Exception )  {
    00702     MsgStream log ( msgSvc() , name() );
    00703     log << MSG::FATAL << "in sysStop(): exception with tag=" << Exception.tag()
    00704         << " is caught" << endmsg;
    00705     log << MSG::ERROR << Exception << endmsg;
    00706     Stat stat( chronoSvc() , Exception.tag() );
    00707     sc = StatusCode::FAILURE;
    00708   }
    00709   catch( const std::exception& Exception ) {
    00710     MsgStream log ( msgSvc() , name() );
    00711     log << MSG::FATAL << "in sysStop(): standard std::exception is caught" << endmsg;
    00712     log << MSG::ERROR << Exception.what()  << endmsg;
    00713     Stat stat( chronoSvc() , "*std::exception*" );
    00714     sc = StatusCode::FAILURE;
    00715   }
    00716   catch(...) {
    00717     MsgStream log ( msgSvc() , name() );
    00718     log << MSG::FATAL << "in sysStop(): UNKNOWN Exception is caught" << endmsg;
    00719     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00720     sc = StatusCode::FAILURE;
    00721   }
    00722
    00723   return sc;
    00724 }
    00725
    00726 StatusCode Algorithm::sysFinalize() {
    00727
    00728   // Bypass the finalialization if the algorithm hasn't been initilized.
    00729   if ( Gaudi::StateMachine::CONFIGURED == FSMState() ||
    00730        !isEnabled() ) return StatusCode::SUCCESS;
    00731
    00732   m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::FINALIZE,m_state);
    00733
    00734   // lock the context service
    00735   Gaudi::Utils::AlgContext cnt
    00736     ( this , registerContext() ? contextSvc().get() : 0 ) ;
    00737
    00738   StatusCode sc(StatusCode::FAILURE);
    00739   // Invoke finalize() method of the derived class inside a try/catch clause
    00740   try {
    00741     // Order changed (bug #3903 overview: finalize and nested algorithms)
    00742     // Finalize first any sub-algoithms (it can be done more than once)
    00743     std::vector<Algorithm *>::iterator it;
    00744     bool fail(false);
    00745     for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00746       if (!(*it)->sysFinalize().isSuccess()) {
    00747         fail = true;
    00748       }
    00749     }
    00750
    00751     { // limit the scope of the guard
    00752       Gaudi::Guards::AuditorGuard guard(this,
    00753                                         // check if we want to audit the initialize
    00754                                         (m_auditorFinalize) ? auditorSvc().get() : 0,
    00755                                         IAuditor::Finalize);
    00756       // Invoke the finalize() method of the derived class
    00757       sc = finalize();
    00758     }
    00759     if (fail) sc = StatusCode::FAILURE;
    00760
    00761     if( sc.isSuccess() ) {
    00762
    00763       // Release all sub-algorithms
    00764       for (it = m_subAlgms->begin(); it != m_subAlgms->end(); it++) {
    00765         (*it)->release();
    00766       }
    00767       // Indicate that this Algorithm has been finalized to prevent duplicate attempts
    00768       m_state = m_targetState;
    00769     }
    00770   }
    00771   catch( const GaudiException& Exception )
    00772   {
    00773     MsgStream log ( msgSvc() , name() );
    00774     log << MSG::FATAL << " Exception with tag=" << Exception.tag()
    00775         << " is caught " << endmsg;
    00776     log << MSG::ERROR << Exception  << endmsg;
    00777     Stat stat( chronoSvc() , Exception.tag() ) ;
    00778     sc = StatusCode::FAILURE;
    00779   }
    00780   catch( const std::exception& Exception )
    00781   {
    00782     MsgStream log ( msgSvc() , name() );
    00783     log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
    00784     log << MSG::ERROR << Exception.what()  << endmsg;
    00785     Stat stat( chronoSvc() , "*std::exception*" ) ;
    00786     sc = StatusCode::FAILURE;
    00787   }
    00788   catch( ... )
    00789   {
    00790     MsgStream log ( msgSvc() , name() );
    00791     log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
    00792     Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
    00793     sc = StatusCode::FAILURE;
    00794   }
    00795   return sc;
    00796 }
    00797
    00798 StatusCode Algorithm::reinitialize() {
    00799   /* @TODO
    00800    * MCl 2008-10-23: the implementation of reinitialize as finalize+initialize
    00801    *                 is causing too many problems
    00802    *
    00803   // Default implementation is finalize+initialize
    00804   StatusCode sc = finalize();
    00805   if (sc.isFailure()) {
    00806     MsgStream log ( msgSvc() , name() );
    00807     log << MSG::ERROR << "reinitialize(): cannot be finalized" << endmsg;
    00808     return sc;
    00809   }
    00810   sc = initialize();
    00811   if (sc.isFailure()) {
    00812     MsgStream log ( msgSvc() , name() );
    00813     log << MSG::ERROR << "reinitialize(): cannot be initialized" << endmsg;
    00814     return sc;
    00815   }
    00816   */
    00817   return StatusCode::SUCCESS;
    00818 }
    00819
    00820 StatusCode Algorithm::restart() {
    00821   // Default implementation is stop+start
    00822   StatusCode sc = stop();
    00823   if (sc.isFailure()) {
    00824     MsgStream log ( msgSvc() , name() );
    00825     log << MSG::ERROR << "restart(): cannot be stopped" << endmsg;
    00826     return sc;
    00827   }
    00828   sc = start();
    00829   if (sc.isFailure()) {
    00830     MsgStream log ( msgSvc() , name() );
    00831     log << MSG::ERROR << "restart(): cannot be started" << endmsg;
    00832     return sc;
    00833   }
    00834   return StatusCode::SUCCESS;
    00835 }
    00836
    00837 const std::string& Algorithm::name() const {
    00838   return m_name;
    00839 }
    00840
    00841 const std::string& Algorithm::version() const {
    00842   return m_version;
    00843 }
    00844
    00845 bool Algorithm::isExecuted() const {
    00846   return m_isExecuted;
    00847 }
    00848
    00849 void Algorithm::setExecuted( bool state ) {
    00850   m_isExecuted = state;
    00851 }
    00852
    00853 void Algorithm::resetExecuted() {
    00854   m_isExecuted   = false;
    00855   m_filterPassed = true;
    00856 }
    00857
    00858 bool Algorithm::isEnabled() const {
    00859   return m_isEnabled;
    00860 }
    00861
    00862 bool Algorithm::filterPassed() const {
    00863   return m_filterPassed;
    00864 }
    00865
    00866 void Algorithm::setFilterPassed( bool state ) {
    00867   m_filterPassed = state;
    00868 }
    00869
    00870 std::vector<Algorithm*>* Algorithm::subAlgorithms( ) const {
    00871   return m_subAlgms;
    00872 }
    00873
    00874 void Algorithm::setOutputLevel( int level ) {
    00875   if ( msgSvc() != 0 )
    00876   {
    00877     if ( MSG::NIL != level )
    00878     { msgSvc()->setOutputLevel( name(), level ) ; }
    00879     m_outputLevel = msgSvc()->outputLevel( name() );
    00880   }
    00881 }
    00882
    00883 #define serviceAccessor(METHOD,INTERFACE,NAME,MEMBER) \
    00884 SmartIF<INTERFACE>& Algorithm::METHOD() const { \
    00885   if ( !MEMBER.isValid() ) { \
    00886     MEMBER = service(NAME); \
    00887     if( !MEMBER.isValid() ) { \
    00888       throw GaudiException("Service [" NAME  "] not found", name(), StatusCode::FAILURE); \
    00889     } \
    00890   } \
    00891   return MEMBER; \
    00892 }
    00893
    00894 //serviceAccessor(msgSvc, IMessageSvc, "MessageSvc", m_MS)
    00895 // Message service needs a special treatment to avoid infinite recursion
    00896 SmartIF<IMessageSvc>& Algorithm::msgSvc() const {
    00897   if ( !m_MS.isValid() ) {
    00898     //can not use service() method (infinite recursion!)
    00899     m_MS = serviceLocator(); // default message service
    00900     if( !m_MS.isValid() ) {
    00901       throw GaudiException("Service [MessageSvc] not found", name(), StatusCode::FAILURE);
    00902     }
    00903   }
    00904   return m_MS;
    00905 }
    00906
    00907 serviceAccessor(auditorSvc, IAuditorSvc, "AuditorSvc", m_pAuditorSvc)
    00908 serviceAccessor(chronoSvc, IChronoStatSvc, "ChronoStatSvc", m_CSS)
    00909 serviceAccessor(detSvc, IDataProviderSvc, "DetectorDataSvc", m_DDS)
    00910 serviceAccessor(detCnvSvc, IConversionSvc, "DetectorPersistencySvc", m_DCS)
    00911 serviceAccessor(eventSvc, IDataProviderSvc, "EventDataSvc", m_EDS)
    00912 serviceAccessor(eventCnvSvc, IConversionSvc, "EventPersistencySvc", m_ECS)
    00913 serviceAccessor(histoSvc, IHistogramSvc, "HistogramDataSvc", m_HDS)
    00914 serviceAccessor(exceptionSvc, IExceptionSvc, "ExceptionSvc", m_EXS)
    00915 serviceAccessor(ntupleSvc, INTupleSvc, "NTupleSvc", m_NTS)
    00916 //serviceAccessor(atupleSvc, IAIDATupleSvc, "AIDATupleSvc", m_ATS)
    00917 serviceAccessor(randSvc, IRndmGenSvc, "RndmGenSvc", m_RGS)
    00918 serviceAccessor(toolSvc, IToolSvc, "ToolSvc", m_ptoolSvc)
    00919 serviceAccessor(contextSvc, IAlgContextSvc,"AlgContextSvc", m_contextSvc)
    00920
    00921
    00922 // Obsoleted name, kept due to the backwards compatibility
    00923 SmartIF<IChronoStatSvc>& Algorithm::chronoStatService() const {
    00924   return chronoSvc();
    00925 }
    00926 // Obsoleted name, kept due to the backwards compatibility
    00927 SmartIF<IDataProviderSvc>& Algorithm::detDataService() const {
    00928   return detSvc();
    00929 }
    00930 // Obsoleted name, kept due to the backwards compatibility
    00931 SmartIF<IConversionSvc>& Algorithm::detDataCnvService() const {
    00932   return detCnvSvc();
    00933 }
    00934 // Obsoleted name, kept due to the backwards compatibility
    00935 SmartIF<IDataProviderSvc>& Algorithm::eventDataService() const {
    00936   return eventSvc();
    00937 }
    00938 // Obsoleted name, kept due to the backwards compatibility
    00939 SmartIF<IConversionSvc>& Algorithm::eventDataCnvService() const {
    00940   return eventCnvSvc();
    00941 }
    00942 // Obsoleted name, kept due to the backwards compatibility
    00943 SmartIF<IHistogramSvc>& Algorithm::histogramDataService() const {
    00944   return histoSvc();
    00945 }
    00946 // Obsoleted name, kept due to the backwards compatibility
    00947 SmartIF<IMessageSvc>& Algorithm::messageService() const {
    00948   return msgSvc();
    00949 }
    00950 // Obsoleted name, kept due to the backwards compatibility
    00951 SmartIF<INTupleSvc>& Algorithm::ntupleService() const {
    00952   return ntupleSvc();
    00953 }
    00954
    00955 #if 0
    00956 IAuditorSvc* Algorithm::auditorSvc() const {
    00957   if ( 0 == m_pAuditorSvc ) {
    00958     StatusCode sc = service( "AuditorSvc", m_pAuditorSvc, true );
    00959     if( sc.isFailure() ) {
    00960       throw GaudiException("Service [AuditorSvc] not found", name(), sc);
    00961     }
    00962   }
    00963   return m_pAuditorSvc;
    00964 }
    00965
    00966 IChronoStatSvc* Algorithm::chronoSvc() const {
    00967   if ( 0 == m_CSS ) {
    00968     StatusCode sc = service( "ChronoStatSvc", m_CSS, true );
    00969     if( sc.isFailure() ) {
    00970       throw GaudiException("Service [ChronoStatSvc] not found", name(), sc);
    00971     }
    00972   }
    00973   return m_CSS;
    00974 }
    00975
    00976 IDataProviderSvc* Algorithm::detSvc() const {
    00977   if ( 0 == m_DDS ) {
    00978     StatusCode sc = service( "DetectorDataSvc", m_DDS, true );
    00979     if( sc.isFailure() ) {
    00980       throw GaudiException("Service [DetectorDataSvc] not found", name(), sc);
    00981     }
    00982   }
    00983   return m_DDS;
    00984 }
    00985
    00986 IConversionSvc* Algorithm::detCnvSvc() const {
    00987   if ( 0 == m_DCS ) {
    00988     StatusCode sc = service( "DetectorPersistencySvc", m_DCS, true );
    00989     if( sc.isFailure() ) {
    00990       throw GaudiException("Service [DetectorPersistencySvc] not found",
    00991                            name(), sc);
    00992     }
    00993   }
    00994   return m_DCS;
    00995 }
    00996
    00997 IDataProviderSvc* Algorithm::eventSvc() const {
    00998   if ( 0 == m_EDS ) {
    00999     StatusCode sc = service( "EventDataSvc", m_EDS, true );
    01000     if( sc.isFailure() ) {
    01001       throw GaudiException("Service [EventDataSvc] not found", name(), sc);
    01002     }
    01003   }
    01004   return m_EDS;
    01005 }
    01006
    01007 IConversionSvc* Algorithm::eventCnvSvc() const {
    01008   if ( 0 == m_ECS ) {
    01009     StatusCode sc = service( "EventPersistencySvc", m_ECS, true );
    01010     if( sc.isFailure() ) {
    01011       throw GaudiException("Service [EventPersistencySvc] not found",
    01012                            name(), sc);
    01013     }
    01014   }
    01015   return m_ECS;
    01016 }
    01017
    01018 IHistogramSvc* Algorithm::histoSvc() const {
    01019   if ( 0 == m_HDS ) {
    01020     StatusCode sc = service( "HistogramDataSvc", m_HDS, true );
    01021     if( sc.isFailure() ) {
    01022       throw GaudiException("Service [HistogramDataSvc] not found", name(), sc);
    01023     }
    01024   }
    01025   return m_HDS;
    01026 }
    01027
    01028 IExceptionSvc* Algorithm::exceptionSvc() const {
    01029   if ( 0 == m_EXS ) {
    01030     StatusCode sc = service( "ExceptionSvc", m_EXS, true );
    01031     if( sc.isFailure() ) {
    01032       throw GaudiException("Service [ExceptionSvc] not found", name(), sc);
    01033     }
    01034   }
    01035   return m_EXS;
    01036 }
    01037
    01038 IMessageSvc* Algorithm::msgSvc() const {
    01039   if ( 0 == m_MS ) {
    01040     //can not use service() method (infinite recursion!)
    01041     StatusCode sc = serviceLocator()->service( "MessageSvc", m_MS, true );
    01042     if( sc.isFailure() ) {
    01043       throw GaudiException("Service [MessageSvc] not found", name(), sc);
    01044     }
    01045   }
    01046   return m_MS;
    01047 }
    01048
    01049 INTupleSvc* Algorithm::ntupleSvc() const {
    01050   if ( 0 == m_NTS ) {
    01051     StatusCode sc = service( "NTupleSvc", m_NTS, true );
    01052     if( sc.isFailure() ) {
    01053       throw GaudiException("Service [NTupleSvc] not found", name(), sc);
    01054     }
    01055   }
    01056   return m_NTS;
    01057 }
    01058
    01059 // AIDATupleSvc:
    01060 // IAIDATupleSvc* Algorithm::atupleSvc() const {
    01061 //   if ( 0 == m_ATS ) {
    01062 //     StatusCode sc = service( "AIDATupleSvc", m_ATS, true );
    01063 //     if( sc.isFailure() ) {
    01064 //       throw GaudiException("Service [AIDATupleSvc] not found", name(), sc);
    01065 //     }
    01066 //   }
    01067 //   return m_ATS;
    01068 // }
    01069
    01070 IRndmGenSvc* Algorithm::randSvc() const {
    01071   if ( 0 == m_RGS ) {
    01072     StatusCode sc = service( "RndmGenSvc", m_RGS, true );
    01073     if( sc.isFailure() ) {
    01074       throw GaudiException("Service [RndmGenSvc] not found", name(), sc);
    01075     }
    01076   }
    01077   return m_RGS;
    01078 }
    01079
    01080 IToolSvc* Algorithm::toolSvc() const {
    01081   if ( 0 == m_ptoolSvc ) {
    01082     StatusCode sc = service( "ToolSvc", m_ptoolSvc, true );
    01083     if( sc.isFailure() ) {
    01084       throw GaudiException("Service [ToolSvc] not found", name(), sc);
    01085     }
    01086   }
    01087   return m_ptoolSvc;
    01088 }
    01089 #endif
    01090
    01091 SmartIF<ISvcLocator>& Algorithm::serviceLocator() const {
    01092   return *const_cast<SmartIF<ISvcLocator>*>(&m_pSvcLocator);
    01093 }
    01094
    01095 // Use the job options service to set declared properties
    01096 StatusCode Algorithm::setProperties() {
    01097   if( m_pSvcLocator != 0 )    {
    01098     SmartIF<IJobOptionsSvc> jos(m_pSvcLocator->service("JobOptionsSvc"));
    01099     if( jos.isValid() ) {
    01100       // set first generic Properties
    01101       StatusCode sc = jos->setMyProperties( getGaudiThreadGenericName(name()), this );
    01102       if( sc.isFailure() ) return StatusCode::FAILURE;
    01103
    01104       // set specific Properties
    01105       if (isGaudiThreaded(name())) {
    01106         if(jos->setMyProperties( name(), this ).isFailure()) {
    01107           return StatusCode::FAILURE;
    01108         }
    01109       }
    01110       return sc;
    01111     }
    01112   }
    01113   return StatusCode::FAILURE;
    01114 }
    01115
    01116 StatusCode Algorithm::createSubAlgorithm(const std::string& type,
    01117                                          const std::string& name,
    01118                                          Algorithm*& pSubAlgorithm) {
    01119   if( m_pSvcLocator == 0 ) return StatusCode::FAILURE;
    01120
    01121   SmartIF<IAlgManager> am(m_pSvcLocator);
    01122   if ( !am.isValid() ) return StatusCode::FAILURE;
    01123
    01124   // Maybe modify the AppMgr interface to return Algorithm* ??
    01125   IAlgorithm *tmp;
    01126   StatusCode sc = am->createAlgorithm
    01127     (type, name+getGaudiThreadIDfromName(Algorithm::name()), tmp);
    01128   if( sc.isFailure() ) return StatusCode::FAILURE;
    01129
    01130   try{
    01131     pSubAlgorithm = dynamic_cast<Algorithm*>(tmp);
    01132     m_subAlgms->push_back(pSubAlgorithm);
    01133   } catch(...){
    01134     sc = StatusCode::FAILURE;
    01135   }
    01136   return sc;
    01137 }
    01138
    01139 // IProperty implementation
    01140 // Delegate to the Property manager
    01141 StatusCode Algorithm::setProperty(const Property& p) {
    01142   return m_propertyMgr->setProperty(p);
    01143 }
    01144 StatusCode Algorithm::setProperty(const std::string& s) {
    01145   return m_propertyMgr->setProperty(s);
    01146 }
    01147 StatusCode Algorithm::setProperty(const std::string& n, const std::string& v) {
    01148   return m_propertyMgr->setProperty(n,v);
    01149 }
    01150 StatusCode Algorithm::getProperty(Property* p) const {
    01151   return m_propertyMgr->getProperty(p);
    01152 }
    01153 const Property& Algorithm::getProperty( const std::string& name) const{
    01154   return m_propertyMgr->getProperty(name);
    01155 }
    01156 StatusCode Algorithm::getProperty(const std::string& n, std::string& v ) const {
    01157   return m_propertyMgr->getProperty(n,v);
    01158 }
    01159 const std::vector<Property*>& Algorithm::getProperties( ) const {
    01160   return m_propertyMgr->getProperties();
    01161 }
    01162
    01166 void
    01167 Algorithm::initOutputLevel(Property& /*prop*/)
    01168 {
    01169   // do nothing... yet ?
    01170 }
    01171
    01172 StatusCode
    01173 Algorithm::service_i(const std::string& svcName,
    01174                      bool createIf,
    01175                      const InterfaceID& iid,
    01176                      void** ppSvc) const {
    01177   const ServiceLocatorHelper helper(*serviceLocator(), *this);
    01178   return helper.getService(svcName, createIf, iid, ppSvc);
    01179 }
    01180
    01181 StatusCode
    01182 Algorithm::service_i(const std::string& svcType,
    01183                      const std::string& svcName,
    01184                      const InterfaceID& iid,
    01185                      void** ppSvc) const {
    01186   const ServiceLocatorHelper helper(*serviceLocator(), *this);
    01187   return helper.createService(svcType, svcName, iid, ppSvc);
    01188 }
    01189
    01190 SmartIF<IService> Algorithm::service(const std::string& name, const bool createIf, const bool quiet) const {
    01191   const ServiceLocatorHelper helper(*serviceLocator(), *this);
    01192   return helper.service(name, quiet, createIf);
    01193 }

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines