GaudiCommon< PBASE > Class Template Reference

Implements the common functionality between GaudiTools and GaudiAlgorithms. More...

#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, 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...
 
DataObjectput (IDataProviderSvc *svc, DataObject *object, const std::string &location, const bool useRootInTES=true) const
 Register a data object or container into Gaudi Event Transient Store. More...
 
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...
 
IUpdateManagerSvcupdMgrSvc () const
 Short-cut to locate the Update Manager Service. More...
 
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...
 
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...
 
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...
 
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...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream ( MSG::ALWAYS ) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream ( MSG::FATAL ) More...
 
MsgStreamerr () const
 shortcut for the method msgStream ( MSG::ERROR ) More...
 
MsgStreamerror () const
 shortcut for the method msgStream ( MSG::ERROR ) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream ( MSG::WARNING ) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream ( MSG::INFO ) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream ( MSG::DEBUG ) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream ( MSG::VERBOSE ) More...
 
MsgStreammsg () const
 shortcut for the method msgStream ( MSG::INFO ) More...
 
const Statisticscounters () const
 accessor to all counters More...
 
StatEntitycounter (const std::string &tag) const
 accessor to certain counter by name More...
 
MSG::Level msgLevel () const
 The current message service output level. More...
 
bool msgLevel (const MSG::Level level) const
 Test the output level. More...
 
void resetMsgStream () const
 Reset (delete) the current message stream object. More...
 
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)()=NULL)
 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...
 
 GaudiCommon (const std::string &name, ISvcLocator *pSvcLocator)
 Algorithm constructor. More...
 
 GaudiCommon (const std::string &type, const std::string &name, const IInterface *parent)
 Tool constructor. More...
 
virtual StatusCode initialize ()
 standard initialization method More...
 
virtual StatusCode finalize ()
 standard finalization method More...
 
StatusCode release (const IInterface *interface) const
 Manual forced (and 'safe') release of the active tool or service. More...
 
virtual unsigned long release ()
 Un-hide IInterface::release (ICC warning #1125) More...
 
const AlgToolstools () const
 get the list of aquired tools More...
 
const Servicesservices () const
 get the list of aquired services More...
 
const std::string & context () const
 Returns the "context" string. Used to identify different processing states. More...
 
const std::string & rootInTES () const
 Returns the "rootInTES" string. More...
 
double globalTimeOffset () const
 Returns the "globalTimeOffset" double. More...
 
const std::string fullTESLocation (const std::string &location, const bool useRootInTES) const
 Returns the full correct event location given the rootInTes settings. More...
 
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...
 
DataObjectput (IDataProviderSvc *svc, DataObject *object, const std::string &location, const bool useRootInTES=true) const
 Register a data object or container into Gaudi Event Transient Store. More...
 
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...
 
IUpdateManagerSvcupdMgrSvc () const
 Short-cut to locate the Update Manager Service. More...
 
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...
 
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...
 
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...
 
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...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream ( MSG::ALWAYS ) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream ( MSG::FATAL ) More...
 
MsgStreamerr () const
 shortcut for the method msgStream ( MSG::ERROR ) More...
 
MsgStreamerror () const
 shortcut for the method msgStream ( MSG::ERROR ) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream ( MSG::WARNING ) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream ( MSG::INFO ) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream ( MSG::DEBUG ) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream ( MSG::VERBOSE ) More...
 
MsgStreammsg () const
 shortcut for the method msgStream ( MSG::INFO ) More...
 
const Statisticscounters () const
 accessor to all counters More...
 
StatEntitycounter (const std::string &tag) const
 accessor to certain counter by name More...
 
MSG::Level msgLevel () const
 The current message service output level. More...
 
bool msgLevel (const MSG::Level level) const
 Test the output level. More...
 
void resetMsgStream () const
 Reset (delete) the current message stream object. More...
 
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)()=NULL)
 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...
 
 GaudiCommon (const std::string &name, ISvcLocator *pSvcLocator)
 Algorithm constructor. More...
 
 GaudiCommon (const std::string &type, const std::string &name, const IInterface *parent)
 Tool constructor. More...
 
virtual StatusCode initialize ()
 standard initialization method More...
 
virtual StatusCode finalize ()
 standard finalization method More...
 
StatusCode release (const IInterface *interface) const
 Manual forced (and 'safe') release of the active tool or service. More...
 
