ATLAS Offline Software
PileUpEventLoopMgr.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef PILEUPEVENTLOOPMGR_H
6 #define PILEUPEVENTLOOPMGR_H
7 
12 // Base class headers
14 #include "GaudiKernel/MinimalEventLoopMgr.h"
15 
16 // Athena headers
19 
20 // Gaudi headers
21 #include "Gaudi/Property.h"
22 #include "GaudiKernel/ServiceHandle.h"
23 #include "GaudiKernel/ToolHandle.h"
24 #include "GaudiKernel/IAlgExecStateSvc.h"
25 #include <string>
26 
27 // Forward declarations
28 class IBeamIntensity;
29 class IBeamLuminosity;
30 class IBkgStreamsCache;
31 class IEvtSelector;
32 class IIncidentSvc;
33 class PileUpMergeSvc;
34 class StoreGateSvc;
35 class EventContext;
36 class EventID;
37 class IEvtIdModifierSvc;
38 
43 class PileUpEventLoopMgr : virtual public IEventSeek,
44  public MinimalEventLoopMgr,
45  public AthMessaging
46 {
47 public:
48 
50  PileUpEventLoopMgr(const std::string& nam, ISvcLocator* svcLoc);
52  virtual ~PileUpEventLoopMgr();
53 
54 public:
56  virtual StatusCode initialize();
58  virtual StatusCode finalize();
60  // virtual StatusCode terminate();
62  virtual StatusCode nextEvent(int maxevt);
64  virtual StatusCode executeEvent( EventContext &&ctx );
65 
67  virtual StatusCode seek(int evt);
69  virtual int curEvent() const;
70 
71  virtual void modifyEventContext(EventContext& ctx, const EventID& eID, bool consume_modifier_stream);
72 
73  virtual StatusCode queryInterface(const InterfaceID& riid,
74  void** ppvInterface);
75 
76  using AthMessaging::msg;
78 
79 
80 private:
82  SmartIF<IAlgExecStateSvc> m_aess;
83 
86 
88  virtual StatusCode executeAlgorithms(const EventContext& ctx);
89 
91  inline unsigned int getBCID(int bunchXing, unsigned int centralBCID) const {
92  //FIXME to be completely safe this should should probably depend on the bunch spacing too. Perhaps that concept should be deprecated though?
93  return static_cast<unsigned int>((((bunchXing + static_cast<int>(centralBCID)) % static_cast<int>(m_maxBunchCrossingPerOrbit)) + static_cast<int>(m_maxBunchCrossingPerOrbit) ) % static_cast<int>(m_maxBunchCrossingPerOrbit));
94  }
95 
98 
101 
104 
106  ServiceHandle<StoreGateSvc> m_evtStore; // overlaid (output) event store
107 
111 
112  //unsigned int m_nInputs;
113  //unsigned int m_nStores;
114 
116 
122  ToolHandleArray<IBkgStreamsCache> m_caches;
124  Gaudi::Property<float> m_maxCollPerXing;
125 
127  Gaudi::Property<float> m_xingFreq;
129  Gaudi::Property<int> m_firstXing;
131  Gaudi::Property<int> m_lastXing;
132 
134  Gaudi::Property<bool> m_allowSubEvtsEOF;
135 
137  Gaudi::Property<bool> m_xingByXing;
138 
140  Gaudi::Property<int> m_failureMode;
141 
143  Gaudi::Property<std::string> m_evinfName;
144 
146  Gaudi::Property<std::string> m_evinfContName;
147 
153 
157 
160 
161  int m_nevt;
162 
166 
170  Gaudi::Property<bool> m_allowSerialAndMPToDiffer;
171 
172  Gaudi::Property<uint32_t> m_mcChannelNumber{ this, "MCChannelNumber", 0, "sample MC channel number" };
173 };
174 #endif // PILEUPTOOLS_PILEUPEVENTLOOPMGR_H
IBkgStreamsCache
Interface to in-memory cache for pileup events.
Definition: IBkgStreamsCache.h:24
PileUpEventLoopMgr::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Incident Service.
Definition: PileUpEventLoopMgr.h:97
PileUpEventLoopMgr::IEvtIdModifierSvc_t
ServiceHandle< IEvtIdModifierSvc > IEvtIdModifierSvc_t
Definition: PileUpEventLoopMgr.h:108
IEventSeek.h
Abstract interface for seeking within an event stream.
PileUpEventLoopMgr::~PileUpEventLoopMgr
virtual ~PileUpEventLoopMgr()
Standard Destructor.
Definition: PileUpEventLoopMgr.cxx:115
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
PileUpEventLoopMgr::m_allowSerialAndMPToDiffer
Gaudi::Property< bool > m_allowSerialAndMPToDiffer
property: Default true.
Definition: PileUpEventLoopMgr.h:170
PileUpEventLoopMgr::m_signalSel
ServiceHandle< IEvtSelector > m_signalSel
Signal Event selector (for overlay).
Definition: PileUpEventLoopMgr.h:120
PileUpEventLoopMgr::nextEvent
virtual StatusCode nextEvent(int maxevt)
implementation of IAppMgreUI::terminate
Definition: PileUpEventLoopMgr.cxx:251
PileUpEventLoopMgr::m_origSel
ServiceHandle< IEvtSelector > m_origSel
Original (Physics) Event selector (background for overlay).
Definition: PileUpEventLoopMgr.h:118
PileUpEventLoopMgr
The ATLAS event loop for pile-up applications.
Definition: PileUpEventLoopMgr.h:46
PileUpEventLoopMgr::m_xingFreq
Gaudi::Property< float > m_xingFreq
Xing frequency(ns);.
Definition: PileUpEventLoopMgr.h:127
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
PileUpEventLoopMgr::m_skipExecAlgs
bool m_skipExecAlgs
Definition: PileUpEventLoopMgr.h:164
PileUpEventLoopMgr::m_evtStore
ServiceHandle< StoreGateSvc > m_evtStore
output store
Definition: PileUpEventLoopMgr.h:106
PileUpEventLoopMgr::m_evinfName
Gaudi::Property< std::string > m_evinfName
SG key for the EventInfoContainer.
Definition: PileUpEventLoopMgr.h:143
PileUpEventLoopMgr::executeAlgorithms
virtual StatusCode executeAlgorithms(const EventContext &ctx)
Run the algorithms for the current event.
Definition: PileUpEventLoopMgr.cxx:607
IEvtIdModifierSvc
Definition: IEvtIdModifierSvc.h:37
PileUpEventLoopMgr::m_origStream
PileUpStream m_origStream
Input Stream.
Definition: PileUpEventLoopMgr.h:103
PileUpEventLoopMgr::m_maxBunchCrossingPerOrbit
unsigned int m_maxBunchCrossingPerOrbit
max bunch crossings per orbit
Definition: PileUpEventLoopMgr.h:159
PileUpMergeSvc
the preferred mechanism to access information from the different event stores in a pileup job.
Definition: PileUpMergeSvc.h:58
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
PileUpEventLoopMgr::m_ncurevt
int m_ncurevt
Definition: PileUpEventLoopMgr.h:163
PileUpEventLoopMgr::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
PileUp Merge Service.
Definition: PileUpEventLoopMgr.h:100
AthMessaging::msgLvl
bool msgLvl(const MSG::Level lvl) const
Test the output level.
Definition: AthMessaging.h:151
PileUpEventLoopMgr::m_allowSubEvtsEOF
Gaudi::Property< bool > m_allowSubEvtsEOF
property: allow sub evts EOF condition when maxevt==-1
Definition: PileUpEventLoopMgr.h:134
PileUpEventLoopMgr::PileUpEventLoopMgr
PileUpEventLoopMgr(const std::string &nam, ISvcLocator *svcLoc)
Standard Constructor.
Definition: PileUpEventLoopMgr.cxx:53
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
PileUpEventLoopMgr::m_beamInt
ServiceHandle< IBeamIntensity > m_beamInt
property: beam intensity service handle for beam profile in local time
Definition: PileUpEventLoopMgr.h:149
PileUpEventLoopMgr::m_nevt
int m_nevt
Definition: PileUpEventLoopMgr.h:161
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
PileUpStream
a triple selector/context/store defines a stream
Definition: PileUpStream.h:33
PileUpEventLoopMgr::seek
virtual StatusCode seek(int evt)
Seek to a given event.
Definition: PileUpEventLoopMgr.cxx:545
PileUpEventLoopMgr::m_evinfContName
Gaudi::Property< std::string > m_evinfContName
SG key for the EventInfoContainer.
Definition: PileUpEventLoopMgr.h:146
PileUpEventLoopMgr::setupStreams
StatusCode setupStreams()
setup input and overlay selectors and iters
Definition: PileUpEventLoopMgr.cxx:575
PileUpEventLoopMgr::m_mcChannelNumber
Gaudi::Property< uint32_t > m_mcChannelNumber
Definition: PileUpEventLoopMgr.h:172
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
PileUpEventLoopMgr::m_firstXing
Gaudi::Property< int > m_firstXing
first xing to be simulated (0th xing is 1st after trigger)
Definition: PileUpEventLoopMgr.h:129
PileUpEventLoopMgr::getBCID
unsigned int getBCID(int bunchXing, unsigned int centralBCID) const
return the 'fake BCID' corresponding to bunchXing
Definition: PileUpEventLoopMgr.h:91
PileUpEventLoopMgr::executeEvent
virtual StatusCode executeEvent(EventContext &&ctx)
implementation of IEventProcessor::executeEvent(void* par)
Definition: PileUpEventLoopMgr.cxx:632
PileUpEventLoopMgr::m_maxCollPerXing
Gaudi::Property< float > m_maxCollPerXing
(max) minBias interactions per Xing, for setting MC luminosity
Definition: PileUpEventLoopMgr.h:124
PileUpEventLoopMgr::m_firstRun
bool m_firstRun
Definition: PileUpEventLoopMgr.h:156
PileUpEventLoopMgr::m_evtIdModSvc
IEvtIdModifierSvc_t m_evtIdModSvc
Definition: PileUpEventLoopMgr.h:110
PileUpEventLoopMgr::queryInterface
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
Definition: PileUpEventLoopMgr.cxx:695
PileUpEventLoopMgr::curEvent
virtual int curEvent() const
Return the current event count.
Definition: PileUpEventLoopMgr.cxx:566
PileUpEventLoopMgr::m_caches
ToolHandleArray< IBkgStreamsCache > m_caches
BkgStreamsCaches managing background events.
Definition: PileUpEventLoopMgr.h:122
IBeamLuminosity
Definition: IBeamLuminosity.h:17
PileUpEventLoopMgr::m_xingByXing
Gaudi::Property< bool > m_xingByXing
property: process bkg events xing by xing without caching them
Definition: PileUpEventLoopMgr.h:137
PileUpEventLoopMgr::finalize
virtual StatusCode finalize()
implementation of IAppMgrUI::finalize
Definition: PileUpEventLoopMgr.cxx:194
PileUpEventLoopMgr::m_currentRun
uint32_t m_currentRun
current run number
Definition: PileUpEventLoopMgr.h:155
AthMessaging.h
PileUpEventLoopMgr::m_aess
SmartIF< IAlgExecStateSvc > m_aess
Reference to the Algorithm Execution State Svc.
Definition: PileUpEventLoopMgr.h:82
EventID
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventID.h:35
IEventSeek
Abstract interface for seeking within an event stream.
Definition: IEventSeek.h:27
PileUpEventLoopMgr::m_lastXing
Gaudi::Property< int > m_lastXing
last xing to be simulated (0th xing is 1st after trigger)
Definition: PileUpEventLoopMgr.h:131
PileUpStream.h
a triple selector/context/store defines a stream
IBeamIntensity
Definition: IBeamIntensity.h:17
PileUpEventLoopMgr::m_failureMode
Gaudi::Property< int > m_failureMode
property: control behaviour of event loop on algorithm failure
Definition: PileUpEventLoopMgr.h:140
PileUpEventLoopMgr::initialize
virtual StatusCode initialize()
implementation of IAppMgrUI::initialize
Definition: PileUpEventLoopMgr.cxx:120
PileUpEventLoopMgr::modifyEventContext
virtual void modifyEventContext(EventContext &ctx, const EventID &eID, bool consume_modifier_stream)
Definition: PileUpEventLoopMgr.cxx:224
PileUpEventLoopMgr::m_beamLumi
ServiceHandle< IBeamLuminosity > m_beamLumi
property: beam intensity service handle for luminosity profile in iovtime
Definition: PileUpEventLoopMgr.h:151
PileUpEventLoopMgr::m_loadProxies
bool m_loadProxies
Definition: PileUpEventLoopMgr.h:165
ServiceHandle< IIncidentSvc >