All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
HiveEventLoopMgr.h
Go to the documentation of this file.
1 #ifndef GAUDIHIVE_HIVEEVENTLOOPMGR_H
2 #define GAUDIHIVE_HIVEEVENTLOOPMGR_H 1
3 
4 // Framework include files
5 #include "GaudiKernel/IAlgResourcePool.h"
6 #include "GaudiKernel/IEvtSelector.h"
7 #include "GaudiKernel/IHiveWhiteBoard.h"
8 #include "GaudiKernel/MinimalEventLoopMgr.h"
9 
10 // std includes
11 #include <atomic>
12 
13 //include boost
14 #include <boost/dynamic_bitset.hpp>
15 
16 // include tbb
17 #include "tbb/concurrent_vector.h"
18 #include "tbb/concurrent_queue.h"
19 
20 // typedef for the event and algo state
21 typedef boost::dynamic_bitset<> state_type;
22 
23 // Forward declarations
24 class IIncidentSvc;
25 class IDataManagerSvc;
26 class IDataProviderSvc;
27 
28 namespace tbb {
29  class task_scheduler_init;
30 }
31 
33 public:
34 
35 protected:
45  std::string m_evtsel;
55  std::string m_histPersName;
62  bool m_warnings;
63 
64  // Variables for the concurrency
66  unsigned int m_max_parallel;
68  tbb::task_scheduler_init* m_tbb_scheduler_init;
70  void find_dependencies();
74  std::vector<state_type> m_all_requirements;
76  std::map<std::string,unsigned int> m_product_indices;
78  std::atomic_uint m_total_algos_in_flight;
80  unsigned int m_numberOfAlgos;
84  unsigned int m_evts_parallel;
86  unsigned int m_num_threads;
90  // keep room for a class hashing strings instead of strings
91  typedef std::vector<std::vector<std::string>> algosDependenciesCollection;
92  // We just need the dependencies and not the algo names.
93  algosDependenciesCollection m_AlgosDependencies;
94  // Number of products to deal with
95  unsigned int m_nProducts;
96 
97 public:
99  HiveEventLoopMgr(const std::string& nam, ISvcLocator* svcLoc);
101  virtual ~HiveEventLoopMgr();
104 
106  virtual StatusCode initialize();
108  virtual StatusCode reinitialize();
110  virtual StatusCode stop();
112  virtual StatusCode finalize();
114  virtual StatusCode nextEvent(int maxevt);
116  virtual StatusCode executeEvent(void* par);
118  virtual StatusCode executeRun(int maxevt);
119 
121  void taskFinished(IAlgorithm*& algo);
122 
123 };
124 #endif // GAUDIHIVE_HIVEEVENTLOOPMGR_H
HiveEventLoopMgr(const std::string &nam, ISvcLocator *svcLoc)
Standard Constructor.
unsigned int m_nProducts
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Histogram Persistency Service.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
void find_dependencies()
Get the input and output collections.
unsigned int m_numberOfAlgos
Total number of algos.
unsigned int m_max_parallel
Maximum number of parallel running algorithms.
void taskFinished(IAlgorithm *&algo)
Decrement the number of algos in flight and put algo back in manager - maybe private.
SmartIF< IAlgResourcePool > m_algResourcePool
Reference to the Algorithm resource pool.
bool m_CloneAlgorithms
Clone algorithms to run them simultaneously.
virtual StatusCode stop()
implementation of IService::stop
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) ...
Data provider interface definition.
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
boost::dynamic_bitset state_type
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
virtual StatusCode finalize()
implementation of IService::finalize
unsigned int m_evts_parallel
Number of events in parallel.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
virtual StatusCode nextEvent(int maxevt)
implementation of IService::nextEvent
std::string m_evtsel
Event selector.
std::vector< state_type > m_all_requirements
All requirements.
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:23
std::map< std::string, unsigned int > m_product_indices
Register of input products.
SmartIF< IDataProviderSvc > m_evtDataSvc
Reference to the Event Data Service's IDataProviderSvc interface.
boost::dynamic_bitset state_type
virtual ~HiveEventLoopMgr()
Standard Destructor.
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
unsigned int m_num_threads
Total numbers of threads.
std::vector< std::vector< std::string > > algosDependenciesCollection
Algorithms Inputs.
virtual StatusCode executeRun(int maxevt)
implementation of IEventProcessor::executeRun()
virtual StatusCode executeEvent(void *par)
implementation of IEventProcessor::executeEvent(void* par)
state_type m_termination_requirement
The termination requirement.
std::atomic_uint m_total_algos_in_flight
Total number of algos in flight across all events.
bool m_warnings
Flag to disable warning messages when using external input.
algosDependenciesCollection m_AlgosDependencies
std::string m_histPersName
Name of the Hist Pers type.
This is the default processing manager of the application manager.
IEvtSelector::Context * m_evtContext
Event Iterator.
virtual StatusCode reinitialize()
implementation of IService::reinitialize
tbb::task_scheduler_init * m_tbb_scheduler_init
Pointer to tbb task scheduler.
Opaque address interface definition.
virtual StatusCode initialize()
implementation of IService::initialize
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:21
bool m_DumpQueues
Dump the algorithm queues.