Gaudi Framework, version v20r2

Generated: 18 Jul 2008

GaudiCommon< PBASE > Class Template Reference

#include <GaudiAlg/GaudiCommon.h>

Collaboration diagram for GaudiCommon< PBASE >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class PBASE>
class GaudiCommon< PBASE >

Implements the common functionality between GaudiTools and GaudiAlgorithms.

Author:
Chris Jones Christopher.Rob.Jones@cern.ch

Vanya BELYAEV Ivan.Belyaev@itep.ru

Date:
2005-08-10

Definition at line 55 of file GaudiCommon.h.

Public Member Functions

template<class TYPE>
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.
void 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=false) const
 A useful method for the easy location of services.
IUpdateManagerSvcupdMgrSvc () const
 Short-cut to locate the Update Manager Service.
IDataProviderSvcfastContainersSvc () 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.
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts.
MsgStreamalways () const
 shortcut for the method msgStream ( MSG::ALWAYS )
MsgStreamfatal () const
 shortcut for the method msgStream ( MSG::FATAL )
MsgStreamerr () const
 shortcut for the method msgStream ( MSG::ERROR )
MsgStreamerror () const
 shortcut for the method msgStream ( MSG::ERROR )
MsgStreamwarning () const
 shortcut for the method msgStream ( MSG::WARNING )
MsgStreaminfo () const
 shortcut for the method msgStream ( MSG::INFO )
MsgStreamdebug () const
 shortcut for the method msgStream ( MSG::DEBUG )
MsgStreamverbose () const
 shortcut for the method msgStream ( MSG::VERBOSE )
MsgStreammsg () const
 shortcut for the method msgStream ( MSG::INFO )
const Statisticscounters () const
 accessor to all counters
StatEntitycounter (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::stringcontext () const
 Returns the "context" string. Used to indentify different processing states.
const std::stringrootInTES () const
 Returns the "rootInTES" string.
const 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< ServiceEntryServices
 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 &)
