|
ATLAS Offline Software
|
In-memory cache for pileup events.
More...
#include <BkgStreamsCache.h>
|
| BkgStreamsCache (const std::string &, const std::string &, const IInterface *) |
|
virtual | ~BkgStreamsCache () |
|
virtual StatusCode | initialize () override final |
|
virtual StatusCode | finalize () override final |
|
virtual StatusCode | setup (int firstXing, unsigned int nXings, unsigned int firstStore, IBeamIntensity *) override final |
|
virtual void | newEvent () override final |
| inform cache that we start overlaying a new event More...
|
|
virtual void | resetEvtsPerXingScaleFactor (float sf) override final |
| reset scale factor at new run/lumiblk More...
|
|
virtual StatusCode | addSubEvts (unsigned int iXing, xAOD::EventInfo *overlaidEvent, int t0BinCenter) override final |
| Read input events in bkg stores and link them to overlay store. More...
|
|
virtual StatusCode | addSubEvts (unsigned int iXing, xAOD::EventInfo *overEvent, int t0BinCenter, bool loadEventProxies, unsigned int) override final |
| Read input events in bkg stores and link them to overlay store. More...
|
|
virtual unsigned int | nStores () const override final |
| how many stores in this cache More...
|
|
long | collXing () |
| meant to be used (mainly) via m_f_collDistr More...
|
|
long | collXingPoisson () |
|
unsigned int | numberOfBkgForBunchCrossingIgnoringBeamIntensity (unsigned int iXing) const |
| meant to be used via m_f_numberOfBackgroundForBunchCrossing More...
|
|
unsigned int | numberOfBkgForBunchCrossingDefaultImpl (unsigned int iXing) const |
|
unsigned int | numberOfCavernBkgForBunchCrossing (unsigned int iXing) const |
|
In-memory cache for pileup events.
Definition at line 36 of file BkgStreamsCache.h.
◆ StreamVector
◆ BkgStreamsCache()
BkgStreamsCache::BkgStreamsCache |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
Definition at line 28 of file BkgStreamsCache.cxx.
56 declareProperty(
"CollPerXing",
m_collXing,
"(average) number of collisions per beam crossing");
57 declareProperty(
"OccupationFraction",
m_occupationFraction,
"The maximum fraction of bunch-crossings which will be occupied.");
58 declareProperty(
"CollDistribution",
m_collDistrName,
"nEvts/Xings can be either Fixed at CollPerXing or Poisson with average CollPerXing");
60 declareProperty(
"PileUpEventType",
m_pileUpEventTypeProp,
"Type of the pileup events in this cache: 0:Signal, 1:MinimumBias, 2:Cavern, 3:HaloGas, 4:ZeroBias. Default=0 (Signal, Invalid)");
61 declareProperty(
"ReadDownscaleFactor",
m_readDownscale,
"read one event every downscaleFactor accesses (asymptotically -> number of times an event in the cache will be reused)");
62 declareProperty(
"RndmGenSvc",
m_atRndmSvc,
"IAtRndmGenSvc controlling the distribution of bkg events/xing");
63 declareProperty(
"RndmStreamName",
m_randomStreamName,
"IAtRndmGenSvc stream used as engine for our various random distributions, including the CollPerXing one ");
64 declareProperty(
"SubtractBC0",
m_subtractBC0,
"reduce the number of events at bunch xing t=0 by m_subtractBC0. Default=0, set to 1 when using the same type of events (e.g. minbias) for original and background streams");
67 declareProperty(
"IgnoreBeamInt",
m_ignoreBM,
"Default=False, set to True to ignore the PileUpEventLoopMgr beam intensity tool in setting the number of events per xing.");
68 declareProperty(
"IgnoreBeamLumi",
m_ignoreSF,
"Default=False, set to True to ignore the PileUpEventLoopMgr beam luminosity tool in setting the number of events per xing.");
69 declareProperty(
"ForceReadForBC0",
m_forceReadForBC0,
"Force events used in the central bunch crossing to be refreshed");
◆ ~BkgStreamsCache()
BkgStreamsCache::~BkgStreamsCache |
( |
| ) |
|
|
virtual |
◆ addSubEvts() [1/2]
StatusCode BkgStreamsCache::addSubEvts |
( |
unsigned int |
iXing, |
|
|
xAOD::EventInfo * |
overEvent, |
|
|
int |
t0BinCenter, |
|
|
bool |
loadEventProxies, |
|
|
unsigned int |
BCID |
|
) |
| |
|
finaloverridevirtual |
Read input events in bkg stores and link them to overlay store.
- Parameters
-
iXing | offset to first xing number (=0 first Xing, =nXings for last xing) |
overlaidEvent | reference to resulting overlaid event |
t0BinCenter | time wrto t0 of current bin center in ns |
loadEventProxies | should we load the event proxies or not. |
BCID | bunch-crossing ID of signal bunch crossing |
Definition at line 365 of file BkgStreamsCache.cxx.
369 for (
unsigned int iEvt=0; iEvt<
nEvtsXing(iXing); ++iEvt)
375 if(!loadEventProxies) {
382 if (0 == pBkgEvent || 0 == currStream)
385 ATH_MSG_INFO (
"end of loop: background cache has no more events" );
386 return StatusCode::FAILURE;
393 <<
" @ Xing " << iXing );
402 tmp_ei.setBCID(
BCID );
403 tmp_ei.setEvtStore(pBkgStore);
409 if (pBkgStore->
retrieve(pStoreInfo).isSuccess() && pStoreInfo &&
410 pBkgEvent->
eventNumber() != pStoreInfo->eventNumber())
414 <<
" differ from current store "
416 <<
" event " << pStoreInfo->eventNumber()
417 <<
" run " << pStoreInfo->runNumber()
423 return StatusCode::SUCCESS;
◆ addSubEvts() [2/2]
StatusCode BkgStreamsCache::addSubEvts |
( |
unsigned int |
iXing, |
|
|
xAOD::EventInfo * |
overlaidEvent, |
|
|
int |
t0BinCenter |
|
) |
| |
|
finaloverridevirtual |
Read input events in bkg stores and link them to overlay store.
- Parameters
-
iXing | offset to first xing number (=0 first Xing, =nXings for last xing) |
overlaidEvent | reference to resulting overlaid event |
t0BinCenter | time wrto t0 of current bin center in ns |
Definition at line 357 of file BkgStreamsCache.cxx.
361 return this->
addSubEvts(iXing, overEvent, t0BinCenter,
true, 0);
◆ alreadyInUse()
bool BkgStreamsCache::alreadyInUse |
( |
StreamVector::size_type |
iStream | ) |
|
|
private |
◆ collXing()
long BkgStreamsCache::collXing |
( |
| ) |
|
|
inline |
◆ collXingPoisson()
long BkgStreamsCache::collXingPoisson |
( |
| ) |
|
◆ current()
◆ finalize()
StatusCode BkgStreamsCache::finalize |
( |
| ) |
|
|
finaloverridevirtual |
◆ initialize()
StatusCode BkgStreamsCache::initialize |
( |
| ) |
|
|
finaloverridevirtual |
Definition at line 256 of file BkgStreamsCache.cxx.
259 <<
" - cache for events of type "
270 return StatusCode::FAILURE;
282 using namespace std::placeholders;
291 return StatusCode::SUCCESS;
299 using namespace std::placeholders;
308 return StatusCode::SUCCESS;
311 <<
" is not a know collision distribution function" );
312 return StatusCode::FAILURE;
◆ nEvtsXing()
unsigned int BkgStreamsCache::nEvtsXing |
( |
unsigned int |
iXing | ) |
const |
|
private |
◆ newEvent()
void BkgStreamsCache::newEvent |
( |
| ) |
|
|
finaloverridevirtual |
inform cache that we start overlaying a new event
Definition at line 165 of file BkgStreamsCache.cxx.
167 ATH_MSG_DEBUG (
"newEvent called resetting used event set" );
168 unsigned int totEvts(0);
171 for (
unsigned int iXing=0; iXing<
m_nXings; ++iXing) {
174 ATH_MSG_WARNING (
"newEvent: number of required evts (" << totEvts <<
") exceeds number of available stores "
175 <<
m_nStores <<
". Regenerating bkg sequence for this event \n"
176 <<
" the total number of bkg events may not exceed average by more than 6 sigmas"
◆ nextEvent()
get next bkg event from cache
Definition at line 185 of file BkgStreamsCache.cxx.
188 StreamVector::size_type iS(0);
199 if (0 != pCurrStream) {
200 pCurrStream->store().makeCurrent();
206 pNextEvt = pCurrStream->nextEventPre(
readEvent );
◆ nextEvent_passive()
StatusCode BkgStreamsCache::nextEvent_passive |
( |
bool |
isCentralBunchCrossing | ) |
|
|
private |
as nextEvent except don't actually load anything
Definition at line 212 of file BkgStreamsCache.cxx.
214 StreamVector::size_type iS(0);
225 if (0 != pCurrStream) {
226 pCurrStream->store().makeCurrent();
232 if(pCurrStream->nextEventPre_Passive(
readEvent))
return StatusCode::SUCCESS;
234 return StatusCode::FAILURE;
◆ nStores()
virtual unsigned int BkgStreamsCache::nStores |
( |
| ) |
const |
|
inlinefinaloverridevirtual |
◆ numberOfBkgForBunchCrossingDefaultImpl()
unsigned int BkgStreamsCache::numberOfBkgForBunchCrossingDefaultImpl |
( |
unsigned int |
iXing | ) |
const |
◆ numberOfBkgForBunchCrossingIgnoringBeamIntensity()
unsigned int BkgStreamsCache::numberOfBkgForBunchCrossingIgnoringBeamIntensity |
( |
unsigned int |
iXing | ) |
const |
meant to be used via m_f_numberOfBackgroundForBunchCrossing
Definition at line 320 of file BkgStreamsCache.cxx.
◆ numberOfCavernBkgForBunchCrossing()
unsigned int BkgStreamsCache::numberOfCavernBkgForBunchCrossing |
( |
unsigned int |
iXing | ) |
const |
◆ PileUpEventTypeHandler()
void BkgStreamsCache::PileUpEventTypeHandler |
( |
Gaudi::Details::PropertyBase & |
| ) |
|
|
private |
◆ resetEvtsPerXingScaleFactor()
void BkgStreamsCache::resetEvtsPerXingScaleFactor |
( |
float |
sf | ) |
|
|
finaloverridevirtual |
◆ setNEvtsXing()
unsigned int BkgStreamsCache::setNEvtsXing |
( |
unsigned int |
iXing | ) |
|
|
private |
Definition at line 333 of file BkgStreamsCache.cxx.
346 <<
" events from BC=0 Xing " << iXing <<
" - Events at BC=0 "
352 <<
" events for BCID " << iXing );
◆ setup()
StatusCode BkgStreamsCache::setup |
( |
int |
firstXing, |
|
|
unsigned int |
nXings, |
|
|
unsigned int |
firstStore, |
|
|
IBeamIntensity * |
iBM |
|
) |
| |
|
finaloverridevirtual |
- Parameters
-
nXings | bunch Xings to be processed |
firstStore | id of first store in cache |
Definition at line 86 of file BkgStreamsCache.cxx.
99 m_nStores =
static_cast<unsigned int>(ceil(
m_collXing * occupiedCrossings * largestElement));
117 std::stringstream bufName;
118 bufName <<
"BkgEvent_" <<
i + firstStore;
124 catch (
const std::runtime_error&
e)
126 ATH_MSG_ERROR (
"Exception thrown while creating PileUpStream "
128 return StatusCode::FAILURE;
135 return StatusCode::FAILURE;
144 return StatusCode::FAILURE;
151 return StatusCode::SUCCESS;
◆ m_atRndmSvc
◆ m_beamInt
◆ m_chooseEventRand
CLHEP::RandFlat* BkgStreamsCache::m_chooseEventRand |
|
private |
◆ m_collDistrName
Gaudi::Property<std::string> BkgStreamsCache::m_collDistrName |
|
private |
◆ m_collXing
Gaudi::Property<float> BkgStreamsCache::m_collXing |
|
private |
of collisions per bunch crossing (~beam intensity)
Definition at line 110 of file BkgStreamsCache.h.
◆ m_collXingPoisson
CLHEP::RandPoisson* BkgStreamsCache::m_collXingPoisson |
|
private |
set number of collisions per bunch crossing (if Poisson distribution chosen)
Definition at line 137 of file BkgStreamsCache.h.
◆ m_collXingSF
float BkgStreamsCache::m_collXingSF |
|
private |
float scaling number of collisions per bunch crossing
Definition at line 145 of file BkgStreamsCache.h.
◆ m_cursor
StreamVector::iterator BkgStreamsCache::m_cursor |
|
private |
◆ m_f_collDistr
std::function< long() > BkgStreamsCache::m_f_collDistr |
|
private |
function returning the number of collisions per bunch crossing before bunch structure modulation
Definition at line 140 of file BkgStreamsCache.h.
◆ m_f_numberOfBackgroundForBunchCrossing
std::function< unsigned int(unsigned int) > BkgStreamsCache::m_f_numberOfBackgroundForBunchCrossing |
|
private |
function returning the number of bkg events per bunch crossing after bunch structure modulation
Definition at line 143 of file BkgStreamsCache.h.
◆ m_forceReadForBC0
Gaudi::Property<bool> BkgStreamsCache::m_forceReadForBC0 |
|
private |
Force events used in the central bunch crossing to be refreshed.
Definition at line 153 of file BkgStreamsCache.h.
◆ m_ignoreBM
Gaudi::Property<bool> BkgStreamsCache::m_ignoreBM |
|
private |
◆ m_ignoreSF
Gaudi::Property<bool> BkgStreamsCache::m_ignoreSF |
|
private |
bool apply scaling number of collisions per bunch crossing ?
Definition at line 147 of file BkgStreamsCache.h.
◆ m_nEvtsXing
std::vector<unsigned int> BkgStreamsCache::m_nEvtsXing |
|
private |
◆ m_nStores
unsigned int BkgStreamsCache::m_nStores |
|
private |
◆ m_nXings
unsigned int BkgStreamsCache::m_nXings |
|
private |
◆ m_occupationFraction
Gaudi::Property<float> BkgStreamsCache::m_occupationFraction |
|
private |
The maximum fraction of bunch-crossings which will be occupied.
Definition at line 112 of file BkgStreamsCache.h.
◆ m_pileUpEventType
◆ m_pileUpEventTypeProp
Gaudi::CheckedProperty<unsigned short> BkgStreamsCache::m_pileUpEventTypeProp |
|
private |
◆ m_randomStreamName
Gaudi::Property<std::string> BkgStreamsCache::m_randomStreamName |
|
private |
◆ m_readDownscale
Gaudi::Property<float> BkgStreamsCache::m_readDownscale |
|
private |
read downscale factor (average number of times a min bias is reused)
Definition at line 117 of file BkgStreamsCache.h.
◆ m_readEventRand
CLHEP::RandFlat* BkgStreamsCache::m_readEventRand |
|
private |
◆ m_selecName
◆ m_streams
◆ m_subtractBC0
Gaudi::Property<unsigned short> BkgStreamsCache::m_subtractBC0 |
|
private |
◆ m_usedStreams
std::vector<bool> BkgStreamsCache::m_usedStreams |
|
private |
◆ m_zeroXing
int BkgStreamsCache::m_zeroXing |
|
private |
The documentation for this class was generated from the following files:
const std::string c_pileUpEventInfoContName
default value for the EventInfoContainer storing subevents for PileUp
void PileUpEventTypeHandler(Gaudi::Details::PropertyBase &)
StreamVector::iterator m_cursor
StatusCode nextEvent_passive(bool isCentralBunchCrossing)
as nextEvent except don't actually load anything
Gaudi::CheckedProperty< unsigned short > m_pileUpEventTypeProp
the type of events in this cache
Gaudi::Property< bool > m_ignoreBM
ignore the PileUpEventLoopMgr beam intensity tool
CLHEP::RandFlat * m_chooseEventRand
pickup an event store at random from the cache
uint64_t eventNumber() const
The current event's event number.
virtual float largestElementInPattern() const =0
the largest element in the beam intensity pattern.
std::vector< unsigned int > m_nEvtsXing
ServiceHandle< IAtRndmGenSvc > m_atRndmSvc
IAtRndmGenSvc controlling the distribution of bkg events per bunch crossing.
xAOD::EventInfo::PileUpType m_pileUpEventType
the type of events in this cache
unsigned int numberOfBkgForBunchCrossingDefaultImpl(unsigned int iXing) const
std::function< unsigned int(unsigned int) > m_f_numberOfBackgroundForBunchCrossing
function returning the number of bkg events per bunch crossing after bunch structure modulation
float m_collXingSF
float scaling number of collisions per bunch crossing
Gaudi::Property< unsigned short > m_subtractBC0
subtract from number of events at bunch xing = 0
Gaudi::Property< bool > m_forceReadForBC0
Force events used in the central bunch crossing to be refreshed.
Gaudi::Property< float > m_occupationFraction
The maximum fraction of bunch-crossings which will be occupied.
std::function< long() > m_f_collDistr
function returning the number of collisions per bunch crossing before bunch structure modulation
Gaudi::Property< float > m_collXing
#define ATH_MSG_VERBOSE(x)
uint32_t runNumber() const
The current event's run number.
unsigned int nEvtsXing(unsigned int iXing) const
IBeamIntensity * m_beamInt
pointer to the IBeamIntensity distribution tool
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
virtual float normFactor(int bunchXing) const =0
a scale factor (average value 1.0) for the beam intensity at a given xing.
Gaudi::Property< std::string > m_collDistrName
select collision distribution
bool alreadyInUse(StreamVector::size_type iStream)
The Athena Transient Store API.
Gaudi::Property< float > m_readDownscale
read downscale factor (average number of times a min bias is reused)
::StatusCode StatusCode
StatusCode definition for legacy code.
Gaudi::Property< bool > m_ignoreSF
bool apply scaling number of collisions per bunch crossing ?
a triple selector/context/store defines a stream
unsigned int numberOfCavernBkgForBunchCrossing(unsigned int iXing) const
int m_zeroXing
offset of BC=0 xing
long collXing()
meant to be used (mainly) via m_f_collDistr
CLHEP::RandPoisson * m_collXingPoisson
set number of collisions per bunch crossing (if Poisson distribution chosen)
ServiceHandle< IEvtSelector > m_selecName
unsigned int setNEvtsXing(unsigned int iXing)
Class describing the basic event information.
static PileUpType PileUpInt2Type(unsigned short typ)
Convert int to PileUpType enum value.
PileUpStream * current()
get current (last asked) stream
#define ATH_MSG_WARNING(x)
static const std::string & PileUpType2Name(PileUpType typ)
Convert PileUpType enum value to string.
std::vector< bool > m_usedStreams
virtual StatusCode addSubEvts(unsigned int iXing, xAOD::EventInfo *overlaidEvent, int t0BinCenter) override final
Read input events in bkg stores and link them to overlay store.
unsigned int numberOfBkgForBunchCrossingIgnoringBeamIntensity(unsigned int iXing) const
meant to be used via m_f_numberOfBackgroundForBunchCrossing
Gaudi::Property< std::string > m_randomStreamName
the IAtRndmGenSvc stream to generate number of bkg events per bunch crossing
xAOD::EventInfo * addSubEvent(xAOD::EventInfo *targetEv, const xAOD::EventInfo::SubEvent &subev, xAOD::EventInfoContainer *eiContainer, const std::string &eiContKey, StoreGateSvc *subev_store=nullptr)
const xAOD::EventInfo * nextEvent(bool isCentralBunchCrossing)
get next bkg event from cache
CLHEP::RandFlat * m_readEventRand
read a new event every downscaleFactor accesses