GaudiParallelizer Class Reference

#include <src/GaudiParallelizer.h>

Inheritance diagram for GaudiParallelizer:
Collaboration diagram for GaudiParallelizer:

Classes

class  AlgorithmEntry
 

Public Member Functions

 GaudiParallelizer (const std::string &name, ISvcLocator *pSvcLocator)
 Standard constructor. More...
 
virtual ~GaudiParallelizer ()
 Destructor. More...
 
virtual StatusCode initialize ()
 Algorithm initialization. More...
 
virtual StatusCode execute ()
 Algorithm execution. More...
 
virtual StatusCode finalize ()
 Algorithm finalization. More...
 
void membershipHandler (Property &theProp)
 for asynchronous changes in the list of algorithms More...
 
- Public Member Functions inherited from GaudiAlgorithm
StatusCode initialize () override
 standard initialization method More...
 
StatusCode execute () override
 standard execution method More...
 
StatusCode finalize () override
 standard finalization method More...
 
StatusCode sysExecute () override
 the generic actions for the execution. More...
 
void put (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const
 Register a data object or container into Gaudi Event Transient Store. More...
 
void put (DataObject *object, const std::string &address, const bool useRootInTES=true) const
 Register a data object or container into Gaudi Event Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Templated access to the data in Gaudi Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type getIfExists (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Templated access to the data in Gaudi Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type get (const std::string &location, const bool useRootInTES=true) const
 Templated access to the data from Gaudi Event Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type getIfExists (const std::string &location, const bool useRootInTES=true) const
 Templated access to the data in Gaudi Transient Store. More...
 
template<class TYPE >
TYPE * getDet (IDataProviderSvc *svc, const std::string &location) const
 Templated access to the detector data from the Gaudi Detector Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type getDetIfExists (IDataProviderSvc *svc, const std::string &location) const
 Templated access to the detector data from the Gaudi Detector Transient Store. More...
 
template<class TYPE >
TYPE * getDet (const std::string &location) const
 Templated access to the detector data from the Gaudi Detector Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type getDetIfExists (const std::string &location) const
 Templated access to the detector data from the Gaudi Detector Transient Store. More...
 
template<class TYPE >
bool exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Check the existence of a data object or container in the Gaudi Transient Event Store. More...
 
template<class TYPE >
bool exist (const std::string &location, const bool useRootInTES=true) const
 Check the existence of a data object or container in the Gaudi Transient Event Store. More...
 
template<class TYPE >
bool existDet (IDataProviderSvc *svc, const std::string &location) const
 Check the existence of detector objects in the Gaudi Transient Detector Store. More...
 
template<class TYPE >
bool existDet (const std::string &location) const
 Check the existence of detector objects in the Gaudi Transient Detector Store. More...
 
template<class TYPE , class TYPE2 >
Gaudi::Utils::GetData< TYPE >::return_type getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Get the existing data object from Gaudi Event Transient store. More...
 
template<class TYPE , class TYPE2 >
Gaudi::Utils::GetData< TYPE >::return_type getOrCreate (const std::string &location, const bool useRootInTES=true) const
 Get the existing data object from Gaudi Event Transient store. More...
 
 GaudiAlgorithm (const std::string &name, ISvcLocator *pSvcLocator)
 Standard constructor (protected) More...
 
 ~GaudiAlgorithm () override=default
 destructor, virtual and protected More...
 
SmartIF< INTupleSvc > & evtColSvc () const
 Access the standard event collection service. More...
 
 GaudiAlgorithm (const GaudiAlgorithm &)=delete
 
GaudiAlgorithmoperator= (const GaudiAlgorithm &)=delete
 
StatusCode initialize () override
 standard initialization method More...
 
StatusCode execute () override
 standard execution method More...
 
StatusCode finalize () override
 standard finalization method More...
 
StatusCode sysExecute () override
 the generic actions for the execution. More...
 
void put (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const
 Register a data object or container into Gaudi Event Transient Store. More...
 
void put (DataObject *object, const std::string &address, const bool useRootInTES=true) const
 Register a data object or container into Gaudi Event Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Templated access to the data in Gaudi Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type getIfExists (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Templated access to the data in Gaudi Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type get (const std::string &location, const bool useRootInTES=true) const
 Templated access to the data from Gaudi Event Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type getIfExists (const std::string &location, const bool useRootInTES=true) const
 Templated access to the data in Gaudi Transient Store. More...
 
template<class TYPE >
TYPE * getDet (IDataProviderSvc *svc, const std::string &location) const
 Templated access to the detector data from the Gaudi Detector Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type getDetIfExists (IDataProviderSvc *svc, const std::string &location) const
 Templated access to the detector data from the Gaudi Detector Transient Store. More...
 
template<class TYPE >
TYPE * getDet (const std::string &location) const
 Templated access to the detector data from the Gaudi Detector Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type getDetIfExists (const std::string &location) const
 Templated access to the detector data from the Gaudi Detector Transient Store. More...
 
template<class TYPE >
bool exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Check the existence of a data object or container in the Gaudi Transient Event Store. More...
 
template<class TYPE >
bool exist (const std::string &location, const bool useRootInTES=true) const
 Check the existence of a data object or container in the Gaudi Transient Event Store. More...
 
template<class TYPE >
bool existDet (IDataProviderSvc *svc, const std::string &location) const
 Check the existence of detector objects in the Gaudi Transient Detector Store. More...
 
template<class TYPE >
bool existDet (const std::string &location) const
 Check the existence of detector objects in the Gaudi Transient Detector Store. More...
 
template<class TYPE , class TYPE2 >
Gaudi::Utils::GetData< TYPE >::return_type getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Get the existing data object from Gaudi Event Transient store. More...
 
template<class TYPE , class TYPE2 >
Gaudi::Utils::GetData< TYPE >::return_type getOrCreate (const std::string &location, const bool useRootInTES=true) const
 Get the existing data object from Gaudi Event Transient store. More...
 
 GaudiAlgorithm (const std::string &name, ISvcLocator *pSvcLocator)
 Standard constructor (protected) More...
 
 ~GaudiAlgorithm () override=default
 destructor, virtual and protected More...
 
SmartIF< INTupleSvc > & evtColSvc () const
 Access the standard event collection service. More...
 
 GaudiAlgorithm (const GaudiAlgorithm &)=delete
 
GaudiAlgorithmoperator= (const GaudiAlgorithm &)=delete
 
- Public Member Functions inherited from GaudiCommon< Algorithm >
Gaudi::Utils::GetData< TYPE >::return_type get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Templated access to the data in Gaudi Transient Store. More...
 
Gaudi::Utils::GetData< TYPE >::return_type get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Templated access to the data in Gaudi Transient Store. More...
 
Gaudi::Utils::GetData< TYPE >::return_type getIfExists (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Quicker version of the get function which bypasses the check on the retrieved data. More...
 
Gaudi::Utils::GetData< TYPE >::return_type getIfExists (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Quicker version of the get function which bypasses the check on the retrieved data. More...
 
bool exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Check the existence of a data object or container in the Gaudi Transient Event Store. More...
 
bool exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Check the existence of a data object or container in the Gaudi Transient Event Store. More...
 
Gaudi::Utils::GetData< TYPE >::return_type getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Get the existing data object from Gaudi Event Transient store. More...
 
Gaudi::Utils::GetData< TYPE >::return_type getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Get the existing data object from Gaudi Event Transient store. More...
 
DataObjectput (IDataProviderSvc *svc, DataObject *object, const std::string &location, const bool useRootInTES=true) const
 Register a data object or container into Gaudi Event Transient Store. More...
 
DataObjectput (IDataProviderSvc *svc, DataObject *object, const std::string &location, const bool useRootInTES=true) const
 Register a data object or container into Gaudi Event Transient Store. More...
 
TOOL * tool (const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const
 Useful method for the easy location of tools. More...
 
TOOL * tool (const std::string &type, const IInterface *parent=0, bool create=true) const
 A useful method for the easy location of tools. More...
 
TOOL * tool (const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const
 Useful method for the easy location of tools. More...
 
TOOL * tool (const std::string &type, const IInterface *parent=0, bool create=true) const
 A useful method for the easy location of tools. More...
 
SmartIF< SERVICE > svc (const std::string &name, const bool create=true) const
 A useful method for the easy location of services. More...
 
SmartIF< SERVICE > svc (const std::string &name, const bool create=true) const
 A useful method for the easy location of services. More...
 
IUpdateManagerSvcupdMgrSvc () const
 Short-cut to locate the Update Manager Service. More...
 
IUpdateManagerSvcupdMgrSvc () const
 Short-cut to locate the Update Manager Service. More...
 
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. More...
 
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. More...
 
StatusCode Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
 Print the warning message and return with the given StatusCode. More...
 
StatusCode Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
 Print the warning message and return with the given StatusCode. More...
 
StatusCode Info (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const size_t mx=10) const
 Print the info message and return with the given StatusCode. More...
 
StatusCode Info (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const size_t mx=10) const
 Print the info message and return with the given StatusCode. More...
 
StatusCode Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const
 Print the message and return with the given StatusCode. More...
 
StatusCode Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const
 Print the message and return with the given StatusCode. More...
 
void Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Assertion - throw exception if the given condition is not fulfilled. More...
 
void Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Assertion - throw exception if the given condition is not fulfilled. More...
 
void Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Assertion - throw exception if the given condition is not fulfilled. More...
 
void Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Assertion - throw exception if the given condition is not fulfilled. More...
 
void Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Create and (re)-throw a given GaudiException. More...
 
void Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Create and (re)-throw a given exception. More...
 
void Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Create and throw an exception with the given message. More...
 
void Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Create and (re)-throw a given GaudiException. More...
 
void Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Create and (re)-throw a given exception. More...
 
void Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Create and throw an exception with the given message. More...
 
const Statisticscounters () const
 accessor to all counters More...
 
const Statisticscounters () const
 accessor to all counters More...
 
StatEntitycounter (const std::string &tag) const
 accessor to certain counter by name More...
 
StatEntitycounter (const std::string &tag) const
 accessor to certain counter by name More...
 
void resetMsgStream () const
 
void resetMsgStream () const
 
bool typePrint () const
 Insert the actual C++ type of the algorithm/tool in the messages ? More...
 
bool typePrint () const
 Insert the actual C++ type of the algorithm/tool in the messages ? More...
 
bool propsPrint () const
 Print properties at initialization ? More...
 
bool propsPrint () const
 Print properties at initialization ? More...
 
bool statPrint () const
 Print statistical counters at finalization ? More...
 
bool statPrint () const
 Print statistical counters at finalization ? More...
 
bool errorsPrint () const
 Print error counters at finalization ? More...
 
bool errorsPrint () const
 Print error counters at finalization ? More...
 
long printStat (const MSG::Level level=MSG::ALWAYS) const
 perform the actual printout of statistical counters More...
 
long printStat (const MSG::Level level=MSG::ALWAYS) const
 perform the actual printout of statistical counters More...
 
long printErrors (const MSG::Level level=MSG::ALWAYS) const
 perform the actual printout of error counters More...
 
long printErrors (const MSG::Level level=MSG::ALWAYS) const
 perform the actual printout of error counters More...
 
long printProps (const MSG::Level level=MSG::ALWAYS) const
 perform the actual printout of properties More...
 
long printProps (const MSG::Level level=MSG::ALWAYS) const
 perform the actual printout of properties More...
 
void registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=nullptr)
 register the current instance to the UpdateManagerSvc as a consumer for a condition. More...
 
void registerCondition (const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL)
 register the current instance to the UpdateManagerSvc as a consumer for a condition. More...
 
void registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL)
 just to avoid conflicts with the version using a pointer to a template class. More...
 
void registerCondition (TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL)
 register the current instance to the UpdateManagerSvc as a consumer for a condition. More...
 
void registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=nullptr)
 register the current instance to the UpdateManagerSvc as a consumer for a condition. More...
 
void registerCondition (const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL)
 register the current instance to the UpdateManagerSvc as a consumer for a condition. More...
 
void registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL)
 just to avoid conflicts with the version using a pointer to a template class. More...
 
void registerCondition (TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL)
 register the current instance to the UpdateManagerSvc as a consumer for a condition. More...
 
StatusCode runUpdate ()
 asks the UpdateManagerSvc to perform an update of the instance (if needed) without waiting the next BeginEvent incident. More...
 
StatusCode runUpdate ()
 asks the UpdateManagerSvc to perform an update of the instance (if needed) without waiting the next BeginEvent incident. More...
 
 GaudiCommon (const std::string &name, ISvcLocator *pSvcLocator)
 Algorithm constructor. More...
 
 GaudiCommon (const std::string &type, const std::string &name, const IInterface *parent)
 Tool constructor. More...
 
 GaudiCommon (const std::string &name, ISvcLocator *pSvcLocator)
 Algorithm constructor. More...
 
 GaudiCommon (const std::string &type, const std::string &name, const IInterface *parent)
 Tool constructor. More...
 
StatusCode initialize () override
 standard initialization method More...
 
StatusCode initialize () override
 standard initialization method More...
 
StatusCode finalize () override
 standard finalization method More...
 
StatusCode finalize () override
 standard finalization method More...
 
StatusCode release (const IInterface *interface) const
 Manual forced (and 'safe') release of the active tool or service. More...
 
StatusCode release (const IInterface *interface) const
 Manual forced (and 'safe') release of the active tool or service. More...
 
const Servicesservices () const
 get the list of aquired services More...
 
const Servicesservices () const
 get the list of aquired services More...
 
const std::string & context () const
 Returns the "context" string. Used to identify different processing states. More...
 
const std::string & context () const
 Returns the "context" string. Used to identify different processing states. More...
 
const std::string & rootInTES () const
 Returns the "rootInTES" string. More...
 
const std::string & rootInTES () const
 Returns the "rootInTES" string. More...
 
double globalTimeOffset () const
 Returns the "globalTimeOffset" double. More...
 
double globalTimeOffset () const
 Returns the "globalTimeOffset" double. More...
 
const std::string fullTESLocation (const std::string &location, const bool useRootInTES) const
 Returns the full correct event location given the rootInTes settings. More...
 
const std::string fullTESLocation (const std::string &location, const bool useRootInTES) const
 Returns the full correct event location given the rootInTes settings. More...
 
- Public Member Functions inherited from CommonMessaging< BASE >
 ~CommonMessaging () override=default
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
 ~CommonMessaging () override=default
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 

Protected Member Functions

StatusCode decodeNames ()
 Decode a vector of string. More...
 
- Protected Member Functions inherited from GaudiCommon< Algorithm >
 ~GaudiCommon () override=default
 Destructor. More...
 
 ~GaudiCommon () override=default
 Destructor. More...
 
StatusCode releaseTool (const IAlgTool *tool) const
 manual forced (and 'safe') release of the tool More...
 
StatusCode releaseTool (const IAlgTool *tool) const
 manual forced (and 'safe') release of the tool More...
 
StatusCode releaseSvc (const IInterface *svc) const
 manual forced (and 'safe') release of the service More...
 
StatusCode releaseSvc (const IInterface *svc) const
 manual forced (and 'safe') release of the service More...
 
- Protected Member Functions inherited from CommonMessaging< BASE >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Private Attributes

StringArrayProperty m_names
 Input string, list of algorithms. More...
 
std::vector< AlgorithmEntrym_entries
 List of algorithms to process. More...
 
bool m_modeOR
 Indicates that the OR is wanted instead of AND. More...
 
bool m_measureTime
 Flag to measure time. More...
 
bool m_returnOK
 Forces the sequencer to return a good status. More...
 
ISequencerTimerToolm_timerTool
 Pointer to the timer tool. More...
 
int m_timer
 Timer number for the sequencer. More...
 
tbb::task_group m_task_group
 TBB task group. More...
 
unsigned short m_nthreads
 Number of threads in the thread pool. More...
 

Additional Inherited Members

- Public Types inherited from CommonMessaging< BASE >
using base_class = CommonMessaging
 
using base_class = CommonMessaging
 
- Protected Types inherited from GaudiCommon< Algorithm >
typedef std::map< std::string, StatEntityStatistics
 the actual type of general counters More...
 
typedef std::map< std::string, StatEntityStatistics
 the actual type of general counters More...
 
typedef std::map< std::string, unsigned int > Counter
 the actual type error/warning counter More...
 
typedef std::map< std::string, unsigned int > Counter
 the actual type error/warning counter More...
 
typedef std::vector< IAlgTool * > AlgTools
 storage for active tools More...
 
typedef std::vector< IAlgTool * > AlgTools
 storage for active tools More...
 
typedef std::vector< SmartIF< IService > > Services
 storage for active services More...
 
typedef std::vector< SmartIF< IService > > Services
 storage for active services More...
 
- Protected Attributes inherited from GaudiCommon< Algorithm >
SmartIF< ICounterSummarySvcm_counterSummarySvc
 a pointer to the CounterSummarySvc More...
 
std::vector< std::string > m_counterList
 list of counters to declare. Set by property CounterList. This can be a regular expression. More...
 
std::vector< std::string > m_statEntityList
 
- Protected Attributes inherited from CommonMessaging< BASE >
SmartIF< IMessageSvcm_msgsvc
 Pointer to the message service;. More...
 
std::unique_ptr< MsgStreamm_msgStream
 The predefined message stream. More...
 
bool m_streamWithService = false
 Flag to create a new MsgStream if it was created without the message service. More...
 
- Static Protected Attributes inherited from GaudiCommon< Algorithm >
static const bool IgnoreRootInTES
 Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods. More...
 
static const bool UseRootInTES
 Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods. More...
 

Detailed Description

Author
Illya Shapoval
Date
09/12/2011

Definition at line 20 of file GaudiParallelizer.h.

Constructor & Destructor Documentation

GaudiParallelizer::GaudiParallelizer ( const std::string &  name,
ISvcLocator pSvcLocator 
)

Standard constructor.

Definition at line 20 of file GaudiParallelizer.cpp.

21  : GaudiAlgorithm(name, pSvcLocator)
22  , m_timerTool( 0 )
23 {
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 );
29 
31 }
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
Definition: Property.cpp:72
bool m_returnOK
Forces the sequencer to return a good status.
bool m_modeOR
Indicates that the OR is wanted instead of AND.
StringArrayProperty m_names
Input string, list of algorithms.
void membershipHandler(Property &theProp)
for asynchronous changes in the list of algorithms
ISequencerTimerTool * m_timerTool
Pointer to the timer tool.
bool m_measureTime
Flag to measure time.
unsigned short m_nthreads
Number of threads in the thread pool.
GaudiParallelizer::~GaudiParallelizer ( )
virtual

Destructor.

Definition at line 36 of file GaudiParallelizer.cpp.

36 {}

Member Function Documentation

StatusCode GaudiParallelizer::decodeNames ( )
protected

Decode a vector of string.

Definition at line 138 of file GaudiParallelizer.cpp.

138  {
139 
141  m_entries.clear();
142 
143  //== Get the "Context" option if in the file...
144  IJobOptionsSvc* jos = svc<IJobOptionsSvc>( "JobOptionsSvc" );
145  bool addedContext = false; //= Have we added the context ?
146  bool addedRootInTES = false; //= Have we added the rootInTES ?
147  bool addedGlobalTimeOffset = false; //= Have we added the globalTimeOffset ?
148 
149 
150  //= Get the Application manager, to see if algorithm exist
151  IAlgManager* appMgr = svc<IAlgManager>("ApplicationMgr");
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();
158 
159  //== Check whether the specified algorithm already exists. If not, create it
161  SmartIF<IAlgorithm> myIAlg = appMgr->algorithm(typeName, false); // do not create it now
162  if ( !myIAlg.isValid() ) {
163  //== Set the Context if not in the jobOptions list
164  if ( "" != context() ||
165  "" != rootInTES() ||
166  0.0 != globalTimeOffset() ) {
167  bool foundContext = false;
168  bool foundRootInTES = false;
169  bool foundGlobalTimeOffset = false;
170  const std::vector<const Property*>* properties = jos->getProperties( theName );
171  if ( 0 != properties ) {
172  // Iterate over the list to set the options
173  for ( std::vector<const Property*>::const_iterator itProp = properties->begin();
174  itProp != properties->end();
175  itProp++ ) {
176  const StringProperty* sp = dynamic_cast<const StringProperty*>(*itProp);
177  if ( 0 != sp ) {
178  if ( "Context" == (*itProp)->name() ) {
179  foundContext = true;
180  }
181  if ( "RootInTES" == (*itProp)->name() ) {
182  foundRootInTES = true;
183  }
184  if ( "GlobalTimeOffset" == (*itProp)->name() ) {
185  foundGlobalTimeOffset = true;
186  }
187  }
188  }
189  }
190  if ( !foundContext && "" != context() ) {
191  StringProperty contextProperty( "Context", context() );
192  jos->addPropertyToCatalogue( theName, contextProperty ).ignore();
193  addedContext = true;
194  }
195  if ( !foundRootInTES && "" != rootInTES() ) {
196  StringProperty rootInTESProperty( "RootInTES", rootInTES() );
197  jos->addPropertyToCatalogue( theName, rootInTESProperty ).ignore();
198  addedRootInTES = true;
199  }
200  if ( !foundGlobalTimeOffset && 0.0 != globalTimeOffset() ) {
201  DoubleProperty globalTimeOffsetProperty( "GlobalTimeOffset", globalTimeOffset() );
202  jos->addPropertyToCatalogue( theName, globalTimeOffsetProperty ).ignore();
203  addedGlobalTimeOffset = true;
204  }
205  }
206 
207  Algorithm *myAlg = 0;
208  result = createSubAlgorithm( theType, theName, myAlg );
209  // (MCl) this should prevent bug #35199... even if I didn't manage to
210  // reproduce it with a simple test.
211  if (result.isSuccess()) myIAlg = myAlg;
212  } else {
213  Algorithm *myAlg = dynamic_cast<Algorithm*>(myIAlg.get());
214  if (myAlg) {
215  subAlgorithms()->push_back(myAlg);
216  // when the algorithm is not created, the ref count is short by one, so we have to fix it.
217  myAlg->addRef();
218  }
219  }
220 
221  //== Remove the property, in case this is not a GaudiAlgorithm...
222  if ( addedContext ) {
223  jos->removePropertyFromCatalogue( theName, "Context" ).ignore();
224  addedContext = false;
225  }
226  if ( addedRootInTES ) {
227  jos->removePropertyFromCatalogue( theName, "RootInTES" ).ignore();
228  addedRootInTES = false;
229  }
230  if ( addedGlobalTimeOffset ) {
231  jos->removePropertyFromCatalogue( theName, "GlobalTimeOffset" ).ignore();
232  addedGlobalTimeOffset = false;
233  }
234 
235  // propagate the sub-algorithm into own state.
236  if ( result.isSuccess () &&
237  Gaudi::StateMachine::INITIALIZED <= FSMState() &&
238  myIAlg.isValid () &&
239  Gaudi::StateMachine::INITIALIZED > myIAlg->FSMState() )
240  {
241  StatusCode sc = myIAlg->sysInitialize() ;
242  if ( sc.isFailure() ) { result = sc ; }
243  }
244 
245  // propagate the sub-algorithm into own state.
246  if ( result.isSuccess () &&
247  Gaudi::StateMachine::RUNNING <= FSMState() &&
248  myIAlg.isValid () &&
249  Gaudi::StateMachine::RUNNING > myIAlg->FSMState() )
250  {
251  StatusCode sc = myIAlg->sysStart () ;
252  if ( sc.isFailure() ) { result = sc ; }
253  }
254 
255  //== Is it an Algorithm ? Strange test...
256  if ( result.isSuccess() ) {
257  // TODO: (MCl) it is possible to avoid the dynamic_cast in most of the
258  // cases by keeping the result of createSubAlgorithm.
259  Algorithm* myAlg = dynamic_cast<Algorithm*>(myIAlg.get());
260  if (myAlg!=0) {
261  // Note: The reference counting is kept by the system of sub-algorithms
262  m_entries.push_back( AlgorithmEntry( myAlg ) );
263  if (msgLevel(MSG::DEBUG)) debug () << "Added algorithm " << theName << endmsg;
264  } else {
265  warning() << theName << " is not an Algorithm - failed dynamic_cast"
266  << endmsg;
267  final = StatusCode::FAILURE;
268  }
269  } else {
270  warning() << "Unable to find or create " << theName << endmsg;
271  final = result;
272  }
273 
274  }
275 
276  release(appMgr).ignore();
277  release(jos).ignore();
278 
279  //== Print the list of algorithms
280  MsgStream& msg = info();
281  if ( m_modeOR ) msg << "OR ";
282  msg << "Member list: ";
283  std::vector<AlgorithmEntry>::iterator itE;
284  for ( itE = m_entries.begin(); m_entries.end() != itE; itE++ ) {
285  Algorithm* myAlg = (*itE).algorithm();
286  std::string myAlgType = System::typeinfoName( typeid( *myAlg) ) ;
287  if ( myAlg->name() == myAlgType ) {
288  msg << myAlg->name();
289  } else {
290  msg << myAlgType << "/" << myAlg->name();
291  }
292  if ( itE+1 != m_entries.end() ) msg << ", ";
293  }
294  if ( "" != context() ) msg << ", with context '" << context() << "'";
295  if ( "" != rootInTES() ) msg << ", with rootInTES '" << rootInTES() << "'";
296  if ( 0.0 != globalTimeOffset() ) msg << ", with globalTimeOffset " << globalTimeOffset();
297  msg << endmsg;
298 
299  return final;
300 
301 }
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.
Definition: MsgStream.h:24
virtual const std::vector< const Property * > * getProperties(const std::string &client) const =0
Get the properties associated to a given client.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual StatusCode sysStart()=0
Startup method invoked by the framework.
const std::string & rootInTES() const
Returns the "rootInTES" string.
Definition: GaudiCommon.h:725
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:297
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...
Definition: IAlgManager.h:27
const std::string & context() const
Returns the "context" string. Used to identify different processing states.
Definition: GaudiCommon.h:721
bool m_modeOR
Indicates that the OR is wanted instead of AND.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
virtual StatusCode sysInitialize()=0
Initialization method invoked by the framework.
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:919
StringArrayProperty m_names
Input string, list of algorithms.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
Main interface for the JobOptions service.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
unsigned long addRef() override
Reference Interface instance.
Definition: implements.h:44
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
const TYPE & value() const
explicit conversion
Definition: Property.h:341
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:77
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:62
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.
virtual StatusCode addPropertyToCatalogue(const std::string &client, const Property &property)=0
Add a property into the JobOptions catalog.
tuple appMgr
Definition: IOTest.py:83
double globalTimeOffset() const
Returns the "globalTimeOffset" double.
Definition: GaudiCommon.h:727
void ignore() const
Definition: StatusCode.h:108
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:21
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
StatusCode release(const IInterface *interface) const
Manual forced (and 'safe') release of the active tool or service.
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
StatusCode GaudiParallelizer::execute ( )
virtual

Algorithm execution.

Definition at line 93 of file GaudiParallelizer.cpp.

93  {
95 
96  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Execute algorithms in parallel" << endmsg;
97 
98  for (std::vector<AlgorithmEntry>::iterator itE = m_entries.begin(); m_entries.end() != itE; ++itE ) {
99  Algorithm* myAlg = itE->algorithm();
100  if ( ! myAlg->isEnabled() ) continue;
101  if ( ! myAlg->isExecuted() ) {
102 
103  m_task_group.run(boost::bind(&AlgorithmEntry::run,
104  boost::ref(*itE),
105  boost::ref(*this)));
106  }
107  }
108 
109  m_task_group.wait();
110  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Joining parallel algorithm tasks" << endmsg;
111 
112  for( std::vector<AlgorithmEntry>::const_iterator it = m_entries.begin(); it != m_entries.end(); ++it ){
113  if ( msgLevel(MSG::DEBUG) ) debug() << "Algorithm wrapper " << &*it
114  << " around the algorithm " << it->algorithm()->name()
115  << " received return status code " << it->m_returncode
116  << endmsg;
117  }
118 
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;
121 
122  setExecuted( true );
124  return StatusCode::SUCCESS;
125 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
bool isExecuted() const override
Has this algorithm been executed since the last reset?
Definition: Algorithm.cpp:931
tbb::task_group m_task_group
TBB task group.
virtual void start(int index)=0
start the counter, i.e.
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:77
bool isEnabled() const override
Is this algorithm enabled or disabled?
Definition: Algorithm.cpp:944
std::vector< AlgorithmEntry > m_entries
List of algorithms to process.
ISequencerTimerTool * m_timerTool
Pointer to the timer tool.
bool m_measureTime
Flag to measure time.
int m_timer
Timer number for the sequencer.
virtual double stop(int index)=0
stop the counter, return the elapsed time
void run(GaudiParallelizer &prlzr)
Thread task executor method to wrap an algorithm execution in.
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
StatusCode GaudiParallelizer::finalize ( )
virtual

Algorithm finalization.

Definition at line 130 of file GaudiParallelizer.cpp.

130  {
131  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Finalize" << endmsg;
132 
133  return GaudiAlgorithm::finalize(); // must be called after all other actions
134 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
StatusCode finalize() override
standard finalization method
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
StatusCode GaudiParallelizer::initialize ( )
virtual

Algorithm initialization.

Definition at line 41 of file GaudiParallelizer.cpp.

41  {
42  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Initialize" << endmsg;
43  StatusCode sc = GaudiAlgorithm::initialize(); // must be executed first
44  if ( sc.isFailure() ) return sc; // error printed already by GaudiAlgorithm
45 
46  StatusCode status = decodeNames();
47  if ( !status.isSuccess() ) return status;
48 
49  m_timerTool = tool<ISequencerTimerTool>( "SequencerTimerTool" );
50  if ( m_timerTool->globalTiming() ) m_measureTime = true;
51 
52  if ( m_measureTime ) {
55  } else {
57  m_timerTool = 0;
58  }
59 
60  //== Initialize the algorithms
61  std::vector<AlgorithmEntry>::iterator itE;
62  for ( itE = m_entries.begin(); m_entries.end() != itE; itE++ ) {
63  Algorithm* myAlg = itE->algorithm();
64  if ( m_measureTime ) {
65  itE->setTimer( m_timerTool->addTimer( myAlg->name() ) );
66  }
67 
68  status = myAlg->sysInitialize();
69  if ( !status.isSuccess() ) {
70  return Error( "Can not initialize " + myAlg->name(),
71  status );
72  }
73  }
74 
76 
77  if ( m_nthreads != 0 ) {
78  // Construct the TBB task scheduler with m_nthreads threads
79  tbb::task_scheduler_init init( m_nthreads );
80  }
81  else {
82  m_nthreads = tbb::task_scheduler_init::default_num_threads();
83  }
84 
85  if ( msgLevel(MSG::DEBUG) ) debug() << "Number of threads set to be used in the TBB thread pool is "
86  << m_nthreads << endmsg;
87  return StatusCode::SUCCESS;
88 }
virtual void decreaseIndent()=0
Decrease the indentation of the name.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual int addTimer(const std::string &name)=0
add a timer entry with the specified name
StatusCode initialize() override
standard initialization method
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
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.
StatusCode decodeNames()
Decode a vector of string.
virtual void increaseIndent()=0
Increase the indentation of the name.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
virtual bool globalTiming()=0
returns the flag telling that global timing is wanted
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:919
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:77
std::vector< AlgorithmEntry > m_entries
List of algorithms to process.
ISequencerTimerTool * m_timerTool
Pointer to the timer tool.
bool m_measureTime
Flag to measure time.
int m_timer
Timer number for the sequencer.
unsigned short m_nthreads
Number of threads in the thread pool.
StatusCode sysInitialize() override
Initialization method invoked by the framework.
Definition: Algorithm.cpp:101
StatusCode release(const IInterface *interface) const
Manual forced (and 'safe') release of the active tool or service.
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
void GaudiParallelizer::membershipHandler ( Property theProp)

for asynchronous changes in the list of algorithms

Definition at line 306 of file GaudiParallelizer.cpp.

307 {
308  // no action for not-yet initialized sequencer
309  if ( Gaudi::StateMachine::INITIALIZED > FSMState() ) { return ; } // RETURN
310 
311  decodeNames().ignore();
312 
313  if ( !m_measureTime ) { return ; } // RETURN
314 
315  // add the entries into timer table:
316 
317  if ( 0 == m_timerTool )
318  { m_timerTool = tool<ISequencerTimerTool>( "SequencerTimerTool" ) ; }
319 
320  if ( m_timerTool->globalTiming() ) m_measureTime = true;
321 
324 
325  for ( std::vector<AlgorithmEntry>::iterator itE = m_entries.begin() ;
326  m_entries.end() != itE; ++itE )
327  {
328  itE->setTimer( m_timerTool->addTimer( itE->algorithm()->name() ) );
329  }
330 
332 
333 }
virtual void decreaseIndent()=0
Decrease the indentation of the name.
virtual int addTimer(const std::string &name)=0
add a timer entry with the specified name
StatusCode decodeNames()
Decode a vector of string.
virtual void increaseIndent()=0
Increase the indentation of the name.
virtual bool globalTiming()=0
returns the flag telling that global timing is wanted
std::vector< AlgorithmEntry > m_entries
List of algorithms to process.
ISequencerTimerTool * m_timerTool
Pointer to the timer tool.
bool m_measureTime
Flag to measure time.
int m_timer
Timer number for the sequencer.
void ignore() const
Definition: StatusCode.h:108

Member Data Documentation

std::vector<AlgorithmEntry> GaudiParallelizer::m_entries
private

List of algorithms to process.

Definition at line 72 of file GaudiParallelizer.h.

bool GaudiParallelizer::m_measureTime
private

Flag to measure time.

Definition at line 75 of file GaudiParallelizer.h.

bool GaudiParallelizer::m_modeOR
private

Indicates that the OR is wanted instead of AND.

Definition at line 73 of file GaudiParallelizer.h.

StringArrayProperty GaudiParallelizer::m_names
private

Input string, list of algorithms.

Definition at line 71 of file GaudiParallelizer.h.

unsigned short GaudiParallelizer::m_nthreads
private

Number of threads in the thread pool.

Definition at line 81 of file GaudiParallelizer.h.

bool GaudiParallelizer::m_returnOK
private

Forces the sequencer to return a good status.

Definition at line 76 of file GaudiParallelizer.h.

tbb::task_group GaudiParallelizer::m_task_group
private

TBB task group.

Definition at line 80 of file GaudiParallelizer.h.

int GaudiParallelizer::m_timer
private

Timer number for the sequencer.

Definition at line 78 of file GaudiParallelizer.h.

ISequencerTimerTool* GaudiParallelizer::m_timerTool
private

Pointer to the timer tool.

Definition at line 77 of file GaudiParallelizer.h.


The documentation for this class was generated from the following files: