This is the important function of the tool.
108 {
109
110 if( ! aod ) {
112 return StatusCode::SUCCESS;
113 }
114
115
127 }
128
129
130 std::vector< float > eventWeights;
138 }
141 }
144 }
146
151 for(
unsigned int i = 0;
i < aod->
event_type()->n_mc_event_weights();
154 }
155 }
156 }
157
158
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() );
172 }
174 }
175
176
177 if( ! pileUpInfo ) {
178 bool haveLumi = false;
179#if !defined(XAOD_ANALYSIS) && !defined(SIMULATIONBASE) && !defined(GENERATIONBASE)
181 SG::ReadCondHandle<LuminosityCondData> lumiData (
m_lumiDataKey, ctx);
182 if (lumiData->lbAverageLuminosity() != 0 ||
183 lumiData->lbAverageInteractionsPerCrossing() != 0)
184 {
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;
190 }
193 lumiData->lbAverageInteractionsPerCrossing() );
194 }
195 haveLumi = true;
196 }
197#endif
198 if (!haveLumi) {
203 }
204 }
205
206
213 for( ; sd_itr != sd_end; ++sd_itr ) {
214
215
216 if( (int)sd_itr->first == (int)EventInfo::Lumi ) {
217 continue;
218 }
219
220
222
223
229 << "Unknown error state found for sub-detector "
230 << sd_itr->second <<
": " << aod->
errorState( sd_itr->second );
231 return StatusCode::FAILURE;
232 }
233
234
236 }
237
238
241 if( puei && copyPileUpLinks ) {
242
243 std::vector< xAOD::EventInfo::SubEvent > subEvents;
246 for( ; itr !=
end; ++itr ) {
247
248
250 switch (itr->type()) {
253 break;
256 break;
259 break;
262 break;
265 break;
268 break;
270 break;
271 default:
273 << itr->type() << ") encountered" );
274 break;
275 }
276
277
278 ElementLink< xAOD::EventInfoContainer > link;
280
281
282 subEvents.emplace_back( itr->time(),
283 itr->index(),
284 type, link );
285 }
286
287
289 }
290
291#if !defined(XAOD_ANALYSIS) && !defined(GENERATIONBASE)
292
294 SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle {
m_beamSpotKey, ctx };
296 beamSpotHandle->beamPos()[
Amg::y ],
297 beamSpotHandle->beamPos()[
Amg::z ] );
299 beamSpotHandle->beamSigma( 1 ),
300 beamSpotHandle->beamSigma( 2 ) );
305 }
306#endif
307
308 if (!eventWeights.empty()) {
310
312 }
314 ew (*xaod) = std::move (eventWeights);
315 }
316
317
318 ATH_MSG_DEBUG(
"Finished conversion EventInfo="<<aod<<
" xAOD::EventInfo="<<xaod<<
" content=" << *xaod );
319
320
321 return StatusCode::SUCCESS;
322 }
#define ATH_MSG_WARNING(x)
#define REPORT_MESSAGE(LVL)
Report a message.
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Old PileUpEventInfo
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
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.
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.
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.
static const std::map< xAOD::EventInfo::EventFlagSubDet, EventInfo::EventFlagSubDet > subDetMap
static const std::map< EventInfo::EventFlagErrorState, xAOD::EventInfo::EventFlagErrorState > errorStateMap
setEventNumber setTimeStamp bcid
std::list< SubEvent >::const_iterator const_iterator