6#ifndef PILEUPMT_ONDEMANDMINBIASSVC_H
7#define PILEUPMT_ONDEMANDMINBIASSVC_H
19#include "Gaudi/Property.h"
20#include "GaudiKernel/IEvtSelector.h"
21#include "GaudiKernel/ServiceHandle.h"
40 std::uint64_t mb_id)
override;
41 std::size_t
getNumForBunch(
const EventContext& ctx,
int bunch)
const override;
43 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 "Number of skipped HS events"};
60 this,
"AvgMBPerBunch", 0.f,
61 "Average (max) number of minbias events per bunch"};
63 "Whether to use a Poisson distribution "
64 "(if False, use a delta distribution)"};
66 this,
"UseBeamInt",
true,
"Whether to use the beam intensity service"};
68 this,
"UseBeamLumi",
true,
"Whether to use the beam luminosity service"};
70 this,
"EarliestDeltaBC", -32,
71 "Earliest bunch crossing to consider (as delta)"};
73 this,
"LatestDeltaBC", +6,
74 "Latest bunch crossing to consider (as delta)"};
76 this,
"SkipEvtIdxSvc",
"SkipEventIdxSvc",
77 "Skipped event index (run / lb num) provider"};
79 this,
"BkgEventSelector", {},
"Event selector for minbias events"};
81 "Beam intensity service"};
83 this,
"BeamLumiSvc",
"LumiProfileSvc",
"Beam luminosity service"};
85 this,
"ActiveStoreSvc",
"ActiveStoreSvc",
"ActiveStoreSvc"};
88 std::format(
"StoreGateSvc/discards_{}", name()),
89 "StoreGate for discarding events"};
101 std::numeric_limits<std::size_t>::max();
104 unsigned int run,
unsigned int lumi,
105 std::uint64_t event);
provides the relative beam intensity as a function of the bunch xing.
provides the relative beam luminosity as a function of the bunch xing.
std::vector< std::vector< std::uint64_t > > m_num_mb_by_bunch
ServiceHandle< StoreGateSvc > SGHandle
~OnDemandMinbiasSvc() final
Destructor.
virtual std::int64_t get_hs_id(const EventContext &ctx) const override
StatusCode initialize() final
AthService initialize.
IEvtSelector::Context * m_bkg_evt_sel_ctx
Gaudi::Property< int > m_latestDeltaBC
StatusCode beginHardScatter(const EventContext &ctx) override
StoreGateSvc * getMinbias(const EventContext &ctx, std::uint64_t mb_id) override
Gaudi::Property< bool > m_useBeamLumi
ServiceHandle< ActiveStoreSvc > m_activeStoreSvc
ServiceHandle< IEvtSelector > m_bkgEventSelector
std::mutex m_reading_batch_mtx
std::vector< std::vector< SGHandle > > m_stores
std::size_t getNumForBunch(const EventContext &ctx, int bunch) const override
Gaudi::Property< int > m_skippedHSEvents
Gaudi::Property< bool > m_useBeamInt
OnDemandMinbiasSvc(const std::string &name, ISvcLocator *svc)
Constructor.
Gaudi::Property< bool > m_usePoisson
Gaudi::Property< std::uint64_t > m_seed
static constexpr std::size_t s_NoSlot
std::atomic_int64_t m_last_loaded_hs
ServiceHandle< IProxyProviderSvc > m_proxyProviderSvc
ServiceHandle< IBeamIntensity > m_beamInt
StatusCode endHardScatter(const EventContext &ctx) override
ServiceHandle< ISkipEventIdxSvc > m_skipEventIdxSvc
Gaudi::Property< float > m_nPerBunch
std::vector< std::vector< std::uint64_t > > m_idx_lists
Gaudi::Property< bool > m_onDemandMB
std::size_t calcMBRequired(std::int64_t hs_id, std::size_t slot, unsigned int run, unsigned int lumi, std::uint64_t event)
ServiceHandle< IBeamLuminosity > m_beamLumi
Gaudi::Property< int > m_earliestDeltaBC
The Athena Transient Store API.