GaudiCommonoperator= (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.
MsgStreamm_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.
IUpdateManagerSvcm_updMgrSvc
 Pointer to the Update Manager Service instance.
IDataProviderSvcm_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


Member Typedef Documentation

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

the actual type of general counters

Definition at line 82 of file GaudiCommon.h.

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

the actual type error/warning counter

Definition at line 84 of file GaudiCommon.h.

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

storage for active tools

Definition at line 86 of file GaudiCommon.h.

template<class PBASE>
typedef std::pair<IInterface*,std::string> GaudiCommon< PBASE >::ServiceEntry [protected]

Service pointer and name.

Definition at line 88 of file GaudiCommon.h.

template<class PBASE>
typedef std::vector<ServiceEntry> GaudiCommon< PBASE >::Services [protected]

storage for active services

Definition at line 90 of file GaudiCommon.h.


Constructor & Destructor Documentation

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

Algorithm constructor.

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

Tool constructor.

template<class PBASE>
GaudiCommon< PBASE >::~GaudiCommon (  )  [protected, virtual]

Destructor.

Definition at line 62 of file GaudiCommon.icpp.

References GaudiCommon< PBASE >::resetMsgStream().

00062 { resetMsgStream(); }

template<class PBASE>
GaudiCommon< PBASE >::GaudiCommon (  )  [private]

template<class PBASE>
GaudiCommon< PBASE >::GaudiCommon ( const GaudiCommon< PBASE > &   )  [private]


Member Function Documentation

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

Attention:
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behaviour can be suppressed by passing the arguement useRootInTES = false
See also:
IDataProviderSvc

SmartDataPtr

Exceptions:
GaudiException for Invalid Data Provider Service
GaudiException for invalid/unavailable data
Parameters:
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
Returns:
pointer to the data object

Reimplemented in GaudiAlgorithm, and GaudiTool.

Definition at line 59 of file GaudiCommonImp.h.

References GaudiCommon< PBASE >::Assert(), GaudiCommon< PBASE >::debug(), MSG::DEBUG, endreq(), GaudiCommon< PBASE >::Exception(), GaudiCommon< PBASE >::fullTESLocation(), GaudiCommon< PBASE >::msgLevel(), and System::typeinfoName().

00062 {
00063   // check the environment
00064   Assert( 0 != service ,    "get():: IDataProvider* points to NULL!"      ) ;
00065   const std::string & fullLoc = fullTESLocation( location, useRootInTES );
00066   SmartDataPtr<TYPE> obj( service , fullLoc ) ;
00067   //if ( !obj ) { Exception ( "get():: No valid data at '" + fullLoc + "'" ) ; }
00068   TYPE* aux = obj ;
00069   if ( !aux ) { Exception ( "get():: No valid data at '" + fullLoc + "'" ) ; }
00070   if ( msgLevel( MSG::DEBUG ) )
00071   { this-> debug() << "The object of type '"
00072                    << System::typeinfoName(typeid(*aux))
00073                    << "' has been retrieved from TS at address '"
00074                    << fullLoc << "'" << endreq ; }
00075   // return located *VALID* data
00076   return aux ;
00077 }

template<class PBASE>
template<class TYPE>
bool GaudiCommon< PBASE >::exist ( IDataProviderSvc svc,
const std::string location,
const bool  useRootInTES = true 
) const [inline]

Check the existence of a data object or container in the Gaudi Transient Event Store.

  bool a1 = exist<DataObject>( evtSvc() , "/Event/MyObject" ) ;
  bool a2 = exist<MyHits>    ( evtSvc() , "/Event/MyHits" ) ;

Attention:
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behaviour can be suppressed by passing the arguement useRootInTES = false
Parameters:
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
Returns:
Boolean indicating status of the request
Return values:
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 85 of file GaudiCommonImp.h.

References GaudiCommon< PBASE >::Assert(), and GaudiCommon< PBASE >::fullTESLocation().

00088 {
00089   // check the environment
00090   Assert( 0 != service , "exist():: IDataProvider* points to NULL!"      ) ;
00091   // check the data object
00092   const std::string & fullLoc = fullTESLocation( location, useRootInTES );
00093   SmartDataPtr<TYPE> obj( service , fullLoc ) ;
00094   return obj ? true : false ;
00095 }

template<class PBASE>
template<class TYPE, class TYPE2>
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" ) ;

Attention:
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behaviour can be suppressed by passing the arguement useRootInTES = false
Exceptions:
GaudiException for Invalid Data Provider Service
GaudiException for invalid/unavailable data
Parameters:
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
Returns:
A valid pointer to the data object

Reimplemented in GaudiAlgorithm, and GaudiTool.

Definition at line 105 of file GaudiCommonImp.h.

References GaudiCommon< PBASE >::Assert(), GaudiCommon< PBASE >::Exception(), GaudiCommon< PBASE >::fullTESLocation(), GaudiCommon< PBASE >::put(), and GaudiCommon< PBASE >::svc().

00108 {
00109   // check the environment
00110   Assert( 0 != svc , "getOrCreate():: svc points to NULL!" ) ;
00111   const std::string & fullLoc = fullTESLocation( location, useRootInTES );
00112   SmartDataPtr<TYPE> obj ( svc , fullLoc ) ;
00113   if ( !obj )
00114   {
00115     TYPE2* o = new TYPE2() ;
00116     put ( svc , o , location ) ; // do not use fullLoc here as put recreates it
00117     return o ;
00118   }
00119   TYPE* aux = obj ;
00120   if( !aux )
00121   { Exception ( "getOrCreate():: No valid data at '" + fullLoc + "'" ) ; }
00122   // return located *VALID* data
00123   return aux ;
00124 }

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

Register a data object or container into Gaudi Event Transient Store.

See also:
IDataProviderSvc
Attention:
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behaviour can be suppressed by passing the arguement useRootInTES = false
Parameters:
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
Exceptions:
GaudiException for invalid event data service
GaudiException for invalid object
GaudiException for error result from event data service
Returns:
StatusCode
Return values:
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 682 of file GaudiCommon.icpp.

References GaudiCommon< PBASE >::Assert(), MSG::DEBUG, std::basic_string< _CharT, _Traits, _Alloc >::empty(), GaudiCommon< PBASE >::Exception(), GaudiCommon< PBASE >::fullTESLocation(), StatusCode::isFailure(), GaudiCommon< PBASE >::msgLevel(), GaudiCommon< PBASE >::Print(), GaudiCommon< PBASE >::svc(), and System::typeinfoName().

Referenced by GaudiCommon< PBASE >::getOrCreate(), GaudiTool::put(), and GaudiAlgorithm::put().

00686 {
00687   // check arguments
00688   Assert ( 0 != svc              , "put():: Invalid 'service'!"       ) ;
00689   Assert ( 0 != object           , "put():: Invalid 'Object'!"        ) ;
00690   Assert ( !location.empty()     , "put():: Invalid 'address' = '' " ) ;
00691   // final data location
00692   const std::string & fullLocation = fullTESLocation( location, useRootInTES );
00693   // register the object!
00694   const StatusCode status = '/' == fullLocation[0] ?
00695     svc -> registerObject(             fullLocation , object ) :
00696     svc -> registerObject( "/Event/" + fullLocation , object ) ;
00697   // check the result!
00698   if ( status.isFailure() )
00699   { Exception ( "put():: could not register '"            +
00700                 System::typeinfoName( typeid( *object ) ) +
00701                 "' at address '" + fullLocation + "'"  , status ) ; }
00702   if ( msgLevel( MSG::DEBUG ) )
00703   { Print( "The object of type '"                    +
00704            System::typeinfoName( typeid( *object ) ) +
00705            "' is registered in TS at address '"
00706            + fullLocation + "'" , status , MSG::DEBUG ) ; }
00707 }

template<class PBASE>
template<class TOOL>
TOOL * GaudiCommon< PBASE >::tool ( const std::string type,
const std::string name,
const IInterface parent = 0,
bool  create = true 
) const [inline]

Useful method for the easy location of tools.

  IMyTool* myTool =
      tool<IMyTool>( "MyToolType", "MyToolName", this );

Attention:
The tools located with this method will be released automatically
See also:
IToolSvc

IAlgTool

Exceptions:
GaudiException for invalid Tool Service
GaudiException for error from Tool Service
GaudiException for invalid tool
Parameters:
type Tool type
name Tool name
parent Tool parent
create Flag for creation of nonexisting tools
Returns:
A pointer to the tool

Definition at line 132 of file GaudiCommonImp.h.

References GaudiCommon< PBASE >::addToToolList(), GaudiCommon< PBASE >::Assert(), std::basic_string< _CharT, _Traits, _Alloc >::empty(), GaudiCommon< PBASE >::Exception(), and name.

Referenced by GaudiCommon< PBASE >::addToToolList(), and GaudiPython::AlgDecorator::tool_().

00136 {
00137   TOOL* Tool = 0 ;
00138   // for empty names delegate to another method
00139   if ( name.empty() )
00140   {
00141     Tool = tool<TOOL>( type , parent , create ) ;
00142   }
00143   else
00144   {
00145     Assert( 0 != this->toolSvc() , "tool():: IToolSvc* points to NULL!" ) ;
00146     // get the tool from Tool Service
00147     const StatusCode sc =
00148       this->toolSvc()->retrieveTool ( type , name , Tool , parent , create ) ;
00149     if ( sc.isFailure() )
00150     { Exception("tool():: Could not retrieve Tool '" + type + "'/'" + name + "'", sc ) ; }
00151     if ( 0 == Tool )
00152     { Exception("tool():: Could not retrieve Tool '" + type + "'/'" + name + "'"     ) ; }
00153     // add the tool into list of known tools to be properly released
00154     addToToolList( Tool );
00155   }
00156   // return *VALID* located tool
00157   return Tool ;
00158 }

template<class PBASE>
template<class TOOL>
TOOL * GaudiCommon< PBASE >::tool ( const std::string type,
const IInterface parent = 0,
bool  create = true 
) const [inline]

A useful method for the easy location of tools.

  IMyTool* myTool = tool<IMyTool>( "PublicToolType" );

Attention:
The tools located with this method will be released automatically
See also:
IToolSvc

IAlgTool

Exceptions:
GaudiException for invalid Tool Service
GaudiException for error from Tool Service
GaudiException for invalid tool
Parameters:
type Tool type, could be of "Type/Name" format
parent Tool parent
create Flag for creation of nonexisting tools
Returns:
A pointer to the tool

Definition at line 166 of file GaudiCommonImp.h.

References GaudiCommon< PBASE >::addToToolList(), GaudiCommon< PBASE >::Assert(), GaudiCommon< PBASE >::Exception(), and StatusCode::isFailure().

00169 {
00170   // check the environment
00171   Assert ( 0 != PBASE::toolSvc() , "IToolSvc* points to NULL!" );
00172   // retrieve the tool from Tool Service
00173   TOOL* Tool = 0 ;
00174   const StatusCode sc =
00175     this->toolSvc() -> retrieveTool ( type, Tool, parent , create   );
00176   if ( sc.isFailure() )
00177   { Exception("tool():: Could not retrieve Tool '" + type + "'", sc ) ; }
00178   if ( 0 == Tool )
00179   { Exception("tool():: Could not retrieve Tool '" + type + "'"     ) ; }
00180   // add the tool into the list of known tools to be properly released
00181   addToToolList( Tool );
00182   // return *VALID* located tool
00183   return Tool ;
00184 }

template<class PBASE>
template<class SERVICE>
SERVICE * GaudiCommon< PBASE >::svc ( const std::string name,
const bool  create = false 
) const [inline]

A useful method for the easy location of services.

  IMyService* mySvc = svc<IMyService>( "MyServiceType" );

Attention:
The services located with this method will be released automatically
See also:
IService

ISevcLocator

Service

Exceptions:
GaudiException for error in Algorithms::service
GaudiException for invalid service
Parameters:
name service type name
create Flag for creation of non-existing services
Returns:
A pointer to the service

Definition at line 192 of file GaudiCommonImp.h.

References GaudiCommon< PBASE >::addToServiceList(), GaudiCommon< PBASE >::Assert(), GaudiCommon< PBASE >::Exception(), name, and Gaudi::Units::s.

Referenced by GaudiCommon< PBASE >::addToServiceList(), GaudiCommon< PBASE >::getFastContainer(), GaudiCommon< PBASE >::getOrCreate(), and GaudiCommon< PBASE >::put().

00194 {
00195   SERVICE* s = 0 ;
00196   Assert ( 0 != this->svcLoc() , "ISvcLocator* points to NULL!" );
00197   // retrieve the service using templated method Algorithm::service
00198   StatusCode sc = this->svcLoc() -> service( name , s , create ) ;
00199   // check the results
00200   if ( sc.isFailure() )
00201   { Exception ( "svc():: Could not retrieve Svc '" + name + "'", sc ) ; }
00202   if ( 0 == s         )
00203   { Exception ( "svc():: Could not retrieve Svc '" + name + "'"     ) ; }
00204   // add the tool into list of known tools, to be properly released
00205   addToServiceList( s, name  ) ;
00206   // return *VALID* located service
00207   return s ;
00208 }

template<class PBASE>
IUpdateManagerSvc * GaudiCommon< PBASE >::updMgrSvc (  )  const [inline]

Short-cut to locate the Update Manager Service.

Definition at line 216 of file GaudiCommonImp.h.

References GaudiCommon< PBASE >::m_updMgrSvc.

Referenced by GaudiCommon< AlgTool >::registerCondition(), and GaudiCommon< AlgTool >::runUpdate().

00217 {
00218   if ( !m_updMgrSvc )
00219   { m_updMgrSvc = svc<IUpdateManagerSvc>("UpdateManagerSvc",true); }
00220   return m_updMgrSvc ;
00221 }

template<class PBASE>
IDataProviderSvc * GaudiCommon< PBASE >::fastContainersSvc (  )  const [inline]

Short-cut to locate the Fast Containers Service.

Definition at line 229 of file GaudiCommonImp.h.

References GaudiCommon< PBASE >::m_fastContainersSvc.

Referenced by GaudiCommon< PBASE >::getFastContainer().

00230 {
00231   if ( !m_fastContainersSvc )
00232   { m_fastContainersSvc = svc<IDataProviderSvc>("FastContainersSvc",true); }
00233   return m_fastContainersSvc ;
00234 }

template<class PBASE>
StatusCode GaudiCommon< PBASE >::Error ( const std::string msg,
const StatusCode  st = StatusCode::FAILURE,
const size_t  mx = 10 
) const

Print the error message and return with the given StatusCode.

Also performs statistical analysis of the error messages and suppression after the defined number of error instances.

   if( a < 0 ) { return Error("a is negative!") ;}
   if( b < 0 ) { return Error("b is illegal!" , StatusCode(25) );
   if( c < 0 )
      { return Error("c is negative" , StatusCode(35) , 50 );

See also:
MsgStream

IMessageSvc

StatusCode

Parameters:
msg Error message
st StatusCode to return
mx Maximum number of printouts for this message
Returns:
StatusCode

Reimplemented in ErrorTool.

Definition at line 427 of file GaudiCommon.icpp.

References MSG::ERROR, GaudiCommon< PBASE >::m_errors, GaudiCommon< PBASE >::msg(), and GaudiCommon< PBASE >::Print().

Referenced by GaudiCommon< PBASE >::initialize(), GaudiCommon< PBASE >::release(), GaudiCommon< PBASE >::releaseSvc(), and GaudiCommon< PBASE >::releaseTool().

00430 {
00431   // increase local counter of errors
00432   const size_t num = ++m_errors[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   ERROR message is suppressed : '" +
00437                    msg + "'" , st , MSG::ERROR ) ; }
00438   // return message
00439   return Print ( msg , st , MSG::ERROR ) ;
00440 }

template<class PBASE>
StatusCode GaudiCommon< PBASE >::Warning ( const std::string msg,
const StatusCode  st = StatusCode::FAILURE,
const size_t  mx = 10 
) const

Print the warning message and return with the given StatusCode.

Also performs statistical analysis of the error messages and suppression after the defined number of error instances.

   if( a < 0 ) { return Warning("a is negative!") ;}
   if( b < 0 ) { return Warning("b is illegal!" , StatusCode(25) );
   if( c < 0 )
      { return Warning("c is negative" , StatusCode(35) , 50 );

See also:
MsgStream

IMessageSvc

StatusCode

Parameters:
msg Warning message
st StatusCode to return
mx Maximum number of printouts for this message
Returns:
The given StatusCode

Reimplemented in ErrorTool.

Definition at line 448 of file GaudiCommon.icpp.

References MSG::WARNING.

Referenced by GaudiCommon< PBASE >::addToServiceList(), GaudiCommon< PBASE >::addToToolList(), GaudiCommon< PBASE >::initialize(), GaudiCommon< PBASE >::releaseSvc(), and GaudiCommon< PBASE >::releaseTool().

00451 {
00452   // increase local counter of warnings
00453   const size_t num = ++m_warnings[msg] ;
00454   // If suppressed, just return
00455   if      ( num  > mx ) { return st ; }
00456   else if ( num == mx ) // issue one-time suppresion message
00457   { return Print ( "The WARNING message is suppressed : '" +
00458                    msg + "'" , st , MSG::WARNING ) ; }
00459   // return message
00460   return Print ( msg , st , MSG::WARNING ) ;
00461 }

template<class PBASE>
StatusCode GaudiCommon< PBASE >::Print ( const std::string msg,
const StatusCode  st = StatusCode::SUCCESS,
const MSG::Level  lev = MSG::INFO 
) const

Print the message and return with the given StatusCode.

See also:
MsgStream

IMessageSvc

StatusCode

Parameters:
msg Message to print
st StatusCode to return
lev Printout level for the given message
Returns:
The given StatusCode

Reimplemented in ErrorTool.

Definition at line 468 of file GaudiCommon.icpp.

References endreq(), StatusCode::FAILURE, StatusCode::getCode(), StatusCode::isSuccess(), GaudiCommon< PBASE >::msg(), GaudiCommon< PBASE >::msgLevel(), GaudiCommon< PBASE >::msgStream(), System::typeinfoName(), and GaudiCommon< PBASE >::typePrint().

Referenced by GaudiCommon< PBASE >::Error(), GaudiCommon< PBASE >::Exception(), and GaudiCommon< PBASE >::put().

00471 {
00472   // perform printout ?
00473   if ( !msgLevel( lvl ) ) { return st ; }   // RETURN
00474 
00475   // use the predefined stream
00476   MsgStream& str = msgStream( lvl ) ;
00477   if ( typePrint() ) { str << System::typeinfoName(typeid(*this)) << ":: " ; }
00478   // print the message
00479   str  << msg ;
00480   // test status code
00481   if      ( st.isSuccess() ) { }
00482   else if ( StatusCode::FAILURE != st.getCode() )
00483   { str << " StatusCode=" << st.getCode() ; }
00484   else
00485   { str << " StatusCode=FAILURE" ; }
00486   // perform print operation
00487   str << endreq ;
00488   // return
00489   return  st;
00490 }

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

See also:
GaudiException
Exceptions:
Exception for invalid condition
Parameters:
ok Condition which should be "true"
message Message to be associated with the exception
sc StatusCode to be returned (artificial)
Returns:
StatusCode

Reimplemented in ErrorTool.

Definition at line 288 of file GaudiCommonImp.h.

References GaudiCommon< PBASE >::Exception(), GaudiCommon< PBASE >::msg(), and StatusCode::SUCCESS.

Referenced by GaudiCommon< PBASE >::exist(), GaudiCommon< PBASE >::get(), GaudiCommon< PBASE >::getFastContainer(), GaudiCommon< PBASE >::getOrCreate(), GaudiCommon< PBASE >::put(), GaudiCommon< PBASE >::svc(), and GaudiCommon< PBASE >::tool().

00291 {
00292   return ( OK ? StatusCode(StatusCode::SUCCESS, true) : Exception( msg , sc ) ) ;
00293 }

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

See also:
GaudiException
Exceptions:
Exception for invalid condition
Parameters:
ok Condition which should be "true"
message Message to be associated with the exception
sc StatusCode to be returned (artificial)
Returns:
StatusCode

Definition at line 311 of file GaudiCommonImp.h.

References GaudiCommon< PBASE >::Exception(), and StatusCode::SUCCESS.

00314 {
00315   return OK ? StatusCode(StatusCode::SUCCESS, true) : Exception( msg , sc ) ;
00316 }

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

Create and (re)-throw a given GaudiException.

See also:
GaudiException
Exceptions:
CaudiException always thrown!
Parameters:
msg Exception message
exc (previous) exception of type GaudiException
sc StatusCode
Returns:
StatusCode (fictive)

Reimplemented in ErrorTool.

Definition at line 497 of file GaudiCommon.icpp.

References MSG::FATAL, GaudiCommon< PBASE >::m_exceptions, GaudiCommon< PBASE >::msg(), name, and GaudiCommon< PBASE >::Print().

Referenced by GaudiCommon< PBASE >::Assert(), GaudiCommon< PBASE >::get(), GaudiCommon< PBASE >::getFastContainer(), GaudiCommon< PBASE >::getOrCreate(), GaudiCommon< PBASE >::put(), GaudiCommon< PBASE >::svc(), and GaudiCommon< PBASE >::tool().

00500 {
00501   // increase local counter of exceptions
00502   ++m_exceptions[ msg ];
00503   Print ( "Exception (re)throw: " + msg , sc , MSG::FATAL );
00504   throw   GaudiException( this->name() + ":: " + msg , this->name() , sc, exc);
00505   return  sc ;
00506 }

template<class PBASE>
StatusCode GaudiCommon< PBASE >::Exception ( const std::string msg,
const std::exception exc,
const StatusCode  sc = StatusCode(StatusCode::FAILURE, true) 
) const

Create and (re)-throw a given exception.

See also:
GaudiException
Exceptions:
std::exception always thrown!
Parameters:
msg Exception message
exc (previous) exception of type std::exception
sc StatusCode
Returns:
StatusCode (fictive)

Reimplemented in ErrorTool.

Definition at line 513 of file GaudiCommon.icpp.

References MSG::FATAL, GaudiCommon< PBASE >::m_exceptions, GaudiCommon< PBASE >::msg(), GaudiCommon< PBASE >::Print(), and std::exception::what().

00516 {
00517   // increase local counter of exceptions
00518   ++m_exceptions[ msg ];
00519   Print ( "Exception (re)throw: " + msg , sc , MSG::FATAL  );
00520   throw GaudiException( this->name() + ":: " + msg+"("+exc.what()+")", "", sc );
00521   return  sc ;
00522 }

template<class PBASE>
StatusCode GaudiCommon< PBASE >::Exception ( const std::string msg = "no message",
const StatusCode  sc = StatusCode(StatusCode::FAILURE, true) 
) const

Create and throw an exception with the given message.

See also:
GaudiException
Exceptions:
GaudiException always thrown!
Parameters:
msg Exception message
sc StatusCode
Returns:
StatusCode (fictive)

Reimplemented in ErrorTool.

Definition at line 529 of file GaudiCommon.icpp.

References MSG::FATAL, GaudiCommon< PBASE >::m_exceptions, GaudiCommon< PBASE >::msg(), and GaudiCommon< PBASE >::Print().

00531 {
00532   // increase local counter of exceptions
00533   ++m_exceptions[ msg ];
00534   Print ( "Exception throw: " + msg , sc , MSG::FATAL );
00535   throw GaudiException( this->name() + ":: " + msg , "",  sc );
00536   return  sc ;
00537 }

template<class PBASE>
MsgStream & GaudiCommon< PBASE >::msgStream ( const MSG::Level  level  )  const [inline]

Predefined configurable message stream for the efficient printouts.

  if ( a < 0 ) { msgStream( MSG::ERROR ) << "a = " << endreq ; }

Returns:
Reference to the predefined stream

Definition at line 276 of file GaudiCommonImp.h.

References GaudiCommon< PBASE >::m_msgStream.

Referenced by GaudiCommon< AlgTool >::always(), GaudiCommon< AlgTool >::debug(), GaudiCommon< AlgTool >::err(), GaudiCommon< AlgTool >::error(), GaudiCommon< AlgTool >::fatal(), GaudiCommon< AlgTool >::info(), GaudiCommon< AlgTool >::msg(), GaudiCommon< PBASE >::Print(), GaudiCommon< PBASE >::printErrors(), GaudiCommon< PBASE >::printProps(), GaudiCommon< PBASE >::printStat(), GaudiCommon< AlgTool >::verbose(), and GaudiCommon< AlgTool >::warning().

00277 {
00278   if ( !m_msgStream )
00279   { m_msgStream = new MsgStream ( PBASE::msgSvc() , this->name() ) ; }
00280   return *m_msgStream << level ;
00281 }

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

shortcut for the method msgStream ( MSG::ALWAYS )

Definition at line 455 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::finalize().

00455 { return msgStream ( MSG::  ALWAYS ) ; }

template<class PBASE>
MsgStream& GaudiCommon< PBASE >::fatal (  )  const [inline]

shortcut for the method msgStream ( MSG::FATAL )

Definition at line 457 of file GaudiCommon.h.

00457 { return msgStream ( MSG::   FATAL ) ; }

template<class PBASE>
MsgStream& GaudiCommon< PBASE >::err (  )  const [inline]

shortcut for the method msgStream ( MSG::ERROR )

Definition at line 459 of file GaudiCommon.h.

00459 { return msgStream ( MSG::   ERROR ) ; }

template<class PBASE>
MsgStream& GaudiCommon< PBASE >::error (  )  const [inline]

shortcut for the method msgStream ( MSG::ERROR )

Definition at line 461 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::printErrors().

00461 { return msgStream ( MSG::   ERROR ) ; }

template<class PBASE>
MsgStream& GaudiCommon< PBASE >::warning (  )  const [inline]

shortcut for the method msgStream ( MSG::WARNING )

Definition at line 463 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::printErrors().

00463 { return msgStream ( MSG:: WARNING ) ; }

template<class PBASE>
MsgStream& GaudiCommon< PBASE >::info (  )  const [inline]

shortcut for the method msgStream ( MSG::INFO )

Definition at line 465 of file GaudiCommon.h.

00465 { return msgStream ( MSG::    INFO ) ; }

template<class PBASE>
MsgStream& GaudiCommon< PBASE >::debug (  )  const [inline]

shortcut for the method msgStream ( MSG::DEBUG )

Definition at line 467 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::finalize(), GaudiCommon< PBASE >::get(), GaudiCommon< PBASE >::initialize(), GaudiCommon< PBASE >::msgLevelHandler(), GaudiCommon< PBASE >::releaseSvc(), and GaudiCommon< PBASE >::releaseTool().

00467 { return msgStream ( MSG::   DEBUG ) ; }

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

shortcut for the method msgStream ( MSG::VERBOSE )

Definition at line 469 of file GaudiCommon.h.

00469 { return msgStream ( MSG:: VERBOSE ) ; }

template<class PBASE>
MsgStream& GaudiCommon< PBASE >::msg (  )  const [inline]

shortcut for the method msgStream ( MSG::INFO )

Definition at line 471 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::Assert(), GaudiCommon< PBASE >::Error(), GaudiCommon< PBASE >::Exception(), GaudiCommon< PBASE >::Print(), GaudiCommon< PBASE >::printProps(), and GaudiCommon< PBASE >::printStat().

00471 { return msgStream ( MSG::    INFO ) ; }

template<class PBASE>
const Statistics& GaudiCommon< PBASE >::counters (  )  const [inline]

accessor to all counters

Definition at line 474 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::finalize(), and GaudiCommon< PBASE >::printStat().

00474 { return m_counters ; }

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

accessor to certain counter by name

  if ( OK ) { ++counter("OK") ; }

  // additive counter ('Flag')
  counter("#Tracks") += tracks->size() ;

  // multiplicative counter  ('Weight')
  counter("ProbTot") *= probability ;

See also:
StatEntuty
Parameters:
tag counter name
Returns:
the counter itself

Definition at line 493 of file GaudiCommon.h.

00493 { return m_counters[tag] ; }

template<class PBASE>
MSG::Level GaudiCommon< PBASE >::msgLevel (  )  const [inline]

The current message service output level.

Returns:
The current message level

Definition at line 498 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::finalize(), GaudiCommon< PBASE >::get(), GaudiCommon< PBASE >::initialize(), GaudiCommon< AlgTool >::msgLevel(), GaudiCommon< PBASE >::msgLevelHandler(), GaudiCommon< PBASE >::Print(), GaudiCommon< PBASE >::put(), GaudiCommon< PBASE >::releaseSvc(), and GaudiCommon< PBASE >::releaseTool().

00498 { return m_msgLevel ; }

template<class PBASE>
bool GaudiCommon< PBASE >::msgLevel ( const MSG::Level  level  )  const [inline]

Test the output level.

Parameters:
level The message level to test against
Returns:
boolean Indicting if messages at given level will be printed
Return values:
true Messages at level "level" will be printed
true Messages at level "level" will NOT be printed

Definition at line 505 of file GaudiCommon.h.

00505 { return msgLevel() <= level ; }

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

Reset (delete) the current message stream object.

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

Definition at line 300 of file GaudiCommonImp.h.

References GaudiCommon< PBASE >::m_msgStream.

Referenced by GaudiCommon< PBASE >::finalize(), GaudiCommon< PBASE >::msgLevelHandler(), and GaudiCommon< PBASE >::~GaudiCommon().

00301 {
00302   if ( 0 != m_msgStream ) { delete m_msgStream; m_msgStream = 0; }
00303 }

template<class PBASE>
bool GaudiCommon< PBASE >::typePrint (  )  const [inline]

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

Definition at line 512 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::Print().

00512 { return m_typePrint    ; }

template<class PBASE>
bool GaudiCommon< PBASE >::propsPrint (  )  const [inline]

Print properties at initalization ?

Definition at line 514 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::initialize().

00514 { return m_propsPrint   ; }

template<class PBASE>
bool GaudiCommon< PBASE >::statPrint (  )  const [inline]

Print statistical counters at finalization ?

Definition at line 516 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::finalize().

00516 { return m_statPrint    ; }

template<class PBASE>
bool GaudiCommon< PBASE >::errorsPrint (  )  const [inline]

Print error counters at finalization ?

Definition at line 518 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::finalize().

00518 { return m_errorsPrint  ; }

template<class PBASE>
void GaudiCommon< PBASE >::msgLevelHandler ( Property theProp  )  [private]

Handle method for changes in the Messaging levels.

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

Parameters:
theProp Reference to the Property that has changed

Definition at line 648 of file GaudiCommon.icpp.

References MSG::ALWAYS, GaudiCommon< PBASE >::debug(), MSG::DEBUG, endreq(), int(), GaudiCommon< PBASE >::m_msgLevel, GaudiCommon< PBASE >::msgLevel(), Property::name(), MSG::NIL, MSG::NUM_LEVELS, and GaudiCommon< PBASE >::resetMsgStream().

00649 {
00650   // Force a new MsgStream object, to pick up the new settings
00651   resetMsgStream();
00652 
00653   // adjust internal message level
00654   m_msgLevel =
00655     this->outputLevel() <  (int) MSG::NIL        ?  MSG::NIL    :
00656     this->outputLevel() >= (int) MSG::NUM_LEVELS ?  MSG::ALWAYS :
00657     MSG::Level( this->outputLevel() ) ;
00658 
00659   // Keep MessageSvc up to date if needed
00660   if ( this->msgSvc()->outputLevel(this->name()) != this->outputLevel() )
00661   {
00662     this->msgSvc()->setOutputLevel( this->name(), this->outputLevel() );
00663   }
00664 
00665   // printout message
00666   if ( msgLevel(MSG::DEBUG) )
00667   {
00668     debug() << "Property update for "
00669             << theProp.name() << " : new value = " << this->outputLevel() << endreq;
00670   }
00671 }

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

perform the actual printout of statistical counters

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

Definition at line 544 of file GaudiCommon.icpp.

References GaudiCommon< PBASE >::counters(), std::endl(), endreq(), Gaudi::Utils::formatAsTableRow(), GaudiCommon< PBASE >::m_format1, GaudiCommon< PBASE >::m_format2, GaudiCommon< PBASE >::m_header, GaudiCommon< PBASE >::m_useEffFormat, GaudiCommon< PBASE >::msg(), GaudiCommon< PBASE >::msgStream(), and second.

Referenced by GaudiCommon< PBASE >::finalize().

00545 {
00546   // print statistics
00547   if ( counters().empty() ) { return 0 ; }
00548   MsgStream& msg = msgStream ( level ) ;
00549   //
00550   msg << "Number of counters : "  << counters().size() ;
00551   //
00552   if ( !counters().empty() ) { msg << std::endl << m_header ; }
00553   //
00554   for ( Statistics::const_iterator entry = counters().begin() ;
00555         counters().end() != entry ; ++entry )
00556   {
00557     msg << std::endl 
00558         << Gaudi::Utils::formatAsTableRow 
00559       ( entry -> first  , 
00560         entry -> second , 
00561         m_useEffFormat  , 
00562         m_format1       , m_format2 );
00563   }
00564   //
00565   msg << endreq ;
00566   //
00567   return counters().size() ;
00568 }

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

perform the actual printout of error counters

Parameters:
level The message level to print at
Returns:
number of error counters

Definition at line 575 of file GaudiCommon.icpp.

References endreq(), GaudiCommon< PBASE >::error(), format(), GaudiCommon< PBASE >::m_errors, GaudiCommon< PBASE >::m_exceptions, GaudiCommon< PBASE >::m_warnings, GaudiCommon< PBASE >::msgStream(), and GaudiCommon< PBASE >::warning().

Referenced by GaudiCommon< PBASE >::finalize().

00576 {
00577   // format for printout
00578   boost::format ftm ( " %s = %|.8s| %|23t| Message = '%s'" );
00579 
00580   { // print exceptions
00581     for ( Counter::const_iterator excp = m_exceptions.begin() ;
00582           excp  != m_exceptions.end() ; ++excp  )
00583     {
00584       msgStream(level)
00585         << ( ftm % "#EXCEPTIONS" % excp->second % excp->first       )
00586         << endreq;
00587     }
00588   }
00589   { // print errors
00590     for ( Counter::const_iterator error = m_errors.begin() ;
00591           error != m_errors.end() ; ++error )
00592     {
00593       msgStream(level)
00594         << ( ftm % "#ERRORS    " % error->second % error->first     )
00595         << endreq;
00596     }
00597   }
00598   { // print warnings
00599     for ( Counter::const_iterator warning = m_warnings.begin() ;
00600           warning != m_warnings.end() ; ++warning )
00601     {
00602       msgStream(level)
00603         << ( ftm % "#WARNINGS  " % warning->second % warning->first )
00604         << endreq;
00605     }
00606   }
00607 
00608   // return total number of errors+warnings+exceptions
00609   return
00610     m_exceptions .size () +
00611     m_errors     .size () +
00612     m_warnings   .size () ;
00613 }

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

perform the actual printout of properties

Parameters:
level The message level to print at
Returns:
number of properties

Definition at line 622 of file GaudiCommon.icpp.

References endreq(), GaudiCommon< PBASE >::msg(), GaudiCommon< PBASE >::msgStream(), name, std::basic_string< _CharT, _Traits, _Alloc >::size(), and System::typeinfoName().

Referenced by GaudiCommon< PBASE >::initialize().

00623 {
00624 
00625   // print ALL properties
00626   MsgStream& msg = msgStream ( level );
00627   typedef std::vector<Property*> Properties;
00628   const Properties& properties = this->getProperties() ;
00629   msg << "List of ALL properties of "
00630       << System::typeinfoName( typeid( *this ) ) << "/" << this->name()
00631       << "  #properties = " << properties.size() << endreq ;
00632   for ( Properties::const_reverse_iterator property
00633           = properties.rbegin() ;
00634         properties.rend() != property ; ++property )
00635   {
00636     msg << "Property ['Name': Value] = "
00637         << ( **property)
00638         << endreq ;
00639   }
00640   return properties.size() ;
00641 }

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

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

Parameters:
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 558 of file GaudiCommon.h.

00558                                                                                                   {
00559     updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf);
00560   }

template<class PBASE>
template<class CallerClass, class CondType>
void GaudiCommon< PBASE >::registerCondition ( const std::string condition,
CondType *&  condPtrDest,
StatusCode(CallerClass::*)()  mf = NULL 
) [inline]

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

This version of the method allow the user to specify where to put a copy of the pointer to the condition object.

Parameters:
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 592 of file GaudiCommon.h.

00593                                                                       {
00594     updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf,condPtrDest);
00595   }

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

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

Definition at line 598 of file GaudiCommon.h.

00598                                                                                        {
00599     updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),std::string(condition),mf);
00600   }

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

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

