The Gaudi Framework  v31r0 (aeb156f0)
Sequencer Class Reference

ClassName: Sequencer. More...

#include <GaudiAlg/Sequencer.h>

Inheritance diagram for Sequencer:
Collaboration diagram for Sequencer:

Public Member Functions

StatusCode initialize () override
 Initialization of a sequencer. More...
 
StatusCode reinitialize () override
 Sequencer Reinitialization. More...
 
StatusCode start () override
 Sequencer finalization. More...
 
StatusCode execute (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::ostreamtoControlFlowExpression (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
 
- 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::stringname () const override
 The identifying name of the algorithm object. More...
 
const Gaudi::StringKeynameKey () const override
 
const std::stringtype () const override
 The type of the algorithm object. More...
 
void setType (const std::string &type) override
 
const std::stringversion () const override
 
unsigned int index () const override
 
StatusCode configure () override
 Dummy implementation of IStateful::configure() method. More...
 
StatusCode terminate () override
 Dummy implementation of IStateful::terminate() method. More...
 
StatusCode initialize () override
 the default (empty) implementation of IStateful::initialize() method More...
 
StatusCode start () override
 the default (empty) implementation of IStateful::start() method More...
 
StatusCode stop () override
 the default (empty) implementation of IStateful::stop() method More...
 
StatusCode finalize () override
 the default (empty) implementation of IStateful::finalize() method More...
 
StatusCode reinitialize () override
 the default (empty) implementation of IStateful::reinitialize() method More...
 
StatusCode restart () override
 the default (empty) implementation of IStateful::restart() method More...
 
Gaudi::StateMachine::State FSMState () const override
 returns the current state of the algorithm More...
 
Gaudi::StateMachine::State targetFSMState () const override
 returns the state the algorithm will be in after the ongoing transition More...
 
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< IServiceservice (const std::string &name, const bool createIf=true, const bool quiet=false) const
 Return a pointer to the service identified by name (or "type/name") More...
 
template<class T >
SmartIF< T > service (const std::string &name, bool createIf=true, bool quiet=false) const
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
SmartIF< IChronoStatSvc > & chronoSvc () const
 The standard Chrono & Stat service, Return a pointer to the service if present. More...
 
SmartIF< IChronoStatSvc > & chronoStatService () const
 
SmartIF< IDataProviderSvc > & detSvc () const
 The standard detector data service. More...
 
SmartIF< IDataProviderSvc > & detDataService () const
 
SmartIF< IConversionSvc > & detCnvSvc () const
 The standard detector data persistency conversion service. More...
 
SmartIF< IConversionSvc > & detDataCnvService () const
 
SmartIF< IDataProviderSvc > & eventSvc () const
 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::PropertyBasedeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
 
template<class T >
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
 
SmartIF< IMonitorSvc > & monitorSvc () const
 Access the monitor service. More...
 
template<class T >
void declareInfo (const std::string &name, const T &var, const std::string &desc) const
 Declare monitoring information. More...
 
void declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const
 Declare monitoring information (special case) More...
 
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
 
AlgExecStateexecState (const EventContext &ctx) const override
 reference to AlgExecState of Alg More...
 
std::ostreamtoControlFlowExpression (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 DataObjIDCollextraInputDeps () const override
 
virtual const DataObjIDCollextraOutputDeps () const override
 
void declare (Gaudi::DataHandle &handle) override
 
void renounce (Gaudi::DataHandle &handle) override
 
const DataObjIDCollinputDataObjs () const override
 
const DataObjIDColloutputDataObjs () 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::stringgetInterfaceNames () 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::PrintableCounterfindCounter (const std::string &tag) const
 
void forEachCounter (Callable &&f) const
 
int nCounters () const
 
void clearCounters ()
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > >
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation. More...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p) override
 set the property form another property More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 set the property from name and the value More...
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (const std::string &name) const override
 get the property by name More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties More...
 
bool hasProperty (const std::string &name) const override
 Return true if we have a property with the given name. More...
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream) More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
MSG::Level outputLevel () const
 Backward compatibility function for getting the output level. More...
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 

Protected Member Functions

StatusCode append (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
 
Sequenceroperator= (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::PropertyBaseproperty (const std::string &name) const
 
- Protected Member Functions inherited from CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches. More...
 
MSG::Level resetMessaging ()
 Reinitialize internal states. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Private Attributes

Gaudi::Property< std::vector< std::string > > m_names
 
Gaudi::Property< std::vector< std::string > > m_branchNames
 
Gaudi::Property< bool > m_stopOverride {this, "StopOverride", false, "stop on filter failure override"}
 
std::vector< bool > m_isInverted
 
std::vector< 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< IDataHandleVisitorm_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 ( const Sequencer a)
protecteddelete

Member Function Documentation

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() ); }
StatusCode append(Gaudi::Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:152
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Sequence.cpp:118
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 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
T end(T...args)
T push_back(T...args)
T find(T...args)
T begin(T...args)
constexpr static const auto FAILURE
Definition: StatusCode.h:86
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 }
StatusCode append(Gaudi::Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:152
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
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; }
std::vector< Gaudi::Algorithm * > m_branchAlgs
Definition: Sequencer.h:225
std::vector< Gaudi::Algorithm * > & Sequencer::branchAlgorithms ( )

Definition at line 180 of file Sequencer.cpp.

180 { return m_branchAlgs; }
std::vector< Gaudi::Algorithm * > m_branchAlgs
Definition: Sequencer.h:225
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  {
142  return m_branchFilterPassed[ctx.slot()];
143 }
ContextID_t slot() const
Definition: EventContext.h:48
std::mutex m_branchFilterMutex
Definition: Sequencer.h:228
std::map< EventContext::ContextID_t, bool > m_branchFilterPassed
Definition: Sequencer.h:229
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 }
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
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Sequence.cpp:118
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 }
bool isSuccess() const
Definition: StatusCode.h:267
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:27
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:76
T push_back(T...args)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:28
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
constexpr static const auto FAILURE
Definition: StatusCode.h:86
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Definition: Algorithm.cpp:679
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
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 }
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
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
StatusCode Sequencer::decodeBranchMemberNames ( )

