ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaHiveEventLoopMgr.h
Go to the documentation of this file.
1// -*- C++ -*-
2
3/*
4 Copyright (C) 2002-2026 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;
184 EventContext allocateEventContext(size_t eventNumber);
189 StatusCode submitEvent(EventContext& ctx);
193 StatusCode finishEvent(const EventContext& ctx);
195 virtual StatusCode eventFinished(const EventContext& ctx);
198 virtual bool clearStoreOnEndAlgorithms() const { return true; }
200 int drainScheduler(int& finishedEvents);
203 SmartIF< IIncidentListener > m_abortEventListener;
205 std::string m_schedulerName;
207 std::string m_whiteboardName;
210
211
212
213public:
215 StatusCode getEventRoot(IOpaqueAddress*& refpAddr);
216
217
218
219//***********************************************************//
220
221public:
223 AthenaHiveEventLoopMgr(const std::string& nam, ISvcLocator* svcLoc);
225 virtual ~AthenaHiveEventLoopMgr();
227 virtual StatusCode initialize() override;
229 virtual StatusCode finalize() override;
231 virtual StatusCode nextEvent(int maxevt) override;
233 virtual StatusCode executeEvent( EventContext&& ctx ) override;
235 virtual StatusCode executeRun(int maxevt) override;
237 virtual StatusCode stopRun() override;
239 virtual StatusCode stop() override;
240
241
243 virtual StatusCode seek(int evt) override;
245 virtual int curEvent() const override;
247 virtual int size() override;
249 virtual void handle(const Incident& inc) override;
250
251 using AthMessaging::msg;
253
254 //FIXME hack to workaround pylcgdict problem...
255 virtual const std::string& name() const override { return Service::name(); } //FIXME
256
257 virtual void modifyEventContext(EventContext& ctx, const EventID& eID, bool consume_modifier_stream);
258
259private:
263
264 unsigned int m_nevt;
265 unsigned int m_timeStamp { 0 };
267 UnsignedIntegerProperty m_writeInterval;
269
270protected:
271 // These are now protected so we can access them in MPIHiveEventLoopMgr
272
273 bool m_terminateLoop { false };
275 unsigned int m_nev;
276 unsigned int m_proc;
279
280 // Save a copy of the last event context to use
281 // at the end of event processing.
282 EventContext m_lastEventContext;
283
284private:
286
287 unsigned int m_flmbi, m_timeStampInt;
288
289 // from MinimalEventLoopMgr
290public:
291 typedef std::list<SmartIF<IAlgorithm> > ListAlg;
292 // typedef std::list<IAlgorithm*> ListAlgPtrs;
293 // typedef std::list<std::string> ListName;
294 // typedef std::vector<std::string> VectorName;
295
296private:
298};
299
300#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
virtual StatusCode eventFinished(const EventContext &ctx)
Process an event's result and decide whether the driving loop may continue.
EventContext allocateEventContext(size_t eventNumber)
std::string m_whiteboardName
Name of the Whiteboard to be used.
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
StatusCode submitEvent(EventContext &ctx)
Submit a recorded context; the scheduler receives its own copy.
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.
virtual bool clearStoreOnEndAlgorithms() const
Batch jobs clear in the algorithm context; external drivers can retain the store until eventFinished(...
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
StatusCode finishEvent(const EventContext &ctx)
Finish one scheduler-returned event on the driving thread.
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:34
EventIDBase::number_type number_type
Definition EventID.h:36
This class provides the interface for AthenaEvtLoopPreSelectTool classes used by AthenaEventLoopMgr.
The Athena Transient Store API.