virtual unsigned long release ()
 Un-hide IInterface::release (ICC warning #1125) More...
 
const AlgToolstools () const
 get the list of aquired tools More...
 
const Servicesservices () const
 get the list of aquired services More...
 
const std::string & context () const
 Returns the "context" string. Used to identify different processing states. More...
 
const std::string & rootInTES () const
 Returns the "rootInTES" string. More...
 
double globalTimeOffset () const
 Returns the "globalTimeOffset" double. More...
 
const std::string fullTESLocation (const std::string &location, const bool useRootInTES) const
 Returns the full correct event location given the rootInTes settings. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type get (IDataProviderSvc *service, const std::string &location, const bool useRootInTES) const
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type getIfExists (IDataProviderSvc *service, const std::string &location, const bool useRootInTES) const
 
template<class TYPE , class TYPE2 >
Gaudi::Utils::GetData< TYPE >::return_type getOrCreate (IDataProviderSvc *service, const std::string &location, const bool useRootInTES) const
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type get (IDataProviderSvc *service, const std::string &location, const bool useRootInTES) const
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type getIfExists (IDataProviderSvc *service, const std::string &location, const bool useRootInTES) const
 
template<class TYPE , class TYPE2 >
Gaudi::Utils::GetData< TYPE >::return_type getOrCreate (IDataProviderSvc *service, const std::string &location, const bool useRootInTES) const
 

Protected Types

typedef std::map< std::string, StatEntityStatistics
 the actual type of general counters More...
 
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 GaudiUtils::HashMap< std::string, SmartIF< IService > > Services
 storage for active services More...
 
typedef std::map< std::string, StatEntityStatistics
 the actual type of general counters More...
 
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 GaudiUtils::HashMap< std::string, SmartIF< IService > > Services
 storage for active services More...
 

Protected Member Functions

virtual ~GaudiCommon ()
 Destructor. More...
 
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...
 
virtual ~GaudiCommon ()
 Destructor. More...
 
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

ICounterSummarySvcm_counterSummarySvc
 a pointer to the CounterSummarySvc More...
 
std::vector< std::string > m_counterList
 list of counters to declare. Set by property CounterList. This can be a regular expression. More...
 
std::vector< std::string > m_statEntityList
 

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

void msgLevelHandler (Property &theProp)
 Handle method for changes in the Messaging levels. More...
 
 GaudiCommon ()
 
 GaudiCommon (const GaudiCommon &)
 
GaudiCommonoperator= (const GaudiCommon &)
 
void printErrorHandler (Property &)
 handler for "ErrorPrint" property More...
 
void printPropsHandler (Property &)
 handler for "PropertiesPrint" property More...
 
void printStatHandler (Property &)
 handler for "StatPrint" property More...
 
void addToToolList (IAlgTool *tool) const
 Add the given tool to the list of acquired tools. More...
 
void addToServiceList (const SmartIF< IService > &svc) const
 Add the given service to the list of acquired services. More...
 
void initGaudiCommonConstructor (const IInterface *parent=0)
 Constructor initializations. More...
 
void msgLevelHandler (Property &theProp)
 Handle method for changes in the Messaging levels. More...
 
 GaudiCommon ()
 
 GaudiCommon (const GaudiCommon &)
 
GaudiCommonoperator= (const GaudiCommon &)
 
void printErrorHandler (Property &)
 handler for "ErrorPrint" property More...
 
void printPropsHandler (Property &)
 handler for "PropertiesPrint" property More...
 
void printStatHandler (Property &)
 handler for "StatPrint" property More...
 
void addToToolList (IAlgTool *tool) const
 Add the given tool to the list of acquired tools. More...
 
void addToServiceList (const SmartIF< IService > &svc) const
 Add the given service to the list of acquired services. More...
 
void initGaudiCommonConstructor (const IInterface *parent=0)
 Constructor initializations. More...
 

Private Attributes

MSG::Level m_msgLevel
 The message level. More...
 
MsgStreamm_msgStream
 The predefined message stream. More...
 
AlgTools m_tools
 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...
 
Statistics m_counters
 General counters. More...
 
IUpdateManagerSvcm_updMgrSvc
 Pointer to the Update Manager Service instance. More...
 
bool m_typePrint
 insert the actual C++ type of the algorithm in the messages? More...
 
bool m_propsPrint
 print properties at initialization? More...
 
bool m_statPrint
 print counters at finalization ? More...
 
bool m_errorsPrint
 print warning and error counters at finalization ? More...
 
std::string m_context
 The context string. More...
 
std::string m_rootInTES
 The rootInTES string. More...
 
std::string m_rootOnTES
 The rootOnTES string. More...
 
double m_globalTimeOffset
 The globalTimeOffset value. More...
 
std::string m_header
 the header row More...
 
std::string m_format1
 format for regular statistical printout rows More...
 
std::string m_format2
 format for "efficiency" statistical printout rows More...
 
bool m_useEffFormat
 flag to use the special "efficiency" format 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 59 of file GaudiCommon.h.

Member Typedef Documentation

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

storage for active tools

Definition at line 92 of file GaudiCommon.h.

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

storage for active tools

Definition at line 92 of file GaudiCommon.h.

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

the actual type error/warning counter

Definition at line 90 of file GaudiCommon.h.

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

the actual type error/warning counter

Definition at line 90 of file GaudiCommon.h.

template<class PBASE>
typedef GaudiUtils::HashMap<std::string, SmartIF<IService> > GaudiCommon< PBASE >::Services
protected

storage for active services

Definition at line 94 of file GaudiCommon.h.

template<class PBASE>
typedef GaudiUtils::HashMap<std::string, SmartIF<IService> > GaudiCommon< PBASE >::Services
protected

storage for active services

Definition at line 94 of file GaudiCommon.h.

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

the actual type of general counters

Definition at line 88 of file GaudiCommon.h.

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

the actual type of general counters

Definition at line 88 of file GaudiCommon.h.

Constructor & Destructor Documentation

template<class PBASE>
GaudiCommon< PBASE >::GaudiCommon ( const std::string &  name,
ISvcLocator pSvcLocator 
)

Algorithm constructor.

template<class PBASE>
GaudiCommon< PBASE >::GaudiCommon ( const std::string &  type,
const std::string &  name,
const IInterface parent 
)

Tool constructor.

template<class PBASE>
virtual GaudiCommon< PBASE >::~GaudiCommon ( )
inlineprotectedvirtual

Destructor.

Definition at line 698 of file GaudiCommon.h.

698 {resetMsgStream();}
void resetMsgStream() const
Reset (delete) the current message stream object.
template<class PBASE>
GaudiCommon< PBASE >::GaudiCommon ( )
private
template<class PBASE>
GaudiCommon< PBASE >::GaudiCommon ( const GaudiCommon< PBASE > &  )
private
template<class PBASE>
GaudiCommon< PBASE >::GaudiCommon ( const std::string &  name,
ISvcLocator pSvcLocator 
)

Algorithm constructor.

template<class PBASE>
GaudiCommon< PBASE >::GaudiCommon ( const std::string &  type,
const std::string &  name,
const IInterface parent 
)

Tool constructor.

template<class PBASE>
virtual GaudiCommon< PBASE >::~GaudiCommon ( )
inlineprotectedvirtual

Destructor.

Definition at line 698 of file GaudiCommon.h.

698 {resetMsgStream();}
void resetMsgStream() const
Reset (delete) the current message stream object.
template<class PBASE>
GaudiCommon< PBASE >::GaudiCommon ( )
private
template<class PBASE>
GaudiCommon< PBASE >::GaudiCommon ( const GaudiCommon< PBASE > &  )
private

Member Function Documentation

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

Add the given service to the list of acquired services.

Definition at line 466 of file GaudiCommon.icpp.

467 {
468  if (svc.isValid()) {
469  m_services[svc->name()] = svc;
470  }
471 }
Services m_services
List of active services.
Definition: GaudiCommon.h:787
virtual const std::string & name() const =0
Retrieve the name of the instance.
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
SmartIF< SERVICE > svc(const std::string &name, const bool create=true) const
A useful method for the easy location of services.
template<class PBASE>
void GaudiCommon< PBASE >::addToServiceList ( const SmartIF< IService > &  svc) const
private

Add the given service to the list of acquired services.

template<class PBASE >
void GaudiCommon< PBASE >::addToToolList ( IAlgTool tool) const
private

Add the given tool to the list of acquired tools.

Definition at line 448 of file GaudiCommon.icpp.

449 {
450  if( 0 != tool ) {
451  if ( this->msgLevel ( MSG::DEBUG ) ) {
452  this->debug() << "The tool of type '"
453  << System::typeinfoName(typeid(*tool))
454  << "' has been added with the name '"
455  << tool->name() << "'" << endmsg ;
456  }
457  m_tools.push_back( tool ) ;
458  }
459 }
AlgTools m_tools
List of active tools.
Definition: GaudiCommon.h:785
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
MSG::Level msgLevel() const
The current message service output level.
Definition: GaudiCommon.h:532
virtual const std::string & name() const =0
Retrieve the name of the instance.
MsgStream & debug() const
shortcut for the method msgStream ( MSG::DEBUG )
Definition: GaudiCommon.h:499
template<class PBASE>
void GaudiCommon< PBASE >::addToToolList ( IAlgTool tool) const
private

Add the given tool to the list of acquired tools.

template<class PBASE>
MsgStream& GaudiCommon< PBASE >::always ( ) const
inline

shortcut for the method msgStream ( MSG::ALWAYS )

Definition at line 487 of file GaudiCommon.h.

487 { return msgStream ( MSG::ALWAYS ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::always ( ) const
inline

shortcut for the method msgStream ( MSG::ALWAYS )

Definition at line 487 of file GaudiCommon.h.

487 { return msgStream ( MSG::ALWAYS ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE >
void GaudiCommon< PBASE >::Assert ( const bool  ok,
const std::string &  message = "",
const StatusCode  sc = StatusCode(StatusCode::FAILURE, true) 
) const
inline

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 238 of file GaudiCommonImp.h.

241 {
242  if (!ok) Exception( msg , sc );
243 }
MsgStream & msg() const
shortcut for the method msgStream ( MSG::INFO )
Definition: GaudiCommon.h:503
void Exception(const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
Create and (re)-throw a given GaudiException.
template<class PBASE>
void GaudiCommon< PBASE >::Assert ( const bool  ok,
const std::string &  message = "",
const StatusCode  sc = StatusCode(StatusCode::FAILURE, true) 
) const
inline

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
template<class PBASE>
void GaudiCommon< PBASE >::Assert ( const bool  ok,
const char *  message,
const StatusCode  sc = StatusCode(StatusCode::FAILURE, true) 
) const
inline

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
template<class PBASE >
void GaudiCommon< PBASE >::Assert ( const bool  ok,
const char *  message,
const StatusCode  sc = StatusCode(StatusCode::FAILURE, true) 
) const
inline

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 256 of file GaudiCommonImp.h.

259 {
260  if (!ok) Exception( msg , sc );
261 }
MsgStream & msg() const
shortcut for the method msgStream ( MSG::INFO )
Definition: GaudiCommon.h:503
void Exception(const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
Create and (re)-throw a given GaudiException.
template<class PBASE>
const std::string& GaudiCommon< PBASE >::context ( ) const
inline

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

Definition at line 754 of file GaudiCommon.h.

754 { return m_context; }
std::string m_context
The context string.
Definition: GaudiCommon.h:813
template<class PBASE>
const std::string& GaudiCommon< PBASE >::context ( ) const
inline

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

Definition at line 754 of file GaudiCommon.h.

754 { return m_context; }
std::string m_context
The context string.
Definition: GaudiCommon.h:813
template<class PBASE>
StatEntity& GaudiCommon< PBASE >::counter ( const std::string &  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 526 of file GaudiCommon.h.

526 { return m_counters[tag] ; }
Statistics m_counters
General counters.
Definition: GaudiCommon.h:798
template<class PBASE>
StatEntity& GaudiCommon< PBASE >::counter ( const std::string &  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 526 of file GaudiCommon.h.

526 { return m_counters[tag] ; }
Statistics m_counters
General counters.
Definition: GaudiCommon.h:798
template<class PBASE>
const Statistics& GaudiCommon< PBASE >::counters ( void  ) const
inline

accessor to all counters

Definition at line 507 of file GaudiCommon.h.

507 { return m_counters ; }
Statistics m_counters
General counters.
Definition: GaudiCommon.h:798
template<class PBASE>
const Statistics& GaudiCommon< PBASE >::counters ( ) const
inline

accessor to all counters

Definition at line 507 of file GaudiCommon.h.

507 { return m_counters ; }
Statistics m_counters
General counters.
Definition: GaudiCommon.h:798
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::debug ( ) const
inline

shortcut for the method msgStream ( MSG::DEBUG )

Definition at line 499 of file GaudiCommon.h.

499 { return msgStream ( MSG::DEBUG ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::debug ( ) const
inline

shortcut for the method msgStream ( MSG::DEBUG )

Definition at line 499 of file GaudiCommon.h.

499 { return msgStream ( MSG::DEBUG ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::err ( ) const
inline

shortcut for the method msgStream ( MSG::ERROR )

Definition at line 491 of file GaudiCommon.h.

491 { return msgStream ( MSG::ERROR ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::err ( ) const
inline

shortcut for the method msgStream ( MSG::ERROR )

Definition at line 491 of file GaudiCommon.h.

491 { return msgStream ( MSG::ERROR ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE>
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.

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

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 482 of file GaudiCommon.icpp.

485 {
486  // increase local counter of errors
487  const size_t num = ++m_errors[msg] ;
488  // If suppressed, just return
489  if ( num > mx ) { return st ; }
490  else if ( num == mx ) // issue one-time suppression message
491  { return Print ( "The ERROR message is suppressed : '" +
492  msg + "'" , st , MSG::ERROR ) ; }
493  // return message
494  return Print ( msg , st , MSG::ERROR ) ;
495 }
Counter m_errors
Counter of errors.
Definition: GaudiCommon.h:790
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.
MsgStream & msg() const
shortcut for the method msgStream ( MSG::INFO )
Definition: GaudiCommon.h:503
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::error ( ) const
inline

shortcut for the method msgStream ( MSG::ERROR )

Definition at line 493 of file GaudiCommon.h.

493 { return msgStream ( MSG::ERROR ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::error ( ) const
inline

shortcut for the method msgStream ( MSG::ERROR )

Definition at line 493 of file GaudiCommon.h.

493 { return msgStream ( MSG::ERROR ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE>
bool GaudiCommon< PBASE >::errorsPrint ( ) const
inline

Print error counters at finalization ?

Definition at line 552 of file GaudiCommon.h.

552 { return m_errorsPrint ; }
bool m_errorsPrint
print warning and error counters at finalization ?
Definition: GaudiCommon.h:810
template<class PBASE>
bool GaudiCommon< PBASE >::errorsPrint ( ) const
inline

Print error counters at finalization ?

Definition at line 552 of file GaudiCommon.h.

552 { return m_errorsPrint ; }
bool m_errorsPrint
print warning and error counters at finalization ?
Definition: GaudiCommon.h:810
template<class PBASE>
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.

See also
GaudiException
Exceptions
GaudiExceptionalways thrown!
Parameters
msgException message
exc(previous) exception of type GaudiException
template<class PBASE >
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.

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

Definition at line 573 of file GaudiCommon.icpp.

576 {
577  // increase local counter of exceptions
578  ++m_exceptions[ msg ];
579  Print ( "Exception (re)throw: " + msg , sc , MSG::FATAL ).ignore();
580  throw GaudiException( this->name() + ":: " + msg , this->name() , sc, exc);
581 }
Define general base for Gaudi exception.
Counter m_exceptions
Counter of exceptions.
Definition: GaudiCommon.h:796
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.
MsgStream & msg() const
shortcut for the method msgStream ( MSG::INFO )
Definition: GaudiCommon.h:503
void ignore() const
Definition: StatusCode.h:107
template<class PBASE >
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.

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

Definition at line 588 of file GaudiCommon.icpp.

591 {
592  // increase local counter of exceptions
593  ++m_exceptions[ msg ];
594  Print ( "Exception (re)throw: " + msg , sc , MSG::FATAL ).ignore();
595  throw GaudiException( this->name() + ":: " + msg+"("+exc.what()+")", "", sc );
596 }
Define general base for Gaudi exception.
Counter m_exceptions
Counter of exceptions.
Definition: GaudiCommon.h:796
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.
MsgStream & msg() const
shortcut for the method msgStream ( MSG::INFO )
Definition: GaudiCommon.h:503
void ignore() const
Definition: StatusCode.h:107
template<class PBASE>
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.

See also
GaudiException
Exceptions
std::exceptionalways thrown!
Parameters
msgException message
exc(previous) exception of type std::exception
scStatusCode
template<class PBASE >
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.

See also
GaudiException
Exceptions
GaudiExceptionalways thrown!
Parameters
msgException message
scStatusCode

Definition at line 603 of file GaudiCommon.icpp.

605 {
606  // increase local counter of exceptions
607  ++m_exceptions[ msg ];
608  Print ( "Exception throw: " + msg , sc , MSG::FATAL ).ignore();
609  throw GaudiException( this->name() + ":: " + msg , "", sc );
610 }
Define general base for Gaudi exception.
Counter m_exceptions
Counter of exceptions.
Definition: GaudiCommon.h:796
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.
MsgStream & msg() const
shortcut for the method msgStream ( MSG::INFO )
Definition: GaudiCommon.h:503
void ignore() const
Definition: StatusCode.h:107
template<class PBASE>
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.

See also
GaudiException
Exceptions
GaudiExceptionalways thrown!
Parameters
msgException message
scStatusCode
template<class PBASE >
template<class TYPE >
bool GaudiCommon< PBASE >::exist ( IDataProviderSvc svc,
const std::string &  location,
const bool  useRootInTES = true 
) const
inline

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 91 of file GaudiCommonImp.h.

94 {
95  // check the environment
96  Assert( 0 != service , "exist():: IDataProvider* points to NULL!" ) ;
97  // check the data object
99  return checker ( service,
100  fullTESLocation ( location , useRootInTES ) ) ;
101 }
Helper structure for implementation of "exists"-functions for GaudiCommon
Definition: GetData.h:316
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.
const std::string fullTESLocation(const std::string &location, const bool useRootInTES) const
Returns the full correct event location given the rootInTes settings.
template<class PBASE>
template<class TYPE >
bool GaudiCommon< PBASE >::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.

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
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::fatal ( ) const
inline

shortcut for the method msgStream ( MSG::FATAL )

Definition at line 489 of file GaudiCommon.h.

489 { return msgStream ( MSG::FATAL ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::fatal ( ) const
inline

shortcut for the method msgStream ( MSG::FATAL )

Definition at line 489 of file GaudiCommon.h.

489 { return msgStream ( MSG::FATAL ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE >
StatusCode GaudiCommon< PBASE >::finalize ( )
virtual

standard finalization method

Returns
status code

Reimplemented in GaudiHistos< GaudiAlgorithm >, GaudiHistos< GaudiAlgorithm >, GaudiHistos< GaudiTool >, GaudiHistos< GaudiTool >, GaudiTuples< GaudiHistoTool >, GaudiTuples< GaudiHistoTool >, GaudiTuples< GaudiHistoAlg >, GaudiTuples< GaudiHistoAlg >, GaudiAlgorithm, GaudiAlgorithm, GaudiTool, GaudiTool, GaudiHistoTool, GaudiHistoTool, GaudiTupleTool, GaudiTupleTool, GaudiTupleAlg, GaudiTupleAlg, GaudiHistoAlg, GaudiHistoAlg, SequencerTimerTool, FuncMinimum, EqSolver, GaudiSequencer, GaudiSequencer, RecordOutputStream, JemallocProfile, ReplayOutputStream, Prescaler, Prescaler, and CallgrindProfile.

Definition at line 277 of file GaudiCommon.icpp.

278 {
280 
281  // print the general information about statistical counters
282  if ( msgLevel(MSG::DEBUG) || (statPrint() && !counters().empty()) )
283  {
284  // print general statistical counters
286  }
287  //add all counters to the CounterSummarySvc
288  if(m_counterSummarySvc && this->svcLoc()->existsService("CounterSummarySvc"))
289  {
290  if ( msgLevel(MSG::DEBUG) ) debug() << "adding counters to CounterSummarySvc" << endmsg;
291  for(Statistics::const_iterator i=this->counters().begin();
292  i!=this->counters().end();
293  i++)
294  {
296  m_counterSummarySvc->addCounter(this->name(),i->first,i->second,
299  m_counterSummarySvc->addCounter(this->name(),i->first,i->second);
300  }
301  }
302  // release all located tools and services
303  if ( msgLevel(MSG::DEBUG) )
304  {
305  debug() << "Tools to release :";
306  for ( AlgTools::const_iterator i = m_tools.begin();
307  i != m_tools.end(); ++i )
308  {
309  debug() << " " << (*i)->name();
310  }
311  debug() << endmsg;
312  }
313  while ( !m_tools.empty() ) { sc = sc && releaseTool( m_tools.back() ) ; }
314 
315  // release all located services
316  if ( msgLevel(MSG::DEBUG) )
317  {
318  debug() << "Services to release :";
320  i != m_services.end(); ++i )
321  {
322  debug() << " " << (*i).first;
323  }
324  debug() << endmsg;
325  }
326  while ( !m_services.empty() ) { sc = sc && releaseSvc( m_services.begin()->second ) ; }
327 
328  //release the CounterSummarySvc manually
330  {
332  m_counterSummarySvc=NULL;
333  }
334 
335  // format printout
336  if ( !m_errors.empty() || !m_warnings.empty() || !m_exceptions.empty() )
337  {
338  always() << "Exceptions/Errors/Warnings/Infos Statistics : "
339  << m_exceptions .size () << "/"
340  << m_errors .size () << "/"
341  << m_warnings .size () << "/"
342  << m_infos .size () << endmsg ;
343  if ( errorsPrint() ) { printErrors () ; }
344  }
345 
346  // delete the MsgStream
347  resetMsgStream();
348 
349  // clear *ALL* counters explicitly
350  m_counters .clear() ;
351  m_exceptions .clear() ;
352  m_infos .clear() ;
353  m_warnings .clear() ;
354  m_errors .clear() ;
355  m_counterList.clear() ;
356  m_statEntityList.clear() ;
357 
358  // finalize base class
359  return sc && PBASE::finalize();
360 }
ICounterSummarySvc * m_counterSummarySvc
a pointer to the CounterSummarySvc
Definition: GaudiCommon.h:98
Counter m_warnings
counter of warnings
Definition: GaudiCommon.h:792
AlgTools m_tools
List of active tools.
Definition: GaudiCommon.h:785
Counter m_exceptions
Counter of exceptions.
Definition: GaudiCommon.h:796
StatusCode releaseSvc(const IInterface *svc) const
manual forced (and 'safe') release of the service
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
std::vector< std::string > m_counterList
list of counters to declare. Set by property CounterList. This can be a regular expression.
Definition: GaudiCommon.h:100
Services m_services
List of active services.
Definition: GaudiCommon.h:787
void resetMsgStream() const
Reset (delete) the current message stream object.
Statistics m_counters
General counters.
Definition: GaudiCommon.h:798
bool matchOr(const std::string &test, const T &regexps)
return true if the string is in any of the regex's
Definition: RegEx.h:32
const Statistics & counters() const
accessor to all counters
Definition: GaudiCommon.h:507
MSG::Level msgLevel() const
The current message service output level.
Definition: GaudiCommon.h:532
bool statPrint() const
Print statistical counters at finalization ?
Definition: GaudiCommon.h:550
iterator end()
Definition: Map.h:131
Counter m_errors
Counter of errors.
Definition: GaudiCommon.h:790
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
bool empty() const
Definition: Map.h:182
virtual void addCounter(const std::string, const std::string name, const StatEntity &, const Gaudi::CounterSummary::SaveType saveType=Gaudi::CounterSummary::SaveSimpleCounter)=0
declare a counter, StatEntity, to be filled in the Counter summary
Counter m_infos
counter of infos
Definition: GaudiCommon.h:794
bool errorsPrint() const
Print error counters at finalization ?
Definition: GaudiCommon.h:552
MsgStream & debug() const
shortcut for the method msgStream ( MSG::DEBUG )
Definition: GaudiCommon.h:499
map_type::const_iterator const_iterator
Definition: Map.h:99
iterator begin()
Definition: Map.h:130
MsgStream & always() const
shortcut for the method msgStream ( MSG::ALWAYS )
Definition: GaudiCommon.h:487
virtual unsigned long release()=0
Release Interface instance.
StatusCode releaseTool(const IAlgTool *tool) const
manual forced (and 'safe') release of the tool
long printStat(const MSG::Level level=MSG::ALWAYS) const
perform the actual printout of statistical counters
std::vector< std::string > m_statEntityList
Definition: GaudiCommon.h:102
list i
Definition: ana.py:128
long printErrors(const MSG::Level level=MSG::ALWAYS) const
perform the actual printout of error counters
template<class PBASE >
const std::string GaudiCommon< PBASE >::fullTESLocation ( const std::string &  location,
const bool  useRootInTES 
) const
inline

Returns the full correct event location given the rootInTes settings.

Definition at line 25 of file GaudiCommonImp.h.

27 {
28  // The logic is:
29  // if no R.I.T., give back location
30  // if R.I.T., this is the mapping:
31  // (note that R.I.T. contains a trailing '/')
32  // location -> result
33  // -------------------------------------------------
34  // "" -> R.I.T.[:-1] ("rit")
35  // "/Event" -> R.I.T.[:-1] ("rit")
36  // "/Event/MyObj" -> R.I.T. + "MyObj" ("rit/MyObj")
37  // "MyObj" -> R.I.T. + "MyObj" ("rit/MyObj")
38  return ( !useRootInTES || rootInTES().empty() ?
39  location
40  :
41  location.empty() || ( location == "/Event" ) ?
42  rootInTES().substr(0,rootInTES().size()-1)
43  :
44  0 == location.find("/Event/") ?
45  rootInTES() + location.substr(7)
46  :
47  rootInTES() + location );
48 }
const std::string & rootInTES() const
Returns the "rootInTES" string.
Definition: GaudiCommon.h:758
template<class PBASE>
const std::string GaudiCommon< PBASE >::fullTESLocation ( const std::string &  location,
const bool  useRootInTES 
) const

Returns the full correct event location given the rootInTes settings.

template<class PBASE>
template<class TYPE >
Gaudi::Utils::GetData<TYPE>::return_type GaudiCommon< PBASE >::get ( IDataProviderSvc service,
const std::string &  location,
const bool  useRootInTES 
) const
inline

Definition at line 55 of file GaudiCommonImp.h.

58 {
59  // check the environment
60  Assert( 0 != service , "get():: IDataProvider* points to NULL!" ) ;
61  // get the helper object:
63  return getter ( *this ,
64  service ,
65  fullTESLocation ( location , useRootInTES ) ) ;
66 }
Helper structure for implementation of "get"-functions for GaudiCommon
Definition: GaudiCommon.h:36
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.
const std::string fullTESLocation(const std::string &location, const bool useRootInTES) const
Returns the full correct event location given the rootInTes settings.
template<class PBASE>
template<class TYPE >
Gaudi::Utils::GetData<TYPE>::return_type GaudiCommon< PBASE >::get ( IDataProviderSvc service,
const std::string &  location,
const bool  useRootInTES 
) const
inline

Definition at line 55 of file GaudiCommonImp.h.

58 {
59  // check the environment
60  Assert( 0 != service , "get():: IDataProvider* points to NULL!" ) ;
61  // get the helper object:
63  return getter ( *this ,
64  service ,
65  fullTESLocation ( location , useRootInTES ) ) ;
66 }
Helper structure for implementation of "get"-functions for GaudiCommon
Definition: GaudiCommon.h:36
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.
const std::string fullTESLocation(const std::string &location, const bool useRootInTES) const
Returns the full correct event location given the rootInTes settings.
template<class PBASE>
template<class TYPE >
Gaudi::Utils::GetData<TYPE>::return_type GaudiCommon< PBASE >::get ( IDataProviderSvc svc,
const std::string &  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
template<class PBASE>
template<class TYPE >
Gaudi::Utils::GetData<TYPE>::return_type GaudiCommon< PBASE >::get ( IDataProviderSvc svc,
const std::string &  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
template<class PBASE>
template<class TYPE >
Gaudi::Utils::GetData<TYPE>::return_type GaudiCommon< PBASE >::getIfExists ( IDataProviderSvc service,
const std::string &  location,
const bool  useRootInTES 
) const
inline

Definition at line 73 of file GaudiCommonImp.h.

76 {
77  // check the environment
78  Assert( 0 != service , "get():: IDataProvider* points to NULL!" ) ;
79  // get the helper object:
81  return getter ( *this ,
82  service ,
83  fullTESLocation ( location , useRootInTES ),
84  false) ;
85 }
Helper structure for implementation of "get"-functions for GaudiCommon
Definition: GaudiCommon.h:36
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.
const std::string fullTESLocation(const std::string &location, const bool useRootInTES) const
Returns the full correct event location given the rootInTes settings.
template<class PBASE>
template<class TYPE >
Gaudi::Utils::GetData<TYPE>::return_type GaudiCommon< PBASE >::getIfExists ( IDataProviderSvc service,
const std::string &  location,
const bool  useRootInTES 
) const
inline

Definition at line 73 of file GaudiCommonImp.h.

76 {
77  // check the environment
78  Assert( 0 != service , "get():: IDataProvider* points to NULL!" ) ;
79  // get the helper object:
81  return getter ( *this ,
82  service ,
83  fullTESLocation ( location , useRootInTES ),
84  false) ;
85 }
Helper structure for implementation of "get"-functions for GaudiCommon
Definition: GaudiCommon.h:36
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.
const std::string fullTESLocation(const std::string &location, const bool useRootInTES) const
Returns the full correct event location given the rootInTes settings.
template<class PBASE>
template<class TYPE >
Gaudi::Utils::GetData<TYPE>::return_type GaudiCommon< PBASE >::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.

template<class PBASE>
template<class TYPE >
Gaudi::Utils::GetData<TYPE>::return_type GaudiCommon< PBASE >::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.

template<class PBASE>
template<class TYPE , class TYPE2 >
Gaudi::Utils::GetData<TYPE>::return_type GaudiCommon< PBASE >::getOrCreate ( IDataProviderSvc service,
const std::string &  location,
const bool  useRootInTES 
) const
inline

Definition at line 110 of file GaudiCommonImp.h.

113 {
114  // check the environment
115  Assert ( 0 != service , "getOrCreate():: svc points to NULL!" ) ;
116  // get the helper object
118  return getter ( *this ,
119  service ,
120  fullTESLocation( location, useRootInTES ) ,
121  location ) ;
122 }
Helper structure for implementation of "getOrCreate"-functions for GaudiCommon ...
Definition: GetData.h:404
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.
const std::string fullTESLocation(const std::string &location, const bool useRootInTES) const
Returns the full correct event location given the rootInTes settings.
template<class PBASE>
template<class TYPE , class TYPE2 >
Gaudi::Utils::GetData<TYPE>::return_type GaudiCommon< PBASE >::getOrCreate ( IDataProviderSvc service,
const std::string &  location,
const bool  useRootInTES 
) const
inline

Definition at line 110 of file GaudiCommonImp.h.

113 {
114  // check the environment
115  Assert ( 0 != service , "getOrCreate():: svc points to NULL!" ) ;
116  // get the helper object
118  return getter ( *this ,
119  service ,
120  fullTESLocation( location, useRootInTES ) ,
121  location ) ;
122 }
Helper structure for implementation of "getOrCreate"-functions for GaudiCommon ...
Definition: GetData.h:404
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.
const std::string fullTESLocation(const std::string &location, const bool useRootInTES) const
Returns the full correct event location given the rootInTes settings.
template<class PBASE>
template<class TYPE , class TYPE2 >
Gaudi::Utils::GetData<TYPE>::return_type GaudiCommon< PBASE >::getOrCreate ( IDataProviderSvc svc,
const std::string &  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
template<class PBASE>
template<class TYPE , class TYPE2 >
Gaudi::Utils::GetData<TYPE>::return_type GaudiCommon< PBASE >::getOrCreate ( IDataProviderSvc svc,
const std::string &  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
template<class PBASE>
double GaudiCommon< PBASE >::globalTimeOffset ( ) const
inline

Returns the "globalTimeOffset" double.

Definition at line 760 of file GaudiCommon.h.

760 { return m_globalTimeOffset; }
double m_globalTimeOffset
The globalTimeOffset value.
Definition: GaudiCommon.h:821
template<class PBASE>
double GaudiCommon< PBASE >::globalTimeOffset ( ) const
inline

Returns the "globalTimeOffset" double.

Definition at line 760 of file GaudiCommon.h.

760 { return m_globalTimeOffset; }
double m_globalTimeOffset
The globalTimeOffset value.
Definition: GaudiCommon.h:821
template<class PBASE>
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 error 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
template<class PBASE >
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 error 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 524 of file GaudiCommon.icpp.

527 {
528  // increase local counter of warnings
529  const size_t num = ++m_infos[msg] ;
530  // If suppressed, just return
531  if ( num > mx ) { return st ; }
532  else if ( num == mx ) // issue one-time suppression message
533  { return Print ( "The INFO message is suppressed : '" +
534  msg + "'" , st , MSG::INFO ) ; }
535  // return message
536  return Print ( msg , st , MSG::INFO ) ;
537 }
Counter m_infos
counter of infos
Definition: GaudiCommon.h:794
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.
MsgStream & msg() const
shortcut for the method msgStream ( MSG::INFO )
Definition: GaudiCommon.h:503
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::info ( ) const
inline

shortcut for the method msgStream ( MSG::INFO )

Definition at line 497 of file GaudiCommon.h.

497 { return msgStream ( MSG::INFO ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::info ( ) const
inline

shortcut for the method msgStream ( MSG::INFO )

Definition at line 497 of file GaudiCommon.h.

497 { return msgStream ( MSG::INFO ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE >
void GaudiCommon< PBASE >::initGaudiCommonConstructor ( const IInterface parent = 0)
private

Constructor initializations.

< flag to use the special "efficiency" format

Definition at line 63 of file GaudiCommon.icpp.

64 {
65  // initialise data members
67  m_msgStream = 0;
68  m_updMgrSvc = 0;
69  m_typePrint = true;
70  m_propsPrint = false;
71  m_statPrint = true;
72  m_errorsPrint = true;
73  m_context = "" ;
74  m_rootInTES = "" ;
75  m_globalTimeOffset = 0.0 ;
76  //data members for the CounterSummarySvc
78  m_counterList=std::vector<std::string>(1,".*");
79  m_statEntityList=std::vector<std::string>(0);
80 
81  // printout of counters:
82 
83  // the header row for counters printout
84  m_header = " | Counter | # | sum | mean/eff^* | rms/err^* | min | max |" ;
85  // format for regular statistical printout rows
86  m_format1 = " | %|-48.48s|%|50t||%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |" ;
87  // format for "efficiency" statistical printout rows
88  m_format2 = " |*%|-48.48s|%|50t||%|10d| |%|11.5g| |(%|#9.6g| +- %|-#9.6g|)%%| ------- | ------- |" ;
89  // flag to use the special "efficiency" format
90  m_useEffFormat = true ;
91 
92  // job options
93  // print error counters at finalization ?
94  this->declareProperty
95  ( "ErrorsPrint" , m_errorsPrint ,
96  "Print the statistics of errors/warnings/exceptions")
97  -> declareUpdateHandler
99  // print properties at initialization?
100  this->declareProperty
101  ( "PropertiesPrint" , m_propsPrint ,
102  "Print the properties of the component ")
103  -> declareUpdateHandler
105  // print statistical counters at finalization ?
106  this->declareProperty
107  ( "StatPrint" , m_statPrint ,
108  "Print the table of counters" )
109  -> declareUpdateHandler
111  // insert the actual C++ type of the algorithm or tool in the messages?
112  this->declareProperty
113  ( "TypePrint" , m_typePrint ,
114  "Add the actal C++ component type into the messages" ) ;
115  // context
116  this->declareProperty ( "Context" , m_context ) ;
117  // root in TES
118  this->declareProperty ( "RootInTES" , m_rootInTES ) ;
119  // root on TES ( temporary )
120  this->declareProperty ( "RootOnTES" , m_rootOnTES ) ;
121  // global time offset
122  this->declareProperty ( "GlobalTimeOffset", m_globalTimeOffset ) ;
123 
124 
125  // the header row for counters printout
126  this->declareProperty
127  ( "StatTableHeader" , m_header ,
128  "The header row for the output Stat-table" ) ;
129  // format for regular statistical printout rows
130  this->declareProperty
131  ( "RegularRowFormat" , m_format1 ,
132  "The format for the regular row in the output Stat-table" ) ;
133  // format for "efficiency" statistical printout rows
134  this->declareProperty
135  ( "EfficiencyRowFormat" , m_format2 ,
136  "The format for the regular row in the output Stat-table" ) ;
137  // flag to use the special "efficiency" format
138  this->declareProperty
139  ( "UseEfficiencyRowFormat" , m_useEffFormat ,
140  "Use the special format for printout of efficiency counters" ) ;
141 
142 
143  //declare the list of simple counters to write.
144  this->declareProperty(
145  "CounterList",
146  m_counterList=std::vector<std::string>(1,".*"),
147  "RegEx list, of simple integer counters for CounterSummary.");
148  //declare the list of stat entities to write.
149  this->declareProperty(
150  "StatEntityList",
151  m_statEntityList=std::vector<std::string>(0),
152  "RegEx list, of StatEntity counters for CounterSummary.");
153 
154  // add handler for message level changes
155  this->outputLevelProperty().declareUpdateHandler( &GaudiCommon<PBASE>::msgLevelHandler, this );
156 
157  // setup context from parent if available
158  if ( parent )
159  {
160  if ( const GaudiAlgorithm* gAlg = dynamic_cast<const GaudiAlgorithm*>(parent) )
161  {
162  m_context = gAlg->context();
163  m_rootInTES = gAlg->rootInTES();
164  m_globalTimeOffset = gAlg->globalTimeOffset();
165  }
166  else if ( const GaudiTool* gTool = dynamic_cast<const GaudiTool*> (parent) )
167  {
168  m_context = gTool->context();
169  m_rootInTES = gTool->rootInTES();
170  m_globalTimeOffset = gTool->globalTimeOffset();
171  }
172  }
173 
174  // Get the job option service
175  SmartIF<IJobOptionsSvc> jos(PBASE::service("JobOptionsSvc"));
176  if (!jos.isValid()) Exception("Cannot get JobOptionsSvc");
177 
178  // Get the "Context" option if in the file...
179  const std::vector<const Property*>* myList = jos->getProperties( this->name() );
180  if ( 0 != myList )
181  {
182  // Iterate over the list to set the options
183  for ( std::vector<const Property*>::const_iterator iter = myList->begin();
184  iter != myList->end();
185  ++iter )
186  {
187  const StringProperty* sp = dynamic_cast<const StringProperty*>(*iter);
188  if ( 0 != sp )
189  {
190  if ( "Context" == (*iter)->name() )
191  {
192  m_context = sp->value();
193  } else if ( "RootInTES" == (*iter)->name() ) {
194  m_rootInTES = sp->value();
195  } else if ( "GlobalTimeOffset" == (*iter)->name() ) {
196  m_globalTimeOffset = atof( sp->value().c_str() );
197  }
198  }
199  }
200  }
201 
202 }
ICounterSummarySvc * m_counterSummarySvc
a pointer to the CounterSummarySvc
Definition: GaudiCommon.h:98
double m_globalTimeOffset
The globalTimeOffset value.
Definition: GaudiCommon.h:821
std::string m_rootOnTES
The rootOnTES string.
Definition: GaudiCommon.h:819
std::vector< std::string > m_counterList
list of counters to declare. Set by property CounterList. This can be a regular expression.
Definition: GaudiCommon.h:100
bool m_typePrint
insert the actual C++ type of the algorithm in the messages?
Definition: GaudiCommon.h:804
bool m_useEffFormat
flag to use the special "efficiency" format
Definition: GaudiCommon.h:830
std::string m_format1
format for regular statistical printout rows
Definition: GaudiCommon.h:826
std::string m_rootInTES
The rootInTES string.
Definition: GaudiCommon.h:815
MsgStream * m_msgStream
The predefined message stream.
Definition: GaudiCommon.h:783
The useful base class for data processing algorithms.
IUpdateManagerSvc * m_updMgrSvc
Pointer to the Update Manager Service instance.
Definition: GaudiCommon.h:801
MSG::Level m_msgLevel
The message level.
Definition: GaudiCommon.h:780
std::string m_header
the header row
Definition: GaudiCommon.h:824
const TYPE & value() const
explicit conversion
Definition: Property.h:355
bool m_statPrint
print counters at finalization ?
Definition: GaudiCommon.h:808
std::string m_format2
format for "efficiency" statistical printout rows
Definition: GaudiCommon.h:828
The useful base class for tools.
Definition: GaudiTool.h:99
bool m_errorsPrint
print warning and error counters at finalization ?
Definition: GaudiCommon.h:810
Implements the common functionality between GaudiTools and GaudiAlgorithms.
Definition: GaudiCommon.h:59
std::vector< std::string > m_statEntityList
Definition: GaudiCommon.h:102
std::string m_context
The context string.
Definition: GaudiCommon.h:813
bool m_propsPrint
print properties at initialization?
Definition: GaudiCommon.h:806
void Exception(const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
Create and (re)-throw a given GaudiException.
template<class PBASE>
void GaudiCommon< PBASE >::initGaudiCommonConstructor ( const IInterface parent = 0)
private

Constructor initializations.

template<class PBASE >
StatusCode GaudiCommon< PBASE >::initialize ( )
virtual

standard initialization method

Returns
status code

Reimplemented in GaudiHistos< GaudiAlgorithm >, GaudiHistos< GaudiAlgorithm >, GaudiHistos< GaudiTool >, GaudiHistos< GaudiTool >, GaudiTuples< GaudiHistoTool >, GaudiTuples< GaudiHistoTool >, GaudiTuples< GaudiHistoAlg >, GaudiTuples< GaudiHistoAlg >, GaudiTool, GaudiTool, GaudiAlgorithm, GaudiAlgorithm, GaudiHistoTool, GaudiHistoTool, GaudiTupleTool, GaudiTupleTool, GaudiTupleAlg, GaudiTupleAlg, GaudiHistoAlg, GaudiHistoAlg, SequencerTimerTool, FuncMinimum, EqSolver, GaudiSequencer, GaudiSequencer, RecordOutputStream, JemallocProfile, Prescaler, ReplayOutputStream, Prescaler, and CallgrindProfile.

Definition at line 215 of file GaudiCommon.icpp.

216 {
217 
218  // initialize base class
219  const StatusCode sc = PBASE::initialize();
220  if ( sc.isFailure() )
221  { return Error ( "Failed to initialise base class PBASE", sc ) ; }
222 
223 
224  // some debug printout
225  if ( msgLevel(MSG::DEBUG) )
226  {
227  debug() << "Initialize base class GaudiCommon<" << System::typeinfoName(typeid(PBASE)) << ">" << endmsg;
228  if ( !context().empty() )
229  debug() << "Created with context = '" << context() << "'" << endmsg;
230  }
231 
232  // some temporary checks to see if people are using RootOnTES and warn if so
233  // TO BE REMOVED ASAP ...
234  if ( m_rootInTES.empty() && !m_rootOnTES.empty() )
235  {
237  Warning( "RootOnTES option is OBSOLETE -> Use RootInTES instead. RootInTES has been updated to "
239  }
240  else if ( !m_rootInTES.empty() && !m_rootOnTES.empty() )
241  {
242  Warning( "Options RootOnTES AND RootInTES are defined ! Use RootInTES. RootOnTES is ignored",
244  }
245 
246  // Check rootInTES ends with a /
247  if ( !m_rootInTES.empty() &&
248  m_rootInTES.substr(m_rootInTES.size()-1) != "/" ) m_rootInTES += "/";
249 
250  //Set up the CounterSummarySvc May need to be changed
251  this->svcLoc()->service("CounterSummarySvc",m_counterSummarySvc,false).ignore() ;
252  if (msgLevel(MSG::DEBUG))
253  {
254  if (m_counterSummarySvc==NULL )
255  debug() << "could not locate CounterSummarySvc, no counter summary will be made" << endmsg;
256  else debug() << "found CounterSummarySvc OK" << endmsg;
257  }
258 
259  // properties will be printed if asked for or in "MSG::DEBUG" mode
260  if ( propsPrint() ) { printProps(MSG::ALWAYS); }
261  else if ( msgLevel(MSG::DEBUG) ) { printProps(MSG::DEBUG); }
262 
263  return sc;
264 }
ICounterSummarySvc * m_counterSummarySvc
a pointer to the CounterSummarySvc
Definition: GaudiCommon.h:98
def initialize()
Definition: AnalysisTest.py:12
std::string m_rootOnTES
The rootOnTES string.
Definition: GaudiCommon.h:819
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
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.
const std::string & context() const
Returns the "context" string. Used to identify different processing states.
Definition: GaudiCommon.h:754
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
MSG::Level msgLevel() const
The current message service output level.
Definition: GaudiCommon.h:532
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
std::string m_rootInTES
The rootInTES string.
Definition: GaudiCommon.h:815
bool propsPrint() const
Print properties at initialization ?
Definition: GaudiCommon.h:548
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.
MsgStream & debug() const
shortcut for the method msgStream ( MSG::DEBUG )
Definition: GaudiCommon.h:499
void ignore() const
Definition: StatusCode.h:107
long printProps(const MSG::Level level=MSG::ALWAYS) const
perform the actual printout of properties
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::msg ( ) const
inline

shortcut for the method msgStream ( MSG::INFO )

Definition at line 503 of file GaudiCommon.h.

503 { return msgStream ( MSG::INFO ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::msg ( ) const
inline

shortcut for the method msgStream ( MSG::INFO )

Definition at line 503 of file GaudiCommon.h.

503 { return msgStream ( MSG::INFO ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE>
MSG::Level GaudiCommon< PBASE >::msgLevel ( ) const
inline

The current message service output level.

Returns
The current message level

Definition at line 532 of file GaudiCommon.h.

532 { return m_msgLevel ; }
MSG::Level m_msgLevel
The message level.
Definition: GaudiCommon.h:780
template<class PBASE>
MSG::Level GaudiCommon< PBASE >::msgLevel ( ) const
inline

The current message service output level.

Returns
The current message level

Definition at line 532 of file GaudiCommon.h.

532 { return m_msgLevel ; }
MSG::Level m_msgLevel
The message level.
Definition: GaudiCommon.h:780
template<class PBASE>
bool GaudiCommon< PBASE >::msgLevel ( const MSG::Level  level) const
inline

Test the output level.

Parameters
levelThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "level" will be printed
trueMessages at level "level" will NOT be printed

Definition at line 539 of file GaudiCommon.h.

539 { return msgLevel() <= level ; }
MSG::Level msgLevel() const
The current message service output level.
Definition: GaudiCommon.h:532
template<class PBASE>
bool GaudiCommon< PBASE >::msgLevel ( const MSG::Level  level) const
inline

Test the output level.

Parameters
levelThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "level" will be printed
trueMessages at level "level" will NOT be printed

Definition at line 539 of file GaudiCommon.h.

539 { return msgLevel() <= level ; }
MSG::Level msgLevel() const
The current message service output level.
Definition: GaudiCommon.h:532
template<class PBASE >
void GaudiCommon< PBASE >::msgLevelHandler ( Property theProp)
private

Handle method for changes in the Messaging levels.

Called whenever the property "OutputLevel" changes to perform all necessary actions locally.

Parameters
thePropReference to the Property that has changed

Definition at line 731 of file GaudiCommon.icpp.

732 {
733  // Force a new MsgStream object, to pick up the new settings
734  resetMsgStream();
735 
736  // adjust internal message level
737  m_msgLevel =
738  this->outputLevel() < (int) MSG::NIL ? MSG::NIL :
739  this->outputLevel() >= (int) MSG::NUM_LEVELS ? MSG::ALWAYS :
740  MSG::Level( this->outputLevel() ) ;
741 
742  // Keep MessageSvc up to date if needed
743  if ( this->msgSvc()->outputLevel(this->name()) != this->outputLevel() )
744  {
745  this->msgSvc()->setOutputLevel( this->name(), this->outputLevel() );
746  }
747 
748  // printout message
749  if ( msgLevel(MSG::DEBUG) )
750  {
751  debug() << "Property update for "
752  << theProp.name() << " : new value = " << this->outputLevel() << endmsg;
753  }
754 }
const std::string & name() const
property name
Definition: Property.h:47
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
void resetMsgStream() const
Reset (delete) the current message stream object.
MSG::Level msgLevel() const
The current message service output level.
Definition: GaudiCommon.h:532
MsgStream & debug() const
shortcut for the method msgStream ( MSG::DEBUG )
Definition: GaudiCommon.h:499
MSG::Level m_msgLevel
The message level.
Definition: GaudiCommon.h:780
template<class PBASE>
void GaudiCommon< PBASE >::msgLevelHandler ( Property theProp)
private

Handle method for changes in the Messaging levels.

Called whenever the property "OutputLevel" changes to perform all necessary actions locally.

Parameters
thePropReference to the Property that has changed
template<class PBASE >
MsgStream & GaudiCommon< PBASE >::msgStream ( const MSG::Level  level) const
inline

Predefined configurable message stream for the efficient printouts.

if ( a < 0 ) { msgStream( MSG::ERROR ) << "a = " << endmsg ; }
Returns
Reference to the predefined stream

Definition at line 228 of file GaudiCommonImp.h.

229 {
230  if ( !m_msgStream )
231  { m_msgStream = new MsgStream ( PBASE::msgSvc() , this->name() ) ; }
232  return *m_msgStream << level ;
233 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream * m_msgStream
The predefined message stream.
Definition: GaudiCommon.h:783
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::msgStream ( const MSG::Level  level) const
inline

Predefined configurable message stream for the efficient printouts.

if ( a < 0 ) { msgStream( MSG::ERROR ) << "a = " << endmsg ; }
Returns
Reference to the predefined stream
template<class PBASE>
GaudiCommon& GaudiCommon< PBASE >::operator= ( const GaudiCommon< PBASE > &  )
private
template<class PBASE>
GaudiCommon& GaudiCommon< PBASE >::operator= ( const GaudiCommon< PBASE > &  )
private
template<class PBASE>
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.

See also
MsgStream
IMessageSvc
StatusCode
Parameters
msgMessage to print
stStatusCode to return
levPrintout level for the given message
Returns
The given StatusCode
template<class PBASE >
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.

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 544 of file GaudiCommon.icpp.

547 {
548  // perform printout ?
549  if ( !msgLevel( lvl ) ) { return st ; } // RETURN
550 
551  // use the predefined stream
552  MsgStream& str = msgStream( lvl ) ;
553  if ( typePrint() ) { str << System::typeinfoName(typeid(*this)) << ":: " ; }
554  // print the message
555  str << msg ;
556  // test status code
557  if ( st.isSuccess() ) { }
558  else if ( StatusCode::FAILURE != st.getCode() )
559  { str << " StatusCode=" << st.getCode() ; }
560  else
561  { str << " StatusCode=FAILURE" ; }
562  // perform print operation
563  str << endmsg ;
564  // return
565  return st;
566 }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
unsigned long getCode() const
Get the status code by value.
Definition: StatusCode.h:92
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
MSG::Level msgLevel() const
The current message service output level.
Definition: GaudiCommon.h:532
MsgStream & msg() const
shortcut for the method msgStream ( MSG::INFO )
Definition: GaudiCommon.h:503
bool typePrint() const
Insert the actual C++ type of the algorithm/tool in the messages ?
Definition: GaudiCommon.h:546
template<class PBASE >
void GaudiCommon< PBASE >::printErrorHandler ( Property )
private

handler for "ErrorPrint" property

Definition at line 798 of file GaudiCommon.icpp.

799 {
800  // no action if not yet initialized
801  if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
802  if ( this -> errorsPrint() ) { this -> printErrors () ; }
803 }
bool errorsPrint() const
Print error counters at finalization ?
Definition: GaudiCommon.h:552
long printErrors(const MSG::Level level=MSG::ALWAYS) const
perform the actual printout of error counters
template<class PBASE>
void GaudiCommon< PBASE >::printErrorHandler ( Property )
private

handler for "ErrorPrint" property

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 648 of file GaudiCommon.icpp.

649 {
650  // format for printout
651  boost::format ftm ( " %s = %|.8s| %|23t| Message = '%s'" );
652 
653  { // print exceptions
654  for ( Counter::const_iterator excp = m_exceptions.begin() ;
655  excp != m_exceptions.end() ; ++excp )
656  {
658  << ( ftm % "#EXCEPTIONS" % excp->second % excp->first )
659  << endmsg;
660  }
661  }
662  { // print errors
663  for ( Counter::const_iterator error = m_errors.begin() ;
664  error != m_errors.end() ; ++error )
665  {
667  << ( ftm % "#ERRORS " % error->second % error->first )
668  << endmsg;
669  }
670  }
671  { // print warnings
672  for ( Counter::const_iterator warning = m_warnings.begin() ;
673  warning != m_warnings.end() ; ++warning )
674  {
676  << ( ftm % "#WARNINGS " % warning->second % warning->first )
677  << endmsg;
678  }
679  }
680  { // print warnings
681  for ( Counter::const_iterator info = m_infos.begin() ;
682  info != m_infos.end() ; ++info )
683  {
685  << ( ftm % "#INFOS " % info->second % info->first )
686  << endmsg;
687  }
688  }
689 
690  // return total number of errors+warnings+exceptions
691  return
692  m_exceptions .size () +
693  m_errors .size () +
694  m_warnings .size () +
695  m_infos .size () ;
696 }
MsgStream & warning() const
shortcut for the method msgStream ( MSG::WARNING )
Definition: GaudiCommon.h:495
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
Counter m_warnings
counter of warnings
Definition: GaudiCommon.h:792
MsgStream & info() const
shortcut for the method msgStream ( MSG::INFO )
Definition: GaudiCommon.h:497
Counter m_exceptions
Counter of exceptions.
Definition: GaudiCommon.h:796
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
MsgStream & error() const
shortcut for the method msgStream ( MSG::ERROR )
Definition: GaudiCommon.h:493
Counter m_errors
Counter of errors.
Definition: GaudiCommon.h:790
Counter m_infos
counter of infos
Definition: GaudiCommon.h:794
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:133
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
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 705 of file GaudiCommon.icpp.

706 {
707 
708  // print ALL properties
709  MsgStream& msg = msgStream ( level );
710  typedef std::vector<Property*> Properties;
711  const Properties& properties = this->getProperties() ;
712  msg << "List of ALL properties of "
713  << System::typeinfoName( typeid( *this ) ) << "/" << this->name()
714  << " #properties = " << properties.size() << endmsg ;
715  for ( Properties::const_reverse_iterator property
716  = properties.rbegin() ;
717  properties.rend() != property ; ++property )
718  {
719  msg << "Property ['Name': Value] = "
720  << ( **property)
721  << endmsg ;
722  }
723  return properties.size() ;
724 }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
MsgStream & msg() const
shortcut for the method msgStream ( MSG::INFO )
Definition: GaudiCommon.h:503
template<class PBASE>
long GaudiCommon< PBASE >::printProps ( const MSG::Level  level = MSG::ALWAYS) const

perform the actual printout of properties

Parameters
levelThe message level to print at
Returns
number of properties
template<class PBASE>
void GaudiCommon< PBASE >::printPropsHandler ( Property )
private

handler for "PropertiesPrint" property

template<class PBASE >
void GaudiCommon< PBASE >::printPropsHandler ( Property )
private

handler for "PropertiesPrint" property

Definition at line 808 of file GaudiCommon.icpp.

809 {
810  // no action if not yet initialized
811  if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
812  if ( this -> propsPrint() ) { this -> printProps ( MSG::ALWAYS ) ; }
813 }
bool propsPrint() const
Print properties at initialization ?
Definition: GaudiCommon.h:548
long printProps(const MSG::Level level=MSG::ALWAYS) const
perform the actual printout of properties
template<class PBASE >
long GaudiCommon< PBASE >::printStat ( const MSG::Level  level = MSG::ALWAYS) const

perform the actual printout of statistical counters

Parameters
levelThe message level to print at
Returns
number of active statistical counters

Definition at line 617 of file GaudiCommon.icpp.

618 {
619  // print statistics
620  if ( counters().empty() ) { return 0 ; }
621  MsgStream& msg = msgStream ( level ) ;
622  //
623  msg << "Number of counters : " << counters().size() ;
624  //
625  if ( !counters().empty() ) { msg << std::endl << m_header ; }
626  //
627  for ( Statistics::const_iterator entry = counters().begin() ;
628  counters().end() != entry ; ++entry )
629  {
630  msg << std::endl
632  ( entry -> first ,
633  entry -> second ,
635  m_format1 , m_format2 );
636  }
637  //
638  msg << endmsg ;
639  //
640  return counters().size() ;
641 }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
const Statistics & counters() const
accessor to all counters
Definition: GaudiCommon.h:507
constexpr double second
bool m_useEffFormat
flag to use the special "efficiency" format
Definition: GaudiCommon.h:830
std::string m_format1
format for regular statistical printout rows
Definition: GaudiCommon.h:826
MsgStream & msg() const
shortcut for the method msgStream ( MSG::INFO )
Definition: GaudiCommon.h:503
std::string m_header
the header row
Definition: GaudiCommon.h:824
std::string m_format2
format for "efficiency" statistical printout rows
Definition: GaudiCommon.h:828
GAUDI_API std::string formatAsTableRow(const StatEntity &counter, const bool flag, const std::string &format1=" |%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |", const std::string &format2="*|%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%| ----- | ----- |")
print the counter in a form of the table row
Definition: StatEntity.cpp:302
template<class PBASE>
long GaudiCommon< PBASE >::printStat ( const MSG::Level  level = MSG::ALWAYS) const

perform the actual printout of statistical counters

Parameters
levelThe message level to print at
Returns
number of active statistical counters
template<class PBASE>
void GaudiCommon< PBASE >::printStatHandler ( Property )
private

handler for "StatPrint" property

template<class PBASE >
void GaudiCommon< PBASE >::printStatHandler ( Property )
private

handler for "StatPrint" property

Definition at line 818 of file GaudiCommon.icpp.

819 {
820  // no action if not yet initialized
821  if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
822  if ( this -> statPrint() ) { this -> printStat ( MSG::ALWAYS ) ; }
823 }
bool statPrint() const
Print statistical counters at finalization ?
Definition: GaudiCommon.h:550
long printStat(const MSG::Level level=MSG::ALWAYS) const
perform the actual printout of statistical counters
template<class PBASE>
bool GaudiCommon< PBASE >::propsPrint ( ) const
inline

Print properties at initialization ?

Definition at line 548 of file GaudiCommon.h.

548 { return m_propsPrint ; }
bool m_propsPrint
print properties at initialization?
Definition: GaudiCommon.h:806
template<class PBASE>
bool GaudiCommon< PBASE >::propsPrint ( ) const
inline

Print properties at initialization ?

Definition at line 548 of file GaudiCommon.h.

548 { return m_propsPrint ; }
bool m_propsPrint
print properties at initialization?
Definition: GaudiCommon.h:806
template<class PBASE>
DataObject* GaudiCommon< PBASE >::put ( IDataProviderSvc svc,
DataObject object,
const std::string &  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.
template<class PBASE >
DataObject * GaudiCommon< PBASE >::put ( IDataProviderSvc svc,
DataObject object,
const std::string &  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 765 of file GaudiCommon.icpp.

769 {
770  // check arguments
771  Assert ( 0 != svc , "put():: Invalid 'service'!" ) ;
772  Assert ( 0 != object , "put():: Invalid 'Object'!" ) ;
773  Assert ( !location.empty() , "put():: Invalid 'address' = '' " ) ;
774  // final data location
775  const std::string & fullLocation = fullTESLocation( location, useRootInTES );
776  // register the object!
777  const StatusCode status = '/' == fullLocation[0] ?
778  svc -> registerObject( fullLocation , object ) :
779  svc -> registerObject( "/Event/" + fullLocation , object ) ;
780  // check the result!
781  if ( status.isFailure() )
782  { Exception ( "put():: could not register '" +
783  System::typeinfoName( typeid( *object ) ) +
784  "' at address '" + fullLocation + "'" , status ) ; }
785  if ( msgLevel( MSG::DEBUG ) )
786  { Print( "The object of type '" +
787  System::typeinfoName( typeid( *object ) ) +
788  "' is registered in TS at address '"
789  + fullLocation + "'" , status , MSG::DEBUG ).ignore() ; }
790  return object;
791 }
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
MSG::Level msgLevel() const
The current message service output level.
Definition: GaudiCommon.h:532
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
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.
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.
const std::string fullTESLocation(const std::string &location, const bool useRootInTES) const
Returns the full correct event location given the rootInTes settings.
void ignore() const
Definition: StatusCode.h:107
void Exception(const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
Create and (re)-throw a given GaudiException.
template<class PBASE>
template<class CallerClass >
void GaudiCommon< PBASE >::registerCondition ( const std::string &  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.
// ...
registerCondition("/dd/Conditions/Readout/MyDet/MyCond",&MyAlg::i_CallBack);
registerCondition<MyAlg>("/dd/Conditions/Readout/MyDet/MyOtherCond");
// ...
}

Definition at line 595 of file GaudiCommon.h.

595  {
596  updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf);
597  }
IUpdateManagerSvc * updMgrSvc() const
Short-cut to locate the Update Manager Service.
void registerCondition(CallerClass *instance, const std::string &condition="", typename ObjectMemberFunction< CallerClass >::MemberFunctionType mf=NULL)
Register an object (algorithm instance) to the service.
template<class PBASE>
template<class CallerClass >
void GaudiCommon< PBASE >::registerCondition ( const std::string &  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.
// ...
registerCondition("/dd/Conditions/Readout/MyDet/MyCond",&MyAlg::i_CallBack);
registerCondition<MyAlg>("/dd/Conditions/Readout/MyDet/MyOtherCond");
// ...
}

Definition at line 595 of file GaudiCommon.h.

595  {
596  updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf);
597  }
IUpdateManagerSvc * updMgrSvc() const
Short-cut to locate the Update Manager Service.
void registerCondition(CallerClass *instance, const std::string &condition="", typename ObjectMemberFunction< CallerClass >::MemberFunctionType mf=NULL)
Register an object (algorithm instance) to the service.
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;
// ...
};
// ...
registerCondition("/dd/Conditions/Readout/MyDet/MyCond",m_MyCond,&MyAlg::i_CallBack);
registerCondition<MyAlg>("/dd/Conditions/Readout/MyDet/MyOtherCond",m_MyOtherCond);
// ...
}

Definition at line 629 of file GaudiCommon.h.

630  {
631  updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf,condPtrDest);
632  }
IUpdateManagerSvc * updMgrSvc() const
Short-cut to locate the Update Manager Service.
void registerCondition(CallerClass *instance, const std::string &condition="", typename ObjectMemberFunction< CallerClass >::MemberFunctionType mf=NULL)
Register an object (algorithm instance) to the service.
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;
// ...
};
// ...
registerCondition("/dd/Conditions/Readout/MyDet/MyCond",m_MyCond,&MyAlg::i_CallBack);
registerCondition<MyAlg>("/dd/Conditions/Readout/MyDet/MyOtherCond",m_MyOtherCond);
// ...
}

Definition at line 629 of file GaudiCommon.h.

630  {
631  updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf,condPtrDest);
632  }
IUpdateManagerSvc * updMgrSvc() const
Short-cut to locate the Update Manager Service.
void registerCondition(CallerClass *instance, const std::string &condition="", typename ObjectMemberFunction< CallerClass >::MemberFunctionType mf=NULL)
Register an object (algorithm instance) to the service.
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 635 of file GaudiCommon.h.

635  {
636  updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),std::string(condition),mf);
637  }
IUpdateManagerSvc * updMgrSvc() const
Short-cut to locate the Update Manager Service.
void registerCondition(CallerClass *instance, const std::string &condition="", typename ObjectMemberFunction< CallerClass >::MemberFunctionType mf=NULL)
Register an object (algorithm instance) to the service.
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 635 of file GaudiCommon.h.

635  {
636  updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),std::string(condition),mf);
637  }
IUpdateManagerSvc * updMgrSvc() const
Short-cut to locate the Update Manager Service.
void registerCondition(CallerClass *instance, const std::string &condition="", typename ObjectMemberFunction< CallerClass >::MemberFunctionType mf=NULL)
Register an object (algorithm instance) to the service.
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.
// ...
registerCondition("/dd/Conditions/Readout/MyDet/MyCond",&MyAlg::i_CallBack);
registerCondition<MyAlg>("/dd/Conditions/Readout/MyDet/MyOtherCond");
// ...
}

Definition at line 654 of file GaudiCommon.h.

654  {
655  updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf);
656  }
IUpdateManagerSvc * updMgrSvc() const
Short-cut to locate the Update Manager Service.
void registerCondition(CallerClass *instance, const std::string &condition="", typename ObjectMemberFunction< CallerClass >::MemberFunctionType mf=NULL)
Register an object (algorithm instance) to the service.
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.
// ...
registerCondition("/dd/Conditions/Readout/MyDet/MyCond",&MyAlg::i_CallBack);
registerCondition<MyAlg>("/dd/Conditions/Readout/MyDet/MyOtherCond");
// ...
}

Definition at line 654 of file GaudiCommon.h.

654  {
655  updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf);
656  }
IUpdateManagerSvc * updMgrSvc() const
Short-cut to locate the Update Manager Service.
void registerCondition(CallerClass *instance, const std::string &condition="", typename ObjectMemberFunction< CallerClass >::MemberFunctionType mf=NULL)
Register an object (algorithm instance) to the service.
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
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 371 of file GaudiCommon.icpp.

372 {
373  if ( 0 == interface )
374  { return Error ( "release(IInterface):: IInterface* points to NULL!" ) ; }
375  // dispatch between tools and services
376  const IAlgTool* algTool = dynamic_cast<const IAlgTool*>( interface ) ;
377  // perform the actual release
378  return 0 != algTool ? releaseTool( algTool ) : releaseSvc( interface ) ;
379 }
StatusCode releaseSvc(const IInterface *svc) const
manual forced (and 'safe') release of the service
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.
StatusCode releaseTool(const IAlgTool *tool) const
manual forced (and 'safe') release of the tool
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
template<class PBASE>
virtual unsigned long GaudiCommon< PBASE >::release ( )
inlinevirtual

Un-hide IInterface::release (ICC warning #1125)

Definition at line 733 of file GaudiCommon.h.

733 { return PBASE::release(); }
template<class PBASE>
virtual unsigned long GaudiCommon< PBASE >::release ( )
inlinevirtual

Un-hide IInterface::release (ICC warning #1125)

Definition at line 733 of file GaudiCommon.h.

733 { return PBASE::release(); }
template<class PBASE>
StatusCode GaudiCommon< PBASE >::releaseSvc ( const IInterface svc) const
protected

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

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

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

Definition at line 423 of file GaudiCommon.icpp.

424 {
425  if( 0 == Svc ) {
426  return Error ( "releaseSvc(IInterface):: IInterface* points to NULL!" ) ;
427  }
428  SmartIF<IService> svc(const_cast<IInterface*>(Svc));
429  if (svc.isValid()) {
430  Services::iterator it = m_services.find(svc->name());
431  if (it == m_services.end()) {
432  return Warning( "releaseSvc(IInterface):: IInterface* is not active" );
433  }
434  if ( msgLevel(MSG::DEBUG) ) {
435  debug() << "Releasing service '" << it->first << "'" << endmsg;
436  }
437  m_services.erase(it);
438  return StatusCode::SUCCESS;
439  }
440  return Warning( "releaseSvc(IInterface):: IInterface* is not a service" );
441 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Services m_services
List of active services.
Definition: GaudiCommon.h:787
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.
MSG::Level msgLevel() const
The current message service output level.
Definition: GaudiCommon.h:532
void erase(iterator pos)
Definition: Map.h:173
iterator end()
Definition: Map.h:131
iterator find(const key_type &key)
Definition: Map.h:148
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.
MsgStream & debug() const
shortcut for the method msgStream ( MSG::DEBUG )
Definition: GaudiCommon.h:499
map_type::iterator iterator
Definition: Map.h:98
SmartIF< SERVICE > svc(const std::string &name, const bool create=true) const
A useful method for the easy location of services.
template<class PBASE >
StatusCode GaudiCommon< PBASE >::releaseTool ( const IAlgTool tool) const
protected

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

Definition at line 386 of file GaudiCommon.icpp.

387 {
388  if( 0 == algTool )
389  { return Error ( "releaseTool(IAlgTool):: IAlgTool* points to NULL!" ) ; }
390  if( this->toolSvc() == 0 )
391  { return Error ( "releaseTool(IAlgTool):: IToolSvc* points to NULL!" ) ; }
392  // find a tool in the list of active tools
393  AlgTools::reverse_iterator it =
394  std::find( m_tools.rbegin() , m_tools.rend() , algTool ) ;
395  if( m_tools.rend() == it )
396  { return Warning("releaseTool(IAlgTool):: IAlgTool* is not active" ) ; }
397  // get the tool
398  IAlgTool* t = *it ;
399  // cache name
400  const std::string name = t->name();
401  if ( msgLevel(MSG::DEBUG) )
402  { debug() << "Releasing tool '" << name << "'" << endmsg; }
403  // remove the tool from the lists
404  m_tools.erase( --it.base() ) ;
405  // release tool
406  if ( msgLevel(MSG::DEBUG) ) {
407  this->debug() << "The tool '" << t->name() << "' of type '"
408  << System::typeinfoName(typeid(*t))
409  << "' is released" << endmsg;
410  }
411  const StatusCode sc = this->toolSvc()->releaseTool( t ) ;
412  if ( sc.isFailure() )
413  { return Warning ( "releaseTool(IAlgTool):: error from IToolSvc whilst releasing "+name , sc ) ; }
414  // return final status code
415  return sc ;
416 }
AlgTools m_tools
List of active tools.
Definition: GaudiCommon.h:785
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
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.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
MSG::Level msgLevel() const
The current message service output level.
Definition: GaudiCommon.h:532
virtual const std::string & name() const =0
Retrieve the name of the instance.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
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.
MsgStream & debug() const
shortcut for the method msgStream ( MSG::DEBUG )
Definition: GaudiCommon.h:499
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
template<class PBASE>
StatusCode GaudiCommon< PBASE >::releaseTool ( const IAlgTool tool) const
protected

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

template<class PBASE >
void GaudiCommon< PBASE >::resetMsgStream ( ) const
inline

Reset (delete) the current message stream object.

Useful for example to force a new object following a change in the message level settings

Definition at line 248 of file GaudiCommonImp.h.

249 {
250  if ( 0 != m_msgStream ) { delete m_msgStream; m_msgStream = 0; }
251 }
MsgStream * m_msgStream
The predefined message stream.
Definition: GaudiCommon.h:783
template<class PBASE>
void GaudiCommon< PBASE >::resetMsgStream ( ) const

Reset (delete) the current message stream object.

Useful for example to force a new object following a change in the message level settings

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

Returns the "rootInTES" string.

Used as the directory root in the TES for which all data access refers to (both saving and retrieving).

Definition at line 758 of file GaudiCommon.h.

758 { return m_rootInTES; }
std::string m_rootInTES
The rootInTES string.
Definition: GaudiCommon.h:815
template<class PBASE>
const std::string& GaudiCommon< PBASE >::rootInTES ( ) const
inline

Returns the "rootInTES" string.

Used as the directory root in the TES for which all data access refers to (both saving and retrieving).

Definition at line 758 of file GaudiCommon.h.

758 { return m_rootInTES; }
std::string m_rootInTES
The rootInTES string.
Definition: GaudiCommon.h:815
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 668 of file GaudiCommon.h.

668 { return updMgrSvc()->update(this); }
IUpdateManagerSvc * updMgrSvc() const
Short-cut to locate the Update Manager Service.
StatusCode update(CallerClass *instance)
Update the given instance.
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 668 of file GaudiCommon.h.

668 { return updMgrSvc()->update(this); }
IUpdateManagerSvc * updMgrSvc() const
Short-cut to locate the Update Manager Service.
StatusCode update(CallerClass *instance)
Update the given instance.
template<class PBASE>
const Services& GaudiCommon< PBASE >::services ( ) const
inline

get the list of aquired services

Definition at line 740 of file GaudiCommon.h.

740 { return m_services ; } // get all services
Services m_services
List of active services.
Definition: GaudiCommon.h:787
template<class PBASE>
const Services& GaudiCommon< PBASE >::services ( ) const
inline

get the list of aquired services

Definition at line 740 of file GaudiCommon.h.

740 { return m_services ; } // get all services
Services m_services
List of active services.
Definition: GaudiCommon.h:787
template<class PBASE>
bool GaudiCommon< PBASE >::statPrint ( ) const
inline

Print statistical counters at finalization ?

Definition at line 550 of file GaudiCommon.h.

550 { return m_statPrint ; }
bool m_statPrint
print counters at finalization ?
Definition: GaudiCommon.h:808
template<class PBASE>
bool GaudiCommon< PBASE >::statPrint ( ) const
inline

Print statistical counters at finalization ?

Definition at line 550 of file GaudiCommon.h.

550 { return m_statPrint ; }
bool m_statPrint
print counters at finalization ?
Definition: GaudiCommon.h:808
template<class PBASE>
template<class SERVICE >
SmartIF<SERVICE> GaudiCommon< PBASE >::svc ( const std::string &  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
template<class PBASE >
template<class SERVICE >
SmartIF< SERVICE > GaudiCommon< PBASE >::svc ( const std::string &  name,
const bool  create = true 
) const
inline

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 184 of file GaudiCommonImp.h.

186 {
187  Assert ( this->svcLoc() != 0, "ISvcLocator* points to NULL!" );
189  // check if we already have this service
191  if (it != m_services.end()) {
192  // Try to get the requested interface
193  s = it->second;
194  // check the results
195  if ( !s.isValid() ) {
196  Exception ("svc():: Could not retrieve Svc '" + name + "'", StatusCode::FAILURE);
197  }
198  } else {
199  SmartIF<IService>& baseSvc = this->svcLoc()->service(name, create);
200  // Try to get the requested interface
201  s = baseSvc;
202  // check the results
203  if ( !baseSvc.isValid() || !s.isValid() ) {
204  Exception ("svc():: Could not retrieve Svc '" + name + "'", StatusCode::FAILURE);
205  }
206  // add the tool into list of known tools, to be properly released
207  addToServiceList(baseSvc);
208  }
209  // return *VALID* located service
210  return s;
211 }
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
void addToServiceList(const SmartIF< IService > &svc) const
Add the given service to the list of acquired services.
Services m_services
List of active services.
Definition: GaudiCommon.h:787
iterator end()
Definition: Map.h:131
iterator find(const key_type &key)
Definition: Map.h:148
map_type::iterator iterator
Definition: Map.h:98
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
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.
string s
Definition: gaudirun.py:244
void Exception(const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
Create and (re)-throw a given GaudiException.
template<class PBASE>
template<class TOOL >
TOOL* GaudiCommon< PBASE >::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.

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
template<class PBASE >
template<class TOOL >
TOOL * GaudiCommon< PBASE >::tool ( const std::string &  type,
const std::string &  name,
const IInterface parent = 0,
bool  create = true 
) const
inline

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 128 of file GaudiCommonImp.h.

132 {
133  TOOL* Tool = 0 ;
134  // for empty names delegate to another method
135  if ( name.empty() )
136  {
137  Tool = tool<TOOL>( type , parent , create ) ;
138  }
139  else
140  {
141  Assert( this->toolSvc() != 0, "tool():: IToolSvc* points to NULL!" ) ;
142  // get the tool from Tool Service
143  const StatusCode sc =
144  this->toolSvc()->retrieveTool ( type , name , Tool , parent , create ) ;
145  if ( sc.isFailure() )
146  { Exception("tool():: Could not retrieve Tool '" + type + "'/'" + name + "'", sc ) ; }
147  if ( 0 == Tool )
148  { Exception("tool():: Could not retrieve Tool '" + type + "'/'" + name + "'" ) ; }
149  // add the tool into list of known tools to be properly released
150  addToToolList( Tool );
151  }
152  // return *VALID* located tool
153  return Tool ;
154 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
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.
void addToToolList(IAlgTool *tool) const
Add the given tool to the list of acquired tools.
string type
Definition: gaudirun.py:151
void Exception(const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
Create and (re)-throw a given GaudiException.
template<class PBASE>
template<class TOOL >
TOOL* GaudiCommon< PBASE >::tool ( const std::string &  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
template<class PBASE >
template<class TOOL >
TOOL * GaudiCommon< PBASE >::tool ( const std::string &  type,
const IInterface parent = 0,
bool  create = true 
) const
inline

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 160 of file GaudiCommonImp.h.

163 {
164  // check the environment
165  Assert ( PBASE::toolSvc() != 0, "IToolSvc* points to NULL!" );
166  // retrieve the tool from Tool Service
167  TOOL* Tool = 0 ;
168  const StatusCode sc =
169  this->toolSvc() -> retrieveTool ( type, Tool, parent , create );
170  if ( sc.isFailure() )
171  { Exception("tool():: Could not retrieve Tool '" + type + "'", sc ) ; }
172  if ( 0 == Tool )
173  { Exception("tool():: Could not retrieve Tool '" + type + "'" ) ; }
174  // add the tool into the list of known tools to be properly released
175  addToToolList( Tool );
176  // return *VALID* located tool
177  return Tool ;
178 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
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.
void addToToolList(IAlgTool *tool) const
Add the given tool to the list of acquired tools.
string type
Definition: gaudirun.py:151
void Exception(const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
Create and (re)-throw a given GaudiException.
template<class PBASE>
const AlgTools& GaudiCommon< PBASE >::tools ( ) const
inline

get the list of aquired tools

Definition at line 738 of file GaudiCommon.h.

738 { return m_tools ; } // get all tools
AlgTools m_tools
List of active tools.
Definition: GaudiCommon.h:785
template<class PBASE>
const AlgTools& GaudiCommon< PBASE >::tools ( ) const
inline

get the list of aquired tools

Definition at line 738 of file GaudiCommon.h.

738 { return m_tools ; } // get all tools
AlgTools m_tools
List of active tools.
Definition: GaudiCommon.h:785
template<class PBASE>
bool GaudiCommon< PBASE >::typePrint ( ) const
inline

Insert the actual C++ type of the algorithm/tool in the messages ?

Definition at line 546 of file GaudiCommon.h.

546 { return m_typePrint ; }
bool m_typePrint
insert the actual C++ type of the algorithm in the messages?
Definition: GaudiCommon.h:804
template<class PBASE>
bool GaudiCommon< PBASE >::typePrint ( ) const
inline

Insert the actual C++ type of the algorithm/tool in the messages ?

Definition at line 546 of file GaudiCommon.h.

546 { return m_typePrint ; }
bool m_typePrint
insert the actual C++ type of the algorithm in the messages?
Definition: GaudiCommon.h:804
template<class PBASE >
IUpdateManagerSvc * GaudiCommon< PBASE >::updMgrSvc ( ) const
inline

Short-cut to locate the Update Manager Service.

Definition at line 217 of file GaudiCommonImp.h.

218 {
219  if ( !m_updMgrSvc )
220  { m_updMgrSvc = svc<IUpdateManagerSvc>("UpdateManagerSvc",true); }
221  return m_updMgrSvc ;
222 }
IUpdateManagerSvc * m_updMgrSvc
Pointer to the Update Manager Service instance.
Definition: GaudiCommon.h:801
template<class PBASE>
IUpdateManagerSvc* GaudiCommon< PBASE >::updMgrSvc ( ) const
inline

Short-cut to locate the Update Manager Service.

template<class PBASE>
MsgStream& GaudiCommon< PBASE >::verbose ( ) const
inline

shortcut for the method msgStream ( MSG::VERBOSE )

Definition at line 501 of file GaudiCommon.h.

501 { return msgStream ( MSG::VERBOSE ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::verbose ( ) const
inline

shortcut for the method msgStream ( MSG::VERBOSE )

Definition at line 501 of file GaudiCommon.h.

501 { return msgStream ( MSG::VERBOSE ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE >
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 error 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 503 of file GaudiCommon.icpp.

506 {
507  // increase local counter of warnings
508  const size_t num = ++m_warnings[msg] ;
509  // If suppressed, just return
510  if ( num > mx ) { return st ; }
511  else if ( num == mx ) // issue one-time suppression message
512  { return Print ( "The WARNING message is suppressed : '" +
513  msg + "'" , st , MSG::WARNING ) ; }
514  // return message
515  return Print ( msg , st , MSG::WARNING ) ;
516 }
Counter m_warnings
counter of warnings
Definition: GaudiCommon.h:792
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.
MsgStream & msg() const
shortcut for the method msgStream ( MSG::INFO )
Definition: GaudiCommon.h:503
template<class PBASE>
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 error 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
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::warning ( ) const
inline

shortcut for the method msgStream ( MSG::WARNING )

Definition at line 495 of file GaudiCommon.h.

495 { return msgStream ( MSG::WARNING ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
template<class PBASE>
MsgStream& GaudiCommon< PBASE >::warning ( ) const
inline

shortcut for the method msgStream ( MSG::WARNING )

Definition at line 495 of file GaudiCommon.h.

495 { return msgStream ( MSG::WARNING ) ; }
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.

Member Data Documentation

template<class PBASE>
static 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 71 of file GaudiCommon.h.

template<class PBASE>
std::string GaudiCommon< PBASE >::m_context
private

The context string.

Definition at line 813 of file GaudiCommon.h.

template<class PBASE>
std::vector< std::string > GaudiCommon< PBASE >::m_counterList
protected

list of counters to declare. Set by property CounterList. This can be a regular expression.

Definition at line 100 of file GaudiCommon.h.

template<class PBASE>
Statistics GaudiCommon< PBASE >::m_counters
mutableprivate

General counters.

Definition at line 798 of file GaudiCommon.h.

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

a pointer to the CounterSummarySvc

Definition at line 98 of file GaudiCommon.h.

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

Counter of errors.

Definition at line 790 of file GaudiCommon.h.

template<class PBASE>
bool GaudiCommon< PBASE >::m_errorsPrint
private

print warning and error counters at finalization ?

Definition at line 810 of file GaudiCommon.h.

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

Counter of exceptions.

Definition at line 796 of file GaudiCommon.h.

template<class PBASE>
std::string GaudiCommon< PBASE >::m_format1
private

format for regular statistical printout rows

Definition at line 826 of file GaudiCommon.h.

template<class PBASE>
std::string GaudiCommon< PBASE >::m_format2
private

format for "efficiency" statistical printout rows

Definition at line 828 of file GaudiCommon.h.

template<class PBASE>
double GaudiCommon< PBASE >::m_globalTimeOffset
private

The globalTimeOffset value.

Definition at line 821 of file GaudiCommon.h.

template<class PBASE>
std::string GaudiCommon< PBASE >::m_header
private

the header row

Definition at line 824 of file GaudiCommon.h.

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

counter of infos

Definition at line 794 of file GaudiCommon.h.

template<class PBASE>
MSG::Level GaudiCommon< PBASE >::m_msgLevel
private

The message level.

Definition at line 780 of file GaudiCommon.h.

template<class PBASE>
MsgStream * GaudiCommon< PBASE >::m_msgStream
mutableprivate

The predefined message stream.

Definition at line 783 of file GaudiCommon.h.

template<class PBASE>
bool GaudiCommon< PBASE >::m_propsPrint
private

print properties at initialization?

Definition at line 806 of file GaudiCommon.h.

template<class PBASE>
std::string GaudiCommon< PBASE >::m_rootInTES
private

The rootInTES string.

Definition at line 815 of file GaudiCommon.h.

template<class PBASE>
std::string GaudiCommon< PBASE >::m_rootOnTES
private

The rootOnTES string.

Note, this job option is OBSOLETE, but retained temporarily to allow easy migration. Please update your code to use RootInTES instead. This option will be removed at some point.

Definition at line 819 of file GaudiCommon.h.

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

List of active services.

Definition at line 787 of file GaudiCommon.h.

template<class PBASE>
std::vector< std::string > GaudiCommon< PBASE >::m_statEntityList
protected

Definition at line 102 of file GaudiCommon.h.

template<class PBASE>
bool GaudiCommon< PBASE >::m_statPrint
private

print counters at finalization ?

Definition at line 808 of file GaudiCommon.h.

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

List of active tools.

Definition at line 785 of file GaudiCommon.h.

template<class PBASE>
bool GaudiCommon< PBASE >::m_typePrint
private

insert the actual C++ type of the algorithm in the messages?

Definition at line 804 of file GaudiCommon.h.

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

Pointer to the Update Manager Service instance.

Definition at line 801 of file GaudiCommon.h.

template<class PBASE>
bool GaudiCommon< PBASE >::m_useEffFormat
private

flag to use the special "efficiency" format

Definition at line 830 of file GaudiCommon.h.

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

counter of warnings

Definition at line 792 of file GaudiCommon.h.

template<class PBASE>
static 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 83 of file GaudiCommon.h.


The documentation for this class was generated from the following files: