14 #define ON_DEBUG if (msgLevel(MSG::DEBUG))
15 #define ON_VERBOSE if (msgLevel(MSG::VERBOSE))
42 error() <<
"Unable to configure one or more sequencer members " <<
endmsg;
47 error() <<
"Unable to configure one or more branch members " <<
endmsg;
53 result = alg->sysInitialize( );
55 error() <<
"Unable to initialize Algorithm " << alg->name() <<
endmsg;
62 result = alg->sysInitialize( );
64 error() <<
"Unable to initialize Algorithm " << alg->name() <<
endmsg;
81 if ( alg->isEnabled( ) ) alg->reinitialize( ).
ignore();
86 if ( alg->isEnabled( ) ) {
87 alg->reinitialize( ).ignore();
115 if ( !theAlgs.empty( ) ) {
117 if ( lastAlgorithm == branchAlgorithm ) {
149 if (alg->sysFinalize( ).isFailure()) {
150 error() <<
"Unable to finalize Algorithm "
165 result = alg->sysStart( );
167 error() <<
"Unable to start Algorithm " << alg->name() <<
endmsg;
174 result = alg->sysStart( );
176 error() <<
"Unable to start Algorithm " << alg->name() <<
endmsg;
191 if (alg->sysStop( ).isFailure()) {
192 error() <<
"Unable to stop Algorithm "
198 if (alg->sysStop( ).isFailure()) {
199 error() <<
"Unable to stop Algorithm "
219 result = alg->sysInitialize( );
221 error() <<
"Unable to initialize Algorithm " << alg->name() <<
endmsg;
224 result = alg->sysStart( );
226 error() <<
"Unable to start Algorithm " << alg->name() <<
endmsg;
234 if ( ! alg->isEnabled( ) ) {
235 alg->beginRun( ).ignore();
244 result = alg->sysInitialize( );
246 error() <<
"Unable to initialize Algorithm " << alg->name() <<
endmsg;
249 result = alg->sysStart( );
251 error() <<
"Unable to start Algorithm " << alg->name() <<
endmsg;
259 if ( ! alg->isEnabled( ) ) {
260 alg->beginRun( ).ignore();
276 if ( ! alg->isEnabled( ) ) alg->endRun( ).
ignore();
281 if ( ! alg->isEnabled( ) ) alg->endRun( ).ignore();
354 return remove( pAlgorithm->
name( ) );
428 pAlgorithm->addRef();
442 StatusCode result = theAlgMgr->createAlgorithm( type, algName, tmp );
445 pAlgorithm =
dynamic_cast<Algorithm*
>(tmp);
448 error() <<
"Unable to create Algorithm " << algName <<
endmsg;
469 for (
const auto&
n : theNames.
value() ) {
487 bool isInverted =
false;
488 std::string::size_type invert = theName.
find_first_of(
":" );
490 while ( std::string::npos != invert
491 && invert < (theName.
size() - 1) && theName[invert+1] ==
':' )
493 if ( std::string::npos != invert ) {
494 if ( theName == theType ) {
497 theType = theType.
substr( 0, invert );
499 theName = theName.
substr( 0, invert );
511 warning() << theName <<
" is not an Algorithm - Failed dynamic cast" <<
endmsg;
512 theAlgorithm =
nullptr;
515 if ( theAlgorithm ) {
518 status =
append( theAlgorithm, theAlgs );
522 warning() << theName <<
" already exists - append failed!!!" <<
endmsg;
531 ON_DEBUG debug() << theName <<
" doesn't exist - created and appended to member list" <<
endmsg;
533 warning() << theName <<
" doesn't exist - creation failed!!!" <<
endmsg;
543 info() <<
"Member list: ";
544 auto ai = theAlgs.
begin();
545 auto li = theLogic.
begin();
546 for ( ; ai != theAlgs.
end(); ++ai, ++li ) {
548 if ( ai != theAlgs.
begin() )
info() <<
", ";
551 info() << alg->name();
555 if (*li)
info() <<
":invert";
574 unsigned int size = theAlgs.
size( );
575 for (
unsigned int i = first;
i < size;
i++) {
576 lastAlgorithm = theAlgs[
i];
583 bool isInverted = theLogic[
i];
584 if ( isInverted ) passed = ! passed;
591 if ( ! passed )
break;
622 for (
auto& alg : theAlgs ) {
623 if ( alg->name( ) == algname ) {
627 info() <<
"Sequencer::remove( ) isn't implemented yet!!!!!" <<
endmsg;
void resetExecuted() override
Reset the executed state of the Algorithm for the duration of the current event.
virtual bool isStopOverride() const
Has the StopOverride mode been set?
StatusCode append(Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
StatusCode remove(Algorithm *pAlgorithm)
Remove the specified algorithm from the sequencer.
StatusCode removeFromBranch(Algorithm *pAlgorithm)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
bool isSuccess() const
Test for a status code of SUCCESS.
Sequencer(const std::string &name, ISvcLocator *svcloc)
Constructor(s)
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
virtual bool branchFilterPassed() const
additional interface methods
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
StatusCode stop() override
Sequencer finalization.
void branchMembershipHandler(Property &theProp)
"BranchMembers" property handler
bool filterPassed() const override
Did this algorithm pass or fail its filter criterion for the last event?
bool m_branchFilterPassed
BooleanProperty m_stopOverride
StatusCode reinitialize() override
Sequencer Reinitialization.
StatusCode beginRun() override
Sequencer beginRun.
const std::vector< Algorithm * > & branchAlgorithms() const
List of branch algorithms.
StatusCode executeMember(Algorithm *theAlgorithm)
Execute member algorithm.
bool isFailure() const
Test for a status code of FAILURE.
StringArrayProperty m_branchNames
StatusCode decodeBranchMemberNames()
Decode branch member name list.
const std::string & name() const override
The identifying name of the algorithm object.
TYPE * get() const
Get interface pointer.
virtual StatusCode setBranchFilterPassed(bool state)
Set the branch filter passed flag for the last event.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
StatusCode decodeNames(StringArrayProperty &theNames, std::vector< Algorithm * > &theAlgs, std::vector< bool > &theLogic)
Decode algorithm names, creating or appending algorithms as appropriate.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Helper class to parse a string of format "type/name".
void setExecuted(bool state) override
Set the executed flag to the specified state.
StatusCode execute() override
The actions to be performed by the sequencer on an event.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
StatusCode decodeMemberNames()
Decode Member Name list.
StatusCode createAndAppendToBranch(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer branch.
This class is used for returning status codes from appropriate routines.
StatusCode sysExecute() override
The actions to be performed by the algorithm on an event.
bool isExecuted() const override
Has this algorithm been executed since the last reset?
T find_first_of(T...args)
The IAlgorithm is the interface implemented by the Algorithm base class.
const TYPE & value() const
explicit conversion
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
Base class from which all concrete algorithm classes should be derived.
Property base class allowing Property* collections to be "homogeneous".
void membershipHandler(Property &theProp)
"Members" property handler
std::vector< Algorithm * > m_branchAlgs
StatusCode endRun() override
Sequencer endRun.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
bool isInitialized() const override
Has the Algorithm already been initialized?
std::vector< bool > m_isInverted
StatusCode createAndAppend(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
bool isEnabled() const override
Is this algorithm enabled or disabled?
const std::string & type() const
StatusCode appendToBranch(Algorithm *pAlgorithm)
Append an algorithm to the sequencer branch.
StringArrayProperty m_names
StatusCode finalize() override
Sequencer finalization.
StatusCode initialize() override
Initialization of a sequencer.
const std::string & name() const
std::string typeName(const std::type_info &typ)
void setFilterPassed(bool state) override
Set the filter passed flag to the specified state.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
void resetExecuted() override
Reset the Sequencer executed state for the current event.
std::vector< bool > m_isBranchInverted
StatusCode start() override
Sequencer finalization.