| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

GaudiCommon< PBASE > Class Template Reference

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

#include <GaudiAlg/GaudiCommon.h>

Inheritance diagram for GaudiCommon< PBASE >:

[legend]
Collaboration diagram for GaudiCommon< PBASE >:
[legend]
List of all members.

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.
DataObjectput (IDataProviderSvc *svc, DataObject *object, const std::string &location, const bool useRootInTES=true) const
 Register a data object or container into Gaudi Event Transient Store.
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.
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::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< 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

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 56 of file GaudiCommon.h.


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 83 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 85 of file GaudiCommon.h.

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

storage for active tools

Definition at line 87 of file GaudiCommon.h.

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

Service pointer and name.

Definition at line 89 of file GaudiCommon.h.

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

storage for active services

Definition at line 91 of file GaudiCommon.h.


Constructor & Destructor Documentation

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

Algorithm constructor.

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

Tool constructor.

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

Destructor.

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>
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" );

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

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

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

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

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

See also:
IDataProviderSvc
Attention:
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This 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.

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

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

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

A useful method for the easy location of services.

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

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

ISevcLocator

Service

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

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

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

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.

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.

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.

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

00277 {
00278   return ( OK ? StatusCode(StatusCode::SUCCESS, true) : Exception( msg , sc ) ) ;
00279 }

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

00300 {
00301   return OK ? StatusCode(StatusCode::SUCCESS, true) : Exception( msg , sc ) ;
00302 }

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.

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.

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.

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

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

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

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

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

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

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

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

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

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

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

accessor to all counters

Definition at line 476 of file GaudiCommon.h.

00476 { 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 495 of file GaudiCommon.h.

00495 { 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 500 of file GaudiCommon.h.

00500 { 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 507 of file GaudiCommon.h.

00507 { 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 286 of file GaudiCommonImp.h.

00287 {
00288   if ( 0 != m_msgStream ) { delete m_msgStream; m_msgStream = 0; }
00289 }

template<class PBASE>
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    ; }

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

Print properties at initalization ?

Definition at line 516 of file GaudiCommon.h.

00516 { return m_propsPrint   ; }

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

Print statistical counters at finalization ?

Definition at line 518 of file GaudiCommon.h.

00518 { return m_statPrint    ; }

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

Print error counters at finalization ?

Definition at line 520 of file GaudiCommon.h.

00520 { 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

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

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

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

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 560 of file GaudiCommon.h.

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

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 594 of file GaudiCommon.h.

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

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 600 of file GaudiCommon.h.

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

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 619 of file GaudiCommon.h.

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

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 633 of file GaudiCommon.h.

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

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

standard initialization method

Returns:
status code

Reimplemented in SequencerTimerTool, GaudiAlgorithm, GaudiHistoAlg, GaudiHistoTool, GaudiSequencer, GaudiTool, GaudiTupleAlg, GaudiTupleTool, Prescaler, GaudiHistos< GaudiAlgorithm >, GaudiHistos< GaudiTool >, GaudiTuples< GaudiHistoTool >, and GaudiTuples< GaudiHistoAlg >.

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

standard finalization method

Returns:
status code

Reimplemented in SequencerTimerTool, GaudiAlgorithm, GaudiHistoAlg, GaudiHistoTool, GaudiSequencer, GaudiTool, GaudiTupleAlg, GaudiTupleTool, Prescaler, GaudiHistos< GaudiAlgorithm >, GaudiHistos< GaudiTool >, GaudiTuples< GaudiHistoTool >, and GaudiTuples< GaudiHistoAlg >.

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

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

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

template<class PBASE>
StatusCode GaudiCommon< PBASE >::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

template<class PBASE>
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; }

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 700 of file GaudiCommon.h.

00700 { return m_rootInTES; }

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

Returns the "globalTimeOffset" double.

Definition at line 702 of file GaudiCommon.h.

00702 { return m_globalTimeOffset; }

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

Add the given tool to the list of acquired tools.

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.

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

Constructor initializations.

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


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 68 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 80 of file GaudiCommon.h.

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

The message level.

Definition at line 716 of file GaudiCommon.h.

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

The predefined message stream.

Definition at line 719 of file GaudiCommon.h.

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

List of active tools.

Definition at line 721 of file GaudiCommon.h.

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

List of active services.

Definition at line 723 of file GaudiCommon.h.

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

Counter of errors.

Definition at line 726 of file GaudiCommon.h.

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

counter of warnings

Definition at line 728 of file GaudiCommon.h.

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

Counter of exceptions.

Definition at line 730 of file GaudiCommon.h.

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

General counters.

Definition at line 732 of file GaudiCommon.h.

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

Pointer to the Update Manager Service instance.

Definition at line 735 of file GaudiCommon.h.

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

Pointer to the service providing transient fast containers.

Definition at line 737 of file GaudiCommon.h.

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

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

print properties at initalization?

Definition at line 742 of file GaudiCommon.h.

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

print counters at finalization ?

Definition at line 744 of file GaudiCommon.h.

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

print warning and error counters at finalization ?

Definition at line 746 of file GaudiCommon.h.

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

The context string.

Definition at line 749 of file GaudiCommon.h.

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

The rootInTES string.

Definition at line 751 of file GaudiCommon.h.

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

The rootOnTES string.

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

Definition at line 755 of file GaudiCommon.h.

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

The globalTimeOffset value.

Definition at line 757 of file GaudiCommon.h.

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

the header row

Definition at line 760 of file GaudiCommon.h.

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

format for regular statistical printout rows

Definition at line 762 of file GaudiCommon.h.

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

format for "efficiency" statistical printout rows

Definition at line 764 of file GaudiCommon.h.

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

flag to use the special "efficiency" format

Definition at line 766 of file GaudiCommon.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:58:17 2011 for GaudiAlg by doxygen 1.4.7