Parameters:
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 617 of file GaudiCommon.h.

00617                                                                                               {
00618     updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf);
00619   }

template<class PBASE>
StatusCode GaudiCommon< PBASE >::runUpdate (  )  [inline]

asks the UpdateManagerSvc to perform an update of the instance (if needed) without waiting the next BeginEvent incident.

It is useful if the instance can be instantiated after a BeginEvent incident, and used before the next one (for example with tools).

  StatusCode MyTool::initialize(){
    // ...
    return runUpdate();
  }

Definition at line 631 of file GaudiCommon.h.

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

template<class PBASE>
template<class T>
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 242 of file GaudiCommonImp.h.

References GaudiCommon< PBASE >::Assert(), GaudiCommon< PBASE >::Exception(), GaudiCommon< PBASE >::fastContainersSvc(), StatusCode::isSuccess(), GaudiCommon< PBASE >::svc(), and System::typeinfoName().

00244 {
00245   typedef TransientFastContainer<T> container_type;
00246 
00247   IDataProviderSvc* svc = fastContainersSvc();
00248   Assert( 0 != svc , "getFastContainer(): cannot get FastContainersSvc" );
00249 
00250   container_type *ptr = NULL;
00251   SmartDataPtr<container_type> obj( svc, location );
00252   if (!obj){
00253     ptr = new container_type(initial);
00254     StatusCode status = svc->registerObject(location,ptr);
00255     if ( !status.isSuccess() ){
00256       Exception("getFastContainer(): cannot register '" +
00257                 System::typeinfoName( typeid( *ptr ) ) +
00258                 "' at address '" + location + "'"  , status );
00259     }
00260   } else {
00261     ptr = obj;
00262     if ( !ptr ){
00263       Exception("getFastContainer(): No valid container at '" + location + "'");
00264     }
00265   }
00266 
00267   return ptr;
00268 }

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

