AlgExecStateSvc Class Reference

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

#include <src/AlgExecStateSvc/AlgExecStateSvc.h>

Inheritance diagram for AlgExecStateSvc:
Collaboration diagram for AlgExecStateSvc:

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 AlgExecStatealgExecState (const Gaudi::StringKey &algName, const EventContext &ctx) const override
 
const AlgExecStatealgExecState (IAlgorithm *iAlg, const EventContext &ctx) const override
 
AlgExecStatealgExecState (IAlgorithm *iAlg, const EventContext &ctx) override
 
const AlgStateMap_talgExecStates (const EventContext &ctx) const override
 
const AlgExecStatealgExecState (const Gaudi::StringKey &algName) const override
 
const AlgExecStatealgExecState (IAlgorithm *iAlg) const override
 
AlgExecStatealgExecState (IAlgorithm *iAlg) override
 
const AlgStateMap_talgExecStates () const override
 
void reset (const EventContext &ctx) override
 
void reset () override
 
void addAlg (IAlgorithm *iAlg) override
 
void addAlg (const Gaudi::StringKey &algName) override
 
const EventStatus::StatuseventStatus () const override
 
const EventStatus::StatuseventStatus (const EventContext &ctx) const override
 
void setEventStatus (const EventStatus::Status &sc) override
 
void setEventStatus (const EventStatus::Status &sc, const EventContext &ctx) override
 
void updateEventStatus (const bool &b) override
 
void updateEventStatus (const bool &b, const EventContext &ctx) override
 
void dump (std::ostringstream &ost) const 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::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 ~extends () override=default
 Virtual destructor. More...
 
- Public Member Functions inherited from Service
const std::stringname () 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 declarePrivateTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
 Declare used Private tool. More...
 
template<class T >
StatusCode declarePublicTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
 Declare used Public 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::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (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::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none") const
 
Gaudi::Details::PropertyBasedeclareProperty (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::PropertyBasedeclareRemoteProperty (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::PropertyBasegetProperty (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
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandle< TYPE > &ref, const std::string &doc="none")
 Specializations for various GaudiHandles. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ServiceHandle< TYPE > &ref, const std::string &doc="none")
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< TYPE > &ref, const std::string &doc="none")
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ServiceHandleArray< TYPE > &ref, const std::string &doc="none")
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, DataObjectHandle< TYPE > &ref, const std::string &doc="none")
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level 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_tAlgStates_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::Statusm_eventStatus
 
std::vector< Gaudi::StringKeym_preInitAlgs
 
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::PropertyBaseproperty (const std::string &name) const
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
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< IAuditorSvcm_pAuditorSvc
 Auditor Service. More...
 

Detailed Description

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

Definition at line 18 of file AlgExecStateSvc.h.

Member Typedef Documentation

Definition at line 71 of file AlgExecStateSvc.h.

Constructor & Destructor Documentation

AlgExecStateSvc::AlgExecStateSvc ( const std::string name,
ISvcLocator svc 
)

Constructor.

Definition at line 14 of file AlgExecStateSvc.cpp.

14  :
15 base_class(name,svcLoc), m_isInit(false)
16 {
17 
18 }
extends base_class
Typedef to this class.
Definition: extends.h:14
AlgExecStateSvc::~AlgExecStateSvc ( )

Destructor.

Definition at line 22 of file AlgExecStateSvc.cpp.

22  {
23 
24 }

Member Function Documentation

void AlgExecStateSvc::addAlg ( IAlgorithm iAlg)
override

Definition at line 181 of file AlgExecStateSvc.cpp.

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

Definition at line 188 of file AlgExecStateSvc.cpp.

