Gaudi Framework, version v24r2

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

Sequencer for executing several algorithms, stopping when one is faulty. More...

#include <GaudiSequencer.h>

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

Classes

class  AlgorithmEntry
 

Public Member Functions

 GaudiSequencer (const std::string &name, ISvcLocator *pSvcLocator)
 Standard constructor.
 
virtual ~GaudiSequencer ()
 Destructor.
 
virtual StatusCode initialize ()
 Algorithm initialization.
 
virtual StatusCode execute ()
 Algorithm execution.
 
virtual StatusCode finalize ()
 Algorithm finalization.
 
virtual StatusCode beginRun ()
 Algorithm beginRun.
 
virtual StatusCode endRun ()
 Algorithm endRun.
 
void resetExecuted ()
 Called before an event processing.
 
void membershipHandler (Property &theProp)
 for asynchronous changes in the list of algorithms
 
- Public Member Functions inherited from GaudiAlgorithm
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 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
 

Protected Member Functions

StatusCode decodeNames ()
 Decode a vector of string.
 

Private Member Functions

 GaudiSequencer (const GaudiSequencer &a)
 Private copy, copy not allowed.
 
GaudiSequenceroperator= (const GaudiSequencer &a)
 Private assignment operator: This is not allowed.
 

Private Attributes

StringArrayProperty m_names
 Input string, list of algorithms.
 
std::vector< AlgorithmEntrym_entries
 List of algorithms to process.
 
bool m_modeOR
 Indicates that the OR is wanted instead of AND.
 
bool m_shortCircuit
 Indicates whether to stop processing as soon as possible, or to always execute all subalgorithms.
 
bool m_ignoreFilter
 True if one continues always.
 
bool m_isInitialized
 Indicate that we are ready.
 
bool m_measureTime
 Flag to measure time.
 
bool m_returnOK
 Forces the sequencer to return a good status.
 
ISequencerTimerToolm_timerTool
 Pointer to the timer tool.
 
int m_timer
 Timer number for the sequencer.
 

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

Sequencer for executing several algorithms, stopping when one is faulty.

Default behaviour (ModeOR=False) is to execute all algorithms until one returns filterPassed() = False. If ShortCircuit is set to False, then all algorithms will be executed.

In OR mode, the logic is opposite. All algorithms until one returns filterPassed() = True. To then exit one must onter-intuitively set ShortCircuit to False. If the default value ShortCircuit=True is left then all algorithms will be executed.

Author
Olivier Callot
Date
2004-05-13

Definition at line 27 of file GaudiSequencer.h.

Constructor & Destructor Documentation

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

Standard constructor.

Definition at line 20 of file GaudiSequencer.cpp.

: GaudiAlgorithm ( name , pSvcLocator )
, m_timerTool( 0 )
{
declareProperty( "Members" , m_names );
declareProperty( "ModeOR" , m_modeOR = false );
declareProperty( "IgnoreFilterPassed" , m_ignoreFilter = false );
declareProperty( "MeasureTime" , m_measureTime = false );
declareProperty( "ReturnOK" , m_returnOK = false );
declareProperty( "ShortCircuit" , m_shortCircuit = true );
}
GaudiSequencer::~GaudiSequencer ( )
virtual

Destructor.

Definition at line 37 of file GaudiSequencer.cpp.

{}
GaudiSequencer::GaudiSequencer ( const GaudiSequencer a)
private

Private copy, copy not allowed.

Member Function Documentation

StatusCode GaudiSequencer::beginRun ( )
virtual

Algorithm beginRun.

Reimplemented from Algorithm.

Definition at line 160 of file GaudiSequencer.cpp.

{
if ( !isEnabled() ) return StatusCode::SUCCESS;
if (msgLevel(MSG::DEBUG)) debug() << "==> beginRun" << endmsg;
}
StatusCode GaudiSequencer::decodeNames ( )
protected

Decode a vector of string.

Definition at line 199 of file GaudiSequencer.cpp.

