| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Sequencer Class Reference

ClassName: Sequencer. More...

`#include <GaudiAlg/Sequencer.h>`

Inheritance diagram for Sequencer:
[legend]
Collaboration diagram for Sequencer:
[legend]

## Public Member Functions
| Sequencer (const std::string &name, ISvcLocator *svcloc)
| Constructor(s) More...
| ~Sequencer () override=default
| Destructor. More...
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...
StatusCode | beginRun () override
| Sequencer beginRun. More...
StatusCode | endRun () override
| Sequencer endRun. 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::ostream & | toControlFlowExpression (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::string & | name () const override
| The identifying name of the algorithm object. More...
const Gaudi::StringKey & | nameKey () const override
const std::string & | type () const override
| The type of the algorithm object. More...
void | setType (const std::string &type) override
const std::string & | version () 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< IService > | service (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
| 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::PropertyBase * | declareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
template<class T >
Gaudi::Details::PropertyBase * | declareProperty (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 EventContext & | getContext () const override
| get the context More...
virtual void | acceptDHVisitor (IDataHandleVisitor *) const override
void | commitHandles () override
void | registerTool (IAlgTool *tool) const
void | deregisterTool (IAlgTool *tool) const
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::ostream & | toControlFlowExpression (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 > > > >
std::vector< Gaudi::DataHandle * > | inputHandles () const override
std::vector< Gaudi::DataHandle * > | outputHandles () const override
virtual const DataObjIDColl & | extraInputDeps () const override
virtual const DataObjIDColl & | extraOutputDeps () const override
void | declare (Gaudi::DataHandle &handle) override
void | renounce (Gaudi::DataHandle &handle) override
const DataObjIDColl & | inputDataObjs () const override
const DataObjIDColl & | outputDataObjs () const override
void | addDependency (const DataObjID &id, const Gaudi::DataHandle::Mode &mode) 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::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| ~extends () override=default
| Virtual destructor. More...
Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > >
| PropertyHolder ()=default
| ~PropertyHolder () override=default
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Details::PropertyBase &prop)
| Declare a property. More...
Gaudi::Details::PropertyBase * | declareProperty (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::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none") const
Gaudi::Details::PropertyBase * | declareProperty (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::PropertyBase * | declareRemoteProperty (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::PropertyBase & | getProperty (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
PropertyHolder & | operator= (const PropertyHolder &)=delete
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleBase &ref, const std::string &doc="none")
| Specializations for various GaudiHandles. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleArrayBase &ref, const std::string &doc="none")
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, DataObjectHandleBase &ref, const std::string &doc="none")
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
Public Member Functions inherited from extend_interfaces< Interfaces... >
| ~extend_interfaces () override=default
| Virtual destructor. 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
Sequencer & | operator= (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...
Protected Member Functions inherited from DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > > >
void | initDataHandleHolder ()
| initializes all handles - called by the sysInitialize method of any descendant of this More...
Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > >
Gaudi::Details::PropertyBase * | property (const std::string &name) const
Protected Member Functions inherited from CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > >
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...

## Private Attributes
Gaudi::Property< std::vector< std::string > > | m_names {this, "Members", {}, "member names"}
Gaudi::Property< std::vector< std::string > > | m_branchNames {this, "BranchMembers", {}, "branch member names"}
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
typedef Gaudi::PluginService::Factory< IAlgorithm *, const std::string &, ISvcLocator * > | Factory
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...
Protected Attributes inherited from Algorithm
std::unique_ptr< IDataHandleVisitor > | m_updateDataHandles
| Hook for for derived classes to provide a custom visitor for data handles. More...
Protected Attributes inherited from DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > > >
DataObjIDColl | m_inputDataObjs
DataObjIDColl | m_outputDataObjs

## 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 std::string & | name,
|  | ISvcLocator * | svcloc
| ) |  |

Constructor(s)

Definition at line 20 of file Sequencer.cpp.

20 : Algorithm( name, pSvcLocator )
21 {
22 // Associate action handlers with the "Members" and "BranchMembers" properties
23 m_names.declareUpdateHandler( [this]( Gaudi::Details::PropertyBase& ) {
24 if ( isInitialized() ) decodeMemberNames().ignore();
25 } );
26 m_branchNames.declareUpdateHandler( [this]( Gaudi::Details::PropertyBase& ) {
27 if ( isInitialized() ) decodeBranchMemberNames().ignore();
28 } );
29 }
Sequencer::m_branchNames
Gaudi::Property< std::vector< std::string > > m_branchNames
Definition: Sequencer.h:233
Sequencer::decodeBranchMemberNames
StatusCode decodeBranchMemberNames()
Decode branch member name list.
Definition: Sequencer.cpp:327
Sequencer::decodeMemberNames
StatusCode decodeMemberNames()
Decode Member Name list.
Definition: Sequencer.cpp:321
Sequencer::m_names
Gaudi::Property< std::vector< std::string > > m_names
Definition: Sequencer.h:232
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
Algorithm::Algorithm
Algorithm(const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
Constructor.
Definition: Algorithm.cpp:47
Algorithm::isInitialized
bool isInitialized() const override
Has the Algorithm already been initialized?
Definition: Algorithm.h:497

Sequencer::~Sequencer | ( |  | ) |
| override default

Destructor.

Sequencer::Sequencer | ( | const Sequencer & | a | ) |
| protected delete

## Member Function Documentation

StatusCode Sequencer::append | ( | Algorithm * | pAlgorithm | ) |

Append an algorithm to the sequencer.

Definition at line 294 of file Sequencer.cpp.

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

StatusCode Sequencer::append | ( | Algorithm * | pAlgorithm,
|  | std::vector< Algorithm * > & | theAlgs
| ) |  |
| protected

Append an algorithm to the sequencer.

Protected Member Functions.

Definition at line 337 of file Sequencer.cpp.

338 {
339 // Check that the specified algorithm doesn't already exist in the membership list
340 if ( std::find( std::begin( theAlgs ), std::end( theAlgs ), pAlgorithm ) != std::end( theAlgs ) ) {
341 return StatusCode::FAILURE;
342 }
343 theAlgs.push_back( pAlgorithm );
344 pAlgorithm->addRef();
345 return StatusCode::SUCCESS;
346 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
StatusCode::FAILURE
Definition: StatusCode.h:31
std::end
T end(T...args)
std::vector::push_back
T push_back(T...args)
std::find
T find(T...args)
std::begin
T begin(T...args)

StatusCode Sequencer::appendToBranch | ( | Algorithm * | pAlgorithm | ) |

Append an algorithm to the sequencer branch.

Definition at line 296 of file Sequencer.cpp.

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

StatusCode Sequencer::beginRun | ( |  | ) |
| override

Sequencer beginRun.

Definition at line 189 of file Sequencer.cpp.

190 {
191 StatusCode result = StatusCode::SUCCESS;
192
193 // Bypass the loop if this sequencer is disabled
194 if ( isEnabled() ) {
195
196 // Loop over all members calling their sysInitialize functions
197 // if they are not disabled. Note that the Algoriithm::sysInitialize
198 // function protects this from affecting Algorithms that have already
199 // been initialized.
200 for ( auto& alg : *subAlgorithms() ) {
201 result = alg->sysInitialize();
202 if ( result.isFailure() ) {
203 error() << "Unable to initialize Algorithm " << alg->name() << endmsg;
204 break;
205 }
206 result = alg->sysStart();
207 if ( result.isFailure() ) {
208 error() << "Unable to start Algorithm " << alg->name() << endmsg;
209 break;
210 }
211 }
212
213 // Loop over all members calling their beginRun functions
214 // if they are not disabled.
215 for ( auto& alg : *subAlgorithms() ) {
216 if ( !alg->isEnabled() ) {
217 alg->beginRun().ignore();
218 }
219 }
220
221 // Loop over all branch members calling their sysInitialize functions
222 // if they are not disabled. Note that the Algoriithm::sysInitialize
223 // function protects this from affecting Algorithms that have already
224 // been initialized.
225 for ( auto& alg : branchAlgorithms() ) {
226 result = alg->sysInitialize();
227 if ( result.isFailure() ) {
228 error() << "Unable to initialize Algorithm " << alg->name() << endmsg;
229 break;
230 }
231 result = alg->sysStart();
232 if ( result.isFailure() ) {
233 error() << "Unable to start Algorithm " << alg->name() << endmsg;
234 break;
235 }
236 }
237
238 // Loop over all branch members calling their beginRun functions
239 // if they are not disabled.
240 for ( auto& alg : branchAlgorithms() ) {
241 if ( !alg->isEnabled() ) {
242 alg->beginRun().ignore();
243 }
244 }
245 }
246 return StatusCode::SUCCESS;
247 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:317
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:111
Algorithm::isEnabled
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:760
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:776
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

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 317 of file Sequencer.cpp.

317 { return m_branchAlgs; }
Sequencer::m_branchAlgs
std::vector< Algorithm * > m_branchAlgs
Definition: Sequencer.h:237

std::vector< Algorithm * > & Sequencer::branchAlgorithms | ( |  | ) |

Definition at line 319 of file Sequencer.cpp.

319 { return m_branchAlgs; }
Sequencer::m_branchAlgs
std::vector< Algorithm * > m_branchAlgs
Definition: Sequencer.h:237

bool Sequencer::branchFilterPassed | ( |  | ) | const
| virtual

Was the branch filter passed for the last event?

Definition at line 284 of file Sequencer.cpp.

284 { return m_branchFilterPassed; }
Sequencer::m_branchFilterPassed
bool m_branchFilterPassed
Definition: Sequencer.h:240

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 298 of file Sequencer.cpp.

299 {
300 return createAndAppend( type, name, pAlgorithm, *subAlgorithms() );
301 }
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:776
Sequencer::createAndAppend
StatusCode createAndAppend(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: Sequencer.cpp:298

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 348 of file Sequencer.cpp.

350 {
351 auto theAlgMgr = serviceLocator()->service<IAlgManager>( "ApplicationMgr" );
352 if ( !theAlgMgr ) return StatusCode::FAILURE;
353
354 IAlgorithm* tmp;
355 StatusCode result = theAlgMgr->createAlgorithm( type, algName, tmp );
356 if ( result.isSuccess() ) {
357 try {
358 pAlgorithm = dynamic_cast<Algorithm*>( tmp );
359 theAlgs.push_back( pAlgorithm );
360 } catch ( ... ) {
361 error() << "Unable to create Algorithm " << algName << endmsg;
362 result = StatusCode::FAILURE;
363 }
364 }
365
366 return result;
367 }
StatusCode::FAILURE
Definition: StatusCode.h:31
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
IAlgManager
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:27
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79
std::vector::push_back
T push_back(T...args)
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:111
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:28
Algorithm::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Definition: Algorithm.cpp:809
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
endmsg
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 303 of file Sequencer.cpp.

305 {
306 return createAndAppend( type, name, pAlgorithm, branchAlgorithms() );
307 }
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:317
Sequencer::createAndAppend
StatusCode createAndAppend(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: Sequencer.cpp:298

StatusCode Sequencer::decodeBranchMemberNames | ( |  | ) |

Decode branch member name list.

Definition at line 327 of file Sequencer.cpp.

328 {
329 // Decode the branch membership list
330 return decodeNames( m_branchNames, branchAlgorithms(), m_isBranchInverted );
331 }
Sequencer::m_branchNames
Gaudi::Property< std::vector< std::string > > m_branchNames
Definition: Sequencer.h:233
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:317
Sequencer::decodeNames
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:369
Sequencer::m_isBranchInverted
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:238

StatusCode Sequencer::decodeMemberNames | ( |  | ) |

Decode Member Name list.

Definition at line 321 of file Sequencer.cpp.

322 {
323 // Decode the membership list
324 return decodeNames( m_names, *subAlgorithms(), m_isInverted );
325 }
Sequencer::m_names
Gaudi::Property< std::vector< std::string > > m_names
Definition: Sequencer.h:232
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:776
Sequencer::m_isInverted
std::vector< bool > m_isInverted
Definition: Sequencer.h:236
Sequencer::decodeNames
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:369

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 369 of file Sequencer.cpp.

371 {
372 StatusCode result;
373 auto theAlgMgr = serviceLocator()->service<IAlgManager>( "ApplicationMgr" );
374 if ( theAlgMgr ) {
375 // Clear the existing list of algorithms
376 theAlgs.clear();
377
378 // Build the list of member algorithms from the contents of the
379 // theNames list.
380 for ( const auto& n : theNames.value() ) {
381
382 // Parse the name for a syntax of the form:
383 //
384 // <type>/<name>
385 //
386 // Where <name> is the algorithm instance name, and <type> is the
387 // algorithm class type (being a subclass of Algorithm).
388 const Gaudi::Utils::TypeNameString typeName( n );
389 std::string theName = typeName.name();
390 std::string theType = typeName.type();
391
392 // Parse the name for a syntax of the form:
393 //
394 // <name>:invert
395 //
396 // Where <name> is the algorithm instance name and ":invert"
397 // indicates that the filter passed logic is inverted.
398 bool isInverted = false;
399 std::string::size_type invert = theName.find_first_of( ":" );
400 // Skip all occurrences of "::" (allow namespaces)
401 while ( std::string::npos != invert && invert < ( theName.size() - 1 ) && theName[invert + 1] == ':' )
402 invert = theName.find_first_of( ":", invert + 2 );
403 if ( std::string::npos != invert ) {
404 if ( theName == theType ) {
405 // This means that we got something like "Type:invert",
406 // so we have to strip the ":invert" from the type too.
407 theType = theType.substr( 0, invert );
408 }
409 theName = theName.substr( 0, invert );
410 isInverted = true;
411 }
412 // Check whether the supplied name corresponds to an existing
413 // Algorithm object.
414 SmartIF<IAlgorithm>& theIAlg = theAlgMgr->algorithm( theName, false );
415 Algorithm* theAlgorithm = nullptr;
416 StatusCode status = StatusCode::SUCCESS;
417 if ( theIAlg ) {
418 try {
419 theAlgorithm = dynamic_cast<Algorithm*>( theIAlg.get() );
420 } catch ( ... ) {
421 warning() << theName << " is not an Algorithm - Failed dynamic cast" << endmsg;
422 theAlgorithm = nullptr; // release
423 }
424 }
425 if ( theAlgorithm ) {
426
427 // The specified Algorithm already exists - just append it to the membership list.
428 status = append( theAlgorithm, theAlgs );
429 if ( status.isSuccess() ) {
430 ON_DEBUG debug() << theName << " already exists - appended to member list" << endmsg;
431 } else {
432 warning() << theName << " already exists - append failed!!!" << endmsg;
433 result = StatusCode::FAILURE;
434 }
435 } else {
436
437 // The specified name doesn't exist - create a new object of the specified type
438 // and append it to the membership list.
439 status = createAndAppend( theType, theName, theAlgorithm, theAlgs );
440 if ( status.isSuccess() ) {
441 ON_DEBUG debug() << theName << " doesn't exist - created and appended to member list" << endmsg;
442 } else {
443 warning() << theName << " doesn't exist - creation failed!!!" << endmsg;
444 result = StatusCode::FAILURE;
445 }
446 }
447 if ( status.isSuccess() ) theLogic.push_back( isInverted );
448 }
449 }
450 // Print membership list
451 if ( result.isSuccess() && theAlgs.size() != 0 ) {
452 info() << "Member list: ";
453 auto ai = theAlgs.begin();
454 auto li = theLogic.begin();
455 for ( ; ai != theAlgs.end(); ++ai, ++li ) {
456
457 if ( ai != theAlgs.begin() ) info() << ", ";
458 auto alg = *ai;
459 if ( alg->name() == System::typeinfoName( typeid( *alg ) ) )
460 info() << alg->name();
461 else
462 info() << System::typeinfoName( typeid( *alg ) ) << "/" << alg->name();
463
464 if ( *li ) info() << ":invert";
465 }
466 info() << endmsg;
467 }
468 return result;
469 }
Sequencer::append
StatusCode append(Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:294
StatusCode::SUCCESS
Definition: StatusCode.h:31
SmartIF< IAlgorithm >
StatusCode::FAILURE
Definition: StatusCode.h:31
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:117
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:329
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
IAlgManager
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:27
std::vector::end
T end(T...args)
std::string
STL class.
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79
std::vector::push_back
T push_back(T...args)
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:12
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:114
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
std::string::find_first_of
T find_first_of(T...args)
std::vector::clear
T clear(T...args)
Algorithm::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Definition: Algorithm.cpp:809
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
std::string::size
T size(T...args)
ON_DEBUG
#define ON_DEBUG
Definition: Sequencer.cpp:14
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:120
Sequencer::createAndAppend
StatusCode createAndAppend(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: Sequencer.cpp:298
std::vector::begin
T begin(T...args)
std::string::substr
T substr(T...args)
Gaudi::Property::value
const ValueType & value() const
Backward compatibility (.
Definition: Property.h:479
GaudiDict::typeName
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:23
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

StatusCode Sequencer::endRun | ( |  | ) |
| override

Sequencer endRun.

Definition at line 249 of file Sequencer.cpp.

250 {
251 // Bypass the loop if this sequencer is disabled
252 if ( isEnabled() ) {
253
254 // Loop over all members calling their endRun functions
255 // if they are not disabled.
256 for ( auto& alg : *subAlgorithms() ) {
257 if ( !alg->isEnabled() ) alg->endRun().ignore();
258 }
259 // Loop over all branch members calling their endRun functions
260 // if they are not disabled.
261 for ( auto& alg : branchAlgorithms() ) {
262 if ( !alg->isEnabled() ) alg->endRun().ignore();
263 }
264 }
265 return StatusCode::SUCCESS;
266 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:317
Algorithm::isEnabled
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:760
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:776

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 88 of file Sequencer.cpp.

89 {
90 StatusCode result = StatusCode::SUCCESS;
91 ON_DEBUG debug() << name() << " Sequencer::execute( )" << endmsg;
92
93 // Bypass the loop if this sequencer is disabled or has already been executed
94 if ( isEnabled() && !isExecuted() ) {
95 Algorithm* lastAlgorithm;
96 result = execute( *subAlgorithms(), m_isInverted, lastAlgorithm );
97 if ( result.isSuccess() ) {
98 bool passed = filterPassed();
99 if ( !passed && !isStopOverride() ) {
100
101 // Filter failed and stop override not set. Execute the
102 // branch if there is one associated with the filter
103 // algorithm that failed. Note that the first member on
104 // the branch is the failing algorithm and so should
105 // be skipped.
106 const auto& theAlgs = branchAlgorithms();
107 if ( !theAlgs.empty() ) {
108 Algorithm* branchAlgorithm = theAlgs[0];
109 if ( lastAlgorithm == branchAlgorithm ) {
110
111 // Branch specified - Loop over branch members
112 result = execute( branchAlgorithms(), m_isBranchInverted, lastAlgorithm, 1 );
113 if ( result.isSuccess() ) {
114
115 // The final filter passed state will be set true if either
116 // of the main or branches passed, otherwise false.
117
118 // Save the branch filter passed state.
119 setBranchFilterPassed( filterPassed() ).ignore();
120 }
121 }
122 }
123 }
124 }
125
126 // Prevent multiple executions of this sequencer for the current event
127 setExecuted( true );
128 }
129 return result;
130 }
Sequencer::isStopOverride
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:292
StatusCode::SUCCESS
Definition: StatusCode.h:31
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:731
Algorithm::isExecuted
bool isExecuted() const override
Has this algorithm been executed since the last reset?
Definition: Algorithm.cpp:741
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:317
Sequencer::setBranchFilterPassed
virtual StatusCode setBranchFilterPassed(bool state)
Set the branch filter passed flag for the last event.
Definition: Sequencer.cpp:286
Algorithm::isEnabled
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:760
Sequencer::execute
StatusCode execute() override
The actions to be performed by the sequencer on an event.
Definition: Sequencer.cpp:88
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:776
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
ON_DEBUG
#define ON_DEBUG
Definition: Sequencer.cpp:14
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:120
Sequencer::m_isInverted
std::vector< bool > m_isInverted
Definition: Sequencer.h:236
Algorithm::filterPassed
bool filterPassed() const override
Did this algorithm pass or fail its filter criterion for the last event?
Definition: Algorithm.cpp:762
Algorithm::setExecuted
void setExecuted(bool state) const override
Set the executed flag to the specified state.
Definition: Algorithm.cpp:747
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:109
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
Sequencer::m_isBranchInverted
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:238

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 471 of file Sequencer.cpp.

473 {
474 StatusCode result = StatusCode::SUCCESS;
475
476 // Loop over all algorithms calling their execute functions if they
477 // are (a) not disabled, and (b) aren't already executed. Note that
478 // in the latter case the filter state is still examined. Terminate
479 // the loop if an algorithm indicates that it's filter didn't pass.
480 unsigned int size = theAlgs.size();
481 for ( unsigned int i = first; i < size; i++ ) {
482 lastAlgorithm = theAlgs[i];
483 result = executeMember( lastAlgorithm );
484 if ( result.isSuccess() ) {
485
486 // Take the filter passed status of this algorithm as my own status.
487 // Note that we take into account inverted logic.
488 bool passed = lastAlgorithm->filterPassed();
489 bool isInverted = theLogic[i];
490 if ( isInverted ) passed = !passed;
491 setFilterPassed( passed );
492
493 // The behaviour when the filter fails depends on the StopOverride property.
494 // The default action is to stop processing, but this default can be
495 // overridden by setting the "StopOverride" property to true.
496 if ( !isStopOverride() ) {
497 if ( !passed ) break;
498 }
499 } else {
500 break;
501 }
502 }
503 return result;
504 }
Sequencer::isStopOverride
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:292
StatusCode::SUCCESS
Definition: StatusCode.h:31
Algorithm::setFilterPassed
void setFilterPassed(bool state) const override
Set the filter passed flag to the specified state.
Definition: Algorithm.cpp:768
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
Sequencer::executeMember
StatusCode executeMember(Algorithm *theAlgorithm)
Execute member algorithm.
Definition: Sequencer.cpp:506
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
std::vector::size
T size(T...args)
Algorithm::filterPassed
bool filterPassed() const override
Did this algorithm pass or fail its filter criterion for the last event?
Definition: Algorithm.cpp:762

StatusCode Sequencer::executeMember | ( | Algorithm * | theAlgorithm | ) |
| protected

Execute member algorithm.

Definition at line 506 of file Sequencer.cpp.

507 {
508 StatusCode result = StatusCode::SUCCESS;
509 if ( theAlgorithm->isEnabled() ) {
510 if ( !theAlgorithm->isExecuted() ) {
511 result = theAlgorithm->sysExecute( getContext() );
512
513 // Set the executed state of the algorithm.
514 // I think this should be done by the algorithm itself, but just in case...
515 theAlgorithm->setExecuted( true );
516 }
517 }
518 return result;
519 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
Algorithm::isExecuted
bool isExecuted() const override
Has this algorithm been executed since the last reset?
Definition: Algorithm.cpp:741
Algorithm::isEnabled
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:760
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
Algorithm::getContext
const EventContext & getContext() const override
get the context
Definition: Algorithm.h:436
Algorithm::setExecuted
void setExecuted(bool state) const override
Set the executed flag to the specified state.
Definition: Algorithm.cpp:747
Algorithm::sysExecute
StatusCode sysExecute(const EventContext &ctx) override
The actions to be performed by the algorithm on an event.
Definition: Algorithm.cpp:502

StatusCode Sequencer::finalize | ( |  | ) |
| override

Sequencer finalization.

Definition at line 132 of file Sequencer.cpp.

133 {
134 // Loop over all branch members calling their finalize functions
135 // if they are not disabled. Note that the Algorithm::sysFinalize
136 // function already does this for the main members.
137 for ( auto& alg : branchAlgorithms() ) {
138 if ( alg->sysFinalize().isFailure() ) {
139 error() << "Unable to finalize Algorithm " << alg->name() << endmsg;
140 }
141 }
142 return StatusCode::SUCCESS;
143 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:317
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:111
endmsg
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 31 of file Sequencer.cpp.

32 {
33 StatusCode result = StatusCode::SUCCESS;
34
35 result = decodeMemberNames();
36 if ( result.isFailure() ) {
37 error() << "Unable to configure one or more sequencer members " << endmsg;
38 return result;
39 }
40 result = decodeBranchMemberNames();
41 if ( result.isFailure() ) {
42 error() << "Unable to configure one or more branch members " << endmsg;
43 return result;
44 }
45
46 // Loop over all sub-algorithms
47 for ( auto& alg : *subAlgorithms() ) {
48 result = alg->sysInitialize();
49 if ( result.isFailure() ) {
50 error() << "Unable to initialize Algorithm " << alg->name() << endmsg;
51 return result;
52 }
53 }
54
55 // Loop over all branches
56 for ( auto& alg : branchAlgorithms() ) {
57 result = alg->sysInitialize();
58 if ( result.isFailure() ) {
59 error() << "Unable to initialize Algorithm " << alg->name() << endmsg;
60 return result;
61 }
62 }
63
64 return result;
65 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:317
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
Sequencer::decodeBranchMemberNames
StatusCode decodeBranchMemberNames()
Decode branch member name list.
Definition: Sequencer.cpp:327
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:111
Sequencer::decodeMemberNames
StatusCode decodeMemberNames()
Decode Member Name list.
Definition: Sequencer.cpp:321
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:776
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

bool Sequencer::isSequence | ( |  | ) | const
| inline final override

additional interface methods

Identify as a Sequence

Definition at line 98 of file Sequencer.h.

98 { return true; }

bool Sequencer::isStopOverride | ( |  | ) | const
| virtual

Has the StopOverride mode been set?

Definition at line 292 of file Sequencer.cpp.

292 { return m_stopOverride.value(); }
Sequencer::m_stopOverride
Gaudi::Property< bool > m_stopOverride
Definition: Sequencer.h:234

Sequencer& Sequencer::operator= | ( | const Sequencer & | rhs | ) |
| protected delete

StatusCode Sequencer::reinitialize | ( |  | ) |
| override

Sequencer Reinitialization.

Definition at line 67 of file Sequencer.cpp.

68 {
69 // Bypass the loop if this sequencer is disabled
70 if ( isEnabled() ) {
71
72 // Loop over all members calling their reinitialize functions
73 // if they are not disabled.
74 for ( auto& alg : *subAlgorithms() ) {
75 if ( alg->isEnabled() ) alg->reinitialize().ignore();
76 }
77 // Loop over all branch members calling their reinitialize functions
78 // if they are not disabled.
79 for ( auto& alg : branchAlgorithms() ) {
80 if ( alg->isEnabled() ) {
81 alg->reinitialize().ignore();
82 }
83 }
84 }
85 return StatusCode::SUCCESS;
86 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:317
Algorithm::isEnabled
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:760
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:776

StatusCode Sequencer::remove | ( | Algorithm * | pAlgorithm | ) |

Remove the specified algorithm from the sequencer.

Definition at line 309 of file Sequencer.cpp.

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

StatusCode Sequencer::remove | ( | const std::string & | name | ) |

Definition at line 311 of file Sequencer.cpp.

311 { return remove( algname, *subAlgorithms() ); }
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:776

StatusCode Sequencer::remove | ( | const std::string & | algname,
|  | std::vector< Algorithm * > & | theAlgs
| ) |  |
| protected

Remove the specified algorithm from the sequencer.

Definition at line 521 of file Sequencer.cpp.

522 {
523 StatusCode result = StatusCode::FAILURE;
524
525 // Test that the algorithm exists in the member list
526 for ( auto& alg : theAlgs ) {
527 if ( alg->name() == algname ) {
528
529 // Algorithm with specified name exists in the algorithm list - remove it
530 // THIS ISN'T IMPLEMENTED YET!!!!
531 info() << "Sequencer::remove( ) isn't implemented yet!!!!!" << endmsg;
532 result = StatusCode::SUCCESS;
533 break;
534 }
535 }
536 return result;
537 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
StatusCode::FAILURE
Definition: StatusCode.h:31
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:117
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
endmsg
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 313 of file Sequencer.cpp.

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

StatusCode Sequencer::removeFromBranch | ( | const std::string & | name | ) |

Definition at line 315 of file Sequencer.cpp.

315 { return remove( algname, branchAlgorithms() ); }
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:317

void Sequencer::resetExecuted | ( |  | ) |
| override

Reset the Sequencer executed state for the current event.

Definition at line 268 of file Sequencer.cpp.

269 {
270 Algorithm::resetExecuted();
271
272 // Loop over all members calling their resetExecuted functions
273 // if they are not disabled.
274 for ( auto& alg : *subAlgorithms() ) alg->resetExecuted();
275
276 // Loop over all branch members calling their resetExecuted functions
277 // if they are not disabled.
278 for ( auto& alg : branchAlgorithms() ) alg->resetExecuted();
279
280 // Reset the branch filter passed flag
281 m_branchFilterPassed = false;
282 }
Algorithm::resetExecuted
void resetExecuted() override
Reset the executed state of the Algorithm for the duration of the current event.
Definition: Algorithm.cpp:754
Sequencer::m_branchFilterPassed
bool m_branchFilterPassed
Definition: Sequencer.h:240
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:317
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:776

StatusCode Sequencer::setBranchFilterPassed | ( | bool | state | ) |
| virtual

Set the branch filter passed flag for the last event.

Definition at line 286 of file Sequencer.cpp.

287 {
288 m_branchFilterPassed = state;
289 return StatusCode::SUCCESS;
290 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
compareRootHistos.state
state
Definition: compareRootHistos.py:422
Sequencer::m_branchFilterPassed
bool m_branchFilterPassed
Definition: Sequencer.h:240

StatusCode Sequencer::start | ( |  | ) |
| override

Sequencer finalization.

Definition at line 145 of file Sequencer.cpp.

146 {
147 StatusCode result = StatusCode::SUCCESS;
148
149 // Loop over all sub-algorithms
150 for ( auto& alg : *subAlgorithms() ) {
151 result = alg->sysStart();
152 if ( result.isFailure() ) {
153 error() << "Unable to start Algorithm " << alg->name() << endmsg;
154 return result;
155 }
156 }
157
158 // Loop over all branches
159 for ( auto& alg : branchAlgorithms() ) {
160 result = alg->sysStart();
161 if ( result.isFailure() ) {
162 error() << "Unable to start Algorithm " << alg->name() << endmsg;
163 return result;
164 }
165 }
166
167 return result;
168 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:317
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:111
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:776
endmsg
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 170 of file Sequencer.cpp.

171 {
172 // Loop over all branch members calling their finalize functions
173 // if they are not disabled.
174
175 for ( auto& alg : *subAlgorithms() ) {
176 if ( alg->sysStop().isFailure() ) {
177 error() << "Unable to stop Algorithm " << alg->name() << endmsg;
178 }
179 }
180
181 for ( auto& alg : branchAlgorithms() ) {
182 if ( alg->sysStop().isFailure() ) {
183 error() << "Unable to stop Algorithm " << alg->name() << endmsg;
184 }
185 }
186 return StatusCode::SUCCESS;
187 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:317
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:111
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:776
endmsg
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 539 of file Sequencer.cpp.

540 {
541 auto& theAlgs = *subAlgorithms();
542 if ( theAlgs.empty() ) return os << "CFTrue";
543
544 os << "seq(";
545 const auto algs_count = theAlgs.size();
546 const auto op = isStopOverride() ? " >> " : " & ";
547 size_t i = 0;
548 while ( i < algs_count ) {
549 if ( i ) os << op;
550 if ( m_isInverted[i] ) os << "~";
551 theAlgs[i]->toControlFlowExpression( os );
552 ++i;
553 }
554 return os << ")";
555 }
Sequencer::isStopOverride
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:292
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:776
Sequencer::m_isInverted
std::vector< bool > m_isInverted
Definition: Sequencer.h:236

## Member Data Documentation

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

Definition at line 237 of file Sequencer.h.

bool Sequencer::m_branchFilterPassed = false
| private

Definition at line 240 of file Sequencer.h.

Gaudi::Property<std::vector<std::string> > Sequencer::m_branchNames {this, "BranchMembers", {}, "branch member names"}
| private

Definition at line 233 of file Sequencer.h.

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

Definition at line 238 of file Sequencer.h.

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

Definition at line 236 of file Sequencer.h.

Gaudi::Property<std::vector<std::string> > Sequencer::m_names {this, "Members", {}, "member names"}
| private

Definition at line 232 of file Sequencer.h.

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

Definition at line 234 of file Sequencer.h.

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

- GaudiAlg/GaudiAlg/Sequencer.h
- GaudiAlg/src/lib/Sequencer.cpp