The Gaudi Framework  v30r4 (9b837755)
Sequencer Class Reference

ClassName: Sequencer. More...

#include <GaudiAlg/Sequencer.h>

Inheritance diagram for Sequencer:
Collaboration diagram for Sequencer:

Public Member Functions

StatusCode initialize () override
 Initialization of a sequencer. More...
 
StatusCode reinitialize () override
 Sequencer Reinitialization. More...
 
StatusCode start () override
 Sequencer finalization. More...
 
StatusCode execute () override
 The actions to be performed by the sequencer on an event. More...
 
StatusCode stop () override
 Sequencer finalization. More...
 
StatusCode finalize () override
 Sequencer finalization. More...
 
void resetExecuted () override
 Reset the Sequencer executed state for the current event. More...
 
bool isSequence () const override final
 additional interface methods More...
 
virtual bool branchFilterPassed () const
 Was the branch filter passed for the last event? More...
 
virtual StatusCode setBranchFilterPassed (bool state)
 Set the branch filter passed flag for the last event. More...
 
virtual bool isStopOverride () const
 Has the StopOverride mode been set? More...
 
StatusCode append (Algorithm *pAlgorithm)
 Append an algorithm to the sequencer. More...
 
StatusCode appendToBranch (Algorithm *pAlgorithm)
 Append an algorithm to the sequencer branch. More...
 
StatusCode createAndAppend (const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
 Create a algorithm and append it to the sequencer. More...
 
StatusCode createAndAppendToBranch (const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
 Create a algorithm and append it to the sequencer branch. More...
 
StatusCode remove (Algorithm *pAlgorithm)
 Remove the specified algorithm from the sequencer. More...
 
StatusCode remove (const std::string &name)
 
StatusCode removeFromBranch (Algorithm *pAlgorithm)
 
StatusCode removeFromBranch (const std::string &name)
 
const std::vector< Algorithm * > & branchAlgorithms () const
 List of branch algorithms. More...
 
std::vector< Algorithm * > & branchAlgorithms ()
 
StatusCode decodeMemberNames ()
 Decode Member Name list. More...
 
StatusCode decodeBranchMemberNames ()
 Decode branch member name list. More...
 
std::ostreamtoControlFlowExpression (std::ostream &os) const override
 Produce string represention of the control flow expression. More...
 
- Public Member Functions inherited from Algorithm
 Algorithm (const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
 Constructor. More...
 
StatusCode sysStart () override
 Reinitialization method invoked by the framework. More...
 
StatusCode sysInitialize () override
 Initialization method invoked by the framework. More...
 
StatusCode sysReinitialize () override
 Reinitialization method invoked by the framework. More...
 
StatusCode sysRestart () override
 Restart method invoked by the framework. More...
 
StatusCode sysExecute (const EventContext &ctx) override
 The actions to be performed by the algorithm on an event. More...
 
StatusCode sysStop () override
 System stop. More...
 
StatusCode sysFinalize () override
 System finalization. More...
 
StatusCode sysBeginRun () override
 beginRun method invoked by the framework. More...
 
StatusCode sysEndRun () override
 endRun method invoked by the framework. More...
 
const std::stringname () const override
 The identifying name of the algorithm object. More...
 
const Gaudi::StringKeynameKey () const override
 
const std::stringtype () const override
 The type of the algorithm object. More...
 
void setType (const std::string &type) override
 
const std::stringversion () const override
 
unsigned int index () const override
 
StatusCode configure () override
 Dummy implementation of IStateful::configure() method. More...
 
StatusCode terminate () override
 Dummy implementation of IStateful::terminate() method. More...
 
StatusCode initialize () override
 the default (empty) implementation of IStateful::initialize() method More...
 
StatusCode start () override
 the default (empty) implementation of IStateful::start() method More...
 
StatusCode stop () override
 the default (empty) implementation of IStateful::stop() method More...
 
StatusCode finalize () override
 the default (empty) implementation of IStateful::finalize() method More...
 
StatusCode reinitialize () override
 the default (empty) implementation of IStateful::reinitialize() method More...
 
StatusCode restart () override
 the default (empty) implementation of IStateful::restart() method More...
 
Gaudi::StateMachine::State FSMState () const override
 returns the current state of the algorithm More...
 
Gaudi::StateMachine::State targetFSMState () const override
 returns the state the algorithm will be in after the ongoing transition More...
 
bool isExecuted () const override
 Has this algorithm been executed since the last reset? More...
 
void setExecuted (bool state) const override
 Set the executed flag to the specified state. More...
 
void resetExecuted () override
 Reset the executed state of the Algorithm for the duration of the current event. More...
 
StatusCode beginRun () override
 Algorithm begin run. More...
 
StatusCode endRun () override
 Algorithm end run. This method is called at the end of the event loop. More...
 
bool isEnabled () const override
 Is this algorithm enabled or disabled? More...
 
bool isSequence () const override
 Are we a Sequence? More...
 
bool filterPassed () const override
 Did this algorithm pass or fail its filter criterion for the last event? More...
 
void setFilterPassed (bool state) const override
 Set the filter passed flag to the specified state. More...
 
unsigned int errorCount () const
 Get the number of failures of the algorithm. More...
 
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. More...
 
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. More...
 
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") More...
 
template<class T >
SmartIF< T > service (const std::string &name, bool createIf=true, bool quiet=false) const
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
SmartIF< IChronoStatSvc > & chronoSvc () const
 The standard Chrono & Stat service, Return a pointer to the service if present. More...
 
SmartIF< IChronoStatSvc > & chronoStatService () const
 
SmartIF< IDataProviderSvc > & detSvc () const
 The standard detector data service. More...
 
SmartIF< IDataProviderSvc > & detDataService () const
 
SmartIF< IConversionSvc > & detCnvSvc () const
 The standard detector data persistency conversion service. More...
 
SmartIF< IConversionSvc > & detDataCnvService () const
 
SmartIF< IDataProviderSvc > & eventSvc () const final override
 The standard event data service. More...
 
SmartIF< IDataProviderSvc > & evtSvc () const
 shortcut for method eventSvc More...
 
SmartIF< IDataProviderSvc > & eventDataService () const
 
SmartIF< IConversionSvc > & eventCnvSvc () const
 The standard event data persistency conversion service. More...
 
SmartIF< IConversionSvc > & eventDataCnvService () const
 
SmartIF< IHistogramSvc > & histoSvc () const
 The standard histogram service. More...
 
SmartIF< IHistogramSvc > & histogramDataService () const
 
SmartIF< INTupleSvc > & ntupleSvc () const
 The standard N tuple service. More...
 
SmartIF< INTupleSvc > & ntupleService () const
 
SmartIF< IRndmGenSvc > & randSvc () const
 The standard RandomGen service, Return a pointer to the service if present. More...
 
SmartIF< IToolSvc > & toolSvc () const
 The standard ToolSvc service, Return a pointer to the service if present. More...
 
SmartIF< IExceptionSvc > & exceptionSvc () const
 Get the exception Service. More...
 
SmartIF< IAlgContextSvc > & contextSvc () const
 get Algorithm Context Service More...
 
SmartIF< ITimelineSvc > & timelineSvc () const
 
SmartIF< ISvcLocator > & serviceLocator () const override
 The standard service locator. More...
 
SmartIF< ISvcLocator > & svcLoc () const
 shortcut for method serviceLocator More...
 
SmartIF< IHiveWhiteBoard > & whiteboard () const
 
SmartIF< IAlgExecStateSvc > & algExecStateSvc () const
 
bool registerContext () const
 register for Algorithm Context Service? More...
 
StatusCode createSubAlgorithm (const std::string &type, const std::string &name, Algorithm *&pSubAlg)
 Create a sub algorithm. More...
 
const std::vector< Algorithm * > * subAlgorithms () const
 List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms. More...
 
std::vector< Algorithm * > * subAlgorithms ()
 List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms. More...
 
StatusCode setProperties ()
 Set the algorithm's properties. More...
 
template<class T >
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
 
template<class T >
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
 
SmartIF< IMonitorSvc > & monitorSvc () const
 Access the monitor service. More...
 
template<class T >
void declareInfo (const std::string &name, const T &var, const std::string &desc) const
 Declare monitoring information. More...
 
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) More...
 
const EventContextgetContext () const override
 get the context More...
 
void registerTool (IAlgTool *tool) const
 
void deregisterTool (IAlgTool *tool) const
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, bool createIf=true)
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, std::string toolTypeAndName, bool createIf=true)
 
