| The Gaudi Framework v27r1

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

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

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

ClassName: Sequencer. More...

`#include <GaudiAlg/Sequencer.h>`

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

## Public Member Functions
| Sequencer (const std::string &name, ISvcLocator *svcloc)
| Constructor(s) More...
| ~Sequencer () override=default
| Destructor. More...
StatusCode | initialize () override
| Initialization of a sequencer. More...
StatusCode | reinitialize () override
| Sequencer Reinitialization. More...
StatusCode | start () override
| Sequencer finalization. More...
StatusCode | execute () override
| The actions to be performed by the sequencer on an event. More...
StatusCode | stop () override
| Sequencer finalization. More...
StatusCode | finalize () override
| Sequencer finalization. More...
StatusCode | beginRun () override
| Sequencer beginRun. More...
StatusCode | endRun () override
| Sequencer endRun. More...
void | resetExecuted () override
| Reset the Sequencer executed state for the current event. More...
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::string & | name () const override
| The identifying name of the algorithm object. More...
const Gaudi::StringKey & | nameKey () const override
const std::string & | type () const override
| The type of the algorithm object. More...
void | setType (const std::string &type) override
const std::string & | version () const override
unsigned int | index () const override
StatusCode | configure () override
| Dummy implementation of IStateful::configure() method. More...
StatusCode | terminate () override
| Dummy implementation of IStateful::terminate() method. More...
StatusCode | initialize () override
| the default (empty) implementation of IStateful::initialize() method More...
StatusCode | start () override
| the default (empty) implementation of IStateful::start() method More...
StatusCode | stop () override
| the default (empty) implementation of IStateful::stop() method More...
StatusCode | finalize () override
| the default (empty) implementation of IStateful::finalize() method More...
StatusCode | reinitialize () override
| the default (empty) implementation of IStateful::reinitialize() method More...
StatusCode | restart () override
| the default (empty) implementation of IStateful::restart() method More...
Gaudi::StateMachine::State | FSMState () const override
| returns the current state of the algorithm More...
Gaudi::StateMachine::State | targetFSMState () const override
| returns the state the algorithm will be in after the ongoing transition More...
bool | isExecuted () const override
| Has this algorithm been executed since the last reset? More...
void | setExecuted (bool state) 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< IService > | service (const std::string &name, const bool createIf=true, const bool quiet=false) const
| Return a pointer to the service identified by name (or "type/name") More...
template<class T >
SmartIF< T > | service (const std::string &name, bool createIf=true, bool quiet=false) const
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
SmartIF< IChronoStatSvc > & | chronoSvc () const
| The standard Chrono & Stat service, Return a pointer to the service if present. More...
SmartIF< IChronoStatSvc > & | chronoStatService () const
| 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 Property & | getProperty (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...
PropertyMgr * | getPropertyMgr ()
StatusCode | setProperties ()
| Set the algorithm's properties. More...
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property. More...
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties. More...
template<class T >
Property * | declareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none") const
template<class T >
Property * | declareProperty (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...
EventContext * | getContext () 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 DataObjIDColl & | extraInputDeps () const override
virtual const DataObjIDColl & | extraOutputDeps () const override
virtual void | acceptDHVisitor (IDataHandleVisitor *) const override
const DataObjIDColl & | inputDataObjs () const
const DataObjIDColl & | outputDataObjs () 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...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...

## 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
Sequencer & | operator= (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
EventContext * | m_event_context
| Event specific data for multiple event processing. More...
SmartIF< PropertyMgr > | m_propertyMgr
| For management of properties. More...
std::unique_ptr< IDataHandleVisitor > | m_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
29 m_names.declareUpdateHandler ( &Sequencer::membershipHandler , this );
30 m_branchNames.declareUpdateHandler( &Sequencer::branchMembershipHandler, this );
31
32 }
Property::declareUpdateHandler
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
Definition: Property.cpp:72
Algorithm::declareProperty
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Algorithm.h:426
Sequencer::branchMembershipHandler
void branchMembershipHandler(Property &theProp)
"BranchMembers" property handler
Definition: Sequencer.cpp:410
Sequencer::m_stopOverride
BooleanProperty m_stopOverride
Definition: Sequencer.h:244
Sequencer::m_branchNames
StringArrayProperty m_branchNames
Definition: Sequencer.h:241
Algorithm::Algorithm
Algorithm(const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
Constructor.
Definition: Algorithm.cpp:43
Sequencer::membershipHandler
void membershipHandler(Property &theProp)
"Members" property handler
Definition: Sequencer.cpp:395
Sequencer::m_names
StringArrayProperty m_names
Definition: Sequencer.h:239

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

Destructor.

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

## Member Function Documentation

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

Append an algorithm to the sequencer.

Definition at line 324 of file Sequencer.cpp.

325 {
326 return append( pAlgorithm, *subAlgorithms( ) );
327 }
Sequencer::append
StatusCode append(Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:324
Algorithm::subAlgorithms
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 }
std::end
T end(T...args)
std::vector::push_back
T push_back(T...args)
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
std::find
T find(T...args)
std::begin
T begin(T...args)

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

Append an algorithm to the sequencer branch.

Definition at line 330 of file Sequencer.cpp.

331 {
332 return append( pAlgorithm, branchAlgorithms( ) );
333 }
Sequencer::append
StatusCode append(Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:324
Sequencer::branchAlgorithms
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 {
209 StatusCode result = StatusCode::SUCCESS;
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 }
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
Algorithm::isEnabled
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:853
endmsg
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 }
Sequencer::m_branchAlgs
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 }
Sequencer::m_branchAlgs
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 }
Sequencer::m_branchFilterPassed
bool m_branchFilterPassed
Definition: Sequencer.h:245

void Sequencer::branchMembershipHandler | ( | Property & | theProp | ) |

"BranchMembers" property handler

Definition at line 410 of file Sequencer.cpp.

411 {
412 if ( isInitialized() ) decodeBranchMemberNames();
413 }
Sequencer::decodeBranchMemberNames
StatusCode decodeBranchMemberNames()
Decode branch member name list.
Definition: Sequencer.cpp:401
Algorithm::isInitialized
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 }
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
Sequencer::createAndAppend
StatusCode createAndAppend(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: Sequencer.cpp: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 }
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
Algorithm::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Definition: Algorithm.cpp:929
IAlgManager
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:27
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
std::vector::push_back
T push_back(T...args)
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:25
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:74
endmsg
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 }
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
Sequencer::createAndAppend
StatusCode createAndAppend(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: Sequencer.cpp: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( ),
406 m_isBranchInverted );
407 }
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
Sequencer::m_branchNames
StringArrayProperty m_branchNames
Definition: Sequencer.h:241
Sequencer::decodeNames
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
Sequencer::m_isBranchInverted
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 }
Sequencer::decodeNames
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
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
Sequencer::m_isInverted
std::vector< bool > m_isInverted
Definition: Sequencer.h:240
Sequencer::m_names
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).
477 const Gaudi::Utils::TypeNameString typeName(n);
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;
506 StatusCode status = StatusCode::SUCCESS;
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 }
Sequencer::append
StatusCode append(Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:324
SmartIF< IAlgorithm >
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:124
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:297
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
Algorithm::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Definition: Algorithm.cpp:929
IAlgManager
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:27
std::vector::end
T end(T...args)
GaudiPluginService.cpluginsvc.n
list n
Definition: cpluginsvc.py:217
std::string
STL class.
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
std::vector::push_back
T push_back(T...args)
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:121
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::string::find_first_of
T find_first_of(T...args)
std::vector::clear
T clear(T...args)
PropertyWithValue::value
const TYPE & value() const
explicit conversion
Definition: Property.h:341
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:74
std::string::size
T size(T...args)
ON_DEBUG
#define ON_DEBUG
Definition: Sequencer.cpp:14
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:127
Sequencer::createAndAppend
StatusCode createAndAppend(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: Sequencer.cpp:336
std::vector::begin
T begin(T...args)
std::string::substr
T substr(T...args)
GaudiDict::typeName
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:21
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h: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 }
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
StatusCode::SUCCESS
Definition: StatusCode.h:30
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
Algorithm::isEnabled
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 {
98 StatusCode result = StatusCode::SUCCESS;
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( ),
121 m_isBranchInverted,
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.
129 setBranchFilterPassed( filterPassed( ) ).ignore();
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 }
Sequencer::isStopOverride
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:318
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
Algorithm::filterPassed
bool filterPassed() const override
Did this algorithm pass or fail its filter criterion for the last event?
Definition: Algorithm.cpp:857
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:820
Sequencer::setBranchFilterPassed
virtual StatusCode setBranchFilterPassed(bool state)
Set the branch filter passed flag for the last event.
Definition: Sequencer.cpp:311
Algorithm::setExecuted
void setExecuted(bool state) override
Set the executed flag to the specified state.
Definition: Algorithm.cpp:844
Sequencer::execute
StatusCode execute() override
The actions to be performed by the sequencer on an event.
Definition: Sequencer.cpp:96
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Algorithm::isExecuted
bool isExecuted() const override
Has this algorithm been executed since the last reset?
Definition: Algorithm.cpp:840
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:74
ON_DEBUG
#define ON_DEBUG
Definition: Sequencer.cpp:14
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:127
Sequencer::m_isInverted
std::vector< bool > m_isInverted
Definition: Sequencer.h:240
Algorithm::isEnabled
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:853
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:108
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Sequencer::m_isBranchInverted
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 {
568 StatusCode result = StatusCode::SUCCESS;
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 }
Sequencer::isStopOverride
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:318
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
Algorithm::filterPassed
bool filterPassed() const override
Did this algorithm pass or fail its filter criterion for the last event?
Definition: Algorithm.cpp:857
Sequencer::executeMember
StatusCode executeMember(Algorithm *theAlgorithm)
Execute member algorithm.
Definition: Sequencer.cpp:601
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::vector::size
T size(T...args)
ana.i
list i
Definition: ana.py:128
Algorithm::setFilterPassed
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 {
603 StatusCode result = StatusCode::SUCCESS;
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 }
Algorithm::setExecuted
void setExecuted(bool state) override
Set the executed flag to the specified state.
Definition: Algorithm.cpp:844
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Algorithm::sysExecute
StatusCode sysExecute() override
The actions to be performed by the algorithm on an event.
Definition: Algorithm.cpp:567
Algorithm::isExecuted
bool isExecuted() const override
Has this algorithm been executed since the last reset?
Definition: Algorithm.cpp:840
Algorithm::isEnabled
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 }
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
StatusCode::SUCCESS
Definition: StatusCode.h:30
endmsg
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 {
37 StatusCode result = StatusCode::SUCCESS;
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 }
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
Sequencer::decodeBranchMemberNames
StatusCode decodeBranchMemberNames()
Decode branch member name list.
Definition: Sequencer.cpp:401
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
Sequencer::decodeMemberNames
StatusCode decodeMemberNames()
Decode Member Name list.
Definition: Sequencer.cpp:386
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
endmsg
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 }
Sequencer::m_stopOverride
BooleanProperty m_stopOverride
Definition: Sequencer.h:244
PropertyWithValue::value
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 }
Sequencer::decodeMemberNames
StatusCode decodeMemberNames()
Decode Member Name list.
Definition: Sequencer.cpp:386
Algorithm::isInitialized
bool isInitialized() const override
Has the Algorithm already been initialized?
Definition: Algorithm.h:665

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

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 }
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
StatusCode::SUCCESS
Definition: StatusCode.h:30
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
Algorithm::isEnabled
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 }
Algorithm::name
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 }
Algorithm::subAlgorithms
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 {
619 StatusCode result = StatusCode::FAILURE;
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 }
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:124
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
endmsg
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 }
Sequencer::removeFromBranch
StatusCode removeFromBranch(Algorithm *pAlgorithm)
Definition: Sequencer.cpp:364
Algorithm::name
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 }
Sequencer::branchAlgorithms
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 {
290 Algorithm::resetExecuted( );
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 }
Algorithm::resetExecuted
void resetExecuted() override
Reset the executed state of the Algorithm for the duration of the current event.
Definition: Algorithm.cpp:848
Sequencer::m_branchFilterPassed
bool m_branchFilterPassed
Definition: Sequencer.h:245
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
Algorithm::subAlgorithms
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 {
313 m_branchFilterPassed = state;
314 return StatusCode::SUCCESS;
315 }
compareRootHistos.state
tuple state
Definition: compareRootHistos.py:348
Sequencer::m_branchFilterPassed
bool m_branchFilterPassed
Definition: Sequencer.h:245
StatusCode::SUCCESS
Definition: StatusCode.h:30

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

Sequencer finalization.

Definition at line 158 of file Sequencer.cpp.

159 {
160 StatusCode result = StatusCode::SUCCESS;
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 }
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
endmsg
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 }
Sequencer::branchAlgorithms
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:376
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
StatusCode::SUCCESS
Definition: StatusCode.h:30
Algorithm::subAlgorithms
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:865
endmsg
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:

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