29#include <fmt/format.h>
56 switch ( s.state() ) {
57 case AlgExecStateRef::State::None:
59 case AlgExecStateRef::State::Executing:
62 return ost <<
"d f: " << s.filterPassed() <<
" sc: " << s.execStatus();
76 using extends::extends;
79 return { *
this, ctx,
algKey( iAlg->name() ) };
85 return { *
this, ctx,
algKey( iAlg->name() ) };
162 std::ostringstream ost;
199 if ( ctx.usesSubSlot() ) {
208 if ( ctx.subSlot() >= subSlots.size() ) subSlots.resize( ctx.subSlot() + 1 );
211 return subSlots[ctx.subSlot()].try_emplace( k ).first->second;
215 assert(
static_cast<size_t>( k ) <
m_algStates.at( ctx.slot() ).size() );
216 return m_algStates.at( ctx.slot() )[
static_cast<size_t>( k )];
226 if ( ctx.usesSubSlot() ) {
235 if ( ctx.subSlot() >= subSlots.size() ) {
239 return subSlots[ctx.subSlot()].at( k );
242 return m_algStates.at( ctx.slot() )[
static_cast<size_t>( k )];
252 std::atomic_ref{
m_eventStatus.
at( ctx.slot() ) }.store( sc, std::memory_order_relaxed );
260 auto current = status.load( std::memory_order_relaxed );
268 if ( next == current || status.compare_exchange_weak( current, next, std::memory_order_relaxed ) ) {
break; }
323 const size_t slotID = ctx.valid() ? ctx.slot() : 0;
324 ost <<
" [slot: " << slotID <<
", incident: " <<
m_eventStatus.
at( slotID ) <<
"]:\n\n";
327 [](
size_t m,
const auto& as ) {
return std::max( m, as.length() ); } );
328 for (
size_t k = 0;
const auto& e : algState )
340 for (
auto& it :
m_algStates.at( ctx.slot() ) ) it.reset();
345 for (
auto& it : subSlot ) it.second.reset();
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
#define DECLARE_COMPONENT(type)
constexpr _InputIterator find(_InputIterator __first, _InputIterator __last, const _Tp &__val)
constexpr const _Tp & max(const _Tp &__a, const _Tp &__b)
void lock(_L1 &__l1, _L2 &__l2, _L3 &... __l3)
void call_once(once_flag &__once, _Callable &&__f, _Args &&... __args)
constexpr _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
constexpr iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
constexpr auto begin(_Container &__cont) -> decltype(__cont.begin())
constexpr auto end(_Container &__cont) -> decltype(__cont.end())
__string_type str() const
constexpr void push_back(const value_type &__x)
constexpr reference at(size_type __n)
constexpr const_iterator end() const noexcept
constexpr size_type size() const noexcept
mapped_type & at(const key_type &__k)
std::pair< iterator, bool > emplace(_Args &&... __args)
size_type size() const noexcept
pair< iterator, bool > try_emplace(const key_type &__k, _Args &&... __args)
wrapper on an Algorithm state, const version.
wrapper on an Algorithm state.
AlgExecState::State State
internal state of an algorithm
void setState(AlgExecStateRef::State s)
void setFilterPassed(bool f=true)
bool filterPassed() const
const StatusCode & execStatus() const
AlgExecStateRef::State state() const
void setState(AlgExecStateRef::State s, const StatusCode &sc)
AlgExecStateRef::State m_state
friend std::ostream & operator<<(std::ostream &ost, const AlgExecStateInternal &s)
void setExecStatus(const StatusCode &sc=StatusCode::SUCCESS)
A service that keeps track of the execution state of Algorithm.
void reset(const EventContext &ctx) override
void dump(std::ostream &ost, const EventContext &ctx) const override
std::vector< std::string > m_algNames
std::vector< EventStatus::Status > m_eventStatus
AlgExecStateRef::AlgKey addAlg(const Gaudi::StringKey &) override
unsigned int incrementErrorCount(const IAlgorithm *iAlg) override
AlgExecStateRef algExecState(const IAlgorithm *iAlg, const EventContext &ctx) override
AlgExecStateRefConst algExecState(const IAlgorithm *iAlg, const EventContext &ctx) const override
void setFilterPassed(const EventContext &, AlgExecStateRef::AlgKey, bool) override
void updateEventStatus(const bool &b, const EventContext &ctx) override
AlgExecStateInternal & getInternalState(const EventContext &ctx, AlgExecStateRef::AlgKey k)
AlgExecStateRefConst algExecState(const std::string &algName, const EventContext &ctx) const override
const StatusCode & execStatus(const EventContext &, AlgExecStateRef::AlgKey) const override
void setState(const EventContext &, AlgExecStateRef::AlgKey, AlgExecStateRef::State) override
std::unordered_map< AlgExecStateRef::AlgKey, std::atomic< unsigned int > > m_errorCount
unsigned int algErrorCount(const IAlgorithm *iAlg) const override
std::vector< std::vector< AlgStatesWithSubSlot > > m_algSubSlotStates
void setEventStatus(const EventStatus::Status &sc, const EventContext &ctx) override
AlgExecStateRef algExecState(const std::string &algName, const EventContext &ctx) override
const EventStatus::Status & eventStatus(const EventContext &ctx) const override
std::vector< Gaudi::StringKey > m_preInitAlgs
std::unordered_map< AlgExecStateRef::AlgKey, AlgExecStateInternal > AlgStatesWithSubSlot
bool filterPassed(const EventContext &, AlgExecStateRef::AlgKey) const override
std::once_flag m_initFlag
std::vector< AlgStates > m_algStates
std::unordered_map< Gaudi::StringKey, AlgExecStateRef::AlgKey, Gaudi::StringKeyHash, std::equal_to<> > m_algNameToIndex
const std::string & algName(AlgExecStateRef::AlgKey) const override
AlgExecStateRef::AlgKey algKey(const std::string &algName) const
void setExecStatus(const EventContext &, AlgExecStateRef::AlgKey, const StatusCode &) override
AlgExecStateRef::State state(const EventContext &, AlgExecStateRef::AlgKey) const override
void resetErrorCount() override
std::vector< AlgExecStateInternal > AlgStates
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
This class represents an entry point to all the event specific data.
static GAUDI_API std::size_t numConcurrentEvents()
number of Concurrent Events (for MT)
static GAUDI_API bool concurrent()
serial operation, or some form of concurrency
Helper class for efficient "key" access for strings.
GaudiException(std::string Message, std::string Tag, StatusCode Code)
Constructor (1).
virtual AlgExecStateRef::AlgKey addAlg(const Gaudi::StringKey &algName)=0
adds a new algorithm to the service
The IAlgorithm is the interface implemented by the Algorithm base class.
This class is used for returning status codes from appropriate routines.
constexpr static const auto SUCCESS
constexpr static const auto FAILURE
Base class used to extend a class implementing other interfaces.
GAUDI_API const EventContext & currentContext()