| The Gaudi Framework v30r0 (c919700c)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
AlgExecStateSvc Class Reference

A service that keeps track of the execution state of Algorithm *. More...

`#include <src/AlgExecStateSvc/AlgExecStateSvc.h>`

Inheritance diagram for AlgExecStateSvc:
[legend]
Collaboration diagram for AlgExecStateSvc:
[legend]

## Public Types
typedef IAlgExecStateSvc::AlgStateMap_t | AlgStateMap_t
Public Types inherited from extends< Service, IAlgExecStateSvc >
using | base_class = extends
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces... >
| Typedef to the base of this class. More...
Public Types inherited from Service
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using | PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| Typedef used to refer to this class from derived classes, as in. More...
Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using | base_class = CommonMessaging
Public Types inherited from extend_interfaces< Interfaces... >
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
| take union of the ext_iids of all Interfaces... More...

## Public Member Functions
| AlgExecStateSvc (const std::string &name, ISvcLocator *svc)
| Constructor. More...
| ~AlgExecStateSvc ()
| Destructor. More...
virtual StatusCode | initialize () override final
virtual StatusCode | finalize () override final
const AlgExecState & | algExecState (const Gaudi::StringKey &algName, const EventContext &ctx) const override
const AlgExecState & | algExecState (IAlgorithm *iAlg, const EventContext &ctx) const override
AlgExecState & | algExecState (IAlgorithm *iAlg, const EventContext &ctx) override
const AlgStateMap_t & | algExecStates (const EventContext &ctx) const override
void | reset (const EventContext &ctx) override
void | addAlg (IAlgorithm *iAlg) override
void | addAlg (const Gaudi::StringKey &algName) override
const EventStatus::Status & | eventStatus (const EventContext &ctx) const override
void | setEventStatus (const EventStatus::Status &sc, const EventContext &ctx) override
void | updateEventStatus (const bool &b, const EventContext &ctx) override
unsigned int | algErrorCount (const IAlgorithm *iAlg) const override
void | resetErrorCount (const IAlgorithm *iAlg) override
unsigned int | incrementErrorCount (const IAlgorithm *iAlg) override
void | dump (std::ostringstream &ost, const EventContext &ctx) const override
Public Member Functions inherited from extends< Service, IAlgExecStateSvc >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| ~extends () override=default
| Virtual destructor. More...
Public Member Functions inherited from Service
const std::string & | name () const override
| Retrieve name of the service. More...
StatusCode | configure () override
StatusCode | initialize () override
StatusCode | start () override
StatusCode | stop () override
StatusCode | finalize () override
StatusCode | terminate () override
Gaudi::StateMachine::State | FSMState () const override
Gaudi::StateMachine::State | targetFSMState () const override
StatusCode | reinitialize () override
StatusCode | restart () override
StatusCode | sysInitialize () override
| Initialize Service. More...
StatusCode | sysStart () override
| Initialize Service. More...
StatusCode | sysStop () override
| Initialize Service. More...
StatusCode | sysFinalize () override
| Finalize Service. More...
StatusCode | sysReinitialize () override
| Re-initialize the Service. More...
StatusCode | sysRestart () override
| Re-initialize the Service. More...
| Service (std::string name, ISvcLocator *svcloc)
| Standard Constructor. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| Retrieve pointer to service locator. More...
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job. More...
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist. More...
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<typename IFace = IService>
SmartIF< IFace > | service (const std::string &name, bool createIf=true) const
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. More...
template<class T >
StatusCode | declareTool (ToolHandle< T > &handle, std::string toolTypeAndName, bool createIf=true)
| Declare used tool. More...
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| PropertyHolder ()=default
| ~PropertyHolder () override=default
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Details::PropertyBase &prop)
| Declare a property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
| Helper to wrap a regular data member and use it as a regular property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none") const
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
| Declare a PropertyBase instance setting name and documentation. More...
Gaudi::Details::PropertyBase * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
| Declare a remote property. More...
StatusCode | setProperty (const Gaudi::Details::PropertyBase &p) override
| set the property form another property More...
StatusCode | setProperty (const std::string &s) override
| set the property from the formatted string More...
StatusCode | setProperty (const std::string &n, const std::string &v) override
| set the property from name and the value More...
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
StatusCode | getProperty (Gaudi::Details::PropertyBase *p) const override
| get the property More...
const Gaudi::Details::PropertyBase & | getProperty (const std::string &name) const override
| get the property by name More...
StatusCode | getProperty (const std::string &n, std::string &v) const override
| convert the property to the string More...
const std::vector< Gaudi::Details::PropertyBase * > & | getProperties () const override
| get all properties More...
bool | hasProperty (const std::string &name) const override
| Return true if we have a property with the given name. More...
| PropertyHolder (const PropertyHolder &)=delete
PropertyHolder & | operator= (const PropertyHolder &)=delete
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleBase &ref, const std::string &doc="none")
| Specializations for various GaudiHandles. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleArrayBase &ref, const std::string &doc="none")
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, DataObjectHandleBase &ref, const std::string &doc="none")
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
const SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the cached level (originally extracted from the embedded MsgStream) More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
Public Member Functions inherited from extend_interfaces< Interfaces... >
| ~extend_interfaces () override=default
| Virtual destructor. More...