template<class T >
void addToolsArray (ToolHandleArray< T > &hndlArr)
 
const std::vector< IAlgTool * > & tools () const
 
bool isIOBound () const
 
void setIOBound (bool value)
 
unsigned int cardinality () const override
 Return the cardinality. More...
 
const std::vector< std::string > & neededResources () const override
 
std::ostreamtoControlFlowExpression (std::ostream &os) const override
 Produce string represention of the control flow expression. More...
 
- Public Member Functions inherited from DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > > >
 DataHandleHolderBase (Args &&...args)
 NOTE: Cannot use "using Super::Super;" due to a GCC 6 bug. More...
 
void registerDataHandle (Gaudi::v2::DataHandle &handle) final override
 Register a data handle of this algorithm/tool. More...
 
void addDataDependency (const DataObjID &key, AccessMode access) final override
 Add a data dependency, even after initialization. More...
 
const DataObjIDColldataDependencies (AccessMode access) const final override
 Tell which whiteboard keys the algorithm will be reading or writing. More...
 
void declare (Gaudi::v1::DataHandle &handle) override
 Declare ownership of a legacy DataHandle. More...
 
void renounce (Gaudi::v1::DataHandle &handle) override
 Discard ownership of a legacy DataHandle. More...
 
const DataObjIDCollallDataDependencies () const final override
 
- Public Member Functions inherited from extends< PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > >, IDataHandleHolder >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > >
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation. More...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p) override
 set the property form another property More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 set the property from name and the value More...
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (const std::string &name) const override
 get the property by name More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties More...
 
bool hasProperty (const std::string &name) const override
 Return true if we have a property with the given name. More...
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream) More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
MSG::Level outputLevel () const
 Backward compatibility function for getting the output level. More...
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 

Protected Member Functions

