ATLAS Offline Software
AthenaEventLoopMgr.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_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 
62 class AthenaEventLoopMgr : public extends<MinimalEventLoopMgr,
63  IEventSeek, ICollectionSize, IIncidentListener>,
64  public Athena::TimeoutMaster,
65  public AthMessaging
66 {
67 public:
68  typedef IEvtSelector::Context EvtContext;
69 
70 protected:
74 
78 
80  IEvtSelector* m_evtSelector;
82  IEvtSelector::Context* m_evtSelCtxt;
84  StringProperty m_evtsel;
85 
89 
93 
97 
99  StringArrayProperty m_execAtPreFork;
100 
102  StringProperty m_histPersName;
103 
108 
110  IntegerProperty m_failureMode;
111 
113  UnsignedIntegerProperty m_eventPrintoutInterval;
114 
117  typedef ToolHandleArray< tool_type > tool_store;
118  typedef tool_store::const_iterator tool_iterator;
119  typedef std::vector<unsigned int> tool_stats;
120  typedef tool_stats::const_iterator tool_stats_iterator;
121 
126 
129 
132 
134  void setupPreSelectTools(Gaudi::Details::PropertyBase&);
135 
139  StringProperty m_clearStorePolicy;
140 
143  void setClearStorePolicy(Gaudi::Details::PropertyBase& clearStorePolicy);
144 
146  virtual StatusCode writeHistograms(bool force=false);
147 
149  virtual StatusCode executeAlgorithms(const EventContext&);
150 
153 
154 protected:
156  SmartIF<IAlgExecStateSvc> m_aess;
157 
158 public:
160  AthenaEventLoopMgr(const std::string& nam, ISvcLocator* svcLoc);
162  virtual ~AthenaEventLoopMgr();
164  virtual StatusCode initialize();
166  virtual StatusCode finalize();
168  virtual StatusCode nextEvent(int maxevt);
170  virtual StatusCode executeEvent( EventContext && ctx );
172  virtual StatusCode executeRun(int maxevt);
174  virtual StatusCode seek(int evt);
176  virtual int curEvent() const;
178  virtual int size();
180  void handle(const Incident& inc);
182  StatusCode execAtPreFork(const EventContext& ctx) const;
183 
184  using AthMessaging::msg;
185  using AthMessaging::msgLvl;
186 
187  //FIXME hack to workaround pylcgdict problem...
188  virtual const std::string& name() const { return Service::name(); } //FIXME
189 
190  virtual void modifyEventContext(EventContext& ctx, const EventID& eID, bool consume_modifier_stream);
191 
192 private:
196 
197  StatusCode installEventContext(EventContext& ctx);
198 
199  int m_nevt{};
201  IntegerProperty m_writeInterval;
202  bool m_writeHists{};
203 
205  unsigned int m_nev;
206  unsigned int m_proc;
208 
209  unsigned int m_lastNev{};
210  unsigned int m_intervalInSeconds;
211  time_t m_lastTime{};
212 
214 
215  StoreGateSvc* eventStore() const;
216 
217  bool m_doChrono = false;
220 };
221 
222 #endif // STOREGATE_ATHENAEVENTLOOPMGR_H
AthenaEventLoopMgr::m_lastTime
time_t m_lastTime
Definition: AthenaEventLoopMgr.h:211
AthenaEventLoopMgr::AthenaEventLoopMgr
AthenaEventLoopMgr(const AthenaEventLoopMgr &)
no implementation
AthenaEventLoopMgr::curEvent
virtual int curEvent() const
Return the current event count.
Definition: AthenaEventLoopMgr.cxx:882
AthenaEventLoopMgr::size
virtual int size()
Return the size of the collection.
Definition: AthenaEventLoopMgr.cxx:890
AthenaEventLoopMgr::m_evtIdModSvc
IEvtIdModifierSvc_t m_evtIdModSvc
Definition: AthenaEventLoopMgr.h:96
AthenaEventLoopMgr::m_toolAccept
tool_stats m_toolAccept
tool returns StatusCode::SUCCESS counter
Definition: AthenaEventLoopMgr.h:124
AthenaEventLoopMgr::IIncidentSvc_t
ServiceHandle< IIncidentSvc > IIncidentSvc_t
Definition: AthenaEventLoopMgr.h:71
AthenaEventLoopMgr::m_tools
tool_store m_tools
internal tool store
Definition: AthenaEventLoopMgr.h:125
AthenaEventLoopMgr
The default ATLAS batch event loop manager.
Definition: AthenaEventLoopMgr.h:66
AthenaEventLoopMgr::tool_type
IAthenaEvtLoopPreSelectTool tool_type
Definition: AthenaEventLoopMgr.h:116
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:82
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:104
IAthenaEvtLoopPreSelectTool
This class provides the interface for AthenaEvtLoopPreSelectTool classes used by AthenaEventLoopMgr.
Definition: IAthenaEvtLoopPreSelectTool.h:22
AthenaEventLoopMgr::eventStore
StoreGateSvc * eventStore() const
Definition: AthenaEventLoopMgr.cxx:1010
AthenaEventLoopMgr::name
virtual const std::string & name() const
Definition: AthenaEventLoopMgr.h:188
AthenaEventLoopMgr::IEvtIdModifierSvc_t
ServiceHandle< IEvtIdModifierSvc > IEvtIdModifierSvc_t
Definition: AthenaEventLoopMgr.h:94
AthenaEventLoopMgr::initialize
virtual StatusCode initialize()
implementation of IAppMgrUI::initalize
Definition: AthenaEventLoopMgr.cxx:130
AthenaEventLoopMgr::m_conditionsCleaner
ServiceHandle< Athena::IConditionsCleanerSvc > m_conditionsCleaner
Definition: AthenaEventLoopMgr.h:219
AthenaEventLoopMgr::m_histPersName
StringProperty m_histPersName
Definition: AthenaEventLoopMgr.h:102
AthenaEventLoopMgr::m_proc
unsigned int m_proc
Definition: AthenaEventLoopMgr.h:206
AthenaEventLoopMgr::IDataManagerSvc_t
ServiceHandle< IDataManagerSvc > IDataManagerSvc_t
Definition: AthenaEventLoopMgr.h:86
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:704
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:80
AthenaEventLoopMgr::m_failureMode
IntegerProperty m_failureMode
Definition: AthenaEventLoopMgr.h:110
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
AthenaEventLoopMgr::StoreGateSvc_t
ServiceHandle< StoreGateSvc > StoreGateSvc_t
Definition: AthenaEventLoopMgr.h:75
AthenaEventLoopMgr::m_incidentSvc
IIncidentSvc_t m_incidentSvc
Reference to the incident service.
Definition: AthenaEventLoopMgr.h:73
IEvtIdModifierSvc
Definition: IEvtIdModifierSvc.h:37
AthenaEventLoopMgr::m_eventStore
StoreGateSvc_t m_eventStore
Reference to StoreGateSvc;.
Definition: AthenaEventLoopMgr.h:77
AthenaEventLoopMgr::m_writeInterval
IntegerProperty m_writeInterval
Definition: AthenaEventLoopMgr.h:201
AthenaEventLoopMgr::m_currentRun
number_type m_currentRun
current run number
Definition: AthenaEventLoopMgr.h:106
AthenaEventLoopMgr::m_nev
unsigned int m_nev
events processed
Definition: AthenaEventLoopMgr.h:205
AthenaEventLoopMgr::~AthenaEventLoopMgr
virtual ~AthenaEventLoopMgr()
Standard Destructor.
Definition: AthenaEventLoopMgr.cxx:123
AthenaEventLoopMgr::modifyEventContext
virtual void modifyEventContext(EventContext &ctx, const EventID &eID, bool consume_modifier_stream)
Definition: AthenaEventLoopMgr.cxx:1170
AthenaEventLoopMgr::installEventContext
StatusCode installEventContext(EventContext &ctx)
Definition: AthenaEventLoopMgr.cxx:1018
AthenaEventLoopMgr::nextEvent
virtual StatusCode nextEvent(int maxevt)
implementation of IAppMgrUI::nextEvent. maxevt==0 returns immediately
Definition: AthenaEventLoopMgr.cxx:716
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
AthenaEventLoopMgr::initializeAlgorithms
StatusCode initializeAlgorithms()
Initialize all algorithms and output streams.
Definition: AthenaEventLoopMgr.cxx:484
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:90
AthenaEventLoopMgr::m_doChrono
bool m_doChrono
Definition: AthenaEventLoopMgr.h:217
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:993
AthenaEventLoopMgr::handle
void handle(const Incident &inc)
IIncidentListenet interfaces.
Definition: AthenaEventLoopMgr.cxx:912
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:128
Athena::TimeoutMaster
Class to modify timeout flag.
Definition: Timeout.h:77
AthenaEventLoopMgr::m_histoPersSvc
IConversionSvc_t m_histoPersSvc
Definition: AthenaEventLoopMgr.h:92
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:156
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
Definition: AthenaEventLoopMgr.h:15
AthenaEventLoopMgr::EvtContext
IEvtSelector::Context EvtContext
Definition: AthenaEventLoopMgr.h:68
AthenaEventLoopMgr::m_useTools
bool m_useTools
Definition: AthenaEventLoopMgr.h:207
IAthenaEvtLoopPreSelectTool.h
This file contains the class definition for the IAthenaEvtLoopPreSelectTool class.
AthenaEventLoopMgr::m_lastNev
unsigned int m_lastNev
Definition: AthenaEventLoopMgr.h:209
AthenaEventLoopMgr::seek
virtual StatusCode seek(int evt)
Seek to a given event.
Definition: AthenaEventLoopMgr.cxx:852
AthenaEventLoopMgr::m_execAtPreFork
StringArrayProperty m_execAtPreFork
Definition: AthenaEventLoopMgr.h:99
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
AthenaEventLoopMgr::finalize
virtual StatusCode finalize()
implementation of IAppMgrUI::finalize
Definition: AthenaEventLoopMgr.cxx:372
AthenaEventLoopMgr::m_eventPrintoutInterval
UnsignedIntegerProperty m_eventPrintoutInterval
Definition: AthenaEventLoopMgr.h:113
AthenaEventLoopMgr::tool_stats
std::vector< unsigned int > tool_stats
Definition: AthenaEventLoopMgr.h:119
AthenaEventLoopMgr::executeEvent
virtual StatusCode executeEvent(EventContext &&ctx)
implementation of IEventProcessor::executeEvent(EventContext&& ctx)
Definition: AthenaEventLoopMgr.cxx:545
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:122
AthenaEventLoopMgr::m_toolReject
tool_stats m_toolReject
tool returns StatusCode::FAILURE counter
Definition: AthenaEventLoopMgr.h:123
AthenaEventLoopMgr::setupPreSelectTools
void setupPreSelectTools(Gaudi::Details::PropertyBase &)
property update handler:sets up the Pre-selection tools
Definition: AthenaEventLoopMgr.cxx:339
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
AthenaEventLoopMgr::m_clearStorePolicy
StringProperty m_clearStorePolicy
Definition: AthenaEventLoopMgr.h:139
AthenaEventLoopMgr::m_liteLoop
bool m_liteLoop
Definition: AthenaEventLoopMgr.h:213
AthenaEventLoopMgr::m_chronoStatSvc
ServiceHandle< IChronoStatSvc > m_chronoStatSvc
Definition: AthenaEventLoopMgr.h:218
Timeout.h
Timeout singleton.
AthenaEventLoopMgr::m_useSecondaryEventNumber
bool m_useSecondaryEventNumber
read event number from secondary input
Definition: AthenaEventLoopMgr.h:131
AthenaEventLoopMgr::setClearStorePolicy
void setClearStorePolicy(Gaudi::Details::PropertyBase &clearStorePolicy)
property update handler:set the clear-store policy value and check its value.
Definition: AthenaEventLoopMgr.cxx:319
AthenaEventLoopMgr::m_intervalInSeconds
unsigned int m_intervalInSeconds
Definition: AthenaEventLoopMgr.h:210
AthenaEventLoopMgr::m_firstRun
bool m_firstRun
Definition: AthenaEventLoopMgr.h:107
AthenaEventLoopMgr::m_writeHists
bool m_writeHists
Definition: AthenaEventLoopMgr.h:202
AthenaEventLoopMgr::m_evtsel
StringProperty m_evtsel
Definition: AthenaEventLoopMgr.h:84
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:428
AthenaEventLoopMgr::tool_iterator
tool_store::const_iterator tool_iterator
Definition: AthenaEventLoopMgr.h:118
AthenaEventLoopMgr::AthenaEventLoopMgr
AthenaEventLoopMgr()
no implementation
AthenaEventLoopMgr::tool_stats_iterator
tool_stats::const_iterator tool_stats_iterator
Definition: AthenaEventLoopMgr.h:120
IEvtSelectorSeek.h
Extension to IEvtSelector to allow for seeking.
AthenaEventLoopMgr::m_nevt
int m_nevt
Definition: AthenaEventLoopMgr.h:199
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:519
AthenaEventLoopMgr::m_histoDataMgrSvc
IDataManagerSvc_t m_histoDataMgrSvc
Reference to the Histogram Data Service.
Definition: AthenaEventLoopMgr.h:88
AthenaEventLoopMgr::operator=
AthenaEventLoopMgr & operator=(const AthenaEventLoopMgr &)
no implementation
AthenaEventLoopMgr::tool_store
ToolHandleArray< tool_type > tool_store
Definition: AthenaEventLoopMgr.h:117
ServiceHandle< IIncidentSvc >