ATLAS Offline Software
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
BkgStreamsCache Class Reference

In-memory cache for pileup events. More...

#include <BkgStreamsCache.h>

Inheritance diagram for BkgStreamsCache:
Collaboration diagram for BkgStreamsCache:

Public Member Functions

 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
 

Private Types

typedef std::vector< PileUpStreamStreamVector
 

Private Member Functions

const xAOD::EventInfonextEvent (bool isCentralBunchCrossing)
 get next bkg event from cache More...
 
StatusCode nextEvent_passive (bool isCentralBunchCrossing)
 as nextEvent except don't actually load anything More...
 
PileUpStreamcurrent ()
 get current (last asked) stream More...
 
unsigned int setNEvtsXing (unsigned int iXing)
 
unsigned int nEvtsXing (unsigned int iXing) const
 
bool alreadyInUse (StreamVector::size_type iStream)
 
void PileUpEventTypeHandler (Gaudi::Details::PropertyBase &)
 

Private Attributes

StreamVector::iterator m_cursor {}
 
StreamVector m_streams
 
std::vector< bool > m_usedStreams
 
unsigned int m_nXings {0}
 
unsigned int m_nStores {0}
 
std::vector< unsigned int > m_nEvtsXing
 
ServiceHandle< IEvtSelector > m_selecName {this, "EventSelector", "FakeEventSelector"}
 
ServiceHandle< IAtRndmGenSvcm_atRndmSvc
 
Gaudi::Property< float > m_collXing
 
Gaudi::Property< float > m_occupationFraction
 
Gaudi::Property< std::string > m_collDistrName
 
Gaudi::Property< float > m_readDownscale
 
Gaudi::Property< std::string > m_randomStreamName
 
Gaudi::CheckedProperty< unsigned short > m_pileUpEventTypeProp
 
Gaudi::Property< unsigned short > m_subtractBC0
 
Gaudi::Property< bool > m_ignoreBM
 
Gaudi::Property< bool > m_ignoreSF
 
Gaudi::Property< bool > m_forceReadForBC0
 
xAOD::EventInfo::PileUpType m_pileUpEventType
 the type of events in this cache More...
 
CLHEP::RandFlat * m_readEventRand {nullptr}
 read a new event every downscaleFactor accesses More...
 
CLHEP::RandFlat * m_chooseEventRand {nullptr}
 pickup an event store at random from the cache More...
 
CLHEP::RandPoisson * m_collXingPoisson {nullptr}
 set number of collisions per bunch crossing (if Poisson distribution chosen) More...
 
std::function< long() > m_f_collDistr
 function returning the number of collisions per bunch crossing before bunch structure modulation More...
 
std::function< unsigned int(unsigned int) > m_f_numberOfBackgroundForBunchCrossing
 function returning the number of bkg events per bunch crossing after bunch structure modulation More...
 
float m_collXingSF {1.0}
 float scaling number of collisions per bunch crossing More...
 
int m_zeroXing {-1}
 offset of BC=0 xing More...
 
IBeamIntensitym_beamInt {nullptr}
 pointer to the IBeamIntensity distribution tool More...
 

Detailed Description

In-memory cache for pileup events.

Definition at line 35 of file BkgStreamsCache.h.

Member Typedef Documentation

◆ StreamVector

typedef std::vector<PileUpStream> BkgStreamsCache::StreamVector
private

Definition at line 97 of file BkgStreamsCache.h.

Constructor & Destructor Documentation

◆ BkgStreamsCache()

BkgStreamsCache::BkgStreamsCache ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 26 of file BkgStreamsCache.cxx.

29  : base_class( type, name, parent )
30 {
32 }

◆ ~BkgStreamsCache()

BkgStreamsCache::~BkgStreamsCache ( )
virtual

Definition at line 34 of file BkgStreamsCache.cxx.

35 {
36  delete m_collXingPoisson;
37  delete m_chooseEventRand;
38  delete m_readEventRand;
39 }

Member Function Documentation

◆ 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
iXingoffset to first xing number (=0 first Xing, =nXings for last xing)
overlaidEventreference to resulting overlaid event
t0BinCentertime wrto t0 of current bin center in ns
loadEventProxiesshould we load the event proxies or not.
BCIDbunch-crossing ID of signal bunch crossing

Definition at line 327 of file BkgStreamsCache.cxx.