## Private Types
typedef std::vector< AlgStateMap_t > | AlgStates_t
typedef std::map< Gaudi::StringKey, std::atomic< unsigned int > > | AlgErrorMap_t

## Private Member Functions
std::string | trans (const EventStatus::Status &sc) const
void | init ()
void | checkInit () const

## Private Attributes
AlgStates_t | m_algStates
std::vector< EventStatus::Status > | m_eventStatus
std::vector< Gaudi::StringKey > | m_preInitAlgs
AlgErrorMap_t | m_errorCount
std::once_flag | m_initFlag
bool | m_isInit
std::mutex | m_mut

## Additional Inherited Members
Protected Member Functions inherited from Service
| ~Service () override
| Standard Destructor. More...
int | outputLevel () const
| get the `Service's` output level More...
Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
Gaudi::Details::PropertyBase * | property (const std::string &name) const
Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level | setUpMessaging ()
| Set up local caches. More...
MSG::Level | resetMessaging ()
| Reinitialize internal states. More...
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...
Protected Attributes inherited from Service
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::Property< int > | m_outputLevel {this, "OutputLevel", MSG::NIL, "output level"}
Gaudi::Property< bool > | m_auditInit {this, "AuditServices", false, "[[deprecated]] unused"}
Gaudi::Property< bool > | m_auditorInitialize {this, "AuditInitialize", false, "trigger auditor on initialize()"}
Gaudi::Property< bool > | m_auditorStart {this, "AuditStart", false, "trigger auditor on start()"}
Gaudi::Property< bool > | m_auditorStop {this, "AuditStop", false, "trigger auditor on stop()"}
Gaudi::Property< bool > | m_auditorFinalize {this, "AuditFinalize", false, "trigger auditor on finalize()"}
Gaudi::Property< bool > | m_auditorReinitialize {this, "AuditReinitialize", false, "trigger auditor on reinitialize()"}
Gaudi::Property< bool > | m_auditorRestart {this, "AuditRestart", false, "trigger auditor on restart()"}
SmartIF< IAuditorSvc > | m_pAuditorSvc
| Auditor Service. More...

## Detailed Description

A service that keeps track of the execution state of Algorithm *.

Definition at line 16 of file AlgExecStateSvc.h.

## Member Typedef Documentation

typedef std::map<Gaudi::StringKey, std::atomic<unsigned int> > AlgExecStateSvc::AlgErrorMap_t
| private

Definition at line 63 of file AlgExecStateSvc.h.

typedef IAlgExecStateSvc::AlgStateMap_t AlgExecStateSvc::AlgStateMap_t

Definition at line 28 of file AlgExecStateSvc.h.

typedef std::vector<AlgStateMap_t> AlgExecStateSvc::AlgStates_t
| private

Definition at line 57 of file AlgExecStateSvc.h.

## Constructor & Destructor Documentation

AlgExecStateSvc::AlgExecStateSvc | ( | const std::string & | name,
|  | ISvcLocator * | svc
| ) |  |

