2 #include <initializer_list> 16 template <
typename Container>
17 bool veto(
const Container* props,
const char*
name )
23 template <
typename F,
typename... Args>
24 void for_each_arg( F&& f, Args&&...
args )
34 class populate_JobOptionsSvc_t
40 template <
typename Properties,
typename Key,
typename Value>
43 const auto& key = std::get<0>( arg );
44 const auto& value = std::get<1>( arg );
45 if ( isDefault( value ) || veto( props, key ) )
return;
51 template <
typename... Args>
57 std::forward<Args>(
args )... );
59 ~populate_JobOptionsSvc_t()
85 m_timerTool = tool<ISequencerTimerTool>(
"SequencerTimerTool" );
86 if ( m_timerTool->globalTiming() ) m_measureTime =
true;
88 if ( m_measureTime ) {
89 m_timer = m_timerTool->addTimer(
name() );
90 m_timerTool->increaseIndent();
92 release( m_timerTool );
93 m_timerTool =
nullptr;
97 for (
auto& entry : m_entries ) {
98 if ( m_measureTime ) {
99 entry.setTimer( m_timerTool->addTimer( entry.algorithm()->name() ) );
102 status = entry.algorithm()->sysInitialize();
104 return Error(
"Can not initialize " + entry.algorithm()->name(), status );
107 if ( m_measureTime ) m_timerTool->decreaseIndent();
118 if ( m_measureTime ) m_timerTool->start( m_timer );
124 bool seqPass = !m_modeOR;
128 for (
auto& entry : m_entries ) {
133 if ( m_measureTime ) m_timerTool->
start( entry.timer() );
135 if ( m_measureTime ) m_timerTool->stop( entry.timer() );
139 if ( !m_ignoreFilter ) {
142 verbose() <<
"Algorithm " << myAlg->
name() <<
" returned filter passed " << ( passed ?
"true" :
"false" )
144 if ( entry.reverse() ) passed = !passed;
161 if ( m_modeOR ? passed : !passed ) {
164 if ( m_shortCircuit )
break;
169 if ( !m_ignoreFilter && !m_entries.empty() ) setFilterPassed( m_invert ? !seqPass : seqPass );
172 if ( m_measureTime ) m_timerTool->stop( m_timer );
186 auto jos = service<IJobOptionsSvc>(
"JobOptionsSvc" );
189 auto appMgr = service<IAlgManager>(
"ApplicationMgr" );
190 for (
const auto& item : m_names.value() ) {
205 result = createSubAlgorithm( theType, theName, myAlg );
210 subAlgorithms()->push_back( myAlg );
237 m_entries.emplace_back( myAlg );
238 if ( msgLevel(
MSG::DEBUG ) ) debug() <<
"Added algorithm " << theName <<
endmsg;
240 warning() << theName <<
" is not an Algorithm - failed dynamic_cast" <<
endmsg;
244 warning() <<
"Unable to find or create " << theName <<
endmsg;
251 if ( m_modeOR ) msg <<
"OR ";
252 msg <<
"Member list: ";
258 if ( alg->
name() != typ ) os <<
"/" << alg->
name();
261 if ( !isDefault( context() ) ) msg <<
", with context '" << context() <<
"'";
262 if ( !isDefault( rootInTES() ) ) msg <<
", with rootInTES '" << rootInTES() <<
"'";
276 decodeNames().ignore();
278 if ( !m_measureTime )
return;
282 if ( !m_timerTool ) {
283 m_timerTool = tool<ISequencerTimerTool>(
"SequencerTimerTool" );
286 if ( m_timerTool->globalTiming() ) m_measureTime =
true;
288 m_timer = m_timerTool->addTimer(
name() );
289 m_timerTool->increaseIndent();
291 for (
auto& entry : m_entries ) {
292 entry.setTimer( m_timerTool->addTimer( entry.algorithm()->name() ) );
295 m_timerTool->decreaseIndent();
300 if ( m_invert ) os <<
"~";
302 if ( m_entries.empty() )
return os << ( ( !m_modeOR ) ?
"CFTrue" :
"CFFalse" );
305 if ( m_entries.size() > 1 ) os <<
"seq(";
307 const auto op = m_modeOR ?
" | " :
" & ";
308 const auto last =
end( m_entries );
309 const auto first =
begin( m_entries );
310 for (
auto iterator = first; iterator != last; ++iterator ) {
311 if ( iterator != first ) os << op;
312 if ( iterator->reverse() ) os <<
"~";
313 iterator->algorithm()->toControlFlowExpression( os );
316 if ( m_entries.size() > 1 ) os <<
")";
constexpr static const auto FAILURE
Definition of the MsgStream class used to transmit messages.
StatusCode execute() override
Algorithm execution.
T forward_as_tuple(T...args)
const std::string & name() const override
The identifying name of the algorithm object.
Implementation of property with value of concrete type.
virtual StatusCode sysStart()=0
Startup method invoked by the framework.
bool isExecuted() const override
Has this algorithm been executed since the last reset?
StatusCode initialize() override
Algorithm initialization.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
StatusCode initialize() override
standard initialization method
bool PyHelper() addPropertyToCatalogue(IInterface *p, char *comp, char *name, char *value)
class MergingTransformer< Out(const vector_of_const_< In > void
Algorithm * algorithm() const
virtual StatusCode sysInitialize()=0
Initialization method invoked by the framework.
std::ostream & toControlFlowExpression(std::ostream &os) const override
Produce string represention of the control flow expression.
virtual StatusCode addPropertyToCatalogue(const std::string &client, const Gaudi::Details::PropertyBase &property)=0
Add a property into the JobOptions catalog.
TYPE * get() const
Get interface pointer.
bool isEnabled() const override
Is this algorithm enabled or disabled?
Helper class to parse a string of format "type/name".
Main interface for the JobOptions service.
This class is used for returning status codes from appropriate routines.
virtual const std::vector< const Gaudi::Details::PropertyBase * > * getProperties(const std::string &client) const =0
Get the properties associated to a given client.
constexpr static const auto SUCCESS
StatusCode decodeNames()
Decode a vector of string.
Stream & ostream_joiner(Stream &os, Iterator first, Iterator last, Separator sep, OutputElement output=OutputElement{})
Base class from which all concrete algorithm classes should be derived.
void membershipHandler()
for asynchronous changes in the list of algorithms
const std::string & type() const
virtual StatusCode removePropertyFromCatalogue(const std::string &client, const std::string &name)=0
Remove a property from the JobOptions catalog.
const StatusCode & ignore() const
Ignore/check StatusCode.
bool filterPassed() const override
Did this algorithm pass or fail its filter criterion for the last event?
StatusCode start() override
the default (empty) implementation of IStateful::start() method
AttribStringParser::Iterator begin(const AttribStringParser &parser)
const std::string & name() const
std::string typeName(const std::type_info &typ)
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.