6#ifndef PILEUPMT_BATCHEDMINBIASSVC_H
7#define PILEUPMT_BATCHEDMINBIASSVC_H
20#include "Gaudi/Property.h"
21#include "GaudiKernel/IEvtSelector.h"
22#include "GaudiKernel/ServiceHandle.h"
41 std::uint64_t mb_id)
override;
42 std::size_t
getNumForBunch(
const EventContext& ctx,
int bunch)
const override;
44 std::int64_t
get_hs_id(
const EventContext& ctx)
const override {
52 Gaudi::Property<std::uint64_t>
m_seed{
this,
"Seed", 0,
53 "Additional seed for PRNGs"};
55 this,
"OnDemandMB",
false,
56 "Should minbias event contents be read on demand"};
58 "Whether to use a Poisson distribution "
59 "(if False, use a delta distribution)"};
61 this,
"UseBeamInt",
true,
"Whether to use the beam intensity service"};
63 this,
"UseBeamLumi",
true,
"Whether to use the beam luminosity service"};
65 this,
"MBBatchSize", 10000,
66 "Number of low pT minbias events to load per batch"};
68 this,
"NSimultaneousBatches", 1,
69 "Max number of batches to load simultaneously"};
71 this,
"HSBatchSize", 1,
72 "Number of HS events per batch (aka max reuse factor)"};
74 "Number of skipped HS events"};
76 this,
"AvgMBPerBunch", 0,
77 "Average (max) number of minbias events per bunch"};
79 this,
"EarliestDeltaBC", -32,
80 "Earliest bunch crossing to consider (as delta)"};
82 this,
"LatestDeltaBC", +6,
83 "Latest bunch crossing to consider (as delta)"};
86 "actualNHSEventsPerBatch",
88 "Dynamic map of actual number of HS events for each batch, in this run."};
90 this,
"SkipEvtIdxSvc",
"SkipEventIdxSvc",
91 "Skipped event index (run / lb num) provider"};
93 this,
"BkgEventSelector", {},
"Event selector for minbias events"};
95 "Beam intensity service"};
97 this,
"BeamLumiSvc",
"LumiProfileSvc",
"Beam luminosity service"};
99 this,
"ActiveStoreSvc",
"ActiveStoreSvc",
"ActiveStoreSvc"};
102 std::format(
"StoreGateSvc/discards_{}", name()),
103 "StoreGate for discarding events"};
108 std::map<int, std::unique_ptr<SGHandleArray>>
m_cache;
117 std::size_t
calcMBRequired(std::int64_t hs_id,
const EventContext& ctx);
Maintain a set of objects, one per slot.
provides the relative beam intensity as a function of the bunch xing.
provides the relative beam luminosity as a function of the bunch xing.
StatusCode initialize() override
AthService initialize.
ServiceHandle< IEvtSelector > m_bkgEventSelector
Gaudi::Property< std::uint64_t > m_seed
Gaudi::Property< float > m_nPerBunch
Gaudi::Property< bool > m_useBeamLumi
std::map< int, std::unique_ptr< SGHandleArray > > m_cache
ServiceHandle< IBeamIntensity > m_beamInt
~BatchedMinbiasSvc()
Destructor.
Gaudi::Property< std::vector< int > > m_actualNHSEventsPerBatch
Gaudi::Property< bool > m_onDemandMB
int event_to_batch(std::int64_t hs_id)
StoreGateSvc * getMinbias(const EventContext &ctx, std::uint64_t mb_id) override
Gaudi::Property< int > m_earliestDeltaBC
std::vector< std::unique_ptr< std::atomic_int > > m_batch_use_count
Gaudi::Property< bool > m_usePoisson
ServiceHandle< ActiveStoreSvc > m_activeStoreSvc
Gaudi::Property< int > m_latestDeltaBC
std::deque< std::unique_ptr< SGHandleArray > > m_empty_caches
std::mutex m_reading_batch_mtx
std::size_t getNumForBunch(const EventContext &ctx, int bunch) const override
StatusCode endHardScatter(const EventContext &ctx) override
SG::SlotSpecificObj< std::vector< std::uint64_t > > m_idx_lists
Gaudi::Property< bool > m_useBeamInt
Gaudi::Property< int > m_skippedHSEvents
std::mutex m_empty_caches_mtx
Gaudi::Property< int > m_MBBatchSize
BatchedMinbiasSvc(const std::string &name, ISvcLocator *svc)
Constructor.
ServiceHandle< ISkipEventIdxSvc > m_skipEventIdxSvc
IEvtSelector::Context * m_bkg_evt_sel_ctx
std::vector< SGHandle > SGHandleArray
virtual std::int64_t get_hs_id(const EventContext &ctx) const override
ServiceHandle< StoreGateSvc > SGHandle
std::size_t calcMBRequired(std::int64_t hs_id, const EventContext &ctx)
SG::SlotSpecificObj< std::vector< std::uint64_t > > m_num_mb_by_bunch
Gaudi::Property< int > m_HSBatchSize
std::map< int, std::mutex > m_cache_mtxs
StatusCode beginHardScatter(const EventContext &ctx) override
std::atomic_int m_last_loaded_batch
ServiceHandle< IBeamLuminosity > m_beamLumi
Gaudi::Property< int > m_NSimultaneousBatches
Maintain a set of objects, one per slot.
The Athena Transient Store API.