Constructor.

Definition at line 14 of file AlgExecStateSvc.cpp.

15 : base_class( name, svcLoc ), m_isInit( false )
16 {
17 }
extends< Service, IAlgExecStateSvc >::base_class
extends base_class
Typedef to this class.
Definition: extends.h:15
AlgExecStateSvc::m_isInit
bool m_isInit
Definition: AlgExecStateSvc.h:69

AlgExecStateSvc::~AlgExecStateSvc | ( |  | ) |

Destructor.

Definition at line 21 of file AlgExecStateSvc.cpp.

21 {}

## Member Function Documentation

void AlgExecStateSvc::addAlg | ( | IAlgorithm * | iAlg | ) |
| override

Definition at line 135 of file AlgExecStateSvc.cpp.

135 { return addAlg( iAlg->nameKey() ); }
IAlgorithm::nameKey
virtual const Gaudi::StringKey & nameKey() const =0
StringKey rep of name.
AlgExecStateSvc::addAlg
void addAlg(IAlgorithm *iAlg) override
Definition: AlgExecStateSvc.cpp:135

void AlgExecStateSvc::addAlg | ( | const Gaudi::StringKey & | algName | ) |
| override

Definition at line 139 of file AlgExecStateSvc.cpp.

140 {
141
142 if ( !m_isInit ) {
143 if ( msgLevel( MSG::DEBUG ) ) debug() << "preInit: will add Alg " << alg.str() << " later" << endmsg;
144 m_preInitAlgs.push_back( alg );
145 return;
146 }
147
148 if ( m_algStates.size() > 0 ) {
149 if ( m_algStates.at( 0 ).find( alg ) != m_algStates.at( 0 ).end() ) {
150 // already added
151 return;
152 }
153 }
154
155 {
156 // in theory, this should only get called during initialization (serial)
157 // so shouldn't have to protect with a mutex...
158 std::lock_guard<std::mutex> lock( m_mut );
159
160 AlgExecState s;
161 for ( size_t i = 0; i < m_algStates.size(); ++i ) {
162 m_algStates.at( i )[alg] = s;
163 }
164
165 m_errorCount[alg] = 0;
166 }
167
168 if ( msgLevel( MSG::DEBUG ) )
169 debug() << "adding alg " << alg.str() << " to " << m_algStates.size() << " slots" << endmsg;
170 }
AlgExecStateSvc::m_algStates
AlgStates_t m_algStates
Definition: AlgExecStateSvc.h:58
MSG::DEBUG
Definition: IMessageSvc.h:16
std::map::end
T end(T...args)
std::vector::at
T at(T...args)
std::vector::push_back
T push_back(T...args)
AlgExecStateSvc::m_errorCount
AlgErrorMap_t m_errorCount
Definition: AlgExecStateSvc.h:64
std::lock
T lock(T...args)
AlgExecStateSvc::m_preInitAlgs
std::vector< Gaudi::StringKey > m_preInitAlgs
Definition: AlgExecStateSvc.h:61
AlgExecStateSvc::m_isInit
bool m_isInit
Definition: AlgExecStateSvc.h:69
AlgExecStateSvc::m_mut
std::mutex m_mut
Definition: AlgExecStateSvc.h:71
std::map::find
T find(T...args)
std::vector::size
T size(T...args)
std::lock_guard
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:115
gaudirun.s
string s
Definition: gaudirun.py:253
CommonMessagingBase::msgLevel
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
Definition: CommonMessaging.h:124
AlgExecState
Definition: IAlgExecStateSvc.h:27
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

unsigned int AlgExecStateSvc::algErrorCount | ( | const IAlgorithm * | iAlg | ) | const
| override

Definition at line 273 of file AlgExecStateSvc.cpp.

274 {
275 AlgErrorMap_t::const_iterator itr = m_errorCount.find( iAlg->nameKey() );
276
277 if ( itr != m_errorCount.end() ) {
278 return itr->second;
279 } else {
280 error() << "Unable to find Algorithm \"" << iAlg->name() << "\" in map"
281 << " of ErrorCounts" << endmsg;
282 return 0;
283 }
284 }
std::map::end
T end(T...args)
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:106
AlgExecStateSvc::m_errorCount
AlgErrorMap_t m_errorCount
Definition: AlgExecStateSvc.h:64
IAlgorithm::nameKey
virtual const Gaudi::StringKey & nameKey() const =0
StringKey rep of name.
std::map::find
T find(T...args)
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

