|  | 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 35 of file BkgStreamsCache.h.
◆ StreamVector
◆ BkgStreamsCache()
      
        
          | BkgStreamsCache::BkgStreamsCache | ( | const std::string & | type, | 
        
          |  |  | const std::string & | name, | 
        
          |  |  | const IInterface * | parent | 
        
          |  | ) |  |  | 
      
 
 
◆ ~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 327 of file BkgStreamsCache.cxx.
  331   for (
unsigned int iEvt=0; iEvt<
nEvtsXing(iXing); ++iEvt)
 
  337       if(!loadEventProxies)        {
 
  344       if (0 == pBkgEvent || 0 == currStream)
 
  347           ATH_MSG_INFO ( 
"end of loop: background cache has no more events" );
 
  348           return StatusCode::FAILURE;
 
  355                       << 
" @ Xing " << iXing );
 
  364       subEvCnt->back()->setBCID( 
BCID );
 
  365       subEvCnt->back()->setEvtStore( pBkgStore );
 
  369       if (pBkgStore->
retrieve(pStoreInfo).isSuccess() && pStoreInfo &&
 
  370           pBkgEvent->
eventNumber() != pStoreInfo->eventNumber())
 
  374                           << 
" differ from current store " 
  376                           << 
" event " <<  pStoreInfo->eventNumber()
 
  377                           << 
" run " << pStoreInfo->runNumber()
 
  383   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 319 of file BkgStreamsCache.cxx.
  323   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 218 of file BkgStreamsCache.cxx.
  221                    << 
" - cache for events of type " 
  232       return StatusCode::FAILURE;
 
  244       using namespace std::placeholders;
 
  253       return StatusCode::SUCCESS;
 
  261       using namespace std::placeholders;
 
  270       return StatusCode::SUCCESS;
 
  273                    << 
" is not a know collision distribution function" );
 
  274   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 127 of file BkgStreamsCache.cxx.
  129   ATH_MSG_DEBUG (  
"newEvent called resetting used event set" );
 
  130   unsigned int totEvts(0);
 
  133     for (
unsigned int iXing=0; iXing<
m_nXings; ++iXing) {
 
  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" 
 
 
 
◆ nextEvent()
get next bkg event from cache 
Definition at line 147 of file BkgStreamsCache.cxx.
  150   StreamVector::size_type iS(0);
 
  161   if (0 != pCurrStream) {
 
  162     pCurrStream->store().makeCurrent();
 
  168     pNextEvt = pCurrStream->nextEventPre( 
readEvent );
 
 
 
 
◆ 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.
  176   StreamVector::size_type iS(0);
 
  187   if (0 != pCurrStream) {
 
  188     pCurrStream->store().makeCurrent();
 
  194     if(pCurrStream->nextEventPre_Passive(
readEvent)) 
return StatusCode::SUCCESS;
 
  196   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 282 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 295 of file BkgStreamsCache.cxx.
  308                         << 
" events from BC=0 Xing " << iXing << 
" - Events at BC=0 " 
  314                     << 
" 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 48 of file BkgStreamsCache.cxx.
   61   m_nStores = 
static_cast<unsigned int>(ceil( 
m_collXing * occupiedCrossings * largestElement));
 
   79       std::stringstream bufName;
 
   80       bufName << 
"BkgEvent_" << 
i + firstStore;
 
   86       catch (
const std::runtime_error& 
e)
 
   88           ATH_MSG_ERROR ( 
"Exception thrown while creating PileUpStream " 
   90           return StatusCode::FAILURE;
 
   97           return StatusCode::FAILURE;
 
  106       return StatusCode::FAILURE;
 
  113   return StatusCode::SUCCESS;
 
 
 
 
◆ m_atRndmSvc
Initial value:{this, "RndmGenSvc", "AtRndmGenSvc",
    "IAtRndmGenSvc controlling the distribution of bkg events/xing"}
Definition at line 108 of file BkgStreamsCache.h.
 
 
◆ m_beamInt
◆ m_chooseEventRand
  
  | 
        
          | CLHEP::RandFlat* BkgStreamsCache::m_chooseEventRand {nullptr} |  | private | 
 
 
◆ 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 | 
 
 
◆ 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 | 
 
 
◆ m_nStores
  
  | 
        
          | unsigned int BkgStreamsCache::m_nStores {0} |  | private | 
 
 
◆ m_nXings
  
  | 
        
          | unsigned int BkgStreamsCache::m_nXings {0} |  | private | 
 
 
◆ 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
◆ 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 | 
 
 
◆ m_selecName
  
  | 
        
          | ServiceHandle<IEvtSelector> BkgStreamsCache::m_selecName {this, "EventSelector", "FakeEventSelector"} |  | private | 
 
 
◆ m_streams
◆ 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 | 
 
 
◆ m_zeroXing
  
  | 
        
          | int BkgStreamsCache::m_zeroXing {-1} |  | 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
Gaudi::Property< bool > m_ignoreBM
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
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
Gaudi::Property< bool > m_forceReadForBC0
Gaudi::Property< float > m_occupationFraction
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
bool alreadyInUse(StreamVector::size_type iStream)
The Athena Transient Store API.
Gaudi::Property< float > m_readDownscale
::StatusCode StatusCode
StatusCode definition for legacy code.
Gaudi::Property< bool > m_ignoreSF
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
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