1 #ifndef GAUDIALG_GAUDICOMMON_H 2 #define GAUDIALG_GAUDICOMMON_H 1 37 #elif __cplusplus > 201402L 38 #define WARN_UNUSED [[nodiscard]] 40 #define WARN_UNUSED [[gnu::warn_unused_result]] 92 template <
class PBASE>
107 static const bool IgnoreRootInTES =
false;
119 static const bool UseRootInTES =
true;
173 template <
class TYPE>
175 const bool useRootInTES = true )
const;
179 template <
class TYPE>
181 const bool useRootInTES =
true )
const;
208 template <
class TYPE>
237 template <
class TYPE,
class TYPE2>
239 const bool useRootInTES =
true )
const;
266 const bool useRootInTES =
true )
const;
269 const bool useRootInTES =
true )
const 298 template <
class TOOL>
300 bool create =
true )
const;
323 template <
class TOOL>
347 template <
class SERVICE>
442 inline void Assert(
const bool ok,
const std::string& message =
"",
452 inline void Assert(
const bool ok,
const char* message,
483 void Exception(
const std::string& msg =
"no message",
488 inline StatisticsOwn
countersOwn()
const {
return m_countersOwn; }
492 inline const Statistics
counters()
const {
return m_counters; }
520 auto p = m_counters.find( tag );
521 if ( p ==
end( m_counters ) ) {
522 auto&
counter = m_countersOwn[tag];
523 p = m_counters.emplace( tag,
counter ).first;
525 return m_countersOwn[tag];
530 m_counters.emplace( tag, r );
574 template <
class CallerClass>
577 updMgrSvc()->
registerCondition( dynamic_cast<CallerClass*>(
this ), condition, mf );
609 template <
class CallerClass,
class CondType>
613 updMgrSvc()->
registerCondition( dynamic_cast<CallerClass*>(
this ), condition, mf, condPtrDest );
616 template <
class CallerClass>
636 template <
class CallerClass,
class TargetClass>
639 updMgrSvc()->
registerCondition( dynamic_cast<CallerClass*>(
this ), condition, mf );
657 template <typename U = PBASE, typename = std::enable_if_t<std::is_base_of<Algorithm, PBASE>::value, U>>
660 initGaudiCommonConstructor();
664 template <typename U = PBASE, typename = std::enable_if_t<std::is_base_of<AlgTool, PBASE>::value, U>>
668 initGaudiCommonConstructor( this->parent() );
678 return i_gcInitialize();
689 return i_gcFinalize();
729 using PBASE::release;
734 const Services&
services()
const {
return m_services; }
764 void initGaudiCommonConstructor(
const IInterface* parent =
nullptr );
790 Gaudi::Property<bool> m_errorsPrint{
this,
"ErrorsPrint",
true,
"print the statistics of errors/warnings/exceptions"};
800 " sum | mean/eff^* | rms/err^* | min | max |",
801 "the header row for the output Stat-table"};
803 this,
"RegularRowFormat",
" | %|-48.48s|%|50t||%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |",
804 "the format for regular row in the output Stat-table"};
806 this,
"EfficiencyRowFormat",
807 " |*%|-48.48s|%|50t||%|10d| |%|11.5g| |(%|#9.6g| +- %|-#9.6g|)%%| ------- | ------- |",
808 "The format for \"efficiency\" row in the output Stat-table"};
810 "use the special format for printout of efficiency counters"};
813 this,
"CounterList", {
".*"},
"RegEx list, of simple integer counters for CounterSummary"};
815 this,
"StatEntityList", {},
"RegEx list, of StatEntity counters for CounterSummary"};
824 #endif // GAUDIALG_GAUDICOMMON_H std::map< std::string, StatEntity > StatisticsOwn
the actual type of general counters
The implementation of inline/templated methods for class GaudiCommon.
bool operator()(const SmartIF< IService > &s, const std::string &n) const
Counter m_warnings
counter of warnings
constexpr static const auto FAILURE
bool operator()(const std::string &n, const SmartIF< IService > &s) const
Define general base for Gaudi exception.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Counter m_exceptions
Counter of exceptions.
Implementation of property with value of concrete type.
const std::string & rootInTES() const
Returns the "rootInTES" string.
GaudiCommon(const std::string &name, ISvcLocator *pSvcLocator)
Algorithm constructor - the SFINAE constraint below ensures that this is constructor is only defined ...
StatEntity & counter(const std::string &tag)
std::vector< IAlgTool * > AlgTools
storage for active tools
constexpr const struct GaudiCommon_details::svc_eq_t svc_eq
AttribStringParser::Iterator end(const AttribStringParser &)
void registerCondition(TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL)
register the current instance to the UpdateManagerSvc as a consumer for a condition.
std::map< std::string, unsigned int > Counter
the actual type error/warning counter
Services m_services
List of active services.
bool operator()(const SmartIF< IService > &s, const SmartIF< IService > &n) const
StatisticsOwn m_countersOwn
General counters.
Helper structure for implementation of "get"-functions for GaudiCommon<BASE>
const std::string & context() const
Returns the "context" string. Used to identify different processing states.
An empty ancester of all counters that knows how to print themselves.
bool operator()(const std::string &n, const SmartIF< IService > &s) const
std::mutex m_countersMutex
The counters mutex.
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
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.
const Services & services() const
get the list of aquired services
PropertyMgr & operator=(const PropertyMgr &)=delete
bool statPrint() const
Print statistical counters at finalization ?
StatEntity & counter(const std::string &tag) const
accessor to certain counter by name
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 propsPrint() const
Print properties at initialization ?
Definition of the basic interface.
Counter m_infos
counter of infos
bool errorsPrint() const
Print error counters at finalization ?
void registerCondition(CallerClass *instance, const std::string &condition="", typename ObjectMemberFunction< CallerClass >::MemberFunctionType mf=nullptr)
Register an object (algorithm instance) to the service.
std::vector< SmartIF< IService > > Services
storage for active services
SmartIF< ICounterSummarySvc > m_counterSummarySvc
a pointer to the CounterSummarySvc
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Interface class to the Update Manager service.
DataObject * put(IDataProviderSvc *svc, DataObject *object, const std::string &location, const bool useRootInTES=true) const
StatusCode runUpdate()
asks the UpdateManagerSvc to perform an update of the instance (if needed) without waiting the next B...
constexpr static const auto SUCCESS
std::map< std::string, std::reference_wrapper< Gaudi::Accumulators::PrintableCounter > > Statistics
bool typePrint() const
Insert the actual C++ type of the algorithm/tool in the messages ?
StatusCode update(CallerClass *instance)
Update the given instance.
bool operator()(const SmartIF< IService > &s, const SmartIF< IService > &n) const
Base class from which all concrete algorithm classes should be derived.
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.
void registerCounter(const std::string &tag, Gaudi::Accumulators::PrintableCounter &r)
Implements the common functionality between GaudiTools and GaudiAlgorithms.
AlgTools m_managedTools
List of active tools.
bool operator()(const SmartIF< IService > &s, const std::string &n) const
GaudiCommon(const std::string &type, const std::string &name, const IInterface *ancestor)
Tool constructor - SFINAE-ed to insure this constructor is only defined if PBASE derives from AlgTool...
backward compatible StatEntity class.
A DataObject is the base class of any identifiable object on any data store.
Helper functions to set/get the application return code.
Out1 * put(DataObjectHandle< Out1 > &out_handle, Out2 &&out)
const Statistics counters() const
accessor to all counters