const AlgExecState & AlgExecStateSvc::algExecState | ( | const Gaudi::StringKey & | algName,
|  | const EventContext & | ctx
| ) |  | const
| override

Definition at line 174 of file AlgExecStateSvc.cpp.

175 {
176
177 checkInit();
178
179 AlgStateMap_t::const_iterator itr = m_algStates.at( ctx.slot() ).find( algName );
180
181 if ( UNLIKELY( itr == m_algStates.at( ctx.slot() ).end() ) ) {
182 throw GaudiException{std::string{"cannot find Alg "} + algName.str() + " in AlgStateMap", name(),
183 StatusCode::FAILURE};
184 }
185
186 return itr->second;
187 }
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:128
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:22
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:40
AlgExecStateSvc::m_algStates
AlgStates_t m_algStates
Definition: AlgExecStateSvc.h:58
std::string
STL class.
AlgExecStateSvc::checkInit
void checkInit() const
Definition: AlgExecStateSvc.cpp:80
std::vector::at
T at(T...args)
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:64
std::find
T find(T...args)
StatusCode::FAILURE
Definition: StatusCode.h:29
Gaudi::StringKey::str
const std::string & str() const
the actual string
Definition: StringKey.h:47

const AlgExecState & AlgExecStateSvc::algExecState | ( | IAlgorithm * | iAlg,
|  | const EventContext & | ctx
| ) |  | const
| override

Definition at line 191 of file AlgExecStateSvc.cpp.

192 {
193
194 return algExecState( iAlg->nameKey(), ctx );
195 }
AlgExecStateSvc::algExecState
const AlgExecState & algExecState(const Gaudi::StringKey &algName, const EventContext &ctx) const override
Definition: AlgExecStateSvc.cpp:174
IAlgorithm::nameKey
virtual const Gaudi::StringKey & nameKey() const =0
StringKey rep of name.

AlgExecState & AlgExecStateSvc::algExecState | ( | IAlgorithm * | iAlg,
|  | const EventContext & | ctx
| ) |  |
| override

Definition at line 199 of file AlgExecStateSvc.cpp.

200 {
201
202 std::call_once( m_initFlag, &AlgExecStateSvc::init, this );
203
204 AlgStateMap_t::iterator itr = m_algStates.at( ctx.slot() ).find( iAlg->nameKey() );
205
206 if ( UNLIKELY( itr == m_algStates.at( ctx.slot() ).end() ) ) {
207 throw GaudiException{std::string{"cannot find Alg "} + iAlg->name() + " in AlgStateMap", name(),
208 StatusCode::FAILURE};
209 }
210
211 return itr->second;
212 }
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:128
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:22
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:40
AlgExecStateSvc::m_algStates
AlgStates_t m_algStates
Definition: AlgExecStateSvc.h:58
AlgExecStateSvc::init
void init()
Definition: AlgExecStateSvc.cpp:25
AlgExecStateSvc::m_initFlag
std::once_flag m_initFlag
Definition: AlgExecStateSvc.h:68
std::call_once
T call_once(T...args)
std::string
STL class.
std::vector::at
T at(T...args)
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:64
IAlgorithm::nameKey
virtual const Gaudi::StringKey & nameKey() const =0
StringKey rep of name.
std::find
T find(T...args)
StatusCode::FAILURE
Definition: StatusCode.h:29

const IAlgExecStateSvc::AlgStateMap_t & AlgExecStateSvc::algExecStates | ( | const EventContext & | ctx | ) | const
| override

Definition at line 216 of file AlgExecStateSvc.cpp.

217 {
218
219 checkInit();
220
221 return m_algStates.at( ctx.slot() );
222 }
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:40
AlgExecStateSvc::m_algStates
AlgStates_t m_algStates
Definition: AlgExecStateSvc.h:58
AlgExecStateSvc::checkInit
void checkInit() const
Definition: AlgExecStateSvc.cpp:80
std::vector::at
T at(T...args)

