The Gaudi Framework  v30r1 (5d4f4ae2)
HLTEventLoopMgr.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <string>
5 #include <unordered_map>
6 #include <vector>
7 
8 #include "tbb/task.h"
9 
10 // Forward declarations
11 class IAlgExecStateSvc;
12 class IEvtSelector;
13 class IHiveWhiteBoard;
14 class IDataManagerSvc;
15 class IDataProviderSvc;
17 
25 class HLTEventLoopMgr : public extends<Service, IEventProcessor>
26 {
27 
28  struct HLTExecutionTask : public tbb::task {
29 
31  IAlgExecStateSvc* aem,
32  std::function<void( std::unique_ptr<EventContext> )> promote2ExecutedClosure )
33  : m_algorithms( algorithms )
34  , m_evtCtx( std::move( ctx ) )
35  , m_aess( aem )
36  , m_serviceLocator( svcLocator )
37  , m_promote2ExecutedClosure( std::move( promote2ExecutedClosure ) ){};
38  tbb::task* execute() override;
39 
41  {
43  return MsgStream( messageSvc, "HLTExecutionTask" );
44  }
45 
51  };
52 
53 public:
55  using extends::extends;
56 
58  StatusCode initialize() override;
62  StatusCode finalize() override;
63 
65  StatusCode nextEvent( int maxevt ) override;
67  StatusCode executeEvent( void* par ) override;
69  StatusCode executeRun( int maxevt ) override { return nextEvent( maxevt ); }
71  StatusCode stopRun() override;
72 
73 private:
77  StatusCode eventFailed( EventContext* eventContext );
80 
82  inline unsigned int algname2index( const std::string& algoname ) { return m_algname_index_map[algoname]; }
84  inline const std::string& index2algname( unsigned int index ) { return m_algname_vect[index]; }
85 
86 private:
87  Gaudi::Property<std::string> m_histPersName{this, "HistogramPersistency", "", ""};
88  Gaudi::Property<std::string> m_evtsel{this, "EvtSel", "", ""};
89  Gaudi::Property<int> m_threadPoolSize{this, "ThreadPoolSize", -1, "Size of the threadpool initialised by TBB"};
90  Gaudi::Property<std::string> m_whiteboardSvcName{this, "WhiteboardSvc", "EventDataSvc", "The whiteboard name"};
91 
106 
113 
116 
125 };
unsigned int algname2index(const std::string &algoname)
Convert a name to an integer.
std::vector< IAlgorithm * > m_algos
Vector of algorithms to run for every event.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
IConversionSvc * m_histoPersSvc
Reference to the Histogram Persistency Service.
std::vector< IAlgorithm * > & m_algorithms
std::mutex m_createEventMutex
mutex assoiciated with m_createEventCond condition variable
Implementation of property with value of concrete type.
Definition: Property.h:319
StatusCode eventFailed(EventContext *eventContext)
Method to check if an event failed and take appropriate actions.
The Event Selector Interface.
Definition: IEvtSelector.h:18
StatusCode finalize() override
implementation of IService::finalize
HLTExecutionTask(std::vector< IAlgorithm * > &algorithms, std::unique_ptr< EventContext > ctx, ISvcLocator *svcLocator, IAlgExecStateSvc *aem, std::function< void(std::unique_ptr< EventContext >)> promote2ExecutedClosure)
Abstract interface for a service that manages tasks&#39; precedence.
STL namespace.
std::condition_variable m_createEventCond
condition variable to wake up main thread when we need to create a new event
Data provider interface definition.
IDataManagerSvc * m_evtDataMgrSvc
Reference to the Event Data Service&#39;s IDataManagerSvc interface.
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
std::function< void(std::unique_ptr< EventContext >)> m_promote2ExecutedClosure
STL class.
GAUDI_API ISvcLocator * svcLocator()
Abstract interface for a service that manages the Algorithm execution states.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::vector< EventSlot > m_eventSlots
Vector of events slots.
Gaudi::Property< std::string > m_whiteboardSvcName
IEvtSelector::Context * m_evtSelContext
event selector context
StatusCode reinitialize() override
implementation of IService::reinitialize
std::unordered_map< std::string, unsigned int > m_algname_index_map
Map to bookkeep the information necessary to the name2index conversion.
IHiveWhiteBoard * m_whiteboard
Reference to the Whiteboard.
const std::string & index2algname(unsigned int index)
Convert an integer to a name.
IDataManagerSvc * m_histoDataMgrSvc
Reference to the Histogram Data Service.
SmartIF< ISvcLocator > m_serviceLocator
Gaudi::Property< int > m_threadPoolSize
StatusCode nextEvent(int maxevt) override
implementation of IEventProcessor::nextEvent
Gaudi::Property< std::string > m_histPersName
Gaudi::Property< std::string > m_evtsel
StatusCode initialize() override
implementation of IService::initialize
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
IEvtSelector * m_evtSelector
Reference to the Event Selector.
std::atomic< unsigned int > m_finishedEvt
atomic count of the number of finished events
StatusCode executeEvent(void *par) override
implementation of IEventProcessor::executeEvent(void* par)
void promoteToExecuted(std::unique_ptr< EventContext > eventContext)
Algorithm promotion.
std::vector< std::string > m_algname_vect
Vector to bookkeep the information necessary to the index2name conversion.
StatusCode executeRun(int maxevt) override
implementation of IEventProcessor::executeRun()
StatusCode stopRun() override
implementation of IEventProcessor::stopRun()
StatusCode declareEventRootAddress()
Declare the root address of the event.
int maxevt
Definition: Bootstrap.cpp:276
IAlgExecStateSvc * m_algExecStateSvc
Reference to the AlgExecStateSvc.
IPrecedenceSvc * m_precSvc
A shortcut to the Precedence Service.
std::unique_ptr< EventContext > m_evtCtx