15 template<
typename T,
typename ...Args>
21 constexpr
bool isDefault(
double x) {
return x == 0; }
26 class populate_JobOptionsSvc_t {
31 template <
typename T>
void process(T&& t) {
35 if (!isDefault(std::get<1>(t))) m_props.
push_back( make_unique_<prop_t>( std::get<0>(t), std::get<1>(t) ) ) ;
37 template <
typename T,
typename... Args>
void process(T&& t, Args&&...
args) {
38 process(std::forward<T>(t)); process(std::forward<Args>(
args)...);
43 for (
const auto&
i : *props ) {
46 return prop->
name() ==
i->name();
50 if (m_props.
empty())
break;
55 template <
typename... Args>
57 process(std::forward<Args>(
args)...);
58 if (!m_props.
empty()) check_veto();
63 ~populate_JobOptionsSvc_t() {
70 template <
typename Stream,
typename Container,
typename Separator,
typename Transform>
71 Stream&
ostream_joiner(Stream& os,
const Container&
c, Separator sep, Transform trans )
74 if (first!=last) { os << trans(*first); ++first; }
75 for (;first!=last;++first) os << sep << trans(*first);
113 if ( !status.
isSuccess() )
return status;
115 m_timerTool = tool<ISequencerTimerTool>(
"SequencerTimerTool" );
132 status = entry.algorithm()->sysInitialize();
134 return Error(
"Can not initialize " + entry.algorithm()->name(),
177 verbose() <<
"Algorithm " << myAlg->
name() <<
" returned filter passed "
178 << (passed ?
"true" :
"false") <<
endmsg;
179 if ( entry.reverse() ) passed = !passed;
197 if (
m_modeOR ? passed : !passed ) {
200 verbose() <<
"SeqPass is now " << (seqPass ?
"true" :
"false") <<
endmsg;
207 verbose() <<
"SeqPass is " << (seqPass ?
"true" :
"false") <<
endmsg;
254 auto jos = service<IJobOptionsSvc>(
"JobOptionsSvc" );
257 auto appMgr = service<IAlgManager>(
"ApplicationMgr");
270 populate_JobOptionsSvc_t populate_guard{ theName, jos,
316 warning() << theName <<
" is not an Algorithm - failed dynamic_cast"
321 warning() <<
"Unable to find or create " << theName <<
endmsg;
330 msg <<
"Member list: ";
334 return ( alg->
name() == typ ) ? alg->
name() : ( typ +
"/" + alg->
name() );
336 if ( !isDefault(
context()) ) msg <<
", with context '" <<
context() <<
"'";
358 {
m_timerTool = tool<ISequencerTimerTool>(
"SequencerTimerTool" ) ; }
void membershipHandler(Property &theProp)
for asynchronous changes in the list of algorithms
Definition of the MsgStream class used to transmit messages.
virtual const std::vector< const Property * > * getProperties(const std::string &client) const =0
Get the properties associated to a given client.
StatusCode execute() override
Algorithm execution.
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
bool m_shortCircuit
Indicates whether to stop processing as soon as possible, or to always execute all subalgorithms...
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
StatusCode createSubAlgorithm(const std::string &type, const std::string &name, Algorithm *&pSubAlg)
Create a sub algorithm.
T forward_as_tuple(T...args)
virtual StatusCode sysStart()=0
Startup method invoked by the framework.
const std::string & rootInTES() const
Returns the "rootInTES" string.
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
bool m_returnOK
Forces the sequencer to return a good status.
bool m_modeOR
Indicates that the OR is wanted instead of AND.
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
const std::string & name() const
property name
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 isSuccess() const
Test for a status code of SUCCESS.
StatusCode Error(const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
Print the error message and return with the given StatusCode.
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
Property * declareProperty(const std::string &name, DataObjectHandle< T > &hndl, const std::string &doc="none") const
bool filterPassed() const override
Did this algorithm pass or fail its filter criterion for the last event?
const std::string & context() const
Returns the "context" string. Used to identify different processing states.
EventContext * getContext() const
get the context
Algorithm * algorithm() const
bool isFailure() const
Test for a status code of FAILURE.
StatusCode endRun() override
Algorithm endRun.
virtual StatusCode sysInitialize()=0
Initialization method invoked by the framework.
void setContext(EventContext *context)
set the context
const std::string & name() const override
The identifying name of the algorithm object.
SimpleProperty concrete class which implements the full Property interface.
TYPE * get() const
Get interface pointer.
ISequencerTimerTool * m_timerTool
Pointer to the timer tool.
Helper class to parse a string of format "type/name".
void setExecuted(bool state) override
Set the executed flag to the specified state.
Main interface for the JobOptions service.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
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 m_measureTime
Flag to measure time.
bool isExecuted() const override
Has this algorithm been executed since the last reset?
StatusCode finalize() override
standard finalization method
The useful base class for data processing algorithms.
StatusCode finalize() override
Algorithm finalization.
const TYPE & value() const
explicit conversion
StatusCode decodeNames()
Decode a vector of string.
Stream & ostream_joiner(Stream &os, Iterator first, Iterator last, Separator sep, OutputElement output=OutputElement{})
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".
Gaudi::StateMachine::State FSMState() const override
returns the current state of the algorithm
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
bool isEnabled() const override
Is this algorithm enabled or disabled?
const std::string & type() const
virtual StatusCode removePropertyFromCatalogue(const std::string &client, const std::string &name)=0
Remove a property from the JobOptions catalog.
virtual StatusCode addPropertyToCatalogue(const std::string &client, const Property &property)=0
Add a property into the JobOptions catalog.
GaudiSequencer(const std::string &name, ISvcLocator *pSvcLocator)
Standard constructor.
const std::string & name() const
std::string typeName(const std::type_info &typ)
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
StatusCode release(const IInterface *interface) const
Manual forced (and 'safe') release of the active tool or service.
void setFilterPassed(bool state) override
Set the filter passed flag to the specified state.
bool m_ignoreFilter
True if one continues always.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
int m_timer
Timer number for the sequencer.
std::vector< AlgorithmEntry > m_entries
List of algorithms to process.
StatusCode beginRun() override
Algorithm beginRun.
StringArrayProperty m_names
Input string, list of algorithms.