Loading [MathJax]/extensions/tex2jax.js
Go to the documentation of this file.
24 #define ON_DEBUG if ( msgLevel( MSG::DEBUG ) )
25 #define ON_VERBOSE if ( msgLevel( MSG::VERBOSE ) )
30 error() <<
"Unable to configure one or more sequencer members " <<
endmsg;
36 error() <<
"Unable to configure one or more branch members " <<
endmsg;
41 is_good = Sequence::initialize();
42 if ( !is_good )
return is_good;
47 is_good =
alg->sysInitialize();
48 if ( is_good.isFailure() ) {
49 error() <<
"Unable to initialize Algorithm " <<
alg->name() <<
endmsg;
63 if (
alg->isEnabled() ) {
alg->reinitialize().ignore(); }
65 return Sequence::reinitialize();
81 const bool passed =
state.filterPassed();
90 if ( !theAlgs.empty() ) {
92 if ( lastAlgorithm == branchAlgorithm ) {
110 state.setState( AlgExecState::State::Done );
120 if (
alg->sysFinalize().isFailure() ) { error() <<
"Unable to finalize Algorithm " <<
alg->name() <<
endmsg; }
122 return Sequence::finalize();
127 if ( !is_good )
return is_good;
131 is_good =
alg->sysStart();
133 error() <<
"Unable to start Algorithm " <<
alg->name() <<
endmsg;
145 if (
alg->sysStop().isFailure() ) { error() <<
"Unable to stop Algorithm " <<
alg->name() <<
endmsg; }
147 return Sequence::stop();
212 pAlgorithm->addRef();
222 StatusCode result = theAlgMgr->createAlgorithm(
type, algName, tmp );
228 error() <<
"Unable to create Algorithm " << algName <<
endmsg;
246 for (
const auto&
n : theNames.value() ) {
264 bool isInverted =
false;
265 std::string::size_type invert = theName.
find_first_of(
":" );
267 while ( std::string::npos != invert && invert < ( theName.
size() - 1 ) && theName[invert + 1] ==
':' )
269 if ( std::string::npos != invert ) {
270 if ( theName == theType ) {
273 theType = theType.
substr( 0, invert );
275 theName = theName.
substr( 0, invert );
287 warning() << theName <<
" is not an Algorithm - Failed dynamic cast" <<
endmsg;
288 theAlgorithm =
nullptr;
291 if ( theAlgorithm ) {
294 status =
append( theAlgorithm, theAlgs );
296 ON_DEBUG debug() << theName <<
" already exists - appended to member list" <<
endmsg;
298 warning() << theName <<
" already exists - append failed!!!" <<
endmsg;
307 ON_DEBUG debug() << theName <<
" doesn't exist - created and appended to member list" <<
endmsg;
309 warning() << theName <<
" doesn't exist - creation failed!!!" <<
endmsg;
318 info() <<
"Member list: ";
319 auto ai = theAlgs.
begin();
320 auto li = theLogic.
begin();
321 for ( ; ai != theAlgs.
end(); ++ai, ++li ) {
323 if ( ai != theAlgs.
begin() ) info() <<
", ";
326 info() <<
alg->name();
330 if ( *li ) info() <<
":invert";
352 for (
auto i = first; i <
size; i++ ) {
353 lastAlgorithm = theAlgs[i];
360 bool isInverted = theLogic[i];
361 if ( isInverted ) passed = !passed;
362 state.setFilterPassed( passed );
368 if ( !passed )
break;
380 if ( theAlgorithm->
execState( context ).
state() != AlgExecState::State::Done ) {
391 for (
auto&
alg : theAlgs ) {
392 if (
alg->name() == algname ) {
396 info() <<
"Sequencer::remove( ) isn't implemented yet!!!!!" <<
endmsg;
406 if ( theAlgs.empty() )
return os <<
"CFTrue";
409 const auto algs_count = theAlgs.size();
412 while ( i < algs_count ) {
415 theAlgs[i]->toControlFlowExpression( os );
StatusCode start() override
Sequencer finalization.
StatusCode removeFromBranch(Gaudi::Algorithm *pAlgorithm)
StatusCode executeMember(Gaudi::Algorithm *theAlgorithm, const EventContext &context) const
Execute member algorithm.
StatusCode reinitialize() override
Sequencer Reinitialization.
StatusCode sysExecute(const EventContext &ctx) override
The actions to be performed by the algorithm on an event.
constexpr auto size(const T &, Args &&...) noexcept
const std::string & name() const override
The identifying name of the algorithm object.
const std::string & type() const override
The type of the algorithm object.
std::vector< Gaudi::Algorithm * > m_branchAlgs
bool branchFilterPassed(const EventContext &ctx) const
additional interface methods
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
StatusCode append(Gaudi::Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
std::mutex m_branchFilterMutex
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
StatusCode createAndAppendToBranch(const std::string &type, const std::string &name, Gaudi::Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer branch.
Gaudi::Property< std::vector< std::string > > m_branchNames
std::vector< bool > m_isInverted
bool isEnabled() const override
Is this algorithm enabled or disabled?
Helper class to parse a string of format "type/name".
StatusCode execute(const EventContext &ctx) const override
The actions to be performed by the sequencer on an event.
StatusCode appendToBranch(Gaudi::Algorithm *pAlgorithm)
Append an algorithm to the sequencer branch.
AlgExecState & execState(const EventContext &ctx) const override
reference to AlgExecState of Alg
Base class from which all concrete algorithm classes should be derived.
const ValueType & value() const
StatusCode remove(Gaudi::Algorithm *pAlgorithm)
Remove the specified algorithm from the sequencer.
Gaudi::Property< std::vector< std::string > > m_names
std::map< EventContext::ContextID_t, bool > m_branchFilterPassed
StatusCode createAndAppend(const std::string &type, const std::string &name, Gaudi::Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Gaudi::Property< bool > m_stopOverride
StatusCode finalize() override
Sequencer finalization.
virtual bool isStopOverride() const
Has the StopOverride mode been set?
StatusCode decodeMemberNames()
Decode Member Name list.
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.
constexpr static const auto SUCCESS
TYPE * get() const
Get interface pointer.
std::string typeName(const std::type_info &typ)
StatusCode decodeBranchMemberNames()
Decode branch member name list.
StatusCode stop() override
Sequencer finalization.
std::ostream & toControlFlowExpression(std::ostream &os) const override
Produce string represention of the control flow expression.
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
bool filterPassed() const
void setBranchFilterPassed(const EventContext &ctx, bool state) const
Set the branch filter passed flag for the last event.
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
T find_first_of(T... args)
constexpr static const auto FAILURE
std::vector< bool > m_isBranchInverted
Implementation of property with value of concrete type.
StatusCode initialize() override
Initialization of a sequencer.