standard initialization method

Returns:
status code

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.

References MSG::ALWAYS, GaudiCommon< PBASE >::context(), GaudiCommon< PBASE >::debug(), MSG::DEBUG, std::basic_string< _CharT, _Traits, _Alloc >::empty(), endreq(), GaudiCommon< PBASE >::Error(), StatusCode::ignore(), StatusCode::isFailure(), GaudiCommon< PBASE >::m_rootInTES, GaudiCommon< PBASE >::m_rootOnTES, GaudiCommon< PBASE >::msgLevel(), GaudiCommon< PBASE >::printProps(), GaudiCommon< PBASE >::propsPrint(), std::basic_string< _CharT, _Traits, _Alloc >::size(), std::basic_string< _CharT, _Traits, _Alloc >::substr(), StatusCode::SUCCESS, and GaudiCommon< PBASE >::Warning().

Referenced by GaudiTool::initialize(), and GaudiAlgorithm::initialize().

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<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 }

template<class PBASE>
StatusCode GaudiCommon< PBASE >::finalize (  )  [virtual]

standard finalization method

Returns:
status code

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.

References GaudiCommon< PBASE >::always(), MSG::ALWAYS, std::vector< _Tp, _Alloc >::back(), std::vector< _Tp, _Alloc >::begin(), GaudiCommon< PBASE >::counters(), GaudiCommon< PBASE >::debug(), MSG::DEBUG, std::vector< _Tp, _Alloc >::empty(), std::vector< _Tp, _Alloc >::end(), endreq(), GaudiCommon< PBASE >::errorsPrint(), GaudiCommon< PBASE >::m_counters, GaudiCommon< PBASE >::m_errors, GaudiCommon< PBASE >::m_exceptions, GaudiCommon< PBASE >::m_services, GaudiCommon< PBASE >::m_tools, GaudiCommon< PBASE >::m_warnings, GaudiCommon< PBASE >::msgLevel(), GaudiCommon< PBASE >::printErrors(), GaudiCommon< PBASE >::printStat(), GaudiCommon< PBASE >::release(), GaudiCommon< PBASE >::resetMsgStream(), GaudiCommon< PBASE >::statPrint(), and StatusCode::SUCCESS.