{
//== Get the "Context" option if in the file...
IJobOptionsSvc* jos = svc<IJobOptionsSvc>( "JobOptionsSvc" );
bool addedContext = false; //= Have we added the context ?
bool addedRootInTES = false; //= Have we added the rootInTES ?
bool addedGlobalTimeOffset = false; //= Have we added the globalTimeOffset ?
//= Get the Application manager, to see if algorithm exist
IAlgManager* appMgr = svc<IAlgManager>("ApplicationMgr");
const std::vector<std::string>& nameVector = m_names.value();
for ( it = nameVector.begin(); nameVector.end() != it; it++ ) {
const Gaudi::Utils::TypeNameString typeName(*it);
const std::string &theName = typeName.name();
const std::string &theType = typeName.type();
//== Check wether the specified algorithm already exists. If not, create it
SmartIF<IAlgorithm> myIAlg = appMgr->algorithm(typeName, false); // do not create it now
if ( !myIAlg.isValid() ) {
//== Set the Context if not in the jobOptions list
if ( "" != context() ||
"" != rootInTES() ||
0.0 != globalTimeOffset() ) {
bool foundContext = false;
bool foundRootInTES = false;
bool foundGlobalTimeOffset = false;
const std::vector<const Property*>* properties = jos->getProperties( theName );
if ( 0 != properties ) {
// Iterate over the list to set the options
itProp != properties->end();
itProp++ ) {
const StringProperty* sp = dynamic_cast<const StringProperty*>(*itProp);
if ( 0 != sp ) {
if ( "Context" == (*itProp)->name() ) {
foundContext = true;
}
if ( "RootInTES" == (*itProp)->name() ) {
foundRootInTES = true;
}
if ( "GlobalTimeOffset" == (*itProp)->name() ) {
foundGlobalTimeOffset = true;
}
}
}
}
if ( !foundContext && "" != context() ) {
StringProperty contextProperty( "Context", context() );
jos->addPropertyToCatalogue( theName, contextProperty ).ignore();
addedContext = true;
}
if ( !foundRootInTES && "" != rootInTES() ) {
StringProperty rootInTESProperty( "RootInTES", rootInTES() );
jos->addPropertyToCatalogue( theName, rootInTESProperty ).ignore();
addedRootInTES = true;
}
if ( !foundGlobalTimeOffset && 0.0 != globalTimeOffset() ) {
DoubleProperty globalTimeOffsetProperty( "GlobalTimeOffset", globalTimeOffset() );
jos->addPropertyToCatalogue( theName, globalTimeOffsetProperty ).ignore();
addedGlobalTimeOffset = true;
}
}
Algorithm *myAlg = 0;
result = createSubAlgorithm( theType, theName, myAlg );
// (MCl) this should prevent bug #35199... even if I didn't manage to
// reproduce it with a simple test.
if (result.isSuccess()) myIAlg = myAlg;
} else {
Algorithm *myAlg = dynamic_cast<Algorithm*>(myIAlg.get());
if (myAlg) {
// when the algorithm is not created, the ref count is short by one, so we have to fix it.
myAlg->addRef();
}
}
//== Remove the property, in case this is not a GaudiAlgorithm...
if ( addedContext ) {
jos->removePropertyFromCatalogue( theName, "Context" ).ignore();
addedContext = false;
}
if ( addedRootInTES ) {
jos->removePropertyFromCatalogue( theName, "RootInTES" ).ignore();
addedRootInTES = false;
}
if ( addedGlobalTimeOffset ) {
jos->removePropertyFromCatalogue( theName, "GlobalTimeOffset" ).ignore();
addedGlobalTimeOffset = false;
}
// propagate the sub-algorithm into own state.
if ( result.isSuccess () &&
myIAlg.isValid () &&
Gaudi::StateMachine::INITIALIZED > myIAlg->FSMState() )
{
StatusCode sc = myIAlg->sysInitialize() ;
if ( sc.isFailure() ) { result = sc ; }
}
// propagate the sub-algorithm into own state.
if ( result.isSuccess () &&
myIAlg.isValid () &&
Gaudi::StateMachine::RUNNING > myIAlg->FSMState() )
{
StatusCode sc = myIAlg->sysStart () ;
if ( sc.isFailure() ) { result = sc ; }
}
//== Is it an Algorithm ? Strange test...
if ( result.isSuccess() ) {
// TODO: (MCl) it is possible to avoid the dynamic_cast in most of the
// cases by keeping the result of createSubAlgorithm.
Algorithm* myAlg = dynamic_cast<Algorithm*>(myIAlg.get());
if (myAlg!=0) {
// Note: The reference counting is kept by the system of sub-algorithms
m_entries.push_back( AlgorithmEntry( myAlg ) );
if (msgLevel(MSG::DEBUG)) debug () << "Added algorithm " << theName << endmsg;
} else {
warning() << theName << " is not an Algorithm - failed dynamic_cast"
<< endmsg;
}
} else {
warning() << "Unable to find or create " << theName << endmsg;
final = result;
}
}
release(appMgr).ignore();
release(jos).ignore();
//== Print the list of algorithms
if ( m_modeOR ) msg << "OR ";
msg << "Member list: ";
for ( itE = m_entries.begin(); m_entries.end() != itE; itE++ ) {
Algorithm* myAlg = (*itE).algorithm();
std::string myAlgType = System::typeinfoName( typeid( *myAlg) ) ;
if ( myAlg->name() == myAlgType ) {
msg << myAlg->name();
} else {
msg << myAlgType << "/" << myAlg->name();
}
if ( itE+1 != m_entries.end() ) msg << ", ";
}
if ( "" != context() ) msg << ", with context '" << context() << "'";
if ( "" != rootInTES() ) msg << ", with rootInTES '" << rootInTES() << "'";
if ( 0.0 != globalTimeOffset() ) msg << ", with globalTimeOffset " << globalTimeOffset();
msg << endmsg;
return final;
}
StatusCode GaudiSequencer::endRun ( )
virtual

