ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaMtesEventLoopMgr.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_ATHENAMTESEVENTLOOPMGR_H
8#define ATHENASERVICES_ATHENAMTESEVENTLOOPMGR_H
9
10#include "GaudiKernel/IEvtSelector.h"
11#include "Gaudi/Property.h"
12#include "GaudiKernel/ServiceHandle.h"
13#include "GaudiKernel/ToolHandle.h"
14#include "GaudiKernel/MinimalEventLoopMgr.h"
15#include "GaudiKernel/IIncidentListener.h"
16#include "GaudiKernel/IAlgResourcePool.h"
17#include "GaudiKernel/IHiveWhiteBoard.h"
18#include "GaudiKernel/IScheduler.h"
19#include "GaudiKernel/IAlgExecStateSvc.h"
20
27
28#include <memory>
29#include <string>
30#include <vector>
31
32#ifndef EVENTINFO_EVENTID_H
33# include "EventInfo/EventID.h" /* number_type */
34#endif
35
36// Forward declarations
37class IConversionSvc;
38struct IDataManagerSvc;
39class IDataProviderSvc;
40class IIncidentSvc;
41class StoreGateSvc;
42class ISvcLocator;
45
46namespace yampl {
47 class ISocket;
48}
49
50class AthenaMtesEventLoopMgr : public extends<MinimalEventLoopMgr,
51 IEventSeek,
52 ICollectionSize,
53 IIncidentListener,
54 IHybridProcessorHelper>,
56{
57public:
58 typedef IEvtSelector::Context EvtContext;
59
60protected:
64
68
70 IEvtSelector* m_evtSelector;
74 StringProperty m_evtsel;
75
79
83
87
89 StringProperty m_histPersName;
90
95
97 IntegerProperty m_failureMode;
98
100 UnsignedIntegerProperty m_eventPrintoutInterval;
101
104 typedef ToolHandleArray< tool_type > tool_store;
105 typedef tool_store::const_iterator tool_iterator;
106 typedef std::vector<unsigned int> tool_stats;
107 typedef tool_stats::const_iterator tool_stats_iterator;
108
113
115 void setupPreSelectTools(Gaudi::Details::PropertyBase&);
116
120 StringProperty m_clearStorePolicy;
121
126
129 void setClearStorePolicy(Gaudi::Details::PropertyBase& clearStorePolicy);
130
132 virtual StatusCode writeHistograms(bool force=false);
133
135 virtual StatusCode executeAlgorithms();
136
138 StatusCode initializeAlgorithms();
139
140
141 //***********************************************************//
142 // for Hive
143protected:
144
146 SmartIF<IHiveWhiteBoard> m_whiteboard;
147
149 SmartIF<IAlgResourcePool> m_algResourcePool;
150
152 SmartIF<IAlgExecStateSvc> m_aess;
153
155 SmartIF<IProperty> m_appMgrProperty;
156
158 SmartIF<IScheduler> m_schedulerSvc;
160 StatusCode clearWBSlot(int evtSlot);
162 int declareEventRootAddress(EventContext&);
164 SmartIF< IIncidentListener > m_abortEventListener;
166 std::string m_schedulerName;
168 std::string m_whiteboardName;
171
173
174public:
176 StatusCode getEventRoot(IOpaqueAddress*& refpAddr);
177
178
179
180//***********************************************************//
181
182public:
184 AthenaMtesEventLoopMgr(const std::string& nam, ISvcLocator* svcLoc);
186 virtual ~AthenaMtesEventLoopMgr();
188 virtual StatusCode initialize() override;
190 virtual StatusCode finalize() override;
192 virtual StatusCode nextEvent(int maxevt) override;
194 virtual EventContext createEventContext() override;
196 virtual StatusCode executeEvent( EventContext&& ctx ) override;
198 virtual StatusCode executeRun(int maxevt) override;
200 virtual StatusCode stopRun() override;
202 virtual StatusCode stop() override;
203
204
206 virtual StatusCode seek(int evt) override;
208 virtual int curEvent() const override;
210 virtual int size() override;
212 virtual void handle(const Incident& inc) override;
213
215 virtual void resetAppReturnCode() override;
216
217 virtual void setCurrentEventNum(int num) override;
218 virtual bool terminateLoop() override;
219
221 virtual int drainScheduler(int& finishedEvents, bool report) override;
222
223 //FIXME hack to workaround pylcgdict problem...
224 virtual const std::string& name() const override { return Service::name(); } //FIXME
225
226private:
230
231 unsigned int m_nevt;
232 unsigned int m_timeStamp { 0 };
234 UnsignedIntegerProperty m_writeInterval;
236
237 bool m_terminateLoop { false };
238
240 unsigned int m_nev;
241 unsigned int m_proc;
244
245 unsigned int m_flmbi, m_timeStampInt;
246
247 // from MinimalEventLoopMgr
248public:
249 typedef std::list<SmartIF<IAlgorithm> > ListAlg;
250
251 // Property to specify text messages with event ranges to simulate input from
252 // EventService pilot - use for standalone tests
253 StringArrayProperty m_testPilotMessages;
254 bool m_inTestMode { false };
255
256private:
257 StoreGateSvc* eventStore() const;
258
259 void modifyEventContext(EventContext& ctx, const EventID& eID, bool consume_modifier_stream);
260
262
263 // Save a copy of the last event context to use
264 // at the end of event processing.
265 EventContext m_lastEventContext;
266
267 // Event Service Specific stuff
270 : eventRangeID{""}
271 , pfn{""}
272 , startEvent{-1}
273 , lastEvent{-1} {}
274
275 std::string eventRangeID;
276 std::string pfn;
279 };
280
281 std::unique_ptr<RangeStruct> getNextRange(yampl::ISocket* socket);
282 void trimRangeStrings(std::string& str);
283
285
286 Gaudi::Property<std::string> m_eventRangeChannel{this
287 , "EventRangeChannel"
288 , "EventService_EventRanges"
289 , "The name of the Yampl channel between AthenaMT and the Pilot"
290 };
291
292 // Hopefully a temporary measurement. For the time being we cannot
293 // support event ranges from different input files.
294 std::string m_pfn{""};
295
296 // For the event service running:
297 std::unique_ptr<yampl::ISocket> m_socket;
298};
299
300#endif // ATHENASERVICES_ATHENAHIVEEVENTLOOPMGR_H
ClearStorePolicy::Type clearStorePolicy(const std::string &policyName, MsgStream &msg)
returns the enum-version of the policy (by name)
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.
tool_stats::const_iterator tool_stats_iterator
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
bool m_requireInputAttributeList
require input attribute list
IEvtSelector::Context EvtContext
virtual StatusCode finalize() override
implementation of IAppMgrUI::finalize
virtual EventContext createEventContext() override
implementation of IEventProcessor::createEventContext()
virtual void resetAppReturnCode() override
Reset the application return code.
virtual StatusCode executeEvent(EventContext &&ctx) override
implementation of IEventProcessor::executeEvent(void* par)
tool_store::const_iterator tool_iterator
virtual int curEvent() const override
Return the current event count.
ServiceHandle< OutputStreamSequencerSvc > m_outSeqSvc
SmartIF< IIncidentListener > m_abortEventListener
Instance of the incident listener waiting for AbortEvent.
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
void setClearStorePolicy(Gaudi::Details::PropertyBase &clearStorePolicy)
property update handler:set the clear-store policy value and check its value.
virtual StatusCode executeAlgorithms()
Run the algorithms for the current event.
std::unique_ptr< yampl::ISocket > m_socket
IAthenaEvtLoopPreSelectTool tool_type
ServiceHandle< Athena::IConditionsCleanerSvc > m_conditionsCleaner
std::unique_ptr< RangeStruct > getNextRange(yampl::ISocket *socket)
std::vector< unsigned int > tool_stats
virtual bool terminateLoop() override
tool_stats m_toolReject
tool returns StatusCode::FAILURE counter
UnsignedIntegerProperty m_eventPrintoutInterval
tool_stats m_toolAccept
tool returns StatusCode::SUCCESS counter
virtual StatusCode executeRun(int maxevt) override
implementation of IEventProcessor::executeRun(int maxevt)
number_type m_currentRun
current run number
AthenaMtesEventLoopMgr()=delete
void modifyEventContext(EventContext &ctx, const EventID &eID, bool consume_modifier_stream)
tool_store m_tools
internal tool store
virtual const std::string & name() const override
unsigned int m_nev
events processed
AthenaMtesEventLoopMgr & operator=(const AthenaMtesEventLoopMgr &)=delete
virtual StatusCode initialize() override
implementation of IAppMgrUI::initalize
SmartIF< IAlgResourcePool > m_algResourcePool
Reference to the Algorithm resource pool.
IEvtIdModifierSvc_t m_evtIdModSvc
ServiceHandle< IIncidentSvc > IIncidentSvc_t
virtual StatusCode writeHistograms(bool force=false)
Dump out histograms as needed.
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard interface.
virtual ~AthenaMtesEventLoopMgr()
Standard Destructor.
StatusCode initializeAlgorithms()
Initialize all algorithms and output streams.
SmartIF< IAlgExecStateSvc > m_aess
Reference to the Algorithm Execution State Svc.
AthenaMtesEventLoopMgr(const AthenaMtesEventLoopMgr &)=delete
tool_stats m_toolInvoke
tool called counter
virtual int drainScheduler(int &finishedEvents, bool report) override
Drain the scheduler from all actions that may be queued.
bool m_useSecondaryEventNumber
read event number from secondary input
virtual StatusCode nextEvent(int maxevt) override
implementation of IAppMgrUI::nextEvent. maxevt==0 returns immediately
EvtContext * m_evtContext
Gaudi event selector Context (may be used as a cursor by the evt selector)
std::list< SmartIF< IAlgorithm > > ListAlg
StatusCode clearWBSlot(int evtSlot)
Clear a slot in the WB.
std::string m_whiteboardName
Name of the Whiteboard to be used.
int declareEventRootAddress(EventContext &)
Declare the root address of the event.
bool m_scheduledStop
Scheduled stop of event processing.
virtual StatusCode seek(int evt) override
Seek to a given event.
virtual StatusCode stop() override
implementation of IService::stop
std::string m_schedulerName
Name of the scheduler to be used.
StringArrayProperty m_testPilotMessages
IDataManagerSvc_t m_histoDataMgrSvc
Reference to the Histogram Data Service.
ServiceHandle< StoreGateSvc > StoreGateSvc_t
StoreGateSvc_t m_eventStore
Reference to StoreGateSvc;.
ToolHandleArray< tool_type > tool_store
virtual int size() override
Return the size of the collection.
Gaudi::Property< std::string > m_eventRangeChannel
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
virtual void setCurrentEventNum(int num) override
AthenaMtesEventLoopMgr(const std::string &nam, ISvcLocator *svcLoc)
Standard Constructor.
ServiceHandle< IConversionSvc > IConversionSvc_t
ServiceHandle< IEvtIdModifierSvc > IEvtIdModifierSvc_t
virtual StatusCode stopRun() override
implementation of IEventProcessor::stopRun()
void setupPreSelectTools(Gaudi::Details::PropertyBase &)
property update handler:sets up the Pre-selection tools
EventID::number_type number_type
IIncidentSvc_t m_incidentSvc
Reference to the incident service.
StoreGateSvc * eventStore() const
ServiceHandle< IDataManagerSvc > IDataManagerSvc_t
void trimRangeStrings(std::string &str)
UnsignedIntegerProperty m_writeInterval
virtual void handle(const Incident &inc) override
IIncidentListenet interfaces.
IEvtSelector * m_evtSelector
Reference to the Event Selector.
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.
This class provides configuration properties to enable OutputStream file sequences.
The Athena Transient Store API.