Gaudi Framework, version v24r2

Home   Generated: Wed Dec 4 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
GaudiAlgorithm Class Reference

The useful base class for data processing algorithms. More...

#include <GaudiAlg/GaudiAlgorithm.h>

Inheritance diagram for GaudiAlgorithm:
Inheritance graph
[legend]
Collaboration diagram for GaudiAlgorithm:
Collaboration graph
[legend]

Public Member Functions

virtual StatusCode initialize ()
 standard initialization method
 
virtual StatusCode execute ()
 standard execution method
 
virtual StatusCode finalize ()
 standard finalization method
 
virtual StatusCode sysExecute ()
 the generic actions for the execution.
 
void put (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const
 Register a data object or container into Gaudi Event Transient Store.
 
void put (DataObject *object, const std::string &address, const bool useRootInTES=true) const
 Register a data object or container into Gaudi Event Transient Store.
 
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 >
Gaudi::Utils::GetData< TYPE >
::return_type 
getIfExists (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Templated access to the data in Gaudi Transient Store.
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >
::return_type 
get (const std::string &location, const bool useRootInTES=true) const
 Templated access to the data from Gaudi Event Transient Store.
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >
::return_type 
getIfExists (const std::string &location, const bool useRootInTES=true) const
 Templated access to the data in Gaudi Transient Store.
 
template<class TYPE >
TYPE * getDet (IDataProviderSvc *svc, const std::string &location) const
 Templated access to the detector data from the Gaudi Detector Transient Store.
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >
::return_type 
getDetIfExists (IDataProviderSvc *svc, const std::string &location) const
 Templated access to the detector data from the Gaudi Detector Transient Store.
 
template<class TYPE >
TYPE * getDet (const std::string &location) const
 Templated access to the detector data from the Gaudi Detector Transient Store.
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >
::return_type 
getDetIfExists (const std::string &location) const
 Templated access to the detector data from the Gaudi Detector 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 >
bool exist (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 >
bool existDet (IDataProviderSvc *svc, const std::string &location) const
 Check the existence of detector objects in the Gaudi Transient Detector Store.
 
template<class TYPE >
bool existDet (const std::string &location) const
 Check the existence of detector objects in the Gaudi Transient Detector Store.
 
template<class TYPE , class TYPE2 >
Gaudi::Utils::GetData< TYPE >
::return_type 
getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Get the existing data object from Gaudi Event Transient store.
 
template<class TYPE , class TYPE2 >
Gaudi::Utils::GetData< TYPE >
::return_type 
getOrCreate (const std::string &location, const bool useRootInTES=true) const
 Get the existing data object from Gaudi Event Transient store.
 
 GaudiAlgorithm (const std::string &name, ISvcLocator *pSvcLocator)
 Standard constructor (protected)
 
virtual ~GaudiAlgorithm ()
 destructor, virtual and protected
 
SmartIF< INTupleSvc > & evtColSvc () const
 Access the standard event collection service.
 
- Public Member Functions inherited from GaudiCommon< Algorithm >
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.
 
Gaudi::Utils::GetData< TYPE >
::return_type 
getIfExists (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Quicker version of the get function which bypasses the check on the retrieved data.
 
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.
 
Gaudi::Utils::GetData< TYPE >
::return_type 
getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Get the existing data object from Gaudi Event Transient store.
 
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.
 
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.
 
TOOL * tool (const std::string &type, const IInterface *parent=0, bool create=true) const
 A useful method for the easy location of tools.
 
SmartIF< 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.
 
StatusCode Error (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
 Print the error message and return with the given StatusCode.
 
StatusCode Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
 Print the warning message and return with the given StatusCode.
 
StatusCode Info (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const size_t mx=10) const
 Print the info message and return with the given StatusCode.
 
StatusCode Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const
 Print the message and return with the given StatusCode.
 
void Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Assertion - throw exception if the given condition is not fulfilled.
 
void Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Assertion - throw exception if the given condition is not fulfilled.
 
void Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Create and (re)-throw a given GaudiException.
 
void Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Create and (re)-throw a given exception.
 
void Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Create and throw an exception with the given message.
 
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 initialization ?
 
bool statPrint () const
 Print statistical counters at finalization ?
 
bool errorsPrint () const
 Print error counters at finalization ?
 
long printStat (const MSG::Level level=MSG::ALWAYS) const
 perform the actual printout of statistical counters
 
long printErrors (const MSG::Level level=MSG::ALWAYS) const
 perform the actual printout of error counters
 
long printProps (const MSG::Level level=MSG::ALWAYS) const
 perform the actual printout of properties
 
void registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=NULL)
 register the current instance to the UpdateManagerSvc as a consumer for a condition.
 
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.
 
void registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL)
 just to avoid conflicts with the version using a pointer to a template class.
 
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.
 
 GaudiCommon (const std::string &name, ISvcLocator *pSvcLocator)
 Algorithm constructor.
 
 GaudiCommon (const std::string &type, const std::string &name, const IInterface *parent)
 Tool constructor.
 
StatusCode release (const IInterface *interface) const
 Manual forced (and 'safe') release of the active tool or service.
 
virtual unsigned long release ()
 Un-hide IInterface::release (ICC warning #1125)
 
const AlgToolstools () const
 get the list of aquired tools
 
const Servicesservices () const
 get the list of aquired services
 
const std::stringcontext () const
 Returns the "context" string. Used to identify different processing states.
 
const std::stringrootInTES () const
 Returns the "rootInTES" string.
 
double globalTimeOffset () const
 Returns the "globalTimeOffset" double.
 
const std::string fullTESLocation (const std::string &location, const bool useRootInTES) const
 Returns the full correct event location given the rootInTes settings.
 
- Public Member Functions inherited from Algorithm
 Algorithm (const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
 Constructor.
 
virtual ~Algorithm ()
 Destructor.
 
virtual StatusCode sysStart ()
 Reinitialization method invoked by the framework.
 
virtual StatusCode sysInitialize ()
 Initialization method invoked by the framework.
 
virtual StatusCode sysReinitialize ()
 Reinitialization method invoked by the framework.
 
virtual StatusCode sysRestart ()
 Restart method invoked by the framework.
 
virtual StatusCode sysStop ()
 System stop.
 
virtual StatusCode sysFinalize ()
 System finalization.
 
virtual StatusCode sysBeginRun ()
 beginRun method invoked by the framework.
 
virtual StatusCode sysEndRun ()
 endRun method invoked by the framework.
 
virtual const std::stringname () const
 The identifying name of the algorithm object.
 
virtual const std::stringversion () const
 
virtual StatusCode configure ()
 Dummy implementation of IStateful::configure() method.
 
virtual StatusCode terminate ()
 Dummy implementation of IStateful::terminate() method.
 
virtual StatusCode start ()
 the default (empty) implementation of IStateful::start() method
 
virtual StatusCode stop ()
 the default (empty) implementation of IStateful::stop() method
 
virtual StatusCode reinitialize ()
 the default (empty) implementation of IStateful::reinitialize() method
 
virtual StatusCode restart ()
 the default (empty) implementation of IStateful::restart() method
 
virtual bool isExecuted () const
 Has this algorithm been executed since the last reset?
 
virtual void setExecuted (bool state)
 Set the executed flag to the specified state.
 
virtual void resetExecuted ()
 Reset the executed state of the Algorithm for the duration of the current event.
 
virtual StatusCode beginRun ()
 Algorithm begin run.
 
virtual StatusCode endRun ()
 Algorithm end run. This method is called at the end of the event loop.
 
virtual Gaudi::StateMachine::State FSMState () const
 returns the current state of the algorithm
 
virtual Gaudi::StateMachine::State targetFSMState () const
 returns the state the algorithm will be in after the ongoing transition
 
virtual bool isEnabled () const
 Is this algorithm enabled or disabled?
 
virtual bool filterPassed () const
 Did this algorithm pass or fail its filter criterion for the last event?
 
virtual void setFilterPassed (bool state)
 Set the filter passed flag to the specified state.
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist.
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist.
 
SmartIF< IServiceservice (const std::string &name, const bool createIf=true, const bool quiet=false) const
 Return a pointer to the service identified by name (or "type/name")
 
void setOutputLevel (int level)
 Set the output level for current algorithm.
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked.
 
SmartIF< IChronoStatSvc > & chronoSvc () const
 The standard Chrono & Stat service, Return a pointer to the service if present.
 
SmartIF< IChronoStatSvc > & chronoStatService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IDataProviderSvc > & detSvc () const
 The standard detector data service.
 
SmartIF< IDataProviderSvc > & detDataService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IConversionSvc > & detCnvSvc () const
 The standard detector data persistency conversion service.
 
SmartIF< IConversionSvc > & detDataCnvService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IDataProviderSvc > & eventSvc () const
 The standard event data service.
 
SmartIF< IDataProviderSvc > & evtSvc () const
 shortcut for method eventSvc
 
SmartIF< IDataProviderSvc > & eventDataService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IConversionSvc > & eventCnvSvc () const
 The standard event data persistency conversion service.
 
SmartIF< IConversionSvc > & eventDataCnvService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IHistogramSvc > & histoSvc () const
 The standard histogram service.
 
SmartIF< IHistogramSvc > & histogramDataService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
SmartIF< IMessageSvc > & messageService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< INTupleSvc > & ntupleSvc () const
 The standard N tuple service.
 
SmartIF< INTupleSvc > & ntupleService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IRndmGenSvc > & randSvc () const
 AIDA-based NTuple service Returns a pointer to the AIDATuple service if present.
 
SmartIF< IToolSvc > & toolSvc () const
 The standard ToolSvc service, Return a pointer to the service if present.
 
SmartIF< IExceptionSvc > & exceptionSvc () const
 Get the exception Service.
 
SmartIF< IAlgContextSvc > & contextSvc () const
 get Algorithm Context Service
 
SmartIF< ISvcLocator > & serviceLocator () const
 The standard service locator.
 
SmartIF< ISvcLocator > & svcLoc () const
 shortcut for method serviceLocator
 
bool registerContext () const
 register for Algorithm Context Service?
 
StatusCode createSubAlgorithm (const std::string &type, const std::string &name, Algorithm *&pSubAlg)
 Create a sub algorithm.
 
std::vector< Algorithm * > * subAlgorithms () const
 List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
 
virtual StatusCode setProperty (const Property &p)
 Implementation of IProperty::setProperty.
 
virtual StatusCode setProperty (const std::string &s)
 Implementation of IProperty::setProperty.
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Implementation of IProperty::setProperty.
 
virtual StatusCode getProperty (Property *p) const
 Implementation of IProperty::getProperty.
 
virtual const PropertygetProperty (const std::string &name) const
 Implementation of IProperty::getProperty.
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Implementation of IProperty::getProperty.
 
virtual const std::vector
< Property * > & 
getProperties () const
 Implementation of IProperty::getProperties.
 
StatusCode setProperties ()
 Set the algorithm's properties.
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property.
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties.
 
SmartIF< IMonitorSvc > & monitorSvc () const
 Access the monitor service.
 
template<class T >
void declareInfo (const std::string &name, const T &var, const std::string &desc) const
 Declare monitoring information.
 
void declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const
 Declare monitoring information (special case)
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 

Private Member Functions

 GaudiAlgorithm ()
 no public default constructor
 
 GaudiAlgorithm (const GaudiAlgorithm &)
 no public copy
 
GaudiAlgorithmoperator= (const GaudiAlgorithm &)
 no public assignment
 

Private Attributes

SmartIF< INTupleSvcm_evtColSvc
 Event Tag Collection Service.
 
std::vector< std::stringm_vetoObjs
 skip the event if any of these objects are present in TES
 
std::vector< std::stringm_requireObjs
 process the event only if one or more of these objects are present in TES
 

Friends

class AlgFactory< GaudiAlgorithm >
 

Additional Inherited Members

- Public Types inherited from implements3< IAlgorithm, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class.
 
typedef extend_interfaces3
< IAlgorithm, IProperty,
IStateful
extend_interfaces_base
 Typedef to the base of this class.
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces.
 
- Protected Types inherited from GaudiCommon< Algorithm >
typedef std::map< std::string,
StatEntity
Statistics
 the actual type of general counters
 
typedef std::map< std::string,
unsigned int
Counter
 the actual type error/warning counter
 
typedef std::vector< IAlgTool * > AlgTools
 storage for active tools
 
typedef GaudiUtils::HashMap
< std::string, SmartIF
< IService > > 
Services
 storage for active services
 
- Protected Member Functions inherited from GaudiCommon< Algorithm >
virtual ~GaudiCommon ()
 Destructor.
 
StatusCode releaseTool (const IAlgTool *tool) const
 manual forced (and 'safe') release of the tool
 
StatusCode releaseSvc (const IInterface *svc) const
 manual forced (and 'safe') release of the service
 
- Protected Attributes inherited from GaudiCommon< Algorithm >
ICounterSummarySvcm_counterSummarySvc
 a pointer to the CounterSummarySvc
 
std::vector< std::stringm_counterList
 list of counters to declare. Set by property CounterList. This can be a regular expression.
 
std::vector< std::stringm_statEntityList
 
- Static Protected Attributes inherited from GaudiCommon< Algorithm >
static const bool IgnoreRootInTES
 Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods.
 
static const bool UseRootInTES
 Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods.
 

Detailed Description

The useful base class for data processing algorithms.

Small extension of ordinary the Algorithm base class.

This base class allows "easy"(=="1 line") access to tools and services. This access is safe in the sense that there is no need to worry about the reference counts for tools and services.

The base class allows "easy" (=="1 line") access to data in Gaudi Transient Stores. The functionality includes the checking of the presence of the data at the given location, checking the validity of the data, retrieval of valid data and "forced" retrieve of valid data (create if there is no data).

The base class allows to perform an easy error, warning and exception treatments, including the accumulated statistics of exceptions, errors and warnings.

The base class also includes utilities for general statistical counters.

It has been reported that usage of this base class results in significant shrinkage of existing code lines.

Attention
See also the class GaudiCommon, which implements some of the common functionality between GaudiTool and GaudiAlgorithm.
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru
Chris Jones Chris.nosp@m.toph.nosp@m.er.Ro.nosp@m.b.Jo.nosp@m.nes@c.nosp@m.ern..nosp@m.ch
Date
30/06/2001

Definition at line 95 of file GaudiAlgorithm.h.

Constructor & Destructor Documentation

GaudiAlgorithm::GaudiAlgorithm ( const std::string name,
ISvcLocator pSvcLocator 
)

Standard constructor (protected)

See Also
Algorithm
Parameters
namename of the algorithm
pSvcLocatorpointer to Service Locator

Definition at line 36 of file GaudiAlgorithm.cpp.

: GaudiCommon<Algorithm> ( name , pSvcLocator )
//
, m_evtColSvc () // pointer to Event Tag Collection Service
{
setProperty ( "RegisterForContextService" , true ).ignore() ;
declareProperty( "VetoObjects", m_vetoObjs,
"Skip execute if one or more of these TES objects exists" );
declareProperty( "RequireObjects", m_requireObjs,
"Execute only if one or more of these TES objects exists" );
}
GaudiAlgorithm::~GaudiAlgorithm ( )
virtual

destructor, virtual and protected

Definition at line 55 of file GaudiAlgorithm.cpp.

{ }
GaudiAlgorithm::GaudiAlgorithm ( )
private

no public default constructor

GaudiAlgorithm::GaudiAlgorithm ( const GaudiAlgorithm )
private

no public copy

Member Function Documentation

SmartIF< INTupleSvc > & GaudiAlgorithm::evtColSvc ( ) const

Access the standard event collection service.

Returns
pointer to the event collection service

Definition at line 94 of file GaudiAlgorithm.cpp.

{
if ( !m_evtColSvc.isValid() )
{ m_evtColSvc = svc< INTupleSvc > ( "EvtTupleSvc" , true ) ; }
//
return m_evtColSvc ;
}
StatusCode GaudiAlgorithm::execute ( )
virtual

standard execution method

See Also
Algorithm
IAlgorithm
Returns
status code

Reimplemented in GaudiSequencer, RecordOutputStream, ReplayOutputStream, Prescaler, and EventNodeKiller.

Definition at line 87 of file GaudiAlgorithm.cpp.

{
return Error ( "Default GaudiAlgorithm execute method called !!" ) ;
}
template<class TYPE >
bool GaudiAlgorithm::exist ( IDataProviderSvc svc,
const std::string location,
const bool  useRootInTES = true 
) const
inline

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

bool a1 = exist<DataObject>( evtSvc(), "/Event/MyObject" ) ;
bool a2 = exist<MyHits> ( evtSvc(), "/Event/MyHits" ) ;
Attention
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behavior can be suppressed by passing the argument useRootInTES = false
Parameters
svcPointer to data service (data provider)
locationAddress in Gaudi Transient Event Store
useRootInTESFlag to turn on(TRUE) off(FALSE) the use of the RootInTES location property
Returns
Boolean indicating status of the request
Return values
trueData object or container exists and implements a proper interface
trueFailed to locate the data object or container

Definition at line 505 of file GaudiAlgorithm.h.

{
return GaudiCommon<Algorithm>::exist<TYPE> ( svc , location , useRootInTES ) ;
}
template<class TYPE >
bool GaudiAlgorithm::exist ( 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>( "/Event/MyObject" ) ;
bool a2 = exist<MyHits> ( "/Event/MyHits" ) ;
Attention
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behavior can be suppressed by passing the argument useRootInTES = false
Parameters
locationAddress in Gaudi Transient Event Store
useRootInTESFlag to turn on(TRUE) off(FALSE) the use of the RootInTES location property
Returns
Boolean indicating status of the request
Return values
trueData object or container exists and implements a proper interface
trueFailed to locate the data object or container

Definition at line 538 of file GaudiAlgorithm.h.

{
return GaudiCommon<Algorithm>::exist<TYPE> ( evtSvc() , location , useRootInTES ) ;
}
template<class TYPE >
bool GaudiAlgorithm::existDet ( IDataProviderSvc svc,
const std::string location 
) const
inline

Check the existence of detector objects in the Gaudi Transient Detector Store.

bool a1 = existDet<DataObject> ( detSvc(), "/dd/Structure/MyObject" ) ;
bool a2 = existDet<Material> ( detSvc(), "/dd/Structure/Material/Air" ) ;
Parameters
svcPointer to data service (data provider)
locationAddress in Gaudi Transient Detector Store
Returns
Boolean indicating status of the request
Return values
trueDetector object exists and implements a proper interface
falseFailed to locate the data object

Definition at line 561 of file GaudiAlgorithm.h.

{
return GaudiCommon<Algorithm>::exist<TYPE> ( svc , location , false ) ;
}
template<class TYPE >
bool GaudiAlgorithm::existDet ( const std::string location) const
inline

Check the existence of detector objects in the Gaudi Transient Detector Store.

bool a1 = existDet<DataObject> ( "/dd/Structure/MyObject" ) ;
bool a2 = existDet<Material> ( "/dd/Structure/Material/Air" ) ;
Parameters
locationAddress in Gaudi Transient Detector Store
Returns
Boolean indicating status of the request
Return values
trueDetector object exists and implements a proper interface
falseFailed to locate the data object

Definition at line 583 of file GaudiAlgorithm.h.

{
return GaudiCommon<Algorithm>::exist<TYPE> ( detSvc() , location , false ) ;
}
StatusCode GaudiAlgorithm::finalize ( )
virtual

standard finalization method

See Also
Algorithm
IAlgorithm
Returns
status code

Reimplemented from GaudiCommon< Algorithm >.

Reimplemented in GaudiHistos< GaudiAlgorithm >, GaudiTuples< GaudiHistoAlg >, GaudiTupleAlg, GaudiHistoAlg, GaudiSequencer, RecordOutputStream, ReplayOutputStream, and Prescaler.

Definition at line 73 of file GaudiAlgorithm.cpp.

{
debug() << "Finalize base class GaudiAlgorithm" << endmsg;
// reset pointers
// finalize the base class and return
}
template<class TYPE >
Gaudi::Utils::GetData<TYPE>::return_type GaudiAlgorithm::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

MCHits* hits = get<MCHits>( evtSvc() , "/Event/MC/Hits" );
Attention
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behavior can be suppressed by passing the argument useRootInTES = false
See Also
IDataProviderSvc
SmartDataPtr
Exceptions
GaudiExceptionfor Invalid Data Provider Service
GaudiExceptionfor invalid/unavailable data
Parameters
svcPointer to data service (data provider)
locationdata location/address in Gaudi Transient Store
useRootInTESFlag to turn on(TRUE) off(FALSE) the use of the RootInTES location property
Returns
pointer to the data object

Definition at line 249 of file GaudiAlgorithm.h.

{
return GaudiCommon<Algorithm>::get<TYPE> ( svc , location , useRootInTES ) ;
}
template<class TYPE >
Gaudi::Utils::GetData<TYPE>::return_type GaudiAlgorithm::get ( const std::string location,
const bool  useRootInTES = true 
) const
inline

Templated access to the data from Gaudi Event Transient Store.

Quick and safe access to the data in Gaudi transient store.

The method located the data at the given address and perform the debug printout about located data.

MCParticles* mcps = get<MCParticles>( MCParticleLocation::Default );
Attention
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behavior can be suppressed by passing the argument useRootInTES = false
Parameters
locationData location/address in Gaudi Transient Store
useRootInTESFlag to turn on(TRUE) off(FALSE) the use of the RootInTES location property
Returns
Pointer to the data object

Definition at line 326 of file GaudiAlgorithm.h.

{
return GaudiCommon<Algorithm>::get<TYPE> ( evtSvc() , location , useRootInTES ) ;
}
template<class TYPE >
TYPE* GaudiAlgorithm::getDet ( IDataProviderSvc svc,
const std::string location 
) const
inline

Templated access to the detector data from the Gaudi Detector Transient Store.

Quick and safe access to the detector data in Gaudi transient store.

The method located the detector at the given address and perform the debug printout about located detector.

MyDet* mdet = getDet<MyDet>( detSvc() , "/dd/Structure/LHCb/MyDet" );
Parameters
svcPointer to data service (data provider)
locationDetector location/address in Gaudi Transient Store
Returns
Pointer to the detector object

Definition at line 391 of file GaudiAlgorithm.h.

{
return GaudiCommon<Algorithm>::get<TYPE> ( svc , location , false ) ;
}
template<class TYPE >
TYPE* GaudiAlgorithm::getDet ( const std::string location) const
inline

Templated access to the detector data from the Gaudi Detector Transient Store.

Quick and safe access to the detector data in Gaudi transient store.

The method located the detector at the given address and perform the debug printout about located detector.

MyDet* mdet = getDet<MyDet>( "/dd/Structure/LHCb/MyDet" );
Parameters
locationDetector location/address in Gaudi Transient Store
Returns
Pointer to the detector object

Definition at line 445 of file GaudiAlgorithm.h.

{
return GaudiCommon<Algorithm>::get<TYPE> ( detSvc() , location , false ) ;
}
template<class TYPE >
Gaudi::Utils::GetData<TYPE>::return_type GaudiAlgorithm::getDetIfExists ( IDataProviderSvc svc,
const std::string location 
) const
inline

Templated access to the detector data from the Gaudi Detector Transient Store.

Quick and safe access to the detector data in Gaudi transient store.

The method located the detector at the given address and perform the debug printout about located detector.

Skips the check on the data as performed by 'get'. No exception is thrown if the data is missing.

MyDet* mdet = getDetIfExists<MyDet>( detSvc() , "/dd/Structure/LHCb/MyDet" );
Parameters
svcPointer to data service (data provider)
locationDetector location/address in Gaudi Transient Store
Returns
Pointer to the detector object
Return values
NULLIf the detector object does not exist.

Definition at line 421 of file GaudiAlgorithm.h.

{
return GaudiCommon<Algorithm>::getIfExists<TYPE> ( svc , location , false ) ;
}
template<class TYPE >
Gaudi::Utils::GetData<TYPE>::return_type GaudiAlgorithm::getDetIfExists ( const std::string location) const
inline

Templated access to the detector data from the Gaudi Detector Transient Store.

Quick and safe access to the detector data in Gaudi transient store.

The method located the detector at the given address and perform the debug printout about located detector.

Skips the check on the data as performed by 'get'. No exception is thrown if the data is missing.

MyDet* mdet = getDetIfExists<MyDet>( "/dd/Structure/LHCb/MyDet" );
Parameters
locationDetector location/address in Gaudi Transient Store
Returns
Pointer to the detector object
Return values
NULLIf the detector object does not exist.

Definition at line 473 of file GaudiAlgorithm.h.

{
return GaudiCommon<Algorithm>::getIfExists<TYPE> ( detSvc() , location , false ) ;
}
template<class TYPE >
Gaudi::Utils::GetData<TYPE>::return_type GaudiAlgorithm::getIfExists ( 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.

Skips the check on the data as performed by 'get'. No exception is thrown if the data is missing.

MCHits* hits = getIfExists<MCHits>( evtSvc() , "/Event/MC/Hits" );
Attention
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behavior can be suppressed by passing the argument useRootInTES = false
See Also
IDataProviderSvc
SmartDataPtr
Parameters
svcPointer to data service (data provider)
locationdata location/address in Gaudi Transient Store
useRootInTESFlag to turn on(TRUE) off(FALSE) the use of the RootInTES location property
Returns
pointer to the data object.
Return values
NULLIf data does not exist.

Definition at line 291 of file GaudiAlgorithm.h.

{
return GaudiCommon<Algorithm>::getIfExists<TYPE> ( svc , location , useRootInTES ) ;
}
template<class TYPE >
Gaudi::Utils::GetData<TYPE>::return_type GaudiAlgorithm::getIfExists ( 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.

Skips the check on the data as performed by 'get'. No exception is thrown if the data is missing.

MCHits* hits = getIfExists<MCHits>( "/Event/MC/Hits" );
Attention
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behavior can be suppressed by passing the argument useRootInTES = false
See Also
IDataProviderSvc
SmartDataPtr
Parameters
locationdata location/address in Gaudi Transient Store
useRootInTESFlag to turn on(TRUE) off(FALSE) the use of the RootInTES location property
Returns
pointer to the data object.
Return values
NULLIf data does not exist.

Definition at line 366 of file GaudiAlgorithm.h.

{
return GaudiCommon<Algorithm>::getIfExists<TYPE> ( evtSvc() , location , useRootInTES ) ;
}
template<class TYPE , class TYPE2 >
Gaudi::Utils::GetData<TYPE>::return_type GaudiAlgorithm::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 behavior can be suppressed by passing the argument useRootInTES = false
Exceptions
GaudiExceptionfor Invalid Data Provider Service
GaudiExceptionfor invalid/unavailable data
Parameters
svcPointer to data service (data provider)
locationLocation in Gaudi Transient Event Store
useRootInTESFlag to turn on(TRUE) off(FALSE) the use of the RootInTES location property
Returns
A valid pointer to the object

Definition at line 617 of file GaudiAlgorithm.h.

{
return GaudiCommon<Algorithm>::getOrCreate<TYPE,TYPE2> ( svc , location , useRootInTES ) ;
}
template<class TYPE , class TYPE2 >
Gaudi::Utils::GetData<TYPE>::return_type GaudiAlgorithm::getOrCreate ( 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>( "/Event/MyHits" ) ;
Attention
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behavior can be suppressed by passing the argument useRootInTES = false
Exceptions
GaudiExceptionfor Invalid Data Provider Service
GaudiExceptionfor invalid/unavailable data
Parameters
locationLocation in Gaudi Transient Event Store
useRootInTESFlag to turn on(TRUE) off(FALSE) the use of the RootInTES location property
Returns
A valid pointer to the object

Definition at line 652 of file GaudiAlgorithm.h.

{
return GaudiCommon<Algorithm>::getOrCreate<TYPE,TYPE2> ( evtSvc() , location , useRootInTES ) ;
}
StatusCode GaudiAlgorithm::initialize ( )
virtual

standard initialization method

See Also
Algorithm
IAlgorithm
Returns
status code

Reimplemented from GaudiCommon< Algorithm >.

Reimplemented in GaudiHistos< GaudiAlgorithm >, GaudiTuples< GaudiHistoAlg >, GaudiTupleAlg, GaudiHistoAlg, GaudiSequencer, RecordOutputStream, Prescaler, and ReplayOutputStream.

Definition at line 59 of file GaudiAlgorithm.cpp.

{
// initialize the base class
if ( sc.isFailure() ) { return sc; }
// Add any customisations here, that cannot go in GaudiCommon
// return
return sc;
}
GaudiAlgorithm& GaudiAlgorithm::operator= ( const GaudiAlgorithm )
private

no public assignment

void GaudiAlgorithm::put ( IDataProviderSvc svc,
DataObject object,
const std::string address,
const bool  useRootInTES = true 
) const
inline

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

MCHits * hits = new MCHits();
put( evtSvc(), hits, "/Event/MC/Hits" );
Attention
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behavior can be suppressed by passing the argument useRootInTES = false
See Also
IDataProviderSvc
Parameters
svcPointer to data provider service
objectData object or container to be registered
addressAddress in Gaudi Event Transient Store ("/Event" could be omitted )
useRootInTESFlag to turn on(TRUE) off(FALSE) the use of the RootInTES location property
Exceptions
GaudiExceptionfor invalid event data service
GaudiExceptionfor invalid object
GaudiExceptionfor error result from event data service
Returns
StatusCode
Return values
StatusCode::SUCCESSData was successfully placed in the TES.
StatusCode::FAILUREFailed to store data in the TES.

Definition at line 169 of file GaudiAlgorithm.h.

{
GaudiCommon<Algorithm>::put ( svc , object , address , useRootInTES ) ;
}
void GaudiAlgorithm::put ( DataObject object,
const std::string address,
const bool  useRootInTES = true 
) const
inline

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

See Also
IDataProviderSvc
MCHits * hits = new MCHits();
put( hits, "/Event/MC/Hits" );
Attention
The method respects the setting of the job option RootInTES by prepending the value of this to the data location that is passed. The default setting for RootInTES is "" so has no effect. This behavior can be suppressed by passing the argument useRootInTES = false
Parameters
objectData object or container to be registered
addressAddress in Gaudi Event Transient Store ("/Event" could be omitted )
useRootInTESFlag to turn on(TRUE) off(FALSE) the use of the RootInTES location property
Exceptions
GaudiExceptionfor invalid event data service
GaudiExceptionfor invalid object
GaudiExceptionfor error result from event data service
Returns
StatusCode
Return values
StatusCode::SUCCESSData was successfully placed in the TES.
StatusCode::FAILUREFailed to store data in the TES.

Definition at line 208 of file GaudiAlgorithm.h.

{
GaudiCommon<Algorithm>::put ( evtSvc() , object , address , useRootInTES ) ;
}
StatusCode GaudiAlgorithm::sysExecute ( )
virtual

the generic actions for the execution.

See Also
Algorithm
IAlgorithm
Algorithm::sysExecute
Returns
status code

< guard/sentry

Reimplemented from Algorithm.

Definition at line 109 of file GaudiAlgorithm.cpp.

{
IAlgContextSvc* ctx = 0 ;
if ( registerContext() ) { ctx = contextSvc() ; }
// Lock the context
Gaudi::Utils::AlgContext cnt ( ctx , this ) ;
// Do not execute if one or more of the m_vetoObjs exist in TES
it != m_vetoObjs.end(); it++ ) {
if( exist<DataObject>(*it) ) {
debug() << *it << " found, skipping event " << endmsg;
}
}
// Execute if m_requireObjs is empty
bool doIt = m_requireObjs.empty() ? true : false;
// Execute also if one or more of the m_requireObjs exist in TES
it != m_requireObjs.end(); it++ ) {
if( exist<DataObject>(*it) ) {
doIt = true;
break;
}
}
if( doIt )
// execute the generic method:
else
}

Friends And Related Function Documentation

friend class AlgFactory< GaudiAlgorithm >
friend

Definition at line 98 of file GaudiAlgorithm.h.

Member Data Documentation

SmartIF<INTupleSvc> GaudiAlgorithm::m_evtColSvc
mutableprivate

Event Tag Collection Service.

Definition at line 691 of file GaudiAlgorithm.h.

std::vector<std::string> GaudiAlgorithm::m_requireObjs
private

process the event only if one or more of these objects are present in TES

Definition at line 695 of file GaudiAlgorithm.h.

std::vector<std::string> GaudiAlgorithm::m_vetoObjs
private

skip the event if any of these objects are present in TES

Definition at line 693 of file GaudiAlgorithm.h.


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

Generated at Wed Dec 4 2013 14:33:15 for Gaudi Framework, version v24r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004