Algorithm endRun.

Reimplemented from Algorithm.

Definition at line 171 of file GaudiSequencer.cpp.

{
if ( !isEnabled() ) return StatusCode::SUCCESS;
if (msgLevel(MSG::DEBUG)) debug() << "==> endRun" << endmsg;
}
StatusCode GaudiSequencer::execute ( )
virtual

Algorithm execution.

Reimplemented from GaudiAlgorithm.

Definition at line 82 of file GaudiSequencer.cpp.

{
if (msgLevel(MSG::DEBUG)) debug() << "==> Execute" << endmsg;
bool seqPass = !m_modeOR; // for OR, result will be false, unless (at least) one is true
// for AND, result will be true, unless (at least) one is false
// also see comment below ....
for ( itE = m_entries.begin(); m_entries.end() != itE; ++itE ) {
Algorithm* myAlg = itE->algorithm();
if ( ! myAlg->isEnabled() ) continue;
if ( ! myAlg->isExecuted() ) {
if ( m_measureTime ) m_timerTool->start( itE->timer() );
result = myAlg->sysExecute();
if ( m_measureTime ) m_timerTool->stop( itE->timer() );
myAlg->setExecuted( true );
if ( ! result.isSuccess() ) break; //== Abort and return bad status
}
//== Check the returned status
if ( !m_ignoreFilter ) {
bool passed = myAlg->filterPassed();
verbose() << "Algorithm " << myAlg->name() << " returned filter passed "
<< (passed ? "true" : "false") << endmsg;
if ( itE->reverse() ) passed = !passed;
//== indicate our own result. For OR, exit as soon as true.
// If no more, will exit with false.
//== for AND, exit as soon as false. Else, will be true (default)
// if not short-circuiting, make sure we latch iPass to 'true' in
// OR mode (i.e. it is sufficient for one item to be true in order
// to be true at the end, and thus we start out at 'false'), and latch
// to 'false' in AND mode (i.e. it is sufficient for one item to
// be false to the false in the end, and thus we start out at 'true')
// -- i.e. we should not just blindly return the 'last' passed status!
// or to put it another way: in OR mode, we don't care about things
// which are false, as they leave our current state alone (provided
// we stared as 'false'!), and in AND mode, we keep our current
// state until someone returns 'false' (provided we started as 'true')
if ( m_modeOR ? passed : !passed ) {
seqPass = passed;
verbose() << "SeqPass is now " << (seqPass ? "true" : "false") << endmsg;
if (m_shortCircuit) break;
}
}
}
verbose() << "SeqPass is " << (seqPass ? "true" : "false") << endmsg;
if ( !m_ignoreFilter && !m_entries.empty() ) setFilterPassed( seqPass );
setExecuted( true );
return m_returnOK ? StatusCode::SUCCESS : result;
}
StatusCode GaudiSequencer::finalize ( )
virtual

