14 #define ON_DEBUG if ( msgLevel( MSG::DEBUG ) ) 15 #define ON_VERBOSE if ( msgLevel( MSG::VERBOSE ) ) 20 error() <<
"Unable to configure one or more sequencer members " <<
endmsg;
26 error() <<
"Unable to configure one or more branch members " <<
endmsg;
31 is_good = Sequence::initialize();
32 if ( !is_good )
return is_good;
37 is_good = alg->sysInitialize();
38 if ( is_good.isFailure() ) {
39 error() <<
"Unable to initialize Algorithm " << alg->name() <<
endmsg;
53 if ( alg->isEnabled() ) { alg->reinitialize().
ignore(); }
55 return Sequence::reinitialize();
71 const bool passed =
state.filterPassed();
80 if ( !theAlgs.empty() ) {
82 if ( lastAlgorithm == branchAlgorithm ) {
100 state.setState( AlgExecState::State::Done );
110 if ( alg->sysFinalize().isFailure() ) {
error() <<
"Unable to finalize Algorithm " << alg->name() <<
endmsg; }
112 return Sequence::finalize();
117 if ( !is_good )
return is_good;
121 is_good = alg->sysStart();
123 error() <<
"Unable to start Algorithm " << alg->name() <<
endmsg;
135 if ( alg->sysStop().isFailure() ) {
error() <<
"Unable to stop Algorithm " << alg->name() <<
endmsg; }
137 return Sequence::stop();
202 pAlgorithm->addRef();
212 StatusCode result = theAlgMgr->createAlgorithm( type, algName, tmp );
218 error() <<
"Unable to create Algorithm " << algName <<
endmsg;
236 for (
const auto&
n : theNames.value() ) {
254 bool isInverted =
false;
255 std::string::size_type invert = theName.
find_first_of(
":" );
257 while ( std::string::npos != invert && invert < ( theName.
size() - 1 ) && theName[invert + 1] ==
':' )
259 if ( std::string::npos != invert ) {
260 if ( theName == theType ) {
263 theType = theType.
substr( 0, invert );
265 theName = theName.
substr( 0, invert );
277 warning() << theName <<
" is not an Algorithm - Failed dynamic cast" <<
endmsg;
278 theAlgorithm =
nullptr;
281 if ( theAlgorithm ) {
284 status =
append( theAlgorithm, theAlgs );
288 warning() << theName <<
" already exists - append failed!!!" <<
endmsg;
297 ON_DEBUG debug() << theName <<
" doesn't exist - created and appended to member list" <<
endmsg;
299 warning() << theName <<
" doesn't exist - creation failed!!!" <<
endmsg;
308 info() <<
"Member list: ";
309 auto ai = theAlgs.
begin();
310 auto li = theLogic.
begin();
311 for ( ; ai != theAlgs.
end(); ++ai, ++li ) {
313 if ( ai != theAlgs.
begin() )
info() <<
", ";
316 info() << alg->name();
320 if ( *li )
info() <<
":invert";
342 for (
auto i = first; i <
size; i++ ) {
343 lastAlgorithm = theAlgs[i];
350 bool isInverted = theLogic[i];
351 if ( isInverted ) passed = !passed;
352 state.setFilterPassed( passed );
358 if ( !passed )
break;
370 if ( theAlgorithm->
execState( context ).
state() != AlgExecState::State::Done ) {
381 for (
auto& alg : theAlgs ) {
382 if ( alg->name() == algname ) {
386 info() <<
"Sequencer::remove( ) isn't implemented yet!!!!!" <<
endmsg;
396 if ( theAlgs.empty() )
return os <<
"CFTrue";
399 const auto algs_count = theAlgs.size();
402 while ( i < algs_count ) {
405 theAlgs[i]->toControlFlowExpression( os );
StatusCode createAndAppend(const std::string &type, const std::string &name, Gaudi::Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
virtual bool isStopOverride() const
Has the StopOverride mode been set?
bool isEnabled() const override
Is this algorithm enabled or disabled?
StatusCode removeFromBranch(Gaudi::Algorithm *pAlgorithm)
Implementation of property with value of concrete type.
Gaudi::Property< std::vector< std::string > > m_branchNames
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
const std::string & name() const override
The identifying name of the algorithm object.
void setBranchFilterPassed(const EventContext &ctx, bool state) const
Set the branch filter passed flag for the last event.
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
constexpr static const auto SUCCESS
StatusCode stop() override
Sequencer finalization.
std::vector< Gaudi::Algorithm * > m_branchAlgs
StatusCode reinitialize() override
Sequencer Reinitialization.
This class represents an entry point to all the event specific data.
StatusCode executeMember(Gaudi::Algorithm *theAlgorithm, const EventContext &context) const
Execute member algorithm.
constexpr auto size(const C &c) noexcept(noexcept(c.size())) -> decltype(c.size())
StatusCode decodeBranchMemberNames()
Decode branch member name list.
std::mutex m_branchFilterMutex
AlgExecState & execState(const EventContext &ctx) const override
reference to AlgExecState of Alg
TYPE * get() const
Get interface pointer.
Gaudi::Property< bool > m_stopOverride
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
StatusCode append(Gaudi::Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Helper class to parse a string of format "type/name".
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
StatusCode decodeMemberNames()
Decode Member Name list.
This class is used for returning status codes from appropriate routines.
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
bool branchFilterPassed(const EventContext &ctx) const
additional interface methods
StatusCode decodeNames(Gaudi::Property< std::vector< std::string >> &theNames, std::vector< Gaudi::Algorithm * > &theAlgs, std::vector< bool > &theLogic)
Decode algorithm names, creating or appending algorithms as appropriate.
Gaudi::Property< std::vector< std::string > > m_names
T find_first_of(T...args)
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
StatusCode remove(Gaudi::Algorithm *pAlgorithm)
Remove the specified algorithm from the sequencer.
std::ostream & toControlFlowExpression(std::ostream &os) const override
Produce string represention of the control flow expression.
StatusCode appendToBranch(Gaudi::Algorithm *pAlgorithm)
Append an algorithm to the sequencer branch.
The IAlgorithm is the interface implemented by the Algorithm base class.
const std::string & type() const override
The type of the algorithm object.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::vector< bool > m_isInverted
const std::string & type() const
const StatusCode & ignore() const
Ignore/check StatusCode.
Base class from which all concrete algorithm classes should be derived.
std::map< EventContext::ContextID_t, bool > m_branchFilterPassed
constexpr static const auto FAILURE
StatusCode execute(const EventContext &ctx) const override
The actions to be performed by the sequencer on an event.
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
StatusCode finalize() override
Sequencer finalization.
StatusCode initialize() override
Initialization of a sequencer.
bool filterPassed() const
const std::string & name() const
std::string typeName(const std::type_info &typ)
StatusCode createAndAppendToBranch(const std::string &type, const std::string &name, Gaudi::Algorithm *&pAlgorithm )
Create a algorithm and append it to the sequencer branch.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StatusCode sysExecute(const EventContext &ctx) override
The actions to be performed by the algorithm on an event.
std::vector< bool > m_isBranchInverted
StatusCode start() override
Sequencer finalization.