void AlgExecStateSvc::checkInit | ( |  | ) | const
| private

Definition at line 80 of file AlgExecStateSvc.cpp.

81 {
82
83 if ( !m_isInit ) {
84 fatal() << "AlgExecStateSvc not initialized before first use" << endmsg;
85 throw GaudiException( "AlgExecStateSvc not initialized before first use!", "AlgExecStateSvc", StatusCode::FAILURE );
86 }
87 }
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:22
AlgExecStateSvc::m_isInit
bool m_isInit
Definition: AlgExecStateSvc.h:69
StatusCode::FAILURE
Definition: StatusCode.h:29
CommonMessagingBase::fatal
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
Definition: CommonMessaging.h:100
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

void AlgExecStateSvc::dump | ( | std::ostringstream & | ost,
|  | const EventContext & | ctx
| ) |  | const
| override

Definition at line 112 of file AlgExecStateSvc.cpp.

113 {
114 size_t slotID = ctx.valid() ? ctx.slot() : 0;
115
116 ost << "Event: " << trans( m_eventStatus.at( slotID ) ) << std::endl;
117 ost << "Algs: " << m_algStates.at( slotID ).size() << std::endl;
118
119 size_t ml( 0 );
120 for ( auto& e : m_algStates.at( slotID ) ) {
121 if ( e.first.str().length() > ml ) {
122 ml = e.first.str().length();
123 }
124 }
125
126 ost << " - Slot " << slotID << std::endl;
127 const AlgStateMap_t& m = m_algStates.at( slotID );
128 for ( auto& e : m ) {
129 ost << " + " << std::setw( ml ) << e.first.str() << " " << e.second << std::endl;
130 }
131 }
AlgExecStateSvc::AlgStateMap_t
IAlgExecStateSvc::AlgStateMap_t AlgStateMap_t
Definition: AlgExecStateSvc.h:28
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:40
AlgExecStateSvc::m_algStates
AlgStates_t m_algStates
Definition: AlgExecStateSvc.h:58
std::endl
T endl(T...args)
std::setw
T setw(T...args)
std::vector::at
T at(T...args)
Gaudi::Units::m
constexpr double m
Definition: SystemOfUnits.h:94
AlgExecStateSvc::trans
std::string trans(const EventStatus::Status &sc) const
Definition: AlgExecStateSvc.cpp:315
std::map::size
T size(T...args)
AlgExecStateSvc::m_eventStatus
std::vector< EventStatus::Status > m_eventStatus
Definition: AlgExecStateSvc.h:60
EventContext::valid
bool valid() const
Definition: EventContext.h:41

const EventStatus::Status & AlgExecStateSvc::eventStatus | ( | const EventContext & | ctx | ) | const
| override

Definition at line 226 of file AlgExecStateSvc.cpp.

227 {
228 checkInit();
229 return m_eventStatus.at( ctx.slot() );
230 }
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:40
AlgExecStateSvc::checkInit
void checkInit() const
Definition: AlgExecStateSvc.cpp:80
std::vector::at
T at(T...args)
AlgExecStateSvc::m_eventStatus
std::vector< EventStatus::Status > m_eventStatus
Definition: AlgExecStateSvc.h:60

StatusCode AlgExecStateSvc::finalize | ( |  | ) |
| final override virtual

Definition at line 108 of file AlgExecStateSvc.cpp.

108 { return StatusCode::SUCCESS; }
StatusCode::SUCCESS
Definition: StatusCode.h:29

unsigned int AlgExecStateSvc::incrementErrorCount | ( | const IAlgorithm * | iAlg | ) |
| override

Definition at line 301 of file AlgExecStateSvc.cpp.