188  {
189 
190 
191  if (!m_isInit) {
192  if (msgLevel(MSG::DEBUG))
193  debug() << "preInit: will add Alg " << alg.str() << " later" << endmsg;
194  m_preInitAlgs.push_back( alg );
195  return;
196  }
197 
198  if (m_algStates.size() > 0) {
199  if (m_algStates.at(0).find(alg) != m_algStates.at(0).end()) {
200  // already added
201  return;
202  }
203  }
204 
205  {
206  // in theory, this should only get called during initialization (serial)
207  // so shouldn't have to protect with a mutex...
209 
210  AlgExecState s;
211  for (size_t i = 0; i<m_algStates.size(); ++i) {
212  m_algStates.at(i)[alg] = s;
213  }
214  }
215 
216  if (msgLevel(MSG::DEBUG))
217  debug() << "adding alg " << alg.str() << " to "
218  << m_algStates.size() << " slots" << endmsg;
219 
220 }
AlgStates_t m_algStates
T end(T...args)
T at(T...args)
T push_back(T...args)
T lock(T...args)
std::mutex m_mut
T find(T...args)
T size(T...args)
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
string s
Definition: gaudirun.py:245
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
std::vector< Gaudi::StringKey > m_preInitAlgs
const AlgExecState & AlgExecStateSvc::algExecState ( const Gaudi::StringKey algName,
const EventContext ctx 
) const
override

Definition at line 225 of file AlgExecStateSvc.cpp.

226  {
227 
228  checkInit();
229 
230  AlgStateMap_t::const_iterator itr = m_algStates.at(ctx.slot()).find( algName );
231 
232  if (UNLIKELY( itr == m_algStates.at(ctx.slot()).end() ) ) {
233  throw GaudiException{std::string{"cannot find Alg "}
234  + algName.str() + " in AlgStateMap", name(), StatusCode::FAILURE};
235  }
236 
237  return itr->second;
238 
239 }
Define general base for Gaudi exception.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
ContextID_t slot() const
Definition: EventContext.h:41
AlgStates_t m_algStates
#define UNLIKELY(x)
Definition: Kernel.h:126
STL class.
void checkInit() const
T at(T...args)
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:49
T find(T...args)
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 244 of file AlgExecStateSvc.cpp.

245  {
246 
247  return algExecState(iAlg->nameKey(), ctx);
248 
249 }
const AlgExecState & algExecState(const Gaudi::StringKey &algName, const EventContext &ctx) const override
virtual const Gaudi::StringKey & nameKey() const =0
StringKey rep of name.
AlgExecState & AlgExecStateSvc::algExecState ( IAlgorithm iAlg,
const EventContext ctx 
)
override

Definition at line 254 of file AlgExecStateSvc.cpp.

255  {
256 
258 
259  AlgStateMap_t::iterator itr = m_algStates.at(ctx.slot()).find( iAlg->nameKey() );
260 
261  if (UNLIKELY( itr == m_algStates.at(ctx.slot()).end() ) ) {
262  throw GaudiException{std::string{"cannot find Alg "}
263  + iAlg->name() + " in AlgStateMap", name(), StatusCode::FAILURE};
264  }
265 
266  return itr->second;
267 
268 }
Define general base for Gaudi exception.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
ContextID_t slot() const
Definition: EventContext.h:41
AlgStates_t m_algStates
#define UNLIKELY(x)
Definition: Kernel.h:126
std::once_flag m_initFlag
T call_once(T...args)
STL class.
T at(T...args)
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:49
virtual const Gaudi::StringKey & nameKey() const =0
StringKey rep of name.
T find(T...args)
const AlgExecState & AlgExecStateSvc::algExecState ( const Gaudi::StringKey algName) const
override

Definition at line 283 of file AlgExecStateSvc.cpp.