Referenced by GaudiTool::finalize(), and GaudiAlgorithm::finalize().

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 }

template<class PBASE>
GaudiCommon& GaudiCommon< PBASE >::operator= ( const GaudiCommon< PBASE > &   )  [private]

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

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

Definition at line 322 of file GaudiCommon.icpp.

References std::reverse_iterator< _Iterator >::base(), GaudiCommon< PBASE >::debug(), MSG::DEBUG, endreq(), std::vector< _Tp, _Alloc >::erase(), GaudiCommon< PBASE >::Error(), std::find(), StatusCode::ignore(), StatusCode::isFailure(), GaudiCommon< PBASE >::m_tools, GaudiCommon< PBASE >::msgLevel(), INamedInterface::name(), name, std::vector< _Tp, _Alloc >::rbegin(), std::vector< _Tp, _Alloc >::rend(), StatusCode::SUCCESS, and GaudiCommon< PBASE >::Warning().

Referenced by GaudiCommon< PBASE >::release().

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   // Check for more tools of the same name
00344   while ( (it = std::find(m_tools.rbegin(),m_tools.rend(),algTool)) != m_tools.rend() )
00345   {
00346     Warning( "Removing additional reference(s) to '"+name+"' in active tool list",
00347              StatusCode::SUCCESS, 1 ).ignore();
00348     m_tools.erase( --it.base() ) ;
00349   }
00350   if ( sc.isFailure() )
00351   { return Warning ( "releaseTool(IAlgTool):: error from IToolSvc whilst releasing "+name , sc ) ; }
00352   // return final status code
00353   return sc ;
00354 }

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

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