Algorithm finalization.

Reimplemented from GaudiAlgorithm.

Definition at line 151 of file GaudiSequencer.cpp.

{
if (msgLevel(MSG::DEBUG)) debug() << "==> Finalize" << endmsg;
}
StatusCode GaudiSequencer::initialize ( )
virtual

Algorithm initialization.

Reimplemented from GaudiAlgorithm.

Definition at line 42 of file GaudiSequencer.cpp.

{
if (msgLevel(MSG::DEBUG)) debug() << "==> Initialise" << endmsg;
StatusCode status = decodeNames();
if ( !status.isSuccess() ) return status;
m_timerTool = tool<ISequencerTimerTool>( "SequencerTimerTool" );
if ( m_measureTime ) {
} else {
}
//== Initialize the algorithms
for ( itE = m_entries.begin(); m_entries.end() != itE; itE++ ) {
if ( m_measureTime ) {
itE->setTimer( m_timerTool->addTimer( itE->algorithm()->name() ) );
}
status = itE->algorithm()->sysInitialize();
if ( !status.isSuccess() ) {
return Error( "Can not initialize " + itE->algorithm()->name(),
status );
}
}
}
void GaudiSequencer::membershipHandler ( Property theProp)

for asynchronous changes in the list of algorithms

Definition at line 371 of file GaudiSequencer.cpp.

{
// no action for not-yet initialized sequencer
if ( Gaudi::StateMachine::INITIALIZED > FSMState() ) { return ; } // RETURN
if ( !m_measureTime ) { return ; } // RETURN
// add the entries into timer table:
if ( 0 == m_timerTool )
{ m_timerTool = tool<ISequencerTimerTool>( "SequencerTimerTool" ) ; }
m_entries.end() != itE; ++itE )
{
itE->setTimer( m_timerTool->addTimer( itE->algorithm()->name() ) );
}
}
GaudiSequencer& GaudiSequencer::operator= ( const GaudiSequencer a)
private

Private assignment operator: This is not allowed.

void GaudiSequencer::resetExecuted ( )
virtual

Called before an event processing.

Reimplemented from Algorithm.

Definition at line 182 of file GaudiSequencer.cpp.

{
// algorithm doesn't call resetExecuted of subalgos! should it???
for ( itE = m_entries.begin(); m_entries.end() != itE; ++itE ) {
itE->algorithm()->resetExecuted();
}
}

Member Data Documentation

std::vector<AlgorithmEntry> GaudiSequencer::m_entries
private

List of algorithms to process.

Definition at line 82 of file GaudiSequencer.h.

bool GaudiSequencer::m_ignoreFilter
private

True if one continues always.

Definition at line 87 of file GaudiSequencer.h.

bool GaudiSequencer::m_isInitialized
private

Indicate that we are ready.

Definition at line 88 of file GaudiSequencer.h.

bool GaudiSequencer::m_measureTime
private

Flag to measure time.

Definition at line 89 of file GaudiSequencer.h.

bool GaudiSequencer::m_modeOR
private

Indicates that the OR is wanted instead of AND.

Definition at line 83 of file GaudiSequencer.h.

StringArrayProperty GaudiSequencer::m_names
private

Input string, list of algorithms.

Definition at line 81 of file GaudiSequencer.h.

bool GaudiSequencer::m_returnOK
private

Forces the sequencer to return a good status.

Definition at line 90 of file GaudiSequencer.h.

bool GaudiSequencer::m_shortCircuit
private

Indicates whether to stop processing as soon as possible, or to always execute all subalgorithms.

In MOdeOR=True the behaviour is the exact opposite.

Definition at line 84 of file GaudiSequencer.h.

int GaudiSequencer::m_timer
private

Timer number for the sequencer.

Definition at line 92 of file GaudiSequencer.h.

ISequencerTimerTool* GaudiSequencer::m_timerTool
private

Pointer to the timer tool.

Definition at line 91 of file GaudiSequencer.h.


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

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