| The Gaudi Framework v32r1 (f65d50dc)

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
StatusCode | initialize () override
| Initialization of a sequencer. More...
StatusCode | reinitialize () override
| Sequencer Reinitialization. More...
StatusCode | start () override
| Sequencer finalization. More...
StatusCode | execute (const EventContext &ctx) const 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...
bool | branchFilterPassed (const EventContext &ctx) const
| additional interface methods More...
void | setBranchFilterPassed (const EventContext &ctx, bool state) const
| Set the branch filter passed flag for the last event. More...
virtual bool | isStopOverride () const
| Has the StopOverride mode been set? More...
StatusCode | append (Gaudi::Algorithm *pAlgorithm)
| Append an algorithm to the sequencer. More...
StatusCode | appendToBranch (Gaudi::Algorithm *pAlgorithm)
| Append an algorithm to the sequencer branch. More...
StatusCode | createAndAppend (const std::string &type, const std::string &name, Gaudi::Algorithm *&pAlgorithm)
| Create a algorithm and append it to the sequencer. More...
StatusCode | createAndAppendToBranch (const std::string &type, const std::string &name, Gaudi::Algorithm *&pAlgorithm)
| Create a algorithm and append it to the sequencer branch. More...
StatusCode | remove (Gaudi::Algorithm *pAlgorithm)
| Remove the specified algorithm from the sequencer. More...
StatusCode | remove (const std::string &name)
StatusCode | removeFromBranch (Gaudi::Algorithm *pAlgorithm)
StatusCode | removeFromBranch (const std::string &name)
const std::vector< Gaudi::Algorithm * > & | branchAlgorithms () const
| List of branch algorithms. More...
std::vector< Gaudi::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 Gaudi::Sequence
bool | isSequence () const override final
| Are we a Sequence? 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 | start () override
| System start. More...
StatusCode | initialize () override
| Initialization method invoked by the framework. More...
StatusCode | reinitialize () override
| Reinitialization method invoked by the framework. More...
StatusCode | restart () override
| Restart method invoked by the framework. More...
StatusCode | stop () override
| System stop. More...
StatusCode | finalize () override
| System finalization. More...
StatusCode | beginRun () override
| beginRun method invoked by the framework. More...
StatusCode | endRun () override
| endRun method invoked by the framework. More...
void | acceptDHVisitor (IDataHandleVisitor *) const override
| Algorithm (const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
| Constructor. More...
Public Member Functions inherited from Gaudi::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...
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...
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 | 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...
void | acceptDHVisitor (IDataHandleVisitor *) const override
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
AlgExecState & | execState (const EventContext &ctx) const override
| reference to AlgExecState of Alg More...
std::ostream & | toControlFlowExpression (std::ostream &os) const override
| Produce string represention of the control flow expression. More...
Public Member Functions inherited from DataHandleHolderBase< CounterHolder< 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< CounterHolder< 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...
Public Member Functions inherited from CounterHolder< PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > > >
void | declareCounter (const std::string &tag, Gaudi::Accumulators::PrintableCounter &r)
const Gaudi::Accumulators::PrintableCounter * | findCounter (const std::string &tag) const
void | forEachCounter (Callable &&f) const
int | nCounters () const
std::size_t | nOfCountersToBePrinted ()
void | clearCounters ()
Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > >
| PropertyHolder ()=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, 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
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...
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...

## Protected Member Functions
StatusCode | append (Gaudi::Algorithm *pAlgorithm, std::vector< Gaudi::Algorithm * > &theAlgs)
| Append an algorithm to the sequencer. More...
StatusCode | createAndAppend (const std::string &type, const std::string &name, Gaudi::Algorithm *&pAlgorithm, std::vector< Gaudi::Algorithm * > &theAlgs)
| Create a algorithm and append it to the sequencer. More...
StatusCode | decodeNames (Gaudi::Property< std::vector< std::string >> &theNames, std::vector< Gaudi::Algorithm * > &theAlgs, std::vector< bool > &theLogic)
| Decode algorithm names, creating or appending algorithms as appropriate. More...
StatusCode | execute (const EventContext &ctx, const std::vector< Gaudi::Algorithm * > &theAlgs, const std::vector< bool > &theLogic, Gaudi::Algorithm *&lastAlgorithm, std::size_t first=0) const
| Execute the members in the specified list. More...
StatusCode | executeMember (Gaudi::Algorithm *theAlgorithm, const EventContext &context) const
| Execute member algorithm. More...
StatusCode | remove (const std::string &algname, std::vector< Gaudi::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 Gaudi::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...
bool | isReEntrant () const override
Protected Member Functions inherited from DataHandleHolderBase< CounterHolder< 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 > >
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< Gaudi::Algorithm * > | m_branchAlgs
std::vector< bool > | m_isBranchInverted
std::mutex | m_branchFilterMutex
std::map< EventContext::ContextID_t, bool > | m_branchFilterPassed

## Additional Inherited Members
Public Types inherited from Gaudi::Algorithm
typedef Gaudi::PluginService::Factory< IAlgorithm *(const std::string &, ISvcLocator *)> | Factory
Public Types inherited from extends< CounterHolder< 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 Gaudi::Algorithm
friend | AlgorithmManager
Protected Attributes inherited from Gaudi::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< CounterHolder< 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 25 of file Sequencer.h.

## Constructor & Destructor Documentation

## ◆ Sequencer()

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

## Member Function Documentation

## ◆ append() [1/2]

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

Append an algorithm to the sequencer.

Definition at line 152 of file Sequencer.cpp.

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

## ◆ append() [2/2]

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

Append an algorithm to the sequencer.

Protected Member Functions.

Definition at line 196 of file Sequencer.cpp.

196 {
197 // Check that the specified algorithm doesn't already exist in the membership list
198 if ( std::find( std::begin( theAlgs ), std::end( theAlgs ), pAlgorithm ) != std::end( theAlgs ) ) {
199 return StatusCode::FAILURE;
200 }
201 theAlgs.push_back( pAlgorithm );
202 pAlgorithm->addRef();
203 return StatusCode::SUCCESS;
204 }
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
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::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86

## ◆ appendToBranch()

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

Append an algorithm to the sequencer branch.

Definition at line 154 of file Sequencer.cpp.

154 {
155 return append( pAlgorithm, branchAlgorithms() );
156 }
Sequencer::append
StatusCode append(Gaudi::Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:152
Sequencer::branchAlgorithms
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178

## ◆ branchAlgorithms() [1/2]

const std::vector< Gaudi::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 178 of file Sequencer.cpp.

178 { return m_branchAlgs; }
Sequencer::m_branchAlgs
std::vector< Gaudi::Algorithm * > m_branchAlgs
Definition: Sequencer.h:225

## ◆ branchAlgorithms() [2/2]

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

Definition at line 180 of file Sequencer.cpp.

180 { return m_branchAlgs; }
Sequencer::m_branchAlgs
std::vector< Gaudi::Algorithm * > m_branchAlgs
Definition: Sequencer.h:225

## ◆ branchFilterPassed()

bool Sequencer::branchFilterPassed | ( | const EventContext & | ctx | ) | const

additional interface methods

Was the branch filter passed for the last event?

Definition at line 140 of file Sequencer.cpp.

140 {
141 std::lock_guard<std::mutex> _{m_branchFilterMutex};
142 return m_branchFilterPassed[ctx.slot()];
143 }
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:41
Sequencer::m_branchFilterMutex
std::mutex m_branchFilterMutex
Definition: Sequencer.h:228
std::lock_guard
Sequencer::m_branchFilterPassed
std::map< EventContext::ContextID_t, bool > m_branchFilterPassed
Definition: Sequencer.h:229

## ◆ createAndAppend() [1/2]

StatusCode Sequencer::createAndAppend | ( | const std::string & | type,
|  | const std::string & | name,
|  | Gaudi::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 158 of file Sequencer.cpp.

159 {
160 return createAndAppend( type, name, pAlgorithm, *subAlgorithms() );
161 }
Sequencer::createAndAppend
StatusCode createAndAppend(const std::string &type, const std::string &name, Gaudi::Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: Sequencer.cpp:158
Gaudi::Algorithm::type
const std::string & type() const override
The type of the algorithm object.
Definition: Algorithm.h:167
Gaudi::Sequence::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Sequence.cpp:118
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:645

## ◆ createAndAppend() [2/2]

StatusCode Sequencer::createAndAppend | ( | const std::string & | type,
|  | const std::string & | name,
|  | Gaudi::Algorithm *& | pAlgorithm,
|  | std::vector< Gaudi::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 206 of file Sequencer.cpp.

207 {
208 auto theAlgMgr = serviceLocator()->service<IAlgManager>( "ApplicationMgr" );
209 if ( !theAlgMgr ) return StatusCode::FAILURE;
210
211 IAlgorithm* tmp;
212 StatusCode result = theAlgMgr->createAlgorithm( type, algName, tmp );
213 if ( result.isSuccess() ) {
214 try {
215 pAlgorithm = dynamic_cast<Gaudi::Algorithm*>( tmp );
216 theAlgs.push_back( pAlgorithm );
217 } catch ( ... ) {
218 error() << "Unable to create Algorithm " << algName << endmsg;
219 result = StatusCode::FAILURE;
220 }
221 }
222
223 return result;
224 }
IAlgManager
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:27
Gaudi::Algorithm::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Definition: Algorithm.cpp:689
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:76
std::vector::push_back
T push_back(T... args)
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
Gaudi::Algorithm::type
const std::string & type() const override
The type of the algorithm object.
Definition: Algorithm.h:167
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:28
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ createAndAppendToBranch()

StatusCode Sequencer::createAndAppendToBranch | ( | const std::string & | type,
|  | const std::string & | name,
|  | Gaudi::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 163 of file Sequencer.cpp.

164 {
165 return createAndAppend( type, name, pAlgorithm, branchAlgorithms() );
166 }
Sequencer::createAndAppend
StatusCode createAndAppend(const std::string &type, const std::string &name, Gaudi::Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: Sequencer.cpp:158
Gaudi::Algorithm::type
const std::string & type() const override
The type of the algorithm object.
Definition: Algorithm.h:167
Sequencer::branchAlgorithms
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:645

## ◆ decodeBranchMemberNames()

StatusCode Sequencer::decodeBranchMemberNames | ( |  | ) |

Decode branch member name list.

Definition at line 187 of file Sequencer.cpp.

187 {
188 // Decode the branch membership list
189 return decodeNames( m_branchNames, branchAlgorithms(), m_isBranchInverted );
190 }
Sequencer::m_branchNames
Gaudi::Property< std::vector< std::string > > m_branchNames
Definition: Sequencer.h:214
Sequencer::decodeNames
StatusCode decodeNames(Gaudi::Property< std::vector< std::string >> &theNames, std::vector< Gaudi::Algorithm * > &theAlgs, std::vector< bool > &theLogic)
Decode algorithm names, creating or appending algorithms as appropriate.
Definition: Sequencer.cpp:226
Sequencer::branchAlgorithms
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
Sequencer::m_isBranchInverted
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:226

## ◆ decodeMemberNames()

StatusCode Sequencer::decodeMemberNames | ( |  | ) |

Decode Member Name list.

Definition at line 182 of file Sequencer.cpp.

182 {
183 // Decode the membership list
184 return decodeNames( m_names, *subAlgorithms(), m_isInverted );
185 }
Sequencer::decodeNames
StatusCode decodeNames(Gaudi::Property< std::vector< std::string >> &theNames, std::vector< Gaudi::Algorithm * > &theAlgs, std::vector< bool > &theLogic)
Decode algorithm names, creating or appending algorithms as appropriate.
Definition: Sequencer.cpp:226
Sequencer::m_names
Gaudi::Property< std::vector< std::string > > m_names
Definition: Sequencer.h:207
Sequencer::m_isInverted
std::vector< bool > m_isInverted
Definition: Sequencer.h:224
Gaudi::Sequence::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Sequence.cpp:118

## ◆ decodeNames()

StatusCode Sequencer::decodeNames | ( | Gaudi::Property< std::vector< std::string >> & | theNames,
|  | std::vector< Gaudi::Algorithm * > & | theAlgs,
|  | std::vector< bool > & | theLogic
| ) |  |
| protected

Decode algorithm names, creating or appending algorithms as appropriate.

Definition at line 226 of file Sequencer.cpp.

227 {
228 StatusCode result;
229 auto theAlgMgr = serviceLocator()->service<IAlgManager>( "ApplicationMgr" );
230 if ( theAlgMgr ) {
231 // Clear the existing list of algorithms
232 theAlgs.clear();
233
234 // Build the list of member algorithms from the contents of the
235 // theNames list.
236 for ( const auto& n : theNames.value() ) {
237
238 // Parse the name for a syntax of the form:
239 //
240 // <type>/<name>
241 //
242 // Where <name> is the algorithm instance name, and <type> is the
243 // algorithm class type (being a subclass of Algorithm).
244 const Gaudi::Utils::TypeNameString typeName( n );
245 std::string theName = typeName.name();
246 std::string theType = typeName.type();
247
248 // Parse the name for a syntax of the form:
249 //
250 // <name>:invert
251 //
252 // Where <name> is the algorithm instance name and ":invert"
253 // indicates that the filter passed logic is inverted.
254 bool isInverted = false;
255 std::string::size_type invert = theName.find_first_of( ":" );
256 // Skip all occurrences of "::" (allow namespaces)
257 while ( std::string::npos != invert && invert < ( theName.size() - 1 ) && theName[invert + 1] == ':' )
258 invert = theName.find_first_of( ":", invert + 2 );
259 if ( std::string::npos != invert ) {
260 if ( theName == theType ) {
261 // This means that we got something like "Type:invert",
262 // so we have to strip the ":invert" from the type too.
263 theType = theType.substr( 0, invert );
264 }
265 theName = theName.substr( 0, invert );
266 isInverted = true;
267 }
268 // Check whether the supplied name corresponds to an existing
269 // Algorithm object.
270 SmartIF<IAlgorithm>& theIAlg = theAlgMgr->algorithm( theName, false );
271 Gaudi::Algorithm* theAlgorithm = nullptr;
272 StatusCode status = StatusCode::SUCCESS;
273 if ( theIAlg ) {
274 try {
275 theAlgorithm = dynamic_cast<Gaudi::Algorithm*>( theIAlg.get() );
276 } catch ( ... ) {
277 warning() << theName << " is not an Algorithm - Failed dynamic cast" << endmsg;
278 theAlgorithm = nullptr; // release
279 }
280 }
281 if ( theAlgorithm ) {
282
283 // The specified Algorithm already exists - just append it to the membership list.
284 status = append( theAlgorithm, theAlgs );
285 if ( status.isSuccess() ) {
286 ON_DEBUG debug() << theName << " already exists - appended to member list" << endmsg;
287 } else {
288 warning() << theName << " already exists - append failed!!!" << endmsg;
289 result = StatusCode::FAILURE;
290 }
291 } else {
292
293 // The specified name doesn't exist - create a new object of the specified type
294 // and append it to the membership list.
295 status = createAndAppend( theType, theName, theAlgorithm, theAlgs );
296 if ( status.isSuccess() ) {
297 ON_DEBUG debug() << theName << " doesn't exist - created and appended to member list" << endmsg;
298 } else {
299 warning() << theName << " doesn't exist - creation failed!!!" << endmsg;
300 result = StatusCode::FAILURE;
301 }
302 }
303 if ( status.isSuccess() ) theLogic.push_back( isInverted );
304 }
305 }
306 // Print membership list
307 if ( result.isSuccess() && theAlgs.size() != 0 ) {
308 info() << "Member list: ";
309 auto ai = theAlgs.begin();
310 auto li = theLogic.begin();
311 for ( ; ai != theAlgs.end(); ++ai, ++li ) {
312
313 if ( ai != theAlgs.begin() ) info() << ", ";
314 auto alg = *ai;
315 if ( alg->name() == System::typeinfoName( typeid( *alg ) ) )
316 info() << alg->name();
317 else
318 info() << System::typeinfoName( typeid( *alg ) ) << "/" << alg->name();
319
320 if ( *li ) info() << ":invert";
321 }
322 info() << endmsg;
323 }
324 return result;
325 }
Sequencer::createAndAppend
StatusCode createAndAppend(const std::string &type, const std::string &name, Gaudi::Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: Sequencer.cpp:158
SmartIF< IAlgorithm >
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:69
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:101
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
IAlgManager
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:27
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
std::vector::end
T end(T... args)
Gaudi::Algorithm::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Definition: Algorithm.cpp:689
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:104
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
std::string
STL class.
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:210
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:76
Sequencer::append
StatusCode append(Gaudi::Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:152
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:10
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
Gaudi::Property::value
const ValueType & value() const
Backward compatibility (.
Definition: Property.h:526
std::string::find_first_of
T find_first_of(T... args)
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:107
std::vector::clear
T clear(T... args)
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
std::string::size
T size(T... args)
ON_DEBUG
#define ON_DEBUG
Definition: Sequencer.cpp:14
std::vector::begin
T begin(T... args)
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
std::string::substr
T substr(T... args)
GaudiDict::typeName
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:21
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ execute() [1/2]

StatusCode Sequencer::execute | ( | const EventContext & | ctx | ) | const
| override

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

This method is invoked once per event.

Definition at line 60 of file Sequencer.cpp.

60 {
61 StatusCode result = StatusCode::SUCCESS;
62 ON_DEBUG debug() << name() << " Sequencer::execute()" << endmsg;
63
64 auto& state = execState( ctx );
65
66 // Bypass the loop if this sequencer is disabled or has already been executed
67 if ( isEnabled() && !( execState( ctx ).state() == AlgExecState::State::Done ) ) {
68 Gaudi::Algorithm* lastAlgorithm;
69 result = execute( ctx, *subAlgorithms(), m_isInverted, lastAlgorithm );
70 if ( result.isSuccess() ) {
71 const bool passed = state.filterPassed();
72 if ( !passed && !isStopOverride() ) {
73
74 // Filter failed and stop override not set. Execute the
75 // branch if there is one associated with the filter
76 // algorithm that failed. Note that the first member on
77 // the branch is the failing algorithm and so should
78 // be skipped.
79 const auto& theAlgs = branchAlgorithms();
80 if ( !theAlgs.empty() ) {
81 Gaudi::Algorithm* branchAlgorithm = theAlgs[0];
82 if ( lastAlgorithm == branchAlgorithm ) {
83
84 // Branch specified - Loop over branch members
85 result = execute( ctx, branchAlgorithms(), m_isBranchInverted, lastAlgorithm, 1 );
86 if ( result.isSuccess() ) {
87
88 // The final filter passed state will be set true if either
89 // of the main or branches passed, otherwise false.
90
91 // Save the branch filter passed state.
92 setBranchFilterPassed( ctx, state.filterPassed() );
93 }
94 }
95 }
96 }
97 }
98
99 // Prevent multiple executions of this sequencer for the current event
100 state.setState( AlgExecState::State::Done );
101 }
102 return result;
103 }
Sequencer::execute
StatusCode execute(const EventContext &ctx) const override
The actions to be performed by the sequencer on an event.
Definition: Sequencer.cpp:60
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
compareRootHistos.state
def state
Definition: compareRootHistos.py:455
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:107
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
ON_DEBUG
#define ON_DEBUG
Definition: Sequencer.cpp:14
Gaudi::Algorithm::execState
AlgExecState & execState(const EventContext &ctx) const override
reference to AlgExecState of Alg
Definition: Algorithm.cpp:657
Sequencer::m_isInverted
std::vector< bool > m_isInverted
Definition: Sequencer.h:224
Gaudi::Sequence::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Sequence.cpp:118
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
Sequencer::isStopOverride
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:150
Gaudi::Algorithm::isEnabled
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:655
Sequencer::branchAlgorithms
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
Sequencer::setBranchFilterPassed
void setBranchFilterPassed(const EventContext &ctx, bool state) const
Set the branch filter passed flag for the last event.
Definition: Sequencer.cpp:145
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:645
Sequencer::m_isBranchInverted
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:226

## ◆ execute() [2/2]

StatusCode Sequencer::execute | ( | const EventContext & | ctx,
|  | const std::vector< Gaudi::Algorithm * > & | theAlgs,
|  | const std::vector< bool > & | theLogic,
|  | Gaudi::Algorithm *& | lastAlgorithm,
|  | std::size_t | first = `0`
| ) |  | const
| protected

Execute the members in the specified list.

Definition at line 327 of file Sequencer.cpp.

329 {
330 StatusCode result = StatusCode::SUCCESS;
331
332 auto& state = execState( ctx );
333
334 // Reset the branch filter passed flag
335 setBranchFilterPassed( ctx, false );
336
337 // Loop over all algorithms calling their execute functions if they
338 // are (a) not disabled, and (b) aren't already executed. Note that
339 // in the latter case the filter state is still examined. Terminate
340 // the loop if an algorithm indicates that it's filter didn't pass.
341 auto size = theAlgs.size();
342 for ( auto i = first; i < size; i++ ) {
343 lastAlgorithm = theAlgs[i];
344 result = executeMember( lastAlgorithm, ctx );
345 if ( result.isSuccess() ) {
346
347 // Take the filter passed status of this algorithm as my own status.
348 // Note that we take into account inverted logic.
349 bool passed = lastAlgorithm->execState( ctx ).filterPassed();
350 bool isInverted = theLogic[i];
351 if ( isInverted ) passed = !passed;
352 state.setFilterPassed( passed );
353
354 // The behaviour when the filter fails depends on the StopOverride property.
355 // The default action is to stop processing, but this default can be
356 // overridden by setting the "StopOverride" property to true.
357 if ( !isStopOverride() ) {
358 if ( !passed ) break;
359 }
360 } else {
361 break;
362 }
363 }
364 return result;
365 }
details::size
constexpr auto size(const T &, Args &&...) noexcept
Definition: AnyDataWrapper.h:14
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
AlgExecState::filterPassed
bool filterPassed() const
Definition: IAlgExecStateSvc.h:31
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
compareRootHistos.state
def state
Definition: compareRootHistos.py:455
Sequencer::executeMember
StatusCode executeMember(Gaudi::Algorithm *theAlgorithm, const EventContext &context) const
Execute member algorithm.
Definition: Sequencer.cpp:367
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
std::vector::size
T size(T... args)
Gaudi::Algorithm::execState
AlgExecState & execState(const EventContext &ctx) const override
reference to AlgExecState of Alg
Definition: Algorithm.cpp:657
Sequencer::isStopOverride
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:150
Sequencer::setBranchFilterPassed
void setBranchFilterPassed(const EventContext &ctx, bool state) const
Set the branch filter passed flag for the last event.
Definition: Sequencer.cpp:145

## ◆ executeMember()

StatusCode Sequencer::executeMember | ( | Gaudi::Algorithm * | theAlgorithm,
|  | const EventContext & | context
| ) |  | const
| protected

Execute member algorithm.

Definition at line 367 of file Sequencer.cpp.

367 {
368 StatusCode result = StatusCode::SUCCESS;
369 if ( theAlgorithm->isEnabled() ) {
370 if ( theAlgorithm->execState( context ).state() != AlgExecState::State::Done ) {
371 result = theAlgorithm->sysExecute( context );
372 }
373 }
374 return result;
375 }
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
AlgExecState::state
State state() const
Definition: IAlgExecStateSvc.h:32
Gaudi::Algorithm::execState
AlgExecState & execState(const EventContext &ctx) const override
reference to AlgExecState of Alg
Definition: Algorithm.cpp:657
Gaudi::Algorithm::isEnabled
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:655
Gaudi::Algorithm::sysExecute
StatusCode sysExecute(const EventContext &ctx) override
The actions to be performed by the algorithm on an event.
Definition: Algorithm.cpp:438

## ◆ finalize()

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

Sequencer finalization.

Definition at line 105 of file Sequencer.cpp.

105 {
106 // Loop over all branch members calling their finalize functions
107 // if they are not disabled. Note that the Sequence::finalize
108 // function already does this for the main members.
109 for ( auto& alg : branchAlgorithms() ) {
110 if ( alg->sysFinalize().isFailure() ) { error() << "Unable to finalize Algorithm " << alg->name() << endmsg; }
111 }
112 return Sequence::finalize();
113 }
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:69
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
Sequencer::branchAlgorithms
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ initialize()

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.

17 {
18 auto is_good = decodeMemberNames();
19 if ( !is_good ) {
20 error() << "Unable to configure one or more sequencer members " << endmsg;
21 return is_good;
22 }
23
24 is_good = decodeBranchMemberNames();
25 if ( !is_good ) {
26 error() << "Unable to configure one or more branch members " << endmsg;
27 return is_good;
28 }
29
30 // We have to "decode" members before calling base class initialize
31 is_good = Sequence::initialize();
32 if ( !is_good ) return is_good;
33
34 // Loop over all branches
35 // (Sequence does not know about branches)
36 for ( auto& alg : branchAlgorithms() ) {
37 is_good = alg->sysInitialize();
38 if ( is_good.isFailure() ) {
39 error() << "Unable to initialize Algorithm " << alg->name() << endmsg;
40 return is_good;
41 }
42 }
43
44 return is_good;
45 }
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:69
Sequencer::decodeBranchMemberNames
StatusCode decodeBranchMemberNames()
Decode branch member name list.
Definition: Sequencer.cpp:187
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
Sequencer::decodeMemberNames
StatusCode decodeMemberNames()
Decode Member Name list.
Definition: Sequencer.cpp:182
Sequencer::branchAlgorithms
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ isStopOverride()

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

Has the StopOverride mode been set?

Definition at line 150 of file Sequencer.cpp.

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

## ◆ operator=()

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

## ◆ reinitialize()

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

Sequencer Reinitialization.

Definition at line 47 of file Sequencer.cpp.

47 {
48 // Bypass the loop if this sequencer is disabled
49 if ( isEnabled() ) {
50 // Loop over all branch members calling their reinitialize functions
51 // if they are not disabled.
52 for ( auto& alg : branchAlgorithms() ) {
53 if ( alg->isEnabled() ) { alg->reinitialize().ignore(); }
54 }
55 return Sequence::reinitialize();
56 }
57 return StatusCode::SUCCESS;
58 }
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:69
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
Gaudi::Algorithm::isEnabled
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:655
Sequencer::branchAlgorithms
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178

## ◆ remove() [1/3]

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

Remove the specified algorithm from the sequencer.

Definition at line 168 of file Sequencer.cpp.

168 { return remove( pAlgorithm->name() ); }
Sequencer::remove
StatusCode remove(Gaudi::Algorithm *pAlgorithm)
Remove the specified algorithm from the sequencer.
Definition: Sequencer.cpp:168
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:645

## ◆ remove() [2/3]

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

Definition at line 170 of file Sequencer.cpp.

170 { return remove( algname, *subAlgorithms() ); }
Sequencer::remove
StatusCode remove(Gaudi::Algorithm *pAlgorithm)
Remove the specified algorithm from the sequencer.
Definition: Sequencer.cpp:168
Gaudi::Sequence::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Sequence.cpp:118

## ◆ remove() [3/3]

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

Remove the specified algorithm from the sequencer.

Definition at line 377 of file Sequencer.cpp.

377 {
378 StatusCode result = StatusCode::FAILURE;
379
380 // Test that the algorithm exists in the member list
381 for ( auto& alg : theAlgs ) {
382 if ( alg->name() == algname ) {
383
384 // Algorithm with specified name exists in the algorithm list - remove it
385 // THIS ISN'T IMPLEMENTED YET!!!!
386 info() << "Sequencer::remove( ) isn't implemented yet!!!!!" << endmsg;
387 result = StatusCode::SUCCESS;
388 break;
389 }
390 }
391 return result;
392 }
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:69
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:104
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ removeFromBranch() [1/2]

StatusCode Sequencer::removeFromBranch | ( | Gaudi::Algorithm * | pAlgorithm | ) |

Definition at line 172 of file Sequencer.cpp.

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

## ◆ removeFromBranch() [2/2]

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

Definition at line 176 of file Sequencer.cpp.

176 { return remove( algname, branchAlgorithms() ); }
Sequencer::remove
StatusCode remove(Gaudi::Algorithm *pAlgorithm)
Remove the specified algorithm from the sequencer.
Definition: Sequencer.cpp:168
Sequencer::branchAlgorithms
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178

## ◆ setBranchFilterPassed()

void Sequencer::setBranchFilterPassed | ( | const EventContext & | ctx,
|  | bool | state
| ) |  | const

Set the branch filter passed flag for the last event.

Definition at line 145 of file Sequencer.cpp.

145 {
146 std::lock_guard<std::mutex> _{m_branchFilterMutex};
147 m_branchFilterPassed[ctx.slot()] = state;
148 }
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:41
Sequencer::m_branchFilterMutex
std::mutex m_branchFilterMutex
Definition: Sequencer.h:228
compareRootHistos.state
def state
Definition: compareRootHistos.py:455
std::lock_guard
Sequencer::m_branchFilterPassed
std::map< EventContext::ContextID_t, bool > m_branchFilterPassed
Definition: Sequencer.h:229

## ◆ start()

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

Sequencer finalization.

Definition at line 115 of file Sequencer.cpp.

115 {
116 auto is_good = Sequence::start();
117 if ( !is_good ) return is_good;
118
119 // Loop over all branches
120 for ( auto& alg : branchAlgorithms() ) {
121 is_good = alg->sysStart();
122 if ( !is_good ) {
123 error() << "Unable to start Algorithm " << alg->name() << endmsg;
124 return is_good;
125 }
126 }
127
128 return is_good;
129 }
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:69
IOTest.start
def start
Definition: IOTest.py:97
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
Sequencer::branchAlgorithms
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ stop()

StatusCode Sequencer::stop | ( |  | ) |
| override

Sequencer finalization.

Definition at line 131 of file Sequencer.cpp.

131 {
132 // Loop over all branch members calling their finalize functions
133 // if they are not disabled.
134 for ( auto& alg : branchAlgorithms() ) {
135 if ( alg->sysStop().isFailure() ) { error() << "Unable to stop Algorithm " << alg->name() << endmsg; }
136 }
137 return Sequence::stop();
138 }
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:69
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
Sequencer::branchAlgorithms
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ toControlFlowExpression()

std::ostream & Sequencer::toControlFlowExpression | ( | std::ostream & | os | ) | const
| override

Produce string represention of the control flow expression.

Definition at line 394 of file Sequencer.cpp.

394 {
395 auto& theAlgs = *subAlgorithms();
396 if ( theAlgs.empty() ) return os << "CFTrue";
397
398 os << "seq(";
399 const auto algs_count = theAlgs.size();
400 const auto op = isStopOverride() ? " >> " : " & ";
401 size_t i = 0;
402 while ( i < algs_count ) {
403 if ( i ) os << op;
404 if ( m_isInverted[i] ) os << "~";
405 theAlgs[i]->toControlFlowExpression( os );
406 ++i;
407 }
408 return os << ")";
409 }
Sequencer::m_isInverted
std::vector< bool > m_isInverted
Definition: Sequencer.h:224
Gaudi::Sequence::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Sequence.cpp:118
Sequencer::isStopOverride
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:150

## Member Data Documentation

## ◆ m_branchAlgs

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

Definition at line 225 of file Sequencer.h.

## ◆ m_branchFilterMutex

std::mutex Sequencer::m_branchFilterMutex
| mutable private

Definition at line 228 of file Sequencer.h.

## ◆ m_branchFilterPassed

std::map<EventContext::ContextID_t, bool> Sequencer::m_branchFilterPassed
| mutable private

Definition at line 229 of file Sequencer.h.

## ◆ m_branchNames

Gaudi::Property<std::vector<std::string> > Sequencer::m_branchNames
| private

Initial value:
{this,
"BranchMembers",
{},
[this]( auto& ) {
if ( this->isInitialized() )
this->decodeBranchMemberNames().ignore();
},
"branch member names"}

Definition at line 214 of file Sequencer.h.

## ◆ m_isBranchInverted

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

Definition at line 226 of file Sequencer.h.

## ◆ m_isInverted

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

Definition at line 224 of file Sequencer.h.

## ◆ m_names

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 207 of file Sequencer.h.

## ◆ m_stopOverride

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

Definition at line 222 of file Sequencer.h.

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

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