ATLAS Offline Software
PileUpMTAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // PileUpMT includes
6 #include "PileUpMTAlg.h"
7 
8 #include <CxxUtils/XXH.h>
9 #include <fmt/chrono.h>
10 #include <fmt/format.h>
11 #include <fmt/ostream.h>
12 #include <unistd.h>
13 
14 #include <array>
15 #include <boost/core/demangle.hpp>
16 #include <chrono>
17 #include <range/v3/all.hpp>
18 #include <tuple>
19 
21 #include "CLHEP/Random/RandPoisson.h"
22 #include "CLHEP/Random/RandomEngine.h"
23 #include "EventInfo/EventID.h"
24 #include "EventInfo/EventInfo.h"
27 #include "PileUpTools/PileUpMisc.h"
28 #include "src/OnDemandMinbiasSvc.h"
33 
35 namespace rv = ranges::views;
36 // namespace ra = ranges::actions;
37 
38 inline std::string CLIDToString(const CLID& clid) {
39  return boost::core::demangle(CLIDRegistry::CLIDToTypeinfo(clid)->name());
40 }
41 
42 PileUpMTAlg::PileUpMTAlg(const std::string& name, ISvcLocator* pSvcLocator)
43  : AthAlgorithm(name, pSvcLocator) {}
44 
46 
48  std::unique_ptr<const xAOD::EventInfo>& ei_,
49  std::unique_ptr<xAOD::EventAuxInfo>& ei_aux_,
50  bool pileup) const {
51  std::string key = pileup ? "EventInfo" : "HSEventInfo";
52  xAOD::EventInfo* newEi = new xAOD::EventInfo();
54  newEi->setStore(eiAux);
55  SG::ReadHandle<xAOD::EventInfo> ei_h(key, sg.name());
56  const xAOD::EventInfo* ei = ei_h.get();
57  if (ei != nullptr) {
58  *newEi = *ei;
59  } else {
60  SG::ReadHandle<::EventInfo> ei2_h(key, sg.name());
61  const ::EventInfo* ei2 = ei2_h.get();
62  if (ei2 == nullptr) {
63  // Just in case
64  ATH_MSG_ERROR("Got null ::EventInfo from " << sg.name());
65  ATH_MSG_ERROR(sg.dump());
66  return StatusCode::FAILURE;
67  }
68  ATH_CHECK(m_xAODEICnvTool->convert(ei2, newEi, true));
69  }
70  // Use attribute list if EventInfo doesn't have event numbers set
71  if (newEi->eventNumber() == 0) {
72  const auto* attr_list_p = sg.tryConstRetrieve<AthenaAttributeList>("Input");
73  if (attr_list_p != nullptr) {
74  if (attr_list_p->size() <= 6) {
75  ATH_MSG_WARNING("Read Input attribute list but size <= 6");
76  } else {
77  const AthenaAttributeList& attr_list = *attr_list_p;
78  const auto runNum = attr_list["RunNumber"].data<unsigned>();
79  const auto evtNum = attr_list["EventNumber"].data<unsigned long long>();
80  const auto lbNum = attr_list["LumiBlockN"].data<unsigned>();
81  newEi->setRunNumber(runNum);
82  newEi->setLumiBlock(lbNum);
83  newEi->setEventNumber(evtNum);
84  }
85  } else {
87  "Could not read Input attribute list and EventInfo has no event "
88  "number");
89  }
90  }
91  newEi->setEvtStore(&sg);
92  ei_.reset(newEi);
93  ei_aux_.reset(eiAux);
94  return StatusCode::SUCCESS;
95 }
96 
98  const std::vector<std::uint32_t>& bcid,
102  int bc, const EventContext& ctx, unsigned long subevt_id,
103  std::vector<std::uint64_t>& trace) {
104  // Keep the code to add and process a subevent in one place
105  const unsigned int bc_idx = bc - m_earliestDeltaBC;
106  StoreGateSvc* sg = mbSvc->getMinbias(ctx, subevt_id);
107  std::unique_ptr<const xAOD::EventInfo> ei;
108  std::unique_ptr<xAOD::EventAuxInfo> eiAux;
109  ATH_CHECK(get_ei(*sg, ei, eiAux, true));
110  xAOD::EventInfo mb_to_modify(*ei);
111  if (m_writeTrace) {
112  trace.push_back(mb_to_modify.eventNumber());
113  }
114  mb_to_modify.setBCID(bcid[bc_idx]);
115  try {
116  addSubEvent(overlaidEvt.ptr(), &mb_to_modify, bc * m_BCSpacing, puType,
117  puCont.ptr(), m_evtInfoContKey.key(), sg);
118  } catch (const std::exception& e) {
119  ATH_MSG_ERROR("Caught exception adding subevent: " << e.what());
120  return StatusCode::FAILURE;
121  }
122  return StatusCode::SUCCESS;
123 }
124 
126  using namespace std::chrono;
127  ATH_MSG_DEBUG("Initializing " << name() << "...");
128  if (m_writeTrace) {
129  m_pileupTrace.init(
130  fmt::format("pileup_trace_skipping-{}_{:%Y-%m-%dT%H%M}.txt",
131  m_skippedHSEvents.value(),
132  fmt::localtime(system_clock::to_time_t(system_clock::now()))));
133  }
134  ATH_CHECK(m_skipEventIdxSvc.retrieve());
135  ATH_CHECK(m_rngSvc.retrieve());
136  if (m_fracLowPt != 0) {
137  ATH_CHECK(m_lowptMBSvc.retrieve());
138  }
139  if (m_fracHighPt != 0) {
140  ATH_CHECK(m_highptMBSvc.retrieve());
141  }
142  if (m_numCavern != 0) {
143  ATH_CHECK(m_cavernMBSvc.retrieve());
144  }
145  if (m_numBeamGas != 0) {
146  ATH_CHECK(m_beamgasMBSvc.retrieve());
147  }
148  if (m_numBeamHalo != 0) {
149  ATH_CHECK(m_beamhaloMBSvc.retrieve());
150  }
151  ATH_CHECK(m_beamInt.retrieve());
152  ATH_CHECK(m_beamLumi.retrieve());
153  ATH_CHECK(m_xAODEICnvTool.retrieve());
154  ATH_CHECK(m_puTools.retrieve());
155 
156  m_evtInfoContKey = "PileUpEventInfo";
158  ATH_CHECK(m_evtInfoContKey.initialize());
159 
160  // Trace skipped events
161  if (m_writeTrace) {
164  fmt::memory_buffer trace_buf{};
165  auto trace = std::back_inserter(trace_buf);
166  for (; it != end; ++it) {
167  fmt::format_to(trace, "SKIPPING Run: {} LB: {} EVT: {} HS ID: {}\n",
168  it->runNum, it->lbNum, it->evtNum, it->evtIdx);
169  }
170  m_pileupTrace.print(trace_buf);
171  return StatusCode::SUCCESS;
172  };
173  if (!m_skiptrace_written) {
174  ATH_CHECK(m_skipEventIdxSvc->registerCallback(handler));
175  m_skiptrace_written = true;
176  }
177  }
178  return StatusCode::SUCCESS;
179 }
180 
182  ATH_MSG_DEBUG("Finalizing " << name() << "...");
183  //
184  // Things that happen once at the end of the event loop go here
185  //
186 
187  return StatusCode::SUCCESS;
188 }
189 
191  using PUType = xAOD::EventInfo::PileUpType;
192  fmt::memory_buffer trace_buf{}; // Hold trace of events.
193  auto trace = std::back_inserter(trace_buf);
194  ATH_MSG_DEBUG("Executing " << name() << "...");
195  const EventContext& ctx = Gaudi::Hive::currentContext();
196  const auto& evtID = ctx.eventID();
197 
199  setFilterPassed(false); // optional: start with algorithm not passed
200 
201  // Code based on PileUpEventLoopMgr and PileUpToolsAlg (trying to extract the
202  // core merging code) Read hard scatter
203  std::unique_ptr<const xAOD::EventInfo> hsEvt = nullptr;
204  std::unique_ptr<xAOD::EventAuxInfo> hsEvtAux = nullptr;
205  ATH_CHECK(get_ei(*evtStore(), hsEvt, hsEvtAux));
206 
207  // Setup overlaid event
209  ATH_CHECK(overlaidEvt.record(std::make_unique<xAOD::EventInfo>(),
210  std::make_unique<xAOD::EventAuxInfo>()));
211  *overlaidEvt = *hsEvt; // copy in hard scatter
212  overlaidEvt->setEvtStore(evtStore().get());
213  overlaidEvt->clearSubEvents();
214 
215  // This was the problem. Need to fix overlaidEvt using context run and lb
216  // number
217  overlaidEvt->setRunNumber(evtID.run_number());
218  overlaidEvt->setLumiBlock(evtID.lumi_block());
219  overlaidEvt->setEventNumber(evtID.event_number());
220  overlaidEvt->setBCID(evtID.bunch_crossing_id());
221  overlaidEvt->setTimeStamp(evtID.time_stamp());
222  overlaidEvt->setTimeStampNSOffset(evtID.time_stamp_ns_offset());
223  // Pileup container
225  ATH_CHECK(puCont.record(std::make_unique<xAOD::EventInfoContainer>(),
226  std::make_unique<xAOD::EventInfoAuxContainer>()));
227 
228  // Get crossing number
229  m_beamInt->selectT0(evtID.run_number(), evtID.event_number());
230  overlaidEvt->setBCID(m_beamInt->getCurrentT0BunchCrossing());
231 
232  // Set simulation bit
233  overlaidEvt->setEventTypeBitmask(hsEvt->eventTypeBitmask() |
235 
236  // Set properties
237  bool sf_updated = false;
238  float lumi_sf = m_beamLumi->scaleFactor(evtID.run_number(),
239  evtID.lumi_block(), sf_updated);
240  float cur_avg_mu = lumi_sf * m_avgMu;
241  overlaidEvt->setAverageInteractionsPerCrossing(cur_avg_mu);
242  overlaidEvt->setActualInteractionsPerCrossing(m_beamInt->normFactor(0) *
243  cur_avg_mu);
244 
245  // Trace
246  if (m_writeTrace) {
247  fmt::format_to(trace,
248  "Idx: {} Run: {} LB: {} EVT: {} "
249  "HS ID: {}\n",
250  ctx.evt(), evtID.run_number(), evtID.lumi_block(),
251  evtID.event_number(), m_lowptMBSvc->get_hs_id(ctx));
252  auto bunch_pattern =
253  rv::closed_iota(m_earliestDeltaBC.value(), m_latestDeltaBC.value()) |
255  [this](int bc) { return int(m_beamInt->normFactor(bc)); }) |
256  rv::group_by(std::equal_to{}) | rv::transform([](const auto& rng) {
257  return fmt::format("{}{}", rng.size(), rng[0] == 0 ? 'E' : 'F');
258  }) |
259  ranges::to<std::vector<std::string>>;
260  fmt::format_to(trace, "mu = {}, central BCID = {}, bunch pattern = [{}]\n",
261  cur_avg_mu, m_beamInt->getCurrentT0BunchCrossing(),
262  fmt::join(bunch_pattern, " "));
263  }
264  // Copy subevents
265  if (!hsEvt->subEvents().empty()) {
266  for (const SubEvent& se : hsEvt->subEvents()) {
267  addSubEvent(overlaidEvt.ptr(), se, puCont.ptr(), m_evtInfoContKey.key(),
268  evtStore().get());
269  }
270  } else {
271  // if no subevents, add original event
272  addSubEvent(overlaidEvt.ptr(), hsEvt.get(), 0, xAOD::EventInfo::Signal,
273  puCont.ptr(), m_evtInfoContKey.key(), evtStore().get());
274  }
275 
276  // Initialize MinbiasSvcs
277  if (m_fracLowPt != 0) {
278  ATH_CHECK(m_lowptMBSvc->beginHardScatter(ctx));
279  }
280  if (m_fracHighPt != 0) {
281  ATH_CHECK(m_highptMBSvc->beginHardScatter(ctx));
282  }
283  if (m_numCavern != 0) {
284  ATH_CHECK(m_cavernMBSvc->beginHardScatter(ctx));
285  }
286  if (m_numBeamHalo != 0) {
287  ATH_CHECK(m_beamhaloMBSvc->beginHardScatter(ctx));
288  }
289  if (m_numBeamGas != 0) {
290  ATH_CHECK(m_beamgasMBSvc->beginHardScatter(ctx));
291  }
292 
293  std::uint32_t central_bcid = overlaidEvt->bcid();
294  std::vector<std::uint32_t> bcid{};
295  bcid.reserve(m_latestDeltaBC - m_earliestDeltaBC + 1);
296 
297  for (int bc = m_earliestDeltaBC; bc <= m_latestDeltaBC; ++bc) {
298  bcid.push_back(get_BCID(bc, central_bcid));
299  }
300 
301  // Setup tools
302  for (auto&& tool : m_puTools) {
303  // Reset filter -- Don't know if this is necessary
304  tool->resetFilter();
305  }
306 
307  // Now add the events
308  std::uint64_t low_pt_count = 0;
309  std::uint64_t high_pt_count = 0;
310  std::uint64_t cavern_count = 0;
311  std::uint64_t beam_halo_count = 0;
312  std::uint64_t beam_gas_count = 0;
314  for (int bc = m_earliestDeltaBC; bc <= m_latestDeltaBC; ++bc) {
315  if (m_beamInt->normFactor(bc) == 0.) {
316  // skip empty bunch crossings
317  continue;
318  }
319  std::vector<std::uint64_t> subevts_vec{};
320  if (m_fracLowPt != 0) {
321  if (m_writeTrace) {
322  fmt::format_to(trace, "\tBC {:03} : LOW PT {} ", bc,
323  m_lowptMBSvc->getNumForBunch(ctx, bc));
324  }
325  for (std::size_t i = 0; i < m_lowptMBSvc->getNumForBunch(ctx, bc); ++i) {
326  ATH_CHECK(add_subevt(bcid, overlaidEvt, puCont, m_lowptMBSvc,
327  PUType::MinimumBias, bc, ctx, low_pt_count,
328  subevts_vec));
329  ++low_pt_count;
330  }
331  }
332  if (m_fracHighPt != 0) {
333  if (m_writeTrace) {
334  fmt::format_to(trace, "HIGH PT {} | ",
335  m_highptMBSvc->getNumForBunch(ctx, bc));
336  }
337  for (std::size_t i = 0; i < m_highptMBSvc->getNumForBunch(ctx, bc); ++i) {
338  ATH_CHECK(add_subevt(bcid, overlaidEvt, puCont, m_highptMBSvc,
339  PUType::HighPtMinimumBias, bc, ctx, high_pt_count,
340  subevts_vec));
341  ++high_pt_count;
342  }
343  }
344  if (m_numCavern != 0) {
345  if (m_writeTrace) {
346  fmt::format_to(trace, "CAVERN {} | ",
347  m_cavernMBSvc->getNumForBunch(ctx, bc));
348  }
349  for (std::size_t i = 0; i < m_cavernMBSvc->getNumForBunch(ctx, bc); ++i) {
350  ATH_CHECK(add_subevt(bcid, overlaidEvt, puCont, m_cavernMBSvc,
351  PUType::Cavern, bc, ctx, cavern_count,
352  subevts_vec));
353  ++cavern_count;
354  }
355  }
356  if (m_numBeamHalo != 0) {
357  if (m_writeTrace) {
358  fmt::format_to(trace, "BEAM HALO {} | ",
359  m_beamhaloMBSvc->getNumForBunch(ctx, bc));
360  }
361  for (std::size_t i = 0; i < m_beamhaloMBSvc->getNumForBunch(ctx, bc);
362  ++i) {
363  ATH_CHECK(add_subevt(bcid, overlaidEvt, puCont, m_beamhaloMBSvc,
364  PUType::HaloGas, bc, ctx, beam_halo_count,
365  subevts_vec));
366  ++beam_halo_count;
367  }
368  }
369  if (m_numBeamGas != 0) {
370  if (m_writeTrace) {
371  fmt::format_to(trace, "BEAM GAS {} | ",
372  m_beamgasMBSvc->getNumForBunch(ctx, bc));
373  }
374  for (std::size_t i = 0; i < m_beamgasMBSvc->getNumForBunch(ctx, bc);
375  ++i) {
376  ATH_CHECK(add_subevt(bcid, overlaidEvt, puCont, m_beamgasMBSvc,
377  PUType::HaloGas, bc, ctx, beam_gas_count,
378  subevts_vec));
379  ++beam_gas_count;
380  }
381  }
382  if (m_writeTrace) {
383  fmt::format_to(trace, "TOTAL {} | HASH {:08X}\n", subevts_vec.size(),
384  xxh3::hash64(subevts_vec));
385  }
386  }
387  if (m_writeTrace) {
388  fmt::format_to(trace, "\n");
389  m_pileupTrace.print(trace_buf);
390  }
391 
392  for (auto&& tool : m_puTools) {
393  try {
394  ATH_CHECK(tool->processAllSubEvents(ctx));
395  } catch (const std::exception& e) {
396  ATH_MSG_ERROR("Caught exception running " << tool.name() << ": "
397  << e.what());
398  return StatusCode::FAILURE;
399  }
400  // Propagate filter result
401  if (!tool->filterPassed()) {
402  setFilterPassed(false);
403  }
404  }
405  ATH_MSG_DEBUG(fmt::format("***** Took {:%OMm %OSs} to process all subevents",
407  //
408  // Save hash (direct copy from PileUpEventLoopMgr)
409  PileUpHashHelper pileUpHashHelper;
410  pileUpHashHelper.addToHashSource(overlaidEvt.cptr());
411  ATH_MSG_VERBOSE("Pile-up hash source:" << pileUpHashHelper.hashSource());
412 
413  // Calculate and set hash
414  uuid_t pileUpHash;
415  pileUpHashHelper.calculateHash(pileUpHash);
416  overlaidEvt->setPileUpMixtureID(
418  ATH_MSG_DEBUG("PileUpMixtureID = " << overlaidEvt->pileUpMixtureID());
419 
420  setFilterPassed(true); // if got here, assume that means algorithm passed
421  if (m_fracLowPt != 0) {
422  ATH_CHECK(m_lowptMBSvc->endHardScatter(ctx));
423  }
424  if (m_fracHighPt != 0) {
425  ATH_CHECK(m_highptMBSvc->endHardScatter(ctx));
426  }
427  if (m_numCavern != 0) {
428  ATH_CHECK(m_cavernMBSvc->endHardScatter(ctx));
429  }
430  if (m_numBeamHalo != 0) {
431  ATH_CHECK(m_beamhaloMBSvc->endHardScatter(ctx));
432  }
433  if (m_numBeamGas != 0) {
434  ATH_CHECK(m_beamgasMBSvc->endHardScatter(ctx));
435  }
436  return StatusCode::SUCCESS;
437 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
PileUpHashHelper.h
A helper class to compute a hash of pile-up events.
xAOD::EventInfo_v1::setActualInteractionsPerCrossing
void setActualInteractionsPerCrossing(float value)
Set average interactions per crossing for the current BCID.
Definition: EventInfo_v1.cxx:391
xAOD::EventInfo_v1::setEventNumber
void setEventNumber(uint64_t value)
Set the current event's event number.
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition: IEventInfoCnvTool.h:17
vtune_athena.format
format
Definition: vtune_athena.py:14
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
PileUpEventInfo.h
This class provides information about an overlaid event. It extends EventInfo with a list of sub-evts...
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
PileUpMTAlg::m_numBeamHalo
Gaudi::Property< float > m_numBeamHalo
Definition: PileUpMTAlg.h:127
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
PileUpMTAlg::initialize
virtual StatusCode initialize() override
uncomment and implement methods as required
Definition: PileUpMTAlg.cxx:125
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
xAOD::EventAuxInfo_v3
Auxiliary information about the event.
Definition: EventAuxInfo_v3.h:28
PileUpMTAlg::finalize
virtual StatusCode finalize() override
Definition: PileUpMTAlg.cxx:181
EventInfo
EventInfo
Definition: EventTPCnv.cxx:47
xAOD::EventInfo_v1::clearSubEvents
void clearSubEvents()
Clear all the currently held sub-events.
Definition: EventInfo_v1.cxx:647
EventInfoAuxContainer.h
PileUpMTAlg::m_lowptMBSvc
ServiceHandle< IMinbiasSvc > m_lowptMBSvc
Other useful methods provided by base class are: evtStore() : ServiceHandle to main event data storeg...
Definition: PileUpMTAlg.h:94
skel.it
it
Definition: skel.GENtoEVGEN.py:423
PileUpMTAlg::m_fracLowPt
Gaudi::Property< float > m_fracLowPt
Definition: PileUpMTAlg.h:119
xAOD::EventInfo_v1::PileUpType
PileUpType
Enumerator describing the types of pileup events.
Definition: EventInfo_v1.h:264
CLIDRegistry::CLIDToTypeinfo
static const std::type_info * CLIDToTypeinfo(CLID clid)
Translate between CLID and type_info.
Definition: CLIDRegistry.cxx:136
PileUpHashHelper::uuidToPileUpMixtureId
static xAOD::EventInfo::PileUpMixtureID uuidToPileUpMixtureId(const uuid_t &hash)
Convert uuid_t to xAOD::EventInfo::PileUpMixtureID.
Definition: PileUpHashHelper.cxx:57
xAOD::EventInfo_v1::eventTypeBitmask
uint32_t eventTypeBitmask() const
The event type bitmask.
PileUpHashHelper
Definition: PileUpHashHelper.h:21
python.PileUpEventType.MinimumBias
int MinimumBias
Definition: PileUpEventType.py:4
PileUpHashHelper::hashSource
std::string hashSource() const
Get the current hash base.
Definition: PileUpHashHelper.h:35
SG::WriteHandle::cptr
const_pointer_type cptr() const
Dereference the pointer.
PileUpMTAlg::~PileUpMTAlg
virtual ~PileUpMTAlg()
Definition: PileUpMTAlg.cxx:45
PileUpMTAlg::m_latestDeltaBC
Gaudi::Property< int > m_latestDeltaBC
Definition: PileUpMTAlg.h:134
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
PileUpMTAlg::m_avgMu
Gaudi::Property< float > m_avgMu
Definition: PileUpMTAlg.h:118
skel.runNum
runNum
Definition: skel.ABtoEVGEN.py:137
D3PDTest::rng
uint32_t rng()
Definition: FillerAlg.cxx:40
keylayer_zslicemap.se
se
Definition: keylayer_zslicemap.py:194
xAOD::EventInfo_v1::IS_SIMULATION
@ IS_SIMULATION
true: simulation, false: data
Definition: EventInfo_v1.h:151
PileUpMTAlg::m_beamInt
ServiceHandle< IBeamIntensity > m_beamInt
Definition: PileUpMTAlg.h:104
xAOD::EventInfo_v1::pileUpMixtureID
PileUpMixtureID pileUpMixtureID() const
Unique pile-up mixture identifier.
Definition: EventInfo_v1.cxx:421
python.PileUpEventType.HighPtMinimumBias
int HighPtMinimumBias
Definition: PileUpEventType.py:7
EventInfoContainer.h
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
handler
void handler(int sig)
signal handler
Definition: rmain.cxx:98
PileUpMTAlg::m_writeTrace
Gaudi::Property< bool > m_writeTrace
Definition: PileUpMTAlg.h:115
PileUpMTAlg::m_evtInfoContKey
SG::WriteHandleKey< xAOD::EventInfoContainer > m_evtInfoContKey
Definition: PileUpMTAlg.h:142
PileUpMTAlg::m_numCavern
Gaudi::Property< float > m_numCavern
Definition: PileUpMTAlg.h:123
PileUpMTAlg::m_earliestDeltaBC
Gaudi::Property< int > m_earliestDeltaBC
Definition: PileUpMTAlg.h:131
xAOD::EventInfo_v1::setPileUpMixtureID
void setPileUpMixtureID(const PileUpMixtureID &value)
Set unique pile-up mixture identifier.
Definition: EventInfo_v1.cxx:436
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
PileUpMTAlg::execute
virtual StatusCode execute() override
Definition: PileUpMTAlg.cxx:190
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
PileUpMTAlg::m_highptMBSvc
ServiceHandle< IMinbiasSvc > m_highptMBSvc
Definition: PileUpMTAlg.h:96
EventID.h
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
python.handimod.now
now
Definition: handimod.py:675
StoreGateSvc::dump
std::string dump() const
dump objects in store.
Definition: StoreGateSvc.cxx:387
CLIDToString
std::string CLIDToString(const CLID &clid)
Definition: PileUpMTAlg.cxx:38
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::EventInfo_v1::setEventTypeBitmask
void setEventTypeBitmask(uint32_t value)
Set the event type bitmask.
PileUpMTAlg::m_numBeamGas
Gaudi::Property< float > m_numBeamGas
Definition: PileUpMTAlg.h:125
OnDemandMinbiasSvc.h
lumiFormat.i
int i
Definition: lumiFormat.py:92
SG::AuxElement::setStore
void setStore(const SG::IConstAuxStore *store)
Set the store associated with this object.
Definition: AuxElement.cxx:221
PileUpMTAlg::m_xAODEICnvTool
ToolHandle< xAODMaker::IEventInfoCnvTool > m_xAODEICnvTool
Definition: PileUpMTAlg.h:110
ISkipEventIdxSvc::EvtIter
std::vector< EvtId >::const_iterator EvtIter
Definition: ISkipEventIdxSvc.h:23
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
SG::ReadHandle::get
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
PileUpMTAlg::m_beamLumi
ServiceHandle< IBeamLuminosity > m_beamLumi
Definition: PileUpMTAlg.h:106
calibdata.exception
exception
Definition: calibdata.py:496
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
python.PileUpEventType.HaloGas
int HaloGas
Definition: PileUpEventType.py:6
PileUpHashHelper::addToHashSource
void addToHashSource(const std::string &string)
Add a plain string to the stream.
Definition: PileUpHashHelper.cxx:11
PileUpMTAlg::m_beamgasMBSvc
ServiceHandle< IMinbiasSvc > m_beamgasMBSvc
Definition: PileUpMTAlg.h:102
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:45
XXH.h
C++ native wrapper for the C xxhash API.
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
PileUpMTAlg::get_BCID
unsigned int get_BCID(int bc, unsigned int central_BCID) const
Definition: PileUpMTAlg.h:148
xAOD::EventInfo_v1::setTimeStamp
void setTimeStamp(uint32_t value)
Set the POSIX time of the event.
xAOD::EventInfo_v1::setBCID
void setBCID(uint32_t value)
Set the bunch crossing ID of the event.
PileUpMTAlg::m_beamhaloMBSvc
ServiceHandle< IMinbiasSvc > m_beamhaloMBSvc
Definition: PileUpMTAlg.h:100
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
PileUpMTAlg::add_subevt
StatusCode add_subevt(const std::vector< std::uint32_t > &bcid, SG::WriteHandle< xAOD::EventInfo > &overlaidEvt, SG::WriteHandle< xAOD::EventInfoContainer > &puCont, ServiceHandle< IMinbiasSvc > &mbSvc, xAOD::EventInfo::PileUpType puType, int bc, const EventContext &ctx, unsigned long subevt_id, std::vector< std::uint64_t > &trace)
Definition: PileUpMTAlg.cxx:97
AthAlgorithm
Definition: AthAlgorithm.h:47
xAOD::EventAuxInfo
EventAuxInfo_v3 EventAuxInfo
Definition of the latest event auxiliary info version.
Definition: EventAuxInfo.h:15
PileUpMTAlg.h
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
PileUpMTAlg::m_rngSvc
ServiceHandle< IAthRNGSvc > m_rngSvc
Definition: PileUpMTAlg.h:108
dqt_zlumi_pandas.pileup
pileup
Definition: dqt_zlumi_pandas.py:185
EventAuxInfo.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
PileUpMTAlg::m_BCSpacing
Gaudi::Property< int > m_BCSpacing
Definition: PileUpMTAlg.h:129
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
xAOD::EventInfo_v1::setAverageInteractionsPerCrossing
void setAverageInteractionsPerCrossing(float value)
Set average interactions per crossing for all BCIDs.
Definition: EventInfo_v1.cxx:408
PileUpMTAlg::m_skippedHSEvents
Gaudi::Property< int > m_skippedHSEvents
Definition: PileUpMTAlg.h:116
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
dq_make_web_display.rv
def rv
Definition: dq_make_web_display.py:219
RNGWrapper.h
StoreGateSvc::tryConstRetrieve
const T * tryConstRetrieve() const
EventInfo.h
CxxUtils::to
CONT to(RANGE &&r)
Definition: ranges.h:32
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
PileUpMTAlg::m_skipEventIdxSvc
ServiceHandle< ISkipEventIdxSvc > m_skipEventIdxSvc
Definition: PileUpMTAlg.h:137
xAOD::EventInfo_v1::setTimeStampNSOffset
void setTimeStampNSOffset(uint32_t value)
Set the nanosecond offset wrt. the time stamp.
xxh3::hash64
std::uint64_t hash64(const void *data, std::size_t size)
Passthrough to XXH3_64bits.
Definition: XXH.cxx:9
xAOD::EventInfo_v1::Signal
@ Signal
The signal event.
Definition: EventInfo_v1.h:266
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
PileUpMTAlg::m_fracHighPt
Gaudi::Property< float > m_fracHighPt
Definition: PileUpMTAlg.h:121
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAOD::EventInfo_v1::setRunNumber
void setRunNumber(uint32_t value)
Set the current event's run number.
PileUpMTAlg::m_cavernMBSvc
ServiceHandle< IMinbiasSvc > m_cavernMBSvc
Definition: PileUpMTAlg.h:98
PileUpMTAlg::PileUpMTAlg
PileUpMTAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: PileUpMTAlg.cxx:42
python.PileUpEventType.Cavern
int Cavern
Definition: PileUpEventType.py:5
PileUpHashHelper::calculateHash
void calculateHash(uuid_t &hash) const
Calculate the hash.
Definition: PileUpHashHelper.cxx:49
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
PileUpMisc.h
PileUpMTAlg::get_ei
StatusCode get_ei(StoreGateSvc &sg, std::unique_ptr< const xAOD::EventInfo > &ei, std::unique_ptr< xAOD::EventAuxInfo > &eiAux, bool pileup=false) const
Definition: PileUpMTAlg.cxx:47
PileUpMTAlg::m_puTools
ToolHandleArray< IPileUpTool > m_puTools
Definition: PileUpMTAlg.h:113
xAOD::EventInfo_v1::setLumiBlock
void setLumiBlock(uint32_t value)
Set the current event's luminosity block number.
xAOD::EventInfo_v1::subEvents
const std::vector< SubEvent > & subEvents() const
Get the pileup events that were used in the simulation.
Definition: EventInfo_v1.cxx:596
xAOD::EventInfo_v1::bcid
uint32_t bcid() const
The bunch crossing ID of the event.
SubEvent
xAOD::EventInfo::SubEvent SubEvent
Definition: PileUpMTAlg.cxx:34
xAOD::EventInfo_v1::SubEvent
Class describing the properties of one pileup sub-event.
Definition: EventInfo_v1.h:286
addSubEvent
xAOD::EventInfo * addSubEvent(xAOD::EventInfo *targetEv, const xAOD::EventInfo::SubEvent &subev, xAOD::EventInfoContainer *eiContainer, const std::string &eiContKey, StoreGateSvc *subev_store=nullptr)
Definition: PileUpMisc.cxx:17
PileUpMTAlg::m_evtInfoKey
SG::WriteHandleKey< xAOD::EventInfo > m_evtInfoKey
Definition: PileUpMTAlg.h:140
ServiceHandle< IMinbiasSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37