|
ATLAS Offline Software
|
Go to the documentation of this file.
21 #ifndef XAOD_STANDALONE
29 template<
typename T >
30 std::ostream&
operator<<( std::ostream&
out,
const std::set< T >&
s );
33 template<
typename T >
37 for(
size_t i = 0;
i <
vec.size(); ++
i ) {
39 if(
i != (
vec.size() - 1 ) ) {
48 template<
typename T >
51 return out << std::vector< T >(
begin(
s ),
end(
s ) );
58 static std::atomic< bool > uninitPileupAccessPrinted =
false;
59 if( ! uninitPileupAccessPrinted ) {
60 std::cout <<
"xAOD::EventInfo WARNING Uninitialised pileup value was "
62 " Debug it by breaking on "
63 "xAODEventInfoPrivate::pileupUnsetHook function calls!"
65 uninitPileupAccessPrinted =
true;
80 using xAODEventInfoPrivate::operator<<;
83 :
SG::AuxElement(), m_streamTags(),
84 m_subEvents(), m_evtStore( nullptr ) {
89 :
SG::AuxElement(
parent), m_streamTags(),
91 m_evtStore(
parent.m_evtStore ) {
131 setTimeStampNSOffset )
135 detectorMask0, setDetectorMask0 )
139 detectorMask2, setDetectorMask2 )
195 detDescrTags, setDetDescrTags )
199 mcEventNumber, setMCEventNumber )
210 eventTypeBitmask, setEventTypeBitmask )
226 statusElement, setStatusElement )
228 extendedLevel1ID, setExtendedLevel1ID )
231 setLevel1TriggerType )
234 const std::string&
type,
236 const std::set< uint32_t >&
robs,
237 const std::set< uint32_t >&
dets )
238 : m_name(
name ),
m_type(
type ), m_obeysLumiblock( obeysLumiblock ),
253 bool EventInfo_v1::StreamTag::obeysLumiblock()
const {
255 return m_obeysLumiblock;
272 names(
"streamTagNames" );
274 types(
"streamTagTypes" );
276 olb(
"streamTagObeysLumiblock" );
278 robsets(
"streamTagRobs" );
280 detsets(
"streamTagDets" );
282 const std::vector< EventInfo_v1::StreamTag >&
283 EventInfo_v1::streamTags()
const {
286 if( !m_streamTags.isValid() ) {
287 std::vector< StreamTag >
tags;
290 if( ( names( *this ).size() != types( *this ).size() ) ||
291 ( names( *this ).size() != olb( *this ).size() ) ||
292 ( robsets.isAvailable( *
this ) &&
293 ( names( *this ).size() != robsets( *this ).size() ) ) ||
294 ( detsets.isAvailable( *
this ) &&
295 ( names( *this ).size() != detsets( *this ).size() ) ) ) {
296 std::cerr <<
"<xAOD::EventInfo_v1::streamTags> ERROR "
297 <<
"Corrupt information found!" << std::endl;
298 std::cerr <<
" streamTagNames = " << names( *
this )
300 std::cerr <<
" streamTagTypes = " << types( *
this )
302 std::cerr <<
" streamTagObeysLumiblock = " << olb( *
this )
304 std::cerr <<
" streamTagRobs = ";
305 if( robsets.isAvailable( *
this ) ) {
306 std::cerr <<
"N/A" << std::endl;
308 std::cerr << robsets( *
this ) << std::endl;
310 std::cerr <<
" streamTagDets = ";
311 if( detsets.isAvailable( *
this ) ) {
312 std::cerr <<
"N/A" << std::endl;
314 std::cerr << detsets( *
this ) << std::endl;
320 for(
size_t i = 0;
i < names( *this ).size(); ++
i ) {
321 static const std::set< uint32_t > dummySet;
322 tags.emplace_back( names( *
this )[
i ],
325 ( robsets.isAvailable( *
this ) ?
326 robsets( *
this )[
i ] :
328 ( detsets.isAvailable( *
this ) ?
329 detsets( *
this )[
i ] :
335 m_streamTags.set (std::move (
tags));
339 return *m_streamTags.ptr();
342 void EventInfo_v1::setStreamTags(
const std::vector< StreamTag >&
value ) {
345 m_streamTags.store (
value);
348 names( *this ).clear(); types( *this ).clear(); olb( *this ).clear();
349 robsets( *this ).clear(); detsets( *this ).clear();
352 std::vector< StreamTag >::const_iterator itr =
value.begin();
353 std::vector< StreamTag >::const_iterator
end =
value.end();
354 for( ; itr !=
end; ++itr ) {
355 names( *this ).push_back( itr->name() );
356 types( *this ).push_back( itr->type() );
357 olb( *this ).push_back( itr->obeysLumiblock() );
358 robsets( *this ).push_back( itr->robs() );
359 detsets( *this ).push_back( itr->dets() );
375 accActualInteractionsPerCrossing(
"actualInteractionsPerCrossing" );
378 accAverageInteractionsPerCrossing(
"averageInteractionsPerCrossing" );
380 float EventInfo_v1::actualInteractionsPerCrossing()
const {
384 if( ! accActualInteractionsPerCrossing.isAvailable( *
this ) ) {
388 return accActualInteractionsPerCrossing( *
this );
391 void EventInfo_v1::setActualInteractionsPerCrossing(
float value ) {
393 accActualInteractionsPerCrossing( *
this ) =
value;
397 float EventInfo_v1::averageInteractionsPerCrossing()
const {
401 if( ! accAverageInteractionsPerCrossing.isAvailable( *
this ) ) {
405 return accAverageInteractionsPerCrossing( *
this );
408 void EventInfo_v1::setAverageInteractionsPerCrossing(
float value ) {
410 accAverageInteractionsPerCrossing( *
this ) =
value;
415 pileUpMixtureIDLowBits,
416 setPileUpMixtureIDLowBits )
419 setPileUpMixtureIDHighBits )
426 if ( xAODEventInfoPrivate::accLow.
isAvailable( *
this )
427 && xAODEventInfoPrivate::accHigh.
isAvailable( *
this ) ) {
428 id.
lowBits = pileUpMixtureIDLowBits();
438 setPileUpMixtureIDLowBits(
value.lowBits );
439 setPileUpMixtureIDHighBits(
value.highBits );
472 static const std::string
name =
"Signal";
475 static const std::string
name =
"MinimumBias";
478 static const std::string
name =
"Cavern";
481 static const std::string
name =
"HaloGas";
484 static const std::string
name =
"HighPtMinimumBias";
487 static const std::string
name =
"ZeroBias";
490 static const std::string
name =
"Unknown";
503 if( m_link.isValid() ) {
514 timeAcc(
"subEventTime" );
516 indexAcc(
"subEventIndex" );
518 linkAcc(
"subEventLink" );
520 typeAcc(
"subEventType" );
522 std::vector< EventInfo_v1::SubEvent >
528 if( ( ! timeAcc.isAvailable( *
this ) ) &&
529 ( ! indexAcc.isAvailable( *
this ) ) &&
530 ( ! linkAcc.isAvailable( *
this ) ) &&
531 ( ! typeAcc.isAvailable( *
this ) ) )
538 if( timeAcc.isAvailable( *
this ) ) {
539 size = timeAcc( *this ).size();
540 }
else if( indexAcc.isAvailable( *
this ) ) {
541 size = indexAcc( *this ).size();
542 }
else if( linkAcc.isAvailable( *
this ) ) {
543 size = linkAcc( *this ).size();
544 }
else if( typeAcc.isAvailable( *
this ) ) {
545 size = typeAcc( *this ).size();
547 std::cerr <<
"xAOD::EventInfo_v1 ERROR Logic error in subEvents()"
551 if( ( timeAcc.isAvailable( *
this ) &&
552 (
size != timeAcc( *this ).size() ) ) ||
553 ( indexAcc.isAvailable( *
this ) &&
554 (
size != indexAcc( *this ).size() ) ) ||
555 ( linkAcc.isAvailable( *
this ) &&
556 (
size != linkAcc( *this ).size() ) ) ||
557 ( typeAcc.isAvailable( *
this ) &&
558 (
size != typeAcc( *this ).size() ) ) ) {
559 std::cerr <<
"xAOD::EventInfo_v1 ERROR Data corruption found in "
560 <<
"the sub-event information" << std::endl;
561 std::cerr <<
"subEventTime = "
562 << ( timeAcc.isAvailable( *
this ) ? timeAcc( *
this ) :
563 std::vector< int16_t >() ) << std::endl;
564 std::cerr <<
"subEventIndex = "
565 << ( indexAcc.isAvailable( *
this ) ? indexAcc( *
this ) :
566 std::vector< uint16_t >() ) << std::endl;
567 std::cerr <<
"subEventLink = "
568 << ( linkAcc.isAvailable( *
this ) ? linkAcc( *
this ) :
569 std::vector< ElementLink< EventInfoContainer_v1 > >() )
571 std::cerr <<
"subEventType = "
572 << ( typeAcc.isAvailable( *
this ) ? typeAcc( *
this ) :
573 std::vector< uint16_t >() ) << std::endl;
577 for(
size_t i = 0;
i <
size; ++
i ) {
579 timeAcc.isAvailable( *
this ) ? timeAcc( *
this )[
i ] : 0;
581 indexAcc.isAvailable( *
this ) ? indexAcc( *
this )[
i ] : 0;
583 linkAcc.isAvailable( *
this ) ? linkAcc( *
this )[
i ] :
586 ( typeAcc.isAvailable( *
this ) ?
587 static_cast< PileUpType >( typeAcc( *
this )[
i ] ) :
595 const std::vector< EventInfo_v1::SubEvent >&
613 timeAcc( *this ).clear(); indexAcc( *this ).clear();
614 typeAcc( *this ).clear(); linkAcc( *this ).clear();
617 std::vector< SubEvent >::const_iterator itr =
value.begin();
618 std::vector< SubEvent >::const_iterator
end =
value.end();
619 for( ; itr !=
end; ++itr ) {
620 timeAcc( *this ).push_back( itr->time() );
621 indexAcc( *this ).push_back( itr->index() );
622 typeAcc( *this ).push_back(
static_cast< uint16_t >( itr->type() ) );
623 linkAcc( *this ).push_back( itr->link() );
639 timeAcc( *this ).push_back( subEvent.
time() );
640 indexAcc( *this ).push_back( subEvent.
index() );
641 typeAcc( *this ).push_back(
static_cast< uint16_t >( subEvent.
type() ) );
642 linkAcc( *this ).push_back( subEvent.
link() );
652 timeAcc( *this ).clear(); indexAcc( *this ).clear();
653 typeAcc( *this ).clear(); linkAcc( *this ).clear();
667 int t = (typ==
Unknown)? 0: (
int)typ+1;
677 int t = (typ==99)? 0: (
int)typ+1;
691 static const uint32_t EF_BITS = 0x0FFFFFFF;
693 static const uint32_t EF_ERROR_BITS = 0xF0000000;
695 static const uint32_t EF_ERROR_SHIFT = 28;
707 if( bit >= EF_ERROR_SHIFT ) {
708 throw std::runtime_error(
"EventInfo_v1::isEventFlagBitSet: Asked for "
709 "non-existent bit" );
716 return ( (
value >> bit ) & 0x1 );
729 std::atomic<uint32_t>&
a = (*acc)(*this);
732 while (!
a.compare_exchange_strong (orig,
value)) {
734 value = ( ( orig & EF_ERROR_BITS ) | (
flags & EF_BITS ) );
749 if( bit >= EF_ERROR_SHIFT ) {
755 if (existingFlags & (1
u << bit)) {
766 ( *acc )( *this ) |= ( 1
u << bit );
781 if( bit >= EF_ERROR_SHIFT ) {
786 ( *acc )( *this ) &= ~( 1
u << bit );
799 if ((existingFlags |
flags) == existingFlags) {
810 ( *acc )( *this ) |= (
flags & EF_BITS );
840 std::atomic<uint32_t>&
a = (*acc)(*this);
843 (
static_cast< uint32_t >( state ) <<
845 while (!
a.compare_exchange_strong (orig,
value)) {
847 value = ( ( orig & EF_BITS ) |
848 (
static_cast< uint32_t >( state ) <<
877 std::atomic<uint32_t>&
a = (*acc)(*this);
881 if (state < ((orig >> EF_ERROR_SHIFT) & 0xf)) {
886 (
static_cast< uint32_t >( state ) <<
888 while (!
a.compare_exchange_strong (orig,
value)) {
889 if (state < ((orig >> EF_ERROR_SHIFT) & 0xf)) {
893 value = ( ( orig & EF_BITS ) |
894 (
static_cast< uint32_t >( state ) <<
967 return accBeamSpotWeight.isAvailable( *
this );
973 return accBeamSpotWeight( *
this );
977 accBeamSpotWeight( *
this ) =
value;
999 if( linkAcc.isAvailableWritable( *
this ) ) {
1001 std::vector< ElementLink< EventInfoContainer_v1 > >
::iterator
1002 el_itr = linkAcc( *this ).begin();
1003 std::vector< ElementLink< EventInfoContainer_v1 > >
::iterator
1004 el_end = linkAcc( *this ).end();
1005 for( ; el_itr != el_end; ++el_itr ) {
1006 el_itr->toPersistent();
1022 #ifdef XAOD_STANDALONE
1058 const char fillChar =
out.fill();
1059 const std::ios_base::fmtflags
flags =
out.flags();
1060 const std::streamsize
width =
out.width();
1063 out <<
"[Run,Evt,Lumi,Time,BunchCross,DetMask] = ["
1070 <<
",0x" << std::hex << std::setw( 16 ) << std::setfill(
'0' )
1075 out.fill( fillChar );
1094 const char fillChar =
out.fill();
1095 const std::ios_base::fmtflags
flags =
out.flags();
1096 const std::streamsize
width =
out.width();
1099 out << std::hex << std::setw( 16 ) << std::setfill(
'0' );
1104 out.fill( fillChar );
1123 return a.lowBits ==
b.lowBits &&
a.highBits ==
b.highBits;
EventInfo_v1 & operator=(const EventInfo_v1 &rhs)
Assignment operator.
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
uint32_t detectorMask3() const
Bit field indicating which TTC zones are present in the event.
void setSubEvents(const std::vector< SubEvent > &value)
Set the pileup events that were used in the simulation.
std::vector< std::pair< std::string, std::string > > DetDescrTags_t
Type of the detector description tags.
const std::string & typeName() const
The string name of the type.
EventInfo_v1()
Default constructor.
Unique pile-up mixture identifier definition.
uint64_t eventNumber() const
The current event's event number.
float beamTiltXZ() const
The beam's tilt in radians in XZ.
void setDetectorMask3(uint32_t value)
Set the bit field indicating with TTC timezones were present.
Helper class to provide type-safe access to aux data.
void toPersistent()
Prepare the object for writing.
uint64_t detectorMaskExt() const
Bit field indicating which TTC zones are present in the event.
@ HighPtMinimumBias
High pT Minimum bias pileup event.
This class represents the "type of event" where the type is given by one or more "characteristics".
@ MinimumBias
(Low pT) Minimum bias pileup event
std::ostream & operator<<(std::ostream &out, const std::set< T > &s)
Convenience operator for printing the contents of sets.
bool updateEventFlagBit(const EventFlagSubDet subDet, const size_t bit) const
Change detector flags with update semantics.
void clearSubEvents()
Clear all the currently held sub-events.
void setBeamPos(float x, float y, float z)
Set the beam spot position.
float beamTiltYZ() const
The beam's tilt in radians in YZ.
const SG::AtomicDecorator< uint32_t > * eventFlagsAccessorsV1(EventInfo_v1::EventFlagSubDet subDet)
Helper function for accessing event flag variables.
PileUpType
Enumerator describing the types of pileup events.
uint32_t eventTypeBitmask() const
The event type bitmask.
float beamPosSigmaX() const
The width of the beam spot in the X direction.
const ElementLink< EventInfoContainer_v1 > & link() const
Get a link to the EventInfo object describing the pileup event.
bool usingStandaloneStore() const
Test to see if this object is currently using a standalone store.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
static IProxyDict * store()
Fetch the current store.
@ NotSet
The flag was not set to anything.
@ ZeroBias
Zero bias pileup event.
setEventNumber setTimeStamp setBCID detectorMask1
std::vector< size_t > vec
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 EventInfo_v1 * ptr() const
Get a pointer to the EventInfo object describing the pileup event.
void setBeamPosSigma(float x, float y, float z)
Set the size of the beam spot.
bool const RAWDATA *ch2 const
uint32_t timeStampNSOffset() const
Nanosecond time offset wrt. the time stamp.
std::vector< EventInfo_v1::SubEvent > makeSubEvents() const
const SG::AtomicConstAccessor< uint32_t > * eventFlagsConstAccessorsV1(EventInfo_v1::EventFlagSubDet subDet)
Helper function for accessing event flag variables, for const access.
bool updateEventFlags(const EventFlagSubDet subDet, const uint32_t flags_in) const
Turn on a set of event flags for one particular sub-detector.
setScaleOne setStatusOne setSaturated int16_t
float beamPosX() const
X coordinate of the beam spot position.
@ u
Enums for curvilinear frames.
uint32_t runNumber() const
The current event's run number.
SG::Accessor< T, ALLOC > Accessor
bool isAvailable(const T_Aux &cont, SG::auxid_t auxid)
@ Error
The sub-detector issued an error.
int16_t time() const
Get the time wrt. the signal event (which has time() == 0)
void setBeamTiltYZ(float value)
Set the beam's tilt in radians in YZ.
void setBeamStatus(uint32_t value)
Set the beam spot's status word.
uint32_t beamStatus() const
The beam spot's status word.
bool setEventFlags(EventFlagSubDet subDet, uint32_t flags)
Set the event flags for a particular sub-detector.
bool hasBeamSpotWeight() const
Check if weight for beam spot size reweighting exists.
bool setEventFlagBit(EventFlagSubDet subDet, size_t bit) const
Set one particular bit of one particular sub-detector.
float beamPosY() const
Y coordinate of the beam spot position.
The Athena Transient Store API.
std::vector< std::string > tags
uint32_t detectorMask2() const
Bit field indicating which TTC zones are present in the event.
bool setErrorState(EventFlagSubDet subDet, EventFlagErrorState state)
Set the error state for a particular sub-detector.
void stall()
Emit stall instruction for use in a spin loop.
Access an auxiliary variable atomically.
void setStore(const SG::IConstAuxStore *store)
Set the store associated with this object.
void setDetectorMask(uint32_t mask0, uint32_t mask1)
Set the bit fields indicating with TTC timezones were present.
@ Unknown
Type not known/specified.
AuxElement()
Default constructor.
void setDetectorMask0(uint32_t value)
Set the bit field indicating with TTC timezones were present.
@ HaloGas
Halo-gas non-collision background.
float beamPosSigmaZ() const
The length of the beam spot in the Z direction.
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(xAOD::PixelCluster_v1, float, widthInEta, setWidthInEta) void xAOD
AthROOTErrorHandlerSvc * svc
uint16_t index() const
Get the index of the sub-event.
uint64_t detectorMask() const
Bit field indicating which TTC zones are present in the event.
void setBeamSpotWeight(float value)
Set weight for beam spot size reweighting.
uint32_t lumiBlock() const
The current event's luminosity block number.
EventFlagErrorState
States that a given sub-detector could be in.
void setBeamPosSigmaXY(float value)
Set the beam spot shape's X-Y correlation.
Emit stall instruction for use in a spin loop.
void toTransient()
Cleanse the object after being read in.
void setDetectorMask2(uint32_t value)
Set the bit field indicating with TTC timezones were present.
float beamPosSigmaY() const
The width of the beam spot in the Y direction.
ElementLink implementation for ROOT usage.
void addSubEvent(const SubEvent &subEvent)
Add one sub-event to the existing list.
float beamPosZ() const
Z coordinate of the beam spot position.
void setDetectorMaskExt(uint32_t mask2, uint32_t mask3)
Set the bit fields indicating with TTC timezones were present.
EventFlagSubDet
Sub-detector types for which we store event-level flags.
For details on how the MC particles are defined and organized see https://twiki.cern....
setEventNumber setTimeStamp bcid
void makePrivateStore()
Create a new (empty) private store for this object.
AuxElement & operator=(const AuxElement &other)
Assignment.
def setLumiBlock(rob, lb)
Class describing the basic event information.
Interface for non-const operations on an auxiliary store.
StoreGateSvc * m_evtStore
Transient pointer to the StoreGateSvc instance associated with the event (Needed for pile-up digitisa...
static PileUpType PileUpInt2Type(unsigned short typ)
Convert int to PileUpType enum value.
@ Signal
The signal event.
uint32_t eventFlags(EventFlagSubDet subDet) const
Get the event flags for a particular sub-detector.
@ Warning
The sub-detector issued a warning.
bool resetEventFlagBit(EventFlagSubDet subDet, size_t bit)
Reset one particular bit of one particular sub-detector.
float beamPosSigmaXY() const
The beam spot shape's X-Y correlation.
CxxUtils::CachedValue< std::vector< StreamTag > > m_streamTags
Cached stream tag objects.
def time(flags, cells_name, *args, **kw)
size_t m_index
The index of this element within its container.
PileUpType type() const
Get the type of the pileup event.
void setBeamTiltXZ(float value)
Set the beam's tilt in radians in XZ.
@ Cavern
Cavern background pileup event.
#define AUXSTORE_PRIMITIVE_GETTER(CL, TYPE, NAME)
Macro creating the reader function for a primitive auxiliary property.
EventFlagErrorState errorState(EventFlagSubDet subDet) const
Get the error state for a particular sub-detector.
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
bool isEventFlagBitSet(EventFlagSubDet subDet, size_t bit) const
Check one particular bit of one particular sub-detector.
bool updateErrorState(const EventFlagSubDet subDet, const EventFlagErrorState state) const
Update the error state for one particular sub-detector.
setEventNumber setTimeStamp setBCID setDetectorMask1 detectorMask3
static const std::string & PileUpType2Name(PileUpType typ)
Convert PileUpType enum value to string.
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.
CxxUtils::CachedValue< std::vector< SubEvent > > m_subEvents
Cached sub-event objects.
void setDetectorMask1(uint32_t value)
Set the bit field indicating with TTC timezones were present.
const std::vector< SubEvent > & subEvents() const
Get the pileup events that were used in the simulation.
Access an auxiliary variable atomically.
uint32_t bcid() const
The bunch crossing ID of the event.
xAOD::EventInfo::SubEvent SubEvent
setMCChannelNumber mcEventWeights
float beamSpotWeight() const
Weight for beam spot size reweighting.
void pileupUnsetHook()
Function that would be possible to use to debug what client is trying to access pileup values from an...
Class describing the properties of one pileup sub-event.
std::ostream & operator<<(std::ostream &out, const std::pair< FIRST, SECOND > &pair)
Helper print operator.
bool eventType(EventType type) const
Check for one particular bitmask value.
AUXSTORE_OBJECT_SETTER_AND_GETTER(CaloRings_v1, RingSetLinks, ringSetLinks, setRingSetLinks) unsigned CaloRings_v1