Definition at line 361 of file GaudiCommon.icpp.

References std::reverse_iterator< _Iterator >::base(), GaudiCommon< PBASE >::debug(), MSG::DEBUG, endreq(), std::vector< _Tp, _Alloc >::erase(), GaudiCommon< PBASE >::Error(), GaudiCommon< PBASE >::m_services, GaudiCommon< PBASE >::msgLevel(), std::vector< _Tp, _Alloc >::rbegin(), std::vector< _Tp, _Alloc >::rend(), Gaudi::Units::s, StatusCode::SUCCESS, and GaudiCommon< PBASE >::Warning().

Referenced by GaudiCommon< PBASE >::release().

00362 {
00363   if( 0 == Svc )
00364   { return Error ( "releaseSvc(IInterface):: IInterface* points to NULL!" ) ; }
00365   // find a service in the list of active services
00366   Services::reverse_iterator iS = m_services.rbegin();
00367   for ( ; iS != m_services.rend(); ++iS ) { if ( (*iS).first == Svc ) break; }
00368   if ( m_services.rend() == iS )
00369   { return Warning( "releaseSvc(IInterface):: IInterface* is not active" ) ; }
00370   // get the service
00371   IInterface * s = (*iS).first ;
00372   if ( msgLevel(MSG::DEBUG) )
00373   { debug() << "Releasing service '" << (*iS).second << "'" << endreq; }
00374   // remove the service from the list of active services
00375   m_services.erase( --iS.base() ) ;
00376   // release the service
00377   s->release() ;
00378   // return
00379   return StatusCode::SUCCESS ;
00380 }

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

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

  IMyTool* mytool = tool<IMyTool>( .... ) ;
  mytool->spendCPUtime() ;
  release ( mytool ) ;

  IMySvc* msvc = svc<IMySvc>( .... ) ;
  msvc->spendCPUtime() ;
  release ( msvc ) ;

