1 #ifndef GAUDIKERNEL_ALGORITHM_H
2 #define GAUDIKERNEL_ALGORITHM_H
6 #include "GaudiKernel/IProperty.h"
7 #include "GaudiKernel/IAlgorithm.h"
8 #include "GaudiKernel/IService.h"
9 #include "GaudiKernel/PropertyMgr.h"
10 #include "GaudiKernel/ISvcLocator.h"
11 #include "GaudiKernel/IMessageSvc.h"
12 #include "GaudiKernel/IStateful.h"
18 #include "GaudiKernel/IDataProviderSvc.h"
19 #include "GaudiKernel/IHistogramSvc.h"
20 #include "GaudiKernel/IConversionSvc.h"
21 #include "GaudiKernel/INTupleSvc.h"
22 #include "GaudiKernel/IChronoStatSvc.h"
23 #include "GaudiKernel/IRndmGenSvc.h"
24 #include "GaudiKernel/IAuditorSvc.h"
25 #include "GaudiKernel/IToolSvc.h"
26 #include "GaudiKernel/IMonitorSvc.h"
27 #include "GaudiKernel/IExceptionSvc.h"
28 #include "GaudiKernel/IAlgContextSvc.h"
29 #include "GaudiKernel/Property.h"
30 #include <Gaudi/PluginService.h>
32 #ifndef PACKAGE_VERSION
33 #define PACKAGE_VERSION "unknown"
147 virtual const std::string& name()
const;
149 virtual const std::string& version()
const;
171 virtual bool isExecuted( )
const;
174 virtual void setExecuted(
bool state );
179 virtual void resetExecuted( );
196 virtual bool isEnabled( )
const;
199 virtual bool filterPassed( )
const;
202 virtual void setFilterPassed(
bool state );
210 (
const std::string& name, T*& psvc,
bool createIf =
true )
const {
211 return service_i(name, createIf, T::interfaceID(), (
void**)&psvc);
218 return service_i(svcType, svcName, T::interfaceID(), (
void**)&psvc);
222 SmartIF<IService> service(
const std::string& name,
const bool createIf =
true,
const bool quiet =
false)
const;
225 void setOutputLevel(
int level );
340 const std::string& name,
Algorithm*& pSubAlg );
343 std::vector<Algorithm*>* subAlgorithms()
const;
358 virtual const std::vector<Property*>& getProperties( )
const;
360 virtual bool hasProperty(
const std::string& name)
const;
402 (
const std::string& name ,
404 const std::string& doc =
"none" )
const
406 return m_propertyMgr->declareProperty(name, property, doc);
411 (
const std::string& name ,
413 const std::string& rname =
"" )
const
415 return m_propertyMgr -> declareRemoteProperty ( name , rsvc , rname );
430 if ( !m_pMonitorSvc.isValid() ){
431 m_pMonitorSvc = service(m_monitorSvcName,
false,
true);
433 return m_pMonitorSvc;
444 const std::string& desc )
const
458 const std::string&
format,
461 const std::string& desc )
const
464 if ( mS ) mS->
declareInfo(name, format, var, size, desc,
this);
511 template <
class TYPE>
513 (
const std::string& name ,
532 void initOutputLevel(
Property& prop);
581 StatusCode service_i(
const std::string& svcName,
585 StatusCode service_i(
const std::string& svcType,
586 const std::string& svcName,
597 #ifndef GAUDI_NEW_PLUGIN_SERVICE
602 template <
typename S,
typename... Args>
604 return new T(
args...);
610 #define DECLARE_ALGORITHM_FACTORY(x) \
611 DECLARE_FACTORY_WITH_CREATOR(x, AlgFactory< x >, Algorithm::Factory)
612 #define DECLARE_NAMED_ALGORITHM_FACTORY(x, n) \
613 DECLARE_FACTORY_WITH_CREATOR_AND_ID(x, AlgFactory< x >, \
614 #n, Algorithm::Factory)
615 #define DECLARE_NAMESPACE_ALGORITHM_FACTORY(n, x) \
616 DECLARE_ALGORITHM_FACTORY(n::x)
621 #define DECLARE_ALGORITHM_FACTORY(x) DECLARE_COMPONENT(x)
622 #define DECLARE_NAMED_ALGORITHM_FACTORY(x, n) DECLARE_COMPONENT_WITH_ID(x, #n)
623 #define DECLARE_NAMESPACE_ALGORITHM_FACTORY(n, x) DECLARE_COMPONENT(n::x)
627 #endif //GAUDIKERNEL_ALGORITHM_H
StatusCode service(const std::string &svcType, const std::string &svcName, T *&psvc) const
Access a service by name and type, creating it if it doesn't already exist.
SmartIF< IChronoStatSvc > m_CSS
Chrono & Stat Service.
StatusCode setProperty(IProperty *component, const std::string &name, const TYPE &value, const std::string &doc)
simple function to set the property of the given object from the value
PropertyMgr * m_propertyMgr
For management of properties.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
virtual StatusCode start()
the default (empty) implementation of IStateful::start() method
SmartIF< ISvcLocator > & svcLoc() const
shortcut for method serviceLocator
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)
SmartIF< IHistogramSvc > m_HDS
Histogram data service.
IntegerProperty & outputLevelProperty()
Accessor for the Message level property.
SmartIF< IConversionSvc > m_DCS
Detector conversion service.
bool m_registerContext
flag to register for Algorithm Context Service
Base class used to implement the interfaces.
BooleanProperty m_auditInit
global flag for auditors
static S::ReturnType create(Args...args)
SmartIF< IToolSvc > m_ptoolSvc
ToolSvc Service.
SmartIF< ISvcLocator > m_pSvcLocator
Pointer to service locator service.
virtual StatusCode terminate()
Dummy implementation of IStateful::terminate() method.
Gaudi::PluginService::Factory< IAlgorithm *, const std::string &, ISvcLocator * > Factory
int errorCount() const
Get the number of failures of the algorithm.
bool m_isEnabled
Algorithm is enabled flag.
GAUDI_API bool hasProperty(const IProperty *p, const std::string &name)
simple function which check the existence of the property with the given name.
bool m_auditorBeginRun
flag for auditors in "beginRun()"
SmartIF< IExceptionSvc > m_EXS
Exception Handler Service.
SmartIF< IRndmGenSvc > m_RGS
Random Number Generator Service.
State
Allowed states for classes implementing the state machine (ApplicationMgr, Algorithm, Service, AlgTool).
virtual StatusCode configure()
Dummy implementation of IStateful::configure() method.
SmartIF< IAuditorSvc > m_pAuditorSvc
Auditor Service.
const char *PyHelper() getProperty(IInterface *p, char *name)
Property manager helper class.
SmartIF< IMonitorSvc > m_pMonitorSvc
Online Monitoring Service.
std::string m_version
Algorithm's version.
int m_errorMax
Algorithm Max number of errors.
virtual StatusCode stop()
the default (empty) implementation of IStateful::stop() method
int m_errorCount
Algorithm error counter.
Gaudi::InterfaceId< IInterface, 0, 0 > iid
Interface ID.
bool m_filterPassed
Filter passed flag.
SmartIF< IDataProviderSvc > m_DDS
Detector data service.
SmartIF< IDataProviderSvc > m_EDS
Event data service.
bool m_auditorExecute
flag for auditors in "execute()"
Definition of the IMonitorSvc interface, which publishes Gaudi variables to outside monitoring proces...
bool m_auditorReinitialize
flag for auditors in "Reinitialize()"
This class is used for returning status codes from appropriate routines.
virtual Gaudi::StateMachine::State FSMState() const
returns the current state of the algorithm
SmartIF< IConversionSvc > m_ECS
Event conversion service.
bool isInitialized() const
Has the Algorithm already been initialized?
bool PyHelper() setProperty(IInterface *p, char *name, char *value)
bool m_isFinalized
Algorithm has been finalized flag.
SmartIF< INTupleSvc > m_NTS
N tuple service.
SmartIF< IMonitorSvc > & monitorSvc() const
Access the monitor service.
Gaudi::StateMachine::State m_targetState
Algorithm has been initialized flag.
The IAlgorithm is the interface implemented by the Algorithm base class.
void declareInfo(const std::string &name, const T &var, const std::string &desc) const
Declare monitoring information.
std::vector< Algorithm * > * m_subAlgms
Sub algorithms.
bool m_auditorRestart
flag for auditors in "Restart()"
bool m_auditorStart
flag for auditors in "initialize()"
Base class from which all concrete algorithm classes should be derived.
SmartIF< IDataProviderSvc > & evtSvc() const
shortcut for method eventSvc
Property base class allowing Property* collections to be "homogeneous".
virtual void declareInfo(const std::string &name, const bool &var, const std::string &desc, const IInterface *owner)=0
Declare monitoring information.
Class wrapping the signature for a factory with any number of arguments.
bool registerContext() const
register for Algorithm Context Service?
std::string m_name
Algorithm's name for identification.
bool m_auditorInitialize
flag for auditors in "initialize()"
IntegerProperty m_outputLevel
Algorithm output level.
virtual Gaudi::StateMachine::State targetFSMState() const
returns the state the algorithm will be in after the ongoing transition
bool isFinalized() const
Has the Algorithm already been finalized?
virtual StatusCode initialize()
the default (empty) implementation of IStateful::initialize() method
virtual StatusCode finalize()
the default (empty) implementation of IStateful::finalize() method
SmartIF< IAlgContextSvc > m_contextSvc
Algorithm Context Service.
Gaudi::StateMachine::State m_state
Algorithm has been initialized flag.
int outputLevel() const
retrieve the Algorithm output level
SmartIF< IMessageSvc > m_MS
Message service.
bool m_auditorStop
flag for auditors in "Reinitialize()"
The IProperty is the basic interface for all components which have properties that can be set or get...
bool m_auditorEndRun
flag for auditors in "endRun()"
bool m_isExecuted
Algorithm is executed flag.
std::string m_monitorSvcName
Name to use for Monitor Service.
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
bool m_auditorFinalize
flag for auditors in "finalize()"