Decode branch member name list.

Definition at line 187 of file Sequencer.cpp.

187  {
188  // Decode the branch membership list
190 }
Gaudi::Property< std::vector< std::string > > m_branchNames
Definition: Sequencer.h:214
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
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:226
StatusCode Sequencer::decodeMemberNames ( )

Decode Member Name list.

Definition at line 182 of file Sequencer.cpp.

182  {
183  // Decode the membership list
185 }
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Sequence.cpp:118
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
Gaudi::Property< std::vector< std::string > > m_names
Definition: Sequencer.h:207
std::vector< bool > m_isInverted
Definition: Sequencer.h:224
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).
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;
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 }
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
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:309
bool isSuccess() const
Definition: StatusCode.h:267
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:27
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
T end(T...args)
STL class.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:76
StatusCode append(Gaudi::Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:152
T push_back(T...args)
Helper class to parse a string of format "type/name".
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
T find_first_of(T...args)
T clear(T...args)
T size(T...args)
#define ON_DEBUG
Definition: Sequencer.cpp:14
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
T begin(T...args)
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
constexpr static const auto FAILURE
Definition: StatusCode.h:86
T substr(T...args)
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Definition: Algorithm.cpp:679
const ValueType & value() const
Backward compatibility (.
Definition: Property.h:525
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:21
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
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  {
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 }
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:150
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:645
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:635
void setBranchFilterPassed(const EventContext &ctx, bool state) const
Set the branch filter passed flag for the last event.
Definition: Sequencer.cpp:145
bool isSuccess() const
Definition: StatusCode.h:267
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
AlgExecState & execState(const EventContext &ctx) const override
reference to AlgExecState of Alg
Definition: Algorithm.cpp:647
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Sequence.cpp:118
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
#define ON_DEBUG
Definition: Sequencer.cpp:14
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::vector< bool > m_isInverted
Definition: Sequencer.h:224
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
StatusCode execute(const EventContext &ctx) const override
The actions to be performed by the sequencer on an event.
Definition: Sequencer.cpp:60
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:226
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  {
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 }
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:150
void setBranchFilterPassed(const EventContext &ctx, bool state) const
Set the branch filter passed flag for the last event.
Definition: Sequencer.cpp:145
bool isSuccess() const
Definition: StatusCode.h:267
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
StatusCode executeMember(Gaudi::Algorithm *theAlgorithm, const EventContext &context) const
Execute member algorithm.
Definition: Sequencer.cpp:367
constexpr auto size(const C &c) noexcept(noexcept(c.size())) -> decltype(c.size())
AlgExecState & execState(const EventContext &ctx) const override
reference to AlgExecState of Alg
Definition: Algorithm.cpp:647
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
T size(T...args)
bool filterPassed() const
StatusCode Sequencer::executeMember ( Gaudi::Algorithm theAlgorithm,
const EventContext context 
) const
protected

Execute member algorithm.

Definition at line 367 of file Sequencer.cpp.

367  {
369  if ( theAlgorithm->isEnabled() ) {
370  if ( theAlgorithm->execState( context ).state() != AlgExecState::State::Done ) {
371  result = theAlgorithm->sysExecute( context );
372  }
373  }
374  return result;
375 }
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:645
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
AlgExecState & execState(const EventContext &ctx) const override
reference to AlgExecState of Alg
Definition: Algorithm.cpp:647
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
State state() const
StatusCode sysExecute(const EventContext &ctx) override
The actions to be performed by the algorithm on an event.
Definition: Algorithm.cpp:438
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 }
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
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 }
StatusCode decodeBranchMemberNames()
Decode branch member name list.
Definition: Sequencer.cpp:187
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode decodeMemberNames()
Decode Member Name list.
Definition: Sequencer.cpp:182
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
bool Sequencer::isStopOverride ( ) const
virtual

