ATLAS Offline Software
AthenaEventLoopMgr.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef ATHENASERVICES_ATHENAEVENTLOOPMGR_H
8 #define ATHENASERVICES_ATHENAEVENTLOOPMGR_H
9 
15 ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // non-MT EventLoopMgr
16 
17 // Base class headers
20 #include "GaudiKernel/IIncidentListener.h"
21 #include "AthenaKernel/Timeout.h"
22 #include "GaudiKernel/MinimalEventLoopMgr.h"
23 
24 // Athena headers
29 #ifndef EVENTINFO_EVENTID_H
30 # include "EventInfo/EventID.h" /* number_type */
31 #endif
32 
33 // Gaudi headers
34 #include <string>
35 #include <vector>
36 #include "GaudiKernel/IEvtSelector.h"
37 #include "Gaudi/Property.h"
38 #include "GaudiKernel/ServiceHandle.h"
39 #include "GaudiKernel/ToolHandle.h"
40 #include "GaudiKernel/IChronoStatSvc.h"
41 #include "GaudiKernel/IAlgExecStateSvc.h"
42 
43 // Forward declarations
44 class IConversionSvc;
45 struct IDataManagerSvc;
46 class IIncidentSvc;
47 class StoreGateSvc;
48 class EventContext;
49 class ISvcLocator;
50 class IEvtIdModifierSvc;
51 
63  : virtual public IEventSeek,
64  virtual public ICollectionSize,
65  virtual public IIncidentListener,
66  public MinimalEventLoopMgr,
67  public Athena::TimeoutMaster,
68  public AthMessaging
69 {
70 public:
71  typedef IEvtSelector::Context EvtContext;
72 
73 protected:
77 
81 
83  IEvtSelector* m_evtSelector;
85  IEvtSelector::Context* m_evtSelCtxt;
87  StringProperty m_evtsel;
88 
92 
96 
100 
102  StringArrayProperty m_execAtPreFork;
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 
132 
135 
137  void setupPreSelectTools(Gaudi::Details::PropertyBase&);
138 
142  StringProperty m_clearStorePolicy;
143 
146  void setClearStorePolicy(Gaudi::Details::PropertyBase& clearStorePolicy);
147 
149  virtual StatusCode writeHistograms(bool force=false);
150 
152  virtual StatusCode executeAlgorithms(const EventContext&);
153 
156 
157 protected:
159  SmartIF<IAlgExecStateSvc> m_aess;
160 
161 public:
163  AthenaEventLoopMgr(const std::string& nam, ISvcLocator* svcLoc);
165  virtual ~AthenaEventLoopMgr();
167  virtual StatusCode initialize();
169  virtual StatusCode finalize();
171  virtual StatusCode nextEvent(int maxevt);
173  virtual StatusCode executeEvent( EventContext && ctx );
175  virtual StatusCode executeRun(int maxevt);
177  virtual StatusCode seek(int evt);
179  virtual int curEvent() const;
181  virtual int size();
183  void handle(const Incident& inc);
185  StatusCode execAtPreFork(const EventContext& ctx) const;
186 
188  virtual StatusCode queryInterface( const InterfaceID& riid,
189  void** ppvInterface );
190 
191  using AthMessaging::msg;
192  using AthMessaging::msgLvl;
193 
194  //FIXME hack to workaround pylcgdict problem...
195  virtual const std::string& name() const { return Service::name(); } //FIXME
196 
197  virtual void modifyEventContext(EventContext& ctx, const EventID& eID, bool consume_modifier_stream);
198 
199 private:
203 
204  StatusCode installEventContext(EventContext& ctx);
205 
206  int m_nevt{};
208  IntegerProperty m_writeInterval;
209  bool m_writeHists{};
210 
212  unsigned int m_nev;
213  unsigned int m_proc;
215 
216  unsigned int m_lastNev{};
217  unsigned int m_intervalInSeconds;
218  time_t m_lastTime{};
219 
221 
222  StoreGateSvc* eventStore() const;
223 
224  bool m_doChrono = false;
227 };
228 
229 #endif // STOREGATE_ATHENAEVENTLOOPMGR_H
AthenaEventLoopMgr::m_lastTime
time_t m_lastTime
Definition: AthenaEventLoopMgr.h:218
AthenaEventLoopMgr::AthenaEventLoopMgr
AthenaEventLoopMgr(const AthenaEventLoopMgr &)
no implementation
AthenaEventLoopMgr::curEvent
virtual int curEvent() const
Return the current event count.
Definition: AthenaEventLoopMgr.cxx:892
AthenaEventLoopMgr::size
virtual int size()
Return the size of the collection.
Definition: AthenaEventLoopMgr.cxx:900
AthenaEventLoopMgr::m_evtIdModSvc
IEvtIdModifierSvc_t m_evtIdModSvc
Definition: AthenaEventLoopMgr.h:99
AthenaEventLoopMgr::m_toolAccept
tool_stats m_toolAccept
tool returns StatusCode::SUCCESS counter
Definition: AthenaEventLoopMgr.h:127
AthenaEventLoopMgr::IIncidentSvc_t
ServiceHandle< IIncidentSvc > IIncidentSvc_t
Definition: AthenaEventLoopMgr.h:74
AthenaEventLoopMgr::m_tools
tool_store m_tools
internal tool store
Definition: AthenaEventLoopMgr.h:128
AthenaEventLoopMgr
The default ATLAS batch event loop manager.
Definition: AthenaEventLoopMgr.h:69
AthenaEventLoopMgr::tool_type
IAthenaEvtLoopPreSelectTool tool_type
Definition: AthenaEventLoopMgr.h:119
IConditionsCleanerSvc.h
Interface for doing garbage collection of conditions objects.
AthenaEventLoopMgr::m_evtSelCtxt
IEvtSelector::Context * m_evtSelCtxt
Gaudi EventSelector Context (may be used as a cursor by the evt selector)
Definition: AthenaEventLoopMgr.h:85
calibdata.force
bool force
Definition: calibdata.py:19
IEventSeek.h
Abstract interface for seeking within an event stream.
AthenaEventLoopMgr::number_type
EventID::number_type number_type
Definition: AthenaEventLoopMgr.h:107
IAthenaEvtLoopPreSelectTool
This class provides the interface for AthenaEvtLoopPreSelectTool classes used by AthenaEventLoopMgr.
Definition: IAthenaEvtLoopPreSelectTool.h:22
AthenaEventLoopMgr::eventStore
StoreGateSvc * eventStore() const
Definition: AthenaEventLoopMgr.cxx:1042
AthenaEventLoopMgr::name
virtual const std::string & name() const
Definition: AthenaEventLoopMgr.h:195
AthenaEventLoopMgr::IEvtIdModifierSvc_t
ServiceHandle< IEvtIdModifierSvc > IEvtIdModifierSvc_t
Definition: AthenaEventLoopMgr.h:97
AthenaEventLoopMgr::initialize
virtual StatusCode initialize()
implementation of IAppMgrUI::initalize
Definition: AthenaEventLoopMgr.cxx:129
AthenaEventLoopMgr::m_conditionsCleaner
ServiceHandle< Athena::IConditionsCleanerSvc > m_conditionsCleaner
Definition: AthenaEventLoopMgr.h:226
AthenaEventLoopMgr::m_histPersName
StringProperty m_histPersName
Definition: AthenaEventLoopMgr.h:105
AthenaEventLoopMgr::m_proc
unsigned int m_proc
Definition: AthenaEventLoopMgr.h:213
AthenaEventLoopMgr::IDataManagerSvc_t
ServiceHandle< IDataManagerSvc > IDataManagerSvc_t
Definition: AthenaEventLoopMgr.h:89
clearStorePolicy
ClearStorePolicy::Type clearStorePolicy(const std::string &policyName, MsgStream &msg)
returns the enum-version of the policy (by name)
Definition: ClearStorePolicy.cxx:7
AthenaEventLoopMgr::executeRun
virtual StatusCode executeRun(int maxevt)
implementation of IEventProcessor::executeRun(int maxevt)
Definition: AthenaEventLoopMgr.cxx:714
ICollectionSize.h
Abstract interface for finding the size of an event collection.
AthenaEventLoopMgr::m_evtSelector
IEvtSelector * m_evtSelector
Reference to the Event Selector.
Definition: AthenaEventLoopMgr.h:83
AthenaEventLoopMgr::m_failureMode
IntegerProperty m_failureMode
Definition: AthenaEventLoopMgr.h:113
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
AthenaEventLoopMgr::StoreGateSvc_t
ServiceHandle< StoreGateSvc > StoreGateSvc_t
Definition: AthenaEventLoopMgr.h:78
AthenaEventLoopMgr::m_incidentSvc
IIncidentSvc_t m_incidentSvc
Reference to the incident service.
Definition: AthenaEventLoopMgr.h:76
IEvtIdModifierSvc
Definition: IEvtIdModifierSvc.h:37
AthenaEventLoopMgr::m_eventStore
StoreGateSvc_t m_eventStore
Reference to StoreGateSvc;.
Definition: AthenaEventLoopMgr.h:80
AthenaEventLoopMgr::m_writeInterval
IntegerProperty m_writeInterval
Definition: AthenaEventLoopMgr.h:208
AthenaEventLoopMgr::m_currentRun
number_type m_currentRun
current run number
Definition: AthenaEventLoopMgr.h:109
AthenaEventLoopMgr::m_nev
unsigned int m_nev
events processed
Definition: AthenaEventLoopMgr.h:212
AthenaEventLoopMgr::~AthenaEventLoopMgr
virtual ~AthenaEventLoopMgr()
Standard Destructor.
Definition: AthenaEventLoopMgr.cxx:122
AthenaEventLoopMgr::modifyEventContext
virtual void modifyEventContext(EventContext &ctx, const EventID &eID, bool consume_modifier_stream)
Definition: AthenaEventLoopMgr.cxx:1200
AthenaEventLoopMgr::installEventContext
StatusCode installEventContext(EventContext &ctx)
Definition: AthenaEventLoopMgr.cxx:1050
AthenaEventLoopMgr::nextEvent
virtual StatusCode nextEvent(int maxevt)
implementation of IAppMgrUI::nextEvent. maxevt==0 returns immediately
Definition: AthenaEventLoopMgr.cxx:726
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
AthenaEventLoopMgr::initializeAlgorithms
StatusCode initializeAlgorithms()
Initialize all algorithms and output streams.
Definition: AthenaEventLoopMgr.cxx:494
EventID.h
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
AthenaEventLoopMgr::IConversionSvc_t
ServiceHandle< IConversionSvc > IConversionSvc_t
Definition: AthenaEventLoopMgr.h:93
AthenaEventLoopMgr::m_doChrono
bool m_doChrono
Definition: AthenaEventLoopMgr.h:224
AthMessaging::msgLvl
bool msgLvl(const MSG::Level lvl) const
Test the output level.
Definition: AthMessaging.h:151
AthenaEventLoopMgr::execAtPreFork
StatusCode execAtPreFork(const EventContext &ctx) const
Execute certain algorithms/sequences in PreFork.
Definition: AthenaEventLoopMgr.cxx:1003
AthenaEventLoopMgr::handle
void handle(const Incident &inc)
IIncidentListenet interfaces.
Definition: AthenaEventLoopMgr.cxx:922
EventID::number_type
EventIDBase::number_type number_type
Definition: EventID.h:37
AthenaEventLoopMgr::m_requireInputAttributeList
bool m_requireInputAttributeList
require input attribute list
Definition: AthenaEventLoopMgr.h:131
Athena::TimeoutMaster
Class to modify timeout flag.
Definition: Timeout.h:77
AthenaEventLoopMgr::m_histoPersSvc
IConversionSvc_t m_histoPersSvc
Definition: AthenaEventLoopMgr.h:95
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthenaEventLoopMgr::m_aess
SmartIF< IAlgExecStateSvc > m_aess
Reference to the Algorithm Execution State Svc.
Definition: AthenaEventLoopMgr.h:159
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
Definition: AthenaEventLoopMgr.h:15
AthenaEventLoopMgr::EvtContext
IEvtSelector::Context EvtContext
Definition: AthenaEventLoopMgr.h:71
AthenaEventLoopMgr::m_useTools
bool m_useTools
Definition: AthenaEventLoopMgr.h:214
IAthenaEvtLoopPreSelectTool.h
This file contains the class definition for the IAthenaEvtLoopPreSelectTool class.
AthenaEventLoopMgr::m_lastNev
unsigned int m_lastNev
Definition: AthenaEventLoopMgr.h:216
AthenaEventLoopMgr::seek
virtual StatusCode seek(int evt)
Seek to a given event.
Definition: AthenaEventLoopMgr.cxx:862
AthenaEventLoopMgr::m_execAtPreFork
StringArrayProperty m_execAtPreFork
Definition: AthenaEventLoopMgr.h:102
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
ICollectionSize
Abstract interface for finding the size of an event collection.
Definition: ICollectionSize.h:31
AthenaEventLoopMgr::finalize
virtual StatusCode finalize()
implementation of IAppMgrUI::finalize
Definition: AthenaEventLoopMgr.cxx:382
AthenaEventLoopMgr::m_eventPrintoutInterval
UnsignedIntegerProperty m_eventPrintoutInterval
Definition: AthenaEventLoopMgr.h:116
AthenaEventLoopMgr::tool_stats
std::vector< unsigned int > tool_stats
Definition: AthenaEventLoopMgr.h:122
AthenaEventLoopMgr::executeEvent
virtual StatusCode executeEvent(EventContext &&ctx)
implementation of IEventProcessor::executeEvent(EventContext&& ctx)
Definition: AthenaEventLoopMgr.cxx:555
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
AthenaEventLoopMgr::m_toolInvoke
tool_stats m_toolInvoke
tool called counter
Definition: AthenaEventLoopMgr.h:125
AthenaEventLoopMgr::m_toolReject
tool_stats m_toolReject
tool returns StatusCode::FAILURE counter
Definition: AthenaEventLoopMgr.h:126
AthenaEventLoopMgr::setupPreSelectTools
void setupPreSelectTools(Gaudi::Details::PropertyBase &)
property update handler:sets up the Pre-selection tools
Definition: AthenaEventLoopMgr.cxx:349
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
AthenaEventLoopMgr::m_clearStorePolicy
StringProperty m_clearStorePolicy
Definition: AthenaEventLoopMgr.h:142
AthenaEventLoopMgr::m_liteLoop
bool m_liteLoop
Definition: AthenaEventLoopMgr.h:220
AthenaEventLoopMgr::queryInterface
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
interface dispatcher
Definition: AthenaEventLoopMgr.cxx:1026
AthenaEventLoopMgr::m_chronoStatSvc
ServiceHandle< IChronoStatSvc > m_chronoStatSvc
Definition: AthenaEventLoopMgr.h:225
Timeout.h
Timeout singleton.
AthenaEventLoopMgr::m_useSecondaryEventNumber
bool m_useSecondaryEventNumber
read event number from secondary input
Definition: AthenaEventLoopMgr.h:134
AthenaEventLoopMgr::setClearStorePolicy
void setClearStorePolicy(Gaudi::Details::PropertyBase &clearStorePolicy)
property update handler:set the clear-store policy value and check its value.
Definition: AthenaEventLoopMgr.cxx:329
AthenaEventLoopMgr::m_intervalInSeconds
unsigned int m_intervalInSeconds
Definition: AthenaEventLoopMgr.h:217
AthenaEventLoopMgr::m_firstRun
bool m_firstRun
Definition: AthenaEventLoopMgr.h:110
AthenaEventLoopMgr::m_writeHists
bool m_writeHists
Definition: AthenaEventLoopMgr.h:209
AthenaEventLoopMgr::m_evtsel
StringProperty m_evtsel
Definition: AthenaEventLoopMgr.h:87
AthMessaging.h
EventID
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventID.h:35
AthenaEventLoopMgr::writeHistograms
virtual StatusCode writeHistograms(bool force=false)
Dump out histograms as needed.
Definition: AthenaEventLoopMgr.cxx:438
AthenaEventLoopMgr::tool_iterator
tool_store::const_iterator tool_iterator
Definition: AthenaEventLoopMgr.h:121
IEventSeek
Abstract interface for seeking within an event stream.
Definition: IEventSeek.h:27
AthenaEventLoopMgr::AthenaEventLoopMgr
AthenaEventLoopMgr()
no implementation
AthenaEventLoopMgr::tool_stats_iterator
tool_stats::const_iterator tool_stats_iterator
Definition: AthenaEventLoopMgr.h:123
IEvtSelectorSeek.h
Extension to IEvtSelector to allow for seeking.
AthenaEventLoopMgr::m_nevt
int m_nevt
Definition: AthenaEventLoopMgr.h:206
checker_macros.h
Define macros for attributes used to control the static checker.
AthenaEventLoopMgr::executeAlgorithms
virtual StatusCode executeAlgorithms(const EventContext &)
Run the algorithms for the current event.
Definition: AthenaEventLoopMgr.cxx:529
AthenaEventLoopMgr::m_histoDataMgrSvc
IDataManagerSvc_t m_histoDataMgrSvc
Reference to the Histogram Data Service.
Definition: AthenaEventLoopMgr.h:91
AthenaEventLoopMgr::operator=
AthenaEventLoopMgr & operator=(const AthenaEventLoopMgr &)
no implementation
AthenaEventLoopMgr::tool_store
ToolHandleArray< tool_type > tool_store
Definition: AthenaEventLoopMgr.h:120
ServiceHandle< IIncidentSvc >