330 {
331  for (unsigned int iEvt=0; iEvt<nEvtsXing(iXing); ++iEvt)
332  {
333  // check if we're picking events for the central bunch-crossing,
334  // so we can choose to only use fresh events here.
335  bool isCentralBunchCrossing((0==t0BinCenter)&&m_forceReadForBC0);
336  // increment event iterators
337  if(!loadEventProxies) {
338  return this->nextEvent_passive(isCentralBunchCrossing);
339  }
340  const xAOD::EventInfo* pBkgEvent = nextEvent( isCentralBunchCrossing ); //FIXME update this for the case where loadProxies=False
341 
342  //check input selector is not empty
343  PileUpStream* currStream(this->current());
344  if (0 == pBkgEvent || 0 == currStream)
345  {
346  // This is the end of the loop. No more events in the selection
347  ATH_MSG_INFO ( "end of loop: background cache has no more events" );
348  return StatusCode::FAILURE;
349  }
350  StoreGateSvc* pBkgStore = &(currStream->store());
351  ATH_MSG_DEBUG ( "added event " << pBkgEvent->eventNumber()
352  << " run " << pBkgEvent->runNumber()
353  << " from store "
354  << pBkgStore->name()
355  << " @ Xing " << iXing );
356 
357  // register as sub event of the overlaid
358 
359  // get the SG container for subevents infos
360  xAOD::EventInfoContainer *subEvCnt (nullptr);
361  ATH_CHECK( overEvent->evtStore()->retrieve(subEvCnt, c_pileUpEventInfoContName) );
362  // add subevent
363  addSubEvent( overEvent, pBkgEvent, t0BinCenter, m_pileUpEventType, subEvCnt, c_pileUpEventInfoContName );
364  subEvCnt->back()->setBCID( BCID );
365  subEvCnt->back()->setEvtStore( pBkgStore );
366 
367 #ifdef DEBUG_PILEUP
368  const xAOD::EventInfo* pStoreInfo(nullptr);
369  if (pBkgStore->retrieve(pStoreInfo).isSuccess() && pStoreInfo &&
370  pBkgEvent->eventNumber() != pStoreInfo->eventNumber())
371  {
372  ATH_MSG_ERROR ( "added event " << pBkgEvent->eventNumber()
373  << " run " << pBkgEvent->runNumber()
374  << " differ from current store "
375  << pBkgStore->name()
376  << " event " << pStoreInfo->eventNumber()
377  << " run " << pStoreInfo->runNumber()
378  );
379  assert(1);
380  }
381 #endif
382  } //loop over evts in xing
383  return StatusCode::SUCCESS;
384 }

◆ 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
iXingoffset to first xing number (=0 first Xing, =nXings for last xing)
overlaidEventreference to resulting overlaid event
t0BinCentertime wrto t0 of current bin center in ns

Definition at line 319 of file BkgStreamsCache.cxx.

322 {
323  return this->addSubEvts(iXing, overEvent, t0BinCenter, true, 0);
324 }

◆ alreadyInUse()

bool BkgStreamsCache::alreadyInUse ( StreamVector::size_type  iStream)
private

Definition at line 199 of file BkgStreamsCache.cxx.

200 {
201  assert(iS<m_usedStreams.size());
202  bool inUse(m_usedStreams[iS]);
203  if (!inUse) m_usedStreams[iS] = true;
204 #ifndef NDEBUG
205  ATH_MSG_VERBOSE ( "alreadyInUse: store " << iS << ' '
206  << (inUse ? "already" : "not yet") << " in use" );
207 #endif
208  return inUse;
209 }

◆ collXing()

long BkgStreamsCache::collXing ( )
inline

meant to be used (mainly) via m_f_collDistr

Definition at line 80 of file BkgStreamsCache.h.

80 { return m_collXing; }

◆ collXingPoisson()

long BkgStreamsCache::collXingPoisson ( )

Definition at line 121 of file BkgStreamsCache.cxx.

122 {
123  if (!m_collXingPoisson) { return collXing(); }
124  return m_collXingPoisson->fire(m_collXing * m_collXingSF);
125 }

◆ current()

PileUpStream * BkgStreamsCache::current ( )
private

get current (last asked) stream

Definition at line 211 of file BkgStreamsCache.cxx.

212 {
213  if (m_cursor != m_streams.end()) return &*m_cursor;
214  // m_cursor->isNotEmpty()) return &*m_cursor;
215  else return 0; //FIXME should reomve empty stream and keep going
216 }

◆ finalize()

StatusCode BkgStreamsCache::finalize ( )
finaloverridevirtual

Definition at line 386 of file BkgStreamsCache.cxx.