302 {
303 AlgErrorMap_t::iterator itr = m_errorCount.find( iAlg->nameKey() );
304 if ( itr != m_errorCount.end() ) {
305 return ( ++( itr->second ) );
306 } else {
307 error() << "Unable to find Algorithm \"" << iAlg->name() << "\" in map"
308 << " of ErrorCounts" << endmsg;
309 return 0;
310 }
311 }
std::map::end
T end(T...args)
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:106
AlgExecStateSvc::m_errorCount
AlgErrorMap_t m_errorCount
Definition: AlgExecStateSvc.h:64
IAlgorithm::nameKey
virtual const Gaudi::StringKey & nameKey() const =0
StringKey rep of name.
std::map::find
T find(T...args)
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

void AlgExecStateSvc::init | ( |  | ) |
| private

Definition at line 25 of file AlgExecStateSvc.cpp.

26 {
27
28 std::string wbn;
29
30 // seriously? do we have no way of getting a Service by type???
31 std::list<IService*> lst = serviceLocator()->getServices();
32 for ( auto& is : lst ) {
33 IHiveWhiteBoard* iwb = dynamic_cast<IHiveWhiteBoard*>( is );
34 if ( iwb != 0 ) {
35 wbn = is->name();
36 if ( msgLevel( MSG::VERBOSE ) ) verbose() << "HiveWhiteBoard service name is " << wbn << endmsg;
37 break;
38 }
39 }
40
41 SmartIF<IHiveWhiteBoard> wbs;
42 wbs = serviceLocator()->service( wbn, false );
43
44 if ( wbs.isValid() ) {
45 m_algStates.resize( wbs->getNumberOfStores() );
46 m_eventStatus.resize( wbs->getNumberOfStores() );
47 } else {
48 m_algStates.resize( 1 );
49 m_eventStatus.resize( 1 );
50 }
51
52 if ( msgLevel( MSG::DEBUG ) ) debug() << "resizing state containers to : " << m_algStates.size() << endmsg;
53
54 SmartIF<IAlgManager> algMan( serviceLocator() );
55 if ( !algMan.isValid() ) {
56 fatal() << "could not get the AlgManager" << endmsg;
57 throw GaudiException( "In AlgExecStateSvc, unable to get the AlgManager!", "AlgExecStateSvc", StatusCode::FAILURE );
58 }
59
60 m_isInit = true;
61
62 auto algos = algMan->getAlgorithms();
63 for ( auto& alg : algos ) {
64 addAlg( alg );
65 }
66
67 for ( auto& alg : m_preInitAlgs ) {
68 addAlg( alg );
69 }
70
71 if ( msgLevel( MSG::VERBOSE ) ) {
72 std::ostringstream ost;
73 dump( ost, Gaudi::Hive::currentContext() );
74 verbose() << "dumping state:\n" << ost.str() << endmsg;
75 }
76 }
SmartIF< IHiveWhiteBoard >
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:22
AlgExecStateSvc::m_algStates
AlgStates_t m_algStates
Definition: AlgExecStateSvc.h:58
CommonMessagingBase::verbose
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
Definition: CommonMessaging.h:118
MSG::DEBUG
Definition: IMessageSvc.h:16
AlgExecStateSvc::dump
void dump(std::ostringstream &ost, const EventContext &ctx) const override
Definition: AlgExecStateSvc.cpp:112
MSG::VERBOSE
Definition: IMessageSvc.h:16
std::vector::resize
T resize(T...args)
std::string
STL class.
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79
std::ostringstream
STL class.
Gaudi::Hive::currentContext
GAUDI_API const EventContext & currentContext()
Definition: ThreadLocalContext.cpp:24
std::ostringstream::str
T str(T...args)
AlgExecStateSvc::m_preInitAlgs
std::vector< Gaudi::StringKey > m_preInitAlgs
Definition: AlgExecStateSvc.h:61
std::list< IService * >
IHiveWhiteBoard
Definition: IHiveWhiteBoard.h:17
AlgExecStateSvc::m_isInit
bool m_isInit
Definition: AlgExecStateSvc.h:69
std::vector::size
T size(T...args)
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:115
SmartIF::isValid
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:68
ISvcLocator::getServices
virtual const std::list< IService * > & getServices() const =0
Get a reference to a service and create it if it does not exists.
AlgExecStateSvc::m_eventStatus
std::vector< EventStatus::Status > m_eventStatus
Definition: AlgExecStateSvc.h:60
StatusCode::FAILURE
Definition: StatusCode.h:29
CommonMessagingBase::fatal
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
Definition: CommonMessaging.h:100
IHiveWhiteBoard::getNumberOfStores
virtual size_t getNumberOfStores() const =0
Get the number of &#39;slots&#39;.
CommonMessagingBase::msgLevel
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
Definition: CommonMessaging.h:124
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:292
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
AlgExecStateSvc::addAlg
void addAlg(IAlgorithm *iAlg) override
Definition: AlgExecStateSvc.cpp:135

