9#include "EventInfo/EventInfo.h"
39 static const std::map< EventInfo::EventFlagErrorState,
46#if !defined(XAOD_ANALYSIS) && !defined(GENERATIONBASE)
53 const std::string& name,
54 const IInterface* parent )
58 declareInterface< IEventInfoCnvTool >(
this );
64#if !defined(XAOD_ANALYSIS) && !defined(GENERATIONBASE)
71 ATH_MSG_INFO(
"Will not fill beam spot information into "
76 ATH_MSG_WARNING(
"Beam spot information manually disabled on EventInfo object" );
83#if !defined(XAOD_ANALYSIS) && !defined(SIMULATIONBASE) && !defined(GENERATIONBASE)
88 return StatusCode::SUCCESS;
106 bool copyPileUpLinks,
107 [[maybe_unused]]
const EventContext& ctx )
const
112 return StatusCode::SUCCESS;
130 std::vector< float > eventWeights;
135 uint32_t eventTypeBitmask = 0;
151 for(
unsigned int i = 0; i < aod->
event_type()->n_mc_event_weights();
163 std::vector< xAOD::EventInfo::StreamTag > streamTags;
164 std::vector< TriggerInfo::StreamTag >::const_iterator st_itr =
166 std::vector< TriggerInfo::StreamTag >::const_iterator st_end =
168 for( ; st_itr != st_end; ++st_itr ) {
169 streamTags.emplace_back( st_itr->name(), st_itr->type(),
170 st_itr->obeysLumiblock(),
171 st_itr->robs(), st_itr->dets() );
178 bool haveLumi =
false;
179#if !defined(XAOD_ANALYSIS) && !defined(SIMULATIONBASE) && !defined(GENERATIONBASE)
182 if (lumiData->lbAverageLuminosity() != 0 ||
183 lumiData->lbAverageInteractionsPerCrossing() != 0)
185 float actualMu = 0.0;
186 const float muToLumi = lumiData->muToLumi();
187 if( std::abs( muToLumi ) > 0.00001 ) {
188 unsigned int bcid = ctx.eventID().bunch_crossing_id();
189 actualMu = lumiData->lbLuminosityPerBCIDVector().at(bcid) / muToLumi;
193 lumiData->lbAverageInteractionsPerCrossing() );
213 for( ; sd_itr != sd_end; ++sd_itr ) {
216 if( (
int)sd_itr->first == (
int)EventInfo::Lumi ) {
224 std::map< EventInfo::EventFlagErrorState,
229 <<
"Unknown error state found for sub-detector "
230 << sd_itr->second <<
": " << aod->
errorState( sd_itr->second );
231 return StatusCode::FAILURE;
241 if( puei && copyPileUpLinks ) {
243 std::vector< xAOD::EventInfo::SubEvent > subEvents;
244 PileUpEventInfo::SubEvent::const_iterator itr = puei->
beginSubEvt();
245 PileUpEventInfo::SubEvent::const_iterator end = puei->
endSubEvt();
246 for( ; itr != end; ++itr ) {
250 switch (itr->type()) {
273 << itr->type() <<
") encountered" );
282 subEvents.emplace_back( itr->time(),
291#if !defined(XAOD_ANALYSIS) && !defined(GENERATIONBASE)
296 beamSpotHandle->beamPos()[
Amg::y ],
297 beamSpotHandle->beamPos()[
Amg::z ] );
299 beamSpotHandle->beamSigma( 1 ),
300 beamSpotHandle->beamSigma( 2 ) );
308 if (!eventWeights.empty()) {
314 ew (*xaod) = std::move (eventWeights);
318 ATH_MSG_DEBUG(
"Finished conversion EventInfo="<<aod<<
" xAOD::EventInfo="<<xaod<<
" content=" << *xaod );
321 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE(LVL)
Report a message.
#define CHECK(...)
Evaluate an expression and check for errors.
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
This class provides general information about an event.
This class provides information about an overlaid event.
This class contains trigger related information.
const ServiceHandle< StoreGateSvc > & detStore() const
ElementLink implementation for ROOT usage.
void resetWithKeyAndIndex(const ID_type &dataID, index_type elemID, IProxyDict *sg=0)
Set the link to an element given by string key and index.
number_type detector_mask3(void) const
detector mask1 - bit field indicating which TTC zones have been built into the event,...
number_type detector_mask2(void) const
detector mask0 - bit field indicating which TTC zones have been built into the event,...
number_type detector_mask1(void) const
detector mask1 - bit field indicating which TTC zones have been built into the event,...
number_type detector_mask0(void) const
detector mask0 - bit field indicating which TTC zones have been built into the event,...
float actualInteractionsPerCrossing() const
Access to number of interactions per crossing:
EventID * event_ID()
the unique identification of the event.
EventFlagErrorState errorState(EventFlagSubDet subDet) const
return error state for a particular sub-detector
TriggerInfo * trigger_info()
trigger information (ptr may be NULL)
float averageInteractionsPerCrossing() const
average interactions per crossing for all BCIDs - for out-of-time pile-up
unsigned int eventFlags(EventFlagSubDet subDet) const
event flags for a particular sub-detector
EventType * event_type()
the type of the event, e.g. simulation, testbeam, etc
float mc_event_weight(unsigned int iweight=0) const
Access to MC weight.
static const EventTypeCode IS_CALIBRATION
true: IS_CALIBRATION, false: IS_PHYSICS
std::vector< NameTagPair > NameTagPairVec
void get_detdescr_tags(NameTagPairVec &pairs) const
Access DetDescr tags.
number_type mc_channel_number() const
Access to the MC generator channel number (was used as run number for generator events)
static const EventTypeCode IS_SIMULATION
true: IS_SIMULATION, false: IS_DATA
unsigned int n_mc_event_weights() const
Total number of MC weights.
bool test(EventTypeCode type_code) const
Tests for standard characteristics.
uint64_t mc_event_number() const
Access to the MC generator event number.
static const EventTypeCode IS_TESTBEAM
true: IS_TESTBEAM, false: IS_FROM_ATLAS_DET
This class provides information about an overlaid event.
SubEvent::iterator endSubEvt()
SubEvent::iterator beginSubEvt()
SG::IAuxStore * getStore() const
Return the current store, as a non-const interface.
SG::Decorator< T, ALLOC > Decorator
class to provide type-safe access to aux data.
virtual void lock()=0
Lock the container.
number_type level1TriggerType() const
get level1 trigger type
number_type extendedLevel1ID() const
get extended level1 ID
number_type statusElement() const
get status element
const std::vector< StreamTag > & streamTags() const
get stream tags
void setBeamPosSigma(float x, float y, float z)
Set the size of the beam spot.
void setAverageInteractionsPerCrossing(float value)
Set average interactions per crossing for all BCIDs.
void setBCID(uint32_t value)
Set the bunch crossing ID of the event.
void setDetectorMask(uint32_t mask0, uint32_t mask1)
Set the bit fields indicating with TTC timezones were present.
void setTimeStampNSOffset(uint32_t value)
Set the nanosecond offset wrt. the time stamp.
void setMCEventNumber(uint64_t value)
Set the MC generator's event number.
bool eventType(EventType type) const
Check for one particular bitmask value.
EventFlagSubDet
Sub-detector types for which we store event-level flags.
@ Background
The beam background detectors.
@ Tile
The Tile calorimeter.
@ Muon
The muon spectrometer.
@ Core
Core flags describing the event.
@ Pixel
The pixel tracker.
@ ForwardDet
The forward detectors.
@ LAr
The LAr calorimeter.
@ Lumi
The luminosity detectors.
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.
void setTimeStamp(uint32_t value)
Set the POSIX time of the event.
bool setErrorState(EventFlagSubDet subDet, EventFlagErrorState state)
Set the error state for a particular sub-detector.
void setLevel1TriggerType(uint16_t value)
Set the Level-1 trigger type.
bool setEventFlags(EventFlagSubDet subDet, uint32_t flags)
Set the event flags for a particular sub-detector.
void setDetectorMaskExt(uint32_t mask2, uint32_t mask3)
Set the bit fields indicating with TTC timezones were present.
void setEventNumber(uint64_t value)
Set the current event's event number.
void setSubEvents(const std::vector< SubEvent > &value)
Set the pileup events that were used in the simulation.
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.
void setBeamPosSigmaXY(float value)
Set the beam spot shape's X-Y correlation.
void setEventTypeBitmask(uint32_t value)
Set the event type bitmask.
void setBeamStatus(uint32_t value)
Set the beam spot's status word.
void setMCChannelNumber(uint32_t value)
Set the MC generator's channel number.
void setExtendedLevel1ID(uint32_t value)
Set the extended Level-1 identifier.
void setDetDescrTags(const DetDescrTags_t &value)
Set the detector description tags.
void setRunNumber(uint32_t value)
Set the current event's run number.
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.
@ IS_CALIBRATION
true: calibration, false: physics
@ IS_SIMULATION
true: simulation, false: data
@ IS_TESTBEAM
true: testbeam, false: full detector
void setStatusElement(uint32_t value)
Set the trigger status element.
void setLumiBlock(uint32_t value)
Set the current event's luminosity block number.
void setActualInteractionsPerCrossing(float value)
Set average interactions per crossing for the current BCID.
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
static const std::map< xAOD::EventInfo::EventFlagSubDet, EventInfo::EventFlagSubDet > subDetMap
static const std::map< EventInfo::EventFlagErrorState, xAOD::EventInfo::EventFlagErrorState > errorStateMap
static const std::string INDET_BEAMPOS
Hard-coded location of the beam position information.
EventInfo_v1 EventInfo
Definition of the latest event info version.