11 #ifndef GAUDIALG_GAUDICOMMON_H 12 #define GAUDIALG_GAUDICOMMON_H 1 94 template <
class PBASE>
108 static const bool IgnoreRootInTES =
false;
120 static const bool UseRootInTES =
true;
174 template <
class TYPE>
176 const bool useRootInTES =
true )
const;
180 template <
class TYPE>
182 const bool useRootInTES =
true )
const;
209 template <
class TYPE>
238 template <
class TYPE,
class TYPE2>
240 const bool useRootInTES =
true )
const;
267 const bool useRootInTES =
true )
const;
270 const bool useRootInTES =
true )
const {
298 template <
class TOOL>
322 template <
class TOOL>
346 template <
class SERVICE>
437 void Assert(
const bool ok, std::string_view message =
"",
468 void Exception( std::string_view
msg =
"no message",
497 auto lock = std::scoped_lock{m_countersOwnMutex};
499 auto p = m_countersOwn.find( tag );
500 if (
UNLIKELY( p == m_countersOwn.end() ) ) {
501 auto [iter, b] = m_countersOwn.try_emplace(
std::string{tag} );
503 this->declareCounter( iter->first, iter->second );
550 template <
class CallerClass>
552 updMgrSvc()->registerCondition( dynamic_cast<CallerClass*>(
this ), condition, mf );
584 template <
class CallerClass,
class CondType>
587 updMgrSvc()->registerCondition( dynamic_cast<CallerClass*>(
this ), condition, mf, condPtrDest );
590 template <
class CallerClass>
592 updMgrSvc()->registerCondition( dynamic_cast<CallerClass*>(
this ),
std::string( condition ), mf );
609 template <
class CallerClass,
class TargetClass>
611 updMgrSvc()->registerCondition( dynamic_cast<CallerClass*>(
this ), condition, mf );
629 template <
typename U = PBASE,
typename = std::enable_if_t<std::is_base_of_v<Gaudi::Algorithm, PBASE>, U>>
631 initGaudiCommonConstructor();
635 template <
typename U = PBASE,
typename = std::enable_if_t<std::is_base_of_v<AlgTool, PBASE>, U>>
638 initGaudiCommonConstructor( this->
parent() );
684 using PBASE::release;
711 return i !=
c.end() ? ++( i->second ) :
c.emplace(
which, 1 ).first->second;
734 this->errorsPrint() ) {
738 "print the statistics of errors/warnings/exceptions"};
743 this->propsPrint() ) {
747 "print the properties of the component"};
755 "print the table of counters"};
757 "force printing of empty counters, otherwise only printed in DEBUG mode"};
763 " sum | mean/eff^* | rms/err^* | min | max |",
764 "the header row for the output Stat-table"};
766 this,
"RegularRowFormat",
" | %|-48.48s|%|50t||%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |",
767 "the format for regular row in the output Stat-table"};
769 this,
"EfficiencyRowFormat",
770 " |*%|-48.48s|%|50t||%|10d| |%|11.5g| |(%|#9.6g| +- %|-#9.6g|)%%| ------- | ------- |",
771 "The format for \"efficiency\" row in the output Stat-table"};
773 "use the special format for printout of efficiency counters"};
776 this,
"CounterList", {
".*"},
"RegEx list, of simple integer counters for CounterSummary"};
778 this,
"StatEntityList", {},
"RegEx list, of StatEntity counters for CounterSummary"};
787 #endif // GAUDIALG_GAUDICOMMON_H std::map< std::string, unsigned int, std::less<> > Counter
the actual type error/warning counter
The implementation of templated methods for class GaudiCommon.
Counter m_warnings
counter of warnings
Out1 * put(const DataObjectHandle< Out1 > &out_handle, Out2 &&out)
StatEntity & counter(std::string_view tag) const
accessor to certain counter by name
Define general base for Gaudi exception.
bool statPrint() const
Print statistical counters at finalization ?
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Counter m_exceptions
Counter of exceptions.
bool errorsPrint() const
Print error counters at finalization ?
Implementation of property with value of concrete type.
StatEntity & counter(std::string_view tag)
std::vector< IAlgTool * > AlgTools
storage for active tools
constexpr const struct GaudiCommon_details::svc_eq_t svc_eq
void registerCondition(TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL)
register the current instance to the UpdateManagerSvc as a consumer for a condition.
Services m_services
List of active services.
const Services & services() const
get the list of aquired services
StatisticsOwn m_countersOwn
General counters.
GaudiCommon(std::string type, std::string name, const IInterface *ancestor)
Tool constructor - SFINAE-ed to insure this constructor is only defined if PBASE derives from AlgTool...
constexpr static const auto SUCCESS
Helper structure for implementation of "get"-functions for GaudiCommon<BASE>
void registerCondition(char *condition, StatusCode(CallerClass::*mf)()=NULL)
just to avoid conflicts with the version using a pointer to a template class.
StatisticsOwn countersOwn() const
accessor to all owned counters
static auto increment(Counter &c, std::string_view which)
auto get(const Handle &handle, const Algo &, const EventContext &) -> decltype(details::deref(handle.get()))
Data provider interface definition.
void registerCondition(const std::string &condition, StatusCode(CallerClass::*mf)()=nullptr)
register the current instance to the UpdateManagerSvc as a consumer for a condition.
constexpr const struct GaudiCommon_details::svc_lt_t svc_lt
Counter m_errors
Counter of errors.
This class is used for returning status codes from appropriate routines.
bool operator()(std::string_view n, const SmartIF< IService > &s) const
Definition of the basic interface.
Counter m_infos
counter of infos
std::vector< SmartIF< IService > > Services
storage for active services
SmartIF< ICounterSummarySvc > m_counterSummarySvc
a pointer to the CounterSummarySvc
Interface class to the Update Manager service.
StatusCode runUpdate()
asks the UpdateManagerSvc to perform an update of the instance (if needed) without waiting the next B...
std::mutex m_countersOwnMutex
The mutex for m_countersOwn.
const std::string & context() const
Returns the "context" string. Used to identify different processing states.
bool operator()(const SmartIF< IService > &s, std::string_view n) const
Alias for backward compatibility.
std::map< std::string, StatEntity, std::less<> > StatisticsOwn
the actual type of general counters
bool operator()(const SmartIF< IService > &s, const SmartIF< IService > &n) const
bool operator()(const SmartIF< IService > &s, const SmartIF< IService > &n) const
bool operator()(std::string_view n, const SmartIF< IService > &s) const
GaudiCommon(std::string name, ISvcLocator *pSvcLocator)
Algorithm constructor - the SFINAE constraint below ensures that this is constructor is only defined ...
void registerCondition(const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL)
register the current instance to the UpdateManagerSvc as a consumer for a condition.
constexpr static const auto FAILURE
const Gaudi::Algorithm & parent
Implements the common functionality between GaudiTools and GaudiAlgorithms.
bool propsPrint() const
Print properties at initialization ?
AlgTools m_managedTools
List of active tools.
StatusCode initialize() override
backward compatible StatEntity class.
bool operator()(const SmartIF< IService > &s, std::string_view n) const
A DataObject is the base class of any identifiable object on any data store.
std::map< std::string, std::reference_wrapper< Gaudi::Accumulators::PrintableCounter >, std::less<> > Statistics
Header file for std:chrono::duration-based Counters.
DataObject * put(IDataProviderSvc *svc, DataObject *object, std::string_view location, const bool useRootInTES=true) const
bool typePrint() const
Insert the actual C++ type of the algorithm/tool in the messages ?