Parameters:
interface Interface pointer to the interface to be released
Returns:
StatusCode
Return values:
StatusCode::SUCCESS Tool or service was successfully released
StatusCode::FAILURE Error releasing too or service

Definition at line 307 of file GaudiCommon.icpp.

References GaudiCommon< PBASE >::Error(), GaudiCommon< PBASE >::releaseSvc(), and GaudiCommon< PBASE >::releaseTool().

Referenced by GaudiCommon< PBASE >::finalize(), and GaudiCommon< PBASE >::initGaudiCommonConstructor().

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 }

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

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

Definition at line 694 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::initialize().

00694 { return m_context; }

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

Returns the "rootInTES" string.

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

Definition at line 698 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::fullTESLocation().

00698 { return m_rootInTES; }

template<class PBASE>
const double GaudiCommon< PBASE >::globalTimeOffset (  )  const [inline]

Returns the "globalTimeOffset" double.

Definition at line 700 of file GaudiCommon.h.

00700 { return m_globalTimeOffset; }

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

Add the given tool to the list of acquired tools.

Definition at line 387 of file GaudiCommon.icpp.

References std::vector< _Tp, _Alloc >::begin(), std::vector< _Tp, _Alloc >::end(), std::find(), GaudiCommon< PBASE >::m_tools, std::vector< _Tp, _Alloc >::push_back(), GaudiCommon< PBASE >::tool(), and GaudiCommon< PBASE >::Warning().

Referenced by GaudiCommon< PBASE >::tool().

00388 {
00389   AlgTools::const_iterator iTool = std::find( m_tools.begin(),
00390                                               m_tools.end(),
00391                                               tool );
00392   if ( iTool != m_tools.end() )
00393   {
00394     Warning( "Tool '" + tool->name() + "' already in list of active tools" ).ignore();
00395   }
00396   m_tools.push_back( tool ) ;
00397 }

template<class PBASE>
void GaudiCommon< PBASE >::addToServiceList ( IInterface svc,
const std::string name 
) const [private]

Add the given service to the list of acquired services.

Definition at line 404 of file GaudiCommon.icpp.

References std::vector< _Tp, _Alloc >::begin(), std::vector< _Tp, _Alloc >::end(), std::find(), StatusCode::ignore(), GaudiCommon< PBASE >::m_services, name, std::vector< _Tp, _Alloc >::push_back(), GaudiCommon< PBASE >::svc(), and GaudiCommon< PBASE >::Warning().

Referenced by GaudiCommon< PBASE >::svc().

00406 {
00407   const ServiceEntry sEntry( svc , name );
00408   Services::const_iterator iSvc = std::find( m_services.begin(),
00409                                              m_services.end(),
00410                                              sEntry );
00411   if ( iSvc != m_services.end() )
00412   {
00413     Warning( "Service '" + name + "' already in list of active services" ).ignore();
00414   }
00415   m_services.push_back( sEntry ) ;
00416 }

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

Constructor initializations.

< flag to use the special "efficiency" format

Definition at line 70 of file GaudiCommon.icpp.