StatusCode append (Algorithm *pAlgorithm, std::vector< Algorithm * > &theAlgs)
 Append an algorithm to the sequencer. More...
 
StatusCode createAndAppend (const std::string &type, const std::string &name, Algorithm *&pAlgorithm, std::vector< Algorithm * > &theAlgs)
 Create a algorithm and append it to the sequencer. More...
 
StatusCode decodeNames (Gaudi::Property< std::vector< std::string >> &theNames, std::vector< Algorithm * > &theAlgs, std::vector< bool > &theLogic)
 Decode algorithm names, creating or appending algorithms as appropriate. More...
 
StatusCode execute (const std::vector< Algorithm * > &theAlgs, std::vector< bool > &theLogic, Algorithm *&lastAlgorithm, unsigned int first=0)
 Execute the members in the specified list. More...
 
StatusCode executeMember (Algorithm *theAlgorithm)
 Execute member algorithm. More...
 
StatusCode remove (const std::string &algname, std::vector< Algorithm * > &theAlgs)
 Remove the specified algorithm from the sequencer. More...
 
 Sequencer (const Sequencer &a)=delete
 
Sequenceroperator= (const Sequencer &rhs)=delete
 
- Protected Member Functions inherited from Algorithm
std::vector< IAlgTool * > & tools ()
 
bool isInitialized () const override
 Has the Algorithm already been initialized? More...
 
bool isFinalized () const override
 Has the Algorithm already been finalized? More...
 
void setIndex (const unsigned int &idx) override
 set instantiation index of Alg More...
 
AlgExecStateexecState (const EventContext &ctx) const
 reference to AlgExecState of Alg More...
 
- Protected Member Functions inherited from DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > > >
void updateDataDependencies (const DataObjIDMapping &keyMap)
 Update the key of each registered data dependency, using a user-defined mapping from the old to the new key. More...
 
void collectExplicitDataDependencies ()
 Collect all explicit data dependencies in a single place. More...
 
StatusCode handleCircularDataDependencies (CircularDepHandler &&circularDepHandler)
 Look for circular dependencies and let a user-specified handler deal with each of them. More...
 
void collectImplicitDataDependencies (const IDataHandleHolder *child)
 Add the dependencies of another DataHandleHolder to our dependency list. More...
 
const DataObjIDCollignoredDataDependencies (AccessMode access) const
 Tell which data dependencies have been ignored due to an empty key. More...
 
void initializeDataHandleHolder ()
 Initialize the DataHandles. More...
 
- Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > >
Gaudi::Details::PropertyBaseproperty (const std::string &name) const
 
- Protected Member Functions inherited from CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches. More...
 
MSG::Level resetMessaging ()
 Reinitialize internal states. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Private Attributes

Gaudi::Property< std::vector< std::string > > m_names
 
Gaudi::Property< std::vector< std::string > > m_branchNames
 
Gaudi::Property< bool > m_stopOverride {this, "StopOverride", false, "stop on filter failure override"}
 
std::vector< bool > m_isInverted
 
std::vector< Algorithm * > m_branchAlgs
 
std::vector< bool > m_isBranchInverted
 
bool m_branchFilterPassed = false
 

Additional Inherited Members

- Public Types inherited from Algorithm
using Factory = Gaudi::PluginService::Factory< IAlgorithm *(const std::string &, ISvcLocator *)>
 
- Public Types inherited from extends< PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > >, IDataHandleHolder >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces... >
 Typedef to the base of this class. More...
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > >
using PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > >
 Typedef used to refer to this class from derived classes, as in. More...
 
- Public Types inherited from CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
 take union of the ext_iids of all Interfaces... More...
 
- Public Attributes inherited from Algorithm
friend AlgorithmManager
 
- Protected Types inherited from DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > > >
enum  CircularDepAction
 A circular dependency handling action. More...
 
using DataObjIDMapping = std::function< boost::optional< DataObjID >(const DataObjID &)>
 DataObjID mapping function, with optimized identity mapping case. More...
 
