124{
125 ByteStreamAddress* pRE_Addr{};
126 ATH_CHECK( (pRE_Addr =
dynamic_cast<ByteStreamAddress*
>(pAddr)) !=
nullptr );
127
130
131
135 return StatusCode::FAILURE;
136 }
137
138
140
141
143 if (
re->version() < 0x03010000) {
145 } else {
147 }
148
149
151 uint32_t bc_time_ns =
re->bc_time_nanoseconds();
152
153 if (bc_time_ns > 1000000000) {
154 if (runNumber < 20920) {
155
157 bc_time_ns = bc_time_sec;
158 bc_time_sec= temp;
159 ATH_MSG_DEBUG(
"bc_time second/nanosecond swapped, sec/ns = " << bc_time_sec <<
" " << bc_time_ns);
160 }
161 else {
162
163 ATH_MSG_WARNING(
"bc_time nanosecond number larger than 1e9, it is " << bc_time_ns <<
", reset it to 1 sec");
164 bc_time_ns = 1000000000;
165 }
166 }
167
168
170
171
173
174 unsigned int detMask0 = 0xFFFFFFFF, detMask1 = 0xFFFFFFFF, detMask2 = 0xFFFFFFFF, detMask3 = 0xFFFFFFFF;
175
178 if (!
status.isSuccess()) {
180 }
181 else {
182 const ByteStreamMetadata*
metadata = *(metadatacont->
begin());
184 detMask0 = (
unsigned int)(detectorMask & 0x00000000FFFFFFFF);
185 detMask1 = (
unsigned int)(detectorMask >> 32);
187 detMask2 = (
unsigned int)(detectorMask2 & 0x00000000FFFFFFFF);
188 detMask3 = (
unsigned int)(detectorMask2 >> 32);
189 }
190
191
194 evtInfo.setStore(pEvtInfoAux);
195
204
205
209
210
214 }
217 }
220 }
222
223
224 bool mcEventInfoDecoded = false;
226
228 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> mcRobFragments;
229 m_robDataProvider->getROBData(ctx, mcRobIds, mcRobFragments,
"EventInfoByteStreamAuxCnv");
230
231 if (!mcRobFragments.empty()) {
232 ATH_MSG_DEBUG(
"Found MC EventInfo ROB fragment, decoding...");
234 if (
sc.isFailure()) {
235 ATH_MSG_WARNING(
"Failed to decode MC EventInfo from ROB fragment, using default values");
236 } else {
237 ATH_MSG_DEBUG(
"Successfully decoded MC EventInfo from ROB fragment");
238 mcEventInfoDecoded = true;
239 }
240 } else {
241 ATH_MSG_DEBUG(
"No MC EventInfo ROB fragment found, using default values");
242 }
243 }
244
245
247
250
251
253
254
255 uint32_t level1TriggerType =
re->lvl1_trigger_type();
256
257
258 std::vector<xAOD::EventInfo::StreamTag> streamTags;
259 std::vector<eformat::helper::StreamTag> onl_streamTags;
260 re->stream_tag(buffer);
261 eformat::helper::decode(
re->nstream_tag(), buffer, onl_streamTags);
262 for (const eformat::helper::StreamTag& onl_streamTag : onl_streamTags) {
263 std::set<uint32_t> tmp_off_dets = std::set<uint32_t>();
264 if (!onl_streamTag.dets.empty()) {
265 std::set<eformat::SubDetector> tmp_onl_dets = onl_streamTag.dets;
266 for (const eformat::SubDetector& subdet : tmp_onl_dets) {
267 tmp_off_dets.insert((uint32_t) subdet);
268 }
269 }
270 streamTags.push_back(xAOD::EventInfo::StreamTag(onl_streamTag.name
271 , onl_streamTag.type
272 , onl_streamTag.obeys_lumiblock
273 , onl_streamTag.robs
274 , tmp_off_dets)
275 );
276 }
277
279
280
281 if (!mcEventInfoDecoded) {
283 }
286
287
290
291 ATH_MSG_DEBUG(
" New xAOD::EventAuxInfo made, run/event= " << runNumber
292 << " " << eventNumber
293 <<
" Time stamp = " <<
ascTime(bc_time_sec)
294 );
295
296 return StatusCode::SUCCESS;
297}
const boost::regex re(r_e)
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
ByteStreamMetadataContainer
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
const EventContext & getEventContext() const
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
std::string ascTime(unsigned int t)
convert timestamp to ascii time.
ToolHandle< IMCEventInfoByteStreamTool > m_mcEventInfoTool
Tool for decoding MC EventInfo from ROB.
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.
@ Core
Core flags describing the event.
void setStreamTags(const std::vector< StreamTag > &value)
Set the streams that the event was put in.
void setTimeStamp(uint32_t value)
Set the POSIX time of the event.
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 setEventTypeBitmask(uint32_t value)
Set the event type bitmask.
void setMCChannelNumber(uint32_t value)
Set the MC generator's channel number.
void setExtendedLevel1ID(uint32_t value)
Set the extended Level-1 identifier.
void setMCEventWeights(const std::vector< float > &value)
Set the weights of all the MC events used in the simulation.
void setRunNumber(uint32_t value)
Set the current event's run number.
@ 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.
::StatusCode StatusCode
StatusCode definition for legacy code.
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
EventInfo_v1 EventInfo
Definition of the latest event info version.
EventAuxInfo_v3 EventAuxInfo
Definition of the latest event auxiliary info version.