StatusCode AlgExecStateSvc::initialize | ( |  | ) |
| final override virtual

Definition at line 91 of file AlgExecStateSvc.cpp.

92 {
93
94 // Initialise mother class (read properties, ...)
95 StatusCode sc( Service::initialize() );
96 if ( !sc.isSuccess() ) {
97 warning() << "Base class could not be initialized" << endmsg;
98 return StatusCode::FAILURE;
99 }
100
101 // moved all initialization to init(). hopefully it will get called in time....
102
103 return StatusCode::SUCCESS;
104 }
StatusCode::SUCCESS
Definition: StatusCode.h:29
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:64
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:109
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode::FAILURE
Definition: StatusCode.h:29
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

void AlgExecStateSvc::reset | ( | const EventContext & | ctx | ) |
| override

Definition at line 258 of file AlgExecStateSvc.cpp.

259 {
260
261 if ( msgLevel( MSG::DEBUG ) ) verbose() << "reset(" << ctx.slot() << ")" << endmsg;
262
263 std::call_once( m_initFlag, &AlgExecStateSvc::init, this );
264 for ( auto& e : m_algStates.at( ctx.slot() ) ) {
265 e.second.reset();
266 }
267
268 m_eventStatus.at( ctx.slot() ) = EventStatus::Invalid;
269 }
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:40
AlgExecStateSvc::m_algStates
AlgStates_t m_algStates
Definition: AlgExecStateSvc.h:58
AlgExecStateSvc::init
void init()
Definition: AlgExecStateSvc.cpp:25
CommonMessagingBase::verbose
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
Definition: CommonMessaging.h:118
MSG::DEBUG
Definition: IMessageSvc.h:16
AlgExecStateSvc::m_initFlag
std::once_flag m_initFlag
Definition: AlgExecStateSvc.h:68
std::call_once
T call_once(T...args)
std::vector::at
T at(T...args)
EventStatus::Invalid
Definition: IAlgExecStateSvc.h:67
AlgExecStateSvc::m_eventStatus
std::vector< EventStatus::Status > m_eventStatus
Definition: AlgExecStateSvc.h:60
CommonMessagingBase::msgLevel
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
Definition: CommonMessaging.h:124
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

void AlgExecStateSvc::resetErrorCount | ( | const IAlgorithm * | iAlg | ) |
| override

Definition at line 288 of file AlgExecStateSvc.cpp.

289 {
290 AlgErrorMap_t::iterator itr = m_errorCount.find( iAlg->nameKey() );
291 if ( itr != m_errorCount.end() ) {
292 itr->second = 0;
293 } else {
294 error() << "Unable to find Algorithm \"" << iAlg->name() << "\" in map"
295 << " of ErrorCounts" << endmsg;
296 }
297 }
std::map::end
T end(T...args)
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:106
AlgExecStateSvc::m_errorCount
AlgErrorMap_t m_errorCount
Definition: AlgExecStateSvc.h:64
IAlgorithm::nameKey
virtual const Gaudi::StringKey & nameKey() const =0
StringKey rep of name.
std::map::find
T find(T...args)
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

void AlgExecStateSvc::setEventStatus | ( | const EventStatus::Status & | sc,
|  | const EventContext & | ctx
| ) |  |
| override

Definition at line 234 of file AlgExecStateSvc.cpp.