283  {
284 
285  checkInit();
286 
287  AlgStateMap_t::const_iterator itr = m_algStates.at(0).find( algName );
288 
289  if (UNLIKELY( itr == m_algStates.at(0).end() ) ) {
290  throw GaudiException{std::string{"cannot find Alg "}
291  + algName.str() + " in AlgStateMap", name(), StatusCode::FAILURE};
292  }
293 
294  return itr->second;
295 
296 }
Define general base for Gaudi exception.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
AlgStates_t m_algStates
#define UNLIKELY(x)
Definition: Kernel.h:126
T end(T...args)
STL class.
void checkInit() const
T at(T...args)
T find(T...args)
const std::string & str() const
the actual string
Definition: StringKey.h:47
const AlgExecState & AlgExecStateSvc::algExecState ( IAlgorithm iAlg) const
override

Definition at line 319 of file AlgExecStateSvc.cpp.

319  {
320  checkInit();
321  return algExecState(iAlg->nameKey());
322 }
const AlgExecState & algExecState(const Gaudi::StringKey &algName, const EventContext &ctx) const override
void checkInit() const
virtual const Gaudi::StringKey & nameKey() const =0
StringKey rep of name.
AlgExecState & AlgExecStateSvc::algExecState ( IAlgorithm iAlg)
override

Definition at line 301 of file AlgExecStateSvc.cpp.

301  {
302 
304 
305  AlgStateMap_t::iterator itr = m_algStates.at(0).find( iAlg->nameKey() );
306 
307  if (UNLIKELY( itr == m_algStates.at(0).end() ) ) {
308  throw GaudiException{std::string{"cannot find Alg "}
309  + iAlg->name() + " in AlgStateMap", name(), StatusCode::FAILURE};
310  }
311 
312  return itr->second;
313 
314 }
Define general base for Gaudi exception.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
AlgStates_t m_algStates
#define UNLIKELY(x)
Definition: Kernel.h:126
T end(T...args)
std::once_flag m_initFlag
T call_once(T...args)
STL class.
T at(T...args)
virtual const Gaudi::StringKey & nameKey() const =0
StringKey rep of name.
T find(T...args)
const IAlgExecStateSvc::AlgStateMap_t & AlgExecStateSvc::algExecStates ( const EventContext ctx) const
override

Definition at line 273 of file AlgExecStateSvc.cpp.

273  {
274 
275  checkInit();
276 
277  return m_algStates.at(ctx.slot());
278 }
ContextID_t slot() const
Definition: EventContext.h:41
AlgStates_t m_algStates
void checkInit() const
T at(T...args)
const IAlgExecStateSvc::AlgStateMap_t & AlgExecStateSvc::algExecStates ( ) const
override

Definition at line 327 of file AlgExecStateSvc.cpp.

327  {
328 
329  checkInit();
330 
331  return m_algStates.at(0);
332 }
AlgStates_t m_algStates
void checkInit() const
T at(T...args)
void AlgExecStateSvc::checkInit ( ) const
private

Definition at line 90 of file AlgExecStateSvc.cpp.

90  {
91 
92  if (!m_isInit) {
93  fatal() << "AlgExecStateSvc not initialized before first use" << endmsg;
94  throw GaudiException("AlgExecStateSvc not initialized before first use!",
95  "AlgExecStateSvc",StatusCode::FAILURE);
96  }
97 }
Define general base for Gaudi exception.
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
void AlgExecStateSvc::dump ( std::ostringstream ost) const
override

Definition at line 129 of file AlgExecStateSvc.cpp.

129  {
130 
131  checkInit();
132 
133  ost << "Event: " << trans(m_eventStatus.at(0)) << std::endl;
134  ost << "Algs: " << m_algStates.at(0).size() << std::endl;
135 
136  size_t ml(0);
137  for (auto &e : m_algStates.at(0)) {
138  if ( e.first.str().length() > ml ) {
139  ml = e.first.str().length();
140  }
141  }
142 
143  for (size_t is =0; is < m_algStates.size(); ++is) {
144  ost << " - Slot " << is << std::endl;
145  const AlgStateMap_t& m = m_algStates.at(is);
146  for (auto &e : m) {
147  ost << " + " << std::setw(ml) << e.first.str() << " " << e.second
148  << std::endl;
149  }
150  }
151 
152 }
IAlgExecStateSvc::AlgStateMap_t AlgStateMap_t
AlgStates_t m_algStates
T endl(T...args)
std::vector< EventStatus::Status > m_eventStatus
T setw(T...args)
void checkInit() const
T at(T...args)
constexpr double m
Definition: SystemOfUnits.h:93
std::string trans(const EventStatus::Status &sc) const
T size(T...args)
void AlgExecStateSvc::dump ( std::ostringstream ost,
const EventContext ctx 
) const
override