References IJobOptionsSvc::getProperties(), StatusCode::ignore(), GaudiCommon< PBASE >::m_context, GaudiCommon< PBASE >::m_errorsPrint, GaudiCommon< PBASE >::m_fastContainersSvc, GaudiCommon< PBASE >::m_format1, GaudiCommon< PBASE >::m_format2, GaudiCommon< PBASE >::m_globalTimeOffset, GaudiCommon< PBASE >::m_header, GaudiCommon< PBASE >::m_msgLevel, GaudiCommon< PBASE >::m_msgStream, GaudiCommon< PBASE >::m_propsPrint, GaudiCommon< PBASE >::m_rootInTES, GaudiCommon< PBASE >::m_rootOnTES, GaudiCommon< PBASE >::m_statPrint, GaudiCommon< PBASE >::m_typePrint, GaudiCommon< PBASE >::m_updMgrSvc, GaudiCommon< PBASE >::m_useEffFormat, MSG::NIL, and GaudiCommon< PBASE >::release().

Referenced by GaudiCommon< AlgTool >::GaudiCommon(), and GaudiCommon< Algorithm >::GaudiCommon().

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 }

template<class PBASE>
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 28 of file GaudiCommonImp.h.

References std::basic_string< _CharT, _Traits, _Alloc >::empty(), std::basic_string< _CharT, _Traits, _Alloc >::find(), GaudiCommon< PBASE >::rootInTES(), and std::basic_string< _CharT, _Traits, _Alloc >::substr().

Referenced by GaudiCommon< PBASE >::exist(), GaudiCommon< PBASE >::get(), GaudiCommon< PBASE >::getOrCreate(), and GaudiCommon< PBASE >::put().

00030 {
00031   // The logic is:
00032   // if no R.I.T., give back location
00033   // if R.I.T., this is the mapping:
00034   // (note that R.I.T. contains a trailing '/')
00035   //  location       -> result
00036   //  -------------------------------------------------
00037   //  ""             -> R.I.T.[:-1]      ("rit")
00038   //  "/Event"       -> R.I.T.[:-1]      ("rit")
00039   //  "/Event/MyObj" -> R.I.T. + "MyObj" ("rit/MyObj")
00040   //  "MyObj"        -> R.I.T. + "MyObj" ("rit/MyObj")
00041   return ( !useRootInTES || rootInTES().empty() ?
00042              location
00043            :
00044              location.empty() || ( location == "/Event" ) ?
00045                rootInTES().substr(0,rootInTES().size()-1)
00046              :
00047                0 == location.find("/Event/") ?
00048                  rootInTES() + location.substr(7)
00049                : 
00050                  rootInTES() + location );
00051 }


Member Data Documentation

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

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

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

The message level.

Definition at line 714 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::initGaudiCommonConstructor(), GaudiCommon< AlgTool >::msgLevel(), and GaudiCommon< PBASE >::msgLevelHandler().

template<class PBASE>
MsgStream* GaudiCommon< PBASE >::m_msgStream [mutable, private]

The predefined message stream.

Definition at line 717 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::initGaudiCommonConstructor(), GaudiCommon< PBASE >::msgStream(), and GaudiCommon< PBASE >::resetMsgStream().

template<class PBASE>
AlgTools GaudiCommon< PBASE >::m_tools [mutable, private]

List of active tools.

Definition at line 719 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::addToToolList(), GaudiCommon< PBASE >::finalize(), and GaudiCommon< PBASE >::releaseTool().

template<class PBASE>
Services GaudiCommon< PBASE >::m_services [mutable, private]

List of active services.

Definition at line 721 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::addToServiceList(), GaudiCommon< PBASE >::finalize(), and GaudiCommon< PBASE >::releaseSvc().

template<class PBASE>
Counter GaudiCommon< PBASE >::m_errors [mutable, private]

Counter of errors.

Definition at line 724 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::Error(), GaudiCommon< PBASE >::finalize(), and GaudiCommon< PBASE >::printErrors().

template<class PBASE>
Counter GaudiCommon< PBASE >::m_warnings [mutable, private]

counter of warnings

Definition at line 726 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::finalize(), and GaudiCommon< PBASE >::printErrors().

template<class PBASE>
Counter GaudiCommon< PBASE >::m_exceptions [mutable, private]

Counter of exceptions.

Definition at line 728 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::Exception(), GaudiCommon< PBASE >::finalize(), and GaudiCommon< PBASE >::printErrors().

template<class PBASE>
Statistics GaudiCommon< PBASE >::m_counters [mutable, private]

General counters.

Definition at line 730 of file GaudiCommon.h.

Referenced by GaudiCommon< AlgTool >::counter(), GaudiCommon< AlgTool >::counters(), and GaudiCommon< PBASE >::finalize().

template<class PBASE>
IUpdateManagerSvc* GaudiCommon< PBASE >::m_updMgrSvc [mutable, private]

Pointer to the Update Manager Service instance.

Definition at line 733 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::initGaudiCommonConstructor(), and GaudiCommon< PBASE >::updMgrSvc().

template<class PBASE>
IDataProviderSvc* GaudiCommon< PBASE >::m_fastContainersSvc [mutable, private]

Pointer to the service providing transient fast containers.

Definition at line 735 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::fastContainersSvc(), and GaudiCommon< PBASE >::initGaudiCommonConstructor().

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

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

Definition at line 738 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::initGaudiCommonConstructor(), and GaudiCommon< AlgTool >::typePrint().

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

print properties at initalization?

Definition at line 740 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::initGaudiCommonConstructor(), and GaudiCommon< AlgTool >::propsPrint().

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

print counters at finalization ?

Definition at line 742 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::initGaudiCommonConstructor(), and GaudiCommon< AlgTool >::statPrint().

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

print warning and error counters at finalization ?

Definition at line 744 of file GaudiCommon.h.

Referenced by GaudiCommon< AlgTool >::errorsPrint(), and GaudiCommon< PBASE >::initGaudiCommonConstructor().

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

The context string.

Definition at line 747 of file GaudiCommon.h.

Referenced by GaudiCommon< AlgTool >::context(), and GaudiCommon< PBASE >::initGaudiCommonConstructor().

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

The rootInTES string.

Definition at line 749 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::initGaudiCommonConstructor(), GaudiCommon< PBASE >::initialize(), and GaudiCommon< AlgTool >::rootInTES().

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

The rootOnTES string.

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

Definition at line 753 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::initGaudiCommonConstructor(), and GaudiCommon< PBASE >::initialize().

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

The globalTimeOffset value.

Definition at line 755 of file GaudiCommon.h.

Referenced by GaudiCommon< AlgTool >::globalTimeOffset(), and GaudiCommon< PBASE >::initGaudiCommonConstructor().

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

the header row

Definition at line 758 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::initGaudiCommonConstructor(), and GaudiCommon< PBASE >::printStat().

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

format for regular statistical printout rows

Definition at line 760 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::initGaudiCommonConstructor(), and GaudiCommon< PBASE >::printStat().

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

format for "efficiency" statistical printout rows

Definition at line 762 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::initGaudiCommonConstructor(), and GaudiCommon< PBASE >::printStat().

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

flag to use the special "efficiency" format

Definition at line 764 of file GaudiCommon.h.

Referenced by GaudiCommon< PBASE >::initGaudiCommonConstructor(), and GaudiCommon< PBASE >::printStat().


The documentation for this class was generated from the following files:
Generated at Fri Jul 18 12:07:29 2008 for Gaudi Framework, version v20r2 by Doxygen version 1.5.1 written by Dimitri van Heesch, © 1997-2004