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 ) )
31 error() <<
"Unable to configure one or more sequencer members " <<
endmsg;
37 error() <<
"Unable to configure one or more branch members " <<
endmsg;
43 if ( !is_good )
return is_good;
48 is_good =
alg->sysInitialize();
49 if ( is_good.isFailure() ) {
50 error() <<
"Unable to initialize Algorithm " <<
alg->name() <<
endmsg;
64 if (
alg->isEnabled() ) {
alg->reinitialize().ignore(); }
82 const bool passed =
state.filterPassed();
91 if ( !theAlgs.empty() ) {
93 if ( lastAlgorithm == branchAlgorithm ) {
111 state.setState( AlgExecState::State::Done );
121 if (
alg->sysFinalize().isFailure() ) { error() <<
"Unable to finalize Algorithm " <<
alg->name() <<
endmsg; }
128 if ( !is_good )
return is_good;
132 is_good =
alg->sysStart();
134 error() <<
"Unable to start Algorithm " <<
alg->name() <<
endmsg;
146 if (
alg->sysStop().isFailure() ) { error() <<
"Unable to stop Algorithm " <<
alg->name() <<
endmsg; }
211 pAlgorithm->addRef();
221 StatusCode result = theAlgMgr->createAlgorithm(
type, algName, tmp );
227 error() <<
"Unable to create Algorithm " << algName <<
endmsg;
245 for (
const auto&
n : theNames.value() ) {
263 bool isInverted =
false;
264 std::string::size_type invert = theName.
find_first_of(
":" );
266 while ( std::string::npos != invert && invert < ( theName.
size() - 1 ) && theName[invert + 1] ==
':' )
268 if ( std::string::npos != invert ) {
269 if ( theName == theType ) {
272 theType = theType.
substr( 0, invert );
274 theName = theName.
substr( 0, invert );
286 warning() << theName <<
" is not an Algorithm - Failed dynamic cast" <<
endmsg;
287 theAlgorithm =
nullptr;
290 if ( theAlgorithm ) {
293 status =
append( theAlgorithm, theAlgs );
295 ON_DEBUG debug() << theName <<
" already exists - appended to member list" <<
endmsg;
297 warning() << theName <<
" already exists - append failed!!!" <<
endmsg;
306 ON_DEBUG debug() << theName <<
" doesn't exist - created and appended to member list" <<
endmsg;
308 warning() << theName <<
" doesn't exist - creation failed!!!" <<
endmsg;
317 info() <<
"Member list: ";
318 auto ai = theAlgs.
begin();
319 auto li = theLogic.
begin();
320 for ( ; ai != theAlgs.
end(); ++ai, ++li ) {
322 if ( ai != theAlgs.
begin() ) info() <<
", ";
325 info() <<
alg->name();
329 if ( *li ) info() <<
":invert";
349 auto exists = [&](
const std::string_view loc ) ->
bool {
351 return evtSvc()->retrieveObject( loc, tmp ).isSuccess();
371 for (
auto i = first; i <
size; i++ ) {
372 lastAlgorithm = theAlgs[i];
379 bool isInverted = theLogic[i];
380 if ( isInverted ) passed = !passed;
386 if (
m_modeOR ? passed : !passed ) {
402 if ( theAlgorithm->
execState( context ).
state() != AlgExecState::State::Done ) {
413 for (
auto&
alg : theAlgs ) {
414 if (
alg->name() == algname ) {
418 info() <<
"Sequencer::remove( ) isn't implemented yet!!!!!" <<
endmsg;
430 if ( theAlgs.empty() )
return os << ( ( !
m_modeOR ) ?
"CFTrue" :
"CFFalse" );
433 if ( theAlgs.size() > 1 ) os <<
"seq(";
435 const auto algs_count = theAlgs.size();
438 while ( i < algs_count ) {
441 theAlgs[i]->toControlFlowExpression( os );
444 if ( theAlgs.size() > 1 ) os <<
')';
std::ostream & toControlFlowExpression(std::ostream &os) const override
Produce string representation of the control flow expression.
StatusCode sysExecute(const EventContext &ctx) override
The actions to be performed by the algorithm on an event.
void setBranchFilterPassed(const EventContext &ctx, bool state) const
Set the branch filter passed flag for the last event.
constexpr auto size(const T &, Args &&...) noexcept
StatusCode initialize() override
Initialization method invoked by the framework.
const std::string & name() const override
The identifying name of the algorithm object.
StatusCode reinitialize() override
Sequencer Reinitialization.
StatusCode stop() override
Sequencer stop.
const std::string & type() const override
The type of the algorithm object.
StatusCode executeMember(Gaudi::Algorithm *theAlgorithm, const EventContext &context) const
Execute member algorithm.
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
StatusCode appendToBranch(Gaudi::Algorithm *pAlgorithm)
Append an algorithm to the sequencer branch.
Gaudi::Property< std::vector< std::string > > m_names
StatusCode finalize() override
System finalization.
const std::vector< Gaudi::Algorithm * > & branchAlgorithms() const
List of branch algorithms.
StatusCode append(Gaudi::Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Gaudi::Property< bool > m_modeOR
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
StatusCode stop() override
System stop.
Gaudi::Property< std::vector< std::string > > m_requireObjs
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
StatusCode start() override
System start.
StatusCode removeFromBranch(Gaudi::Algorithm *pAlgorithm)
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< bool > m_shortCircuit
bool isEnabled() const override
Is this algorithm enabled or disabled?
Helper class to parse a string of format "type/name".
std::vector< bool > m_isInverted
StatusCode initialize() override
Initialization of a sequencer.
StatusCode finalize() override
Sequencer finalization.
std::map< EventContext::ContextID_t, bool > m_branchFilterPassed
double * begin(CLHEP::HepVector &v)
AlgExecState & execState(const EventContext &ctx) const override
reference to AlgExecState of Alg
Base class from which all concrete algorithm classes should be derived.
std::vector< bool > m_isBranchInverted
StatusCode decodeMemberNames()
Decode Member Name list.
bool branchFilterPassed(const EventContext &ctx) const
Was the branch filter passed for the last event?
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StatusCode execute(const EventContext &ctx) const override
The actions to be performed by the sequencer on an event.
Gaudi::Property< std::vector< std::string > > m_branchNames
Header file for std:chrono::duration-based Counters.
StatusCode start() override
Sequencer finalization.
constexpr static const auto SUCCESS
SmartIF< IDataProviderSvc > & evtSvc() const
shortcut for method eventSvc
TYPE * get() const
Get interface pointer.
std::string typeName(const std::type_info &typ)
Gaudi::Property< std::vector< std::string > > m_vetoObjs
const std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
bool filterPassed() const
T find_first_of(T... args)
StatusCode decodeBranchMemberNames()
Decode branch member name list.
StatusCode createAndAppendToBranch(const std::string &type, const std::string &name, Gaudi::Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer branch.
StatusCode createAndAppend(const std::string &type, const std::string &name, Gaudi::Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
Gaudi::Property< bool > m_invert
StatusCode remove(Gaudi::Algorithm *pAlgorithm)
Remove the specified algorithm from the sequencer.
constexpr static const auto FAILURE
std::vector< Gaudi::Algorithm * > m_branchAlgs
Gaudi::Property< bool > m_ignoreFilter
Implementation of property with value of concrete type.
std::mutex m_branchFilterMutex
StatusCode reinitialize() override
Reinitialization method invoked by the framework.