387 {
388  StatusCode sc(StatusCode::SUCCESS);
389  ATH_MSG_DEBUG ( "Finalizing " << name()
390  << " - cache for events of type "
392  while (sc.isSuccess() && m_streams.size()>0)
393  {
394  sc=m_streams.back().finalize();
395  m_streams.pop_back();
396  }
397  return sc;
398 }

◆ initialize()

StatusCode BkgStreamsCache::initialize ( )
finaloverridevirtual

Definition at line 218 of file BkgStreamsCache.cxx.

219 {
220  ATH_MSG_DEBUG ( "Initializing " << name()
221  << " - cache for events of type "
223 
225 
226  //create random number generators
227  ATH_CHECK(m_atRndmSvc.retrieve());
228  CLHEP::HepRandomEngine* collEng(m_atRndmSvc->GetEngine(m_randomStreamName.value()));
229  if( 0 == collEng )
230  {
231  ATH_MSG_ERROR ( "can not get random stream " << m_randomStreamName.value() );
232  return StatusCode::FAILURE;
233  }
234 
235  //setup distribution to read a new event every downscaleFactor accesses
236  //notice how we pass collEng by reference. If ! CLHEP will take ownership...
237  m_readEventRand = new CLHEP::RandFlat(*(collEng),
238  0.0, double(m_readDownscale));
239 
240  // select collision distribution functions
241  if (m_collDistrName.value() == "Fixed")
242  {
243  m_f_collDistr = std::bind(&BkgStreamsCache::collXing, this);
244  using namespace std::placeholders;
245  if(m_ignoreBM.value())
246  {
248  }
249  else
250  {
252  }
253  return StatusCode::SUCCESS;
254  }
255  if (m_collDistrName.value() == "Poisson")
256  {
257  //pass collEng by reference. If Not CLHEP will take ownership...
258  m_collXingPoisson = new CLHEP::RandPoisson(*(collEng), m_collXing);
259  // m_f_collDistr will call m_collXingPoisson->fire(m_collXing) USED TO BE boost::bind(&CLHEP::RandPoisson::fire, m_collXingPoisson);
261  using namespace std::placeholders;
262  if(m_ignoreBM.value())
263  {
265  }
266  else
267  {
269  }
270  return StatusCode::SUCCESS;
271  }
273  << " is not a know collision distribution function" );
274  return StatusCode::FAILURE;
275 }

◆ nEvtsXing()

unsigned int BkgStreamsCache::nEvtsXing ( unsigned int  iXing) const
private

Definition at line 277 of file BkgStreamsCache.cxx.

278 {
279  return (iXing + 1 > m_nEvtsXing.size()) ? 0 : m_nEvtsXing[iXing];
280 }

◆ newEvent()

void BkgStreamsCache::newEvent ( )
finaloverridevirtual

inform cache that we start overlaying a new event

Definition at line 127 of file BkgStreamsCache.cxx.

128 {
129  ATH_MSG_DEBUG ( "newEvent called resetting used event set" );
130  unsigned int totEvts(0);
131  do {
132  totEvts = 0;
133  for (unsigned int iXing=0; iXing<m_nXings; ++iXing) {
134  totEvts += setNEvtsXing(iXing);
135  if (totEvts > m_nStores) {
136  ATH_MSG_WARNING ( "newEvent: number of required evts (" << totEvts << ") exceeds number of available stores "
137  << m_nStores << ". Regenerating bkg sequence for this event \n"
138  << " the total number of bkg events may not exceed average by more than 6 sigmas"
139  );
140  break;
141  }
142  }
143  } while(totEvts > m_nStores);
144  m_usedStreams.assign(m_streams.size(), false);
145 }

◆ nextEvent()

const xAOD::EventInfo * BkgStreamsCache::nextEvent ( bool  isCentralBunchCrossing)
private

get next bkg event from cache

Definition at line 147 of file BkgStreamsCache.cxx.

148 {
149  const xAOD::EventInfo* pNextEvt(nullptr);
150  StreamVector::size_type iS(0);
151  do {
152  iS = (StreamVector::size_type)m_chooseEventRand->fire();
153  } while (alreadyInUse(iS));
154 
155  //set current store to iS
156  m_cursor = m_streams.begin();
157  std::advance(m_cursor, iS);
158 
159  ATH_MSG_DEBUG ( "using store " << iS );
160  PileUpStream* pCurrStream(current());
161  if (0 != pCurrStream) {
162  pCurrStream->store().makeCurrent();
163  //read a new event every downscaleFactor accesses
164  //force reading of new event if the event is being used for in-time pile-up
165  //FIXME a more careful strategy would have the PileUpStreams knowing if
166  //they have been used for the central bunch-crossing already.
167  bool readEvent(isCentralBunchCrossing || (m_readEventRand->fire()<1.0));
168  pNextEvt = pCurrStream->nextEventPre( readEvent );
169  }
170  return pNextEvt;
171 }

◆ nextEvent_passive()

StatusCode BkgStreamsCache::nextEvent_passive ( bool  isCentralBunchCrossing)
private

as nextEvent except don't actually load anything

Definition at line 174 of file BkgStreamsCache.cxx.

175 {
176  StreamVector::size_type iS(0);
177  do {
178  iS = (StreamVector::size_type)m_chooseEventRand->fire();
179  } while (alreadyInUse(iS));
180 
181  //set current store to iS
182  m_cursor = m_streams.begin();
183  std::advance(m_cursor, iS);
184 
185  ATH_MSG_DEBUG ( "using store " << iS );
186  PileUpStream* pCurrStream(current());
187  if (0 != pCurrStream) {
188  pCurrStream->store().makeCurrent();
189  //read a new event every downscaleFactor accesses
190  //force reading of new event if the event is being used for in-time pile-up
191  //FIXME a more careful strategy would have the PileUpStreams knowing if
192  //they have been used for the central bunch-crossing already.
193  bool readEvent(isCentralBunchCrossing || (m_readEventRand->fire()<1.0));
194  if(pCurrStream->nextEventPre_Passive(readEvent)) return StatusCode::SUCCESS;
195  }
196  return StatusCode::FAILURE;
197 }

◆ nStores()

virtual unsigned int BkgStreamsCache::nStores ( ) const
inlinefinaloverridevirtual

how many stores in this cache

Definition at line 77 of file BkgStreamsCache.h.

77 { return m_nStores; }

◆ numberOfBkgForBunchCrossingDefaultImpl()

unsigned int BkgStreamsCache::numberOfBkgForBunchCrossingDefaultImpl ( unsigned int  iXing) const

Definition at line 286 of file BkgStreamsCache.cxx.

287 {
288  return static_cast<unsigned int>(m_beamInt->normFactor(iXing-m_zeroXing)*static_cast<float>(m_f_collDistr()));
289 }

◆ numberOfBkgForBunchCrossingIgnoringBeamIntensity()

unsigned int BkgStreamsCache::numberOfBkgForBunchCrossingIgnoringBeamIntensity ( unsigned int  iXing) const

meant to be used via m_f_numberOfBackgroundForBunchCrossing

Definition at line 282 of file BkgStreamsCache.cxx.

283 {
284  return m_f_collDistr();
285 }

◆ numberOfCavernBkgForBunchCrossing()

unsigned int BkgStreamsCache::numberOfCavernBkgForBunchCrossing ( unsigned int  iXing) const

Definition at line 290 of file BkgStreamsCache.cxx.

291 {
292  return static_cast<unsigned int>(m_beamInt->normFactor(iXing-m_zeroXing)>0.0)*m_f_collDistr();
293 }

◆ PileUpEventTypeHandler()

void BkgStreamsCache::PileUpEventTypeHandler ( Gaudi::Details::PropertyBase &  )
private

Definition at line 42 of file BkgStreamsCache.cxx.

◆ resetEvtsPerXingScaleFactor()

void BkgStreamsCache::resetEvtsPerXingScaleFactor ( float  sf)
finaloverridevirtual

reset scale factor at new run/lumiblk

Definition at line 116 of file BkgStreamsCache.cxx.

117 {
118  if (!m_ignoreSF) m_collXingSF = sf;
119 }

◆ setNEvtsXing()

unsigned int BkgStreamsCache::setNEvtsXing ( unsigned int  iXing)
private

Definition at line 295 of file BkgStreamsCache.cxx.

296 {
297  if (iXing + 1 > m_nEvtsXing.size()) m_nEvtsXing.resize(2 * iXing + 1);
298  unsigned int nEvts(m_f_numberOfBackgroundForBunchCrossing(iXing));
299  //this is done mainly to handle the case in which original and backround
300  //events belong to the same stream. Of course we do not want m_nEvtsXing[m_zeroXing]<0
301  if ((int)iXing==m_zeroXing)
302  {
303  unsigned int subValue(m_subtractBC0.value());
304  while (nEvts<subValue) nEvts = m_f_numberOfBackgroundForBunchCrossing(iXing);
305  nEvts -= subValue;
306 #ifndef NDEBUG
307  ATH_MSG_VERBOSE ( "Subtracted " << m_subtractBC0.value()
308  << " events from BC=0 Xing " << iXing << " - Events at BC=0 "
309  << nEvts
310  );
311 #endif
312  }
313  ATH_MSG_VERBOSE ( "Will pile-up " << nEvts
314  << " events for BCID " << iXing );
315  m_nEvtsXing[iXing] = nEvts;
316  return nEvts;
317 }

◆ setup()

StatusCode BkgStreamsCache::setup ( int  firstXing,
unsigned int  nXings,
unsigned int  firstStore,
IBeamIntensity iBM 
)
finaloverridevirtual
Parameters
nXingsbunch Xings to be processed
firstStoreid of first store in cache

Definition at line 48 of file BkgStreamsCache.cxx.

52 {
53  assert (0 < nXings);
54  m_nXings = nXings;
55  m_zeroXing = -firstXing;
56  if (m_zeroXing >= (int)nXings) m_zeroXing = -99;
57  m_beamInt = (m_ignoreBM.value() ? 0 : iBM);
58  float largestElement( ( m_ignoreBM.value() || m_collDistrName.value() == "Fixed" ) ? 1.0 : m_beamInt->largestElementInPattern() );
59  //ceil (cmath) rounds up to the nearest integer ceil(1.5)= 2
60  float occupiedCrossings = ceil(static_cast<float>(m_nXings) * m_occupationFraction);
61  m_nStores = static_cast<unsigned int>(ceil( m_collXing * occupiedCrossings * largestElement));
62  if (m_collDistrName.value() == "Poisson")
63  {
64  //allow for fluctuations in # of overlaid events
65  m_nStores += static_cast<unsigned int>(6.0 * sqrt(static_cast<float>(m_nStores)));
66  }
67 
68  //get bkg selectors, stores and iterators
69  ATH_MSG_DEBUG ( "Set up " << m_nStores << " stores" );
70 
71  m_nEvtsXing.reserve(m_nStores);
72  m_streams.reserve(m_nStores);
73  m_usedStreams.reserve(m_nStores);
74  m_usedStreams.assign(m_nStores, false);
75 
76  const std::string& selecName(m_selecName.name());
77  for (unsigned int i=0; i < m_nStores; ++i)
78  {
79  std::stringstream bufName;
80  bufName << "BkgEvent_" << i + firstStore;
81  const std::string& streamName(bufName.str());
82  try
83  {
84  m_streams.emplace_back(streamName,serviceLocator(),selecName);
85  }
86  catch (const std::runtime_error& e)
87  {
88  ATH_MSG_ERROR ( "Exception thrown while creating PileUpStream "
89  << streamName << " : " << e.what() );
90  return StatusCode::FAILURE;
91  }
92 
93  if(!(m_streams.back().setupStore()))
94  {
95  ATH_MSG_ERROR ( "Can not setup bkg evt store for stream "
96  << streamName );
97  return StatusCode::FAILURE;
98  }
99  }
100  m_cursor = m_streams.begin();
101 
102  CLHEP::HepRandomEngine* collEng(m_atRndmSvc->GetEngine(m_randomStreamName.value()));
103  if( !collEng )
104  {
105  ATH_MSG_ERROR ( "can not get random stream " << m_randomStreamName.value() );
106  return StatusCode::FAILURE;
107  }
108  //setup generator to pickup an event store at random from the cache
109  //notice how we pass collEng by reference. If ! CLHEP will take ownership...
110  m_chooseEventRand = new CLHEP::RandFlat(*(collEng),
111  0.0, double(m_nStores));
112 
113  return StatusCode::SUCCESS;
114 }

Member Data Documentation

◆ m_atRndmSvc

ServiceHandle<IAtRndmGenSvc> BkgStreamsCache::m_atRndmSvc
private
Initial value:
{this, "RndmGenSvc", "AtRndmGenSvc",
"IAtRndmGenSvc controlling the distribution of bkg events/xing"}

Definition at line 108 of file BkgStreamsCache.h.

◆ m_beamInt

IBeamIntensity* BkgStreamsCache::m_beamInt {nullptr}
private

pointer to the IBeamIntensity distribution tool

Definition at line 167 of file BkgStreamsCache.h.

◆ m_chooseEventRand

CLHEP::RandFlat* BkgStreamsCache::m_chooseEventRand {nullptr}
private

pickup an event store at random from the cache

Definition at line 153 of file BkgStreamsCache.h.

◆ m_collDistrName

Gaudi::Property<std::string> BkgStreamsCache::m_collDistrName
private
Initial value:
{this, "CollDistribution", "Poisson",
"nEvts/Xings can be either Fixed at CollPerXing or Poisson with average CollPerXing"}

Definition at line 117 of file BkgStreamsCache.h.

◆ m_collXing

Gaudi::Property<float> BkgStreamsCache::m_collXing
private
Initial value:
{this, "CollPerXing", 23.0,
"(average) number of collisions per beam crossing"}

Definition at line 111 of file BkgStreamsCache.h.

◆ m_collXingPoisson

CLHEP::RandPoisson* BkgStreamsCache::m_collXingPoisson {nullptr}
private

set number of collisions per bunch crossing (if Poisson distribution chosen)

Definition at line 155 of file BkgStreamsCache.h.

◆ m_collXingSF

float BkgStreamsCache::m_collXingSF {1.0}
private

float scaling number of collisions per bunch crossing

Definition at line 163 of file BkgStreamsCache.h.

◆ m_cursor

StreamVector::iterator BkgStreamsCache::m_cursor {}
private

Definition at line 99 of file BkgStreamsCache.h.

◆ 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 158 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 161 of file BkgStreamsCache.h.

◆ m_forceReadForBC0

Gaudi::Property<bool> BkgStreamsCache::m_forceReadForBC0
private
Initial value:
{this, "ForceReadForBC0", true,
"Force events used in the central bunch crossing to be refreshed"}

Definition at line 145 of file BkgStreamsCache.h.

◆ m_ignoreBM

Gaudi::Property<bool> BkgStreamsCache::m_ignoreBM
private
Initial value:
{this, "IgnoreBeamInt", false,
"Default=False, set to True to ignore the PileUpEventLoopMgr beam intensity "
"tool in setting the number of events per xing."}

Definition at line 137 of file BkgStreamsCache.h.

◆ m_ignoreSF

Gaudi::Property<bool> BkgStreamsCache::m_ignoreSF
private
Initial value:
{this, "IgnoreBeamLumi", false,
"Default=False, set to True to ignore the PileUpEventLoopMgr beam luminosity "
"tool in setting the number of events per xing."}

Definition at line 141 of file BkgStreamsCache.h.

◆ m_nEvtsXing

std::vector<unsigned int> BkgStreamsCache::m_nEvtsXing
private

Definition at line 104 of file BkgStreamsCache.h.

◆ m_nStores

unsigned int BkgStreamsCache::m_nStores {0}
private

Definition at line 103 of file BkgStreamsCache.h.

◆ m_nXings

unsigned int BkgStreamsCache::m_nXings {0}
private

Definition at line 102 of file BkgStreamsCache.h.

◆ m_occupationFraction

Gaudi::Property<float> BkgStreamsCache::m_occupationFraction
private
Initial value:
{this, "OccupationFraction", 1.0,
"The maximum fraction of bunch-crossings which will be occupied."}

Definition at line 114 of file BkgStreamsCache.h.

◆ m_pileUpEventType

xAOD::EventInfo::PileUpType BkgStreamsCache::m_pileUpEventType
private

the type of events in this cache

Definition at line 149 of file BkgStreamsCache.h.

◆ m_pileUpEventTypeProp

Gaudi::CheckedProperty<unsigned short> BkgStreamsCache::m_pileUpEventTypeProp
private
Initial value:
{this, "PileUpEventType", 0,
"Type of the pileup events in this cache: 0:Signal, 1:MinimumBias, 2:Cavern, 3:HaloGas, "
"4:ZeroBias. Default=0 (Signal, Invalid)"}

Definition at line 127 of file BkgStreamsCache.h.

◆ m_randomStreamName

Gaudi::Property<std::string> BkgStreamsCache::m_randomStreamName
private
Initial value:
{this, "RndmStreamName", "PileUpCollXingStream",
"IAtRndmGenSvc stream used as engine for our various random distributions, including the CollPerXing one "}

Definition at line 124 of file BkgStreamsCache.h.

◆ m_readDownscale

Gaudi::Property<float> BkgStreamsCache::m_readDownscale
private
Initial value:
{this, "ReadDownscaleFactor", 150,
"read one event every downscaleFactor accesses (asymptotically -> number of times "
"an event in the cache will be reused)"}

Definition at line 120 of file BkgStreamsCache.h.

◆ m_readEventRand

CLHEP::RandFlat* BkgStreamsCache::m_readEventRand {nullptr}
private

read a new event every downscaleFactor accesses

Definition at line 151 of file BkgStreamsCache.h.

◆ m_selecName

ServiceHandle<IEvtSelector> BkgStreamsCache::m_selecName {this, "EventSelector", "FakeEventSelector"}
private

Definition at line 106 of file BkgStreamsCache.h.

◆ m_streams

StreamVector BkgStreamsCache::m_streams
private

Definition at line 100 of file BkgStreamsCache.h.

◆ m_subtractBC0

Gaudi::Property<unsigned short> BkgStreamsCache::m_subtractBC0
private
Initial value:
{this, "SubtractBC0", 0,
"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"}

Definition at line 133 of file BkgStreamsCache.h.

◆ m_usedStreams

std::vector<bool> BkgStreamsCache::m_usedStreams
private

Definition at line 101 of file BkgStreamsCache.h.

◆ m_zeroXing

int BkgStreamsCache::m_zeroXing {-1}
private

offset of BC=0 xing

Definition at line 165 of file BkgStreamsCache.h.


The documentation for this class was generated from the following files:
c_pileUpEventInfoContName
const std::string c_pileUpEventInfoContName
default value for the EventInfoContainer storing subevents for PileUp
Definition: PileUpMisc.h:15
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
BkgStreamsCache::PileUpEventTypeHandler
void PileUpEventTypeHandler(Gaudi::Details::PropertyBase &)
Definition: BkgStreamsCache.cxx:42
BkgStreamsCache::m_cursor
StreamVector::iterator m_cursor
Definition: BkgStreamsCache.h:99
BkgStreamsCache::nextEvent_passive
StatusCode nextEvent_passive(bool isCentralBunchCrossing)
as nextEvent except don't actually load anything
Definition: BkgStreamsCache.cxx:174
BkgStreamsCache::m_pileUpEventTypeProp
Gaudi::CheckedProperty< unsigned short > m_pileUpEventTypeProp
Definition: BkgStreamsCache.h:127
xAOD::EventInfo_v1::PileUp_NTYPES
@ PileUp_NTYPES
Definition: EventInfo_v1.h:272
BkgStreamsCache::m_ignoreBM
Gaudi::Property< bool > m_ignoreBM
Definition: BkgStreamsCache.h:137
BkgStreamsCache::m_chooseEventRand
CLHEP::RandFlat * m_chooseEventRand
pickup an event store at random from the cache
Definition: BkgStreamsCache.h:153
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
IBeamIntensity::largestElementInPattern
virtual float largestElementInPattern() const =0
the largest element in the beam intensity pattern.
BkgStreamsCache::m_nEvtsXing
std::vector< unsigned int > m_nEvtsXing
Definition: BkgStreamsCache.h:104
BkgStreamsCache::m_atRndmSvc
ServiceHandle< IAtRndmGenSvc > m_atRndmSvc
Definition: BkgStreamsCache.h:108
BkgStreamsCache::m_pileUpEventType
xAOD::EventInfo::PileUpType m_pileUpEventType
the type of events in this cache
Definition: BkgStreamsCache.h:149
BkgStreamsCache::numberOfBkgForBunchCrossingDefaultImpl
unsigned int numberOfBkgForBunchCrossingDefaultImpl(unsigned int iXing) const
Definition: BkgStreamsCache.cxx:286
BkgStreamsCache::m_f_numberOfBackgroundForBunchCrossing
std::function< unsigned int(unsigned int) > m_f_numberOfBackgroundForBunchCrossing
function returning the number of bkg events per bunch crossing after bunch structure modulation
Definition: BkgStreamsCache.h:161
BkgStreamsCache::m_collXingSF
float m_collXingSF
float scaling number of collisions per bunch crossing
Definition: BkgStreamsCache.h:163
BkgStreamsCache::m_subtractBC0
Gaudi::Property< unsigned short > m_subtractBC0
Definition: BkgStreamsCache.h:133
BkgStreamsCache::m_nStores
unsigned int m_nStores
Definition: BkgStreamsCache.h:103
BkgStreamsCache::m_forceReadForBC0
Gaudi::Property< bool > m_forceReadForBC0
Definition: BkgStreamsCache.h:145
BkgStreamsCache::m_occupationFraction
Gaudi::Property< float > m_occupationFraction
Definition: BkgStreamsCache.h:114
BkgStreamsCache::m_f_collDistr
std::function< long() > m_f_collDistr
function returning the number of collisions per bunch crossing before bunch structure modulation
Definition: BkgStreamsCache.h:158
BkgStreamsCache::m_collXing
Gaudi::Property< float > m_collXing
Definition: BkgStreamsCache.h:111
trigbs_truncateEvents.readEvent
def readEvent(file)
Definition: trigbs_truncateEvents.py:10
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
BkgStreamsCache::nEvtsXing
unsigned int nEvtsXing(unsigned int iXing) const
Definition: BkgStreamsCache.cxx:277
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
BkgStreamsCache::m_beamInt
IBeamIntensity * m_beamInt
pointer to the IBeamIntensity distribution tool
Definition: BkgStreamsCache.h:167
StoreGateSvc::retrieve
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
PixelByteStreamErrors::BCID
@ BCID
Definition: PixelByteStreamErrors.h:13
IBeamIntensity::normFactor
virtual float normFactor(int bunchXing) const =0
a scale factor (average value 1.0) for the beam intensity at a given xing.
BkgStreamsCache::m_collDistrName
Gaudi::Property< std::string > m_collDistrName
Definition: BkgStreamsCache.h:117
BkgStreamsCache::alreadyInUse
bool alreadyInUse(StreamVector::size_type iStream)
Definition: BkgStreamsCache.cxx:199
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:120
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
BkgStreamsCache::m_readDownscale
Gaudi::Property< float > m_readDownscale
Definition: BkgStreamsCache.h:120
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
BkgStreamsCache::m_ignoreSF
Gaudi::Property< bool > m_ignoreSF
Definition: BkgStreamsCache.h:141
test_pyathena.parent
parent
Definition: test_pyathena.py:15
PileUpStream
a triple selector/context/store defines a stream
Definition: PileUpStream.h:32
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
BkgStreamsCache::m_nXings
unsigned int m_nXings
Definition: BkgStreamsCache.h:102
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
BkgStreamsCache::numberOfCavernBkgForBunchCrossing
unsigned int numberOfCavernBkgForBunchCrossing(unsigned int iXing) const
Definition: BkgStreamsCache.cxx:290
WriteHiveWithMetaData.streamName
string streamName
Definition: WriteHiveWithMetaData.py:22
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
BkgStreamsCache::m_zeroXing
int m_zeroXing
offset of BC=0 xing
Definition: BkgStreamsCache.h:165
BkgStreamsCache::collXing
long collXing()
meant to be used (mainly) via m_f_collDistr
Definition: BkgStreamsCache.h:80
BkgStreamsCache::m_collXingPoisson
CLHEP::RandPoisson * m_collXingPoisson
set number of collisions per bunch crossing (if Poisson distribution chosen)
Definition: BkgStreamsCache.h:155
BkgStreamsCache::m_selecName
ServiceHandle< IEvtSelector > m_selecName
Definition: BkgStreamsCache.h:106
BkgStreamsCache::setNEvtsXing
unsigned int setNEvtsXing(unsigned int iXing)
Definition: BkgStreamsCache.cxx:295
BkgStreamsCache::collXingPoisson
long collXingPoisson()
Definition: BkgStreamsCache.cxx:121
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
xAOD::EventInfo_v1::PileUpInt2Type
static PileUpType PileUpInt2Type(unsigned short typ)
Convert int to PileUpType enum value.
Definition: EventInfo_v1.cxx:672
BkgStreamsCache::current
PileUpStream * current()
get current (last asked) stream
Definition: BkgStreamsCache.cxx:211
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAOD::EventInfo_v1::PileUpType2Name
static const std::string & PileUpType2Name(PileUpType typ)
Convert PileUpType enum value to string.
Definition: EventInfo_v1.cxx:658
BkgStreamsCache::m_usedStreams
std::vector< bool > m_usedStreams
Definition: BkgStreamsCache.h:101
BkgStreamsCache::addSubEvts
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.
Definition: BkgStreamsCache.cxx:319
BkgStreamsCache::numberOfBkgForBunchCrossingIgnoringBeamIntensity
unsigned int numberOfBkgForBunchCrossingIgnoringBeamIntensity(unsigned int iXing) const
meant to be used via m_f_numberOfBackgroundForBunchCrossing
Definition: BkgStreamsCache.cxx:282
BkgStreamsCache::m_randomStreamName
Gaudi::Property< std::string > m_randomStreamName
Definition: BkgStreamsCache.h:124
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:18
BkgStreamsCache::m_streams
StreamVector m_streams
Definition: BkgStreamsCache.h:100
BkgStreamsCache::nextEvent
const xAOD::EventInfo * nextEvent(bool isCentralBunchCrossing)
get next bkg event from cache
Definition: BkgStreamsCache.cxx:147
BkgStreamsCache::m_readEventRand
CLHEP::RandFlat * m_readEventRand
read a new event every downscaleFactor accesses
Definition: BkgStreamsCache.h:151