ATLAS Offline Software
PileUpEventLoopMgr.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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 : public extends<MinimalEventLoopMgr, IEventSeek>,
44  public AthMessaging
45 {
46 public:
47 
49  PileUpEventLoopMgr(const std::string& nam, ISvcLocator* svcLoc);
51  virtual ~PileUpEventLoopMgr();
52 
53 public:
55  virtual StatusCode initialize();
57  virtual StatusCode finalize();
59  // virtual StatusCode terminate();
61  virtual StatusCode nextEvent(int maxevt);
63  virtual StatusCode executeEvent( EventContext &&ctx );
64 
66  virtual StatusCode seek(int evt);
68  virtual int curEvent() const;
69 
70  virtual void modifyEventContext(EventContext& ctx, const EventID& eID, bool consume_modifier_stream);
71 
72  using AthMessaging::msg;
74 
75 
76 private:
78  SmartIF<IAlgExecStateSvc> m_aess;
79 
82 
84  virtual StatusCode executeAlgorithms(const EventContext& ctx);
85 
87  inline unsigned int getBCID(int bunchXing, unsigned int centralBCID) const {
88  //FIXME to be completely safe this should should probably depend on the bunch spacing too. Perhaps that concept should be deprecated though?
89  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));
90  }
91 
94 
97 
100 
102  ServiceHandle<StoreGateSvc> m_evtStore; // overlaid (output) event store
103 
107 
108  //unsigned int m_nInputs;
109  //unsigned int m_nStores;
110 
112 
118  ToolHandleArray<IBkgStreamsCache> m_caches;
120  Gaudi::Property<float> m_maxCollPerXing;
121 
123  Gaudi::Property<float> m_xingFreq;
125  Gaudi::Property<int> m_firstXing;
127  Gaudi::Property<int> m_lastXing;
128 
130  Gaudi::Property<bool> m_allowSubEvtsEOF;
131 
133  Gaudi::Property<bool> m_xingByXing;
134 
136  Gaudi::Property<int> m_failureMode;
137 
139  Gaudi::Property<std::string> m_evinfName;
140 
142  Gaudi::Property<std::string> m_evinfContName;
143 
149 
153 
156 
157  int m_nevt;
158 
162 
166  Gaudi::Property<bool> m_allowSerialAndMPToDiffer;
167 
168  Gaudi::Property<uint32_t> m_mcChannelNumber{ this, "MCChannelNumber", 0, "sample MC channel number" };
169 };
170 #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:93
PileUpEventLoopMgr::IEvtIdModifierSvc_t
ServiceHandle< IEvtIdModifierSvc > IEvtIdModifierSvc_t
Definition: PileUpEventLoopMgr.h:104
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:166
PileUpEventLoopMgr::m_signalSel
ServiceHandle< IEvtSelector > m_signalSel
Signal Event selector (for overlay).
Definition: PileUpEventLoopMgr.h:116
PileUpEventLoopMgr::nextEvent
virtual StatusCode nextEvent(int maxevt)
implementation of IAppMgreUI::terminate
Definition: PileUpEventLoopMgr.cxx:252
PileUpEventLoopMgr::m_origSel
ServiceHandle< IEvtSelector > m_origSel
Original (Physics) Event selector (background for overlay).
Definition: PileUpEventLoopMgr.h:114
PileUpEventLoopMgr
The ATLAS event loop for pile-up applications.
Definition: PileUpEventLoopMgr.h:45
PileUpEventLoopMgr::m_xingFreq
Gaudi::Property< float > m_xingFreq
Xing frequency(ns);.
Definition: PileUpEventLoopMgr.h:123
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
PileUpEventLoopMgr::m_skipExecAlgs
bool m_skipExecAlgs
Definition: PileUpEventLoopMgr.h:160
PileUpEventLoopMgr::m_evtStore
ServiceHandle< StoreGateSvc > m_evtStore
output store
Definition: PileUpEventLoopMgr.h:102
PileUpEventLoopMgr::m_evinfName
Gaudi::Property< std::string > m_evinfName
SG key for the EventInfoContainer.
Definition: PileUpEventLoopMgr.h:139
PileUpEventLoopMgr::executeAlgorithms
virtual StatusCode executeAlgorithms(const EventContext &ctx)
Run the algorithms for the current event.
Definition: PileUpEventLoopMgr.cxx:611
IEvtIdModifierSvc
Definition: IEvtIdModifierSvc.h:37
PileUpEventLoopMgr::m_origStream
PileUpStream m_origStream
Input Stream.
Definition: PileUpEventLoopMgr.h:99
PileUpEventLoopMgr::m_maxBunchCrossingPerOrbit
unsigned int m_maxBunchCrossingPerOrbit
max bunch crossings per orbit
Definition: PileUpEventLoopMgr.h:155
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:125
PileUpEventLoopMgr::m_ncurevt
int m_ncurevt
Definition: PileUpEventLoopMgr.h:159
PileUpEventLoopMgr::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
PileUp Merge Service.
Definition: PileUpEventLoopMgr.h:96
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:130
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:145
PileUpEventLoopMgr::m_nevt
int m_nevt
Definition: PileUpEventLoopMgr.h:157
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:32
PileUpEventLoopMgr::seek
virtual StatusCode seek(int evt)
Seek to a given event.
Definition: PileUpEventLoopMgr.cxx:549
PileUpEventLoopMgr::m_evinfContName
Gaudi::Property< std::string > m_evinfContName
SG key for the EventInfoContainer.
Definition: PileUpEventLoopMgr.h:142
PileUpEventLoopMgr::setupStreams
StatusCode setupStreams()
setup input and overlay selectors and iters
Definition: PileUpEventLoopMgr.cxx:579
PileUpEventLoopMgr::m_mcChannelNumber
Gaudi::Property< uint32_t > m_mcChannelNumber
Definition: PileUpEventLoopMgr.h:168
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:125
PileUpEventLoopMgr::getBCID
unsigned int getBCID(int bunchXing, unsigned int centralBCID) const
return the 'fake BCID' corresponding to bunchXing
Definition: PileUpEventLoopMgr.h:87
PileUpEventLoopMgr::executeEvent
virtual StatusCode executeEvent(EventContext &&ctx)
implementation of IEventProcessor::executeEvent(void* par)
Definition: PileUpEventLoopMgr.cxx:636
PileUpEventLoopMgr::m_maxCollPerXing
Gaudi::Property< float > m_maxCollPerXing
(max) minBias interactions per Xing, for setting MC luminosity
Definition: PileUpEventLoopMgr.h:120
PileUpEventLoopMgr::m_firstRun
bool m_firstRun
Definition: PileUpEventLoopMgr.h:152
PileUpEventLoopMgr::m_evtIdModSvc
IEvtIdModifierSvc_t m_evtIdModSvc
Definition: PileUpEventLoopMgr.h:106
PileUpEventLoopMgr::curEvent
virtual int curEvent() const
Return the current event count.
Definition: PileUpEventLoopMgr.cxx:570
PileUpEventLoopMgr::m_caches
ToolHandleArray< IBkgStreamsCache > m_caches
BkgStreamsCaches managing background events.
Definition: PileUpEventLoopMgr.h:118
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:133
PileUpEventLoopMgr::finalize
virtual StatusCode finalize()
implementation of IAppMgrUI::finalize
Definition: PileUpEventLoopMgr.cxx:195
PileUpEventLoopMgr::m_currentRun
uint32_t m_currentRun
current run number
Definition: PileUpEventLoopMgr.h:151
AthMessaging.h
PileUpEventLoopMgr::m_aess
SmartIF< IAlgExecStateSvc > m_aess
Reference to the Algorithm Execution State Svc.
Definition: PileUpEventLoopMgr.h:78
EventID
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventID.h:35
PileUpEventLoopMgr::m_lastXing
Gaudi::Property< int > m_lastXing
last xing to be simulated (0th xing is 1st after trigger)
Definition: PileUpEventLoopMgr.h:127
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:136
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:225
PileUpEventLoopMgr::m_beamLumi
ServiceHandle< IBeamLuminosity > m_beamLumi
property: beam intensity service handle for luminosity profile in iovtime
Definition: PileUpEventLoopMgr.h:147
PileUpEventLoopMgr::m_loadProxies
bool m_loadProxies
Definition: PileUpEventLoopMgr.h:161
ServiceHandle< IIncidentSvc >