All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Sequencer.cpp
Go to the documentation of this file.
1 // Sequencer class
2 // Implements:
3 // 1) Common functionality of IInterface
4 // 2) Default behavior for the IAlgorithm
5 
6 #include "GaudiAlg/Sequencer.h"
7 
10 #include "GaudiKernel/MsgStream.h"
11 #include "GaudiKernel/Chrono.h"
12 #include "GaudiKernel/Stat.h"
14 
15 #define ON_DEBUG if (UNLIKELY(outputLevel() <= MSG::DEBUG))
16 #define ON_VERBOSE if (UNLIKELY(outputLevel() <= MSG::VERBOSE))
17 
21 Sequencer::Sequencer( const std::string& name, ISvcLocator* pSvcLocator )
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 }
39 
44 {
45  delete m_branchAlgs;
46 }
47 
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 }
95 
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 }
127 
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 }
176 
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 }
196 
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 }
233 
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 }
266 
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 }
337 
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 }
368 
369 void
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 }
396 
397 bool
399 {
400  return m_branchFilterPassed;
401 }
402 
405 {
407  return StatusCode::SUCCESS;
408 }
409 
410 bool
412 {
413  return m_stopOverride.value( );
414 }
415 
418 {
419  StatusCode result = append( pAlgorithm, subAlgorithms( ) );
420  return result;
421 }
422 
425 {
426  StatusCode result = append( pAlgorithm, branchAlgorithms( ) );
427  return result;
428 }
429 
431 Sequencer::createAndAppend( const std::string& type,
432  const std::string& name,
433  Algorithm*& pAlgorithm )
434 {
435  StatusCode result = createAndAppend( type, name, pAlgorithm, subAlgorithms( ) );
436  return result;
437 }
438 
441  const std::string& name,
442  Algorithm*& pAlgorithm )
443 {
444  StatusCode result = createAndAppend( type, name, pAlgorithm, branchAlgorithms( ) );
445  return result;
446 }
447 
450 {
451  std::string theName = pAlgorithm->name( );
452  StatusCode result = remove( theName );
453  return result;
454 }
455 
457 Sequencer::remove( const std::string& algname )
458 {
459  StatusCode result = remove( algname, subAlgorithms( ) );
460  return result;
461 }
462 
465 {
466  std::string theName = pAlgorithm->name( );
467  StatusCode result = removeFromBranch( theName );
468  return result;
469 }
470 
472 Sequencer::removeFromBranch( const std::string& algname )
473 {
474  StatusCode result = remove( algname, branchAlgorithms( ) );
475  return result;
476 }
477 
478 std::vector<Algorithm*>*
480  return m_branchAlgs;
481 }
482 
485 {
487 
488  // Decode the membership list
489  result = decodeNames( m_names,
490  subAlgorithms( ),
491  m_isInverted );
492 
493  return result;
494 }
495 
496 void
498 {
499  if ( isInitialized() ) decodeMemberNames();
500 }
501 
504 {
506 
507  // Decode the branch membership list
508  result = decodeNames( m_branchNames,
509  branchAlgorithms( ),
511 
512  return result;
513 }
514 
515 void
517 {
519 }
520 
527  std::vector<Algorithm*>* theAlgs )
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 }
546 
548 Sequencer::createAndAppend( const std::string& type,
549  const std::string& algName,
550  Algorithm*& pAlgorithm,
551  std::vector<Algorithm*>* theAlgs )
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 }
571 
574  std::vector<Algorithm*>* theAlgs,
575  std::vector<bool>& theLogic )
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 }
683 
685 Sequencer::execute( std::vector<Algorithm*>* theAlgs,
686  std::vector<bool>& theLogic,
687  Algorithm*& lastAlgorithm,
688  unsigned int first )
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 }
723 
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 }
739 
741 Sequencer::remove( const std::string& algname, std::vector<Algorithm*>* theAlgs )
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 }
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
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
virtual void setExecuted(bool state)
Set the executed flag to the specified state.
Definition: Algorithm.cpp:849
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:26
StatusCode remove(Algorithm *pAlgorithm)
Remove the specified algorithm from the sequencer.
Definition: Sequencer.cpp:449
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
Definition: Algorithm.cpp:1091
StatusCode removeFromBranch(Algorithm *pAlgorithm)
Definition: Sequencer.cpp:464
virtual bool filterPassed() const
Did this algorithm pass or fail its filter criterion for the last event?
Definition: Algorithm.cpp:862
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
virtual StatusCode sysExecute()
The actions to be performed by the algorithm on an event.
Definition: Algorithm.cpp:578
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
void resetExecuted()
Reset the Sequencer executed state for the current event.
Definition: Sequencer.cpp:370
Sequencer(const std::string &name, ISvcLocator *svcloc)
Constructor(s)
Definition: Sequencer.cpp:21
virtual bool isEnabled() const
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:858
virtual StatusCode stop()
Sequencer finalization.
Definition: Sequencer.cpp:235
virtual bool branchFilterPassed() const
Was the branch filter passed for the last event?
Definition: Sequencer.cpp:398
virtual bool isExecuted() const
Has this algorithm been executed since the last reset?
Definition: Algorithm.cpp:845
virtual StatusCode beginRun()
Sequencer beginRun.
Definition: Sequencer.cpp:268
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
virtual StatusCode finalize()
Sequencer finalization.
Definition: Sequencer.cpp:178
virtual StatusCode sysStart()
Reinitialization method invoked by the framework.
Definition: Algorithm.cpp:182
StatusCode executeMember(Algorithm *theAlgorithm)
Execute member algorithm.
Definition: Sequencer.cpp:725
virtual StatusCode beginRun()
Algorithm begin run.
Definition: Algorithm.cpp:497
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
StringArrayProperty m_branchNames
Definition: Sequencer.h:246
virtual StatusCode endRun()
Sequencer endRun.
Definition: Sequencer.cpp:339
virtual StatusCode reinitialize()
the default (empty) implementation of IStateful::reinitialize() method
Definition: Algorithm.cpp:798
virtual StatusCode endRun()
Algorithm end run. This method is called at the end of the event loop.
Definition: Algorithm.cpp:573
virtual StatusCode sysFinalize()
System finalization.
Definition: Algorithm.cpp:726
StatusCode decodeBranchMemberNames()
Decode branch member name list.
Definition: Sequencer.cpp:503
virtual void declareUpdateHandler(PropertyCallbackFunctor *pf)
set new callback for update
Definition: Property.cpp:141
virtual StatusCode setBranchFilterPassed(bool state)
Set the branch filter passed flag for the last event.
Definition: Sequencer.cpp:404
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
virtual void resetExecuted()
Reset the executed state of the Algorithm for the duration of the current event.
Definition: Algorithm.cpp:853
string type
Definition: gaudirun.py:126
StatusCode decodeMemberNames()
Decode Member Name list.
Definition: Sequencer.cpp:484
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
StatusCode createAndAppendToBranch(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer branch.
Definition: Sequencer.cpp:440
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
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
virtual StatusCode start()
Sequencer finalization.
Definition: Sequencer.cpp:198
bool isInitialized() const
Has the Algorithm already been initialized?
Definition: Algorithm.h:515
virtual StatusCode initialize()
Initialization of a sequencer.
Definition: Sequencer.cpp:49
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:62
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:20
const TYPE & value() const
explicit conversion
Definition: Property.h:355
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
virtual StatusCode reinitialize()
Sequencer Reinitialization.
Definition: Sequencer.cpp:97
std::vector< Algorithm * > * m_branchAlgs
Definition: Sequencer.h:247
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
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:43
void membershipHandler(Property &theProp)
"Members" property handler
Definition: Sequencer.cpp:497
#define ON_DEBUG
Definition: Sequencer.cpp:15
std::vector< bool > m_isInverted
Definition: Sequencer.h:245
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
const std::string & type() const
StatusCode appendToBranch(Algorithm *pAlgorithm)
Append an algorithm to the sequencer branch.
Definition: Sequencer.cpp:424
virtual ~Sequencer()
Destructor.
Definition: Sequencer.cpp:43
std::vector< Algorithm * > * branchAlgorithms() const
List of branch algorithms.
Definition: Sequencer.cpp:479
StringArrayProperty m_names
Definition: Sequencer.h:244
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
virtual StatusCode sysStop()
System stop.
Definition: Algorithm.cpp:667
const std::string & name() const
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
void ignore() const
Definition: StatusCode.h:107
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:22
list i
Definition: ana.py:128
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