21#ifndef XAOD_STANDALONE
32 static std::atomic< bool > uninitPileupAccessPrinted =
false;
33 if( ! uninitPileupAccessPrinted ) {
34 std::println(
"xAOD::EventInfo WARNING Uninitialised pileup value was "
36 " Debug it by breaking on "
37 "xAODEventInfoPrivate::pileupUnsetHook function calls!" );
38 uninitPileupAccessPrinted =
true;
64 makePrivateStore( parent );
80 SG::AuxElement::operator=( rhs );
93 runNumber, setRunNumber )
102 setTimeStampNSOffset )
106 detectorMask0, setDetectorMask0 )
110 detectorMask2, setDetectorMask2 )
166 detDescrTags, setDetDescrTags )
170 mcEventNumber, setMCEventNumber )
181 eventTypeBitmask, setEventTypeBitmask )
197 statusElement, setStatusElement )
199 extendedLevel1ID, setExtendedLevel1ID )
202 setLevel1TriggerType )
205 const std::string&
type,
207 const std::set< uint32_t >& robs,
208 const std::set< uint32_t >& dets )
209 : m_name(
name ), m_type(
type ), m_obeysLumiblock( obeysLumiblock ),
210 m_robs( robs ), m_dets( dets ) {
242 static const EventInfo_v1::Accessor< std::vector< std::string > >
244 static const EventInfo_v1::Accessor< std::vector< std::string > >
246 static const EventInfo_v1::Accessor< std::vector< char > >
247 olb(
"streamTagObeysLumiblock" );
248 static const EventInfo_v1::Accessor< std::vector< std::set< uint32_t > > >
250 static const EventInfo_v1::Accessor< std::vector< std::set< uint32_t > > >
253 const std::vector< EventInfo_v1::StreamTag >&
258 std::vector< StreamTag >
tags;
261 if( (
names( *this ).size() !=
types( *this ).size() ) ||
262 (
names( *this ).size() !=
olb( *this ).size() ) ||
263 (
robsets.isAvailable( *
this ) &&
264 (
names( *this ).size() !=
robsets( *this ).size() ) ) ||
265 (
detsets.isAvailable( *
this ) &&
266 (
names( *this ).size() !=
detsets( *this ).size() ) ) ) {
267 std::println( std::cerr,
"<xAOD::EventInfo_v1::streamTags> ERROR "
268 "Corrupt information found!" );
269 std::println( std::cerr,
" streamTagNames = {}",
names( *
this ) );
270 std::println( std::cerr,
" streamTagTypes = {}",
types( *
this ) );
271 std::println( std::cerr,
" streamTagObeysLumiblock = {}",
olb( *
this ) );
272 std::print( std::cerr,
" streamTagRobs = " );
273 if(
robsets.isAvailable( *
this ) ) {
274 std::println( std::cerr,
"N/A" );
276 std::println( std::cerr,
"{}",
robsets( *
this ) );
278 std::print( std::cerr,
" streamTagDets = " );
279 if(
detsets.isAvailable( *
this ) ) {
280 std::println( std::cerr,
"N/A" );
282 std::println( std::cerr,
"{}",
detsets( *
this ) );
288 for(
size_t i = 0; i <
names( *this ).size(); ++i ) {
289 static const std::set< uint32_t > dummySet;
293 (
robsets.isAvailable( *
this ) ?
296 (
detsets.isAvailable( *
this ) ?
316 names( *this ).clear();
types( *this ).clear();
olb( *this ).clear();
320 std::vector< StreamTag >::const_iterator itr = value.begin();
321 std::vector< StreamTag >::const_iterator end = value.end();
322 for( ; itr != end; ++itr ) {
323 names( *this ).push_back( itr->name() );
324 types( *this ).push_back( itr->type() );
325 olb( *this ).push_back( itr->obeysLumiblock() );
326 robsets( *this ).push_back( itr->robs() );
327 detsets( *this ).push_back( itr->dets() );
383 pileUpMixtureIDLowBits,
384 setPileUpMixtureIDLowBits )
387 setPileUpMixtureIDHighBits )
411 EventInfo_v1::SubEvent::
440 static const std::string
name =
"Signal";
443 static const std::string
name =
"MinimumBias";
446 static const std::string
name =
"Cavern";
449 static const std::string
name =
"HaloGas";
452 static const std::string
name =
"HighPtMinimumBias";
455 static const std::string
name =
"ZeroBias";
458 static const std::string
name =
"Unknown";
490 std::vector< EventInfo_v1::SubEvent >
496 if( ( !
timeAcc.isAvailable( *
this ) ) &&
497 ( !
indexAcc.isAvailable( *
this ) ) &&
498 ( !
linkAcc.isAvailable( *
this ) ) &&
499 ( !
typeAcc.isAvailable( *
this ) ) )
506 if(
timeAcc.isAvailable( *
this ) ) {
508 }
else if(
indexAcc.isAvailable( *
this ) ) {
510 }
else if(
linkAcc.isAvailable( *
this ) ) {
512 }
else if(
typeAcc.isAvailable( *
this ) ) {
515 std::println( std::cerr,
"xAOD::EventInfo_v1 ERROR Logic error in subEvents()" );
518 if( (
timeAcc.isAvailable( *
this ) &&
522 (
linkAcc.isAvailable( *
this ) &&
524 (
typeAcc.isAvailable( *
this ) &&
526 std::println( std::cerr,
"xAOD::EventInfo_v1 ERROR Data corruption found in "
527 "the sub-event information" );
528 std::println( std::cerr,
"subEventTime = {}",
530 std::vector< int16_t >() ) );
531 std::println( std::cerr,
"subEventIndex = {}",
533 std::vector< uint16_t >() ) );
537 return std::format (
"{}:{}", el.dataID(), el.index());
539 const std::vector< ElementLink< EventInfoContainer_v1 > >& links =
541 std::vector< ElementLink< EventInfoContainer_v1 > >();
542 auto linksform = links | std::views::transform (format_el);
544 std::println( std::cerr,
"subEventLink = {}", linksform );
545 std::println( std::cerr,
"subEventType = {}",
547 std::vector< uint16_t >() ) );
551 for(
size_t i = 0; i <
size; ++i ) {
560 (
typeAcc.isAvailable( *
this ) ?
569 const std::vector< EventInfo_v1::SubEvent >&
591 std::vector< SubEvent >::const_iterator itr = value.begin();
592 std::vector< SubEvent >::const_iterator end = value.end();
593 for( ; itr != end; ++itr ) {
594 timeAcc( *this ).push_back( itr->time() );
595 indexAcc( *this ).push_back( itr->index() );
597 linkAcc( *this ).push_back( itr->link() );
651 int t = (typ==99)? 0: (
int)typ+1;
682 throw std::runtime_error(
"EventInfo_v1::isEventFlagBitSet: Asked for "
683 "non-existent bit" );
690 return ( ( value >> bit ) & 0x1 );
703 std::atomic<uint32_t>&
a = (*acc)(*this);
706 while (!
a.compare_exchange_strong (orig, value)) {
729 if (existingFlags & (1u << bit)) {
740 ( *acc )( *this ) |= ( 1u << bit );
760 ( *acc )( *this ) &= ~( 1u << bit );
773 if ((existingFlags | flags) == existingFlags) {
784 ( *acc )( *this ) |= ( flags &
EF_BITS );
814 std::atomic<uint32_t>&
a = (*acc)(*this);
817 (
static_cast< uint32_t >( state ) <<
819 while (!
a.compare_exchange_strong (orig, value)) {
822 (
static_cast< uint32_t >( state ) <<
851 std::atomic<uint32_t>&
a = (*acc)(*this);
860 (
static_cast< uint32_t >( state ) <<
862 while (!
a.compare_exchange_strong (orig, value)) {
868 (
static_cast< uint32_t >( state ) <<
893 static const Accessor< float > accX(
"beamPosX" );
894 static const Accessor< float > accY(
"beamPosY" );
895 static const Accessor< float > accZ(
"beamPosZ" );
912 static const Accessor< float > accX(
"beamPosSigmaX" );
913 static const Accessor< float > accY(
"beamPosSigmaY" );
914 static const Accessor< float > accZ(
"beamPosSigmaZ" );
937 static
const SG::Accessor<
float >
973 if(
linkAcc.isAvailableWritable( *
this ) ) {
975 std::vector< ElementLink< EventInfoContainer_v1 > >
::iterator
976 el_itr =
linkAcc( *this ).begin();
977 std::vector< ElementLink< EventInfoContainer_v1 > >
::iterator
978 el_end =
linkAcc( *this ).end();
979 for( ; el_itr != el_end; ++el_itr ) {
980 el_itr->toPersistent();
996#ifdef XAOD_STANDALONE
1002 if( usingStandaloneStore() ) {
1011 "[Run,Evt,Lumi,Time,BunchCross,DetMask] = [{},{},{},{}:{},{},{:#018x}]",
1056 std::print( out,
"{}", ei.
toString() );
1069 std::print( out,
"{}",
id );
1083 return a.lowBits == b.lowBits &&
a.highBits == b.highBits;
ElementLink()
Default constructor.
Access an auxiliary variable atomically.
#define AUXSTORE_PRIMITIVE_GETTER(CL, TYPE, NAME)
Macro creating the reader function for a primitive auxiliary property.
#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of primitive auxiliary properties.
#define AUXSTORE_OBJECT_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of complex auxiliary properties.
static const std::vector< std::string > types
static const uint32_t mask3
size_t size() const
Number of registered mappings.
ElementLink implementation for ROOT usage.
This class represents the "type of event" where the type is given by one or more "characteristics".
Helper class to provide type-safe access to aux data.
Access an auxiliary variable atomically.
Interface for non-const operations on an auxiliary store.
The Athena Transient Store API.
bool obeysLumiblock() const
Get whether the the stream obeys the luminosity block boundaires.
StreamTag(const std::string &name, const std::string &type, bool obeysLumiblock, const std::set< uint32_t > &robs=std::set< uint32_t >(), const std::set< uint32_t > &dets=std::set< uint32_t >())
Constructor giving all relevant information to the object.
const std::set< uint32_t > & dets() const
Get the (optional) list of detector IDs for partial event building.
std::set< uint32_t > m_dets
Optional list of detector IDs for PEB.
bool m_obeysLumiblock
Whether the stream obeys luminosity block boundaries.
const std::string & type() const
Get the type of the stream.
std::string m_type
The type of the stream.
std::string m_name
The name of the stream.
const std::string & name() const
Get the name of the stream.
std::set< uint32_t > m_robs
Optional list of RoB IDs for PEB.
const std::set< uint32_t > & robs() const
Get the (optional) list of RoB IDs for partial event building.
Class describing the properties of one pileup sub-event.
uint16_t m_index
The index of the pileup event.
PileUpType m_type
The type of the pileup event.
ElementLink< EventInfoContainer_v1 > m_link
Link to the EventInfo object in question.
uint16_t index() const
Get the index of the sub-event.
const ElementLink< EventInfoContainer_v1 > & link() const
Get a link to the EventInfo object describing the pileup event.
int16_t m_time
The time wrt. the signal event.
int16_t time() const
Get the time wrt. the signal event (which has time() == 0).
const EventInfo_v1 * ptr() const
Get a pointer to the EventInfo object describing the pileup event.
PileUpType type() const
Get the type of the pileup event.
const std::string & typeName() const
The string name of the type.
Class describing the basic event information.
void setBeamPosSigma(float x, float y, float z)
Set the size of the beam spot.
static const std::string & PileUpType2Name(PileUpType typ)
Convert PileUpType enum value to string.
uint32_t detectorMask3() const
Bit field indicating which TTC zones are present in the event.
void setAverageInteractionsPerCrossing(float value)
Set average interactions per crossing for all BCIDs.
CxxUtils::CachedValue< std::vector< StreamTag > > m_streamTags
Cached stream tag objects.
bool resetEventFlagBit(EventFlagSubDet subDet, size_t bit)
Reset one particular bit of one particular sub-detector.
uint64_t pileUpMixtureIDLowBits() const
Unique pile-up mixture identifier low bits.
float beamPosSigmaY() const
The width of the beam spot in the Y direction.
void setDetectorMask(uint32_t mask0, uint32_t mask1)
Set the bit fields indicating with TTC timezones were present.
uint32_t lumiBlock() const
The current event's luminosity block number.
bool eventType(EventType type) const
Check for one particular bitmask value.
std::vector< EventInfo_v1::SubEvent > makeSubEvents() const
void toPersistent()
Prepare the object for writing.
std::vector< std::pair< std::string, std::string > > DetDescrTags_t
Type of the detector description tags.
uint32_t eventTypeBitmask() const
The event type bitmask.
uint32_t bcid() const
The bunch crossing ID of the event.
EventFlagSubDet
Sub-detector types for which we store event-level flags.
float beamPosX() const
X coordinate of the beam spot position.
void setDetectorMask1(uint32_t value)
Set the bit field indicating with TTC timezones were present.
bool updateEventFlagBit(const EventFlagSubDet subDet, const size_t bit) const
Change detector flags with update semantics.
void setStreamTags(const std::vector< StreamTag > &value)
Set the streams that the event was put in.
void setBeamTiltYZ(float value)
Set the beam's tilt in radians in YZ.
bool setErrorState(EventFlagSubDet subDet, EventFlagErrorState state)
Set the error state for a particular sub-detector.
void clearSubEvents()
Clear all the currently held sub-events.
StoreGateSvc * m_evtStore
Transient pointer to the StoreGateSvc instance associated with the event (Needed for pile-up digitisa...
float beamPosSigmaXY() const
The beam spot shape's X-Y correlation.
float beamSpotWeight() const
Weight for beam spot size reweighting.
void toTransient()
Cleanse the object after being read in.
std::string toString() const
Convert to a string representation.
bool updateEventFlags(const EventFlagSubDet subDet, const uint32_t flags_in) const
Turn on a set of event flags for one particular sub-detector.
void setDetectorMask0(uint32_t value)
Set the bit field indicating with TTC timezones were present.
bool setEventFlags(EventFlagSubDet subDet, uint32_t flags)
Set the event flags for a particular sub-detector.
EventInfo_v1 & operator=(const EventInfo_v1 &rhs)
Assignment operator.
bool isEventFlagBitSet(EventFlagSubDet subDet, size_t bit) const
Check one particular bit of one particular sub-detector.
void setDetectorMaskExt(uint32_t mask2, uint32_t mask3)
Set the bit fields indicating with TTC timezones were present.
void setSubEvents(const std::vector< SubEvent > &value)
Set the pileup events that were used in the simulation.
void setBeamSpotWeight(float value)
Set weight for beam spot size reweighting.
float averageInteractionsPerCrossing() const
Average interactions per crossing for all BCIDs - for out-of-time pile-up.
void setBeamPos(float x, float y, float z)
Set the beam spot position.
EventFlagErrorState
States that a given sub-detector could be in.
@ Warning
The sub-detector issued a warning.
@ NotSet
The flag was not set to anything.
@ Error
The sub-detector issued an error.
float beamTiltYZ() const
The beam's tilt in radians in YZ.
PileUpMixtureID pileUpMixtureID() const
Unique pile-up mixture identifier.
void setBeamPosSigmaXY(float value)
Set the beam spot shape's X-Y correlation.
float actualInteractionsPerCrossing() const
Average interactions per crossing for the current BCID - for in-time pile-up.
CxxUtils::CachedValue< std::vector< SubEvent > > m_subEvents
Cached sub-event objects.
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
void addSubEvent(const SubEvent &subEvent)
Add one sub-event to the existing list.
void setPileUpMixtureID(const PileUpMixtureID &value)
Set unique pile-up mixture identifier.
void setDetectorMask2(uint32_t value)
Set the bit field indicating with TTC timezones were present.
void setBeamStatus(uint32_t value)
Set the beam spot's status word.
uint32_t eventFlags(EventFlagSubDet subDet) const
Get the event flags for a particular sub-detector.
uint64_t detectorMaskExt() const
Bit field indicating which TTC zones are present in the event.
const std::vector< SubEvent > & subEvents() const
Get the pileup events that were used in the simulation.
const std::vector< StreamTag > & streamTags() const
Get the streams that the event was put in.
void setDetectorMask3(uint32_t value)
Set the bit field indicating with TTC timezones were present.
EventInfo_v1()
Default constructor.
void setEvtStore(StoreGateSvc *svc)
Set the pointer to the event store associated with this event.
float beamPosSigmaX() const
The width of the beam spot in the X direction.
uint32_t detectorMask0() const
Bit field indicating which TTC zones are present in the event.
PileUpType
Enumerator describing the types of pileup events.
@ HaloGas
Halo-gas non-collision background.
@ HighPtMinimumBias
High pT Minimum bias pileup event.
@ MinimumBias
(Low pT) Minimum bias pileup event
@ ZeroBias
Zero bias pileup event.
@ Signal
The signal event.
@ Cavern
Cavern background pileup event.
@ Unknown
Type not known/specified.
void setBeamTiltXZ(float value)
Set the beam's tilt in radians in XZ.
float beamPosZ() const
Z coordinate of the beam spot position.
uint64_t pileUpMixtureIDHighBits() const
Unique pile-up mixture identifier high bits.
bool updateErrorState(const EventFlagSubDet subDet, const EventFlagErrorState state) const
Update the error state for one particular sub-detector.
uint32_t runNumber() const
The current event's run number.
bool hasBeamSpotWeight() const
Check if weight for beam spot size reweighting exists.
void setPileUpMixtureIDHighBits(uint64_t value)
Set unique pile-up mixture identifier high bits.
uint32_t detectorMask2() const
Bit field indicating which TTC zones are present in the event.
uint32_t timeStampNSOffset() const
Nanosecond time offset wrt. the time stamp.
EventFlagErrorState errorState(EventFlagSubDet subDet) const
Get the error state for a particular sub-detector.
uint64_t eventNumber() const
The current event's event number.
float beamPosSigmaZ() const
The length of the beam spot in the Z direction.
float beamPosY() const
Y coordinate of the beam spot position.
float mcEventWeight(size_t i=0) const
The weight of one specific MC event used in the simulation.
bool setEventFlagBit(EventFlagSubDet subDet, size_t bit) const
Set one particular bit of one particular sub-detector.
uint64_t detectorMask() const
Bit field indicating which TTC zones are present in the event.
static PileUpType PileUpInt2Type(unsigned short typ)
Convert int to PileUpType enum value.
void setPileUpMixtureIDLowBits(uint64_t value)
Set unique pile-up mixture identifier low bits.
void setActualInteractionsPerCrossing(float value)
Set average interactions per crossing for the current BCID.
std::vector< std::string > tags
IProxyDict * proxyDictFromEventContext()
Return the IProxyDict for this thread's current context.
static const SG::Accessor< uint64_t > accMcEvNum("mcEventNumber")
void pileupUnsetHook()
Function that would be possible to use to debug what client is trying to access pileup values from an...
static const SG::Accessor< uint64_t > accHigh("pileUpMixtureIDHighBits")
static const SG::Accessor< uint64_t > accEvNum("eventNumber")
static const SG::Accessor< uint64_t > accLow("pileUpMixtureIDLowBits")
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
const SG::AtomicDecorator< uint32_t > * eventFlagsAccessorsV1(EventInfo_v1::EventFlagSubDet subDet)
Helper function for accessing event flag variables.
static const EventInfo_v1::Accessor< std::vector< std::set< uint32_t > > > detsets("streamTagDets")
static const EventInfo_v1::Accessor< std::vector< std::set< uint32_t > > > robsets("streamTagRobs")
static const EventInfo_v1::Accessor< std::vector< char > > olb("streamTagObeysLumiblock")
static const SG::Accessor< std::vector< uint16_t > > typeAcc("subEventType")
static const uint32_t EF_ERROR_SHIFT
Shift used to store the sub-detector error states.
setMCChannelNumber mcEventWeights
static const SG::Accessor< std::vector< uint16_t > > indexAcc("subEventIndex")
static const SG::Accessor< float > accActualInteractionsPerCrossing("actualInteractionsPerCrossing")
Accessor for "actualInteractionsPerCrossing".
static const SG::Accessor< std::vector< std::string > > names("thrNames")
Accessor for the names of the passed thresholds.
static const uint32_t EF_BITS
Bits that store the "user defined" detector flags.
bool operator==(const xAOD::EventInfo_v1::PileUpMixtureID &a, const xAOD::EventInfo_v1::PileUpMixtureID &b)
This operator is provided to make it convenient to compare two instances of PileUpMixtureID directly.
static const EventInfo_v1::Accessor< std::vector< std::string > > types("streamTagTypes")
setBeamTiltXZ static setBeamStatus const SG::Accessor< float > accBeamSpotWeight("beamSpotWeight")
Accessor for "BeamSpotWeight".
setScaleOne setStatusOne setSaturated int16_t
static const SG::Accessor< std::vector< ElementLink< EventInfoContainer_v1 > > > linkAcc("subEventLink")
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
static const SG::Accessor< std::vector< int16_t > > timeAcc("subEventTime")
setEventNumber setTimeStamp setBCID setDetectorMask1 detectorMask3
static const uint32_t EF_ERROR_BITS
Bits that store the error state of the sub-detectors.
setEventNumber setTimeStamp bcid
std::ostream & operator<<(std::ostream &out, const std::pair< FIRST, SECOND > &pair)
Helper print operator.
JetConstituentVector::iterator iterator
static const SG::Accessor< float > accAverageInteractionsPerCrossing("averageInteractionsPerCrossing")
Accessor for "averageInteractionsPerCrossing".
AUXSTORE_OBJECT_SETTER_AND_GETTER(CaloRings_v1, RingSetLinks, ringSetLinks, setRingSetLinks) unsigned CaloRings_v1
setEventNumber setTimeStamp setBCID detectorMask1
const SG::AtomicConstAccessor< uint32_t > * eventFlagsConstAccessorsV1(EventInfo_v1::EventFlagSubDet subDet)
Helper function for accessing event flag variables, for const access.
static const SG::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.
Some out-of-line helpers for ExtendedEventContext.
Emit stall instruction for use in a spin loop.
Unique pile-up mixture identifier definition.