![]() |
The Gaudi Framework
v36r7 (7f57a304)
|
#include <GaudiAlg/GaudiCommon.h>
Public Member Functions | |
template<class TYPE > | |
Gaudi::Utils::GetData< TYPE >::return_type | get (IDataProviderSvc *svc, std::string_view 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, std::string_view 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, std::string_view 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, std::string_view 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, std::string_view location, const bool useRootInTES=true) const |
Register a data object or container into Gaudi Event Transient Store. More... | |
DataObject * | put (IDataProviderSvc *svc, DataObject *object, std::string_view location, const bool useRootInTES=true) const |
template<class TOOL > | |
TOOL * | tool (std::string_view type, std::string_view name, const IInterface *parent=0, bool create=true) const |
Useful method for the easy location of tools. More... | |
template<class TOOL > | |
TOOL * | tool (std::string_view 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 (std::string_view 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... | |
StatusCode | Error (std::string_view msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
Print the error message and return with the given StatusCode. More... | |
StatusCode | Warning (std::string_view msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
Print the warning message and return with the given StatusCode. More... | |
StatusCode | Info (std::string_view msg, const StatusCode st=StatusCode::SUCCESS, const size_t mx=10) const |
Print the info message and return with the given StatusCode. More... | |
StatusCode | Print (std::string_view 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, std::string_view message="", const StatusCode sc=StatusCode::FAILURE) const |
Assertion - throw exception if the given condition is not fulfilled. More... | |
void | Exception (std::string_view msg, const GaudiException &exc, const StatusCode sc=StatusCode::FAILURE) const |
Create and (re)-throw a given GaudiException. More... | |
void | Exception (std::string_view msg, const std::exception &exc, const StatusCode sc=StatusCode::FAILURE) const |
Create and (re)-throw a given exception. More... | |
void | Exception (std::string_view msg="no message", const StatusCode sc=StatusCode::FAILURE) const |
Create and throw an exception with the given message. More... | |
StatEntity & | counter (std::string_view tag) const |
accessor to certain counter by name More... | |
StatEntity & | counter (std::string_view tag) |
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 (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 (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. More... | |
StatusCode | initialize () override |
standard initialization method More... | |
StatusCode | finalize () override |
standard finalization method More... | |
GaudiCommon ()=delete | |
GaudiCommon (const GaudiCommon &)=delete | |
GaudiCommon & | operator= (const GaudiCommon &)=delete |
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 (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 (std::string type, 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, std::less<> > | StatisticsOwn |
the actual type of general counters More... | |
typedef std::map< std::string, std::reference_wrapper< Gaudi::Accumulators::PrintableCounter >, std::less<> > | Statistics |
typedef std::map< std::string, unsigned int, std::less<> > | 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... | |
Gaudi::Property< bool > | m_errorsPrint |
Gaudi::Property< bool > | m_propsPrint |
Gaudi::Property< bool > | m_typePrint { this, "TypePrint", true, "add the actual C++ component type into the messages" } |
Gaudi::Property< std::string > | m_context { this, "Context", {}, "note: overridden by parent settings" } |
Gaudi::Property< std::vector< std::string > > | m_counterList |
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... | |
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... | |
Static Private Member Functions | |
static auto | increment (Counter &c, std::string_view which) |
Private Attributes | |
AlgTools | m_managedTools |
List of active tools. More... | |
Services | m_services |
List of active services. More... | |
Counter | m_errors |
Counter of errors. More... | |
Counter | m_warnings |
counter of warnings More... | |
Counter | m_infos |
counter of infos More... | |
Counter | m_exceptions |
Counter of exceptions. More... | |
StatisticsOwn | m_countersOwn |
General counters. More... | |
std::mutex | m_countersOwnMutex |
The mutex for m_countersOwn. More... | |
IUpdateManagerSvc * | m_updMgrSvc = nullptr |
Pointer to the Update Manager Service instance. More... | |
Implements the common functionality between GaudiTools and GaudiAlgorithms
Definition at line 95 of file GaudiCommon.h.
|
protected |
storage for active tools
Definition at line 130 of file GaudiCommon.h.
|
protected |
Definition at line 97 of file GaudiCommon.h.
|
protected |
the actual type error/warning counter
Definition at line 128 of file GaudiCommon.h.
|
protected |
storage for active services
Definition at line 132 of file GaudiCommon.h.
|
protected |
Definition at line 126 of file GaudiCommon.h.
|
protected |
the actual type of general counters
Definition at line 125 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 612 of file GaudiCommon.h.
|
inline |
Tool constructor - SFINAE-ed to insure this constructor is only defined if PBASE derives from AlgTool.
Definition at line 618 of file GaudiCommon.h.
|
delete |
|
delete |
|
private |
Add the given service to the list of acquired services.
Definition at line 236 of file GaudiCommon.icpp.
void GaudiCommon< PBASE >::Assert | ( | const bool | ok, |
std::string_view | message = "" , |
||
const StatusCode | sc = StatusCode::FAILURE |
||
) | const |
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 175 of file GaudiCommonImp.h.
|
inline |
Returns the "context" string. Used to identify different processing states.
Definition at line 676 of file GaudiCommon.h.
|
inline |
Definition at line 492 of file GaudiCommon.h.
|
inline |
accessor to certain counter by name
tag | counter name |
Definition at line 491 of file GaudiCommon.h.
|
inlineprivate |
StatusCode GaudiCommon< PBASE >::Error | ( | std::string_view | 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 256 of file GaudiCommon.icpp.
void GaudiCommon< PBASE >::Exception | ( | std::string_view | msg, |
const GaudiException & | exc, | ||
const StatusCode | sc = StatusCode::FAILURE |
||
) | const |
Create and (re)-throw a given GaudiException.
GaudiException | always thrown! |
msg | Exception message |
exc | (previous) exception of type GaudiException |
Definition at line 345 of file GaudiCommon.icpp.
void GaudiCommon< PBASE >::Exception | ( | std::string_view | msg, |
const std::exception & | exc, | ||
const StatusCode | sc = StatusCode::FAILURE |
||
) | 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 357 of file GaudiCommon.icpp.
void GaudiCommon< PBASE >::Exception | ( | std::string_view | msg = "no message" , |
const StatusCode | sc = StatusCode::FAILURE |
||
) | const |
Create and throw an exception with the given message.
GaudiException | always thrown! |
msg | Exception message |
sc | StatusCode |
Definition at line 369 of file GaudiCommon.icpp.
bool GaudiCommon< PBASE >::exist | ( | IDataProviderSvc * | svc, |
std::string_view | location, | ||
const bool | useRootInTES = true |
||
) | const |
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 61 of file GaudiCommonImp.h.
|
override |
standard finalization method
Definition at line 112 of file GaudiCommon.icpp.
Gaudi::Utils::GetData< TYPE >::return_type GaudiCommon< PBASE >::get | ( | IDataProviderSvc * | svc, |
std::string_view | location, | ||
const bool | useRootInTES = true |
||
) | const |
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 36 of file GaudiCommonImp.h.
Gaudi::Utils::GetData< TYPE >::return_type GaudiCommon< PBASE >::getIfExists | ( | IDataProviderSvc * | svc, |
std::string_view | location, | ||
const bool | useRootInTES = true |
||
) | const |
Quicker version of the get function which bypasses the check on the retrieved data.
Definition at line 49 of file GaudiCommonImp.h.
Gaudi::Utils::GetData< TYPE >::return_type GaudiCommon< PBASE >::getOrCreate | ( | IDataProviderSvc * | svc, |
std::string_view | location, | ||
const bool | useRootInTES = true |
||
) | const |
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 76 of file GaudiCommonImp.h.
|
inlinestaticprivate |
StatusCode GaudiCommon< PBASE >::Info | ( | std::string_view | 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 295 of file GaudiCommon.icpp.
|
private |
|
override |
standard initialization method
Definition at line 76 of file GaudiCommon.icpp.
|
delete |
StatusCode GaudiCommon< PBASE >::Print | ( | std::string_view | 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 314 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 381 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 405 of file GaudiCommon.icpp.
|
inline |
Definition at line 269 of file GaudiCommon.h.
DataObject * GaudiCommon< PBASE >::put | ( | IDataProviderSvc * | svc, |
std::unique_ptr< DataObject > | object, | ||
std::string_view | 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 425 of file GaudiCommon.icpp.
|
inline |
just to avoid conflicts with the version using a pointer to a template class.
Definition at line 573 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 567 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 533 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 592 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 176 of file GaudiCommon.icpp.
|
protected |
manual forced (and 'safe') release of the service
Definition at line 217 of file GaudiCommon.icpp.
|
protected |
manual forced (and 'safe') release of the tool
Definition at line 189 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 606 of file GaudiCommon.h.
|
inline |
SmartIF< SERVICE > GaudiCommon< PBASE >::svc | ( | std::string_view | name, |
const bool | create = true |
||
) | const |
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 137 of file GaudiCommonImp.h.
TOOL * GaudiCommon< PBASE >::tool | ( | std::string_view | type, |
const IInterface * | parent = 0 , |
||
bool | create = true |
||
) | const |
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 116 of file GaudiCommonImp.h.
TOOL * GaudiCommon< PBASE >::tool | ( | std::string_view | type, |
std::string_view | name, | ||
const IInterface * | parent = 0 , |
||
bool | create = true |
||
) | const |
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 88 of file GaudiCommonImp.h.
IUpdateManagerSvc * GaudiCommon< PBASE >::updMgrSvc |
StatusCode GaudiCommon< PBASE >::Warning | ( | std::string_view | 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 275 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 108 of file GaudiCommon.h.
|
protected |
Definition at line 734 of file GaudiCommon.h.
|
protected |
Definition at line 735 of file GaudiCommon.h.
|
private |
General counters.
Definition at line 704 of file GaudiCommon.h.
|
private |
The mutex for m_countersOwn.
Definition at line 706 of file GaudiCommon.h.
|
protected |
a pointer to the CounterSummarySvc
Definition at line 137 of file GaudiCommon.h.
|
mutableprivate |
Counter of errors.
Definition at line 696 of file GaudiCommon.h.
|
protected |
Definition at line 714 of file GaudiCommon.h.
|
mutableprivate |
Counter of exceptions.
Definition at line 702 of file GaudiCommon.h.
|
mutableprivate |
counter of infos
Definition at line 700 of file GaudiCommon.h.
|
mutableprivate |
List of active tools.
Definition at line 687 of file GaudiCommon.h.
|
protected |
Definition at line 723 of file GaudiCommon.h.
|
mutableprivate |
List of active services.
Definition at line 689 of file GaudiCommon.h.
|
protected |
Definition at line 732 of file GaudiCommon.h.
|
mutableprivate |
Pointer to the Update Manager Service instance.
Definition at line 709 of file GaudiCommon.h.
|
mutableprivate |
counter of warnings
Definition at line 698 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 120 of file GaudiCommon.h.