The Gaudi Framework  v36r11 (bdb84f5f)
GaudiCommon< PBASE > Class Template Reference

#include <GaudiAlg/GaudiCommon.h>

Inheritance diagram for GaudiCommon< PBASE >:
Collaboration diagram for GaudiCommon< PBASE >:

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...
 
DataObjectput (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...
 
DataObjectput (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...
 
IUpdateManagerSvcupdMgrSvc () 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...
 
StatEntitycounter (std::string_view tag) const
 accessor to certain counter by name More...
 
StatEntitycounter (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
 
GaudiCommonoperator= (const GaudiCommon &)=delete
 
StatusCode release (const IInterface *interface) const
 Manual forced (and 'safe') release of the active tool or service. More...
 
const Servicesservices () const
 get the list of aquired services More...
 
const std::stringcontext () const
 Returns the "context" string. Used to identify different processing states. More...
 
- Public Member Functions inherited from FixTESPath< PBASE >
 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::stringrootInTES () 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< ICounterSummarySvcm_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::stringm_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...
 
IUpdateManagerSvcm_updMgrSvc = nullptr
 Pointer to the Update Manager Service instance. More...
 

Detailed Description

template<class PBASE>
class GaudiCommon< PBASE >

Implements the common functionality between GaudiTools and GaudiAlgorithms

Author
Chris Jones Chris.nosp@m.toph.nosp@m.er.Ro.nosp@m.b.Jo.nosp@m.nes@c.nosp@m.ern..nosp@m.ch
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru
Rob Lambert Rob.L.nosp@m.ambe.nosp@m.rt@ce.nosp@m.rn.c.nosp@m.h
Date
2009-08-04

Definition at line 95 of file GaudiCommon.h.

Member Typedef Documentation

◆ AlgTools

template<class PBASE >
typedef std::vector<IAlgTool*> GaudiCommon< PBASE >::AlgTools
protected

storage for active tools

Definition at line 130 of file GaudiCommon.h.

◆ base_class

template<class PBASE >
using GaudiCommon< PBASE >::base_class = FixTESPath<PBASE>
protected

Definition at line 97 of file GaudiCommon.h.

◆ Counter

template<class PBASE >
typedef std::map<std::string, unsigned int, std::less<> > GaudiCommon< PBASE >::Counter
protected

the actual type error/warning counter

Definition at line 128 of file GaudiCommon.h.

◆ Services

template<class PBASE >
typedef std::vector<SmartIF<IService> > GaudiCommon< PBASE >::Services
protected

storage for active services

Definition at line 132 of file GaudiCommon.h.

◆ Statistics

Definition at line 126 of file GaudiCommon.h.

◆ StatisticsOwn

template<class PBASE >
typedef std::map<std::string, StatEntity, std::less<> > GaudiCommon< PBASE >::StatisticsOwn
protected

the actual type of general counters

Definition at line 125 of file GaudiCommon.h.

Constructor & Destructor Documentation

◆ GaudiCommon() [1/4]

template<class PBASE >
template<typename U = PBASE, typename = std::enable_if_t<std::is_base_of_v<Gaudi::Algorithm, PBASE>, U>>
GaudiCommon< PBASE >::GaudiCommon ( std::string  name,
ISvcLocator pSvcLocator 
)
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.

612  : base_class( std::move( name ), pSvcLocator ) {
614  }

◆ GaudiCommon() [2/4]

template<class PBASE >
template<typename U = PBASE, typename = std::enable_if_t<std::is_base_of_v<AlgTool, PBASE>, U>>
GaudiCommon< PBASE >::GaudiCommon ( std::string  type,
std::string  name,
const IInterface ancestor 
)
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.

619  : base_class( std::move( type ), std::move( name ), ancestor ) {
620  initGaudiCommonConstructor( this->parent() );
621  }

◆ GaudiCommon() [3/4]

template<class PBASE >
GaudiCommon< PBASE >::GaudiCommon ( )
delete

◆ GaudiCommon() [4/4]

template<class PBASE >
GaudiCommon< PBASE >::GaudiCommon ( const GaudiCommon< PBASE > &  )
delete

Member Function Documentation

◆ addToServiceList()

template<class PBASE >
void GaudiCommon< PBASE >::addToServiceList ( SmartIF< IService svc) const
private

Add the given service to the list of acquired services.

Definition at line 236 of file GaudiCommon.icpp.

236  {
237  if ( svc ) {
239  if ( i == std::end( m_services ) || !GaudiCommon_details::svc_eq( *i, svc ) ) {
240  m_services.insert( i, std::move( svc ) );
241  } else {
242  this->warning() << "Service " << svc->name() << " already present -- skipping" << endmsg;
243  }
244  }
245 }

◆ Assert()

template<class PBASE >
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.

See also
GaudiException
Exceptions
Exceptionfor invalid condition
Parameters
okCondition which should be "true"
messageMessage to be associated with the exception

Definition at line 175 of file GaudiCommonImp.h.

175  {
176  if ( !ok ) Exception( msg, sc );
177 }

◆ context()

template<class PBASE >
const std::string& GaudiCommon< PBASE >::context ( ) const
inline

Returns the "context" string. Used to identify different processing states.

Definition at line 676 of file GaudiCommon.h.

676 { return m_context; }

◆ counter() [1/2]

template<class PBASE >
StatEntity& GaudiCommon< PBASE >::counter ( std::string_view  tag)
inline

Definition at line 492 of file GaudiCommon.h.

492  {
493  auto lock = std::scoped_lock{ m_countersOwnMutex };
494  // Return referenced StatEntity if it already exists, else create it
495  auto p = m_countersOwn.find( tag );
496  if ( p == m_countersOwn.end() ) {
497  auto [iter, b] = m_countersOwn.try_emplace( std::string{ tag } );
498  assert( b );
499  this->serviceLocator()->monitoringHub().registerEntity( this->name(), iter->first, StatEntity::typeString,
500  iter->second );
501  p = iter;
502  }
503  return p->second;
504  }

◆ counter() [2/2]

template<class PBASE >
StatEntity& GaudiCommon< PBASE >::counter ( std::string_view  tag) const
inline

accessor to certain counter by name

if ( OK ) { ++counter("OK") ; }
// additive counter ('Flag')
counter("#Tracks") += tracks->size() ;
// multiplicative counter ('Weight')
counter("ProbTot") *= probability ;
See also
StatEntuty
Parameters
tagcounter name
Returns
the counter itself

Definition at line 491 of file GaudiCommon.h.

491 { return const_cast<GaudiCommon<PBASE>*>( this )->counter( tag ); }

◆ countersOwn()

template<class PBASE >
StatisticsOwn GaudiCommon< PBASE >::countersOwn ( ) const
inlineprivate

accessor to all owned counters

Definition at line 469 of file GaudiCommon.h.

469 { return m_countersOwn; }

◆ Error()

template<class PBASE >
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.

if( a < 0 ) { return Error("a is negative!") ;}
if( b < 0 ) { return Error("b is illegal!" , StatusCode(25) );
if( c < 0 )
{ return Error("c is negative" , StatusCode(35) , 50 );
See also
MsgStream
IMessageSvc
StatusCode
Parameters
msgError message
stStatusCode to return
mxMaximum number of printouts for this message
Returns
StatusCode

Definition at line 256 of file GaudiCommon.icpp.

256  {
257  // increase local counter of errors
258  const size_t num = increment( m_errors, msg );
259  // If suppressed, just return
260  if ( num > mx ) {
261  return st;
262  } else if ( num == mx ) // issue one-time suppression message
263  {
264  return Print( std::string{ "The ERROR message is suppressed : '" }.append( msg ).append( "'" ), st, MSG::ERROR );
265  }
266  // return message
267  return Print( msg, st, MSG::ERROR );
268 }

◆ Exception() [1/3]

template<class PBASE >
void GaudiCommon< PBASE >::Exception ( std::string_view  msg,
const GaudiException exc,
const StatusCode  sc = StatusCode::FAILURE 
) const

Create and (re)-throw a given GaudiException.

See also
GaudiException
Exceptions
GaudiExceptionalways thrown!
Parameters
msgException message
exc(previous) exception of type GaudiException

Definition at line 345 of file GaudiCommon.icpp.

345  {
346  // increase local counter of exceptions
348  Print( std::string{ "Exception (re)throw: " }.append( msg ), sc, MSG::FATAL ).ignore();
349  throw GaudiException( ( this->name() + ":: " ).append( msg ), this->name(), sc, exc );
350 }

◆ Exception() [2/3]

template<class PBASE >
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.

See also
GaudiException
Exceptions
std::exceptionalways thrown!
Parameters
msgException message
exc(previous) exception of type std::exception
scStatusCode

Definition at line 357 of file GaudiCommon.icpp.

357  {
358  // increase local counter of exceptions
360  Print( std::string{ "Exception (re)throw: " }.append( msg ), sc, MSG::FATAL ).ignore();
361  throw GaudiException( ( this->name() + ":: " ).append( msg ) + "(" + exc.what() + ")", "", sc );
362 }

◆ Exception() [3/3]

template<class PBASE >
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.

See also
GaudiException
Exceptions
GaudiExceptionalways thrown!
Parameters
msgException message
scStatusCode

Definition at line 369 of file GaudiCommon.icpp.

369  {
370  // increase local counter of exceptions
372  Print( std::string{ "Exception throw: " }.append( msg ), sc, MSG::FATAL ).ignore();
373  throw GaudiException( ( this->name() + ":: " ).append( msg ), "", sc );
374 }

◆ exist()

template<class PBASE >
template<class TYPE >
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.

bool a1 = exist<DataObject>( evtSvc() , "/Event/MyObject" ) ;
bool a2 = exist<MyHits> ( evtSvc() , "/Event/MyHits" ) ;
Attention
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behavior can be suppressed by passing the argument useRootInTES = false
Parameters
svcPointer to data provider service
locationAddress in Gaudi Transient Store
useRootInTESFlag to turn on(TRUE) off(FALSE) the use of the RootInTES location property
Returns
Boolean indicating status of the request
Return values
trueData object or container exists and implements a proper interface
trueFailed to locate the data object or container

Definition at line 61 of file GaudiCommonImp.h.

61  {
62  // check the environment
63  Assert( service, "exist():: IDataProvider* points to NULL!" );
64  // check the data object
66  return checker( service, this->fullTESLocation( location, useRootInTES ) );
67 }

◆ finalize()

template<class PBASE >
StatusCode GaudiCommon< PBASE >::finalize
override

standard finalization method

Returns
status code

Definition at line 112 of file GaudiCommon.icpp.

112  {
114 
115  // add all counters to the CounterSummarySvc
116  if ( m_counterSummarySvc && this->svcLoc()->existsService( "CounterSummarySvc" ) ) {
117  if ( this->msgLevel( MSG::DEBUG ) ) this->debug() << "adding counters to CounterSummarySvc" << endmsg;
118 
120 
121  for ( const auto& i : m_countersOwn ) {
122  if ( counterList.Or( i.first ) ) m_counterSummarySvc->addCounter( this->name(), i.first, i.second );
123  }
124  }
125  // release all located tools and services
126  if ( this->msgLevel( MSG::DEBUG ) ) {
127  this->debug() << "Tools to release :";
128  for ( const auto& i : m_managedTools ) { this->debug() << " " << i->name(); }
129  this->debug() << endmsg;
130  }
131  while ( !m_managedTools.empty() ) {
133  }
134 
135  // release all located services
136  if ( this->msgLevel( MSG::DEBUG ) ) {
137  this->debug() << "Services to release :";
138  for ( const auto& i : m_services ) this->debug() << " " << i->name();
139  this->debug() << endmsg;
140  }
141  while ( !m_services.empty() ) {
143  }
144 
145  // release the CounterSummarySvc manually
147 
148  // format printout
149  if ( !m_errors.empty() || !m_warnings.empty() || !m_exceptions.empty() ) {
150  this->always() << "Exceptions/Errors/Warnings/Infos Statistics : " << m_exceptions.size() << "/" << m_errors.size()
151  << "/" << m_warnings.size() << "/" << m_infos.size() << endmsg;
152  if ( m_errorsPrint.value() ) { printErrors(); }
153  }
154 
155  // clear *ALL* counters explicitly
156  m_countersOwn.clear(); // then delete any owned counters
158  m_infos.clear();
159  m_warnings.clear();
160  m_errors.clear();
161  m_counterList.clear();
162 
163  // finalize base class
164  return ( sc && base_class::finalize() ? StatusCode::SUCCESS : StatusCode::FAILURE );
165 }

◆ get()

template<class PBASE >
template<class TYPE >
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

// Will access MCHits from the given location
MCHits* hits = get<MCHits>( evtSvc () , "MC/Hits" );
Attention
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behavior can be suppressed by passing the argument useRootInTES = false
See also
IDataProviderSvc
SmartDataPtr
Exceptions
GaudiExceptionfor Invalid Data Provider Service
GaudiExceptionfor invalid/unavailable data
Parameters
svcPointer to data service (data provider)
locationdata location/address in Gaudi Transient Store
useRootInTESFlag to turn on(TRUE) off(FALSE) the use of the RootInTES location property
Returns
pointer to the data object

Definition at line 36 of file GaudiCommonImp.h.

36  {
37  // check the environment
38  Assert( service, "get():: IDataProvider* points to NULL!" );
39  // get the helper object:
41  return getter( *this, service, this->fullTESLocation( location, useRootInTES ) );
42 }

◆ getIfExists()

template<class PBASE >
template<class TYPE >
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.

49  {
50  // check the environment
51  Assert( service, "get():: IDataProvider* points to NULL!" );
52  // get the helper object:
54  return getter( *this, service, this->fullTESLocation( location, useRootInTES ), false );
55 }

◆ getOrCreate()

template<class PBASE >
template<class TYPE , class TYPE2 >
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.

MyHits* hits = getOrCreate<MyHits,MyHits>( evtSvc() , "/Event/MyHits" ) ;
Attention
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behavior can be suppressed by passing the argument useRootInTES = false
Exceptions
GaudiExceptionfor Invalid Data Provider Service
GaudiExceptionfor invalid/unavailable data
Parameters
svcPointer to data provider service
locationLocation in Gaudi Transient Event Store
useRootInTESFlag to turn on(TRUE) off(FALSE) the use of the RootInTES location property
Returns
A valid pointer to the data object

Definition at line 76 of file GaudiCommonImp.h.

76  {
77  // check the environment
78  Assert( service, "getOrCreate():: svc points to NULL!" );
79  // get the helper object
81  return getter( *this, service, this->fullTESLocation( location, useRootInTES ), location );
82 }

◆ increment()

template<class PBASE >
static auto GaudiCommon< PBASE >::increment ( Counter c,
std::string_view  which 
)
inlinestaticprivate

Definition at line 691 of file GaudiCommon.h.

691  {
692  auto i = c.find( which );
693  return i != c.end() ? ++( i->second ) : c.emplace( which, 1 ).first->second;
694  }

◆ Info()

template<class PBASE >
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.

See also
MsgStream
IMessageSvc
StatusCode
GaudiCommon::Warning
Parameters
msgInfo message
stStatusCode to return
mxMaximum number of printouts for this message
Returns
The given StatusCode

Definition at line 295 of file GaudiCommon.icpp.

295  {
296  // increase local counter of warnings
297  const size_t num = increment( m_infos, msg );
298  // If suppressed, just return
299  if ( num > mx ) {
300  return st;
301  } else if ( num == mx ) // issue one-time suppression message
302  {
303  return Print( std::string{ "The INFO message is suppressed : '" }.append( msg ).append( "'" ), st, MSG::INFO );
304  }
305  // return message
306  return Print( msg, st, MSG::INFO );
307 }

◆ initGaudiCommonConstructor()

template<class PBASE >
void GaudiCommon< PBASE >::initGaudiCommonConstructor ( const IInterface parent = nullptr)
private

Constructor initializations.

Definition at line 52 of file GaudiCommon.icpp.

52  {
53  // setup context from parent if available
54  if ( parent ) {
55  if ( const GaudiAlgorithm* gAlg = dynamic_cast<const GaudiAlgorithm*>( parent ) ) {
56  m_context = gAlg->context();
57  } else if ( const GaudiTool* gTool = dynamic_cast<const GaudiTool*>( parent ) ) {
58  m_context = gTool->context();
59  }
60  }
61 
62  // Get options values from IOptionsSvc
63  // \fixme this part is not needed because this method is called in the constructor,
64  // and properties are, anyway, set during the initialize... except for Context
65  // which might be set in the contructor by GaudiSequencer.
66  const auto& optsSvc = this->serviceLocator()->getOptsSvc();
67  const std::string key = this->name() + ".Context";
68  if ( optsSvc.has( key ) ) { this->setPropertyRepr( "Context", optsSvc.get( key ) ).ignore(); }
69 }

◆ initialize()

template<class PBASE >
StatusCode GaudiCommon< PBASE >::initialize
override

standard initialization method

Returns
status code

Definition at line 76 of file GaudiCommon.icpp.

76  {
77 
78  // initialize base class
80  if ( sc.isFailure() ) { return Error( "Failed to initialise base class PBASE", sc ); }
81 
82  // some debug printout
83  if ( this->msgLevel( MSG::DEBUG ) ) {
84  this->debug() << "Initialize base class GaudiCommon<" << System::typeinfoName( typeid( PBASE ) ) << ">" << endmsg;
85  if ( !context().empty() ) this->debug() << "Created with context = '" << context() << "'" << endmsg;
86  }
87 
88  // Set up the CounterSummarySvc May need to be changed
89  m_counterSummarySvc = this->svcLoc()->service( "CounterSummarySvc", false );
90  if ( this->msgLevel( MSG::DEBUG ) ) {
91  if ( !m_counterSummarySvc )
92  this->debug() << "could not locate CounterSummarySvc, no counter summary will be made" << endmsg;
93  else
94  this->debug() << "found CounterSummarySvc OK" << endmsg;
95  }
96 
97  // properties will be printed if asked for or in "MSG::DEBUG" mode
98  if ( m_propsPrint.value() ) {
100  } else if ( this->msgLevel( MSG::DEBUG ) ) {
102  }
103 
104  return sc;
105 }

◆ operator=()

template<class PBASE >
GaudiCommon& GaudiCommon< PBASE >::operator= ( const GaudiCommon< PBASE > &  )
delete

◆ Print()

template<class PBASE >
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.

See also
MsgStream
IMessageSvc
StatusCode
Parameters
msgMessage to print
stStatusCode to return
levPrintout level for the given message
Returns
The given StatusCode

Definition at line 314 of file GaudiCommon.icpp.

314  {
315  // perform printout ?
316  if ( !this->msgLevel( lvl ) ) { return st; } // RETURN
317 
318  // use the predefined stream
319  MsgStream& str = this->msgStream( lvl );
320  if ( m_typePrint.value() ) { str << System::typeinfoName( typeid( *this ) ) << ":: "; }
321 
322  // print the message
323  str << msg;
324 
325  // test status code
326  if ( st.isSuccess() ) {
327  } else if ( StatusCode::FAILURE != st ) {
328  str << " StatusCode=" << st.getCode();
329  } else {
330  str << " StatusCode=FAILURE";
331  }
332 
333  // perform print operation
334  str << endmsg;
335 
336  // return
337  return st;
338 }

◆ printErrors()

template<class PBASE >
long GaudiCommon< PBASE >::printErrors ( const MSG::Level  level = MSG::ALWAYS) const

perform the actual printout of error counters

Parameters
levelThe message level to print at
Returns
number of error counters

Definition at line 381 of file GaudiCommon.icpp.

381  {
382  auto print = [&]( const Counter& c, const auto& label ) {
383  for ( const auto& i : c ) {
384  this->msgStream( level ) << fmt::format( " #{:<10s} = {:<8d} Message = '{}'", label, i.second, i.first )
385  << endmsg;
386  }
387  };
388 
389  print( m_exceptions, "EXCEPTIONS" );
390  print( m_errors, "ERRORS" );
391  print( m_warnings, "WARNINGS" );
392  print( m_infos, "INFOS" );
393 
394  // return total number of errors+warnings+exceptions
395  return m_exceptions.size() + m_errors.size() + m_warnings.size() + m_infos.size();
396 }

◆ printProps()

template<class PBASE >
long GaudiCommon< PBASE >::printProps ( const MSG::Level  level = MSG::ALWAYS) const

perform the actual printout of properties

perform the printout of properties

Parameters
levelThe message level to print at
Returns
number of properties
number of error counters

Definition at line 405 of file GaudiCommon.icpp.

405  {
406 
407  // print ALL properties
408  MsgStream& msg = this->msgStream( level );
409  const auto& properties = this->getProperties();
410  msg << "List of ALL properties of " << System::typeinfoName( typeid( *this ) ) << "/" << this->name()
411  << " #properties = " << properties.size() << endmsg;
412  for ( const auto& property : reverse( properties ) ) { msg << "Property ['Name': Value] = " << *property << endmsg; }
413  return properties.size();
414 }

◆ put() [1/2]

template<class PBASE >
DataObject* GaudiCommon< PBASE >::put ( IDataProviderSvc svc,
DataObject object,
std::string_view  location,
const bool  useRootInTES = true 
) const
inline

Definition at line 269 of file GaudiCommon.h.

270  {
271  return put( svc, std::unique_ptr<DataObject>( object ), location, useRootInTES );
272  }

◆ put() [2/2]

template<class PBASE >
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.

See also
IDataProviderSvc
Attention
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behavior can be suppressed by passing the argument useRootInTES = false
Parameters
svcPointer to data provider service
objectData object or container to be registered
locationLocation in Gaudi Event Transient Store ("/Event" could be omitted )
useRootInTESFlag to turn on(TRUE) off(FALSE) the use of the RootInTES location property
Exceptions
GaudiExceptionfor invalid event data service
GaudiExceptionfor invalid object
GaudiExceptionfor error result from event data service
Returns
StatusCode
Return values
StatusCode::SUCCESSData was successfully placed in the TES.
StatusCode::FAILUREFailed to store data in the TES.

Definition at line 425 of file GaudiCommon.icpp.

426  {
427  // check arguments
428  Assert( svc, "put():: Invalid 'service'!" );
429  Assert( static_cast<bool>( object ), "put():: Invalid 'Object'!" );
430  Assert( !location.empty(), "put():: Invalid 'address' = '' " );
431  // final data location
432  const auto& fullLocation = this->fullTESLocation( location, useRootInTES );
433  // register the object!
434  const StatusCode status = '/' == fullLocation[0] ? svc->registerObject( fullLocation, object.get() )
435  : svc->registerObject( "/Event/" + fullLocation, object.get() );
436  // check the result!
437  DataObject& obj = *object;
438  if ( status.isFailure() ) {
439  Exception( "put():: could not register '" + System::typeinfoName( typeid( obj ) ) + "' at address '" +
440  fullLocation + "'",
441  status );
442  }
443  if ( this->msgLevel( MSG::DEBUG ) ) {
444  Print( "The object of type '" + System::typeinfoName( typeid( obj ) ) + "' is registered in TS at address '" +
445  fullLocation + "'",
446  status, MSG::DEBUG )
447  .ignore();
448  }
449  // if we get here, ownership has been transferred to the IDataProviderSvc
450  return object.release();
451 }

◆ registerCondition() [1/4]

template<class PBASE >
template<class CallerClass >
void GaudiCommon< PBASE >::registerCondition ( char *  condition,
StatusCode(CallerClass::*)()  mf = NULL 
)
inline

just to avoid conflicts with the version using a pointer to a template class.

Definition at line 573 of file GaudiCommon.h.

573  {
574  updMgrSvc()->registerCondition( dynamic_cast<CallerClass*>( this ), std::string( condition ), mf );
575  }

◆ registerCondition() [2/4]

template<class PBASE >
template<class CallerClass , class CondType >
void GaudiCommon< PBASE >::registerCondition ( const std::string condition,
CondType *&  condPtrDest,
StatusCode(CallerClass::*)()  mf = NULL 
)
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.

Parameters
conditionthe path inside the Transient Detector Store to the condition object.
condPtrDestpointer 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.
mfoptional 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.
class MyAlg: public GaudiAlgorithm {
// ...
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.

568  {
569  updMgrSvc()->registerCondition( dynamic_cast<CallerClass*>( this ), condition, mf, condPtrDest );
570  }

◆ registerCondition() [3/4]

template<class PBASE >
template<class CallerClass >
void GaudiCommon< PBASE >::registerCondition ( const std::string condition,
StatusCode(CallerClass::*)()  mf = nullptr 
)
inline

register the current instance to the UpdateManagerSvc as a consumer for a condition.

Parameters
conditionthe path inside the Transient Detector Store to the condition object.
mfoptional 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.

533  {
534  updMgrSvc()->registerCondition( dynamic_cast<CallerClass*>( this ), condition, mf );
535  }

◆ registerCondition() [4/4]

template<class PBASE >
template<class CallerClass , class TargetClass >
void GaudiCommon< PBASE >::registerCondition ( TargetClass *  condition,
StatusCode(CallerClass::*)()  mf = NULL 
)
inline

register the current instance to the UpdateManagerSvc as a consumer for a condition.

Parameters
conditionthe path inside the Transient Detector Store to the condition object.
mfoptional 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.

592  {
593  updMgrSvc()->registerCondition( dynamic_cast<CallerClass*>( this ), condition, mf );
594  }

◆ release()

template<class PBASE >
StatusCode GaudiCommon< PBASE >::release ( const IInterface interface) const

Manual forced (and 'safe') release of the active tool or service.

IMyTool* mytool = tool<IMyTool>( .... ) ;
mytool->spendCPUtime() ;
release ( mytool ) ;
IMySvc* msvc = svc<IMySvc>( .... ) ;
msvc->spendCPUtime() ;
release ( msvc ) ;
Parameters
interfaceInterface pointer to the interface to be released
Returns
StatusCode
Return values
StatusCode::SUCCESSTool or service was successfully released
StatusCode::FAILUREError releasing too or service

Definition at line 176 of file GaudiCommon.icpp.

176  {
177  if ( !interface ) { return Error( "release(IInterface):: IInterface* points to NULL!" ); }
178  // dispatch between tools and services
179  const IAlgTool* algTool = dynamic_cast<const IAlgTool*>( interface );
180  // perform the actual release
181  return algTool ? releaseTool( algTool ) : releaseSvc( interface );
182 }

◆ releaseSvc()

template<class PBASE >
StatusCode GaudiCommon< PBASE >::releaseSvc ( const IInterface svc) const
protected

manual forced (and 'safe') release of the service

Definition at line 217 of file GaudiCommon.icpp.

217  {
218  if ( !Svc ) return Error( "releaseSvc(IInterface):: IInterface* points to NULL!" );
219  SmartIF<IService> svc{ const_cast<IInterface*>( Svc ) };
220  if ( !svc ) return Warning( "releaseSvc(IInterface):: IInterface* is not a service" );
222  if ( it == m_services.end() || !GaudiCommon_details::svc_eq( *it, svc ) ) {
223  return Warning( "releaseSvc(IInterface):: IInterface* is not active" );
224  }
225  if ( this->msgLevel( MSG::DEBUG ) ) { this->debug() << "Releasing service '" << ( *it )->name() << "'" << endmsg; }
226  m_services.erase( it );
227  return StatusCode::SUCCESS;
228 }

◆ releaseTool()

template<class PBASE >
StatusCode GaudiCommon< PBASE >::releaseTool ( const IAlgTool tool) const
protected

manual forced (and 'safe') release of the tool

Definition at line 189 of file GaudiCommon.icpp.

189  {
190  if ( !algTool ) { return Error( "releaseTool(IAlgTool):: IAlgTool* points to NULL!" ); }
191  if ( !this->toolSvc() ) { return Error( "releaseTool(IAlgTool):: IToolSvc* points to NULL!" ); }
192  // find a tool in the list of active tools
193  auto it = std::find( m_managedTools.begin(), m_managedTools.end(), algTool );
194  if ( m_managedTools.end() == it ) { return Warning( "releaseTool(IAlgTool):: IAlgTool* is not active" ); }
195  // get the tool
196  IAlgTool* t = *it;
197  // cache name
198  const std::string name = t->name();
199  if ( this->msgLevel( MSG::DEBUG ) ) { this->debug() << "Releasing tool '" << name << "'" << endmsg; }
200  // remove the tool from the lists
201  base_class::deregisterTool( t );
202  m_managedTools.erase( it );
203  // release tool
204  if ( this->msgLevel( MSG::DEBUG ) ) {
205  this->debug() << "The tool '" << t->name() << "' of type '" << System::typeinfoName( typeid( *t ) )
206  << "' is released" << endmsg;
207  }
208  const StatusCode sc = this->toolSvc()->releaseTool( t );
209  return sc.isSuccess() ? sc : Warning( "releaseTool(IAlgTool):: error from IToolSvc releasing " + name, sc );
210 }

◆ runUpdate()

template<class PBASE >
StatusCode GaudiCommon< PBASE >::runUpdate ( )
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).

// ...
return runUpdate();
}

Definition at line 606 of file GaudiCommon.h.

606 { return updMgrSvc()->update( this ); }

◆ services()

template<class PBASE >
const Services& GaudiCommon< PBASE >::services ( ) const
inline

get the list of aquired services

Definition at line 671 of file GaudiCommon.h.

671 { return m_services; } // get all services

◆ svc()

template<class PBASE >
template<class SERVICE >
SmartIF< SERVICE > GaudiCommon< PBASE >::svc ( std::string_view  name,
const bool  create = true 
) const

A useful method for the easy location of services.

IMyService* mySvc = svc<IMyService>( "MyServiceType" );
Attention
The services located with this method will be released automatically
See also
IService
ISevcLocator
Service
Exceptions
GaudiExceptionfor error in Algorithms::service
GaudiExceptionfor invalid service
Parameters
nameservice type name
createFlag for creation of non-existing services
Returns
A pointer to the service

Definition at line 137 of file GaudiCommonImp.h.

137  {
138  Assert( this->svcLoc(), "ISvcLocator* points to NULL!" );
140  // check if we already have this service
142  if ( it != std::end( m_services ) && GaudiCommon_details::svc_eq( *it, name ) ) {
143  // Try to get the requested interface
144  s = *it;
145  // check the results
146  if ( !s ) {
147  Exception( std::string{ "svc():: Could not retrieve Svc '" }.append( name ).append( "'" ), StatusCode::FAILURE );
148  }
149  } else {
150  auto baseSvc = this->svcLoc()->service( name, create );
151  // Try to get the requested interface
152  s = baseSvc;
153  // check the results
154  if ( !baseSvc || !s ) {
155  Exception( std::string{ "svc():: Could not retrieve Svc '" }.append( name ).append( "'" ), StatusCode::FAILURE );
156  }
157  // add the tool into list of known tools, to be properly released
158  addToServiceList( baseSvc );
159  }
160  // return *VALID* located service
161  return s;
162 }

◆ tool() [1/2]

template<class PBASE >
template<class TOOL >
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.

IMyTool* myTool = tool<IMyTool>( "PublicToolType" );
Attention
The tools located with this method will be released automatically
See also
IToolSvc
IAlgTool
Exceptions
GaudiExceptionfor invalid Tool Service
GaudiExceptionfor error from Tool Service
GaudiExceptionfor invalid tool
Parameters
typeTool type, could be of "Type/Name" format
parentTool parent
createFlag for creation of non-existing tools
Returns
A pointer to the tool

Definition at line 116 of file GaudiCommonImp.h.

116  {
117  // check the environment
118  Assert( PBASE::toolSvc(), "IToolSvc* points to NULL!" );
119  // retrieve the tool from Tool Service
120  TOOL* Tool = nullptr;
121  const StatusCode sc = this->toolSvc()->retrieveTool( type, Tool, parent, create );
122  if ( sc.isFailure() ) {
123  Exception( std::string{ "tool():: Could not retrieve Tool '" }.append( type ).append( "'" ), sc );
124  }
125  if ( !Tool ) { Exception( std::string{ "tool():: Could not retrieve Tool '" }.append( type ).append( "'" ) ); }
126  // add the tool into the list of known tools to be properly released
127  PBASE::registerTool( Tool );
128  m_managedTools.push_back( Tool );
129  // return *VALID* located tool
130  return Tool;
131 }

◆ tool() [2/2]

template<class PBASE >
template<class TOOL >
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.

IMyTool* myTool =
tool<IMyTool>( "MyToolType", "MyToolName", this );
Attention
The tools located with this method will be released automatically
See also
IToolSvc
IAlgTool
Exceptions
GaudiExceptionfor invalid Tool Service
GaudiExceptionfor error from Tool Service
GaudiExceptionfor invalid tool
Parameters
typeTool type
nameTool name
parentTool parent
createFlag for creation of nonexisting tools
Returns
A pointer to the tool

Definition at line 88 of file GaudiCommonImp.h.

89  {
90  // for empty names delegate to another method
91  if ( name.empty() ) return tool<TOOL>( type, parent, create );
92  Assert( this->toolSvc(), "tool():: IToolSvc* points to NULL!" );
93  // get the tool from Tool Service
94  TOOL* Tool = nullptr;
95  const StatusCode sc = this->toolSvc()->retrieveTool( type, name, Tool, parent, create );
96  if ( sc.isFailure() ) {
97  Exception(
98  std::string{ "tool():: Could not retrieve Tool '" }.append( type ).append( "'/'" ).append( name ).append( "'" ),
99  sc );
100  }
101  if ( !Tool ) {
102  Exception( std::string{ "tool():: Could not retrieve Tool '" }.append( type ).append( "'/'" ).append( name ).append(
103  "'" ) );
104  }
105  // insert tool into list of tools
106  PBASE::registerTool( Tool );
107  m_managedTools.push_back( Tool );
108  // return *VALID* located tool
109  return Tool;
110 }

◆ updMgrSvc()

template<class PBASE >
IUpdateManagerSvc * GaudiCommon< PBASE >::updMgrSvc

Short-cut to locate the Update Manager Service.

Definition at line 167 of file GaudiCommonImp.h.

167  {
168  if ( !m_updMgrSvc ) { m_updMgrSvc = svc<IUpdateManagerSvc>( "UpdateManagerSvc", true ); }
169  return m_updMgrSvc;
170 }

◆ Warning()

template<class PBASE >
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.

if( a < 0 ) { return Warning("a is negative!") ;}
if( b < 0 ) { return Warning("b is illegal!" , StatusCode(25) );
if( c < 0 )
{ return Warning("c is negative" , StatusCode(35) , 50 );
See also
MsgStream
IMessageSvc
StatusCode
Parameters
msgWarning message
stStatusCode to return
mxMaximum number of printouts for this message
Returns
The given StatusCode

Definition at line 275 of file GaudiCommon.icpp.

275  {
276  // increase local counter of warnings
277  const size_t num = increment( m_warnings, msg );
278  // If suppressed, just return
279  if ( num > mx ) {
280  return st;
281  } else if ( num == mx ) // issue one-time suppression message
282  {
283  return Print( std::string{ "The WARNING message is suppressed : '" }.append( msg ).append( "'" ), st,
284  MSG::WARNING );
285  }
286  // return message
287  return Print( msg, st, MSG::WARNING );
288 }

Member Data Documentation

◆ IgnoreRootInTES

template<class PBASE >
const bool GaudiCommon< PBASE >::IgnoreRootInTES = false
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.

// Get data, ignoring the setting of rootInTES()
MyData * data = get<MyData>( "/Event/MyData", IgnoreRootInTES );

Definition at line 108 of file GaudiCommon.h.

◆ m_context

template<class PBASE >
Gaudi::Property<std::string> GaudiCommon< PBASE >::m_context { this, "Context", {}, "note: overridden by parent settings" }
protected

Definition at line 734 of file GaudiCommon.h.

◆ m_counterList

template<class PBASE >
Gaudi::Property<std::vector<std::string> > GaudiCommon< PBASE >::m_counterList
protected
Initial value:
{
this, "CounterList", { ".*" }, "RegEx list, of simple integer counters for CounterSummary" }

Definition at line 735 of file GaudiCommon.h.

◆ m_countersOwn

template<class PBASE >
StatisticsOwn GaudiCommon< PBASE >::m_countersOwn
private

General counters.

Definition at line 704 of file GaudiCommon.h.

◆ m_countersOwnMutex

template<class PBASE >
std::mutex GaudiCommon< PBASE >::m_countersOwnMutex
private

The mutex for m_countersOwn.

Definition at line 706 of file GaudiCommon.h.

◆ m_counterSummarySvc

template<class PBASE >
SmartIF<ICounterSummarySvc> GaudiCommon< PBASE >::m_counterSummarySvc
protected

a pointer to the CounterSummarySvc

Definition at line 137 of file GaudiCommon.h.

◆ m_errors

template<class PBASE >
Counter GaudiCommon< PBASE >::m_errors
mutableprivate

Counter of errors.

Definition at line 696 of file GaudiCommon.h.

◆ m_errorsPrint

template<class PBASE >
Gaudi::Property<bool> GaudiCommon< PBASE >::m_errorsPrint
protected
Initial value:
{ this, "ErrorsPrint", true,
[this]( auto& ) {
if ( this->FSMState() >= Gaudi::StateMachine::INITIALIZED &&
this->m_errorsPrint.value() ) {
this->printErrors();
}
},
"print the statistics of errors/warnings/exceptions" }

Definition at line 714 of file GaudiCommon.h.

◆ m_exceptions

template<class PBASE >
Counter GaudiCommon< PBASE >::m_exceptions
mutableprivate

Counter of exceptions.

Definition at line 702 of file GaudiCommon.h.

◆ m_infos

template<class PBASE >
Counter GaudiCommon< PBASE >::m_infos
mutableprivate

counter of infos

Definition at line 700 of file GaudiCommon.h.

◆ m_managedTools

template<class PBASE >
AlgTools GaudiCommon< PBASE >::m_managedTools
mutableprivate

List of active tools.

Definition at line 687 of file GaudiCommon.h.

◆ m_propsPrint

template<class PBASE >
Gaudi::Property<bool> GaudiCommon< PBASE >::m_propsPrint
protected
Initial value:
{ this, "PropertiesPrint", false,
[this]( auto& ) {
if ( this->FSMState() >= Gaudi::StateMachine::INITIALIZED &&
this->m_propsPrint.value() ) {
}
},
"print the properties of the component" }

Definition at line 723 of file GaudiCommon.h.

◆ m_services

template<class PBASE >
Services GaudiCommon< PBASE >::m_services
mutableprivate

List of active services.

Definition at line 689 of file GaudiCommon.h.

◆ m_typePrint

template<class PBASE >
Gaudi::Property<bool> GaudiCommon< PBASE >::m_typePrint { this, "TypePrint", true, "add the actual C++ component type into the messages" }
protected

Definition at line 732 of file GaudiCommon.h.

◆ m_updMgrSvc

template<class PBASE >
IUpdateManagerSvc* GaudiCommon< PBASE >::m_updMgrSvc = nullptr
mutableprivate

Pointer to the Update Manager Service instance.

Definition at line 709 of file GaudiCommon.h.

◆ m_warnings

template<class PBASE >
Counter GaudiCommon< PBASE >::m_warnings
mutableprivate

counter of warnings

Definition at line 698 of file GaudiCommon.h.

◆ UseRootInTES

template<class PBASE >
const bool GaudiCommon< PBASE >::UseRootInTES = true
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.

// Get data, using the setting of rootInTES()
MyData * data = get<MyData>( "/Event/MyData", UseRootInTES );
// note the default setting is true, so this is equivalent to
MyData * data = get<MyData>( "/Event/MyData" );

Definition at line 120 of file GaudiCommon.h.


The documentation for this class was generated from the following files:
MyTool::initialize
StatusCode initialize() override
Overriding initialize and finalize.
Definition: MyTool.cpp:40
GaudiCommon::m_warnings
Counter m_warnings
counter of warnings
Definition: GaudiCommon.h:698
MSG::DEBUG
@ DEBUG
Definition: IMessageSvc.h:25
AutoLoadUnmetDataInputs.a2
a2
Definition: AutoLoadUnmetDataInputs.py:43
Gaudi::Utils::CheckData
Definition: GetData.h:318
Gaudi::Utils::RegEx::matchList
Definition: RegEx.h:34
Gaudi::Utils::GetOrCreateData
Definition: GetData.h:393
std::lock
T lock(T... args)
GaudiCommon::m_typePrint
Gaudi::Property< bool > m_typePrint
Definition: GaudiCommon.h:732
GaudiPython.HistoUtils.location
location
Definition: HistoUtils.py:965
std::string
STL class.
IAlgTool
Definition: IAlgTool.h:33
GaudiCommon::printErrors
long printErrors(const MSG::Level level=MSG::ALWAYS) const
perform the actual printout of error counters
Definition: GaudiCommon.icpp:381
GaudiCommon::get
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.
Definition: GaudiCommonImp.h:36
std::move
T move(T... args)
GaudiCommon::UseRootInTES
static const bool UseRootInTES
Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods.
Definition: GaudiCommon.h:120
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:314
MSG::INFO
@ INFO
Definition: IMessageSvc.h:25
GaudiCommon::Assert
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.
Definition: GaudiCommonImp.h:175
GaudiCommon::releaseTool
StatusCode releaseTool(const IAlgTool *tool) const
manual forced (and 'safe') release of the tool
Definition: GaudiCommon.icpp:189
reverse
::details::reverse_wrapper< T > reverse(T &&iterable)
Definition: reverse.h:59
gaudirun.s
string s
Definition: gaudirun.py:346
SmartIF::reset
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:96
std::map::find
T find(T... args)
std::map::size
T size(T... args)
GaudiCommon::m_countersOwn
StatisticsOwn m_countersOwn
General counters.
Definition: GaudiCommon.h:704
Gaudi::Utils::GetData< TYPE >
GaudiException
Definition: GaudiException.h:31
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:19
IMyTool
Definition: IMyTool.h:22
GaudiCommon::m_exceptions
Counter m_exceptions
Counter of exceptions.
Definition: GaudiCommon.h:702
GaudiCommon::base_class
FixTESPath< PBASE > base_class
Definition: GaudiCommon.h:97
GaudiCommon::m_managedTools
AlgTools m_managedTools
List of active tools.
Definition: GaudiCommon.h:687
GaudiCommon::m_counterList
Gaudi::Property< std::vector< std::string > > m_counterList
Definition: GaudiCommon.h:735
MSG::WARNING
@ WARNING
Definition: IMessageSvc.h:25
GaudiCommon_details::svc_lt
constexpr const struct GaudiCommon_details::svc_lt_t svc_lt
gaudirun.c
c
Definition: gaudirun.py:525
std::vector::back
T back(T... args)
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:310
Counter
Definition: Counter.py:1
std::vector::front
T front(T... args)
std::map::clear
T clear(T... args)
GaudiCommon::m_infos
Counter m_infos
counter of infos
Definition: GaudiCommon.h:700
std::vector::push_back
T push_back(T... args)
bug_34121.t
t
Definition: bug_34121.py:30
GaudiCommon::initGaudiCommonConstructor
void initGaudiCommonConstructor(const IInterface *parent=nullptr)
Constructor initializations.
Definition: GaudiCommon.icpp:52
GaudiCommon::svc
SmartIF< SERVICE > svc(std::string_view name, const bool create=true) const
A useful method for the easy location of services.
Definition: GaudiCommonImp.h:137
GaudiCommon::m_propsPrint
Gaudi::Property< bool > m_propsPrint
Definition: GaudiCommon.h:723
GaudiCommon::m_countersOwnMutex
std::mutex m_countersOwnMutex
The mutex for m_countersOwn.
Definition: GaudiCommon.h:706
GaudiCommon::updMgrSvc
IUpdateManagerSvc * updMgrSvc() const
Short-cut to locate the Update Manager Service.
Definition: GaudiCommonImp.h:167
GaudiCommon::runUpdate
StatusCode runUpdate()
asks the UpdateManagerSvc to perform an update of the instance (if needed) without waiting the next B...
Definition: GaudiCommon.h:606
GaudiCommon::m_context
Gaudi::Property< std::string > m_context
Definition: GaudiCommon.h:734
TimingHistograms.name
name
Definition: TimingHistograms.py:25
IUpdateManagerSvc::registerCondition
void registerCondition(CallerClass *instance, const std::string &condition="", typename ObjectMemberFunction< CallerClass >::MemberFunctionType mf=nullptr)
Register an object (algorithm instance) to the service.
Definition: IUpdateManagerSvc.h:178
StatusCode
Definition: StatusCode.h:65
AutoLoadUnmetDataInputs.a1
a1
Definition: AutoLoadUnmetDataInputs.py:41
GaudiAlgorithm
Definition: GaudiAlgorithm.h:104
GaudiCommon::Print
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.
Definition: GaudiCommon.icpp:314
IUpdateManagerSvc::update
StatusCode update(CallerClass *instance)
Update the given instance.
Definition: IUpdateManagerSvc.h:243
GaudiTesting.BaseTest.which
def which(executable)
Definition: BaseTest.py:748
Gaudi::Property::value
const ValueType & value() const
Definition: Property.h:239
GaudiCommon::m_errorsPrint
Gaudi::Property< bool > m_errorsPrint
Definition: GaudiCommon.h:714
GaudiCommon_details::svc_eq
constexpr const struct GaudiCommon_details::svc_eq_t svc_eq
std::vector::erase
T erase(T... args)
SmartIF< IService >
GaudiCommon::Warning
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.
Definition: GaudiCommon.icpp:275
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
GaudiCommon::releaseSvc
StatusCode releaseSvc(const IInterface *svc) const
manual forced (and 'safe') release of the service
Definition: GaudiCommon.icpp:217
FixTESPath< PBASE >::initialize
StatusCode initialize() override
Definition: FixTESPath.h:49
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:203
StatEntity::typeString
static const std::string typeString
Definition: StatEntity.h:25
GaudiCommon::addToServiceList
void addToServiceList(SmartIF< IService > svc) const
Add the given service to the list of acquired services.
Definition: GaudiCommon.icpp:236
GaudiCommon::release
StatusCode release(const IInterface *interface) const
Manual forced (and 'safe') release of the active tool or service.
Definition: GaudiCommon.icpp:176
gaudirun.level
level
Definition: gaudirun.py:364
MsgStream
Definition: MsgStream.h:34
MSG::FATAL
@ FATAL
Definition: IMessageSvc.h:25
GaudiCommon::context
const std::string & context() const
Returns the "context" string. Used to identify different processing states.
Definition: GaudiCommon.h:676
std::string::append
T append(T... args)
GaudiCommon::IgnoreRootInTES
static const bool IgnoreRootInTES
Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods.
Definition: GaudiCommon.h:108
gaudiComponentHelp.properties
properties
Definition: gaudiComponentHelp.py:69
StatusCode::ignore
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition: StatusCode.h:139
GaudiCommon::put
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.
Definition: GaudiCommon.icpp:425
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:129
GaudiCommon::increment
static auto increment(Counter &c, std::string_view which)
Definition: GaudiCommon.h:691
gaudirun.type
type
Definition: gaudirun.py:160
GaudiCommon::printProps
long printProps(const MSG::Level level=MSG::ALWAYS) const
perform the actual printout of properties
Definition: GaudiCommon.icpp:405
std::lower_bound
T lower_bound(T... args)
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
MSG::ALWAYS
@ ALWAYS
Definition: IMessageSvc.h:25
GaudiCommon::Exception
void Exception(std::string_view msg, const GaudiException &exc, const StatusCode sc=StatusCode::FAILURE) const
Create and (re)-throw a given GaudiException.
Definition: GaudiCommon.icpp:345
std::begin
T begin(T... args)
std::vector::insert
T insert(T... args)
Gaudi::StateMachine::INITIALIZED
@ INITIALIZED
Definition: StateMachine.h:25
MSG::ERROR
@ ERROR
Definition: IMessageSvc.h:25
IInterface
Definition: IInterface.h:237
GaudiCommon::m_services
Services m_services
List of active services.
Definition: GaudiCommon.h:689
DataObject
Definition: DataObject.h:40
std::vector::empty
T empty(T... args)
GaudiCommon::m_counterSummarySvc
SmartIF< ICounterSummarySvc > m_counterSummarySvc
a pointer to the CounterSummarySvc
Definition: GaudiCommon.h:137
StatusCode::getCode
code_t getCode() const
Retrieve value.
Definition: StatusCode.h:136
GaudiCommon::counter
StatEntity & counter(std::string_view tag) const
accessor to certain counter by name
Definition: GaudiCommon.h:491
std::end
T end(T... args)
GaudiCommon::m_errors
Counter m_errors
Counter of errors.
Definition: GaudiCommon.h:696
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
GaudiCommon::registerCondition
void registerCondition(const std::string &condition, StatusCode(CallerClass::*mf)()=nullptr)
register the current instance to the UpdateManagerSvc as a consumer for a condition.
Definition: GaudiCommon.h:533
std::unique_ptr
STL class.
GaudiTool
Definition: GaudiTool.h:110
FixTESPath< PBASE >::fullTESLocation
std::string fullTESLocation(std::string_view location, bool useRootInTES) const
Returns the full correct event location given the rootInTes settings.
Definition: FixTESPath.h:64
ProduceConsume.key
key
Definition: ProduceConsume.py:81
GaudiCommon::m_updMgrSvc
IUpdateManagerSvc * m_updMgrSvc
Pointer to the Update Manager Service instance.
Definition: GaudiCommon.h:709
GaudiCommon::Error
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.
Definition: GaudiCommon.icpp:256
std::exception::what
T what(T... args)
GaudiCommon
Definition: GaudiCommon.h:95