using CircularDepHandler = std::function< CircularDepAction(const DataObjID &)>
 A circular dependency handler, which can take any user-specified step (e.g. More...
 
- Protected Attributes inherited from Algorithm
DataObjIDMapping m_updateDependencies
 Hook for for derived classes to alter the DataObjID of dependencies. More...
 

Detailed Description

ClassName: Sequencer.

Description: A Sequencer is essentially a list of Algorithms and is responsible for their management. Note that Sequences may themselves contain other Sequences. The default execute( ) implementation loops over the members of the sequence, calling their execute( ) methods. However, this can be modified if a member is disabled, has already been executed, or a member indicates that it's filter fails. The the former two cases the execution of the member is bypassed. In the latter case, the loop is terminated and the Sequencer assumes the same filtered state as the last member.

Definition at line 23 of file Sequencer.h.

Constructor & Destructor Documentation

Sequencer::Sequencer ( const Sequencer a)
protecteddelete

Member Function Documentation

StatusCode Sequencer::append ( Algorithm pAlgorithm)

Append an algorithm to the sequencer.

Definition at line 201 of file Sequencer.cpp.

201 { return append( pAlgorithm, *subAlgorithms() ); }
StatusCode append(Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:201
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:783
StatusCode Sequencer::append ( Algorithm pAlgorithm,
std::vector< Algorithm * > &  theAlgs 
)
protected

Append an algorithm to the sequencer.

Protected Member Functions.

Definition at line 244 of file Sequencer.cpp.

245 {
246  // Check that the specified algorithm doesn't already exist in the membership list
247  if ( std::find( std::begin( theAlgs ), std::end( theAlgs ), pAlgorithm ) != std::end( theAlgs ) ) {
248  return StatusCode::FAILURE;
249  }
250  theAlgs.push_back( pAlgorithm );
251  pAlgorithm->addRef();
252  return StatusCode::SUCCESS;
253 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
T end(T...args)
T push_back(T...args)
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
T find(T...args)
T begin(T...args)
StatusCode Sequencer::appendToBranch ( Algorithm pAlgorithm)

Append an algorithm to the sequencer branch.

Definition at line 203 of file Sequencer.cpp.

203 { return append( pAlgorithm, branchAlgorithms() ); }
StatusCode append(Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:201
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:224
const std::vector< Algorithm * > & Sequencer::branchAlgorithms ( ) const

List of branch algorithms.

These are the algorithms that would get executed if a filter algorithm indicated a failure. The branch is located within the main sequence by the first element, which is the filter algorithm.

Definition at line 224 of file Sequencer.cpp.

224 { return m_branchAlgs; }
std::vector< Algorithm * > m_branchAlgs
Definition: Sequencer.h:233
std::vector< Algorithm * > & Sequencer::branchAlgorithms ( )

Definition at line 226 of file Sequencer.cpp.

226 { return m_branchAlgs; }
std::vector< Algorithm * > m_branchAlgs
Definition: Sequencer.h:233
bool Sequencer::branchFilterPassed ( ) const
virtual

Was the branch filter passed for the last event?

Definition at line 191 of file Sequencer.cpp.

191 { return m_branchFilterPassed; }
bool m_branchFilterPassed
Definition: Sequencer.h:236
StatusCode Sequencer::createAndAppend ( const std::string type,
const std::string name,
Algorithm *&  pAlgorithm 
)

Create a algorithm and append it to the sequencer.

A call to this method creates a child algorithm object. Note that the returned pointer is to Algorithm (as opposed to IAlgorithm), and thus the methods of IProperty are also available for the direct setting of the algorithm's properties. Using this mechanism instead of creating algorithms directly via the new operator is preferred since then the framework may take care of all of the necessary book-keeping.

Definition at line 205 of file Sequencer.cpp.

206 {
207  return createAndAppend( type, name, pAlgorithm, *subAlgorithms() );
208 }
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:783
StatusCode createAndAppend(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: Sequencer.cpp:205
StatusCode Sequencer::createAndAppend ( const std::string type,
const std::string name,
Algorithm *&  pAlgorithm,
std::vector< Algorithm * > &  theAlgs 
)
protected

Create a algorithm and append it to the sequencer.

A call to this method creates a child algorithm object. Note that the returned pointer is to Algorithm (as opposed to IAlgorithm), and thus the methods of IProperty are also available for the direct setting of the algorithm's properties. Using this mechanism instead of creating algorithms directly via the new operator is preferred since then the framework may take care of all of the necessary book-keeping.

Definition at line 255 of file Sequencer.cpp.

257 {
258  auto theAlgMgr = serviceLocator()->service<IAlgManager>( "ApplicationMgr" );
259  if ( !theAlgMgr ) return StatusCode::FAILURE;
260 
261  IAlgorithm* tmp;
262  StatusCode result = theAlgMgr->createAlgorithm( type, algName, tmp );
263  if ( result.isSuccess() ) {
264  try {
265  pAlgorithm = dynamic_cast<Algorithm*>( tmp );
266  theAlgs.push_back( pAlgorithm );
267  } catch ( ... ) {
268  error() << "Unable to create Algorithm " << algName << endmsg;
269  result = StatusCode::FAILURE;
270  }
271  }
272 
273  return result;
274 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
bool isSuccess() const
Definition: StatusCode.h:287
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:27
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79
T push_back(T...args)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:28
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Definition: Algorithm.cpp:816
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode Sequencer::createAndAppendToBranch ( const std::string type,
const std::string name,
Algorithm *&  pAlgorithm 
)

Create a algorithm and append it to the sequencer branch.

A call to this method creates a child algorithm object. Note that the returned pointer is to Algorithm (as opposed to IAlgorithm), and thus the methods of IProperty are also available for the direct setting of the algorithm's properties. Using this mechanism instead of creating algorithms directly via the new operator is preferred since then the framework may take care of all of the necessary book-keeping.

Definition at line 210 of file Sequencer.cpp.

212 {
213  return createAndAppend( type, name, pAlgorithm, branchAlgorithms() );
214 }
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:224
StatusCode createAndAppend(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: Sequencer.cpp:205
StatusCode Sequencer::decodeBranchMemberNames ( )

Decode branch member name list.

Definition at line 234 of file Sequencer.cpp.

235 {
236  // Decode the branch membership list
238 }
Gaudi::Property< std::vector< std::string > > m_branchNames
Definition: Sequencer.h:222
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:224
StatusCode decodeNames(Gaudi::Property< std::vector< std::string >> &theNames, std::vector< Algorithm * > &theAlgs, std::vector< bool > &theLogic)
Decode algorithm names, creating or appending algorithms as appropriate.
Definition: Sequencer.cpp:276
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:234
StatusCode Sequencer::decodeMemberNames ( )

Decode Member Name list.

Definition at line 228 of file Sequencer.cpp.

229 {
230  // Decode the membership list
232 }
Gaudi::Property< std::vector< std::string > > m_names
Definition: Sequencer.h:214
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:783
std::vector< bool > m_isInverted
Definition: Sequencer.h:232
StatusCode decodeNames(Gaudi::Property< std::vector< std::string >> &theNames, std::vector< Algorithm * > &theAlgs, std::vector< bool > &theLogic)
Decode algorithm names, creating or appending algorithms as appropriate.
Definition: Sequencer.cpp:276
StatusCode Sequencer::decodeNames ( Gaudi::Property< std::vector< std::string >> &  theNames,
std::vector< Algorithm * > &  theAlgs,
std::vector< bool > &  theLogic 
)
protected

Decode algorithm names, creating or appending algorithms as appropriate.

Definition at line 276 of file Sequencer.cpp.

278 {
279  StatusCode result;
280  auto theAlgMgr = serviceLocator()->service<IAlgManager>( "ApplicationMgr" );
281  if ( theAlgMgr ) {
282  // Clear the existing list of algorithms
283  theAlgs.clear();
284 
285  // Build the list of member algorithms from the contents of the
286  // theNames list.
287  for ( const auto& n : theNames.value() ) {
288 
289  // Parse the name for a syntax of the form:
290  //
291  // <type>/<name>
292  //
293  // Where <name> is the algorithm instance name, and <type> is the
294  // algorithm class type (being a subclass of Algorithm).
296  std::string theName = typeName.name();
297  std::string theType = typeName.type();
298 
299  // Parse the name for a syntax of the form:
300  //
301  // <name>:invert
302  //
303  // Where <name> is the algorithm instance name and ":invert"
304  // indicates that the filter passed logic is inverted.
305  bool isInverted = false;
306  std::string::size_type invert = theName.find_first_of( ":" );
307  // Skip all occurrences of "::" (allow namespaces)
308  while ( std::string::npos != invert && invert < ( theName.size() - 1 ) && theName[invert + 1] == ':' )
309  invert = theName.find_first_of( ":", invert + 2 );
310  if ( std::string::npos != invert ) {
311  if ( theName == theType ) {
312  // This means that we got something like "Type:invert",
313  // so we have to strip the ":invert" from the type too.
314  theType = theType.substr( 0, invert );
315  }
316  theName = theName.substr( 0, invert );
317  isInverted = true;
318  }
319  // Check whether the supplied name corresponds to an existing
320  // Algorithm object.
321  SmartIF<IAlgorithm>& theIAlg = theAlgMgr->algorithm( theName, false );
322  Algorithm* theAlgorithm = nullptr;
324  if ( theIAlg ) {
325  try {
326  theAlgorithm = dynamic_cast<Algorithm*>( theIAlg.get() );
327  } catch ( ... ) {
328  warning() << theName << " is not an Algorithm - Failed dynamic cast" << endmsg;
329  theAlgorithm = nullptr; // release
330  }
331  }
332  if ( theAlgorithm ) {
333 
334  // The specified Algorithm already exists - just append it to the membership list.
335  status = append( theAlgorithm, theAlgs );
336  if ( status.isSuccess() ) {
337  ON_DEBUG debug() << theName << " already exists - appended to member list" << endmsg;
338  } else {
339  warning() << theName << " already exists - append failed!!!" << endmsg;
340  result = StatusCode::FAILURE;
341  }
342  } else {
343 
344  // The specified name doesn't exist - create a new object of the specified type
345  // and append it to the membership list.
346  status = createAndAppend( theType, theName, theAlgorithm, theAlgs );
347  if ( status.isSuccess() ) {
348  ON_DEBUG debug() << theName << " doesn't exist - created and appended to member list" << endmsg;
349  } else {
350  warning() << theName << " doesn't exist - creation failed!!!" << endmsg;
351  result = StatusCode::FAILURE;
352  }
353  }
354  if ( status.isSuccess() ) theLogic.push_back( isInverted );
355  }
356  }
357  // Print membership list
358  if ( result.isSuccess() && theAlgs.size() != 0 ) {
359  info() << "Member list: ";
360  auto ai = theAlgs.begin();
361  auto li = theLogic.begin();
362  for ( ; ai != theAlgs.end(); ++ai, ++li ) {
363 
364  if ( ai != theAlgs.begin() ) info() << ", ";
365  auto alg = *ai;
366  if ( alg->name() == System::typeinfoName( typeid( *alg ) ) )
367  info() << alg->name();
368  else
369  info() << System::typeinfoName( typeid( *alg ) ) << "/" << alg->name();
370 
371  if ( *li ) info() << ":invert";
372  }
373  info() << endmsg;
374  }
375  return result;
376 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
StatusCode append(Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:201
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:332
bool isSuccess() const
Definition: StatusCode.h:287
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:27
T end(T...args)
STL class.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79
T push_back(T...args)
Helper class to parse a string of format "type/name".
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
T find_first_of(T...args)
T clear(T...args)
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Definition: Algorithm.cpp:816
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
T size(T...args)
#define ON_DEBUG
Definition: Sequencer.cpp:14
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
StatusCode createAndAppend(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: Sequencer.cpp:205
T begin(T...args)
T substr(T...args)
const ValueType & value() const
Backward compatibility (.
Definition: Property.h:587
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:23
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode Sequencer::execute ( )
override

The actions to be performed by the sequencer on an event.

This method is invoked once per event.

Definition at line 74 of file Sequencer.cpp.

75 {
77  ON_DEBUG debug() << name() << " Sequencer::execute( )" << endmsg;
78 
79  // Bypass the loop if this sequencer is disabled or has already been executed
80  if ( isEnabled() && !isExecuted() ) {
81  Algorithm* lastAlgorithm;
82  result = execute( *subAlgorithms(), m_isInverted, lastAlgorithm );
83  if ( result.isSuccess() ) {
84  bool passed = filterPassed();
85  if ( !passed && !isStopOverride() ) {
86 
87  // Filter failed and stop override not set. Execute the
88  // branch if there is one associated with the filter
89  // algorithm that failed. Note that the first member on
90  // the branch is the failing algorithm and so should
91  // be skipped.
92  const auto& theAlgs = branchAlgorithms();
93  if ( !theAlgs.empty() ) {
94  Algorithm* branchAlgorithm = theAlgs[0];
95  if ( lastAlgorithm == branchAlgorithm ) {
96 
97  // Branch specified - Loop over branch members
98  result = execute( branchAlgorithms(), m_isBranchInverted, lastAlgorithm, 1 );
99  if ( result.isSuccess() ) {
100 
101  // The final filter passed state will be set true if either
102  // of the main or branches passed, otherwise false.
103 
104  // Save the branch filter passed state.
106  }
107  }
108  }
109  }
110  }
111 
112  // Prevent multiple executions of this sequencer for the current event
113  setExecuted( true );
114  }
115  return result;
116 }
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:199
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:747
bool isExecuted() const override
Has this algorithm been executed since the last reset?
Definition: Algorithm.cpp:757
bool isSuccess() const
Definition: StatusCode.h:287
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:224
virtual StatusCode setBranchFilterPassed(bool state)
Set the branch filter passed flag for the last event.
Definition: Sequencer.cpp:193
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:769
StatusCode execute() override
The actions to be performed by the sequencer on an event.
Definition: Sequencer.cpp:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:783
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
#define ON_DEBUG
Definition: Sequencer.cpp:14
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::vector< bool > m_isInverted
Definition: Sequencer.h:232
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
bool filterPassed() const override
Did this algorithm pass or fail its filter criterion for the last event?
Definition: Algorithm.cpp:771
void setExecuted(bool state) const override
Set the executed flag to the specified state.
Definition: Algorithm.cpp:762
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:234
StatusCode Sequencer::execute ( const std::vector< Algorithm * > &  theAlgs,
std::vector< bool > &  theLogic,
Algorithm *&  lastAlgorithm,
unsigned int  first = 0 
)
protected

Execute the members in the specified list.

Definition at line 378 of file Sequencer.cpp.

380 {
382 
383  // Loop over all algorithms calling their execute functions if they
384  // are (a) not disabled, and (b) aren't already executed. Note that
385  // in the latter case the filter state is still examined. Terminate
386  // the loop if an algorithm indicates that it's filter didn't pass.
387  unsigned int size = theAlgs.size();
388  for ( unsigned int i = first; i < size; i++ ) {
389  lastAlgorithm = theAlgs[i];
390  result = executeMember( lastAlgorithm );
391  if ( result.isSuccess() ) {
392 
393  // Take the filter passed status of this algorithm as my own status.
394  // Note that we take into account inverted logic.
395  bool passed = lastAlgorithm->filterPassed();
396  bool isInverted = theLogic[i];
397  if ( isInverted ) passed = !passed;
398  setFilterPassed( passed );
399 
400  // The behaviour when the filter fails depends on the StopOverride property.
401  // The default action is to stop processing, but this default can be
402  // overridden by setting the "StopOverride" property to true.
403  if ( !isStopOverride() ) {
404  if ( !passed ) break;
405  }
406  } else {
407  break;
408  }
409  }
410  return result;
411 }
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:199
void setFilterPassed(bool state) const override
Set the filter passed flag to the specified state.
Definition: Algorithm.cpp:773
bool isSuccess() const
Definition: StatusCode.h:287
StatusCode executeMember(Algorithm *theAlgorithm)
Execute member algorithm.
Definition: Sequencer.cpp:413
constexpr auto size(const C &c) noexcept(noexcept(c.size())) -> decltype(c.size())
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
T size(T...args)
bool filterPassed() const override
Did this algorithm pass or fail its filter criterion for the last event?
Definition: Algorithm.cpp:771
StatusCode Sequencer::executeMember ( Algorithm theAlgorithm)
protected

Execute member algorithm.

Definition at line 413 of file Sequencer.cpp.

414 {
416  if ( theAlgorithm->isEnabled() ) {
417  if ( !theAlgorithm->isExecuted() ) {
418  result = theAlgorithm->sysExecute( getContext() );
419  }
420  }
421  return result;
422 }
bool isExecuted() const override
Has this algorithm been executed since the last reset?
Definition: Algorithm.cpp:757
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:769
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
const EventContext & getContext() const override
get the context
Definition: Algorithm.h:437
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
StatusCode sysExecute(const EventContext &ctx) override
The actions to be performed by the algorithm on an event.
Definition: Algorithm.cpp:528
StatusCode Sequencer::finalize ( )
override

Sequencer finalization.

Definition at line 118 of file Sequencer.cpp.

119 {
120  // Loop over all branch members calling their finalize functions
121  // if they are not disabled. Note that the Algorithm::sysFinalize
122  // function already does this for the main members.
123  for ( auto& alg : branchAlgorithms() ) {
124  if ( alg->sysFinalize().isFailure() ) {
125  error() << "Unable to finalize Algorithm " << alg->name() << endmsg;
126  }
127  }
128  return StatusCode::SUCCESS;
129 }
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:224
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode Sequencer::initialize ( )
override

Initialization of a sequencer.

Typically things like histogram creation, setting up of data structures etc, should be done here. If a sequence has properties specified in the job options file, they will be set to the requested values BEFORE the initialize() method is invoked.

Definition at line 17 of file Sequencer.cpp.

18 {
20 
21  result = decodeMemberNames();
22  if ( result.isFailure() ) {
23  error() << "Unable to configure one or more sequencer members " << endmsg;
24  return result;
25  }
26  result = decodeBranchMemberNames();
27  if ( result.isFailure() ) {
28  error() << "Unable to configure one or more branch members " << endmsg;
29  return result;
30  }
31 
32  // Loop over all sub-algorithms
33  for ( auto& alg : *subAlgorithms() ) {
34  result = alg->sysInitialize();
35  if ( result.isFailure() ) {
36  error() << "Unable to initialize Algorithm " << alg->name() << endmsg;
37  return result;
38  }
39  }
40 
41  // Loop over all branches
42  for ( auto& alg : branchAlgorithms() ) {
43  result = alg->sysInitialize();
44  if ( result.isFailure() ) {
45  error() << "Unable to initialize Algorithm " << alg->name() << endmsg;
46  return result;
47  }
48  }
49 
50  return result;
51 }
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:224
bool isFailure() const
Definition: StatusCode.h:139
StatusCode decodeBranchMemberNames()
Decode branch member name list.
Definition: Sequencer.cpp:234
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode decodeMemberNames()
Decode Member Name list.
Definition: Sequencer.cpp:228
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:783
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
bool Sequencer::isSequence ( ) const
inlinefinaloverride

additional interface methods

Identify as a Sequence

Definition at line 80 of file Sequencer.h.

80 { return true; }
bool Sequencer::isStopOverride ( ) const
virtual

Has the StopOverride mode been set?

Definition at line 199 of file Sequencer.cpp.

199 { return m_stopOverride.value(); }
Gaudi::Property< bool > m_stopOverride
Definition: Sequencer.h:230
Sequencer& Sequencer::operator= ( const Sequencer rhs)
protecteddelete
StatusCode Sequencer::reinitialize ( )
override

Sequencer Reinitialization.

Definition at line 53 of file Sequencer.cpp.

54 {
55  // Bypass the loop if this sequencer is disabled
56  if ( isEnabled() ) {
57 
58  // Loop over all members calling their reinitialize functions
59  // if they are not disabled.
60  for ( auto& alg : *subAlgorithms() ) {
61  if ( alg->isEnabled() ) alg->reinitialize().ignore();
62  }
63  // Loop over all branch members calling their reinitialize functions
64  // if they are not disabled.
65  for ( auto& alg : branchAlgorithms() ) {
66  if ( alg->isEnabled() ) {
67  alg->reinitialize().ignore();
68  }
69  }
70  }
71  return StatusCode::SUCCESS;
72 }
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:224
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:769
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:783
StatusCode Sequencer::remove ( Algorithm pAlgorithm)

Remove the specified algorithm from the sequencer.

Definition at line 216 of file Sequencer.cpp.

216 { return remove( pAlgorithm->name() ); }
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:747
StatusCode Sequencer::remove ( const std::string name)

Definition at line 218 of file Sequencer.cpp.

218 { return remove( algname, *subAlgorithms() ); }
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:783
StatusCode Sequencer::remove ( const std::string algname,
std::vector< Algorithm * > &  theAlgs 
)
protected

Remove the specified algorithm from the sequencer.

Definition at line 424 of file Sequencer.cpp.

425 {
427 
428  // Test that the algorithm exists in the member list
429  for ( auto& alg : theAlgs ) {
430  if ( alg->name() == algname ) {
431 
432  // Algorithm with specified name exists in the algorithm list - remove it
433  // THIS ISN'T IMPLEMENTED YET!!!!
434  info() << "Sequencer::remove( ) isn't implemented yet!!!!!" << endmsg;
435  result = StatusCode::SUCCESS;
436  break;
437  }
438  }
439  return result;
440 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode Sequencer::removeFromBranch ( Algorithm pAlgorithm)

Definition at line 220 of file Sequencer.cpp.

220 { return removeFromBranch( pAlgorithm->name() ); }
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:747
StatusCode removeFromBranch(Algorithm *pAlgorithm)
Definition: Sequencer.cpp:220
StatusCode Sequencer::removeFromBranch ( const std::string name)

Definition at line 222 of file Sequencer.cpp.

222 { return remove( algname, branchAlgorithms() ); }
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:224
void Sequencer::resetExecuted ( )
override

Reset the Sequencer executed state for the current event.

Definition at line 175 of file Sequencer.cpp.

176 {
178 
179  // Loop over all members calling their resetExecuted functions
180  // if they are not disabled.
181  for ( auto& alg : *subAlgorithms() ) alg->resetExecuted();
182 
183  // Loop over all branch members calling their resetExecuted functions
184  // if they are not disabled.
185  for ( auto& alg : branchAlgorithms() ) alg->resetExecuted();
186 
187  // Reset the branch filter passed flag
188  m_branchFilterPassed = false;
189 }
void resetExecuted() override
Reset the executed state of the Algorithm for the duration of the current event.
Definition: Algorithm.cpp:767
bool m_branchFilterPassed
Definition: Sequencer.h:236
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:224
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:783
StatusCode Sequencer::setBranchFilterPassed ( bool  state)
virtual

Set the branch filter passed flag for the last event.

Definition at line 193 of file Sequencer.cpp.

194 {
196  return StatusCode::SUCCESS;
197 }
bool m_branchFilterPassed
Definition: Sequencer.h:236
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
StatusCode Sequencer::start ( )
override

Sequencer finalization.

Definition at line 131 of file Sequencer.cpp.

132 {
134 
135  // Loop over all sub-algorithms
136  for ( auto& alg : *subAlgorithms() ) {
137  result = alg->sysStart();
138  if ( result.isFailure() ) {
139  error() << "Unable to start Algorithm " << alg->name() << endmsg;
140  return result;
141  }
142  }
143 
144  // Loop over all branches
145  for ( auto& alg : branchAlgorithms() ) {
146  result = alg->sysStart();
147  if ( result.isFailure() ) {
148  error() << "Unable to start Algorithm " << alg->name() << endmsg;
149  return result;
150  }
151  }
152 
153  return result;
154 }
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:224
bool isFailure() const
Definition: StatusCode.h:139
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:783
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode Sequencer::stop ( )
override

Sequencer finalization.

Definition at line 156 of file Sequencer.cpp.

157 {
158  // Loop over all branch members calling their finalize functions
159  // if they are not disabled.
160 
161  for ( auto& alg : *subAlgorithms() ) {
162  if ( alg->sysStop().isFailure() ) {
163  error() << "Unable to stop Algorithm " << alg->name() << endmsg;
164  }
165  }
166 
167  for ( auto& alg : branchAlgorithms() ) {
168  if ( alg->sysStop().isFailure() ) {
169  error() << "Unable to stop Algorithm " << alg->name() << endmsg;
170  }
171  }
172  return StatusCode::SUCCESS;
173 }
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:224
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:783
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
std::ostream & Sequencer::toControlFlowExpression ( std::ostream os) const
override

Produce string represention of the control flow expression.

Definition at line 442 of file Sequencer.cpp.

443 {
444  auto& theAlgs = *subAlgorithms();
445  if ( theAlgs.empty() ) return os << "CFTrue";
446 
447  os << "seq(";
448  const auto algs_count = theAlgs.size();
449  const auto op = isStopOverride() ? " >> " : " & ";
450  size_t i = 0;
451  while ( i < algs_count ) {
452  if ( i ) os << op;
453  if ( m_isInverted[i] ) os << "~";
454  theAlgs[i]->toControlFlowExpression( os );
455  ++i;
456  }
457  return os << ")";
458 }
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:199
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:783
std::vector< bool > m_isInverted
Definition: Sequencer.h:232

Member Data Documentation

std::vector<Algorithm*> Sequencer::m_branchAlgs
private

Definition at line 233 of file Sequencer.h.

bool Sequencer::m_branchFilterPassed = false
private

Definition at line 236 of file Sequencer.h.

Gaudi::Property<std::vector<std::string> > Sequencer::m_branchNames
private
Initial value:
{this,
"BranchMembers",
{},
[this]( auto& ) {
if ( this->isInitialized() )
},
"branch member names"}

Definition at line 222 of file Sequencer.h.

std::vector<bool> Sequencer::m_isBranchInverted
private

Definition at line 234 of file Sequencer.h.

std::vector<bool> Sequencer::m_isInverted
private

Definition at line 232 of file Sequencer.h.

Gaudi::Property<std::vector<std::string> > Sequencer::m_names
private
Initial value:
{this,
"Members",
{},
[this]( auto& ) {
if ( this->isInitialized() ) this->decodeMemberNames().ignore();
},
"member names"}

Definition at line 214 of file Sequencer.h.

Gaudi::Property<bool> Sequencer::m_stopOverride {this, "StopOverride", false, "stop on filter failure override"}
private

Definition at line 230 of file Sequencer.h.


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