Definition at line 157 of file AlgExecStateSvc.cpp.

157  {
158 
159  ost << "Event: " << trans(m_eventStatus.at(ctx.slot())) << std::endl;
160  ost << "Algs: " << m_algStates.at(ctx.slot()).size() << std::endl;
161 
162  size_t ml(0);
163  for (auto &e : m_algStates.at(ctx.slot())) {
164  if ( e.first.str().length() > ml ) {
165  ml = e.first.str().length();
166  }
167  }
168 
169  ost << " - Slot " << ctx.slot() << std::endl;
170  const AlgStateMap_t& m = m_algStates.at(ctx.slot());
171  for (auto &e : m) {
172  ost << " + " << std::setw(ml) << e.first.str() << " " << e.second
173  << std::endl;
174  }
175 
176 }
IAlgExecStateSvc::AlgStateMap_t AlgStateMap_t
ContextID_t slot() const
Definition: EventContext.h:41
AlgStates_t m_algStates
T endl(T...args)
std::vector< EventStatus::Status > m_eventStatus
T setw(T...args)
T at(T...args)
constexpr double m
Definition: SystemOfUnits.h:93
std::string trans(const EventStatus::Status &sc) const
const EventStatus::Status & AlgExecStateSvc::eventStatus ( ) const
override

Definition at line 345 of file AlgExecStateSvc.cpp.

345  {
346  checkInit();
347  return m_eventStatus.at(0);
348 }
std::vector< EventStatus::Status > m_eventStatus
void checkInit() const
T at(T...args)
const EventStatus::Status & AlgExecStateSvc::eventStatus ( const EventContext ctx) const
override

Definition at line 337 of file AlgExecStateSvc.cpp.

337  {
338  checkInit();
339  return m_eventStatus.at(ctx.slot());
340 }
ContextID_t slot() const
Definition: EventContext.h:41
std::vector< EventStatus::Status > m_eventStatus
void checkInit() const
T at(T...args)
StatusCode AlgExecStateSvc::finalize ( )
finaloverridevirtual

Definition at line 120 of file AlgExecStateSvc.cpp.

120  {
121 
122  return StatusCode::SUCCESS;
123 
124 }
void AlgExecStateSvc::init ( )
private

Definition at line 29 of file AlgExecStateSvc.cpp.

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

Definition at line 102 of file AlgExecStateSvc.cpp.

102  {
103 
104  // Initialise mother class (read properties, ...)
106  if (!sc.isSuccess()) {
107  warning () << "Base class could not be initialized" << endmsg;
108  return StatusCode::FAILURE;
109  }
110 
111  // moved all initialization to init(). hopefully it will get called in time....
112 
113  return StatusCode::SUCCESS;
114 
115 }
StatusCode initialize() override
Definition: Service.cpp:64
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
void AlgExecStateSvc::reset ( const EventContext ctx)
override

Definition at line 404 of file AlgExecStateSvc.cpp.

404  {
405 
406  if (msgLevel(MSG::DEBUG))
407  verbose() << "reset(" << ctx.slot() << ")" << endmsg;
408 
410  for (auto &e : m_algStates.at(ctx.slot())) {
411  e.second.reset();
412  }
413 
415 
416 }
ContextID_t slot() const
Definition: EventContext.h:41
AlgStates_t m_algStates
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
std::vector< EventStatus::Status > m_eventStatus
std::once_flag m_initFlag
T call_once(T...args)
T at(T...args)
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
void AlgExecStateSvc::reset ( )
override

