3 #include "GaudiKernel/AlgFactory.h"
4 #include "GaudiKernel/IAlgManager.h"
5 #include "GaudiKernel/IJobOptionsSvc.h"
6 #include "GaudiAlg/ISequencerTimerTool.h"
24 declareProperty(
"Members" , m_names );
25 declareProperty(
"ModeOR" , m_modeOR =
false );
26 declareProperty(
"MeasureTime" , m_measureTime =
false );
27 declareProperty(
"ReturnOK" , m_returnOK =
false );
28 declareProperty(
"NumberOfThreads", m_nthreads = 0 );
49 m_timerTool = tool<ISequencerTimerTool>(
"SequencerTimerTool" );
61 std::vector<AlgorithmEntry>::iterator itE;
70 return Error(
"Can not initialize " + myAlg->
name(),
82 m_nthreads = tbb::task_scheduler_init::default_num_threads();
98 for (std::vector<AlgorithmEntry>::iterator itE =
m_entries.begin();
m_entries.end() != itE; ++itE ) {
112 for( std::vector<AlgorithmEntry>::const_iterator it =
m_entries.begin(); it !=
m_entries.end(); ++it ){
114 <<
" around the algorithm " << it->algorithm()->name()
115 <<
" received return status code " << it->m_returncode
119 for( std::vector<AlgorithmEntry>::const_iterator it =
m_entries.begin(); it !=
m_entries.end(); ++it )
120 if ( !(it->m_returncode.isSuccess()) )
return it->m_returncode;
145 bool addedContext =
false;
146 bool addedRootInTES =
false;
147 bool addedGlobalTimeOffset =
false;
152 const std::vector<std::string>& nameVector =
m_names.
value();
153 std::vector<std::string>::const_iterator it;
154 for ( it = nameVector.begin(); nameVector.end() != it; it++ ) {
156 const std::string &theName = typeName.
name();
157 const std::string &theType = typeName.
type();
167 bool foundContext =
false;
168 bool foundRootInTES =
false;
169 bool foundGlobalTimeOffset =
false;
171 if ( 0 != properties ) {
173 for ( std::vector<const Property*>::const_iterator itProp = properties->begin();
174 itProp != properties->end();
178 if (
"Context" == (*itProp)->name() ) {
181 if (
"RootInTES" == (*itProp)->name() ) {
182 foundRootInTES =
true;
184 if (
"GlobalTimeOffset" == (*itProp)->name() ) {
185 foundGlobalTimeOffset =
true;
190 if ( !foundContext &&
"" !=
context() ) {
195 if ( !foundRootInTES &&
"" !=
rootInTES() ) {
198 addedRootInTES =
true;
203 addedGlobalTimeOffset =
true;
208 result = createSubAlgorithm( theType, theName, myAlg );
215 subAlgorithms()->push_back(myAlg);
222 if ( addedContext ) {
224 addedContext =
false;
226 if ( addedRootInTES ) {
228 addedRootInTES =
false;
230 if ( addedGlobalTimeOffset ) {
232 addedGlobalTimeOffset =
false;
265 warning() << theName <<
" is not an Algorithm - failed dynamic_cast"
270 warning() <<
"Unable to find or create " << theName <<
endmsg;
282 msg <<
"Member list: ";
283 std::vector<AlgorithmEntry>::iterator itE;
287 if ( myAlg->
name() == myAlgType ) {
288 msg << myAlg->
name();
290 msg << myAlgType <<
"/" << myAlg->
name();
292 if ( itE+1 !=
m_entries.end() ) msg <<
", ";
294 if (
"" !=
context() ) msg <<
", with context '" <<
context() <<
"'";
318 {
m_timerTool = tool<ISequencerTimerTool>(
"SequencerTimerTool" ) ; }
325 for ( std::vector<AlgorithmEntry>::iterator itE =
m_entries.begin() ;
virtual SmartIF< IAlgorithm > & algorithm(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
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.
#define DECLARE_ALGORITHM_FACTORY(x)
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
virtual StatusCode sysStart()=0
Startup method invoked by the framework.
const std::string & rootInTES() const
Returns the "rootInTES" string.
virtual ~GaudiParallelizer()
Destructor.
StatusCode initialize() override
standard initialization method
bool isSuccess() const
Test for a status code of SUCCESS.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
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 & warning() const
shortcut for the method msgStream(MSG::WARNING)
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
StatusCode decodeNames()
Decode a vector of string.
const std::string & context() const
Returns the "context" string. Used to identify different processing states.
bool m_modeOR
Indicates that the OR is wanted instead of AND.
bool isFailure() const
Test for a status code of FAILURE.
virtual StatusCode sysInitialize()=0
Initialization method invoked by the framework.
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
virtual StatusCode finalize()
Algorithm finalization.
const std::string & name() const override
The identifying name of the algorithm object.
StringArrayProperty m_names
Input string, list of algorithms.
TYPE * get() const
Get interface pointer.
Helper class to parse a string of format "type/name".
Main interface for the JobOptions service.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
unsigned long addRef() override
Reference Interface instance.
This class is used for returning status codes from appropriate routines.
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.
const TYPE & value() const
explicit conversion
tbb::task_group m_task_group
TBB task group.
Base class from which all concrete algorithm classes should be derived.
Property base class allowing Property* collections to be "homogeneous".
virtual StatusCode execute()
Algorithm execution.
bool isValid() const
Allow for check if smart pointer is valid.
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.
std::vector< AlgorithmEntry > m_entries
List of algorithms to process.
void membershipHandler(Property &theProp)
for asynchronous changes in the list of algorithms
virtual StatusCode addPropertyToCatalogue(const std::string &client, const Property &property)=0
Add a property into the JobOptions catalog.
ISequencerTimerTool * m_timerTool
Pointer to the timer tool.
bool m_measureTime
Flag to measure time.
int m_timer
Timer number for the sequencer.
const std::string & name() const
double globalTimeOffset() const
Returns the "globalTimeOffset" double.
std::string typeName(const std::type_info &typ)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
unsigned short m_nthreads
Number of threads in the thread pool.
StatusCode sysInitialize() override
Initialization method invoked by the framework.
StatusCode release(const IInterface *interface) const
Manual forced (and 'safe') release of the active tool or service.
void run(GaudiParallelizer &prlzr)
Thread task executor method to wrap an algorithm execution in.
virtual StatusCode initialize()
Algorithm initialization.
MSG::Level msgLevel() const
get the output level from the embedded MsgStream