Has the StopOverride mode been set?

Definition at line 150 of file Sequencer.cpp.

150 { return m_stopOverride.value(); }
Gaudi::Property< bool > m_stopOverride
Definition: Sequencer.h:222
Sequencer& Sequencer::operator= ( const Sequencer rhs)
protecteddelete
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 }
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:645
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
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() ); }
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:635
StatusCode Sequencer::remove ( const std::string name)

Definition at line 170 of file Sequencer.cpp.

170 { return remove( algname, *subAlgorithms() ); }
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Sequence.cpp:118
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  {
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 }
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
constexpr static const auto FAILURE
Definition: StatusCode.h:86
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
StatusCode Sequencer::removeFromBranch ( Gaudi::Algorithm pAlgorithm)

Definition at line 172 of file Sequencer.cpp.

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

Definition at line 176 of file Sequencer.cpp.

176 { return remove( algname, branchAlgorithms() ); }
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
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  {
148 }
ContextID_t slot() const
Definition: EventContext.h:48
std::mutex m_branchFilterMutex
Definition: Sequencer.h:228
std::map< EventContext::ContextID_t, bool > m_branchFilterPassed
Definition: Sequencer.h:229
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 }
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
start
Definition: IOTest.py:97
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
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 }
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:178
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
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 }
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:150
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Sequence.cpp:118
std::vector< bool > m_isInverted
Definition: Sequencer.h:224

Member Data Documentation

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

Definition at line 225 of file Sequencer.h.

std::mutex Sequencer::m_branchFilterMutex
mutableprivate

Definition at line 228 of file Sequencer.h.

std::map<EventContext::ContextID_t, bool> Sequencer::m_branchFilterPassed
mutableprivate

Definition at line 229 of file Sequencer.h.

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

Definition at line 214 of file Sequencer.h.

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

Definition at line 226 of file Sequencer.h.

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

Definition at line 224 of file Sequencer.h.

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

Definition at line 207 of file Sequencer.h.

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: