ATLAS Offline Software
BatchedMinbiasSvc.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2022, 2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "BatchedMinbiasSvc.h"
6 
7 #include <GaudiKernel/ConcurrencyFlags.h>
8 #include <fmt/chrono.h>
9 #include <fmt/format.h>
10 
11 #include <algorithm>
12 #include <boost/core/demangle.hpp>
13 #include <chrono>
14 #include <cmath>
15 #include <random>
16 #include <range/v3/algorithm/stable_sort.hpp>
17 #include <range/v3/numeric/accumulate.hpp>
18 #include <range/v3/to_container.hpp>
19 #include <range/v3/view.hpp>
20 #include <thread>
21 
25 #include "EventInfo/EventID.h"
26 #include "EventInfo/EventInfo.h"
29 
30 namespace rv = ranges::views;
31 
32 inline std::string CLIDToString(const CLID& clid) {
33  return boost::core::demangle(CLIDRegistry::CLIDToTypeinfo(clid)->name());
34 }
35 
36 BatchedMinbiasSvc::BatchedMinbiasSvc(const std::string& name, ISvcLocator* svc)
37  : base_class(name, svc),
38  m_bkg_evt_sel_ctx(nullptr),
39  m_last_loaded_batch() {}
40 
42 
43 int BatchedMinbiasSvc::event_to_batch(std::int64_t hs_id) {
44  return int(hs_id / m_HSBatchSize.value());
45 }
46 
48  ATH_CHECK(m_skipEventIdxSvc.retrieve());
49  ATH_CHECK(m_beamInt.retrieve());
50  ATH_CHECK(m_beamLumi.retrieve());
51  std::size_t n_concurrent =
52  Gaudi::Concurrency::ConcurrencyFlags::numConcurrentEvents();
53  m_idx_lists.clear();
54  m_idx_lists.resize(n_concurrent);
55 
56  m_num_mb_by_bunch.clear();
57  m_num_mb_by_bunch.resize(n_concurrent);
58 
59  m_cache.clear();
60  m_empty_caches.clear();
61  m_batch_use_count.clear();
62  m_batch_use_count.reserve(m_actualNHSEventsPerBatch.value().size());
63  for (std::size_t i = 0; i < m_actualNHSEventsPerBatch.value().size(); ++i) {
64  m_batch_use_count.emplace_back(std::make_unique<std::atomic_int>(0));
65  }
66  ATH_CHECK(m_bkgEventSelector.retrieve());
67  ATH_CHECK(m_activeStoreSvc.retrieve());
68  // Setup context
69  if (!m_bkgEventSelector->createContext(m_bkg_evt_sel_ctx).isSuccess()) {
70  ATH_MSG_ERROR("Failed to create background event selector context");
71  return StatusCode::FAILURE;
72  }
73  ATH_CHECK(dynamic_cast<Service*>(m_bkgEventSelector.get())->start());
74 
75  // Setup proxy provider
76  IProxyProviderSvc* proxyProviderSvc = nullptr;
77  ATH_CHECK(serviceLocator()->service(
78  fmt::format("ProxyProviderSvc/BkgPPSvc_{}", name()), proxyProviderSvc,
79  true));
80  // Setup Address Providers
81  auto* addressProvider =
82  dynamic_cast<IAddressProvider*>(m_bkgEventSelector.get());
83  if (addressProvider == nullptr) {
85  "Could not cast background event selector to IAddressProvider");
86  } else {
87  proxyProviderSvc->addProvider(addressProvider);
88  }
89  // AthenaPoolAddressProviderSvc
90  IService* athPoolSvc = nullptr;
91  ATH_CHECK(serviceLocator()->service(
92  fmt::format("AthenaPoolAddressProviderSvc/BkgAPAPSvc_{}", name()),
93  athPoolSvc));
94  auto* athPoolAP = dynamic_cast<IAddressProvider*>(athPoolSvc);
95  if (athPoolAP == nullptr) {
97  "Could not cast AthenaPoolAddressProviderSvc to IAddressProvider");
98  } else {
99  proxyProviderSvc->addProvider(athPoolAP);
100  }
101  // AddressRemappingSvc
102  IService* addRemapSvc = nullptr;
103  ATH_CHECK(serviceLocator()->service(
104  fmt::format("AddressRemappingSvc/BkgARSvc_{}", name()), addRemapSvc));
105  auto* addRemapAP = dynamic_cast<IAddressProvider*>(addRemapSvc);
106  if (addRemapAP == nullptr) {
107  ATH_MSG_WARNING("Could not cast AddressRemappingSvc to IAddressProvider");
108  } else {
109  proxyProviderSvc->addProvider(addRemapAP);
110  }
111 
112  int mbBatchSize = m_MBBatchSize.value();
113  // setup NSimultaneousBatches vectors of MBBatchSize StoreGates in
114  // m_empty_caches
115  for (int i = 0; i < m_NSimultaneousBatches.value(); ++i) {
116  auto& sgs = m_empty_caches.emplace_back(std::make_unique<SGHandleArray>());
117  sgs->reserve(mbBatchSize);
118  for (int j = 0; j < mbBatchSize; ++j) {
119  // creates / retrieves a different StoreGateSvc for each slot
120  auto& sg = sgs->emplace_back(
121  fmt::format("StoreGateSvc/StoreGate_{}_{}_{}", name(), i, j), name());
122  ATH_CHECK(sg.retrieve());
123  sg->setStoreID(StoreID::PILEUP_STORE);
124  sg->setProxyProviderSvc(proxyProviderSvc);
125  }
126  }
127 
128  // Setup the spare store for event skipping
129  ATH_CHECK(m_spare_store.retrieve());
131  m_spare_store->setProxyProviderSvc(proxyProviderSvc);
132 
133  // Setup the callback for event skipping
134  auto skipEvent_callback = [this, mbBatchSize](
137  using namespace std::chrono_literals;
138  auto evts = ranges::make_subrange(begin, end);
139  ATH_MSG_INFO("Skipping " << end - begin << " HS events.");
140  auto batches_all =
141  evts | rv::transform([this](const ISkipEventIdxSvc::EvtId& evt) {
142  return event_to_batch(evt.evtIdx);
143  });
144  std::vector<std::tuple<int, int>> batches_with_counts{};
145  // Produce a list of batches, and how many times they appear
146  for (int batch : batches_all) {
147  // First entry
148  if (batches_with_counts.empty()) {
149  batches_with_counts.emplace_back(batch, 1);
150  continue;
151  }
152  // Subsequent entries
153  auto& last_entry = batches_with_counts.back();
154  if (batch == std::get<0>(last_entry)) {
155  std::get<1>(last_entry) += 1;
156  continue;
157  }
158  batches_with_counts.emplace_back(batch, 1);
159  }
160 
161  // Discard batches
162  const int hs_batch_size = m_HSBatchSize.value();
163  auto* const old_store = m_activeStoreSvc->activeStore();
164  m_activeStoreSvc->setStore(m_spare_store.get());
165  ATH_CHECK(m_spare_store->clearStore());
166  for (const auto& [batch, count] : batches_with_counts) {
167  if (m_cache.count(batch) != 0) {
168  // batch is currently loaded, just update the use count
169  m_batch_use_count[batch]->fetch_add(count);
170  continue;
171  }
172  // force ordering in background stream
173  while (m_last_loaded_batch < batch - 1) {
174  std::this_thread::sleep_for(50ms);
175  }
176  // if we aren't skipping all the hardscatters in the batch, do nothing
177  if ((m_batch_use_count[batch]->fetch_add(count) + count) <
178  hs_batch_size) {
179  continue;
180  }
181  // otherwise discard the batch
182  ATH_MSG_INFO("Discarding batch " << batch);
183  std::unique_lock lck{m_reading_batch_mtx};
184  if (!m_bkgEventSelector->next(*m_bkg_evt_sel_ctx, mbBatchSize)
185  .isSuccess()) {
186  ATH_MSG_INFO("Ran out of background events");
187  return StatusCode::FAILURE;
188  }
189  // increment counters
190  m_last_loaded_batch.fetch_add(1);
191  }
192  ATH_CHECK(m_spare_store->clearStore());
193  m_activeStoreSvc->setStore(old_store);
194  return StatusCode::SUCCESS;
195  };
196 
197  // register callback
198  ATH_CHECK(m_skipEventIdxSvc->registerCallback(skipEvent_callback));
199  return StatusCode::SUCCESS;
200 }
201 
202 std::size_t BatchedMinbiasSvc::calcMBRequired(std::int64_t hs_id,
203  std::size_t slot,
204  unsigned int run,
205  unsigned int lumi,
207  const int n_bunches = m_latestDeltaBC.value() - m_earliestDeltaBC.value() + 1;
208  FastReseededPRNG prng{m_seed.value(), hs_id};
209 
210  // First apply the beam luminosity SF
211  bool sf_updated_throwaway;
212  const float beam_lumi_sf =
213  m_useBeamLumi ? m_beamLumi->scaleFactor(run, lumi, sf_updated_throwaway)
214  : 1.f;
215  std::vector<float> avg_num_mb_by_bunch(n_bunches,
216  beam_lumi_sf * m_nPerBunch.value());
217  // Now update using beam intensities
218  if (m_useBeamInt) {
219  // Supposed to be once per event, but ends up running once per minbias type
220  // per event now
221  m_beamInt->selectT0(run, event);
222  for (int bunch = m_earliestDeltaBC.value();
223  bunch <= m_latestDeltaBC.value(); ++bunch) {
224  std::size_t idx = bunch - m_earliestDeltaBC.value();
225  avg_num_mb_by_bunch[idx] *= m_beamInt->normFactor(bunch);
226  }
227  }
228 
229  std::vector<std::uint64_t>& num_mb_by_bunch = m_num_mb_by_bunch[slot];
230  num_mb_by_bunch.clear();
231  num_mb_by_bunch.resize(n_bunches);
232 
233  if (m_usePoisson) {
234  std::transform(avg_num_mb_by_bunch.begin(), avg_num_mb_by_bunch.end(),
235  num_mb_by_bunch.begin(), [&prng](float avg) {
236  return std::poisson_distribution<std::uint64_t>(avg)(prng);
237  });
238  } else {
239  std::transform(avg_num_mb_by_bunch.begin(), avg_num_mb_by_bunch.end(),
240  num_mb_by_bunch.begin(), [](float f) {
241  return static_cast<std::uint64_t>(std::round(f));
242  });
243  }
244 
245  std::uint64_t num_mb = ranges::accumulate(num_mb_by_bunch, 0UL);
246  std::vector<std::uint64_t>& index_array = m_idx_lists[slot];
247  const std::uint64_t mbBatchSize = m_MBBatchSize.value();
248  // Prevent running out of events
249  if (num_mb > mbBatchSize) {
250  const int center_bunch = -m_earliestDeltaBC.value();
251  auto indices =
252  rv::iota(0ULL, num_mb_by_bunch.size()) |
253  rv::filter([center_bunch, &num_mb_by_bunch](int idx) {
254  bool good = idx != center_bunch; // filter out the central bunch
255  good =
256  good && num_mb_by_bunch[idx] > 0; // filter out unfilled bunches
257  return good;
258  }) |
259  ranges::to<std::vector>;
260  // sort by distance from central bunch
261  ranges::stable_sort(indices, std::greater{},
262  [center_bunch](std::size_t idx) {
263  return std::size_t(std::abs(int(idx) - center_bunch));
264  });
265  // subtract from bunches until we aren't using too many events
266  for (auto idx : indices) {
267  const std::uint64_t max_to_subtract = num_mb - mbBatchSize;
268  const std::uint64_t num_subtracted =
269  std::min(max_to_subtract, num_mb_by_bunch[idx]);
270  num_mb_by_bunch[idx] -= num_subtracted;
271  num_mb -= num_subtracted;
272  if (num_mb <= mbBatchSize) {
273  break;
274  }
275  }
276  // Print an error anyway so we can fix the job
277  ATH_MSG_ERROR("We need " << num_mb << " events but the batch size is "
278  << mbBatchSize << ". Restricting to "
279  << mbBatchSize << " events!");
280  }
281  index_array = rv::ints(0, int(mbBatchSize)) | rv::sample(num_mb, prng) |
282  ranges::to<std::vector<std::uint64_t>>;
283  ranges::shuffle(index_array, prng);
284  if (m_HSBatchSize > 1) {
285  ATH_MSG_DEBUG("HS ID " << hs_id << " uses " << num_mb << " events");
286  } else {
287  ATH_MSG_DEBUG("HS ID " << hs_id << " uses " << num_mb << " events\n"
288  << fmt::format("\t\tBy bunch: [{}]\n",
289  fmt::join(num_mb_by_bunch, ", "))
290  << fmt::format("\t\tOrder: [{}]",
291  fmt::join(index_array, ", ")));
292  }
293  return num_mb;
294 }
295 
297  using namespace std::chrono_literals;
298  bool first_wait = true;
299  std::chrono::steady_clock::time_point cache_wait_start{};
300  std::chrono::steady_clock::time_point order_wait_start{};
301  const std::int64_t hs_id = get_hs_id(ctx);
302  const int batch = event_to_batch(hs_id);
303  calcMBRequired(hs_id, ctx.slot(),
304  ctx.eventID().run_number(), // don't need the total, only
305  ctx.eventID().lumi_block(), // need to populate the arrays
306  ctx.eventID().event_number());
307  while (true) {
308  if (m_cache.count(batch) != 0) {
309  // batch already loaded
310  // mutex prevents returning when batch is partially loaded
311  m_cache_mtxs[batch].lock();
312  m_cache_mtxs[batch].unlock();
313  return StatusCode::SUCCESS;
314  }
315  // prevent batches loading out-of-order
316  if (m_last_loaded_batch < (batch - 1)) {
317  ATH_MSG_INFO("Waiting to prevent out-of-order loading of batches");
318  order_wait_start = std::chrono::steady_clock::now();
319  while (m_last_loaded_batch < (batch - 1)) {
320  std::this_thread::sleep_for(50ms);
321  }
322  auto wait_time = std::chrono::steady_clock::now() - order_wait_start;
324  "Waited {:%M:%S} to prevent out-of-order loading", wait_time));
325  }
326  // See if there are any free caches
327  // Using try_lock here to avoid reading same batch twice
328  if (m_empty_caches_mtx.try_lock()) {
329  if (m_empty_caches.empty()) {
330  // Unlock mutex if we got the lock but there were no free caches
331  m_empty_caches_mtx.unlock();
332  if (first_wait) {
333  ATH_MSG_INFO("Waiting for a free cache");
334  first_wait = false;
335  cache_wait_start = std::chrono::steady_clock::now();
336  }
337  // Wait 100ms then try again
338  std::this_thread::sleep_for(100ms);
339  continue;
340  }
341  if (!first_wait) {
342  auto wait_time = std::chrono::steady_clock::now() - cache_wait_start;
343  ATH_MSG_INFO(
344  fmt::format("Waited {:%M:%S} for a free cache", wait_time));
345  }
346  std::scoped_lock reading{m_cache_mtxs[batch], m_reading_batch_mtx};
347  if (m_HSBatchSize != 0) {
348  ATH_MSG_INFO("Reading next batch in event " << ctx.evt() << ", slot "
349  << ctx.slot() << " (hs_id "
350  << hs_id << ")");
351  }
352  auto start_time = std::chrono::system_clock::now();
353  m_cache[batch] = std::move(m_empty_caches.front());
354  m_empty_caches.pop_front();
355  // Remember old store to reset later
356  auto* old_store = m_activeStoreSvc->activeStore();
357  for (auto&& sg : *m_cache[batch]) {
358  // Change active store
359  m_activeStoreSvc->setStore(sg.get());
360  SG::CurrentEventStore::Push reader_sg_ces(sg.get());
361  // Read next event
362  ATH_CHECK(sg->clearStore(true));
363  if (!(m_bkgEventSelector->next(*m_bkg_evt_sel_ctx)).isSuccess()) {
364  ATH_MSG_FATAL("Ran out of minbias events");
365  return StatusCode::FAILURE;
366  }
367  IOpaqueAddress* addr = nullptr;
368  if (!m_bkgEventSelector->createAddress(*m_bkg_evt_sel_ctx, addr)
369  .isSuccess()) {
370  ATH_MSG_WARNING("Failed to create address. No more events?");
371  return StatusCode::FAILURE;
372  }
373  if (addr == nullptr) {
374  ATH_MSG_WARNING("createAddress returned nullptr. No more events?");
375  return StatusCode::FAILURE;
376  }
377  ATH_CHECK(sg->recordAddress(addr));
378  ATH_CHECK(sg->loadEventProxies());
379  // Read data now if desired
380  for (const auto* proxy_ptr : sg->proxies()) {
381  if (!proxy_ptr->isValid()) {
382  continue;
383  }
384 
385  if (!m_onDemandMB) {
386  // Sort of a const_cast, then ->accessData()
387  sg->proxy_exact(proxy_ptr->sgkey())->accessData();
388  }
389  }
390  }
391  // Reset active store
392  m_activeStoreSvc->setStore(old_store);
393  if (m_HSBatchSize != 0) {
395  "Reading {} events took {:%OMm %OSs}", m_cache[batch]->size(),
396  std::chrono::system_clock::now() - start_time));
397  }
398  m_empty_caches_mtx.unlock();
399  m_last_loaded_batch.exchange(batch);
400  return StatusCode::SUCCESS;
401  }
402  }
403  return StatusCode::SUCCESS;
404 }
405 
407  std::uint64_t mb_id) {
408  const std::int64_t hs_id = get_hs_id(ctx);
409  const std::size_t slot = ctx.slot();
410  const std::size_t index = m_idx_lists.at(slot).at(mb_id);
411  const int batch = event_to_batch(hs_id);
412  return m_cache[batch]->at(index).get();
413 }
414 
415 std::size_t BatchedMinbiasSvc::getNumForBunch(const EventContext& ctx,
416  int bunch) const {
417  if (bunch < m_earliestDeltaBC.value() || bunch > m_latestDeltaBC.value()) {
418  throw std::logic_error(fmt::format(
419  "Tried to request bunch {} which is outside the range [{}, {}]", bunch,
420  m_earliestDeltaBC.value(), m_latestDeltaBC.value()));
421  }
422  return m_num_mb_by_bunch.at(ctx.slot()).at(bunch - m_earliestDeltaBC.value());
423 }
424 
426  using namespace std::chrono_literals;
427  const std::int64_t hs_id = get_hs_id(ctx);
428  const int batch = event_to_batch(hs_id);
429  const int uses = m_batch_use_count[batch]->fetch_add(1) + 1;
430 
431  // If we're done with every event in the batch, clear the stores and return
432  // them
433  if (uses == m_HSBatchSize.value()) {
434  std::unique_ptr temp = std::move(m_cache[batch]);
435  m_cache.erase(batch);
436  for (auto&& sg : *temp) {
437  ATH_CHECK(sg->clearStore());
438  }
439  std::lock_guard lg{m_empty_caches_mtx};
440  m_empty_caches.emplace_back(std::move(temp));
441  } else {
442  ATH_MSG_DEBUG("BATCH " << batch << ": " << uses << " uses out of "
443  << m_HSBatchSize << " "
445  }
446  return StatusCode::SUCCESS;
447 }
CLIDToString
std::string CLIDToString(const CLID &clid)
Definition: BatchedMinbiasSvc.cxx:32
CurrentEventStore.h
Hold a pointer to the current event store.
BatchedMinbiasSvc::m_skipEventIdxSvc
ServiceHandle< ISkipEventIdxSvc > m_skipEventIdxSvc
Definition: BatchedMinbiasSvc.h:87
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
BatchedMinbiasSvc::m_empty_caches
std::deque< std::unique_ptr< SGHandleArray > > m_empty_caches
Definition: BatchedMinbiasSvc.h:110
BatchedMinbiasSvc::m_earliestDeltaBC
Gaudi::Property< int > m_earliestDeltaBC
Definition: BatchedMinbiasSvc.h:76
FastReseededPRNG.h
ISkipEventIdxSvc::EvtId
Definition: ISkipEventIdxSvc.h:16
BatchedMinbiasSvc::~BatchedMinbiasSvc
~BatchedMinbiasSvc()
Destructor.
Definition: BatchedMinbiasSvc.cxx:41
vtune_athena.format
format
Definition: vtune_athena.py:14
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
BatchedMinbiasSvc::m_MBBatchSize
Gaudi::Property< int > m_MBBatchSize
Definition: BatchedMinbiasSvc.h:62
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
index
Definition: index.py:1
Trk::indices
std::pair< long int, long int > indices
Definition: AlSymMatBase.h:24
BatchedMinbiasSvc::event_to_batch
int event_to_batch(std::int64_t hs_id)
Definition: BatchedMinbiasSvc.cxx:43
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
SG::CurrentEventStore::Push
Temporarily change the current store.
Definition: SGTools/SGTools/CurrentEventStore.h:58
CLIDRegistry::CLIDToTypeinfo
static const std::type_info * CLIDToTypeinfo(CLID clid)
Translate between CLID and type_info.
Definition: CLIDRegistry.cxx:136
BatchedMinbiasSvc::getNumForBunch
std::size_t getNumForBunch(const EventContext &ctx, int bunch) const override
Definition: BatchedMinbiasSvc.cxx:415
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
BatchedMinbiasSvc::m_seed
Gaudi::Property< std::uint64_t > m_seed
Definition: BatchedMinbiasSvc.h:50
Preparation.batch
batch
Definition: Preparation.py:50
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
BatchedMinbiasSvc::m_empty_caches_mtx
std::mutex m_empty_caches_mtx
Definition: BatchedMinbiasSvc.h:111
CxxUtils::fpcompare::greater
bool greater(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition: fpcompare.h:140
BatchedMinbiasSvc::m_usePoisson
Gaudi::Property< bool > m_usePoisson
Definition: BatchedMinbiasSvc.h:55
python.FakeAthena.Service
def Service(name)
Definition: FakeAthena.py:38
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
BatchedMinbiasSvc::m_HSBatchSize
Gaudi::Property< int > m_HSBatchSize
Definition: BatchedMinbiasSvc.h:68
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
covarianceTool.filter
filter
Definition: covarianceTool.py:514
BatchedMinbiasSvc.h
BatchedMinbiasSvc::initialize
StatusCode initialize() override
AthService initialize.
Definition: BatchedMinbiasSvc.cxx:47
BatchedMinbiasSvc::m_useBeamInt
Gaudi::Property< bool > m_useBeamInt
Definition: BatchedMinbiasSvc.h:58
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
BatchedMinbiasSvc::m_onDemandMB
Gaudi::Property< bool > m_onDemandMB
Definition: BatchedMinbiasSvc.h:52
BatchedMinbiasSvc::endHardScatter
StatusCode endHardScatter(const EventContext &ctx) override
Definition: BatchedMinbiasSvc.cxx:425
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
EventID.h
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
IProxyProviderSvc::addProvider
virtual void addProvider(IAddressProvider *aProvider)=0
IAddressProvider manager functionality add a provider to the set of known ones.
python.handimod.now
now
Definition: handimod.py:675
BatchedMinbiasSvc::m_cache_mtxs
std::map< int, std::mutex > m_cache_mtxs
Definition: BatchedMinbiasSvc.h:107
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:100
StoreID::PILEUP_STORE
@ PILEUP_STORE
Definition: StoreID.h:31
lumiFormat.i
int i
Definition: lumiFormat.py:92
ISkipEventIdxSvc::EvtIter
std::vector< EvtId >::const_iterator EvtIter
Definition: ISkipEventIdxSvc.h:23
BatchedMinbiasSvc::m_cache
std::map< int, std::unique_ptr< SGHandleArray > > m_cache
Definition: BatchedMinbiasSvc.h:106
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Recovery.avg
def avg(a, b)
Definition: Recovery.py:79
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
IAddressProvider
interface for IOA providers
Definition: IAddressProvider.h:28
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
run
Definition: run.py:1
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
BatchedMinbiasSvc::m_bkg_evt_sel_ctx
IEvtSelector::Context * m_bkg_evt_sel_ctx
Definition: BatchedMinbiasSvc.h:102
BatchedMinbiasSvc::m_latestDeltaBC
Gaudi::Property< int > m_latestDeltaBC
Definition: BatchedMinbiasSvc.h:79
min
#define min(a, b)
Definition: cfImp.cxx:40
BatchedMinbiasSvc::m_activeStoreSvc
ServiceHandle< ActiveStoreSvc > m_activeStoreSvc
Definition: BatchedMinbiasSvc.h:96
BatchedMinbiasSvc::calcMBRequired
std::size_t calcMBRequired(std::int64_t hs_id, std::size_t slot, unsigned int run, unsigned int lumi, std::uint64_t event)
Definition: BatchedMinbiasSvc.cxx:202
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
IProxyProviderSvc
Definition: IProxyProviderSvc.h:34
BatchedMinbiasSvc::BatchedMinbiasSvc
BatchedMinbiasSvc(const std::string &name, ISvcLocator *svc)
Constructor.
Definition: BatchedMinbiasSvc.cxx:36
BatchedMinbiasSvc::m_batch_use_count
std::vector< std::unique_ptr< std::atomic_int > > m_batch_use_count
Definition: BatchedMinbiasSvc.h:112
dq_make_web_display.rv
def rv
Definition: dq_make_web_display.py:219
BatchedMinbiasSvc::m_actualNHSEventsPerBatch
Gaudi::Property< std::vector< int > > m_actualNHSEventsPerBatch
Definition: BatchedMinbiasSvc.h:82
EventInfo.h
BatchedMinbiasSvc::m_nPerBunch
Gaudi::Property< float > m_nPerBunch
Definition: BatchedMinbiasSvc.h:73
BatchedMinbiasSvc::m_num_mb_by_bunch
std::vector< std::vector< std::uint64_t > > m_num_mb_by_bunch
Definition: BatchedMinbiasSvc.h:104
BatchedMinbiasSvc::get_hs_id
virtual std::int64_t get_hs_id(const EventContext &ctx) const override
Definition: BatchedMinbiasSvc.h:42
PlotCalibFromCool.lg
lg
Definition: PlotCalibFromCool.py:748
ReadBchFromCool.good
good
Definition: ReadBchFromCool.py:433
lumiFormat.lumi
lumi
Definition: lumiFormat.py:113
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
BatchedMinbiasSvc::m_spare_store
SGHandle m_spare_store
Definition: BatchedMinbiasSvc.h:99
BatchedMinbiasSvc::m_bkgEventSelector
ServiceHandle< IEvtSelector > m_bkgEventSelector
Definition: BatchedMinbiasSvc.h:90
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
BatchedMinbiasSvc::m_NSimultaneousBatches
Gaudi::Property< int > m_NSimultaneousBatches
Definition: BatchedMinbiasSvc.h:65
BatchedMinbiasSvc::m_useBeamLumi
Gaudi::Property< bool > m_useBeamLumi
Definition: BatchedMinbiasSvc.h:60
IProxyProviderSvc.h
BatchedMinbiasSvc::m_idx_lists
std::vector< std::vector< std::uint64_t > > m_idx_lists
Definition: BatchedMinbiasSvc.h:105
IAddressProvider.h
BatchedMinbiasSvc::m_last_loaded_batch
std::atomic_int m_last_loaded_batch
Definition: BatchedMinbiasSvc.h:113
BatchedMinbiasSvc::m_beamLumi
ServiceHandle< IBeamLuminosity > m_beamLumi
Definition: BatchedMinbiasSvc.h:94
BatchedMinbiasSvc::getMinbias
StoreGateSvc * getMinbias(const EventContext &ctx, std::uint64_t mb_id) override
Definition: BatchedMinbiasSvc.cxx:406
BatchedMinbiasSvc::beginHardScatter
StatusCode beginHardScatter(const EventContext &ctx) override
Definition: BatchedMinbiasSvc.cxx:296
BatchedMinbiasSvc::m_reading_batch_mtx
std::mutex m_reading_batch_mtx
Definition: BatchedMinbiasSvc.h:109
BatchedMinbiasSvc::m_beamInt
ServiceHandle< IBeamIntensity > m_beamInt
Definition: BatchedMinbiasSvc.h:92
FastReseededPRNG
Definition: FastReseededPRNG.h:28