![]() |
|
|
Generated: 8 Jan 2009 |
#include <GaudiAlg/GaudiCommon.h>

Definition at line 56 of file 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> | |
| 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> | |
| 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 | 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. | |
| StatusCode | 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. | |
| StatusCode | 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. | |
| StatusCode | Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
| Create and (re)-throw a given GaudiException. | |
| StatusCode | Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
| Create and (re)-throw a given exception. | |
| StatusCode | 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 initalization ? | |
| 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 std::string & | context () const |
| Returns the "context" string. Used to indentify 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 std::pair< IInterface *, std::string > | ServiceEntry |
| Service pointer and name. | |
| typedef std::vector< ServiceEntry > | 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 | |
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 | addToToolList (IAlgTool *tool) const |
| Add the given tool to the list of acquired tools. | |
| void | addToServiceList (IInterface *svc, const std::string &name) 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_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 algoritm in the messages? | |
| bool | m_propsPrint |
| print properties at initalization? | |
| 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 | |
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 std::pair<IInterface*,std::string> GaudiCommon< PBASE >::ServiceEntry [protected] |
typedef std::vector<ServiceEntry> 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.
| 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> helper ; 00063 return helper ( *this , service , 00064 fullTESLocation ( location , useRootInTES ) ) ; 00065 }
| 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 71 of file GaudiCommonImp.h.
00074 { 00075 // check the environment 00076 Assert( 0 != service , "exist():: IDataProvider* points to NULL!" ) ; 00077 // check the data object 00078 const std::string & fullLoc = fullTESLocation( location, useRootInTES ); 00079 SmartDataPtr<TYPE> obj( service , fullLoc ) ; 00080 return obj ? true : false ; 00081 }
| 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 != svc , "getOrCreate():: svc points to NULL!" ) ; 00097 const std::string & fullLoc = fullTESLocation( location, useRootInTES ); 00098 SmartDataPtr<TYPE> obj ( svc , fullLoc ) ; 00099 if ( !obj ) 00100 { 00101 TYPE2* o = new TYPE2() ; 00102 put ( svc , o , location ) ; // do not use fullLoc here as put recreates it 00103 return o ; 00104 } 00105 TYPE* aux = obj ; 00106 if( !aux ) 00107 { Exception ( "getOrCreate():: No valid data at '" + fullLoc + "'" ) ; } 00108 // return located *VALID* data 00109 return aux ; 00110 }
| 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 661 of file GaudiCommon.icpp.
00665 { 00666 // check arguments 00667 Assert ( 0 != svc , "put():: Invalid 'service'!" ) ; 00668 Assert ( 0 != object , "put():: Invalid 'Object'!" ) ; 00669 Assert ( !location.empty() , "put():: Invalid 'address' = '' " ) ; 00670 // final data location 00671 const std::string & fullLocation = fullTESLocation( location, useRootInTES ); 00672 // register the object! 00673 const StatusCode status = '/' == fullLocation[0] ? 00674 svc -> registerObject( fullLocation , object ) : 00675 svc -> registerObject( "/Event/" + fullLocation , object ) ; 00676 // check the result! 00677 if ( status.isFailure() ) 00678 { Exception ( "put():: could not register '" + 00679 System::typeinfoName( typeid( *object ) ) + 00680 "' at address '" + fullLocation + "'" , status ) ; } 00681 if ( msgLevel( MSG::DEBUG ) ) 00682 { Print( "The object of type '" + 00683 System::typeinfoName( typeid( *object ) ) + 00684 "' is registered in TS at address '" 00685 + fullLocation + "'" , status , MSG::DEBUG ) ; } 00686 return object; 00687 }
| 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 118 of file GaudiCommonImp.h.
00122 { 00123 TOOL* Tool = 0 ; 00124 // for empty names delegate to another method 00125 if ( name.empty() ) 00126 { 00127 Tool = tool<TOOL>( type , parent , create ) ; 00128 } 00129 else 00130 { 00131 Assert( 0 != this->toolSvc() , "tool():: IToolSvc* points to NULL!" ) ; 00132 // get the tool from Tool Service 00133 const StatusCode sc = 00134 this->toolSvc()->retrieveTool ( type , name , Tool , parent , create ) ; 00135 if ( sc.isFailure() ) 00136 { Exception("tool():: Could not retrieve Tool '" + type + "'/'" + name + "'", sc ) ; } 00137 if ( 0 == Tool ) 00138 { Exception("tool():: Could not retrieve Tool '" + type + "'/'" + name + "'" ) ; } 00139 // add the tool into list of known tools to be properly released 00140 addToToolList( Tool ); 00141 } 00142 // return *VALID* located tool 00143 return Tool ; 00144 }
| 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 nonexisting tools |
Definition at line 152 of file GaudiCommonImp.h.
00155 { 00156 // check the environment 00157 Assert ( 0 != PBASE::toolSvc() , "IToolSvc* points to NULL!" ); 00158 // retrieve the tool from Tool Service 00159 TOOL* Tool = 0 ; 00160 const StatusCode sc = 00161 this->toolSvc() -> retrieveTool ( type, Tool, parent , create ); 00162 if ( sc.isFailure() ) 00163 { Exception("tool():: Could not retrieve Tool '" + type + "'", sc ) ; } 00164 if ( 0 == Tool ) 00165 { Exception("tool():: Could not retrieve Tool '" + type + "'" ) ; } 00166 // add the tool into the list of known tools to be properly released 00167 addToToolList( Tool ); 00168 // return *VALID* located tool 00169 return Tool ; 00170 }
| 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 178 of file GaudiCommonImp.h.
00180 { 00181 SERVICE* s = 0 ; 00182 Assert ( 0 != this->svcLoc() , "ISvcLocator* points to NULL!" ); 00183 // retrieve the service using templated method Algorithm::service 00184 StatusCode sc = this->svcLoc() -> service( name , s , create ) ; 00185 // check the results 00186 if ( sc.isFailure() ) 00187 { Exception ( "svc():: Could not retrieve Svc '" + name + "'", sc ) ; } 00188 if ( 0 == s ) 00189 { Exception ( "svc():: Could not retrieve Svc '" + name + "'" ) ; } 00190 // add the tool into list of known tools, to be properly released 00191 addToServiceList( s, name ) ; 00192 // return *VALID* located service 00193 return s ; 00194 }
| IUpdateManagerSvc * GaudiCommon< PBASE >::updMgrSvc | ( | ) | const [inline] |
Short-cut to locate the Update Manager Service.
Definition at line 202 of file GaudiCommonImp.h.
00203 { 00204 if ( !m_updMgrSvc ) 00205 { m_updMgrSvc = svc<IUpdateManagerSvc>("UpdateManagerSvc",true); } 00206 return m_updMgrSvc ; 00207 }
| IDataProviderSvc * GaudiCommon< PBASE >::fastContainersSvc | ( | ) | const [inline] |
Short-cut to locate the Fast Containers Service.
Definition at line 215 of file GaudiCommonImp.h.
00216 { 00217 if ( !m_fastContainersSvc ) 00218 { m_fastContainersSvc = svc<IDataProviderSvc>("FastContainersSvc",true); } 00219 return m_fastContainersSvc ; 00220 }
| 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 406 of file GaudiCommon.icpp.
00409 { 00410 // increase local counter of errors 00411 const size_t num = ++m_errors[msg] ; 00412 // If suppressed, just return 00413 if ( num > mx ) { return st ; } 00414 else if ( num == mx ) // issue one-time suppresion message 00415 { return Print ( "The ERROR message is suppressed : '" + 00416 msg + "'" , st , MSG::ERROR ) ; } 00417 // return message 00418 return Print ( msg , st , MSG::ERROR ) ; 00419 }
| 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 427 of file GaudiCommon.icpp.
00430 { 00431 // increase local counter of warnings 00432 const size_t num = ++m_warnings[msg] ; 00433 // If suppressed, just return 00434 if ( num > mx ) { return st ; } 00435 else if ( num == mx ) // issue one-time suppresion message 00436 { return Print ( "The WARNING message is suppressed : '" + 00437 msg + "'" , st , MSG::WARNING ) ; } 00438 // return message 00439 return Print ( msg , st , MSG::WARNING ) ; 00440 }
| 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 447 of file GaudiCommon.icpp.
00450 { 00451 // perform printout ? 00452 if ( !msgLevel( lvl ) ) { return st ; } // RETURN 00453 00454 // use the predefined stream 00455 MsgStream& str = msgStream( lvl ) ; 00456 if ( typePrint() ) { str << System::typeinfoName(typeid(*this)) << ":: " ; } 00457 // print the message 00458 str << msg ; 00459 // test status code 00460 if ( st.isSuccess() ) { } 00461 else if ( StatusCode::FAILURE != st.getCode() ) 00462 { str << " StatusCode=" << st.getCode() ; } 00463 else 00464 { str << " StatusCode=FAILURE" ; } 00465 // perform print operation 00466 str << endreq ; 00467 // return 00468 return st; 00469 }
| StatusCode 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 | |
| sc | StatusCode to be returned (artificial) |
Reimplemented in ErrorTool.
Definition at line 274 of file GaudiCommonImp.h.
00277 { 00278 return ( OK ? StatusCode(StatusCode::SUCCESS, true) : Exception( msg , sc ) ) ; 00279 }
| StatusCode 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 | |
| sc | StatusCode to be returned (artificial) |
Definition at line 297 of file GaudiCommonImp.h.
00300 { 00301 return OK ? StatusCode(StatusCode::SUCCESS, true) : Exception( msg , sc ) ; 00302 }
| StatusCode 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.
| CaudiException | always thrown! |
| msg | Exception message | |
| exc | (previous) exception of type GaudiException | |
| sc | StatusCode |
Reimplemented in ErrorTool.
Definition at line 476 of file GaudiCommon.icpp.
00479 { 00480 // increase local counter of exceptions 00481 ++m_exceptions[ msg ]; 00482 Print ( "Exception (re)throw: " + msg , sc , MSG::FATAL ); 00483 throw GaudiException( this->name() + ":: " + msg , this->name() , sc, exc); 00484 return sc ; 00485 }
| StatusCode 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 492 of file GaudiCommon.icpp.
00495 { 00496 // increase local counter of exceptions 00497 ++m_exceptions[ msg ]; 00498 Print ( "Exception (re)throw: " + msg , sc , MSG::FATAL ); 00499 throw GaudiException( this->name() + ":: " + msg+"("+exc.what()+")", "", sc ); 00500 return sc ; 00501 }
| StatusCode 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 508 of file GaudiCommon.icpp.
00510 { 00511 // increase local counter of exceptions 00512 ++m_exceptions[ msg ]; 00513 Print ( "Exception throw: " + msg , sc , MSG::FATAL ); 00514 throw GaudiException( this->name() + ":: " + msg , "", sc ); 00515 return sc ; 00516 }
| 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 = " << endreq ; }
Definition at line 262 of file GaudiCommonImp.h.
00263 { 00264 if ( !m_msgStream ) 00265 { m_msgStream = new MsgStream ( PBASE::msgSvc() , this->name() ) ; } 00266 return *m_msgStream << level ; 00267 }
| MsgStream& GaudiCommon< PBASE >::always | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::ALWAYS )
Definition at line 457 of file GaudiCommon.h.
00457 { return msgStream ( MSG:: ALWAYS ) ; }
| MsgStream& GaudiCommon< PBASE >::fatal | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::FATAL )
Definition at line 459 of file GaudiCommon.h.
00459 { return msgStream ( MSG:: FATAL ) ; }
| MsgStream& GaudiCommon< PBASE >::err | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::ERROR )
Definition at line 461 of file GaudiCommon.h.
00461 { return msgStream ( MSG:: ERROR ) ; }
| MsgStream& GaudiCommon< PBASE >::error | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::ERROR )
Definition at line 463 of file GaudiCommon.h.
00463 { return msgStream ( MSG:: ERROR ) ; }
| MsgStream& GaudiCommon< PBASE >::warning | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::WARNING )
Definition at line 465 of file GaudiCommon.h.
00465 { return msgStream ( MSG:: WARNING ) ; }
| MsgStream& GaudiCommon< PBASE >::info | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::INFO )
Definition at line 467 of file GaudiCommon.h.
00467 { return msgStream ( MSG:: INFO ) ; }
| MsgStream& GaudiCommon< PBASE >::debug | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::DEBUG )
Definition at line 469 of file GaudiCommon.h.
00469 { return msgStream ( MSG:: DEBUG ) ; }
| MsgStream& GaudiCommon< PBASE >::verbose | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::VERBOSE )
Definition at line 471 of file GaudiCommon.h.
00471 { return msgStream ( MSG:: VERBOSE ) ; }
| MsgStream& GaudiCommon< PBASE >::msg | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::INFO )
Definition at line 473 of file GaudiCommon.h.
00473 { return msgStream ( MSG:: INFO ) ; }
| const Statistics& GaudiCommon< PBASE >::counters | ( | ) | const [inline] |
accessor to all counters
Definition at line 476 of file GaudiCommon.h.
00476 { 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 495 of file GaudiCommon.h.
00495 { return m_counters[tag] ; }
| MSG::Level GaudiCommon< PBASE >::msgLevel | ( | ) | const [inline] |
The current message service output level.
Definition at line 500 of file GaudiCommon.h.
00500 { 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 507 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 286 of file GaudiCommonImp.h.
00287 { 00288 if ( 0 != m_msgStream ) { delete m_msgStream; m_msgStream = 0; } 00289 }
| bool GaudiCommon< PBASE >::typePrint | ( | ) | const [inline] |
Insert the actual C++ type of the algorithm/tool in the messages ?
Definition at line 514 of file GaudiCommon.h.
00514 { return m_typePrint ; }
| bool GaudiCommon< PBASE >::propsPrint | ( | ) | const [inline] |
Print properties at initalization ?
Definition at line 516 of file GaudiCommon.h.
00516 { return m_propsPrint ; }
| bool GaudiCommon< PBASE >::statPrint | ( | ) | const [inline] |
Print statistical counters at finalization ?
Definition at line 518 of file GaudiCommon.h.
00518 { return m_statPrint ; }
| bool GaudiCommon< PBASE >::errorsPrint | ( | ) | const [inline] |
Print error counters at finalization ?
Definition at line 520 of file GaudiCommon.h.
00520 { 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 627 of file GaudiCommon.icpp.
00628 { 00629 // Force a new MsgStream object, to pick up the new settings 00630 resetMsgStream(); 00631 00632 // adjust internal message level 00633 m_msgLevel = 00634 this->outputLevel() < (int) MSG::NIL ? MSG::NIL : 00635 this->outputLevel() >= (int) MSG::NUM_LEVELS ? MSG::ALWAYS : 00636 MSG::Level( this->outputLevel() ) ; 00637 00638 // Keep MessageSvc up to date if needed 00639 if ( this->msgSvc()->outputLevel(this->name()) != this->outputLevel() ) 00640 { 00641 this->msgSvc()->setOutputLevel( this->name(), this->outputLevel() ); 00642 } 00643 00644 // printout message 00645 if ( msgLevel(MSG::DEBUG) ) 00646 { 00647 debug() << "Property update for " 00648 << theProp.name() << " : new value = " << this->outputLevel() << endreq; 00649 } 00650 }
| 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 523 of file GaudiCommon.icpp.
00524 { 00525 // print statistics 00526 if ( counters().empty() ) { return 0 ; } 00527 MsgStream& msg = msgStream ( level ) ; 00528 // 00529 msg << "Number of counters : " << counters().size() ; 00530 // 00531 if ( !counters().empty() ) { msg << std::endl << m_header ; } 00532 // 00533 for ( Statistics::const_iterator entry = counters().begin() ; 00534 counters().end() != entry ; ++entry ) 00535 { 00536 msg << std::endl 00537 << Gaudi::Utils::formatAsTableRow 00538 ( entry -> first , 00539 entry -> second , 00540 m_useEffFormat , 00541 m_format1 , m_format2 ); 00542 } 00543 // 00544 msg << endreq ; 00545 // 00546 return counters().size() ; 00547 }
| 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 554 of file GaudiCommon.icpp.
00555 { 00556 // format for printout 00557 boost::format ftm ( " %s = %|.8s| %|23t| Message = '%s'" ); 00558 00559 { // print exceptions 00560 for ( Counter::const_iterator excp = m_exceptions.begin() ; 00561 excp != m_exceptions.end() ; ++excp ) 00562 { 00563 msgStream(level) 00564 << ( ftm % "#EXCEPTIONS" % excp->second % excp->first ) 00565 << endreq; 00566 } 00567 } 00568 { // print errors 00569 for ( Counter::const_iterator error = m_errors.begin() ; 00570 error != m_errors.end() ; ++error ) 00571 { 00572 msgStream(level) 00573 << ( ftm % "#ERRORS " % error->second % error->first ) 00574 << endreq; 00575 } 00576 } 00577 { // print warnings 00578 for ( Counter::const_iterator warning = m_warnings.begin() ; 00579 warning != m_warnings.end() ; ++warning ) 00580 { 00581 msgStream(level) 00582 << ( ftm % "#WARNINGS " % warning->second % warning->first ) 00583 << endreq; 00584 } 00585 } 00586 00587 // return total number of errors+warnings+exceptions 00588 return 00589 m_exceptions .size () + 00590 m_errors .size () + 00591 m_warnings .size () ; 00592 }
| 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 601 of file GaudiCommon.icpp.
00602 { 00603 00604 // print ALL properties 00605 MsgStream& msg = msgStream ( level ); 00606 typedef std::vector<Property*> Properties; 00607 const Properties& properties = this->getProperties() ; 00608 msg << "List of ALL properties of " 00609 << System::typeinfoName( typeid( *this ) ) << "/" << this->name() 00610 << " #properties = " << properties.size() << endreq ; 00611 for ( Properties::const_reverse_iterator property 00612 = properties.rbegin() ; 00613 properties.rend() != property ; ++property ) 00614 { 00615 msg << "Property ['Name': Value] = " 00616 << ( **property) 00617 << endreq ; 00618 } 00619 return properties.size() ; 00620 }
| 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 explicitely 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 560 of file GaudiCommon.h.
00560 { 00561 updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf); 00562 }
| 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 explicitely 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 594 of file GaudiCommon.h.
00595 { 00596 updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf,condPtrDest); 00597 }
| 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 600 of file GaudiCommon.h.
00600 { 00601 updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),std::string(condition),mf); 00602 }
| 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 explicitely 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 619 of file GaudiCommon.h.
00619 { 00620 updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf); 00621 }
| 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 633 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 228 of file GaudiCommonImp.h.
00230 { 00231 typedef TransientFastContainer<T> container_type; 00232 00233 IDataProviderSvc* svc = fastContainersSvc(); 00234 Assert( 0 != svc , "getFastContainer(): cannot get FastContainersSvc" ); 00235 00236 container_type *ptr = NULL; 00237 SmartDataPtr<container_type> obj( svc, location ); 00238 if (!obj){ 00239 ptr = new container_type(initial); 00240 StatusCode status = svc->registerObject(location,ptr); 00241 if ( !status.isSuccess() ){ 00242 Exception("getFastContainer(): cannot register '" + 00243 System::typeinfoName( typeid( *ptr ) ) + 00244 "' at address '" + location + "'" , status ); 00245 } 00246 } else { 00247 ptr = obj; 00248 if ( !ptr ){ 00249 Exception("getFastContainer(): No valid container at '" + location + "'"); 00250 } 00251 } 00252 00253 return ptr; 00254 }
| 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 191 of file GaudiCommon.icpp.
00192 { 00193 00194 // initialize base class 00195 const StatusCode sc = PBASE::initialize(); 00196 if ( sc.isFailure() ) 00197 { return Error ( "Failed to initialise base class PBASE", sc ) ; } 00198 00199 00200 // some debug printout 00201 if ( msgLevel(MSG::DEBUG) ) 00202 { 00203 debug() << "Initialize base class GaudiCommon<" << System::typeinfoName(typeid(PBASE)) << ">" << endreq; 00204 if ( !context().empty() ) 00205 debug() << "Created with context = '" << context() << "'" << endreq; 00206 } 00207 00208 // some temporary checks to see if people are using RootOnTES and warn if so 00209 // TO BE REMOVED ASAP ... 00210 if ( m_rootInTES.empty() && !m_rootOnTES.empty() ) 00211 { 00212 m_rootInTES = m_rootOnTES; 00213 Warning( "RootOnTES option is OBSOLETE -> Use RootInTES instead. RootInTES has been updated to " 00214 + m_rootInTES, StatusCode::SUCCESS ).ignore(); 00215 } 00216 else if ( !m_rootInTES.empty() && !m_rootOnTES.empty() ) 00217 { 00218 Warning( "Options RootOnTES AND RootInTES are defined ! Use RootInTES. RootOnTES is ignored", 00219 StatusCode::SUCCESS ).ignore(); 00220 } 00221 00222 // Check rootInTES ends with a / 00223 if ( !m_rootInTES.empty() && 00224 m_rootInTES.substr(m_rootInTES.size()-1) != "/" ) m_rootInTES += "/"; 00225 00226 // properties will be printed if asked for or in "MSG::DEBUG" mode 00227 if ( propsPrint() ) { printProps(MSG::ALWAYS); } 00228 else if ( msgLevel(MSG::DEBUG) ) { printProps(MSG::DEBUG); } 00229 00230 return sc; 00231 }
| 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 238 of file GaudiCommon.icpp.
00239 { 00240 StatusCode sc = StatusCode::SUCCESS; 00241 00242 // print the general information about statistical counters 00243 if ( msgLevel(MSG::DEBUG) || (statPrint() && !counters().empty()) ) 00244 { 00245 // print general statictical counters 00246 printStat ( statPrint() ? MSG::ALWAYS : MSG::DEBUG ) ; 00247 } 00248 00249 // release all located tools and services 00250 if ( msgLevel(MSG::DEBUG) ) 00251 { 00252 debug() << "Tools to release :"; 00253 for ( AlgTools::const_iterator i = m_tools.begin(); 00254 i != m_tools.end(); ++i ) 00255 { 00256 debug() << " " << (*i)->name(); 00257 } 00258 debug() << endreq; 00259 } 00260 while ( !m_tools.empty() ) { sc = sc && release( m_tools.back() ) ; } 00261 00262 // release all located services 00263 if ( msgLevel(MSG::DEBUG) ) 00264 { 00265 debug() << "Services to release :"; 00266 for ( Services::const_iterator i = m_services.begin(); 00267 i != m_services.end(); ++i ) 00268 { 00269 debug() << " " << (*i).second; 00270 } 00271 debug() << endreq; 00272 } 00273 while ( !m_services.empty() ) { sc = sc && release( m_services.back().first ); } 00274 00275 // format printout 00276 if ( !m_errors.empty() || !m_warnings.empty() || !m_exceptions.empty() ) 00277 { 00278 always() << "Exceptions/Errors/Warnings Statistics : " 00279 << m_exceptions .size () << "/" 00280 << m_errors .size () << "/" 00281 << m_warnings .size () << endreq ; 00282 if ( errorsPrint() ) { printErrors () ; } 00283 } 00284 00285 // delete the MsgStream 00286 resetMsgStream(); 00287 00288 // clear *ALL* counters explicitely 00289 m_counters .clear() ; 00290 m_exceptions .clear() ; 00291 m_warnings .clear() ; 00292 m_errors .clear() ; 00293 00294 // finalize base class 00295 return sc && PBASE::finalize(); 00296 }
| 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 322 of file GaudiCommon.icpp.
00323 { 00324 if( 0 == algTool ) 00325 { return Error ( "releaseTool(IAlgTool):: IAlgTool* points to NULL!" ) ; } 00326 if( 0 == this->toolSvc() ) 00327 { return Error ( "releaseTool(IAlgTool):: IToolSvc* points to NULL!" ) ; } 00328 // find a tool in the list of active tools 00329 AlgTools::reverse_iterator it = 00330 std::find( m_tools.rbegin() , m_tools.rend() , algTool ) ; 00331 if( m_tools.rend() == it ) 00332 { return Warning("releaseTool(IAlgTool):: IAlgTool* is not active" ) ; } 00333 // get the tool 00334 IAlgTool* t = *it ; 00335 // cache name 00336 const std::string name = t->name(); 00337 if ( msgLevel(MSG::DEBUG) ) 00338 { debug() << "Releasing tool '" << name << "'" << endreq; } 00339 // remove the tool from the lists 00340 m_tools.erase( --it.base() ) ; 00341 // release tool 00342 const StatusCode sc = this->toolSvc()->releaseTool( t ) ; 00343 if ( sc.isFailure() ) 00344 { return Warning ( "releaseTool(IAlgTool):: error from IToolSvc whilst releasing "+name , sc ) ; } 00345 // return final status code 00346 return sc ; 00347 }
| StatusCode GaudiCommon< PBASE >::releaseSvc | ( | const IInterface * | svc | ) | const [inline, protected] |
manual forced (and 'safe') release of the service
Definition at line 354 of file GaudiCommon.icpp.
00355 { 00356 if( 0 == Svc ) 00357 { return Error ( "releaseSvc(IInterface):: IInterface* points to NULL!" ) ; } 00358 // find a service in the list of active services 00359 Services::reverse_iterator iS = m_services.rbegin(); 00360 for ( ; iS != m_services.rend(); ++iS ) { if ( (*iS).first == Svc ) break; } 00361 if ( m_services.rend() == iS ) 00362 { return Warning( "releaseSvc(IInterface):: IInterface* is not active" ) ; } 00363 // get the service 00364 IInterface * s = (*iS).first ; 00365 if ( msgLevel(MSG::DEBUG) ) 00366 { debug() << "Releasing service '" << (*iS).second << "'" << endreq; } 00367 // remove the service from the list of active services 00368 m_services.erase( --iS.base() ) ; 00369 // release the service 00370 s->release() ; 00371 // return 00372 return StatusCode::SUCCESS ; 00373 }
| 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 307 of file GaudiCommon.icpp.
00308 { 00309 if ( 0 == interface ) 00310 { return Error ( "release(IInterface):: IInterface* points to NULL!" ) ; } 00311 // dispatch between tools and services 00312 const IAlgTool* algTool = dynamic_cast<const IAlgTool*>( interface ) ; 00313 // perform teh actual release 00314 return 0 != algTool ? releaseTool( algTool ) : releaseSvc( interface ) ; 00315 }
| const std::string& GaudiCommon< PBASE >::context | ( | ) | const [inline] |
Returns the "context" string. Used to indentify different processing states.
Definition at line 696 of file GaudiCommon.h.
00696 { 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 700 of file GaudiCommon.h.
00700 { return m_rootInTES; }
| double GaudiCommon< PBASE >::globalTimeOffset | ( | ) | const [inline] |
Returns the "globalTimeOffset" double.
Definition at line 702 of file GaudiCommon.h.
00702 { 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 380 of file GaudiCommon.icpp.
00381 { 00382 m_tools.push_back( tool ) ; 00383 }
| void GaudiCommon< PBASE >::addToServiceList | ( | IInterface * | svc, | |
| const std::string & | name | |||
| ) | const [inline, private] |
Add the given service to the list of acquired services.
Definition at line 390 of file GaudiCommon.icpp.
00392 { 00393 const ServiceEntry sEntry( svc , name ); 00394 m_services.push_back( sEntry ) ; 00395 }
| void GaudiCommon< PBASE >::initGaudiCommonConstructor | ( | const IInterface * | parent = 0 |
) | [inline, private] |
Constructor initializations.
< flag to use the special "efficiency" format
Definition at line 70 of file GaudiCommon.icpp.
00071 { 00072 // initialise data members 00073 m_msgLevel = MSG::NIL; 00074 m_msgStream = 0; 00075 m_updMgrSvc = 0; 00076 m_fastContainersSvc = 0; 00077 m_typePrint = true; 00078 m_propsPrint = false; 00079 m_statPrint = true; 00080 m_errorsPrint = true; 00081 m_context = "" ; 00082 m_rootInTES = "" ; 00083 m_globalTimeOffset = 0.0 ; 00084 00085 // printout of counters: 00086 00087 // the header row for counters printout 00088 m_header = " | Counter | # | sum | mean/eff^* | rms/err^* | min | max |" ; 00089 // format for regular statistical printout rows 00090 m_format1 = " | %|-48.48s|%|50t||%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |" ; 00091 // format for "efficiency" statistical printout rows 00092 m_format2 = " |*%|-48.48s|%|50t||%|10d| |%|11.5g| |(%|#9.6g| +- %|-#9.6g|)%%| ------- | ------- |" ; 00093 // flag to use the special "efficiency" format 00094 m_useEffFormat = true ; 00095 00096 00097 // job options 00098 // print error counters at finalization ? 00099 this->declareProperty ( "ErrorsPrint" , m_errorsPrint ) ; 00100 // print properties at initalization? 00101 this->declareProperty ( "PropertiesPrint" , m_propsPrint ) ; 00102 // print statistical counters at finalization ? 00103 this->declareProperty ( "StatPrint" , m_statPrint ) ; 00104 // insert the actual C++ type of the algorithm or tool in the messages? 00105 this->declareProperty ( "TypePrint" , m_typePrint ) ; 00106 // context 00107 this->declareProperty ( "Context" , m_context ) ; 00108 // root in TES 00109 this->declareProperty ( "RootInTES" , m_rootInTES ) ; 00110 // root on TES ( temporary ) 00111 this->declareProperty ( "RootOnTES" , m_rootOnTES ) ; 00112 // global time offset 00113 this->declareProperty ( "GlobalTimeOffset", m_globalTimeOffset ) ; 00114 00115 00116 // the header row for counters printout 00117 this->declareProperty 00118 ( "StatTableHeader" , m_header , 00119 "The header row for the output Stat-table" ) ; 00120 // format for regular statistical printout rows 00121 this->declareProperty 00122 ( "RegularRowFormat" , m_format1 , 00123 "The format for the regular row in the output Stat-table" ) ; 00124 // format for "efficiency" statistical printout rows 00125 this->declareProperty 00126 ( "EfficiencyRowFormat" , m_format2 , 00127 "The format for the regular row in the outptu Stat-table" ) ; 00128 // flag to use the special "efficiency" format 00129 this->declareProperty 00130 ( "UseEfficiencyRowFormat" , m_useEffFormat , 00131 "Use the special format for printout of efficiency counters" ) ; 00132 00133 00134 // add handler for message level changes 00135 this->outputLevelProperty().declareUpdateHandler( &GaudiCommon<PBASE>::msgLevelHandler, this ); 00136 00137 // setup context from parent if available 00138 if ( parent ) 00139 { 00140 if ( const GaudiAlgorithm* gAlg = dynamic_cast<const GaudiAlgorithm*>(parent) ) 00141 { 00142 m_context = gAlg->context(); 00143 m_rootInTES = gAlg->rootInTES(); 00144 m_globalTimeOffset = gAlg->globalTimeOffset(); 00145 } 00146 else if ( const GaudiTool* gTool = dynamic_cast<const GaudiTool*> (parent) ) 00147 { 00148 m_context = gTool->context(); 00149 m_rootInTES = gTool->rootInTES(); 00150 m_globalTimeOffset = gTool->globalTimeOffset(); 00151 } 00152 } 00153 00154 // Get the job option service 00155 IJobOptionsSvc* jos = svc<IJobOptionsSvc>( "JobOptionsSvc" ); 00156 00157 // Get the "Context" option if in the file... 00158 const std::vector<const Property*>* myList = jos->getProperties( this->name() ); 00159 if ( 0 != myList ) 00160 { 00161 // Iterate over the list to set the options 00162 for ( std::vector<const Property*>::const_iterator iter = myList->begin(); 00163 iter != myList->end(); 00164 ++iter ) 00165 { 00166 const StringProperty* sp = dynamic_cast<const StringProperty*>(*iter); 00167 if ( 0 != sp ) 00168 { 00169 if ( "Context" == (*iter)->name() ) 00170 { 00171 m_context = sp->value(); 00172 } else if ( "RootInTES" == (*iter)->name() ) { 00173 m_rootInTES = sp->value(); 00174 } else if ( "GlobalTimeOffset" == (*iter)->name() ) { 00175 m_globalTimeOffset = atof( sp->value().c_str() ); 00176 } 00177 } 00178 } 00179 } 00180 00181 // release tool 00182 release( jos ).ignore(); 00183 00184 }
| 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 readablity. e.g.
// Get data, ignoring the setting of rootInTES() MyData * data = get<MyData>( "/Event/MyData", IgnoreRootInTES );
Definition at line 68 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 readablity. 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 80 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_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 737 of file GaudiCommon.h.
bool GaudiCommon< PBASE >::m_typePrint [private] |
insert the actual C++ type of the algoritm in the messages?
Definition at line 740 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 755 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] |