Definition at line 421 of file AlgExecStateSvc.cpp.

421  {
422 
423  if (msgLevel(MSG::DEBUG))
424  verbose() << "reset()" << endmsg;
425 
427  for (auto &e : m_algStates.at(0)) {
428  e.second.reset();
429  }
430 
432 
433 }
AlgStates_t m_algStates
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
std::vector< EventStatus::Status > m_eventStatus
std::once_flag m_initFlag
T call_once(T...args)
T at(T...args)
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
void AlgExecStateSvc::setEventStatus ( const EventStatus::Status sc)
override

Definition at line 361 of file AlgExecStateSvc.cpp.

361  {
363  m_eventStatus.at(0) = sc;
364 }
std::vector< EventStatus::Status > m_eventStatus
std::once_flag m_initFlag
T call_once(T...args)
T at(T...args)
void AlgExecStateSvc::setEventStatus ( const EventStatus::Status sc,
const EventContext ctx 
)
override

Definition at line 353 of file AlgExecStateSvc.cpp.

353  {
355  m_eventStatus.at(ctx.slot()) = sc;
356 }
ContextID_t slot() const
Definition: EventContext.h:41
std::vector< EventStatus::Status > m_eventStatus
std::once_flag m_initFlag
T call_once(T...args)
T at(T...args)
std::string AlgExecStateSvc::trans ( const EventStatus::Status sc) const
private

Definition at line 438 of file AlgExecStateSvc.cpp.

438  {
439  switch (s) {
440  case EventStatus::Invalid :
441  return "Invalid";
442  case EventStatus::Success :
443  return "Success";
444  case EventStatus::AlgFail :
445  return "AlgFail";
446  case EventStatus::AlgStall :
447  return "AlgStall";
448  case EventStatus::Other :
449  return "Other";
450  default :
451  return "Should not happen";
452  }
453 
454 }
string s
Definition: gaudirun.py:245
void AlgExecStateSvc::updateEventStatus ( const bool &  b)
override

Definition at line 369 of file AlgExecStateSvc.cpp.

369  {
372  if (fail)
374  } else if (m_eventStatus.at(0) == EventStatus::Invalid) {
375  if (! fail) {
377  } else {
379  }
380  }
381 }
std::vector< EventStatus::Status > m_eventStatus
std::once_flag m_initFlag
T call_once(T...args)
T at(T...args)
void AlgExecStateSvc::updateEventStatus ( const bool &  b,
const EventContext ctx 
)
override

Definition at line 386 of file AlgExecStateSvc.cpp.

386  {
388  if (m_eventStatus.at(ctx.slot()) == EventStatus::Success) {
389  if (fail)
391  } else if (m_eventStatus.at(ctx.slot()) == EventStatus::Invalid) {
392  if (! fail) {
394  } else {
396  }
397  }
398 }
ContextID_t slot() const
Definition: EventContext.h:41
std::vector< EventStatus::Status > m_eventStatus
std::once_flag m_initFlag
T call_once(T...args)
T at(T...args)

Member Data Documentation

AlgStates_t AlgExecStateSvc::m_algStates
private

Definition at line 72 of file AlgExecStateSvc.h.

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

Definition at line 74 of file AlgExecStateSvc.h.

std::once_flag AlgExecStateSvc::m_initFlag
private

Definition at line 79 of file AlgExecStateSvc.h.

bool AlgExecStateSvc::m_isInit
private

Definition at line 80 of file AlgExecStateSvc.h.

std::mutex AlgExecStateSvc::m_mut
private

Definition at line 82 of file AlgExecStateSvc.h.

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

Definition at line 75 of file AlgExecStateSvc.h.


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