Sequencer Class Reference

ClassName: Sequencer. More...

#include <GaudiAlg/Sequencer.h>

Inheritance diagram for Sequencer:
Collaboration diagram for Sequencer:

Public Member Functions

 Sequencer (const std::string &name, ISvcLocator *svcloc)
 Constructor(s) More...
 
 ~Sequencer () override=default
 Destructor. More...
 
StatusCode initialize () override
 Initialization of a sequencer. More...
 
StatusCode reinitialize () override
 Sequencer Reinitialization. More...
 
StatusCode start () override
 Sequencer finalization. More...
 
StatusCode execute () override
 The actions to be performed by the sequencer on an event. More...
 
StatusCode stop () override
 Sequencer finalization. More...
 
StatusCode finalize () override
 Sequencer finalization. More...
 
StatusCode beginRun () override
 Sequencer beginRun. More...
 
StatusCode endRun () override
 Sequencer endRun. More...
 
void resetExecuted () override
 Reset the Sequencer executed state for the current event. More...
 
virtual bool branchFilterPassed () const
 additional interface methods More...
 
virtual StatusCode setBranchFilterPassed (bool state)
 Set the branch filter passed flag for the last event. More...
 
virtual bool isStopOverride () const
 Has the StopOverride mode been set? More...
 
StatusCode append (Algorithm *pAlgorithm)
 Append an algorithm to the sequencer. More...
 
StatusCode appendToBranch (Algorithm *pAlgorithm)
 Append an algorithm to the sequencer branch. More...
 
