6 #include "GaudiAlg/Sequencer.h"
8 #include "GaudiKernel/IAlgManager.h"
9 #include "GaudiKernel/ISvcLocator.h"
10 #include "GaudiKernel/MsgStream.h"
11 #include "GaudiKernel/Chrono.h"
12 #include "GaudiKernel/Stat.h"
13 #include "GaudiKernel/GaudiException.h"
15 #define ON_DEBUG if (UNLIKELY(outputLevel() <= MSG::DEBUG))
16 #define ON_VERBOSE if (UNLIKELY(outputLevel() <= MSG::VERBOSE))
23 m_branchFilterPassed( false )
54 std::vector<Algorithm*>* theAlgs;
55 std::vector<Algorithm*>::iterator it;
56 std::vector<Algorithm*>::iterator itend;
60 log <<
MSG::ERROR <<
"Unable to configure one or more sequencer members " <<
endmsg;
65 log <<
MSG::ERROR <<
"Unable to configure one or more branch members " <<
endmsg;
71 itend = theAlgs->end( );
72 for (it = theAlgs->begin(); it != itend; it++) {
83 itend = theAlgs->end( );
84 for (it = theAlgs->begin(); it != itend; it++) {
105 std::vector<Algorithm*>::iterator it;
106 std::vector<Algorithm*>::iterator itend = theAlgms->end( );
107 for (it = theAlgms->begin(); it != itend; it++) {
116 itend = theAlgms->end( );
117 for (it = theAlgms->begin(); it != itend; it++) {
150 if ( theAlgs->size( ) > 0 ) {
151 Algorithm* branchAlgorithm = (*theAlgs)[0];
152 if ( lastAlgorithm == branchAlgorithm ) {
184 std::vector<Algorithm*>::iterator it;
185 std::vector<Algorithm*>::iterator itend = theAlgs->end( );
186 for (it = theAlgs->begin(); it != itend; it++) {
190 log <<
MSG::ERROR <<
"Unable to finalize Algorithm "
203 std::vector<Algorithm*>* theAlgs;
204 std::vector<Algorithm*>::iterator it;
205 std::vector<Algorithm*>::iterator itend;
209 itend = theAlgs->end( );
210 for (it = theAlgs->begin(); it != itend; it++) {
221 itend = theAlgs->end( );
222 for (it = theAlgs->begin(); it != itend; it++) {
239 std::vector<Algorithm*>* theAlgs;
240 std::vector<Algorithm*>::iterator it;
241 std::vector<Algorithm*>::iterator itend;
244 itend = theAlgs->end( );
245 for (it = theAlgs->begin(); it != itend; it++) {
249 log <<
MSG::ERROR <<
"Unable to stop Algorithm "
255 itend = theAlgs->end( );
256 for (it = theAlgs->begin(); it != itend; it++) {
260 log <<
MSG::ERROR <<
"Unable to stop Algorithm "
281 std::vector<Algorithm*>::iterator it;
282 std::vector<Algorithm*>::iterator itend = theAlgs->end( );
283 for (it = theAlgs->begin(); it != itend; it++) {
299 for (it = theAlgs->begin(); it != itend; it++) {
311 itend = theAlgs->end( );
312 for (it = theAlgs->begin(); it != itend; it++) {
328 for (it = theAlgs->begin(); it != itend; it++) {
347 std::vector<Algorithm*>::iterator it;
348 std::vector<Algorithm*>::iterator itend = theAlgms->end( );
349 for (it = theAlgms->begin(); it != itend; it++) {
358 itend = theAlgms->end( );
359 for (it = theAlgms->begin(); it != itend; it++) {
377 std::vector<Algorithm*>::iterator it;
378 std::vector<Algorithm*>::iterator itend = subAlgms->end( );
379 for (it = subAlgms->begin(); it != itend; it++) {
387 itend = subAlgms->end( );
388 for (it = subAlgms->begin(); it != itend; it++) {
432 const std::string& name,
441 const std::string& name,
451 std::string theName = pAlgorithm->
name( );
466 std::string theName = pAlgorithm->
name( );
478 std::vector<Algorithm*>*
527 std::vector<Algorithm*>* theAlgs )
531 std::vector<Algorithm*>::iterator it;
532 std::vector<Algorithm*>::iterator itend = theAlgs->end( );
533 for (it = theAlgs->begin(); it != itend; it++) {
535 if ( theAlgorithm == pAlgorithm ) {
541 theAlgs->push_back( pAlgorithm );
542 pAlgorithm->addRef();
549 const std::string& algName,
551 std::vector<Algorithm*>* theAlgs )
558 result = theAlgMgr->createAlgorithm( type, algName, tmp );
561 pAlgorithm =
dynamic_cast<Algorithm*
>(tmp);
562 theAlgs->push_back( pAlgorithm );
574 std::vector<Algorithm*>* theAlgs,
575 std::vector<bool>& theLogic )
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++) {
597 const Gaudi::Utils::TypeNameString
typeName(*it);
598 std::string theName = typeName.name();
599 std::string theType = typeName.type();
607 bool isInverted =
false;
608 std::string::size_type invert = theName.find_first_of(
":" );
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 ) {
617 theType = theType.substr( 0, invert );
619 theName = theName.substr( 0, invert );
631 log <<
MSG::WARNING << theName <<
" is not an Algorithm - Failed dynamic cast" <<
endmsg;
635 if ( theAlgorithm ) {
638 status =
append( theAlgorithm, theAlgs );
658 theLogic.push_back( isInverted );
664 if ( result.
isSuccess() && theAlgs->size() != 0 ) {
666 std::vector<Algorithm*>::iterator ai = theAlgs->begin();
667 std::vector<bool>::iterator li = theLogic.begin();
668 for ( ; ai != theAlgs->end(); ++ai, ++li ) {
670 if ( ai != theAlgs->begin() ) log <<
", ";
673 log << (*ai)->name();
677 if (*li) log <<
":invert";
686 std::vector<bool>& theLogic,
696 unsigned int size = theAlgs->size( );
697 for (
unsigned int i = first;
i < size;
i++) {
698 lastAlgorithm = (*theAlgs)[
i];
705 bool isInverted = theLogic[
i];
715 if ( ! passed )
break;
747 std::vector<Algorithm*>::iterator it;
748 std::vector<Algorithm*>::iterator itend = theAlgs->end( );
749 for (it = theAlgs->begin(); it != itend; it++) {
751 if ( theAlgorithm->
name( ) == algname ) {
755 log <<
MSG::INFO <<
"Sequencer::remove( ) isn't implemented yet!!!!!" <<
endmsg;