All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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...
 
virtual ~Sequencer ()
 Destructor. More...
 
virtual StatusCode initialize ()
 Initialization of a sequencer. More...
 
virtual StatusCode reinitialize ()
 Sequencer Reinitialization. More...
 
virtual StatusCode start ()
 Sequencer finalization. More...
 
virtual StatusCode execute ()
 The actions to be performed by the sequencer on an event. More...
 
virtual StatusCode stop ()
 Sequencer finalization. More...
 
virtual StatusCode finalize ()
 Sequencer finalization. More...
 
virtual StatusCode beginRun ()
 Sequencer beginRun. More...
 
virtual StatusCode endRun ()
 Sequencer endRun. More...
 
void resetExecuted ()
 Reset the Sequencer executed state for the current event. More...
 
virtual bool branchFilterPassed () const
 Was the branch filter passed for the last event? More...
 
virtual StatusCode setBranchFilterPassed (bool state)
 Set the branch filter passed flag for the last event. More...
 
virtual bool isStopOverride () const
 Has the StopOverride mode been set? More...
 
StatusCode append (Algorithm *pAlgorithm)
 Append an algorithm to the sequencer. More...
 
StatusCode appendToBranch (Algorithm *pAlgorithm)
 Append an algorithm to the sequencer branch. More...
 