235 {
236 std::call_once( m_initFlag, &AlgExecStateSvc::init, this );
237 m_eventStatus.at( ctx.slot() ) = sc;
238 }
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:40
AlgExecStateSvc::init
void init()
Definition: AlgExecStateSvc.cpp:25
AlgExecStateSvc::m_initFlag
std::once_flag m_initFlag
Definition: AlgExecStateSvc.h:68
std::call_once
T call_once(T...args)
std::vector::at
T at(T...args)
AlgExecStateSvc::m_eventStatus
std::vector< EventStatus::Status > m_eventStatus
Definition: AlgExecStateSvc.h:60

std::string AlgExecStateSvc::trans | ( | const EventStatus::Status & | sc | ) | const
| private

Definition at line 315 of file AlgExecStateSvc.cpp.

316 {
317 switch ( s ) {
318 case EventStatus::Invalid:
319 return "Invalid";
320 case EventStatus::Success:
321 return "Success";
322 case EventStatus::AlgFail:
323 return "AlgFail";
324 case EventStatus::AlgStall:
325 return "AlgStall";
326 case EventStatus::Other:
327 return "Other";
328 default:
329 return "Should not happen";
330 }
331 }
EventStatus::Other
Definition: IAlgExecStateSvc.h:67
EventStatus::AlgStall
Definition: IAlgExecStateSvc.h:67
EventStatus::Invalid
Definition: IAlgExecStateSvc.h:67
EventStatus::Success
Definition: IAlgExecStateSvc.h:67
EventStatus::AlgFail
Definition: IAlgExecStateSvc.h:67
gaudirun.s
string s
Definition: gaudirun.py:253

void AlgExecStateSvc::updateEventStatus | ( | const bool & | b,
|  | const EventContext & | ctx
| ) |  |
| override

Definition at line 242 of file AlgExecStateSvc.cpp.

243 {
244 std::call_once( m_initFlag, &AlgExecStateSvc::init, this );
245 if ( m_eventStatus.at( ctx.slot() ) == EventStatus::Success ) {
246 if ( fail ) m_eventStatus.at( ctx.slot() ) = EventStatus::AlgFail;
247 } else if ( m_eventStatus.at( ctx.slot() ) == EventStatus::Invalid ) {
248 if ( !fail ) {
249 m_eventStatus.at( ctx.slot() ) = EventStatus::Success;
250 } else {
251 m_eventStatus.at( ctx.slot() ) = EventStatus::AlgFail;
252 }
253 }
254 }
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:40
AlgExecStateSvc::init
void init()
Definition: AlgExecStateSvc.cpp:25
AlgExecStateSvc::m_initFlag
std::once_flag m_initFlag
Definition: AlgExecStateSvc.h:68
std::call_once
T call_once(T...args)
std::vector::at
T at(T...args)
EventStatus::Invalid
Definition: IAlgExecStateSvc.h:67
EventStatus::Success
Definition: IAlgExecStateSvc.h:67
EventStatus::AlgFail
Definition: IAlgExecStateSvc.h:67
AlgExecStateSvc::m_eventStatus
std::vector< EventStatus::Status > m_eventStatus
Definition: AlgExecStateSvc.h:60

## Member Data Documentation

AlgStates_t AlgExecStateSvc::m_algStates
| private

Definition at line 58 of file AlgExecStateSvc.h.

AlgErrorMap_t AlgExecStateSvc::m_errorCount
| private

Definition at line 64 of file AlgExecStateSvc.h.

std::vector<EventStatus::Status> AlgExecStateSvc::m_eventStatus
| private

Definition at line 60 of file AlgExecStateSvc.h.

std::once_flag AlgExecStateSvc::m_initFlag
| private

Definition at line 68 of file AlgExecStateSvc.h.

bool AlgExecStateSvc::m_isInit
| private

Definition at line 69 of file AlgExecStateSvc.h.

std::mutex AlgExecStateSvc::m_mut
| private

Definition at line 71 of file AlgExecStateSvc.h.

std::vector<Gaudi::StringKey> AlgExecStateSvc::m_preInitAlgs
| private

Definition at line 61 of file AlgExecStateSvc.h.

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

- GaudiCoreSvc/src/AlgExecStateSvc/AlgExecStateSvc.h
- GaudiCoreSvc/src/AlgExecStateSvc/AlgExecStateSvc.cpp