![]() |
The Gaudi Framework
v32r2 (46d42edc)
|
Implements the common functionality between GaudiTools and GaudiAlgorithms. More...
#include <GaudiAlg/GaudiCommon.h>
Public Member Functions | |
template<class TYPE > | |
Gaudi::Utils::GetData< TYPE >::return_type | get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
Templated access to the data in Gaudi Transient Store. More... | |
template<class TYPE > | |
Gaudi::Utils::GetData< TYPE >::return_type | getIfExists (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
Quicker version of the get function which bypasses the check on the retrieved data. More... | |
template<class TYPE > | |
bool | exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
Check the existence of a data object or container in the Gaudi Transient Event Store. More... | |
template<class TYPE , class TYPE2 > | |
Gaudi::Utils::GetData< TYPE >::return_type | getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
Get the existing data object from Gaudi Event Transient store. More... | |
DataObject * | put (IDataProviderSvc *svc, std::unique_ptr< DataObject > object, const std::string &location, const bool useRootInTES=true) const |
Register a data object or container into Gaudi Event Transient Store. More... | |
DataObject * | put (IDataProviderSvc *svc, DataObject *object, const std::string &location, const bool useRootInTES=true) const |
template<class TOOL > | |
TOOL * | tool (const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const |
Useful method for the easy location of tools. More... | |
template<class TOOL > | |
TOOL * | tool (const std::string &type, const IInterface *parent=0, bool create=true) const |
A useful method for the easy location of tools. More... | |
template<class SERVICE > | |
SmartIF< SERVICE > | svc (const std::string &name, const bool create=true) const |
A useful method for the easy location of services. More... | |
IUpdateManagerSvc * | updMgrSvc () const |
Short-cut to locate the Update Manager Service. More... | |
WARN_UNUSED StatusCode | Error (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
Print the error message and return with the given StatusCode. More... | |
WARN_UNUSED StatusCode | Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
Print the warning message and return with the given StatusCode. More... | |
WARN_UNUSED StatusCode | Info (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const size_t mx=10) const |
Print the info message and return with the given StatusCode. More... | |
WARN_UNUSED StatusCode | Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const |
Print the message and return with the given StatusCode. More... | |
void | Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
Assertion - throw exception if the given condition is not fulfilled. More... | |
void | Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
Assertion - throw exception if the given condition is not fulfilled. More... | |
void | Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
Create and (re)-throw a given GaudiException. More... | |
void | Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
Create and (re)-throw a given exception. More... | |
void | Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
Create and throw an exception with the given message. More... | |
StatEntity & | counter (const std::string &tag) const |
accessor to certain counter by name More... | |
StatEntity & | counter (const std::string &tag) |
bool | typePrint () const |
Insert the actual C++ type of the algorithm/tool in the messages ? More... | |
bool | propsPrint () const |
Print properties at initialization ? More... | |
bool | statPrint () const |
Print statistical counters at finalization ? More... | |
bool | errorsPrint () const |
Print error counters at finalization ? More... | |
long | printStat (const MSG::Level level=MSG::ALWAYS) const |
perform the actual printout of statistical counters More... | |
long | printErrors (const MSG::Level level=MSG::ALWAYS) const |
perform the actual printout of error counters More... | |
long | printProps (const MSG::Level level=MSG::ALWAYS) const |
perform the actual printout of properties More... | |
template<class CallerClass > | |
void | registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=nullptr) |
register the current instance to the UpdateManagerSvc as a consumer for a condition. More... | |
template<class CallerClass , class CondType > | |
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. More... | |
template<class CallerClass > | |
void | registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL) |
just to avoid conflicts with the version using a pointer to a template class. More... | |
template<class CallerClass , class TargetClass > | |
void | registerCondition (TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL) |
register the current instance to the UpdateManagerSvc as a consumer for a condition. More... | |
StatusCode | runUpdate () |
asks the UpdateManagerSvc to perform an update of the instance (if needed) without waiting the next BeginEvent incident. More... | |
template<typename U = PBASE, typename = std::enable_if_t<std::is_base_of_v<Gaudi::Algorithm, PBASE>, U>> | |
GaudiCommon (const std::string &name, ISvcLocator *pSvcLocator) | |
Algorithm constructor - the SFINAE constraint below ensures that this is constructor is only defined if PBASE derives from Algorithm. More... | |
template<typename U = PBASE, typename = std::enable_if_t<std::is_base_of_v<AlgTool, PBASE>, U>> | |
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. More... | |
StatusCode | initialize () override |
standard initialization method More... | |
StatusCode | finalize () override |
standard finalization method More... | |
StatusCode | release (const IInterface *interface) const |
Manual forced (and 'safe') release of the active tool or service. More... | |
const Services & | services () const |
get the list of aquired services More... | |
const std::string & | context () const |
Returns the "context" string. Used to identify different processing states. More... | |
![]() | |
FixTESPath (const std::string &name, ISvcLocator *pSvcLocator) | |
Algorithm constructor - the SFINAE constraint below ensures that this is constructor is only defined if BASE derives from Algorithm. More... | |
FixTESPath (const std::string &type, const std::string &name, const IInterface *ancestor) | |
Tool constructor - SFINAE-ed to insure this constructor is only defined if BASE derives from AlgTool. More... | |
StatusCode | initialize () override |
const std::string & | rootInTES () const |
Returns the "rootInTES" string. More... | |
std::string | fullTESLocation (std::string_view location, bool useRootInTES) const |
Returns the full correct event location given the rootInTes settings. More... | |
Protected Types | |
using | base_class = FixTESPath< PBASE > |
typedef std::map< std::string, StatEntity > | StatisticsOwn |
the actual type of general counters More... | |
typedef std::map< std::string, std::reference_wrapper< Gaudi::Accumulators::PrintableCounter > > | Statistics |
typedef std::map< std::string, unsigned int > | Counter |
the actual type error/warning counter More... | |
typedef std::vector< IAlgTool * > | AlgTools |
storage for active tools More... | |
typedef std::vector< SmartIF< IService > > | Services |
storage for active services More... | |
Protected Member Functions | |
StatusCode | releaseTool (const IAlgTool *tool) const |
manual forced (and 'safe') release of the tool More... | |
StatusCode | releaseSvc (const IInterface *svc) const |
manual forced (and 'safe') release of the service More... | |
Protected Attributes | |
SmartIF< ICounterSummarySvc > | m_counterSummarySvc |
a pointer to the CounterSummarySvc More... | |
Static Protected Attributes | |
static const bool | IgnoreRootInTES = false |
Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods. More... | |
static const bool | UseRootInTES = true |
Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods. More... | |
Private Member Functions | |
StatisticsOwn | countersOwn () const |
accessor to all owned counters More... | |
GaudiCommon ()=delete | |
GaudiCommon (const GaudiCommon &)=delete | |
GaudiCommon & | operator= (const GaudiCommon &)=delete |
void | addToServiceList (SmartIF< IService > svc) const |
Add the given service to the list of acquired services. More... | |
void | initGaudiCommonConstructor (const IInterface *parent=nullptr) |
Constructor initializations. More... | |
Implements the common functionality between GaudiTools and GaudiAlgorithms.
Definition at line 91 of file GaudiCommon.h.
|
protected |
storage for active tools
Definition at line 126 of file GaudiCommon.h.
|
protected |
Definition at line 93 of file GaudiCommon.h.
|
protected |
the actual type error/warning counter
Definition at line 124 of file GaudiCommon.h.
|
protected |
storage for active services
Definition at line 128 of file GaudiCommon.h.
|
protected |
Definition at line 122 of file GaudiCommon.h.
|
protected |
the actual type of general counters
Definition at line 121 of file GaudiCommon.h.
|
inline |
Algorithm constructor - the SFINAE constraint below ensures that this is constructor is only defined if PBASE derives from Algorithm.
Definition at line 642 of file GaudiCommon.h.
|
inline |
Tool constructor - SFINAE-ed to insure this constructor is only defined if PBASE derives from AlgTool.
Definition at line 648 of file GaudiCommon.h.
|
privatedelete |
|
privatedelete |
|
private |
Add the given service to the list of acquired services.
Definition at line 266 of file GaudiCommon.icpp.
|
inline |
Assertion - throw exception if the given condition is not fulfilled.
Exception | for invalid condition |
ok | Condition which should be "true" |
message | Message to be associated with the exception |
Definition at line 155 of file GaudiCommonImp.h.
|
inline |
Assertion - throw exception if the given condition is not fulfilled.
Exception | for invalid condition |
ok | Condition which should be "true" |
message | Message to be associated with the exception |
Definition at line 162 of file GaudiCommonImp.h.
|
inline |
Returns the "context" string. Used to identify different processing states.
Definition at line 707 of file GaudiCommon.h.
|
inline |
accessor to certain counter by name
tag | counter name |
Definition at line 506 of file GaudiCommon.h.
|
inline |
Definition at line 509 of file GaudiCommon.h.
|
inlineprivate |
StatusCode GaudiCommon< PBASE >::Error | ( | const std::string & | msg, |
const StatusCode | st = StatusCode::FAILURE , |
||
const size_t | mx = 10 |
||
) | const |
Print the error message and return with the given StatusCode.
Also performs statistical analysis of the error messages and suppression after the defined number of error instances.
msg | Error message |
st | StatusCode to return |
mx | Maximum number of printouts for this message |
Definition at line 286 of file GaudiCommon.icpp.
|
inline |
void GaudiCommon< PBASE >::Exception | ( | const std::string & | msg, |
const GaudiException & | exc, | ||
const StatusCode | sc = StatusCode( StatusCode::FAILURE, true ) |
||
) | const |
Create and (re)-throw a given GaudiException.
GaudiException | always thrown! |
msg | Exception message |
exc | (previous) exception of type GaudiException |
Definition at line 374 of file GaudiCommon.icpp.
void GaudiCommon< PBASE >::Exception | ( | const std::string & | msg, |
const std::exception & | exc, | ||
const StatusCode | sc = StatusCode( StatusCode::FAILURE, true ) |
||
) | const |
Create and (re)-throw a given exception.
std::exception | always thrown! |
msg | Exception message |
exc | (previous) exception of type std::exception |
sc | StatusCode |
Definition at line 386 of file GaudiCommon.icpp.
void GaudiCommon< PBASE >::Exception | ( | const std::string & | msg = "no message" , |
const StatusCode | sc = StatusCode( StatusCode::FAILURE, true ) |
||
) | const |
Create and throw an exception with the given message.
GaudiException | always thrown! |
msg | Exception message |
sc | StatusCode |
Definition at line 398 of file GaudiCommon.icpp.
|
inline |
Check the existence of a data object or container in the Gaudi Transient Event Store.
svc | Pointer to data provider service |
location | Address in Gaudi Transient Store |
useRootInTES | Flag to turn on(TRUE) off(FALSE) the use of the RootInTES location property |
true | Data object or container exists and implements a proper interface |
true | Failed to locate the data object or container |
Definition at line 52 of file GaudiCommonImp.h.
|
override |
standard finalization method
Definition at line 131 of file GaudiCommon.icpp.
|
inline |
Templated access to the data in Gaudi Transient Store.
Quick and safe access to the data in Gaudi transient store. The method located the data at given address and perform the debug printout about located data
GaudiException | for Invalid Data Provider Service |
GaudiException | for invalid/unavailable data |
svc | Pointer to data service (data provider) |
location | data location/address in Gaudi Transient Store |
useRootInTES | Flag to turn on(TRUE) off(FALSE) the use of the RootInTES location property |
Definition at line 26 of file GaudiCommonImp.h.
|
inline |
Quicker version of the get function which bypasses the check on the retrieved data.
Definition at line 39 of file GaudiCommonImp.h.
|
inline |
Get the existing data object from Gaudi Event Transient store.
Alternatively, create new object and register it in TES and return if object does not exist.
GaudiException | for Invalid Data Provider Service |
GaudiException | for invalid/unavailable data |
svc | Pointer to data provider service |
location | Location in Gaudi Transient Event Store |
useRootInTES | Flag to turn on(TRUE) off(FALSE) the use of the RootInTES location property |
Definition at line 68 of file GaudiCommonImp.h.
StatusCode GaudiCommon< PBASE >::Info | ( | const std::string & | msg, |
const StatusCode | st = StatusCode::SUCCESS , |
||
const size_t | mx = 10 |
||
) | const |
Print the info message and return with the given StatusCode.
Also performs statistical analysis of the info messages and suppression after the defined number of instances.
msg | Info message |
st | StatusCode to return |
mx | Maximum number of printouts for this message |
Definition at line 324 of file GaudiCommon.icpp.
|
private |
Constructor initializations.
Definition at line 65 of file GaudiCommon.icpp.
|
override |
standard initialization method
Definition at line 95 of file GaudiCommon.icpp.
|
privatedelete |
StatusCode GaudiCommon< PBASE >::Print | ( | const std::string & | msg, |
const StatusCode | st = StatusCode::SUCCESS , |
||
const MSG::Level | lev = MSG::INFO |
||
) | const |
Print the message and return with the given StatusCode.
msg | Message to print |
st | StatusCode to return |
lev | Printout level for the given message |
Definition at line 343 of file GaudiCommon.icpp.
long GaudiCommon< PBASE >::printErrors | ( | const MSG::Level | level = MSG::ALWAYS | ) | const |
perform the actual printout of error counters
level | The message level to print at |
Definition at line 442 of file GaudiCommon.icpp.
long GaudiCommon< PBASE >::printProps | ( | const MSG::Level | level = MSG::ALWAYS | ) | const |
perform the actual printout of properties
perform the printout of properties
level | The message level to print at |
Definition at line 466 of file GaudiCommon.icpp.
long GaudiCommon< PBASE >::printStat | ( | const MSG::Level | level = MSG::ALWAYS | ) | const |
perform the actual printout of statistical counters
level | The message level to print at |
Definition at line 410 of file GaudiCommon.icpp.
|
inline |
DataObject * GaudiCommon< PBASE >::put | ( | IDataProviderSvc * | svc, |
std::unique_ptr< DataObject > | object, | ||
const std::string & | location, | ||
const bool | useRootInTES = true |
||
) | const |
Register a data object or container into Gaudi Event Transient Store.
svc | Pointer to data provider service |
object | Data object or container to be registered |
location | Location in Gaudi Event Transient Store ("/Event" could be omitted ) |
useRootInTES | Flag to turn on(TRUE) off(FALSE) the use of the RootInTES location property |
GaudiException | for invalid event data service |
GaudiException | for invalid object |
GaudiException | for error result from event data service |
StatusCode::SUCCESS | Data was successfully placed in the TES. |
StatusCode::FAILURE | Failed to store data in the TES. |
Definition at line 486 of file GaudiCommon.icpp.
|
inline |
Definition at line 265 of file GaudiCommon.h.
|
inline |
register the current instance to the UpdateManagerSvc as a consumer for a condition.
condition | the path inside the Transient Detector Store to the condition object. |
mf | optional pointer to the member function to call when the condition object is updated. If the pointer is omitted the user must explicitly provide the class name to the method. StatusCode MyAlg::initialize(){ // ... registerCondition("/dd/Conditions/Readout/MyDet/MyCond",&MyAlg::i_CallBack); registerCondition<MyAlg>("/dd/Conditions/Readout/MyDet/MyOtherCond"); // ... } |
Definition at line 563 of file GaudiCommon.h.
|
inline |
register the current instance to the UpdateManagerSvc as a consumer for a condition.
This version of the method allow the user to specify where to put a copy of the pointer to the condition object.
condition | the path inside the Transient Detector Store to the condition object. |
condPtrDest | pointer to fill with the location of the condition object. Note: the pointer can be safely used only in the execute method or in the member function triggered by the update. |
mf | optional pointer to the member function to call when the condition object is updated. If the pointer is omitted the user must explicitly provide the class name to the method. // ... public: virtual StatusCode i_CallBack(); private: Condition *m_MyCond; SpecialCondition *m_MyOtherCond; // ... }; StatusCode MyAlg::initialize(){ // ... registerCondition("/dd/Conditions/Readout/MyDet/MyCond",m_MyCond,&MyAlg::i_CallBack); registerCondition<MyAlg>("/dd/Conditions/Readout/MyDet/MyOtherCond",m_MyOtherCond); // ... } |
Definition at line 597 of file GaudiCommon.h.
|
inline |
just to avoid conflicts with the version using a pointer to a template class.
Definition at line 603 of file GaudiCommon.h.
|
inline |
register the current instance to the UpdateManagerSvc as a consumer for a condition.
condition | the path inside the Transient Detector Store to the condition object. |
mf | optional pointer to the member function to call when the condition object is updated. If the pointer is omitted the user must explicitly provide the class name to the method. StatusCode MyAlg::initialize(){ // ... registerCondition("/dd/Conditions/Readout/MyDet/MyCond",&MyAlg::i_CallBack); registerCondition<MyAlg>("/dd/Conditions/Readout/MyDet/MyOtherCond"); // ... } |
Definition at line 622 of file GaudiCommon.h.
StatusCode GaudiCommon< PBASE >::release | ( | const IInterface * | interface | ) | const |
Manual forced (and 'safe') release of the active tool or service.
interface | Interface pointer to the interface to be released |
StatusCode::SUCCESS | Tool or service was successfully released |
StatusCode::FAILURE | Error releasing too or service |
Definition at line 206 of file GaudiCommon.icpp.
|
protected |
manual forced (and 'safe') release of the service
Definition at line 247 of file GaudiCommon.icpp.
|
protected |
manual forced (and 'safe') release of the tool
Definition at line 219 of file GaudiCommon.icpp.
|
inline |
asks the UpdateManagerSvc to perform an update of the instance (if needed) without waiting the next BeginEvent incident.
It is useful if the instance can be instantiated after a BeginEvent incident, and used before the next one (for example with tools).
Definition at line 636 of file GaudiCommon.h.
|
inline |
|
inline |
|
inline |
A useful method for the easy location of services.
GaudiException | for error in Algorithms::service |
GaudiException | for invalid service |
name | service type name |
create | Flag for creation of non-existing services |
Definition at line 121 of file GaudiCommonImp.h.
|
inline |
Useful method for the easy location of tools.
GaudiException | for invalid Tool Service |
GaudiException | for error from Tool Service |
GaudiException | for invalid tool |
type | Tool type |
name | Tool name |
parent | Tool parent |
create | Flag for creation of nonexisting tools |
Definition at line 81 of file GaudiCommonImp.h.
|
inline |
A useful method for the easy location of tools.
GaudiException | for invalid Tool Service |
GaudiException | for error from Tool Service |
GaudiException | for invalid tool |
type | Tool type, could be of "Type/Name" format |
parent | Tool parent |
create | Flag for creation of non-existing tools |
Definition at line 102 of file GaudiCommonImp.h.
|
inline |
Insert the actual C++ type of the algorithm/tool in the messages ?
Definition at line 523 of file GaudiCommon.h.
|
inline |
Short-cut to locate the Update Manager Service.
Definition at line 147 of file GaudiCommonImp.h.
StatusCode GaudiCommon< PBASE >::Warning | ( | const std::string & | msg, |
const StatusCode | st = StatusCode::FAILURE , |
||
const size_t | mx = 10 |
||
) | const |
Print the warning message and return with the given StatusCode.
Also performs statistical analysis of the warning messages and suppression after the defined number of error instances.
msg | Warning message |
st | StatusCode to return |
mx | Maximum number of printouts for this message |
Definition at line 305 of file GaudiCommon.icpp.
|
staticprotected |
Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods.
If used with cause the RootInTES option to be IGNORED.
Useful to aid with code readability. e.g.
Definition at line 104 of file GaudiCommon.h.
|
private |
Definition at line 769 of file GaudiCommon.h.
|
private |
Definition at line 784 of file GaudiCommon.h.
|
private |
General counters.
Definition at line 731 of file GaudiCommon.h.
|
private |
The mutex for m_countersOwn.
Definition at line 733 of file GaudiCommon.h.
|
protected |
a pointer to the CounterSummarySvc
Definition at line 133 of file GaudiCommon.h.
|
mutableprivate |
Counter of errors.
Definition at line 723 of file GaudiCommon.h.
|
private |
Definition at line 739 of file GaudiCommon.h.
|
mutableprivate |
Counter of exceptions.
Definition at line 729 of file GaudiCommon.h.
|
private |
Definition at line 774 of file GaudiCommon.h.
|
private |
Definition at line 777 of file GaudiCommon.h.
|
private |
Definition at line 770 of file GaudiCommon.h.
|
mutableprivate |
counter of infos
Definition at line 727 of file GaudiCommon.h.
|
mutableprivate |
List of active tools.
Definition at line 718 of file GaudiCommon.h.
|
private |
Definition at line 765 of file GaudiCommon.h.
|
private |
Definition at line 748 of file GaudiCommon.h.
|
mutableprivate |
List of active services.
Definition at line 720 of file GaudiCommon.h.
|
private |
Definition at line 786 of file GaudiCommon.h.
|
private |
Definition at line 757 of file GaudiCommon.h.
|
private |
Definition at line 767 of file GaudiCommon.h.
|
mutableprivate |
Pointer to the Update Manager Service instance.
Definition at line 736 of file GaudiCommon.h.
|
private |
Definition at line 781 of file GaudiCommon.h.
|
mutableprivate |
counter of warnings
Definition at line 725 of file GaudiCommon.h.
|
staticprotected |
Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods.
If used with cause the RootInTES option to be USED
Useful to aid with code readability. e.g.
Definition at line 116 of file GaudiCommon.h.