StatusCode createAndAppend (const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
 Create a algorithm and append it to the sequencer. More...
 
StatusCode createAndAppendToBranch (const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
 Create a algorithm and append it to the sequencer branch. More...
 
StatusCode remove (Algorithm *pAlgorithm)
 Remove the specified algorithm from the sequencer. More...
 
StatusCode remove (const std::string &name)
 
StatusCode removeFromBranch (Algorithm *pAlgorithm)
 
StatusCode removeFromBranch (const std::string &name)
 
const std::vector< Algorithm * > & branchAlgorithms () const
 List of branch algorithms. More...
 
std::vector< Algorithm * > & branchAlgorithms ()
 
StatusCode decodeMemberNames ()
 Decode Member Name list. More...
 
void membershipHandler (Property &theProp)
 "Members" property handler More...
 
StatusCode decodeBranchMemberNames ()
 Decode branch member name list. More...
 
void branchMembershipHandler (Property &theProp)
 "BranchMembers" property handler More...
 
- Public Member Functions inherited from Algorithm
 Algorithm (const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
 Constructor. More...
 
 ~Algorithm () override=default
 Destructor. 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 () override
 The actions to be performed by the algorithm on an event. More...
 
StatusCode sysStop () override
 System stop. More...
 
StatusCode sysFinalize () override
 System finalization. More...
 
StatusCode sysBeginRun () override
 beginRun method invoked by the framework. More...
 
StatusCode sysEndRun () override
 endRun method invoked by the framework. More...
 
const std::stringname () const override
 The identifying name of the algorithm object. More...
 
const Gaudi::StringKeynameKey () const override
 
const std::stringtype () const override
 The type of the algorithm object. More...
 
void setType (const std::string &type) override
 
const std::stringversion () const override
 
unsigned int index () const override
 
StatusCode configure () override
 Dummy implementation of IStateful::configure() method. More...
 
StatusCode terminate () override
 Dummy implementation of IStateful::terminate() method. More...
 
StatusCode initialize () override
 the default (empty) implementation of IStateful::initialize() method More...
 
StatusCode start () override
 the default (empty) implementation of IStateful::start() method More...
 
StatusCode stop () override
 the default (empty) implementation of IStateful::stop() method More...
 
StatusCode finalize () override
 the default (empty) implementation of IStateful::finalize() method More...
 
StatusCode reinitialize () override
 the default (empty) implementation of IStateful::reinitialize() method More...
 
StatusCode restart () override
 the default (empty) implementation of IStateful::restart() method More...
 
Gaudi::StateMachine::State FSMState () const override
 returns the current state of the algorithm More...
 
Gaudi::StateMachine::State targetFSMState () const override
 returns the state the algorithm will be in after the ongoing transition More...
 
bool isExecuted () const override
 Has this algorithm been executed since the last reset? More...
 
void setExecuted (bool state) override
 Set the executed flag to the specified state. More...
 
void resetExecuted () override
 Reset the executed state of the Algorithm for the duration of the current event. More...
 
StatusCode beginRun () override
 Algorithm begin run. More...
 
StatusCode endRun () override
 Algorithm end run. This method is called at the end of the event loop. More...
 
bool isEnabled () const override
 Is this algorithm enabled or disabled? More...
 
bool filterPassed () const override
 Did this algorithm pass or fail its filter criterion for the last event? More...
 
void setFilterPassed (bool state) override
 Set the filter passed flag to the specified state. More...
 
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
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IDataProviderSvc > & detSvc () const
 The standard detector data service. More...
 
SmartIF< IDataProviderSvc > & detDataService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IConversionSvc > & detCnvSvc () const
 The standard detector data persistency conversion service. More...
 
SmartIF< IConversionSvc > & detDataCnvService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IDataProviderSvc > & eventSvc () const
 The standard event data service. More...
 
SmartIF< IDataProviderSvc > & evtSvc () const
 shortcut for method eventSvc More...
 
SmartIF< IDataProviderSvc > & eventDataService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IConversionSvc > & eventCnvSvc () const
 The standard event data persistency conversion service. More...
 
SmartIF< IConversionSvc > & eventDataCnvService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IHistogramSvc > & histoSvc () const
 The standard histogram service. More...
 
SmartIF< IHistogramSvc > & histogramDataService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< INTupleSvc > & ntupleSvc () const
 The standard N tuple service. More...
 
SmartIF< INTupleSvc > & ntupleService () const
 Obsoleted name, kept due to the backwards compatibility. More...
 
SmartIF< IRndmGenSvc > & randSvc () const
 AIDA-based NTuple service Returns a pointer to the AIDATuple 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
 
bool registerContext () const
 register for Algorithm Context Service? More...
 
StatusCode createSubAlgorithm (const std::string &type, const std::string &name, Algorithm *&pSubAlg)
 Create a sub algorithm. More...
 
const std::vector< Algorithm * > * subAlgorithms () const
 List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms. More...
 
std::vector< Algorithm * > * subAlgorithms ()
 List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms. More...
 
StatusCode setProperty (const Property &p) override
 Implementation of IProperty::setProperty. More...
 
StatusCode setProperty (const std::string &s) override
 Implementation of IProperty::setProperty. More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 Implementation of IProperty::setProperty. More...
 
StatusCode getProperty (Property *p) const override
 Implementation of IProperty::getProperty. More...
 
const PropertygetProperty (const std::string &name) const override
 Implementation of IProperty::getProperty. More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 Implementation of IProperty::getProperty. More...
 
const std::vector< Property * > & getProperties () const override
 Implementation of IProperty::getProperties. More...
 
bool hasProperty (const std::string &name) const override
 Implementation of IProperty::hasProperty. More...
 
PropertyMgrgetPropertyMgr ()
 
StatusCode setProperties ()
 Set the algorithm's properties. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none") const
 
template<class T >
PropertydeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none") const
 
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...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
EventContextgetContext () const
 get the context More...
 
void setContext (EventContext *context)
 set the context More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 
virtual const DataObjIDCollextraInputDeps () const override
 
virtual const DataObjIDCollextraOutputDeps () const override
 
virtual void acceptDHVisitor (IDataHandleVisitor *) const override
 
const DataObjIDCollinputDataObjs () const
 
const DataObjIDColloutputDataObjs () const
 
void commitHandles () override
 
void registerTool (IAlgTool *tool) const
 
void deregisterTool (IAlgTool *tool) const
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
 
const std::vector< IAlgTool * > & tools () const
 
bool isClonable () const override
 Specifies the clonability of the algorithm. More...
 
unsigned int cardinality () const override
 Return the cardinality. More...
 
const std::vector< std::string > & neededResources () const override
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
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...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
MSG::Level outputLevel () const __attribute__((deprecated))
 Backward compatibility function for getting the output level. More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 

Protected Member Functions

StatusCode append (Algorithm *pAlgorithm, std::vector< Algorithm * > &theAlgs)
 Append an algorithm to the sequencer. More...
 
StatusCode createAndAppend (const std::string &type, const std::string &name, Algorithm *&pAlgorithm, std::vector< Algorithm * > &theAlgs)
 Create a algorithm and append it to the sequencer. More...
 
StatusCode decodeNames (StringArrayProperty &theNames, std::vector< Algorithm * > &theAlgs, std::vector< bool > &theLogic)
 Decode algorithm names, creating or appending algorithms as appropriate. More...
 
StatusCode execute (const std::vector< Algorithm * > &theAlgs, std::vector< bool > &theLogic, Algorithm *&lastAlgorithm, unsigned int first=0)
 Execute the members in the specified list. More...
 
StatusCode executeMember (Algorithm *theAlgorithm)
 Execute member algorithm. More...
 
StatusCode remove (const std::string &algname, std::vector< Algorithm * > &theAlgs)
 Remove the specified algorithm from the sequencer. More...
 
 Sequencer (const Sequencer &a)=delete
 
Sequenceroperator= (const Sequencer &rhs)=delete
 
- Protected Member Functions inherited from Algorithm
virtual void declareInput (Gaudi::DataHandle *im) override
 
virtual void declareOutput (Gaudi::DataHandle *im) override
 
std::vector< IAlgTool * > & tools ()
 
bool isInitialized () const override
 Has the Algorithm already been initialized? More...
 
bool isFinalized () const override
 Has the Algorithm already been finalized? More...
 
void setIndex (const unsigned int &idx) override
 set instantiation index of Alg More...
 
- Protected Member Functions inherited from CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Private Attributes

StringArrayProperty m_names
 
std::vector< bool > m_isInverted
 
StringArrayProperty m_branchNames
 
std::vector< Algorithm * > m_branchAlgs
 
std::vector< bool > m_isBranchInverted
 
BooleanProperty m_stopOverride
 
bool m_branchFilterPassed = false
 

Additional Inherited Members

- Public Types inherited from Algorithm
typedef Gaudi::PluginService::Factory< IAlgorithm *, const std::string &, ISvcLocator * > Factory
 
- Public Types inherited from CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Protected Attributes inherited from Algorithm
EventContextm_event_context
 Event specific data for multiple event processing. More...
 
SmartIF< PropertyMgrm_propertyMgr
 For management of properties. More...
 
std::unique_ptr< IDataHandleVisitorm_updateDataHandles
 Hook for for derived classes to provide a custom visitor for data handles. More...
 

Detailed Description

ClassName: Sequencer.

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

Definition at line 23 of file Sequencer.h.

Constructor & Destructor Documentation

Sequencer::Sequencer ( const std::string name,
ISvcLocator svcloc 
)

Constructor(s)

Definition at line 20 of file Sequencer.cpp.

21 : Algorithm( name, pSvcLocator )
22 {
23  // Declare Sequencer properties with their defaults
24  declareProperty( "Members", m_names );
25  declareProperty( "BranchMembers", m_branchNames );
26  declareProperty( "StopOverride", m_stopOverride=false );
27 
28  // Associate action handlers with the "Members" and "BranchMembers" properties
31 
32 }
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
Definition: Property.cpp:72
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Algorithm.h:426
void branchMembershipHandler(Property &theProp)
"BranchMembers" property handler
Definition: Sequencer.cpp:410
BooleanProperty m_stopOverride
Definition: Sequencer.h:244
StringArrayProperty m_branchNames
Definition: Sequencer.h:241
Algorithm(const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
Constructor.
Definition: Algorithm.cpp:43
void membershipHandler(Property &theProp)
"Members" property handler
Definition: Sequencer.cpp:395
StringArrayProperty m_names
Definition: Sequencer.h:239
Sequencer::~Sequencer ( )
overridedefault

Destructor.

Sequencer::Sequencer ( const Sequencer a)
protecteddelete

Member Function Documentation

StatusCode Sequencer::append ( Algorithm pAlgorithm)

Append an algorithm to the sequencer.

Definition at line 324 of file Sequencer.cpp.

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

Append an algorithm to the sequencer.

Protected Member Functions.

Definition at line 420 of file Sequencer.cpp.

422 {
423  // Check that the specified algorithm doesn't already exist in the membership list
424  if (std::find(std::begin(theAlgs),std::end(theAlgs),pAlgorithm)!=std::end(theAlgs)) {
425  return StatusCode::FAILURE;
426  }
427  theAlgs.push_back( pAlgorithm );
428  pAlgorithm->addRef();
429  return StatusCode::SUCCESS;
430 }
T end(T...args)
T push_back(T...args)
T find(T...args)
T begin(T...args)
StatusCode Sequencer::appendToBranch ( Algorithm pAlgorithm)

Append an algorithm to the sequencer branch.

Definition at line 330 of file Sequencer.cpp.

331 {
332  return append( pAlgorithm, branchAlgorithms( ) );
333 }
StatusCode append(Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:324
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
StatusCode Sequencer::beginRun ( )
override

Sequencer beginRun.

Definition at line 207 of file Sequencer.cpp.

208 {
210 
211  // Bypass the loop if this sequencer is disabled
212  if ( isEnabled( ) ) {
213 
214  // Loop over all members calling their sysInitialize functions
215  // if they are not disabled. Note that the Algoriithm::sysInitialize
216  // function protects this from affecting Algorithms that have already
217  // been initialized.
218  for (auto& alg : *subAlgorithms() ) {
219  result = alg->sysInitialize( );
220  if( result.isFailure() ) {
221  error() << "Unable to initialize Algorithm " << alg->name() << endmsg;
222  break;
223  }
224  result = alg->sysStart( );
225  if( result.isFailure() ) {
226  error() << "Unable to start Algorithm " << alg->name() << endmsg;
227  break;
228  }
229  }
230 
231  // Loop over all members calling their beginRun functions
232  // if they are not disabled.
233  for (auto& alg : *subAlgorithms() ) {
234  if ( ! alg->isEnabled( ) ) {
235  alg->beginRun( ).ignore();
236  }
237  }
238 
239  // Loop over all branch members calling their sysInitialize functions
240  // if they are not disabled. Note that the Algoriithm::sysInitialize
241  // function protects this from affecting Algorithms that have already
242  // been initialized.
243  for (auto& alg : branchAlgorithms() ) {
244  result = alg->sysInitialize( );
245  if( result.isFailure() ) {
246  error() << "Unable to initialize Algorithm " << alg->name() << endmsg;
247  break;
248  }
249  result = alg->sysStart( );
250  if( result.isFailure() ) {
251  error() << "Unable to start Algorithm " << alg->name() << endmsg;
252  break;
253  }
254  }
255 
256  // Loop over all branch members calling their beginRun functions
257  // if they are not disabled.
258  for (auto& alg : branchAlgorithms()) {
259  if ( ! alg->isEnabled( ) ) {
260  alg->beginRun( ).ignore();
261  }
262  }
263  }
264  return StatusCode::SUCCESS;
265 }
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:853
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
const std::vector< Algorithm * > & Sequencer::branchAlgorithms ( ) const

List of branch algorithms.

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

Definition at line 376 of file Sequencer.cpp.

376  {
377  return m_branchAlgs;
378 }
std::vector< Algorithm * > m_branchAlgs
Definition: Sequencer.h:242
std::vector< Algorithm * > & Sequencer::branchAlgorithms ( )

Definition at line 381 of file Sequencer.cpp.

381  {
382  return m_branchAlgs;
383 }
std::vector< Algorithm * > m_branchAlgs
Definition: Sequencer.h:242
bool Sequencer::branchFilterPassed ( ) const
virtual

additional interface methods

Was the branch filter passed for the last event?

Definition at line 305 of file Sequencer.cpp.

306 {
307  return m_branchFilterPassed;
308 }
bool m_branchFilterPassed
Definition: Sequencer.h:245
void Sequencer::branchMembershipHandler ( Property theProp)

"BranchMembers" property handler

Definition at line 410 of file Sequencer.cpp.

411 {
413 }
StatusCode decodeBranchMemberNames()
Decode branch member name list.
Definition: Sequencer.cpp:401
bool isInitialized() const override
Has the Algorithm already been initialized?
Definition: Algorithm.h:665
StatusCode Sequencer::createAndAppend ( const std::string type,
const std::string name,
Algorithm *&  pAlgorithm 
)

Create a algorithm and append it to the sequencer.

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

Definition at line 336 of file Sequencer.cpp.

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

Create a algorithm and append it to the sequencer.

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

Definition at line 433 of file Sequencer.cpp.

437 {
438  auto theAlgMgr = serviceLocator()->service<IAlgManager>("ApplicationMgr");
439  if ( !theAlgMgr ) return StatusCode::FAILURE;
440 
441  IAlgorithm* tmp;
442  StatusCode result = theAlgMgr->createAlgorithm( type, algName, tmp );
443  if ( result.isSuccess( ) ) {
444  try{
445  pAlgorithm = dynamic_cast<Algorithm*>(tmp);
446  theAlgs.push_back( pAlgorithm );
447  } catch(...){
448  error() << "Unable to create Algorithm " << algName << endmsg;
449  result = StatusCode::FAILURE;
450  }
451  }
452 
453  return result;
454 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Definition: Algorithm.cpp:929
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:78
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:26
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:25
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:74
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode Sequencer::createAndAppendToBranch ( const std::string type,
const std::string name,
Algorithm *&  pAlgorithm 
)

Create a algorithm and append it to the sequencer branch.

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

Definition at line 344 of file Sequencer.cpp.

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

Decode branch member name list.

Definition at line 401 of file Sequencer.cpp.

402 {
403  // Decode the branch membership list
404  return decodeNames( m_branchNames,
405  branchAlgorithms( ),
407 }
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
StringArrayProperty m_branchNames
Definition: Sequencer.h:241
StatusCode decodeNames(StringArrayProperty &theNames, std::vector< Algorithm * > &theAlgs, std::vector< bool > &theLogic)
Decode algorithm names, creating or appending algorithms as appropriate.
Definition: Sequencer.cpp:457
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:243
StatusCode Sequencer::decodeMemberNames ( )

Decode Member Name list.

Definition at line 386 of file Sequencer.cpp.

387 {
388  // Decode the membership list
389  return decodeNames( m_names,
390  *subAlgorithms( ),
391  m_isInverted );
392 }
StatusCode decodeNames(StringArrayProperty &theNames, std::vector< Algorithm * > &theAlgs, std::vector< bool > &theLogic)
Decode algorithm names, creating or appending algorithms as appropriate.
Definition: Sequencer.cpp:457
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
std::vector< bool > m_isInverted
Definition: Sequencer.h:240
StringArrayProperty m_names
Definition: Sequencer.h:239
StatusCode Sequencer::decodeNames ( StringArrayProperty theNames,
std::vector< Algorithm * > &  theAlgs,
std::vector< bool > &  theLogic 
)
protected

Decode algorithm names, creating or appending algorithms as appropriate.

Definition at line 457 of file Sequencer.cpp.

460 {
461  StatusCode result;
462  auto theAlgMgr = serviceLocator()->service<IAlgManager>("ApplicationMgr");
463  if ( theAlgMgr ) {
464  // Clear the existing list of algorithms
465  theAlgs.clear( );
466 
467  // Build the list of member algorithms from the contents of the
468  // theNames list.
469  for (const auto& n : theNames.value() ) {
470 
471  // Parse the name for a syntax of the form:
472  //
473  // <type>/<name>
474  //
475  // Where <name> is the algorithm instance name, and <type> is the
476  // algorithm class type (being a subclass of Algorithm).
478  std::string theName = typeName.name();
479  std::string theType = typeName.type();
480 
481  // Parse the name for a syntax of the form:
482  //
483  // <name>:invert
484  //
485  // Where <name> is the algorithm instance name and ":invert"
486  // indicates that the filter passed logic is inverted.
487  bool isInverted = false;
488  std::string::size_type invert = theName.find_first_of( ":" );
489  // Skip all occurrences of "::" (allow namespaces)
490  while ( std::string::npos != invert
491  && invert < (theName.size() - 1) && theName[invert+1] == ':' )
492  invert = theName.find_first_of( ":", invert+2 );
493  if ( std::string::npos != invert ) {
494  if ( theName == theType ) {
495  // This means that we got something like "Type:invert",
496  // so we have to strip the ":invert" from the type too.
497  theType = theType.substr( 0, invert );
498  }
499  theName = theName.substr( 0, invert );
500  isInverted = true;
501  }
502  // Check whether the supplied name corresponds to an existing
503  // Algorithm object.
504  SmartIF<IAlgorithm>& theIAlg = theAlgMgr->algorithm(theName, false);
505  Algorithm* theAlgorithm = nullptr;
507  if ( theIAlg ) {
508  try{
509  theAlgorithm = dynamic_cast<Algorithm*>(theIAlg.get());
510  } catch(...){
511  warning() << theName << " is not an Algorithm - Failed dynamic cast" << endmsg;
512  theAlgorithm = nullptr; // release
513  }
514  }
515  if ( theAlgorithm ) {
516 
517  // The specified Algorithm already exists - just append it to the membership list.
518  status = append( theAlgorithm, theAlgs );
519  if ( status.isSuccess( ) ) {
520  ON_DEBUG debug() << theName << " already exists - appended to member list" << endmsg;
521  } else {
522  warning() << theName << " already exists - append failed!!!" << endmsg;
523  result = StatusCode::FAILURE;
524  }
525  } else {
526 
527  // The specified name doesn't exist - create a new object of the specified type
528  // and append it to the membership list.
529  status = createAndAppend( theType, theName, theAlgorithm, theAlgs );
530  if ( status.isSuccess( ) ) {
531  ON_DEBUG debug() << theName << " doesn't exist - created and appended to member list" << endmsg;
532  } else {
533  warning() << theName << " doesn't exist - creation failed!!!" << endmsg;
534  result = StatusCode::FAILURE;
535  }
536  }
537  if ( status.isSuccess( ) ) theLogic.push_back( isInverted );
538  }
539 
540  }
541  // Print membership list
542  if ( result.isSuccess() && theAlgs.size() != 0 ) {
543  info() << "Member list: ";
544  auto ai = theAlgs.begin();
545  auto li = theLogic.begin();
546  for ( ; ai != theAlgs.end(); ++ai, ++li ) {
547 
548  if ( ai != theAlgs.begin() ) info() << ", ";
549  auto alg = *ai;
550  if ( alg->name() == System::typeinfoName(typeid(*alg)) )
551  info() << alg->name();
552  else
553  info() << System::typeinfoName(typeid(*alg)) << "/" << alg->name();
554 
555  if (*li) info() << ":invert";
556  }
557  info() << endmsg;
558  }
559  return result;
560 }
StatusCode append(Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:324
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:297
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Definition: Algorithm.cpp:929
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:27
T end(T...args)
STL class.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
T push_back(T...args)
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
T find_first_of(T...args)
T clear(T...args)
const TYPE & value() const
explicit conversion
Definition: Property.h:341
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:74
T size(T...args)
#define ON_DEBUG
Definition: Sequencer.cpp:14
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
StatusCode createAndAppend(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: Sequencer.cpp:336
T begin(T...args)
T substr(T...args)
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:244
StatusCode Sequencer::endRun ( )
override

Sequencer endRun.

Definition at line 268 of file Sequencer.cpp.

269 {
270  // Bypass the loop if this sequencer is disabled
271  if ( isEnabled( ) ) {
272 
273  // Loop over all members calling their endRun functions
274  // if they are not disabled.
275  for (auto& alg : *subAlgorithms()) {
276  if ( ! alg->isEnabled( ) ) alg->endRun( ).ignore();
277  }
278  // Loop over all branch members calling their endRun functions
279  // if they are not disabled.
280  for (auto& alg : branchAlgorithms()) {
281  if ( ! alg->isEnabled( ) ) alg->endRun( ).ignore();
282  }
283  }
284  return StatusCode::SUCCESS;
285 }
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:853
StatusCode Sequencer::execute ( )
override

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

This method is invoked once per event.

Definition at line 96 of file Sequencer.cpp.

97 {
99  ON_DEBUG debug() << name( ) << " Sequencer::execute( )" << endmsg;
100 
101  // Bypass the loop if this sequencer is disabled or has already been executed
102  if ( isEnabled( ) && ! isExecuted( ) ) {
103  Algorithm* lastAlgorithm;
104  result = execute( *subAlgorithms( ), m_isInverted, lastAlgorithm );
105  if ( result.isSuccess( ) ) {
106  bool passed = filterPassed( );
107  if ( ! passed && ! isStopOverride( ) ) {
108 
109  // Filter failed and stop override not set. Execute the
110  // branch if there is one associated with the filter
111  // algorithm that failed. Note that the first member on
112  // the branch is the failing algorithm and so should
113  // be skipped.
114  const auto& theAlgs = branchAlgorithms( );
115  if ( !theAlgs.empty( ) ) {
116  Algorithm* branchAlgorithm = theAlgs[0];
117  if ( lastAlgorithm == branchAlgorithm ) {
118 
119  // Branch specified - Loop over branch members
120  result = execute( branchAlgorithms( ),
122  lastAlgorithm, 1 );
123  if ( result.isSuccess( ) ) {
124 
125  // The final filter passed state will be set true if either
126  // of the main or branches passed, otherwise false.
127 
128  // Save the branch filter passed state.
130  }
131  }
132  }
133  }
134  }
135 
136  // Prevent multiple executions of this sequencer for the current event
137  setExecuted( true );
138  }
139  return result;
140 }
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:318
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
bool filterPassed() const override
Did this algorithm pass or fail its filter criterion for the last event?
Definition: Algorithm.cpp:857
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:820
virtual StatusCode setBranchFilterPassed(bool state)
Set the branch filter passed flag for the last event.
Definition: Sequencer.cpp:311
void setExecuted(bool state) override
Set the executed flag to the specified state.
Definition: Algorithm.cpp:844
StatusCode execute() override
The actions to be performed by the sequencer on an event.
Definition: Sequencer.cpp:96
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
bool isExecuted() const override
Has this algorithm been executed since the last reset?
Definition: Algorithm.cpp:840
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:74
#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:240
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:853
void ignore() const
Definition: StatusCode.h:108
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:243
StatusCode Sequencer::execute ( const std::vector< Algorithm * > &  theAlgs,
std::vector< bool > &  theLogic,
Algorithm *&  lastAlgorithm,
unsigned int  first = 0 
)
protected

Execute the members in the specified list.

Definition at line 563 of file Sequencer.cpp.

567 {
569 
570  // Loop over all algorithms calling their execute functions if they
571  // are (a) not disabled, and (b) aren't already executed. Note that
572  // in the latter case the filter state is still examined. Terminate
573  // the loop if an algorithm indicates that it's filter didn't pass.
574  unsigned int size = theAlgs.size( );
575  for (unsigned int i = first; i < size; i++) {
576  lastAlgorithm = theAlgs[i];
577  result = executeMember( lastAlgorithm );
578  if ( result.isSuccess( ) ) {
579 
580  // Take the filter passed status of this algorithm as my own status.
581  // Note that we take into account inverted logic.
582  bool passed = lastAlgorithm->filterPassed( );
583  bool isInverted = theLogic[i];
584  if ( isInverted ) passed = ! passed;
585  setFilterPassed( passed );
586 
587  // The behaviour when the filter fails depends on the StopOverride property.
588  // The default action is to stop processing, but this default can be
589  // overridden by setting the "StopOverride" property to true.
590  if ( ! isStopOverride( ) ) {
591  if ( ! passed ) break;
592  }
593  } else {
594  break;
595  }
596  }
597  return result;
598 }
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:318
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
bool filterPassed() const override
Did this algorithm pass or fail its filter criterion for the last event?
Definition: Algorithm.cpp:857
StatusCode executeMember(Algorithm *theAlgorithm)
Execute member algorithm.
Definition: Sequencer.cpp:601
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
T size(T...args)
list i
Definition: ana.py:128
void setFilterPassed(bool state) override
Set the filter passed flag to the specified state.
Definition: Algorithm.cpp:861
StatusCode Sequencer::executeMember ( Algorithm theAlgorithm)
protected

Execute member algorithm.

Definition at line 601 of file Sequencer.cpp.

602 {
604  if ( theAlgorithm->isEnabled( ) ) {
605  if ( ! theAlgorithm->isExecuted( ) ) {
606  result = theAlgorithm->sysExecute( );
607 
608  // Set the executed state of the algorithm.
609  // I think this should be done by the algorithm itself, but just in case...
610  theAlgorithm->setExecuted( true );
611  }
612  }
613  return result;
614 }
void setExecuted(bool state) override
Set the executed flag to the specified state.
Definition: Algorithm.cpp:844
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode sysExecute() override
The actions to be performed by the algorithm on an event.
Definition: Algorithm.cpp:567
bool isExecuted() const override
Has this algorithm been executed since the last reset?
Definition: Algorithm.cpp:840
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:853
StatusCode Sequencer::finalize ( )
override

Sequencer finalization.

Definition at line 143 of file Sequencer.cpp.

144 {
145  // Loop over all branch members calling their finalize functions
146  // if they are not disabled. Note that the Algorithm::sysFinalize
147  // function already does this for the main members.
148  for (auto & alg : branchAlgorithms() ) {
149  if (alg->sysFinalize( ).isFailure()) {
150  error() << "Unable to finalize Algorithm "
151  << alg->name() << endmsg;
152  }
153  }
154  return StatusCode::SUCCESS;
155 }
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
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 35 of file Sequencer.cpp.

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

Has the StopOverride mode been set?

Definition at line 318 of file Sequencer.cpp.

319 {
320  return m_stopOverride.value( );
321 }
BooleanProperty m_stopOverride
Definition: Sequencer.h:244
const TYPE & value() const
explicit conversion
Definition: Property.h:341
void Sequencer::membershipHandler ( Property theProp)

"Members" property handler

Definition at line 395 of file Sequencer.cpp.

396 {
397  if ( isInitialized() ) decodeMemberNames();
398 }
StatusCode decodeMemberNames()
Decode Member Name list.
Definition: Sequencer.cpp:386
bool isInitialized() const override
Has the Algorithm already been initialized?
Definition: Algorithm.h:665
Sequencer& Sequencer::operator= ( const Sequencer rhs)
protecteddelete
StatusCode Sequencer::reinitialize ( )
override

Sequencer Reinitialization.

Definition at line 73 of file Sequencer.cpp.

74 {
75  // Bypass the loop if this sequencer is disabled
76  if ( isEnabled( ) ) {
77 
78  // Loop over all members calling their reinitialize functions
79  // if they are not disabled.
80  for (auto& alg : *subAlgorithms() ) {
81  if ( alg->isEnabled( ) ) alg->reinitialize( ).ignore();
82  }
83  // Loop over all branch members calling their reinitialize functions
84  // if they are not disabled.
85  for (auto& alg : branchAlgorithms() ) {
86  if ( alg->isEnabled( ) ) {
87  alg->reinitialize( ).ignore();
88  }
89  }
90 
91  }
92  return StatusCode::SUCCESS;
93 }
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:853
StatusCode Sequencer::remove ( Algorithm pAlgorithm)

Remove the specified algorithm from the sequencer.

Definition at line 352 of file Sequencer.cpp.

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

Definition at line 358 of file Sequencer.cpp.

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

Remove the specified algorithm from the sequencer.

Definition at line 617 of file Sequencer.cpp.

618 {
620 
621  // Test that the algorithm exists in the member list
622  for (auto& alg : theAlgs ) {
623  if ( alg->name( ) == algname ) {
624 
625  // Algorithm with specified name exists in the algorithm list - remove it
626  // THIS ISN'T IMPLEMENTED YET!!!!
627  info() << "Sequencer::remove( ) isn't implemented yet!!!!!" << endmsg;
628  result = StatusCode::SUCCESS;
629  break;
630  }
631  }
632  return result;
633 }
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode Sequencer::removeFromBranch ( Algorithm pAlgorithm)

Definition at line 364 of file Sequencer.cpp.

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

Definition at line 370 of file Sequencer.cpp.

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

Reset the Sequencer executed state for the current event.

Definition at line 288 of file Sequencer.cpp.

289 {
291 
292  // Loop over all members calling their resetExecuted functions
293  // if they are not disabled.
294  for (auto& alg : *subAlgorithms() ) alg->resetExecuted( );
295 
296  // Loop over all branch members calling their resetExecuted functions
297  // if they are not disabled.
298  for (auto& alg : branchAlgorithms() ) alg->resetExecuted( );
299 
300  // Reset the branch filter passed flag
301  m_branchFilterPassed = false;
302 }
void resetExecuted() override
Reset the executed state of the Algorithm for the duration of the current event.
Definition: Algorithm.cpp:848
bool m_branchFilterPassed
Definition: Sequencer.h:245
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
StatusCode Sequencer::setBranchFilterPassed ( bool  state)
virtual

Set the branch filter passed flag for the last event.

Definition at line 311 of file Sequencer.cpp.

312 {
314  return StatusCode::SUCCESS;
315 }
bool m_branchFilterPassed
Definition: Sequencer.h:245
StatusCode Sequencer::start ( )
override

Sequencer finalization.

Definition at line 158 of file Sequencer.cpp.

159 {
161 
162 
163  // Loop over all sub-algorithms
164  for (auto& alg : *subAlgorithms() ) {
165  result = alg->sysStart( );
166  if( result.isFailure() ) {
167  error() << "Unable to start Algorithm " << alg->name() << endmsg;
168  return result;
169  }
170  }
171 
172  // Loop over all branches
173  for (auto& alg : branchAlgorithms() ) {
174  result = alg->sysStart( );
175  if( result.isFailure() ) {
176  error() << "Unable to start Algorithm " << alg->name() << endmsg;
177  return result;
178  }
179  }
180 
181  return result;
182 }
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode Sequencer::stop ( )
override

Sequencer finalization.

Definition at line 185 of file Sequencer.cpp.

186 {
187  // Loop over all branch members calling their finalize functions
188  // if they are not disabled.
189 
190  for (auto& alg : *subAlgorithms() ) {
191  if (alg->sysStop( ).isFailure()) {
192  error() << "Unable to stop Algorithm "
193  << alg->name() << endmsg;
194  }
195  }
196 
197  for (auto& alg : branchAlgorithms() ) {
198  if (alg->sysStop( ).isFailure()) {
199  error() << "Unable to stop Algorithm "
200  << alg->name() << endmsg;
201  }
202  }
203  return StatusCode::SUCCESS;
204 }
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

Member Data Documentation

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

Definition at line 242 of file Sequencer.h.

bool Sequencer::m_branchFilterPassed = false
private

Definition at line 245 of file Sequencer.h.

StringArrayProperty Sequencer::m_branchNames
private

Definition at line 241 of file Sequencer.h.

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

Definition at line 243 of file Sequencer.h.

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

Definition at line 240 of file Sequencer.h.

StringArrayProperty Sequencer::m_names
private

Definition at line 239 of file Sequencer.h.

BooleanProperty Sequencer::m_stopOverride
private

Definition at line 244 of file Sequencer.h.


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