ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaHiveEventLoopMgr.h
Go to the documentation of this file.
1// -*- C++ -*-
2
3/*
4 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5*/
6
7#ifndef ATHENASERVICES_ATHENAHIVEEVENTLOOPMGR_H
8#define ATHENASERVICES_ATHENAHIVEEVENTLOOPMGR_H
13
14// Base class headers
17#include "GaudiKernel/IIncidentListener.h"
19#include "GaudiKernel/MinimalEventLoopMgr.h"
20
21// Athena headers
25#ifndef EVENTINFO_EVENTID_H
26# include "EventInfo/EventID.h" /* number_type */
27#endif
28
29
30// Gaudi headers
31#include "Gaudi/Property.h"
32#include "GaudiKernel/ServiceHandle.h"
33#include "GaudiKernel/ToolHandle.h"
34#include "GaudiKernel/IAlgResourcePool.h"
35#include "GaudiKernel/IEvtSelector.h"
36#include "GaudiKernel/IHiveWhiteBoard.h"
37#include "GaudiKernel/IScheduler.h"
38#include "GaudiKernel/IAlgExecStateSvc.h"
39
40// Standard includes
41#include <functional>
42#include <string>
43#include <vector>
44
45// External Libraries
46#include "tbb/concurrent_queue.h"
48
49// Forward declarations
50class IConversionSvc;
51struct IDataManagerSvc;
52class IDataProviderSvc;
53class IIncidentSvc;
54class StoreGateSvc;
55class ISvcLocator;
57
68class AthenaHiveEventLoopMgr : public extends<MinimalEventLoopMgr,
69 IEventSeek, ICollectionSize, IIncidentListener>,
71 public AthMessaging
72{
73public:
74 typedef IEvtSelector::Context EvtContext;
75
76protected:
80
84
86 IEvtSelector* m_evtSelector;
90 StringProperty m_evtsel;
91
95
99
103
105 StringProperty m_histPersName;
106
111
113 IntegerProperty m_failureMode;
114
116 UnsignedIntegerProperty m_eventPrintoutInterval;
117
120 typedef ToolHandleArray< tool_type > tool_store;
121 typedef tool_store::const_iterator tool_iterator;
122 typedef std::vector<unsigned int> tool_stats;
123 typedef tool_stats::const_iterator tool_stats_iterator;
124
129
131 void setupPreSelectTools(Gaudi::Details::PropertyBase&);
132
135
138
140 virtual StatusCode writeHistograms(bool force=false);
141
143 virtual StatusCode executeAlgorithms();
144
146 StatusCode initializeAlgorithms();
147
148
149 //***********************************************************//
150 // for Hive
151protected:
152
154 SmartIF<IHiveWhiteBoard> m_whiteboard;
155
157 SmartIF<IAlgResourcePool> m_algResourcePool;
158
160 SmartIF<IAlgExecStateSvc> m_aess;
161
163 SmartIF<IProperty> m_appMgrProperty;
164
166 SmartIF<IScheduler> m_schedulerSvc;
168 StatusCode clearWBSlot(int evtSlot);
170 int declareEventRootAddress(EventContext&);
172 virtual EventContext createEventContext() override;
174 int drainScheduler(int& finishedEvents);
176 SmartIF< IIncidentListener > m_abortEventListener;
178 std::string m_schedulerName;
180 std::string m_whiteboardName;
183
184
185
186public:
188 StatusCode getEventRoot(IOpaqueAddress*& refpAddr);
189
190
191
192//***********************************************************//
193
194public:
196 AthenaHiveEventLoopMgr(const std::string& nam, ISvcLocator* svcLoc);
198 virtual ~AthenaHiveEventLoopMgr();
200 virtual StatusCode initialize() override;
202 virtual StatusCode finalize() override;
204 virtual StatusCode nextEvent(int maxevt) override;
206 virtual StatusCode executeEvent( EventContext&& ctx ) override;
208 virtual StatusCode executeRun(int maxevt) override;
210 virtual StatusCode stopRun() override;
212 virtual StatusCode stop() override;
213
214
216 virtual StatusCode seek(int evt) override;
218 virtual int curEvent() const override;
220 virtual int size() override;
222 virtual void handle(const Incident& inc) override;
223
224 using AthMessaging::msg;
226
227 //FIXME hack to workaround pylcgdict problem...
228 virtual const std::string& name() const override { return Service::name(); } //FIXME
229
230 virtual void modifyEventContext(EventContext& ctx, const EventID& eID, bool consume_modifier_stream);
231
232private:
236
237 unsigned int m_nevt;
238 unsigned int m_timeStamp { 0 };
240 UnsignedIntegerProperty m_writeInterval;
242
243protected:
244 // These are now protected so we can access them in MPIHiveEventLoopMgr
245
246 bool m_terminateLoop { false };
248 unsigned int m_nev;
249 unsigned int m_proc;
252
253 // Save a copy of the last event context to use
254 // at the end of event processing.
255 EventContext m_lastEventContext;
256
257private:
259
260 unsigned int m_flmbi, m_timeStampInt;
261
262 // from MinimalEventLoopMgr
263public:
264 typedef std::list<SmartIF<IAlgorithm> > ListAlg;
265 // typedef std::list<IAlgorithm*> ListAlgPtrs;
266 // typedef std::list<std::string> ListName;
267 // typedef std::vector<std::string> VectorName;
268
269private:
270 StoreGateSvc* eventStore() const;
271
273};
274
275#endif // ATHENASERVICES_ATHENAHIVEEVENTLOOPMGR_H
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
This file contains the class definition for the IAthenaEvtLoopPreSelectTool class.
Abstract interface for finding the size of an event collection.
Interface for doing garbage collection of conditions objects.
Abstract interface for seeking within an event stream.
Timeout singleton.
MsgStream & msg() const
The standard message stream.
bool msgLvl(const MSG::Level lvl) const
Test the output level.
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
UnsignedIntegerProperty m_eventPrintoutInterval
IEvtSelector * m_evtSelector
Reference to the Event Selector.
virtual StatusCode stopRun() override
implementation of IEventProcessor::stopRun()
virtual void handle(const Incident &inc) override
IIncidentListenet interfaces.
ServiceHandle< IIncidentSvc > IIncidentSvc_t
ServiceHandle< IConversionSvc > IConversionSvc_t
virtual StatusCode initialize() override
implementation of IAppMgrUI::initalize
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard interface.
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
int drainScheduler(int &finishedEvents)
Drain the scheduler from all actions that may be queued.
number_type m_currentRun
current run number
IAthenaEvtLoopPreSelectTool tool_type
virtual int size() override
Return the size of the collection.
SmartIF< IAlgExecStateSvc > m_aess
Reference to the Algorithm Execution State Svc.
virtual const std::string & name() const override
std::string m_schedulerName
Name of the scheduler to be used.
UnsignedIntegerProperty m_writeInterval
std::string m_whiteboardName
Name of the Whiteboard to be used.
StoreGateSvc * eventStore() const
tool_stats m_toolAccept
tool returns StatusCode::SUCCESS counter
std::vector< unsigned int > tool_stats
virtual StatusCode executeRun(int maxevt) override
implementation of IEventProcessor::executeRun(int maxevt)
tool_store::const_iterator tool_iterator
unsigned int m_nev
events processed
tool_stats m_toolInvoke
tool called counter
AthenaHiveEventLoopMgr(const AthenaHiveEventLoopMgr &)=delete
IIncidentSvc_t m_incidentSvc
Reference to the incident service.
virtual StatusCode stop() override
implementation of IService::stop
ServiceHandle< IEvtIdModifierSvc > IEvtIdModifierSvc_t
bool m_useSecondaryEventNumber
read event number from secondary input
bool m_requireInputAttributeList
require input attribute list
AthenaHiveEventLoopMgr & operator=(const AthenaHiveEventLoopMgr &)=delete
IEvtSelector::Context EvtContext
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
StoreGateSvc_t m_eventStore
Reference to StoreGateSvc;.
SmartIF< IIncidentListener > m_abortEventListener
Instance of the incident listener waiting for AbortEvent.
ServiceHandle< StoreGateSvc > StoreGateSvc_t
EvtContext * m_evtContext
Gaudi event selector Context (may be used as a cursor by the evt selector)
virtual StatusCode seek(int evt) override
Seek to a given event.
AthenaHiveEventLoopMgr(const std::string &nam, ISvcLocator *svcLoc)
Standard Constructor.
int declareEventRootAddress(EventContext &)
Declare the root address of the event.
AthenaHiveEventLoopMgr()=delete
virtual StatusCode finalize() override
implementation of IAppMgrUI::finalize
EventID::number_type number_type
virtual StatusCode executeEvent(EventContext &&ctx) override
implementation of IEventProcessor::executeEvent(void* par)
IDataManagerSvc_t m_histoDataMgrSvc
Reference to the Histogram Data Service.
bool m_scheduledStop
Scheduled stop of event processing.
virtual EventContext createEventContext() override
Create event context.
ServiceHandle< IDataManagerSvc > IDataManagerSvc_t
StatusCode initializeAlgorithms()
Initialize all algorithms and output streams.
virtual ~AthenaHiveEventLoopMgr()
Standard Destructor.
tool_stats::const_iterator tool_stats_iterator
StatusCode clearWBSlot(int evtSlot)
Clear a slot in the WB.
ServiceHandle< Athena::IConditionsCleanerSvc > m_conditionsCleaner
tool_store m_tools
internal tool store
virtual void modifyEventContext(EventContext &ctx, const EventID &eID, bool consume_modifier_stream)
std::list< SmartIF< IAlgorithm > > ListAlg
virtual StatusCode writeHistograms(bool force=false)
Dump out histograms as needed.
void setupPreSelectTools(Gaudi::Details::PropertyBase &)
property update handler:sets up the Pre-selection tools
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
virtual int curEvent() const override
Return the current event count.
tool_stats m_toolReject
tool returns StatusCode::FAILURE counter
IEvtIdModifierSvc_t m_evtIdModSvc
SmartIF< IAlgResourcePool > m_algResourcePool
Reference to the Algorithm resource pool.
ToolHandleArray< tool_type > tool_store
virtual StatusCode nextEvent(int maxevt) override
implementation of IAppMgrUI::nextEvent. maxevt==0 returns immediately
virtual StatusCode executeAlgorithms()
Run the algorithms for the current event.
Class to modify timeout flag.
Definition Timeout.h:77
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition EventID.h:35
EventIDBase::number_type number_type
Definition EventID.h:37
This class provides the interface for AthenaEvtLoopPreSelectTool classes used by AthenaEventLoopMgr.
The Athena Transient Store API.