StatusCode createAndAppend (const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
 Create a algorithm and append it to the sequencer. More...
 
StatusCode createAndAppendToBranch (const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
 Create a algorithm and append it to the sequencer branch. More...
 
StatusCode remove (Algorithm *pAlgorithm)
 Remove the specified algorithm from the sequencer. More...
 
StatusCode remove (const std::string &name)
 
StatusCode removeFromBranch (Algorithm *pAlgorithm)
 
StatusCode removeFromBranch (const std::string &name)
 
std::vector< Algorithm * > * branchAlgorithms () const
 List of branch algorithms. More...
 
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...
 
virtual ~Algorithm ()
 Destructor. More...
 
virtual StatusCode sysStart ()
 Reinitialization method invoked by the framework. More...
 
virtual StatusCode sysInitialize ()
 Initialization method invoked by the framework. More...
 
virtual StatusCode sysReinitialize ()
 Reinitialization method invoked by the framework. More...
 
virtual StatusCode sysRestart ()
 Restart method invoked by the framework. More...
 
virtual StatusCode sysExecute ()
 The actions to be performed by the algorithm on an event. More...
 
virtual StatusCode sysStop ()
 System stop. More...
 
virtual StatusCode sysFinalize ()
 System finalization. More...
 
virtual StatusCode sysBeginRun ()
 beginRun method invoked by the framework. More...
 
virtual StatusCode sysEndRun ()
 endRun method invoked by the framework. More...
 
virtual const std::string & name () const
 The identifying name of the algorithm object. More...
 
virtual const std::string & version () const
 The version of the algorithm. More...
 
virtual StatusCode configure ()
 Dummy implementation of IStateful::configure() method. More...
 
virtual StatusCode terminate ()
 Dummy implementation of IStateful::terminate() method. More...
 
virtual StatusCode restart ()
 the default (empty) implementation of IStateful::restart() method More...
 
virtual bool isExecuted () const
 Has this algorithm been executed since the last reset? More...
 
virtual void setExecuted (bool state)
 Set the executed flag to the specified state. More...
 
virtual Gaudi::StateMachine::State FSMState () const
 returns the current state of the algorithm More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 returns the state the algorithm will be in after the ongoing transition More...
 
virtual bool isEnabled () const
 Is this algorithm enabled or disabled? More...
 
virtual bool filterPassed () const
 Did this algorithm pass or fail its filter criterion for the last event? More...
 
virtual void setFilterPassed (bool state)
 Set the filter passed flag to the specified state. 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...
 
void setOutputLevel (int level)
 Set the output level for current algorithm. More...
 
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< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
SmartIF< IMessageSvc > & messageService () 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< ISvcLocator > & serviceLocator () const
 The standard service locator. More...
 
SmartIF< ISvcLocator > & svcLoc () const
 shortcut for method serviceLocator More...
 
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...
 
std::vector< Algorithm * > * subAlgorithms () const
 List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms. More...
 
virtual StatusCode setProperty (const Property &p)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode setProperty (const std::string &s)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode getProperty (Property *p) const
 Implementation of IProperty::getProperty. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Implementation of IProperty::getProperty. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Implementation of IProperty::getProperty. More...
 
virtual const std::vector
< Property * > & 
getProperties () const
 Implementation of IProperty::getProperties. More...
 
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...
 
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...
 
- Public Member Functions inherited from extend_interfaces3< IAlgorithm, IProperty, IStateful >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IAlgorithm
 DeclareInterfaceID (IAlgorithm, 4, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from INamedInterface
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
- Public Member Functions inherited from IInterface
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 

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 (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...
 
- Protected Member Functions inherited from Algorithm
bool isInitialized () const
 Has the Algorithm already been initialized? More...
 
bool isFinalized () const
 Has the Algorithm already been finalized? More...
 
int outputLevel () const
 retrieve the Algorithm output level More...
 
IntegerPropertyoutputLevelProperty ()
 Accessor for the Message level property. More...
 
void initOutputLevel (Property &prop)
 callback for output level property More...
 

Private Member Functions

 Sequencer (const Sequencer &a)
 Private Copy constructor: NO COPY ALLOWED. More...
 
Sequenceroperator= (const Sequencer &rhs)
 Private assignment operator: NO ASSIGNMENT ALLOWED. 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
 

Additional Inherited Members

- Public Types inherited from Algorithm
typedef
Gaudi::PluginService::Factory
< IAlgorithm *, const
std::string &, ISvcLocator * > 
Factory
 
- Public Types inherited from implements3< IAlgorithm, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3
< IAlgorithm, IProperty,
IStateful
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces3< IAlgorithm, IProperty, IStateful >
typedef mpl::fold< typename
IAlgorithm::iid::iids::type,
typename mpl::fold< typename
IProperty::iid::iids::type,
typename
IStateful::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type, mpl::insert< mpl::_1,
mpl::_2 > >::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...
 
typedef Gaudi::InterfaceId
< IInterface, 0, 0 > 
iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. 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 24 of file Sequencer.h.

Constructor & Destructor Documentation

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

Constructor(s)

Definition at line 21 of file Sequencer.cpp.

22 : Algorithm( name, pSvcLocator ),
23  m_branchFilterPassed( false )
24 {
25 
26  // Create vector of branch algorithms
27  m_branchAlgs = new std::vector<Algorithm*>();
28 
29  // Declare Sequencer properties with their defaults
30  declareProperty( "Members", m_names );
31  declareProperty( "BranchMembers", m_branchNames );
32  declareProperty( "StopOverride", m_stopOverride=false );
33 
34  // Associate action handlers with the "Members" and "BranchMembers" properties
37 
38 }
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Algorithm.h:397
void branchMembershipHandler(Property &theProp)
"BranchMembers" property handler
Definition: Sequencer.cpp:516
bool m_branchFilterPassed
Definition: Sequencer.h:250
BooleanProperty m_stopOverride
Definition: Sequencer.h:249
StringArrayProperty m_branchNames
Definition: Sequencer.h:246
virtual void declareUpdateHandler(PropertyCallbackFunctor *pf)
set new callback for update
Definition: Property.cpp:141
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
Algorithm(const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
Constructor.
Definition: Algorithm.cpp:28
std::vector< Algorithm * > * m_branchAlgs
Definition: Sequencer.h:247
void membershipHandler(Property &theProp)
"Members" property handler
Definition: Sequencer.cpp:497
StringArrayProperty m_names
Definition: Sequencer.h:244
Sequencer::~Sequencer ( )
virtual

Destructor.

Definition at line 43 of file Sequencer.cpp.

44 {
45  delete m_branchAlgs;
46 }
std::vector< Algorithm * > * m_branchAlgs
Definition: Sequencer.h:247
Sequencer::Sequencer ( const Sequencer a)
private

Private Copy constructor: NO COPY ALLOWED.

Member Function Documentation

StatusCode Sequencer::append ( Algorithm pAlgorithm)

Append an algorithm to the sequencer.

Definition at line 417 of file Sequencer.cpp.

418 {
419  StatusCode result = append( pAlgorithm, subAlgorithms( ) );
420  return result;
421 }
std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:870
StatusCode append(Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:417
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StatusCode Sequencer::append ( Algorithm pAlgorithm,
std::vector< Algorithm * > *  theAlgs 
)
protected

Append an algorithm to the sequencer.

Protected Member Functions.

Definition at line 526 of file Sequencer.cpp.

528 {
530  // Check that the specified algorithm doesn't already exist in the membership list
531  std::vector<Algorithm*>::iterator it;
532  std::vector<Algorithm*>::iterator itend = theAlgs->end( );
533  for (it = theAlgs->begin(); it != itend; it++) {
534  Algorithm* theAlgorithm = (*it);
535  if ( theAlgorithm == pAlgorithm ) {
536  result = StatusCode::FAILURE;
537  break;
538  }
539  }
540  if ( result.isSuccess( ) ) {
541  theAlgs->push_back( pAlgorithm );
542  pAlgorithm->addRef();
543  }
544  return result;
545 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
StatusCode Sequencer::appendToBranch ( Algorithm pAlgorithm)

Append an algorithm to the sequencer branch.

Definition at line 424 of file Sequencer.cpp.

425 {
426  StatusCode result = append( pAlgorithm, branchAlgorithms( ) );
427  return result;
428 }
StatusCode append(Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:417
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
std::vector< Algorithm * > * branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:479
StatusCode Sequencer::beginRun ( )
virtual

Sequencer beginRun.

Reimplemented from Algorithm.

Definition at line 268 of file Sequencer.cpp.

269 {
271  MsgStream log( msgSvc( ), name( ) );
272 
273  // Bypass the loop if this sequencer is disabled
274  if ( isEnabled( ) ) {
275 
276  // Loop over all members calling their sysInitialize functions
277  // if they are not disabled. Note that the Algoriithm::sysInitialize
278  // function protects this from affecting Algorithms that have already
279  // been initialized.
280  std::vector<Algorithm*>* theAlgs = subAlgorithms( );
281  std::vector<Algorithm*>::iterator it;
282  std::vector<Algorithm*>::iterator itend = theAlgs->end( );
283  for (it = theAlgs->begin(); it != itend; it++) {
284  Algorithm* theAlgorithm = (*it);
285  result = theAlgorithm->sysInitialize( );
286  if( result.isFailure() ) {
287  log << MSG::ERROR << "Unable to initialize Algorithm " << theAlgorithm->name() << endmsg;
288  break;
289  }
290  result = theAlgorithm->sysStart( );
291  if( result.isFailure() ) {
292  log << MSG::ERROR << "Unable to start Algorithm " << theAlgorithm->name() << endmsg;
293  break;
294  }
295  }
296 
297  // Loop over all members calling their beginRun functions
298  // if they are not disabled.
299  for (it = theAlgs->begin(); it != itend; it++) {
300  Algorithm* theAlgorithm = (*it);
301  if ( ! theAlgorithm->isEnabled( ) ) {
302  theAlgorithm->beginRun( ).ignore();
303  }
304  }
305 
306  // Loop over all branch members calling their sysInitialize functions
307  // if they are not disabled. Note that the Algoriithm::sysInitialize
308  // function protects this from affecting Algorithms that have already
309  // been initialized.
310  theAlgs = branchAlgorithms( );
311  itend = theAlgs->end( );
312  for (it = theAlgs->begin(); it != itend; it++) {
313  Algorithm* theAlgorithm = (*it);
314  result = theAlgorithm->sysInitialize( );
315  if( result.isFailure() ) {
316  log << MSG::ERROR << "Unable to initialize Algorithm " << theAlgorithm->name() << endmsg;
317  break;
318  }
319  result = theAlgorithm->sysStart( );
320  if( result.isFailure() ) {
321  log << MSG::ERROR << "Unable to start Algorithm " << theAlgorithm->name() << endmsg;
322  break;
323  }
324  }
325 
326  // Loop over all branch members calling their beginRun functions
327  // if they are not disabled.
328  for (it = theAlgs->begin(); it != itend; it++) {
329  Algorithm* theAlgorithm = (*it);
330  if ( ! theAlgorithm->isEnabled( ) ) {
331  theAlgorithm->beginRun( ).ignore();
332  }
333  }
334  }
335  return StatusCode::SUCCESS;
336 }
std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:870
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual bool isEnabled() const
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:858
virtual StatusCode sysStart()
Reinitialization method invoked by the framework.
Definition: Algorithm.cpp:182
virtual StatusCode beginRun()
Algorithm begin run.
Definition: Algorithm.cpp:497
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
virtual StatusCode sysInitialize()
Initialization method invoked by the framework.
Definition: Algorithm.cpp:93
std::vector< Algorithm * > * branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:479
void ignore() const
Definition: StatusCode.h:94
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
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 479 of file Sequencer.cpp.

479  {
480  return m_branchAlgs;
481 }
std::vector< Algorithm * > * m_branchAlgs
Definition: Sequencer.h:247
bool Sequencer::branchFilterPassed ( ) const
virtual

Was the branch filter passed for the last event?

Definition at line 398 of file Sequencer.cpp.

399 {
400  return m_branchFilterPassed;
401 }
bool m_branchFilterPassed
Definition: Sequencer.h:250
void Sequencer::branchMembershipHandler ( Property theProp)

"BranchMembers" property handler

Definition at line 516 of file Sequencer.cpp.

517 {
519 }
StatusCode decodeBranchMemberNames()
Decode branch member name list.
Definition: Sequencer.cpp:503
bool isInitialized() const
Has the Algorithm already been initialized?
Definition: Algorithm.h:515
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 431 of file Sequencer.cpp.

434 {
435  StatusCode result = createAndAppend( type, name, pAlgorithm, subAlgorithms( ) );
436  return result;
437 }
std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:870
string type
Definition: gaudirun.py:126
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
StatusCode createAndAppend(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: Sequencer.cpp:431
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 548 of file Sequencer.cpp.

552 {
554  MsgStream log( msgSvc( ), name( ) );
555  SmartIF<IAlgManager> theAlgMgr(serviceLocator()->service("ApplicationMgr"));
556  if ( theAlgMgr.isValid() ) {
557  IAlgorithm* tmp;
558  result = theAlgMgr->createAlgorithm( type, algName, tmp );
559  if ( result.isSuccess( ) ) {
560  try{
561  pAlgorithm = dynamic_cast<Algorithm*>(tmp);
562  theAlgs->push_back( pAlgorithm );
563  } catch(...){
564  log << MSG::ERROR << "Unable to create Algorithm " << algName << endmsg;
565  result = StatusCode::FAILURE;
566  }
567  }
568  }
569  return result;
570 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
Definition: Algorithm.cpp:1091
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
string type
Definition: gaudirun.py:126
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:20
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
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.
Definition: Algorithm.h:207
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 440 of file Sequencer.cpp.

443 {
444  StatusCode result = createAndAppend( type, name, pAlgorithm, branchAlgorithms( ) );
445  return result;
446 }
string type
Definition: gaudirun.py:126
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
StatusCode createAndAppend(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: Sequencer.cpp:431
std::vector< Algorithm * > * branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:479
StatusCode Sequencer::decodeBranchMemberNames ( )

Decode branch member name list.

Definition at line 503 of file Sequencer.cpp.

504 {
506 
507  // Decode the branch membership list
508  result = decodeNames( m_branchNames,
509  branchAlgorithms( ),
511 
512  return result;
513 }
StringArrayProperty m_branchNames
Definition: Sequencer.h:246
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StatusCode decodeNames(StringArrayProperty &theNames, std::vector< Algorithm * > *theAlgs, std::vector< bool > &theLogic)
Decode algorithm names, creating or appending algorithms as appropriate.
Definition: Sequencer.cpp:573
std::vector< Algorithm * > * branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:479
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:248
StatusCode Sequencer::decodeMemberNames ( )

Decode Member Name list.

Definition at line 484 of file Sequencer.cpp.

485 {
487 
488  // Decode the membership list
489  result = decodeNames( m_names,
490  subAlgorithms( ),
491  m_isInverted );
492 
493  return result;
494 }
std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:870
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StatusCode decodeNames(StringArrayProperty &theNames, std::vector< Algorithm * > *theAlgs, std::vector< bool > &theLogic)
Decode algorithm names, creating or appending algorithms as appropriate.
Definition: Sequencer.cpp:573
std::vector< bool > m_isInverted
Definition: Sequencer.h:245
StringArrayProperty m_names
Definition: Sequencer.h:244
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 573 of file Sequencer.cpp.

576 {
577  StatusCode result;
578  MsgStream log( msgSvc( ), name( ) );
579  SmartIF<IAlgManager> theAlgMgr(serviceLocator()->service("ApplicationMgr"));
580  if ( theAlgMgr.isValid() ) {
581  // Clear the existing list of algorithms
582  theAlgs->clear( );
583 
584  // Build the list of member algorithms from the contents of the
585  // theNames list.
586  const std::vector<std::string>& theNameVector = theNames.value( );
587  std::vector<std::string>::const_iterator it;
588  std::vector<std::string>::const_iterator itend = theNameVector.end( );
589  for (it = theNameVector.begin(); it != itend; it++) {
590 
591  // Parse the name for a syntax of the form:
592  //
593  // <type>/<name>
594  //
595  // Where <name> is the algorithm instance name, and <type> is the
596  // algorithm class type (being a subclass of Algorithm).
598  std::string theName = typeName.name();
599  std::string theType = typeName.type();
600 
601  // Parse the name for a syntax of the form:
602  //
603  // <name>:invert
604  //
605  // Where <name> is the algorithm instance name and ":invert"
606  // indicates that the filter passed logic is inverted.
607  bool isInverted = false;
608  std::string::size_type invert = theName.find_first_of( ":" );
609  // Skip all occurrences of "::" (allow namespaces)
610  while ( std::string::npos != invert
611  && invert < (theName.size() - 1) && theName[invert+1] == ':' )
612  invert = theName.find_first_of( ":", invert+2 );
613  if ( std::string::npos != invert ) {
614  if ( theName == theType ) {
615  // This means that we got something like "Type:invert",
616  // so we have to strip the ":invert" from the type too.
617  theType = theType.substr( 0, invert );
618  }
619  theName = theName.substr( 0, invert );
620  isInverted = true;
621  }
622  // Check whether the supplied name corresponds to an existing
623  // Algorithm object.
624  SmartIF<IAlgorithm>& theIAlg = theAlgMgr->algorithm(theName, false);
625  Algorithm* theAlgorithm = 0;
627  if ( theIAlg.isValid() ) {
628  try{
629  theAlgorithm = dynamic_cast<Algorithm*>(theIAlg.get());
630  } catch(...){
631  log << MSG::WARNING << theName << " is not an Algorithm - Failed dynamic cast" << endmsg;
632  theAlgorithm = 0; // release
633  }
634  }
635  if ( theAlgorithm ) {
636 
637  // The specified Algorithm already exists - just append it to the membership list.
638  status = append( theAlgorithm, theAlgs );
639  if ( status.isSuccess( ) ) {
640  ON_DEBUG log << MSG::DEBUG << theName << " already exists - appended to member list" << endmsg;
641  } else {
642  log << MSG::WARNING << theName << " already exists - append failed!!!" << endmsg;
643  result = StatusCode::FAILURE;
644  }
645  } else {
646 
647  // The specified name doesn't exist - create a new object of the specified type
648  // and append it to the membership list.
649  status = createAndAppend( theType, theName, theAlgorithm, theAlgs );
650  if ( status.isSuccess( ) ) {
651  ON_DEBUG log << MSG::DEBUG << theName << " doesn't exist - created and appended to member list" << endmsg;
652  } else {
653  log << MSG::WARNING << theName << " doesn't exist - creation failed!!!" << endmsg;
654  result = StatusCode::FAILURE;
655  }
656  }
657  if ( status.isSuccess( ) ) {
658  theLogic.push_back( isInverted );
659  }
660  }
661 
662  }
663  // Print membership list
664  if ( result.isSuccess() && theAlgs->size() != 0 ) {
665  log << MSG::INFO << "Member list: ";
666  std::vector<Algorithm*>::iterator ai = theAlgs->begin();
667  std::vector<bool>::iterator li = theLogic.begin();
668  for ( ; ai != theAlgs->end(); ++ai, ++li ) {
669 
670  if ( ai != theAlgs->begin() ) log << ", ";
671 
672  if ( (*ai)->name() == System::typeinfoName(typeid(**ai)) )
673  log << (*ai)->name();
674  else
675  log << System::typeinfoName(typeid(**ai)) << "/" << (*ai)->name();
676 
677  if (*li) log << ":invert";
678  }
679  log << endmsg;
680  }
681  return result;
682 }
StatusCode append(Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition: Sequencer.cpp:417
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
Definition: Algorithm.cpp:1091
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:62
const TYPE & value() const
explicit conversion
Definition: Property.h:355
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
#define ON_DEBUG
Definition: Sequencer.cpp:15
StatusCode createAndAppend(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Definition: Sequencer.cpp:431
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.
Definition: Algorithm.h:207
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:22
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode Sequencer::endRun ( )
virtual

Sequencer endRun.

Reimplemented from Algorithm.

Definition at line 339 of file Sequencer.cpp.

340 {
341  // Bypass the loop if this sequencer is disabled
342  if ( isEnabled( ) ) {
343 
344  // Loop over all members calling their endRun functions
345  // if they are not disabled.
346  std::vector<Algorithm*>* theAlgms = subAlgorithms( );
347  std::vector<Algorithm*>::iterator it;
348  std::vector<Algorithm*>::iterator itend = theAlgms->end( );
349  for (it = theAlgms->begin(); it != itend; it++) {
350  Algorithm* theAlgorithm = (*it);
351  if ( ! theAlgorithm->isEnabled( ) ) {
352  theAlgorithm->endRun( ).ignore();
353  }
354  }
355  // Loop over all branch members calling their endRun functions
356  // if they are not disabled.
357  theAlgms = branchAlgorithms( );
358  itend = theAlgms->end( );
359  for (it = theAlgms->begin(); it != itend; it++) {
360  Algorithm* theAlgorithm = (*it);
361  if ( ! theAlgorithm->isEnabled( ) ) {
362  theAlgorithm->endRun( ).ignore();
363  }
364  }
365  }
366  return StatusCode::SUCCESS;
367 }
std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:870
virtual bool isEnabled() const
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:858
virtual StatusCode endRun()
Algorithm end run. This method is called at the end of the event loop.
Definition: Algorithm.cpp:573
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
std::vector< Algorithm * > * branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:479
void ignore() const
Definition: StatusCode.h:94
StatusCode Sequencer::execute ( )
virtual

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

This method is invoked once per event.

Implements IAlgorithm.

Definition at line 129 of file Sequencer.cpp.

130 {
132  MsgStream log( msgSvc( ), name( ) );
133 
134  ON_DEBUG log << MSG::DEBUG << name( ) << " Sequencer::execute( )" << endmsg;
135 
136  // Bypass the loop if this sequencer is disabled or has already been executed
137  if ( isEnabled( ) && ! isExecuted( ) ) {
138  Algorithm* lastAlgorithm;
139  result = execute( subAlgorithms( ), m_isInverted, lastAlgorithm );
140  if ( result.isSuccess( ) ) {
141  bool passed = filterPassed( );
142  if ( ! passed && ! isStopOverride( ) ) {
143 
144  // Filter failed and stop override not set. Execute the
145  // branch if there is one associated with the filter
146  // algorithm that failed. Note that the first member on
147  // the branch is the failing algorithm and so should
148  // be skipped.
149  std::vector<Algorithm*>* theAlgs = branchAlgorithms( );
150  if ( theAlgs->size( ) > 0 ) {
151  Algorithm* branchAlgorithm = (*theAlgs)[0];
152  if ( lastAlgorithm == branchAlgorithm ) {
153 
154  // Branch specified - Loop over branch members
155  result = execute( branchAlgorithms( ),
157  lastAlgorithm, 1 );
158  if ( result.isSuccess( ) ) {
159 
160  // The final filter passed state will be set true if either
161  // of the main or branches passed, otherwise false.
162 
163  // Save the branch filter passed state.
165  }
166  }
167  }
168  }
169  }
170 
171  // Prevent multiple executions of this sequencer for the current event
172  setExecuted( true );
173  }
174  return result;
175 }
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:411
std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:870
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual void setExecuted(bool state)
Set the executed flag to the specified state.
Definition: Algorithm.cpp:849
virtual bool filterPassed() const
Did this algorithm pass or fail its filter criterion for the last event?
Definition: Algorithm.cpp:862
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
virtual bool isEnabled() const
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:858
virtual bool isExecuted() const
Has this algorithm been executed since the last reset?
Definition: Algorithm.cpp:845
virtual StatusCode setBranchFilterPassed(bool state)
Set the branch filter passed flag for the last event.
Definition: Sequencer.cpp:404
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
#define ON_DEBUG
Definition: Sequencer.cpp:15
std::vector< bool > m_isInverted
Definition: Sequencer.h:245
std::vector< Algorithm * > * branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:479
void ignore() const
Definition: StatusCode.h:94
virtual StatusCode execute()
The actions to be performed by the sequencer on an event.
Definition: Sequencer.cpp:129
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:248
StatusCode Sequencer::execute ( 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 685 of file Sequencer.cpp.

689 {
691 
692  // Loop over all algorithms calling their execute functions if they
693  // are (a) not disabled, and (b) aren't already executed. Note that
694  // in the latter case the filter state is still examined. Terminate
695  // the loop if an algorithm indicates that it's filter didn't pass.
696  unsigned int size = theAlgs->size( );
697  for (unsigned int i = first; i < size; i++) {
698  lastAlgorithm = (*theAlgs)[i];
699  result = executeMember( lastAlgorithm );
700  if ( result.isSuccess( ) ) {
701 
702  // Take the filter passed status of this algorithm as my own status.
703  // Note that we take into account inverted logic.
704  bool passed = lastAlgorithm->filterPassed( );
705  bool isInverted = theLogic[i];
706  if ( isInverted ) {
707  passed = ! passed;
708  }
709  setFilterPassed( passed );
710 
711  // The behaviour when the filter fails depends on the StopOverride property.
712  // The default action is to stop processing, but this default can be
713  // overridden by setting the "StopOverride" property to true.
714  if ( ! isStopOverride( ) ) {
715  if ( ! passed ) break;
716  }
717  } else {
718  break;
719  }
720  }
721  return result;
722 }
virtual bool isStopOverride() const
Has the StopOverride mode been set?
Definition: Sequencer.cpp:411
virtual bool filterPassed() const
Did this algorithm pass or fail its filter criterion for the last event?
Definition: Algorithm.cpp:862
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
StatusCode executeMember(Algorithm *theAlgorithm)
Execute member algorithm.
Definition: Sequencer.cpp:725
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual void setFilterPassed(bool state)
Set the filter passed flag to the specified state.
Definition: Algorithm.cpp:866
list i
Definition: ana.py:128
StatusCode Sequencer::executeMember ( Algorithm theAlgorithm)
protected

Execute member algorithm.

Definition at line 725 of file Sequencer.cpp.

726 {
728  if ( theAlgorithm->isEnabled( ) ) {
729  if ( ! theAlgorithm->isExecuted( ) ) {
730  result = theAlgorithm->sysExecute( );
731 
732  // Set the executed state of the algorithm.
733  // I think this should be done by the algorithm itself, but just in case...
734  theAlgorithm->setExecuted( true );
735  }
736  }
737  return result;
738 }
virtual void setExecuted(bool state)
Set the executed flag to the specified state.
Definition: Algorithm.cpp:849
virtual StatusCode sysExecute()
The actions to be performed by the algorithm on an event.
Definition: Algorithm.cpp:578
virtual bool isEnabled() const
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:858
virtual bool isExecuted() const
Has this algorithm been executed since the last reset?
Definition: Algorithm.cpp:845
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StatusCode Sequencer::finalize ( )
virtual

Sequencer finalization.

Reimplemented from Algorithm.

Definition at line 178 of file Sequencer.cpp.

179 {
180  // Loop over all branch members calling their finalize functions
181  // if they are not disabled. Note that the Algorithm::sysFinalize
182  // function already does this for the main members.
183  std::vector<Algorithm*>* theAlgs = branchAlgorithms( );
184  std::vector<Algorithm*>::iterator it;
185  std::vector<Algorithm*>::iterator itend = theAlgs->end( );
186  for (it = theAlgs->begin(); it != itend; it++) {
187  Algorithm* theAlgorithm = (*it);
188  if (theAlgorithm->sysFinalize( ).isFailure()) {
189  MsgStream log( msgSvc( ), name( ) );
190  log << MSG::ERROR << "Unable to finalize Algorithm "
191  << theAlgorithm->name() << endmsg;
192  }
193  }
194  return StatusCode::SUCCESS;
195 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
virtual StatusCode sysFinalize()
System finalization.
Definition: Algorithm.cpp:726
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
std::vector< Algorithm * > * branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:479
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode Sequencer::initialize ( )
virtual

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.

Reimplemented from Algorithm.

Definition at line 49 of file Sequencer.cpp.

50 {
52  MsgStream log( msgSvc( ), name( ) );
53 
54  std::vector<Algorithm*>* theAlgs;
55  std::vector<Algorithm*>::iterator it;
56  std::vector<Algorithm*>::iterator itend;
57 
58  result = decodeMemberNames();
59  if( result.isFailure() ) {
60  log << MSG::ERROR << "Unable to configure one or more sequencer members " << endmsg;
61  return result;
62  }
63  result = decodeBranchMemberNames();
64  if( result.isFailure() ) {
65  log << MSG::ERROR << "Unable to configure one or more branch members " << endmsg;
66  return result;
67  }
68 
69  // Loop over all sub-algorithms
70  theAlgs = subAlgorithms( );
71  itend = theAlgs->end( );
72  for (it = theAlgs->begin(); it != itend; it++) {
73  Algorithm* theAlgorithm = (*it);
74  result = theAlgorithm->sysInitialize( );
75  if( result.isFailure() ) {
76  log << MSG::ERROR << "Unable to initialize Algorithm " << theAlgorithm->name() << endmsg;
77  return result;
78  }
79  }
80 
81  // Loop over all branches
82  theAlgs = branchAlgorithms( );
83  itend = theAlgs->end( );
84  for (it = theAlgs->begin(); it != itend; it++) {
85  Algorithm* theAlgorithm = (*it);
86  result = theAlgorithm->sysInitialize( );
87  if( result.isFailure() ) {
88  log << MSG::ERROR << "Unable to initialize Algorithm " << theAlgorithm->name() << endmsg;
89  return result;
90  }
91  }
92 
93  return result;
94 }
std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:870
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
StatusCode decodeBranchMemberNames()
Decode branch member name list.
Definition: Sequencer.cpp:503
StatusCode decodeMemberNames()
Decode Member Name list.
Definition: Sequencer.cpp:484
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
virtual StatusCode sysInitialize()
Initialization method invoked by the framework.
Definition: Algorithm.cpp:93
std::vector< Algorithm * > * branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:479
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 411 of file Sequencer.cpp.

412 {
413  return m_stopOverride.value( );
414 }
BooleanProperty m_stopOverride
Definition: Sequencer.h:249
const TYPE & value() const
explicit conversion
Definition: Property.h:355
void Sequencer::membershipHandler ( Property theProp)

"Members" property handler

Definition at line 497 of file Sequencer.cpp.

498 {
499  if ( isInitialized() ) decodeMemberNames();
500 }
StatusCode decodeMemberNames()
Decode Member Name list.
Definition: Sequencer.cpp:484
bool isInitialized() const
Has the Algorithm already been initialized?
Definition: Algorithm.h:515
Sequencer& Sequencer::operator= ( const Sequencer rhs)
private

Private assignment operator: NO ASSIGNMENT ALLOWED.

StatusCode Sequencer::reinitialize ( )
virtual

Sequencer Reinitialization.

Reimplemented from Algorithm.

Definition at line 97 of file Sequencer.cpp.

98 {
99  // Bypass the loop if this sequencer is disabled
100  if ( isEnabled( ) ) {
101 
102  // Loop over all members calling their reinitialize functions
103  // if they are not disabled.
104  std::vector<Algorithm*>* theAlgms = subAlgorithms( );
105  std::vector<Algorithm*>::iterator it;
106  std::vector<Algorithm*>::iterator itend = theAlgms->end( );
107  for (it = theAlgms->begin(); it != itend; it++) {
108  Algorithm* theAlgorithm = (*it);
109  if ( ! theAlgorithm->isEnabled( ) ) {
110  theAlgorithm->reinitialize( ).ignore();
111  }
112  }
113  // Loop over all branch members calling their reinitialize functions
114  // if they are not disabled.
115  theAlgms = branchAlgorithms( );
116  itend = theAlgms->end( );
117  for (it = theAlgms->begin(); it != itend; it++) {
118  Algorithm* theAlgorithm = (*it);
119  if ( ! theAlgorithm->isEnabled( ) ) {
120  theAlgorithm->reinitialize( ).ignore();
121  }
122  }
123 
124  }
125  return StatusCode::SUCCESS;
126 }
std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:870
virtual bool isEnabled() const
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:858
virtual StatusCode reinitialize()
the default (empty) implementation of IStateful::reinitialize() method
Definition: Algorithm.cpp:798
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
std::vector< Algorithm * > * branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:479
void ignore() const
Definition: StatusCode.h:94
StatusCode Sequencer::remove ( Algorithm pAlgorithm)

Remove the specified algorithm from the sequencer.

Definition at line 449 of file Sequencer.cpp.

450 {
451  std::string theName = pAlgorithm->name( );
452  StatusCode result = remove( theName );
453  return result;
454 }
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
StatusCode Sequencer::remove ( const std::string &  name)

Definition at line 457 of file Sequencer.cpp.

458 {
459  StatusCode result = remove( algname, subAlgorithms( ) );
460  return result;
461 }
std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:870
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StatusCode Sequencer::remove ( const std::string &  algname,
std::vector< Algorithm * > *  theAlgs 
)
protected

Remove the specified algorithm from the sequencer.

Definition at line 741 of file Sequencer.cpp.

742 {
743  MsgStream log( msgSvc( ), name( ) );
745 
746  // Test that the algorithm exists in the member list
747  std::vector<Algorithm*>::iterator it;
748  std::vector<Algorithm*>::iterator itend = theAlgs->end( );
749  for (it = theAlgs->begin(); it != itend; it++) {
750  Algorithm* theAlgorithm = (*it);
751  if ( theAlgorithm->name( ) == algname ) {
752 
753  // Algorithm with specified name exists in the algorithm list - remove it
754  // THIS ISN'T IMPLEMENTED YET!!!!
755  log << MSG::INFO <<"Sequencer::remove( ) isn't implemented yet!!!!!" << endmsg;
756  result = StatusCode::SUCCESS;
757  break;
758  }
759  }
760  return result;
761 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
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 464 of file Sequencer.cpp.

465 {
466  std::string theName = pAlgorithm->name( );
467  StatusCode result = removeFromBranch( theName );
468  return result;
469 }
StatusCode removeFromBranch(Algorithm *pAlgorithm)
Definition: Sequencer.cpp:464
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
StatusCode Sequencer::removeFromBranch ( const std::string &  name)

Definition at line 472 of file Sequencer.cpp.

473 {
474  StatusCode result = remove( algname, branchAlgorithms( ) );
475  return result;
476 }
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
std::vector< Algorithm * > * branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:479
void Sequencer::resetExecuted ( )
virtual

Reset the Sequencer executed state for the current event.

Reimplemented from Algorithm.

Definition at line 370 of file Sequencer.cpp.

371 {
373 
374  // Loop over all members calling their resetExecuted functions
375  // if they are not disabled.
376  std::vector<Algorithm*>* subAlgms = subAlgorithms( );
377  std::vector<Algorithm*>::iterator it;
378  std::vector<Algorithm*>::iterator itend = subAlgms->end( );
379  for (it = subAlgms->begin(); it != itend; it++) {
380  Algorithm* theAlgorithm = (*it);
381  theAlgorithm->resetExecuted( );
382  }
383 
384  // Loop over all branch members calling their resetExecuted functions
385  // if they are not disabled.
386  subAlgms = branchAlgorithms( );
387  itend = subAlgms->end( );
388  for (it = subAlgms->begin(); it != itend; it++) {
389  Algorithm* theAlgorithm = (*it);
390  theAlgorithm->resetExecuted( );
391  }
392 
393  // Reset the branch filter passed flag
394  m_branchFilterPassed = false;
395 }
std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:870
bool m_branchFilterPassed
Definition: Sequencer.h:250
virtual void resetExecuted()
Reset the executed state of the Algorithm for the duration of the current event.
Definition: Algorithm.cpp:853
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
std::vector< Algorithm * > * branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:479
StatusCode Sequencer::setBranchFilterPassed ( bool  state)
virtual

Set the branch filter passed flag for the last event.

Definition at line 404 of file Sequencer.cpp.

405 {
407  return StatusCode::SUCCESS;
408 }
bool m_branchFilterPassed
Definition: Sequencer.h:250
StatusCode Sequencer::start ( )
virtual

Sequencer finalization.

Reimplemented from Algorithm.

Definition at line 198 of file Sequencer.cpp.

199 {
201  MsgStream log( msgSvc( ), name( ) );
202 
203  std::vector<Algorithm*>* theAlgs;
204  std::vector<Algorithm*>::iterator it;
205  std::vector<Algorithm*>::iterator itend;
206 
207  // Loop over all sub-algorithms
208  theAlgs = subAlgorithms( );
209  itend = theAlgs->end( );
210  for (it = theAlgs->begin(); it != itend; it++) {
211  Algorithm* theAlgorithm = (*it);
212  result = theAlgorithm->sysStart( );
213  if( result.isFailure() ) {
214  log << MSG::ERROR << "Unable to start Algorithm " << theAlgorithm->name() << endmsg;
215  return result;
216  }
217  }
218 
219  // Loop over all branches
220  theAlgs = branchAlgorithms( );
221  itend = theAlgs->end( );
222  for (it = theAlgs->begin(); it != itend; it++) {
223  Algorithm* theAlgorithm = (*it);
224  result = theAlgorithm->sysStart( );
225  if( result.isFailure() ) {
226  log << MSG::ERROR << "Unable to start Algorithm " << theAlgorithm->name() << endmsg;
227  return result;
228  }
229  }
230 
231  return result;
232 }
std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:870
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual StatusCode sysStart()
Reinitialization method invoked by the framework.
Definition: Algorithm.cpp:182
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
std::vector< Algorithm * > * branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:479
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode Sequencer::stop ( )
virtual

Sequencer finalization.

Reimplemented from Algorithm.

Definition at line 235 of file Sequencer.cpp.

236 {
237  // Loop over all branch members calling their finalize functions
238  // if they are not disabled.
239  std::vector<Algorithm*>* theAlgs;
240  std::vector<Algorithm*>::iterator it;
241  std::vector<Algorithm*>::iterator itend;
242 
243  theAlgs = subAlgorithms( );
244  itend = theAlgs->end( );
245  for (it = theAlgs->begin(); it != itend; it++) {
246  Algorithm* theAlgorithm = (*it);
247  if (theAlgorithm->sysStop( ).isFailure()) {
248  MsgStream log( msgSvc( ), name( ) );
249  log << MSG::ERROR << "Unable to stop Algorithm "
250  << theAlgorithm->name() << endmsg;
251  }
252  }
253 
254  theAlgs = branchAlgorithms( );
255  itend = theAlgs->end( );
256  for (it = theAlgs->begin(); it != itend; it++) {
257  Algorithm* theAlgorithm = (*it);
258  if (theAlgorithm->sysStop( ).isFailure()) {
259  MsgStream log( msgSvc( ), name( ) );
260  log << MSG::ERROR << "Unable to stop Algorithm "
261  << theAlgorithm->name() << endmsg;
262  }
263  }
264  return StatusCode::SUCCESS;
265 }
std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Definition: Algorithm.cpp:870
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
std::vector< Algorithm * > * branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:479
virtual StatusCode sysStop()
System stop.
Definition: Algorithm.cpp:667
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 247 of file Sequencer.h.

bool Sequencer::m_branchFilterPassed
private

Definition at line 250 of file Sequencer.h.

StringArrayProperty Sequencer::m_branchNames
private

Definition at line 246 of file Sequencer.h.

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

Definition at line 248 of file Sequencer.h.

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

Definition at line 245 of file Sequencer.h.

StringArrayProperty Sequencer::m_names
private

Definition at line 244 of file Sequencer.h.

BooleanProperty Sequencer::m_stopOverride
private

Definition at line 249 of file Sequencer.h.


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