|
Gaudi Framework, version v21r8 |
| Home | Generated: 17 Mar 2010 |
#include <GaudiAlg/GaudiCommon.h>

Public Member Functions | |
| template<class TYPE> | |
| Gaudi::Utils::GetData< TYPE > ::return_type | get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
| Templated access to the data in Gaudi Transient Store. | |
| 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. | |
| 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. | |
| DataObject * | 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. | |
| 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. | |
| 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. | |
| template<class SERVICE> | |
| SmartIF< SERVICE > | svc (const std::string &name, const bool create=true) const |
| A useful method for the easy location of services. | |
| IUpdateManagerSvc * | updMgrSvc () const |
| Short-cut to locate the Update Manager Service. | |
| IDataProviderSvc * | fastContainersSvc () const |
| Short-cut to locate the Fast Containers 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 | 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. | |
| 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. | |
| 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. | |
| 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. | |
| void | Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
| Create and (re)-throw a given GaudiException. | |
| 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. | |
| 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. | |
| MsgStream & | msgStream (const MSG::Level level) const |
| Predefined configurable message stream for the efficient printouts. | |
| MsgStream & | always () const |
| shortcut for the method msgStream ( MSG::ALWAYS ) | |
| MsgStream & | fatal () const |
| shortcut for the method msgStream ( MSG::FATAL ) | |
| MsgStream & | err () const |
| shortcut for the method msgStream ( MSG::ERROR ) | |
| MsgStream & | error () const |
| shortcut for the method msgStream ( MSG::ERROR ) | |
| MsgStream & | warning () const |
| shortcut for the method msgStream ( MSG::WARNING ) | |
| MsgStream & | info () const |
| shortcut for the method msgStream ( MSG::INFO ) | |
| MsgStream & | debug () const |
| shortcut for the method msgStream ( MSG::DEBUG ) | |
| MsgStream & | verbose () const |
| shortcut for the method msgStream ( MSG::VERBOSE ) | |
| MsgStream & | msg () const |
| shortcut for the method msgStream ( MSG::INFO ) | |
| const Statistics & | counters () const |
| accessor to all counters | |
| StatEntity & | counter (const std::string &tag) const |
| accessor to certain counter by name | |
| MSG::Level | msgLevel () const |
| The current message service output level. | |
| bool | msgLevel (const MSG::Level level) const |
| Test the output level. | |
| void | resetMsgStream () const |
| Reset (delete) the current message stream object. | |
| bool | typePrint () const |
| Insert the actual C++ type of the algorithm/tool in the messages ? | |
| bool | propsPrint () const |
| Print properties at initialization ? | |
| bool | statPrint () const |
| Print statistical counters at finalization ? | |
| bool | errorsPrint () const |
| Print error counters at finalization ? | |
| long | printStat (const MSG::Level level=MSG::ALWAYS) const |
| perform the actual printout of statistical counters | |
| long | printErrors (const MSG::Level level=MSG::ALWAYS) const |
| perform the actual printout of error counters | |
| long | printProps (const MSG::Level level=MSG::ALWAYS) const |
| perform the actual printout of properties | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| StatusCode | runUpdate () |
| asks the UpdateManagerSvc to perform an update of the instance (if needed) without waiting the next BeginEvent incident. | |
| template<class T> | |
| TransientFastContainer< T > * | getFastContainer (const std::string &location, typename TransientFastContainer< T >::size_type initial=0) |
| Return a new TransientFastContainer for objects of type T. | |
| GaudiCommon (const std::string &name, ISvcLocator *pSvcLocator) | |
| Algorithm constructor. | |
| GaudiCommon (const std::string &type, const std::string &name, const IInterface *parent) | |
| Tool constructor. | |
| virtual StatusCode | initialize () |
| standard initialization method | |
| virtual StatusCode | finalize () |
| standard finalization method | |
| StatusCode | release (const IInterface *interface) const |
| Manual forced (and 'safe') release of the active tool or service. | |
| const AlgTools & | tools () const |
| get the list of aquired tools | |
| const Services & | services () const |
| get the list of aquired services | |
| const std::string & | context () const |
| Returns the "context" string. Used to identify different processing states. | |
| const std::string & | rootInTES () const |
| Returns the "rootInTES" string. | |
| double | globalTimeOffset () const |
| Returns the "globalTimeOffset" double. | |
Protected Types | |
| typedef std::map< std::string, StatEntity > | Statistics |
| the actual type of general counters | |
| typedef std::map< std::string, unsigned int > | Counter |
| the actual type error/warning counter | |
| typedef std::vector< IAlgTool * > | AlgTools |
| storage for active tools | |
| typedef GaudiUtils::HashMap < std::string, SmartIF < IService > > | Services |
| storage for active services | |
Protected Member Functions | |
| virtual | ~GaudiCommon () |
| Destructor. | |
| StatusCode | releaseTool (const IAlgTool *tool) const |
| manual forced (and 'safe') release of the tool | |
| StatusCode | releaseSvc (const IInterface *svc) const |
| manual forced (and 'safe') release of the service | |
Protected Attributes | |
| ICounterSummarySvc * | m_counterSummarySvc |
| a pointer to the CounterSummarySvc | |
| std::vector< std::string > | m_counterList |
| list of counters to declare. Set by property CounterList. This can be a regular expression. | |
| 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. | |
| static const bool | UseRootInTES = true |
| Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods. | |
Private Member Functions | |
| void | msgLevelHandler (Property &theProp) |
| Handle method for changes in the Messaging levels. | |
| GaudiCommon () | |
| GaudiCommon (const GaudiCommon &) | |
| GaudiCommon & | operator= (const GaudiCommon &) |
| void | printErrorHandler (Property &) |
| handler for "ErrorPrint" property | |
| void | printPropsHandler (Property &) |
| handler for "PropertiesPrint" property | |
| void | printStatHandler (Property &) |
| handler for "StatPrint" property | |
| void | addToToolList (IAlgTool *tool) const |
| Add the given tool to the list of acquired tools. | |
| void | addToServiceList (const SmartIF< IService > &svc) const |
| Add the given service to the list of acquired services. | |
| void | initGaudiCommonConstructor (const IInterface *parent=0) |
| Constructor initializations. | |
| const std::string | fullTESLocation (const std::string &location, const bool useRootInTES) const |
| Returns the full correct event location given the rootInTes settings. | |
Private Attributes | |
| MSG::Level | m_msgLevel |
| The message level. | |
| MsgStream * | m_msgStream |
| The predefined message stream. | |
| AlgTools | m_tools |
| List of active tools. | |
| Services | m_services |
| List of active services. | |
| Counter | m_errors |
| Counter of errors. | |
| Counter | m_warnings |
| counter of warnings | |
| Counter | m_infos |
| counter of infos | |
| Counter | m_exceptions |
| Counter of exceptions. | |
| Statistics | m_counters |
| General counters. | |
| IUpdateManagerSvc * | m_updMgrSvc |
| Pointer to the Update Manager Service instance. | |
| IDataProviderSvc * | m_fastContainersSvc |
| Pointer to the service providing transient fast containers. | |
| bool | m_typePrint |
| insert the actual C++ type of the algorithm in the messages? | |
| bool | m_propsPrint |
| print properties at initialization? | |
| bool | m_statPrint |
| print counters at finalization ? | |
| bool | m_errorsPrint |
| print warning and error counters at finalization ? | |
| std::string | m_context |
| The context string. | |
| std::string | m_rootInTES |
| The rootInTES string. | |
| std::string | m_rootOnTES |
| The rootOnTES string. | |
| double | m_globalTimeOffset |
| The globalTimeOffset value. | |
| std::string | m_header |
| the header row | |
| std::string | m_format1 |
| format for regular statistical printout rows | |
| std::string | m_format2 |
| format for "efficiency" statistical printout rows | |
| bool | m_useEffFormat |
| flag to use the special "efficiency" format | |
Definition at line 60 of file GaudiCommon.h.
typedef std::map<std::string,StatEntity> GaudiCommon< PBASE >::Statistics [protected] |
typedef std::map<std::string,unsigned int> GaudiCommon< PBASE >::Counter [protected] |
typedef std::vector<IAlgTool*> GaudiCommon< PBASE >::AlgTools [protected] |
typedef GaudiUtils::HashMap<std::string, SmartIF<IService> > GaudiCommon< PBASE >::Services [protected] |
| GaudiCommon< PBASE >::GaudiCommon | ( | const std::string & | name, | |
| ISvcLocator * | pSvcLocator | |||
| ) |
Algorithm constructor.
| GaudiCommon< PBASE >::GaudiCommon | ( | const std::string & | type, | |
| const std::string & | name, | |||
| const IInterface * | parent | |||
| ) |
Tool constructor.
| virtual GaudiCommon< PBASE >::~GaudiCommon | ( | ) | [inline, protected, virtual] |
| GaudiCommon< PBASE >::GaudiCommon | ( | ) | [private] |
| GaudiCommon< PBASE >::GaudiCommon | ( | const GaudiCommon< PBASE > & | ) | [private] |
| Gaudi::Utils::GetData< TYPE >::return_type GaudiCommon< PBASE >::get | ( | IDataProviderSvc * | svc, | |
| const std::string & | location, | |||
| const bool | useRootInTES = true | |||
| ) | const [inline] |
Templated access to the data in Gaudi Transient Store.
Quick and safe access to the data in Gaudi transient store. The method located the data at given address and perform the debug printout about located data
// Will access MCHits from the given location MCHits* hits = get<MCHits>( evtSvc () , "MC/Hits" );
| GaudiException | for Invalid Data Provider Service | |
| GaudiException | for invalid/unavailable data |
| svc | Pointer to data service (data provider) | |
| location | data location/address in Gaudi Transient Store | |
| useRootInTES | Flag to turn on(TRUE) off(FALSE) the use of the RootInTES location property |
Reimplemented in GaudiAlgorithm, and GaudiTool.
Definition at line 55 of file GaudiCommonImp.h.
00058 { 00059 // check the environment 00060 Assert( 0 != service , "get():: IDataProvider* points to NULL!" ) ; 00061 // get the helper object: 00062 Gaudi::Utils::GetData<TYPE> getter ; 00063 return getter ( *this , 00064 service , 00065 fullTESLocation ( location , useRootInTES ) ) ; 00066 }
| 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" ) ;
| svc | Pointer to data provider service | |
| location | Address in Gaudi Transient Store | |
| useRootInTES | Flag to turn on(TRUE) off(FALSE) the use of the RootInTES location property |
| true | Data object or container exists and implements a proper interface | |
| true | Failed to locate the data object or container |
Reimplemented in GaudiAlgorithm, and GaudiTool.
Definition at line 72 of file GaudiCommonImp.h.
00075 { 00076 // check the environment 00077 Assert( 0 != service , "exist():: IDataProvider* points to NULL!" ) ; 00078 // check the data object 00079 Gaudi::Utils::CheckData<TYPE> checker ; 00080 return checker ( service, 00081 fullTESLocation ( location , useRootInTES ) ) ; 00082 }
| Gaudi::Utils::GetData< TYPE >::return_type GaudiCommon< PBASE >::getOrCreate | ( | IDataProviderSvc * | svc, | |
| const std::string & | location, | |||
| const bool | useRootInTES = true | |||
| ) | const [inline] |
Get the existing data object from Gaudi Event Transient store.
Alternatively, create new object and register it in TES and return if object does not exist.
MyHits* hits = getOrCreate<MyHits,MyHits>( evtSvc() , "/Event/MyHits" ) ;
| GaudiException | for Invalid Data Provider Service | |
| GaudiException | for invalid/unavailable data |
| svc | Pointer to data provider service | |
| location | Location in Gaudi Transient Event Store | |
| useRootInTES | Flag to turn on(TRUE) off(FALSE) the use of the RootInTES location property |
Reimplemented in GaudiAlgorithm, and GaudiTool.
Definition at line 91 of file GaudiCommonImp.h.
00094 { 00095 // check the environment 00096 Assert ( 0 != service , "getOrCreate():: svc points to NULL!" ) ; 00097 // get the helper object 00098 Gaudi::Utils::GetOrCreateData<TYPE,TYPE2> getter ; 00099 return getter ( *this , 00100 service , 00101 fullTESLocation( location, useRootInTES ) , 00102 location ) ; 00103 }
| DataObject * GaudiCommon< PBASE >::put | ( | IDataProviderSvc * | svc, | |
| DataObject * | object, | |||
| const std::string & | location, | |||
| const bool | useRootInTES = true | |||
| ) | const [inline] |
Register a data object or container into Gaudi Event Transient Store.
| svc | Pointer to data provider service | |
| object | Data object or container to be registered | |
| location | Location in Gaudi Event Transient Store ("/Event" could be omitted ) | |
| useRootInTES | Flag to turn on(TRUE) off(FALSE) the use of the RootInTES location property |
| GaudiException | for invalid event data service | |
| GaudiException | for invalid object | |
| GaudiException | for error result from event data service |
| StatusCode::SUCCESS | Data was successfully placed in the TES. | |
| StatusCode::FAILURE | Failed to store data in the TES. |
Reimplemented in GaudiAlgorithm, and GaudiTool.
Definition at line 773 of file GaudiCommon.icpp.
00777 { 00778 // check arguments 00779 Assert ( 0 != svc , "put():: Invalid 'service'!" ) ; 00780 Assert ( 0 != object , "put():: Invalid 'Object'!" ) ; 00781 Assert ( !location.empty() , "put():: Invalid 'address' = '' " ) ; 00782 // final data location 00783 const std::string & fullLocation = fullTESLocation( location, useRootInTES ); 00784 // register the object! 00785 const StatusCode status = '/' == fullLocation[0] ? 00786 svc -> registerObject( fullLocation , object ) : 00787 svc -> registerObject( "/Event/" + fullLocation , object ) ; 00788 // check the result! 00789 if ( status.isFailure() ) 00790 { Exception ( "put():: could not register '" + 00791 System::typeinfoName( typeid( *object ) ) + 00792 "' at address '" + fullLocation + "'" , status ) ; } 00793 if ( msgLevel( MSG::DEBUG ) ) 00794 { Print( "The object of type '" + 00795 System::typeinfoName( typeid( *object ) ) + 00796 "' is registered in TS at address '" 00797 + fullLocation + "'" , status , MSG::DEBUG ) ; } 00798 return object; 00799 }
| 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 );
| GaudiException | for invalid Tool Service | |
| GaudiException | for error from Tool Service | |
| GaudiException | for invalid tool |
| type | Tool type | |
| name | Tool name | |
| parent | Tool parent | |
| create | Flag for creation of nonexisting tools |
Definition at line 109 of file GaudiCommonImp.h.
00113 { 00114 TOOL* Tool = 0 ; 00115 // for empty names delegate to another method 00116 if ( name.empty() ) 00117 { 00118 Tool = tool<TOOL>( type , parent , create ) ; 00119 } 00120 else 00121 { 00122 Assert( this->toolSvc() != 0, "tool():: IToolSvc* points to NULL!" ) ; 00123 // get the tool from Tool Service 00124 const StatusCode sc = 00125 this->toolSvc()->retrieveTool ( type , name , Tool , parent , create ) ; 00126 if ( sc.isFailure() ) 00127 { Exception("tool():: Could not retrieve Tool '" + type + "'/'" + name + "'", sc ) ; } 00128 if ( 0 == Tool ) 00129 { Exception("tool():: Could not retrieve Tool '" + type + "'/'" + name + "'" ) ; } 00130 // add the tool into list of known tools to be properly released 00131 addToToolList( Tool ); 00132 } 00133 // return *VALID* located tool 00134 return Tool ; 00135 }
| 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" );
| GaudiException | for invalid Tool Service | |
| GaudiException | for error from Tool Service | |
| GaudiException | for invalid tool |
| type | Tool type, could be of "Type/Name" format | |
| parent | Tool parent | |
| create | Flag for creation of non-existing tools |
Definition at line 141 of file GaudiCommonImp.h.
00144 { 00145 // check the environment 00146 Assert ( PBASE::toolSvc() != 0, "IToolSvc* points to NULL!" ); 00147 // retrieve the tool from Tool Service 00148 TOOL* Tool = 0 ; 00149 const StatusCode sc = 00150 this->toolSvc() -> retrieveTool ( type, Tool, parent , create ); 00151 if ( sc.isFailure() ) 00152 { Exception("tool():: Could not retrieve Tool '" + type + "'", sc ) ; } 00153 if ( 0 == Tool ) 00154 { Exception("tool():: Could not retrieve Tool '" + type + "'" ) ; } 00155 // add the tool into the list of known tools to be properly released 00156 addToToolList( Tool ); 00157 // return *VALID* located tool 00158 return Tool ; 00159 }
| 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" );
| GaudiException | for error in Algorithms::service | |
| GaudiException | for invalid service |
| name | service type name | |
| create | Flag for creation of non-existing services |
Definition at line 165 of file GaudiCommonImp.h.
00167 { 00168 Assert ( this->svcLoc() != 0, "ISvcLocator* points to NULL!" ); 00169 SmartIF<SERVICE> s; 00170 // check if we already have this service 00171 Services::iterator it = m_services.find(name); 00172 if (it != m_services.end()) { 00173 // Try to get the requested interface 00174 s = it->second; 00175 // check the results 00176 if ( !s.isValid() ) { 00177 Exception ("svc():: Could not retrieve Svc '" + name + "'", StatusCode::FAILURE); 00178 } 00179 } else { 00180 SmartIF<IService>& baseSvc = this->svcLoc()->service(name, create); 00181 // Try to get the requested interface 00182 s = baseSvc; 00183 // check the results 00184 if ( !baseSvc.isValid() || !s.isValid() ) { 00185 Exception ("svc():: Could not retrieve Svc '" + name + "'", StatusCode::FAILURE); 00186 } 00187 // add the tool into list of known tools, to be properly released 00188 addToServiceList(baseSvc); 00189 } 00190 // return *VALID* located service 00191 return s; 00192 }
| IUpdateManagerSvc * GaudiCommon< PBASE >::updMgrSvc | ( | ) | const [inline] |
Short-cut to locate the Update Manager Service.
Definition at line 198 of file GaudiCommonImp.h.
00199 { 00200 if ( !m_updMgrSvc ) 00201 { m_updMgrSvc = svc<IUpdateManagerSvc>("UpdateManagerSvc",true); } 00202 return m_updMgrSvc ; 00203 }
| IDataProviderSvc * GaudiCommon< PBASE >::fastContainersSvc | ( | ) | const [inline] |
Short-cut to locate the Fast Containers Service.
Definition at line 209 of file GaudiCommonImp.h.
00210 { 00211 if ( !m_fastContainersSvc ) 00212 { m_fastContainersSvc = svc<IDataProviderSvc>("FastContainersSvc",true); } 00213 return m_fastContainersSvc ; 00214 }
| StatusCode GaudiCommon< PBASE >::Error | ( | const std::string & | msg, | |
| const StatusCode | st = StatusCode::FAILURE, |
|||
| const size_t | mx = 10 | |||
| ) | const [inline] |
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 );
| msg | Error message | |
| st | StatusCode to return | |
| mx | Maximum number of printouts for this message |
Reimplemented in ErrorTool.
Definition at line 490 of file GaudiCommon.icpp.
00493 { 00494 // increase local counter of errors 00495 const size_t num = ++m_errors[msg] ; 00496 // If suppressed, just return 00497 if ( num > mx ) { return st ; } 00498 else if ( num == mx ) // issue one-time suppression message 00499 { return Print ( "The ERROR message is suppressed : '" + 00500 msg + "'" , st , MSG::ERROR ) ; } 00501 // return message 00502 return Print ( msg , st , MSG::ERROR ) ; 00503 }
| StatusCode GaudiCommon< PBASE >::Warning | ( | const std::string & | msg, | |
| const StatusCode | st = StatusCode::FAILURE, |
|||
| const size_t | mx = 10 | |||
| ) | const [inline] |
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 );
| msg | Warning message | |
| st | StatusCode to return | |
| mx | Maximum number of printouts for this message |
Reimplemented in ErrorTool.
Definition at line 511 of file GaudiCommon.icpp.
00514 { 00515 // increase local counter of warnings 00516 const size_t num = ++m_warnings[msg] ; 00517 // If suppressed, just return 00518 if ( num > mx ) { return st ; } 00519 else if ( num == mx ) // issue one-time suppression message 00520 { return Print ( "The WARNING message is suppressed : '" + 00521 msg + "'" , st , MSG::WARNING ) ; } 00522 // return message 00523 return Print ( msg , st , MSG::WARNING ) ; 00524 }
| StatusCode GaudiCommon< PBASE >::Info | ( | const std::string & | msg, | |
| const StatusCode | st = StatusCode::SUCCESS, |
|||
| const size_t | mx = 10 | |||
| ) | const [inline] |
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.
| msg | Info message | |
| st | StatusCode to return | |
| mx | Maximum number of printouts for this message |
Definition at line 532 of file GaudiCommon.icpp.
00535 { 00536 // increase local counter of warnings 00537 const size_t num = ++m_infos[msg] ; 00538 // If suppressed, just return 00539 if ( num > mx ) { return st ; } 00540 else if ( num == mx ) // issue one-time suppression message 00541 { return Print ( "The INFO message is suppressed : '" + 00542 msg + "'" , st , MSG::INFO ) ; } 00543 // return message 00544 return Print ( msg , st , MSG::INFO ) ; 00545 }
| StatusCode GaudiCommon< PBASE >::Print | ( | const std::string & | msg, | |
| const StatusCode | st = StatusCode::SUCCESS, |
|||
| const MSG::Level | lev = MSG::INFO | |||
| ) | const [inline] |
Print the message and return with the given StatusCode.
| msg | Message to print | |
| st | StatusCode to return | |
| lev | Printout level for the given message |
Reimplemented in ErrorTool.
Definition at line 552 of file GaudiCommon.icpp.
00555 { 00556 // perform printout ? 00557 if ( !msgLevel( lvl ) ) { return st ; } // RETURN 00558 00559 // use the predefined stream 00560 MsgStream& str = msgStream( lvl ) ; 00561 if ( typePrint() ) { str << System::typeinfoName(typeid(*this)) << ":: " ; } 00562 // print the message 00563 str << msg ; 00564 // test status code 00565 if ( st.isSuccess() ) { } 00566 else if ( StatusCode::FAILURE != st.getCode() ) 00567 { str << " StatusCode=" << st.getCode() ; } 00568 else 00569 { str << " StatusCode=FAILURE" ; } 00570 // perform print operation 00571 str << endmsg ; 00572 // return 00573 return st; 00574 }
| 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.
| Exception | for invalid condition |
| ok | Condition which should be "true" | |
| message | Message to be associated with the exception |
Reimplemented in ErrorTool.
Definition at line 263 of file GaudiCommonImp.h.
| 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.
| Exception | for invalid condition |
| ok | Condition which should be "true" | |
| message | Message to be associated with the exception |
Definition at line 281 of file GaudiCommonImp.h.
| void GaudiCommon< PBASE >::Exception | ( | const std::string & | msg, | |
| const GaudiException & | exc, | |||
| const StatusCode | sc = StatusCode(StatusCode::FAILURE, true) | |||
| ) | const [inline] |
Create and (re)-throw a given GaudiException.
| GaudiException | always thrown! |
| msg | Exception message | |
| exc | (previous) exception of type GaudiException |
Reimplemented in ErrorTool.
Definition at line 581 of file GaudiCommon.icpp.
00584 { 00585 // increase local counter of exceptions 00586 ++m_exceptions[ msg ]; 00587 Print ( "Exception (re)throw: " + msg , sc , MSG::FATAL ); 00588 throw GaudiException( this->name() + ":: " + msg , this->name() , sc, exc); 00589 }
| void GaudiCommon< PBASE >::Exception | ( | const std::string & | msg, | |
| const std::exception & | exc, | |||
| const StatusCode | sc = StatusCode(StatusCode::FAILURE, true) | |||
| ) | const [inline] |
Create and (re)-throw a given exception.
| std::exception | always thrown! |
| msg | Exception message | |
| exc | (previous) exception of type std::exception | |
| sc | StatusCode |
Reimplemented in ErrorTool.
Definition at line 596 of file GaudiCommon.icpp.
00599 { 00600 // increase local counter of exceptions 00601 ++m_exceptions[ msg ]; 00602 Print ( "Exception (re)throw: " + msg , sc , MSG::FATAL ); 00603 throw GaudiException( this->name() + ":: " + msg+"("+exc.what()+")", "", sc ); 00604 }
| void GaudiCommon< PBASE >::Exception | ( | const std::string & | msg = "no message", |
|
| const StatusCode | sc = StatusCode(StatusCode::FAILURE, true) | |||
| ) | const [inline] |
Create and throw an exception with the given message.
| GaudiException | always thrown! |
| msg | Exception message | |
| sc | StatusCode |
Reimplemented in ErrorTool.
Definition at line 611 of file GaudiCommon.icpp.
00613 { 00614 // increase local counter of exceptions 00615 ++m_exceptions[ msg ]; 00616 Print ( "Exception throw: " + msg , sc , MSG::FATAL ); 00617 throw GaudiException( this->name() + ":: " + msg , "", sc ); 00618 }
| 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 ; }
Definition at line 253 of file GaudiCommonImp.h.
00254 { 00255 if ( !m_msgStream ) 00256 { m_msgStream = new MsgStream ( PBASE::msgSvc() , this->name() ) ; } 00257 return *m_msgStream << level ; 00258 }
| MsgStream& GaudiCommon< PBASE >::always | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::ALWAYS )
Definition at line 482 of file GaudiCommon.h.
00482 { return msgStream ( MSG::ALWAYS ) ; }
| MsgStream& GaudiCommon< PBASE >::fatal | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::FATAL )
Definition at line 484 of file GaudiCommon.h.
00484 { return msgStream ( MSG::FATAL ) ; }
| MsgStream& GaudiCommon< PBASE >::err | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::ERROR )
Definition at line 486 of file GaudiCommon.h.
00486 { return msgStream ( MSG::ERROR ) ; }
| MsgStream& GaudiCommon< PBASE >::error | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::ERROR )
Definition at line 488 of file GaudiCommon.h.
00488 { return msgStream ( MSG::ERROR ) ; }
| MsgStream& GaudiCommon< PBASE >::warning | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::WARNING )
Definition at line 490 of file GaudiCommon.h.
00490 { return msgStream ( MSG::WARNING ) ; }
| MsgStream& GaudiCommon< PBASE >::info | ( | ) | const [inline] |
| MsgStream& GaudiCommon< PBASE >::debug | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::DEBUG )
Definition at line 494 of file GaudiCommon.h.
00494 { return msgStream ( MSG::DEBUG ) ; }
| MsgStream& GaudiCommon< PBASE >::verbose | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::VERBOSE )
Definition at line 496 of file GaudiCommon.h.
00496 { return msgStream ( MSG::VERBOSE ) ; }
| MsgStream& GaudiCommon< PBASE >::msg | ( | ) | const [inline] |
| const Statistics& GaudiCommon< PBASE >::counters | ( | ) | const [inline] |
accessor to all counters
Definition at line 502 of file GaudiCommon.h.
00502 { return m_counters ; }
| 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 ;
| tag | counter name |
Definition at line 521 of file GaudiCommon.h.
00521 { return m_counters[tag] ; }
| MSG::Level GaudiCommon< PBASE >::msgLevel | ( | ) | const [inline] |
The current message service output level.
Definition at line 527 of file GaudiCommon.h.
00527 { return m_msgLevel ; }
| bool GaudiCommon< PBASE >::msgLevel | ( | const MSG::Level | level | ) | const [inline] |
Test the output level.
| level | The message level to test against |
| true | Messages at level "level" will be printed | |
| true | Messages at level "level" will NOT be printed |
Definition at line 534 of file GaudiCommon.h.
| 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 273 of file GaudiCommonImp.h.
00274 { 00275 if ( 0 != m_msgStream ) { delete m_msgStream; m_msgStream = 0; } 00276 }
| bool GaudiCommon< PBASE >::typePrint | ( | ) | const [inline] |
Insert the actual C++ type of the algorithm/tool in the messages ?
Definition at line 541 of file GaudiCommon.h.
00541 { return m_typePrint ; }
| bool GaudiCommon< PBASE >::propsPrint | ( | ) | const [inline] |
Print properties at initialization ?
Definition at line 543 of file GaudiCommon.h.
00543 { return m_propsPrint ; }
| bool GaudiCommon< PBASE >::statPrint | ( | ) | const [inline] |
Print statistical counters at finalization ?
Definition at line 545 of file GaudiCommon.h.
00545 { return m_statPrint ; }
| bool GaudiCommon< PBASE >::errorsPrint | ( | ) | const [inline] |
Print error counters at finalization ?
Definition at line 547 of file GaudiCommon.h.
00547 { return m_errorsPrint ; }
| void GaudiCommon< PBASE >::msgLevelHandler | ( | Property & | theProp | ) | [inline, private] |
Handle method for changes in the Messaging levels.
Called whenever the property "OutputLevel" changes to perform all necessary actions locally.
| theProp | Reference to the Property that has changed |
Definition at line 739 of file GaudiCommon.icpp.
00740 { 00741 // Force a new MsgStream object, to pick up the new settings 00742 resetMsgStream(); 00743 00744 // adjust internal message level 00745 m_msgLevel = 00746 this->outputLevel() < (int) MSG::NIL ? MSG::NIL : 00747 this->outputLevel() >= (int) MSG::NUM_LEVELS ? MSG::ALWAYS : 00748 MSG::Level( this->outputLevel() ) ; 00749 00750 // Keep MessageSvc up to date if needed 00751 if ( this->msgSvc()->outputLevel(this->name()) != this->outputLevel() ) 00752 { 00753 this->msgSvc()->setOutputLevel( this->name(), this->outputLevel() ); 00754 } 00755 00756 // printout message 00757 if ( msgLevel(MSG::DEBUG) ) 00758 { 00759 debug() << "Property update for " 00760 << theProp.name() << " : new value = " << this->outputLevel() << endmsg; 00761 } 00762 }
| long GaudiCommon< PBASE >::printStat | ( | const MSG::Level | level = MSG::ALWAYS |
) | const [inline] |
perform the actual printout of statistical counters
| level | The message level to print at |
Definition at line 625 of file GaudiCommon.icpp.
00626 { 00627 // print statistics 00628 if ( counters().empty() ) { return 0 ; } 00629 MsgStream& msg = msgStream ( level ) ; 00630 // 00631 msg << "Number of counters : " << counters().size() ; 00632 // 00633 if ( !counters().empty() ) { msg << std::endl << m_header ; } 00634 // 00635 for ( Statistics::const_iterator entry = counters().begin() ; 00636 counters().end() != entry ; ++entry ) 00637 { 00638 msg << std::endl 00639 << Gaudi::Utils::formatAsTableRow 00640 ( entry -> first , 00641 entry -> second , 00642 m_useEffFormat , 00643 m_format1 , m_format2 ); 00644 } 00645 // 00646 msg << endmsg ; 00647 // 00648 return counters().size() ; 00649 }
| long GaudiCommon< PBASE >::printErrors | ( | const MSG::Level | level = MSG::ALWAYS |
) | const [inline] |
perform the actual printout of error counters
| level | The message level to print at |
Definition at line 656 of file GaudiCommon.icpp.
00657 { 00658 // format for printout 00659 boost::format ftm ( " %s = %|.8s| %|23t| Message = '%s'" ); 00660 00661 { // print exceptions 00662 for ( Counter::const_iterator excp = m_exceptions.begin() ; 00663 excp != m_exceptions.end() ; ++excp ) 00664 { 00665 msgStream(level) 00666 << ( ftm % "#EXCEPTIONS" % excp->second % excp->first ) 00667 << endmsg; 00668 } 00669 } 00670 { // print errors 00671 for ( Counter::const_iterator error = m_errors.begin() ; 00672 error != m_errors.end() ; ++error ) 00673 { 00674 msgStream(level) 00675 << ( ftm % "#ERRORS " % error->second % error->first ) 00676 << endmsg; 00677 } 00678 } 00679 { // print warnings 00680 for ( Counter::const_iterator warning = m_warnings.begin() ; 00681 warning != m_warnings.end() ; ++warning ) 00682 { 00683 msgStream(level) 00684 << ( ftm % "#WARNINGS " % warning->second % warning->first ) 00685 << endmsg; 00686 } 00687 } 00688 { // print warnings 00689 for ( Counter::const_iterator info = m_infos.begin() ; 00690 info != m_infos.end() ; ++info ) 00691 { 00692 msgStream(level) 00693 << ( ftm % "#INFOS " % info->second % info->first ) 00694 << endmsg; 00695 } 00696 } 00697 00698 // return total number of errors+warnings+exceptions 00699 return 00700 m_exceptions .size () + 00701 m_errors .size () + 00702 m_warnings .size () + 00703 m_infos .size () ; 00704 }
| long GaudiCommon< PBASE >::printProps | ( | const MSG::Level | level = MSG::ALWAYS |
) | const [inline] |
perform the actual printout of properties
perform the printout of properties
| level | The message level to print at |
number of error counters
Definition at line 713 of file GaudiCommon.icpp.
00714 { 00715 00716 // print ALL properties 00717 MsgStream& msg = msgStream ( level ); 00718 typedef std::vector<Property*> Properties; 00719 const Properties& properties = this->getProperties() ; 00720 msg << "List of ALL properties of " 00721 << System::typeinfoName( typeid( *this ) ) << "/" << this->name() 00722 << " #properties = " << properties.size() << endmsg ; 00723 for ( Properties::const_reverse_iterator property 00724 = properties.rbegin() ; 00725 properties.rend() != property ; ++property ) 00726 { 00727 msg << "Property ['Name': Value] = " 00728 << ( **property) 00729 << endmsg ; 00730 } 00731 return properties.size() ; 00732 }
| 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.
| condition | the path inside the Transient Detector Store to the condition object. | |
| mf | optional pointer to the member function to call when the condition object is updated. If the pointer is omitted the user must explicitly provide the class name to the method. StatusCode MyAlg::initialize(){ // ... registerCondition("/dd/Conditions/Readout/MyDet/MyCond",&MyAlg::i_CallBack); registerCondition<MyAlg>("/dd/Conditions/Readout/MyDet/MyOtherCond"); // ... return StatusCode.SUCCESS; } |
Definition at line 590 of file GaudiCommon.h.
00590 { 00591 updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf); 00592 }
| 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.
| condition | the path inside the Transient Detector Store to the condition object. | |
| condPtrDest | pointer to fill with the location of the condition object. Note: the pointer can be safely used only in the execute method or in the member function triggered by the update. | |
| mf | optional pointer to the member function to call when the condition object is updated. If the pointer is omitted the user must explicitly provide the class name to the method. class MyAlg: public GaudiAlgorithm { // ... public: virtual StatusCode i_CallBack(); private: Condition *m_MyCond; SpecialCondition *m_MyOtherCond; // ... }; StatusCode MyAlg::initialize(){ // ... registerCondition("/dd/Conditions/Readout/MyDet/MyCond",m_MyCond,&MyAlg::i_CallBack); registerCondition<MyAlg>("/dd/Conditions/Readout/MyDet/MyOtherCond",m_MyOtherCond); // ... return StatusCode.SUCCESS; } |
Definition at line 624 of file GaudiCommon.h.
00625 { 00626 updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf,condPtrDest); 00627 }
| 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 630 of file GaudiCommon.h.
00630 { 00631 updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),std::string(condition),mf); 00632 }
| void GaudiCommon< PBASE >::registerCondition | ( | TargetClass * | condition, | |
| StatusCode(CallerClass::*)() | mf = NULL | |||
| ) | [inline] |
register the current instance to the UpdateManagerSvc as a consumer for a condition.
| condition | the path inside the Transient Detector Store to the condition object. | |
| mf | optional pointer to the member function to call when the condition object is updated. If the pointer is omitted the user must explicitly provide the class name to the method. StatusCode MyAlg::initialize(){ // ... registerCondition("/dd/Conditions/Readout/MyDet/MyCond",&MyAlg::i_CallBack); registerCondition<MyAlg>("/dd/Conditions/Readout/MyDet/MyOtherCond"); // ... return StatusCode.SUCCESS; } |
Definition at line 649 of file GaudiCommon.h.
00649 { 00650 updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf); 00651 }
| 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).
StatusCode MyTool::initialize(){ // ... return runUpdate(); }
Definition at line 663 of file GaudiCommon.h.
| TransientFastContainer< T > * GaudiCommon< PBASE >::getFastContainer | ( | const std::string & | location, | |
| typename TransientFastContainer< T >::size_type | initial = 0 | |||
| ) | [inline] |
Return a new TransientFastContainer for objects of type T.
The container is created if it is not in the transient store. If a container with the same name but a different type
Definition at line 221 of file GaudiCommonImp.h.
00223 { 00224 typedef TransientFastContainer<T> container_type; 00225 00226 IDataProviderSvc* svc = fastContainersSvc(); 00227 Assert( 0 != svc , "getFastContainer(): cannot get FastContainersSvc" ); 00228 00229 container_type *ptr = NULL; 00230 SmartDataPtr<container_type> obj( svc, location ); 00231 if (!obj){ 00232 ptr = new container_type(initial); 00233 StatusCode status = svc->registerObject(location,ptr); 00234 if ( !status.isSuccess() ){ 00235 Exception("getFastContainer(): cannot register '" + 00236 System::typeinfoName( typeid( *ptr ) ) + 00237 "' at address '" + location + "'" , status ); 00238 } 00239 } else { 00240 ptr = obj; 00241 if ( !ptr ){ 00242 Exception("getFastContainer(): No valid container at '" + location + "'"); 00243 } 00244 } 00245 00246 return ptr; 00247 }
| StatusCode GaudiCommon< PBASE >::initialize | ( | ) | [inline, virtual] |
standard initialization method
Reimplemented in GaudiAlgorithm, GaudiHistoAlg, GaudiHistoTool, GaudiSequencer, GaudiTool, GaudiTupleAlg, GaudiTupleTool, Prescaler, SequencerTimerTool, EqSolver, FuncMinimum, GaudiHistos< GaudiAlgorithm >, GaudiHistos< GaudiTool >, GaudiTuples< GaudiHistoTool >, and GaudiTuples< GaudiHistoAlg >.
Definition at line 223 of file GaudiCommon.icpp.
00224 { 00225 00226 // initialize base class 00227 const StatusCode sc = PBASE::initialize(); 00228 if ( sc.isFailure() ) 00229 { return Error ( "Failed to initialise base class PBASE", sc ) ; } 00230 00231 00232 // some debug printout 00233 if ( msgLevel(MSG::DEBUG) ) 00234 { 00235 debug() << "Initialize base class GaudiCommon<" << System::typeinfoName(typeid(PBASE)) << ">" << endmsg; 00236 if ( !context().empty() ) 00237 debug() << "Created with context = '" << context() << "'" << endmsg; 00238 } 00239 00240 // some temporary checks to see if people are using RootOnTES and warn if so 00241 // TO BE REMOVED ASAP ... 00242 if ( m_rootInTES.empty() && !m_rootOnTES.empty() ) 00243 { 00244 m_rootInTES = m_rootOnTES; 00245 Warning( "RootOnTES option is OBSOLETE -> Use RootInTES instead. RootInTES has been updated to " 00246 + m_rootInTES, StatusCode::SUCCESS ).ignore(); 00247 } 00248 else if ( !m_rootInTES.empty() && !m_rootOnTES.empty() ) 00249 { 00250 Warning( "Options RootOnTES AND RootInTES are defined ! Use RootInTES. RootOnTES is ignored", 00251 StatusCode::SUCCESS ).ignore(); 00252 } 00253 00254 // Check rootInTES ends with a / 00255 if ( !m_rootInTES.empty() && 00256 m_rootInTES.substr(m_rootInTES.size()-1) != "/" ) m_rootInTES += "/"; 00257 00258 //Set up the CounterSummarySvc May need to be changed 00259 this->svcLoc()->service("CounterSummarySvc",m_counterSummarySvc,false).ignore() ; 00260 if (msgLevel(MSG::DEBUG)) 00261 { 00262 if (m_counterSummarySvc==NULL ) 00263 debug() << "could not locate CounterSummarySvc, no counter summary will be made" << endmsg; 00264 else debug() << "found CounterSummarySvc OK" << endmsg; 00265 } 00266 00267 // properties will be printed if asked for or in "MSG::DEBUG" mode 00268 if ( propsPrint() ) { printProps(MSG::ALWAYS); } 00269 else if ( msgLevel(MSG::DEBUG) ) { printProps(MSG::DEBUG); } 00270 00271 return sc; 00272 }
| StatusCode GaudiCommon< PBASE >::finalize | ( | void | ) | [inline, virtual] |
standard finalization method
Reimplemented in GaudiAlgorithm, GaudiHistoAlg, GaudiHistoTool, GaudiSequencer, GaudiTool, GaudiTupleAlg, GaudiTupleTool, Prescaler, SequencerTimerTool, EqSolver, FuncMinimum, GaudiHistos< GaudiAlgorithm >, GaudiHistos< GaudiTool >, GaudiTuples< GaudiHistoTool >, and GaudiTuples< GaudiHistoAlg >.
Definition at line 285 of file GaudiCommon.icpp.
00286 { 00287 StatusCode sc = StatusCode::SUCCESS; 00288 00289 // print the general information about statistical counters 00290 if ( msgLevel(MSG::DEBUG) || (statPrint() && !counters().empty()) ) 00291 { 00292 // print general statistical counters 00293 printStat ( statPrint() ? MSG::ALWAYS : MSG::DEBUG ) ; 00294 } 00295 //add all counters to the CounterSummarySvc 00296 if(m_counterSummarySvc && this->svcLoc()->existsService("CounterSummarySvc")) 00297 { 00298 if ( msgLevel(MSG::DEBUG) ) debug() << "adding counters to CounterSummarySvc" << endmsg; 00299 for(Statistics::const_iterator i=this->counters().begin(); 00300 i!=this->counters().end(); 00301 i++) 00302 { 00303 if(Gaudi::Utils::RegEx::matchOr(i->first,m_statEntityList)) 00304 m_counterSummarySvc->addCounter(this->name(),i->first,i->second, 00305 Gaudi::CounterSummary::SaveStatEntity); 00306 else if(Gaudi::Utils::RegEx::matchOr(i->first,m_counterList)) 00307 m_counterSummarySvc->addCounter(this->name(),i->first,i->second); 00308 } 00309 } 00310 // release all located tools and services 00311 if ( msgLevel(MSG::DEBUG) ) 00312 { 00313 debug() << "Tools to release :"; 00314 for ( AlgTools::const_iterator i = m_tools.begin(); 00315 i != m_tools.end(); ++i ) 00316 { 00317 debug() << " " << (*i)->name(); 00318 } 00319 debug() << endmsg; 00320 } 00321 while ( !m_tools.empty() ) { sc = sc && releaseTool( m_tools.back() ) ; } 00322 00323 // release all located services 00324 if ( msgLevel(MSG::DEBUG) ) 00325 { 00326 debug() << "Services to release :"; 00327 for ( Services::const_iterator i = m_services.begin(); 00328 i != m_services.end(); ++i ) 00329 { 00330 debug() << " " << (*i).first; 00331 } 00332 debug() << endmsg; 00333 } 00334 while ( !m_services.empty() ) { sc = sc && releaseSvc( m_services.begin()->second ) ; } 00335 00336 //release the CounterSummarySvc manually 00337 if(m_counterSummarySvc) 00338 { 00339 m_counterSummarySvc->release(); 00340 m_counterSummarySvc=NULL; 00341 } 00342 00343 // format printout 00344 if ( !m_errors.empty() || !m_warnings.empty() || !m_exceptions.empty() ) 00345 { 00346 always() << "Exceptions/Errors/Warnings/Infos Statistics : " 00347 << m_exceptions .size () << "/" 00348 << m_errors .size () << "/" 00349 << m_warnings .size () << "/" 00350 << m_infos .size () << endmsg ; 00351 if ( errorsPrint() ) { printErrors () ; } 00352 } 00353 00354 // delete the MsgStream 00355 resetMsgStream(); 00356 00357 // clear *ALL* counters explicitly 00358 m_counters .clear() ; 00359 m_exceptions .clear() ; 00360 m_infos .clear() ; 00361 m_warnings .clear() ; 00362 m_errors .clear() ; 00363 m_counterList.clear() ; 00364 m_statEntityList.clear() ; 00365 00366 // finalize base class 00367 return sc && PBASE::finalize(); 00368 }
| GaudiCommon& GaudiCommon< PBASE >::operator= | ( | const GaudiCommon< PBASE > & | ) | [private] |
| StatusCode GaudiCommon< PBASE >::releaseTool | ( | const IAlgTool * | tool | ) | const [inline, protected] |
manual forced (and 'safe') release of the tool
Definition at line 394 of file GaudiCommon.icpp.
00395 { 00396 if( 0 == algTool ) 00397 { return Error ( "releaseTool(IAlgTool):: IAlgTool* points to NULL!" ) ; } 00398 if( this->toolSvc() == 0 ) 00399 { return Error ( "releaseTool(IAlgTool):: IToolSvc* points to NULL!" ) ; } 00400 // find a tool in the list of active tools 00401 AlgTools::reverse_iterator it = 00402 std::find( m_tools.rbegin() , m_tools.rend() , algTool ) ; 00403 if( m_tools.rend() == it ) 00404 { return Warning("releaseTool(IAlgTool):: IAlgTool* is not active" ) ; } 00405 // get the tool 00406 IAlgTool* t = *it ; 00407 // cache name 00408 const std::string name = t->name(); 00409 if ( msgLevel(MSG::DEBUG) ) 00410 { debug() << "Releasing tool '" << name << "'" << endmsg; } 00411 // remove the tool from the lists 00412 m_tools.erase( --it.base() ) ; 00413 // release tool 00414 if ( msgLevel(MSG::DEBUG) ) { 00415 this->debug() << "The tool '" << t->name() << "' of type '" 00416 << System::typeinfoName(typeid(*t)) 00417 << "' is released" << endmsg; 00418 } 00419 const StatusCode sc = this->toolSvc()->releaseTool( t ) ; 00420 if ( sc.isFailure() ) 00421 { return Warning ( "releaseTool(IAlgTool):: error from IToolSvc whilst releasing "+name , sc ) ; } 00422 // return final status code 00423 return sc ; 00424 }
| StatusCode GaudiCommon< PBASE >::releaseSvc | ( | const IInterface * | svc | ) | const [inline, protected] |
manual forced (and 'safe') release of the service
Definition at line 431 of file GaudiCommon.icpp.
00432 { 00433 if( 0 == Svc ) { 00434 return Error ( "releaseSvc(IInterface):: IInterface* points to NULL!" ) ; 00435 } 00436 SmartIF<IService> svc(const_cast<IInterface*>(Svc)); 00437 if (svc.isValid()) { 00438 Services::iterator it = m_services.find(svc->name()); 00439 if (it == m_services.end()) { 00440 return Warning( "releaseSvc(IInterface):: IInterface* is not active" ); 00441 } 00442 if ( msgLevel(MSG::DEBUG) ) { 00443 debug() << "Releasing service '" << it->first << "'" << endmsg; 00444 } 00445 m_services.erase(it); 00446 return StatusCode::SUCCESS; 00447 } 00448 return Warning( "releaseSvc(IInterface):: IInterface* is not a service" ); 00449 }
| StatusCode GaudiCommon< PBASE >::release | ( | const IInterface * | interface | ) | const [inline] |
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 ) ;
| interface | Interface pointer to the interface to be released |
| StatusCode::SUCCESS | Tool or service was successfully released | |
| StatusCode::FAILURE | Error releasing too or service |
Definition at line 379 of file GaudiCommon.icpp.
00380 { 00381 if ( 0 == interface ) 00382 { return Error ( "release(IInterface):: IInterface* points to NULL!" ) ; } 00383 // dispatch between tools and services 00384 const IAlgTool* algTool = dynamic_cast<const IAlgTool*>( interface ) ; 00385 // perform the actual release 00386 return 0 != algTool ? releaseTool( algTool ) : releaseSvc( interface ) ; 00387 }
| const AlgTools& GaudiCommon< PBASE >::tools | ( | ) | const [inline] |
get the list of aquired tools
Definition at line 738 of file GaudiCommon.h.
00738 { return m_tools ; } // get all tools
| const Services& GaudiCommon< PBASE >::services | ( | ) | const [inline] |
get the list of aquired services
Definition at line 740 of file GaudiCommon.h.
00740 { return m_services ; } // get all services
| void GaudiCommon< PBASE >::printErrorHandler | ( | Property & | ) | [inline, private] |
handler for "ErrorPrint" property
Definition at line 806 of file GaudiCommon.icpp.
00807 { 00808 // no action if not yet initialized 00809 if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; } 00810 if ( this -> errorsPrint() ) { this -> printErrors () ; } 00811 }
| void GaudiCommon< PBASE >::printPropsHandler | ( | Property & | ) | [inline, private] |
handler for "PropertiesPrint" property
Definition at line 816 of file GaudiCommon.icpp.
00817 { 00818 // no action if not yet initialized 00819 if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; } 00820 if ( this -> propsPrint() ) { this -> printProps ( MSG::ALWAYS ) ; } 00821 }
| void GaudiCommon< PBASE >::printStatHandler | ( | Property & | ) | [inline, private] |
handler for "StatPrint" property
Definition at line 826 of file GaudiCommon.icpp.
00827 { 00828 // no action if not yet initialized 00829 if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; } 00830 if ( this -> statPrint() ) { this -> printStat ( MSG::ALWAYS ) ; } 00831 }
| 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.
00754 { return m_context; }
| 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.
00758 { return m_rootInTES; }
| double GaudiCommon< PBASE >::globalTimeOffset | ( | ) | const [inline] |
Returns the "globalTimeOffset" double.
Definition at line 760 of file GaudiCommon.h.
00760 { return m_globalTimeOffset; }
| void GaudiCommon< PBASE >::addToToolList | ( | IAlgTool * | tool | ) | const [inline, private] |
Add the given tool to the list of acquired tools.
Definition at line 456 of file GaudiCommon.icpp.
00457 { 00458 if( 0 != tool ) { 00459 if ( this->msgLevel ( MSG::DEBUG ) ) { 00460 this->debug() << "The tool of type '" 00461 << System::typeinfoName(typeid(*tool)) 00462 << "' has been added with the name '" 00463 << tool->name() << "'" << endmsg ; 00464 } 00465 m_tools.push_back( tool ) ; 00466 } 00467 }
| void GaudiCommon< PBASE >::addToServiceList | ( | const SmartIF< IService > & | svc | ) | const [inline, private] |
Add the given service to the list of acquired services.
Definition at line 474 of file GaudiCommon.icpp.
00475 { 00476 if (svc.isValid()) { 00477 m_services[svc->name()] = svc; 00478 } 00479 }
| void GaudiCommon< PBASE >::initGaudiCommonConstructor | ( | const IInterface * | parent = 0 |
) | [inline, private] |
Constructor initializations.
< flag to use the special "efficiency" format
Definition at line 68 of file GaudiCommon.icpp.
00069 { 00070 // initialise data members 00071 m_msgLevel = MSG::NIL; 00072 m_msgStream = 0; 00073 m_updMgrSvc = 0; 00074 m_fastContainersSvc = 0; 00075 m_typePrint = true; 00076 m_propsPrint = false; 00077 m_statPrint = true; 00078 m_errorsPrint = true; 00079 m_context = "" ; 00080 m_rootInTES = "" ; 00081 m_globalTimeOffset = 0.0 ; 00082 //data members for the CounterSummarySvc 00083 m_counterSummarySvc=NULL; 00084 m_counterList=std::vector<std::string>(1,".*"); 00085 m_statEntityList=std::vector<std::string>(0); 00086 00087 // printout of counters: 00088 00089 // the header row for counters printout 00090 m_header = " | Counter | # | sum | mean/eff^* | rms/err^* | min | max |" ; 00091 // format for regular statistical printout rows 00092 m_format1 = " | %|-48.48s|%|50t||%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |" ; 00093 // format for "efficiency" statistical printout rows 00094 m_format2 = " |*%|-48.48s|%|50t||%|10d| |%|11.5g| |(%|#9.6g| +- %|-#9.6g|)%%| ------- | ------- |" ; 00095 // flag to use the special "efficiency" format 00096 m_useEffFormat = true ; 00097 00098 // job options 00099 // print error counters at finalization ? 00100 this->declareProperty 00101 ( "ErrorsPrint" , m_errorsPrint , 00102 "Print the statistics of errors/warnings/exceptions") 00103 -> declareUpdateHandler 00104 ( &GaudiCommon<PBASE>::printErrorHandler, this ) ; 00105 // print properties at initialization? 00106 this->declareProperty 00107 ( "PropertiesPrint" , m_propsPrint , 00108 "Print the properties of the component ") 00109 -> declareUpdateHandler 00110 ( &GaudiCommon<PBASE>::printPropsHandler, this ) ; 00111 // print statistical counters at finalization ? 00112 this->declareProperty 00113 ( "StatPrint" , m_statPrint , 00114 "Print the table of counters" ) 00115 -> declareUpdateHandler 00116 ( &GaudiCommon<PBASE>::printStatHandler, this ) ; 00117 // insert the actual C++ type of the algorithm or tool in the messages? 00118 this->declareProperty 00119 ( "TypePrint" , m_typePrint , 00120 "Add the actal C++ component type into the messages" ) ; 00121 // context 00122 this->declareProperty ( "Context" , m_context ) ; 00123 // root in TES 00124 this->declareProperty ( "RootInTES" , m_rootInTES ) ; 00125 // root on TES ( temporary ) 00126 this->declareProperty ( "RootOnTES" , m_rootOnTES ) ; 00127 // global time offset 00128 this->declareProperty ( "GlobalTimeOffset", m_globalTimeOffset ) ; 00129 00130 00131 // the header row for counters printout 00132 this->declareProperty 00133 ( "StatTableHeader" , m_header , 00134 "The header row for the output Stat-table" ) ; 00135 // format for regular statistical printout rows 00136 this->declareProperty 00137 ( "RegularRowFormat" , m_format1 , 00138 "The format for the regular row in the output Stat-table" ) ; 00139 // format for "efficiency" statistical printout rows 00140 this->declareProperty 00141 ( "EfficiencyRowFormat" , m_format2 , 00142 "The format for the regular row in the output Stat-table" ) ; 00143 // flag to use the special "efficiency" format 00144 this->declareProperty 00145 ( "UseEfficiencyRowFormat" , m_useEffFormat , 00146 "Use the special format for printout of efficiency counters" ) ; 00147 00148 00149 //declare the list of simple counters to write. 00150 this->declareProperty( 00151 "CounterList", 00152 m_counterList=std::vector<std::string>(1,".*"), 00153 "RegEx list, of simple integer counters for CounterSummary."); 00154 //declare the list of stat entities to write. 00155 this->declareProperty( 00156 "StatEntityList", 00157 m_statEntityList=std::vector<std::string>(0), 00158 "RegEx list, of StatEntity counters for CounterSummary."); 00159 00160 // add handler for message level changes 00161 this->outputLevelProperty().declareUpdateHandler( &GaudiCommon<PBASE>::msgLevelHandler, this ); 00162 00163 // setup context from parent if available 00164 if ( parent ) 00165 { 00166 if ( const GaudiAlgorithm* gAlg = dynamic_cast<const GaudiAlgorithm*>(parent) ) 00167 { 00168 m_context = gAlg->context(); 00169 m_rootInTES = gAlg->rootInTES(); 00170 m_globalTimeOffset = gAlg->globalTimeOffset(); 00171 } 00172 else if ( const GaudiTool* gTool = dynamic_cast<const GaudiTool*> (parent) ) 00173 { 00174 m_context = gTool->context(); 00175 m_rootInTES = gTool->rootInTES(); 00176 m_globalTimeOffset = gTool->globalTimeOffset(); 00177 } 00178 } 00179 00180 // Get the job option service 00181 IJobOptionsSvc* jos = svc<IJobOptionsSvc>( "JobOptionsSvc" ); 00182 00183 // Get the "Context" option if in the file... 00184 const std::vector<const Property*>* myList = jos->getProperties( this->name() ); 00185 if ( 0 != myList ) 00186 { 00187 // Iterate over the list to set the options 00188 for ( std::vector<const Property*>::const_iterator iter = myList->begin(); 00189 iter != myList->end(); 00190 ++iter ) 00191 { 00192 const StringProperty* sp = dynamic_cast<const StringProperty*>(*iter); 00193 if ( 0 != sp ) 00194 { 00195 if ( "Context" == (*iter)->name() ) 00196 { 00197 m_context = sp->value(); 00198 } else if ( "RootInTES" == (*iter)->name() ) { 00199 m_rootInTES = sp->value(); 00200 } else if ( "GlobalTimeOffset" == (*iter)->name() ) { 00201 m_globalTimeOffset = atof( sp->value().c_str() ); 00202 } 00203 } 00204 } 00205 } 00206 00207 // release tool 00208 release( jos ).ignore(); 00209 00210 }
| const std::string GaudiCommon< PBASE >::fullTESLocation | ( | const std::string & | location, | |
| const bool | useRootInTES | |||
| ) | const [inline, private] |
Returns the full correct event location given the rootInTes settings.
Definition at line 25 of file GaudiCommonImp.h.
00027 { 00028 // The logic is: 00029 // if no R.I.T., give back location 00030 // if R.I.T., this is the mapping: 00031 // (note that R.I.T. contains a trailing '/') 00032 // location -> result 00033 // ------------------------------------------------- 00034 // "" -> R.I.T.[:-1] ("rit") 00035 // "/Event" -> R.I.T.[:-1] ("rit") 00036 // "/Event/MyObj" -> R.I.T. + "MyObj" ("rit/MyObj") 00037 // "MyObj" -> R.I.T. + "MyObj" ("rit/MyObj") 00038 return ( !useRootInTES || rootInTES().empty() ? 00039 location 00040 : 00041 location.empty() || ( location == "/Event" ) ? 00042 rootInTES().substr(0,rootInTES().size()-1) 00043 : 00044 0 == location.find("/Event/") ? 00045 rootInTES() + location.substr(7) 00046 : 00047 rootInTES() + location ); 00048 }
const bool GaudiCommon< PBASE >::IgnoreRootInTES = false [static, protected] |
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 72 of file GaudiCommon.h.
const bool GaudiCommon< PBASE >::UseRootInTES = true [static, protected] |
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 84 of file GaudiCommon.h.
ICounterSummarySvc* GaudiCommon< PBASE >::m_counterSummarySvc [protected] |
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 101 of file GaudiCommon.h.
std::vector<std::string> GaudiCommon< PBASE >::m_statEntityList [protected] |
Definition at line 103 of file GaudiCommon.h.
MSG::Level GaudiCommon< PBASE >::m_msgLevel [private] |
MsgStream* GaudiCommon< PBASE >::m_msgStream [mutable, private] |
AlgTools GaudiCommon< PBASE >::m_tools [mutable, private] |
Services GaudiCommon< PBASE >::m_services [mutable, private] |
Counter GaudiCommon< PBASE >::m_errors [mutable, private] |
Counter GaudiCommon< PBASE >::m_warnings [mutable, private] |
Counter GaudiCommon< PBASE >::m_infos [mutable, private] |
Counter GaudiCommon< PBASE >::m_exceptions [mutable, private] |
Statistics GaudiCommon< PBASE >::m_counters [mutable, private] |
IUpdateManagerSvc* GaudiCommon< PBASE >::m_updMgrSvc [mutable, private] |
IDataProviderSvc* GaudiCommon< PBASE >::m_fastContainersSvc [mutable, private] |
Pointer to the service providing transient fast containers.
Definition at line 796 of file GaudiCommon.h.
bool GaudiCommon< PBASE >::m_typePrint [private] |
insert the actual C++ type of the algorithm in the messages?
Definition at line 799 of file GaudiCommon.h.
bool GaudiCommon< PBASE >::m_propsPrint [private] |
bool GaudiCommon< PBASE >::m_statPrint [private] |
bool GaudiCommon< PBASE >::m_errorsPrint [private] |
std::string GaudiCommon< PBASE >::m_context [private] |
std::string GaudiCommon< PBASE >::m_rootInTES [private] |
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 814 of file GaudiCommon.h.
double GaudiCommon< PBASE >::m_globalTimeOffset [private] |
std::string GaudiCommon< PBASE >::m_header [private] |
std::string GaudiCommon< PBASE >::m_format1 [private] |
std::string GaudiCommon< PBASE >::m_format2 [private] |
bool GaudiCommon< PBASE >::m_useEffFormat [private] |