165 {
166
167
168
169
170 SG::WriteHandle<xAOD::gFexJetRoIContainer> gRhoContainer(
m_gFexRhoWriteKey, ctx);
171 ATH_CHECK(gRhoContainer.record(std::make_unique<xAOD::gFexJetRoIContainer>(), std::make_unique<xAOD::gFexJetRoIAuxContainer>()));
172 ATH_MSG_DEBUG(
"Recorded gFexJetRoIContainer with key " << gRhoContainer.key());
173
174
176 ATH_CHECK(gSJContainer.record(std::make_unique<xAOD::gFexJetRoIContainer>(), std::make_unique<xAOD::gFexJetRoIAuxContainer>()));
177 ATH_MSG_DEBUG(
"Recorded gFexJetRoIContainer with key " << gSJContainer.key());
178
179
181 ATH_CHECK(gLJContainer.record(std::make_unique<xAOD::gFexJetRoIContainer>(), std::make_unique<xAOD::gFexJetRoIAuxContainer>()));
182 ATH_MSG_DEBUG(
"Recorded gFexJetRoIContainer with key " << gLJContainer.key());
183
184
186 ATH_CHECK(gScalarEJwojContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
187 ATH_MSG_DEBUG(
"Recorded gFexJetGlobalContainer with key " << gScalarEJwojContainer.key());
188
189
190 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gEspressoContainer(
m_gEspressoWriteKey, ctx);
191 ATH_CHECK(gEspressoContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
192 ATH_MSG_DEBUG(
"Recorded gFexJetGlobalContainer with key " << gEspressoContainer.key());
193
194
196 ATH_CHECK(gMETComponentsJwojContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
197 ATH_MSG_DEBUG(
"Recorded gFexJetGlobalContainer with key " << gMETComponentsJwojContainer.key());
198
199
201 ATH_CHECK(gMHTComponentsJwojContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
202 ATH_MSG_DEBUG(
"Recorded gFexJetGlobalContainer with key " << gMHTComponentsJwojContainer.key());
203
204
206 ATH_CHECK(gMSTComponentsJwojContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
207 ATH_MSG_DEBUG(
"Recorded gFexJetGlobalContainer with key " << gMSTComponentsJwojContainer.key());
208
209
211 ATH_CHECK(gMETComponentsNoiseCutContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
212 ATH_MSG_DEBUG(
"Recorded gFexJetGlobalContainer with key " << gMETComponentsNoiseCutContainer.key());
213
214
216 ATH_CHECK(gMETComponentsRmsContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
217 ATH_MSG_DEBUG(
"Recorded gFexJetGlobalContainer with key " << gMETComponentsRmsContainer.key());
218
219
221 ATH_CHECK(gScalarENoiseCutContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
222 ATH_MSG_DEBUG(
"Recorded gFexJetGlobalContainer with key " << gScalarENoiseCutContainer.key());
223
224
226 ATH_CHECK(gScalarERmsContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
227 ATH_MSG_DEBUG(
"Recorded gFexJetGlobalContainer with key " << gScalarERmsContainer.key());
228
229
230
231 for (
const ROBF* rob : vrobf) {
232
233
234
235 ATH_MSG_DEBUG(
"Starting to decode " << rob->rod_ndata() <<
" ROD words from ROB 0x" << std::hex << rob->rob_source_id());
236
237
238 if(rob->rod_ndata() <= 0){
239 continue;
240 }
241
242 const auto dataArray = std::span{rob->rod_data(), rob->rod_ndata()};
243
244
245
246
247 unsigned int n_words = rob->rod_ndata();
248
249
250 for(
unsigned int iWord=0; iWord<
n_words; iWord++) {
251 ATH_MSG_DEBUG(
"Raw word 0x" << std::hex << dataArray[iWord] <<
" " << std::bitset<32> (dataArray[iWord]));
252 }
253
254
255 int global_counter = 0;
256 std::vector<uint32_t> JWOJ_MHT(3, 0);
257 std::vector<uint32_t> JWOJ_MST(3, 0);
258 std::vector<uint32_t> JWOJ_MET(3, 0);
259 std::vector<uint32_t> JWOJ_SCALAR(3, 0);
261 std::vector<uint32_t> NC_MET(3, 0);
262 std::vector<uint32_t> NC_SCALAR(3, 0);
263 std::vector<uint32_t> RMS_MET(3, 0);
264 std::vector<uint32_t> RMS_SCALAR(3, 0);
265
267 while ( index < n_words ) {
273
275 ATH_MSG_DEBUG(
"word "<< std::bitset<32> (dataArray[index]) );
276 ATH_MSG_DEBUG(
"headerWord "<< std::bitset<32> (headerWord) );
278 ATH_MSG_DEBUG(
"headerSize "<< std::bitset<2> (headerSize) );
279 ATH_MSG_DEBUG(
"errorFlags "<< std::bitset<1> (errorFlags) );
281
283 if ( (index + blockSize) > n_words ) {
284
285 std::stringstream sdetail;
286 sdetail <<
"Remaining block size " << (
n_words -
index) <<
" is too small for subblock of type " << blockType <<
" with headerSize " << headerSize <<
" and dataSize " << dataSize ;
287 std::stringstream slocation;
288 slocation <<
"0x"<< std::hex << rob->rob_source_id() << std::dec <<
" type:"<<
blockType;
289 std::stringstream stitle;
290 stitle << "Small subblock size " ;
291 printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str());
292
293 }
294
296
299
301
302 std::stringstream sdetail;
304 std::stringstream slocation;
305 slocation <<
"0x"<< std::hex << rob->rob_source_id()<< std::dec <<
" type:"<<
blockType;
306 std::stringstream stitle;
307 stitle << "Wrong dataSize" ;
308 printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str());
309
310
312 continue;
313
314 }
315
316
317
320
321
322 for (uint32_t sliceNumber = 0; sliceNumber < numSlices; sliceNumber++) {
323 if (sliceNumber == 0){
324 if ( !isJet && !isMet ) {
325
326 std::stringstream sdetail;
327 sdetail <<
"gFexByteStreamTool::decodeGfexTobSlice: Invalid block type " <<
blockType ;
328 std::stringstream slocation;
329 slocation << "0x"<< std::hex << rob->rob_source_id();
330 std::stringstream stitle;
331 stitle << "Invalid block type" ;
332 printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str());
333
334 }
335
337
338 if (isJet) {
339
341 continue;
342 }
343
345 continue;
346 }
347
350 gRhoContainer->push_back(std::move(myEDM));
351 gRhoContainer->back()->initialize(dataArray[index+iWord],
m_gJ_scale);
352 }
353
356 gSJContainer->push_back(std::move(myEDM));
357 gSJContainer->back()->initialize(dataArray[index+iWord],
m_gJ_scale);
358 }
359
362 gLJContainer->push_back(std::move(myEDM));
363 gLJContainer->back()->initialize(dataArray[index+iWord],
m_gLJ_scale);
364 }
365
366 }
367
368 if (isMet){
369
371 continue;
372 }
373
375 continue;
376 }
377
379 global_counter ++;
380 if (blockType == 0x1) {JWOJ_MHT[0] = dataArray[
index+iWord];}
381 if (blockType == 0x2) {JWOJ_MHT[1] = dataArray[
index+iWord];}
382 if (blockType == 0x3) {JWOJ_MHT[2] = dataArray[
index+iWord];}
383 }
384
386 if (blockType == 0x1) {JWOJ_MST[0] = dataArray[
index+iWord];}
387 if (blockType == 0x2) {JWOJ_MST[1] = dataArray[
index+iWord];}
388 if (blockType == 0x3) {JWOJ_MST[2] = dataArray[
index+iWord];}
389 }
390
392 if (blockType == 0x1) {JWOJ_MET[0] = dataArray[
index+iWord];}
393 if (blockType == 0x2) {JWOJ_MET[1] = dataArray[
index+iWord];}
394 if (blockType == 0x3) {JWOJ_MET[2] = dataArray[
index+iWord];}
395 }
396
398 if (blockType == 0x1) {JWOJ_SCALAR[0] = dataArray[
index+iWord];}
399 if (blockType == 0x2) {JWOJ_SCALAR[1] = dataArray[
index+iWord];}
400 if (blockType == 0x3) {JWOJ_SCALAR[2] = dataArray[
index+iWord];}
401 }
402
407 }
408
410 if (blockType == 0x1) {NC_MET[0] = dataArray[
index+iWord];}
411 if (blockType == 0x2) {NC_MET[1] = dataArray[
index+iWord];}
412 if (blockType == 0x3) {NC_MET[2] = dataArray[
index+iWord];}
413 }
414
416 if (blockType == 0x1) {NC_SCALAR[0] = dataArray[
index+iWord];}
417 if (blockType == 0x2) {NC_SCALAR[1] = dataArray[
index+iWord];}
418 if (blockType == 0x3) {NC_SCALAR[2] = dataArray[
index+iWord];}
419 }
420
422 if (blockType == 0x1) {RMS_MET[0] = dataArray[
index+iWord];}
423 if (blockType == 0x2) {RMS_MET[1] = dataArray[
index+iWord];}
424 if (blockType == 0x3) {RMS_MET[2] = dataArray[
index+iWord];}
425 }
426
428 if (blockType == 0x1) {RMS_SCALAR[0] = dataArray[
index+iWord];}
429 if (blockType == 0x2) {RMS_SCALAR[1] = dataArray[
index+iWord];}
430 if (blockType == 0x3) {RMS_SCALAR[2] = dataArray[
index+iWord];}
431 }
432
433 }
434
435 }
436
437 }
439 }
440
442 if (global_counter == 3) {
443
444 fillGlobal(JWOJ_MHT, 3, gMHTComponentsJwojContainer);
445 fillGlobal(JWOJ_MST, 4, gMSTComponentsJwojContainer);
447 fillGlobal(JWOJ_SCALAR, 1, gScalarEJwojContainer, scalar);
448
449 fillGlobal(GESPRESSO, 1, gEspressoContainer, 0);
450
451 scalar =
fillGlobal(NC_MET, 2, gMETComponentsNoiseCutContainer);
452 fillGlobal(NC_SCALAR, 1, gScalarENoiseCutContainer, scalar);
453
454 scalar =
fillGlobal(RMS_MET, 2, gMETComponentsRmsContainer);
455 fillGlobal(RMS_SCALAR, 1, gScalarERmsContainer, scalar);
456
457 global_counter = 0;
458 }
459
460 }
461 }
462 return StatusCode::SUCCESS;
463}
#define ATH_CHECK
Evaluate an expression and check for errors.
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment ROBF
L1Topo::BlockTypes blockType(const uint32_t word, uint32_t offset=28, uint32_t size=0x0f)
Function to return the block type of a data word from L1Topo.
constexpr unsigned int WORDS_PER_SLICE
constexpr std::array< unsigned int, 4 > GBLOCK_POSITION
constexpr unsigned int BLOCK_TYPE_BIT
constexpr std::array< unsigned int, 2 > GJET_POSITION
constexpr unsigned int DATA_SIZE_MASK
constexpr unsigned int JWOJ_MHT_POSITION
constexpr unsigned int GESPRESSO_POSITION
constexpr unsigned int RMS_MET_POSITION
constexpr unsigned int NC_SCALAR_POSITION
constexpr std::array< unsigned int, 4 > GLOBAL_UNUSED_POSITION
constexpr unsigned int BLOCK_TYPE_MASK
constexpr unsigned int ERROR_FLAG_BIT
constexpr std::array< unsigned int, 2 > TRAILER_POSITION
constexpr unsigned int HEADER_SIZE_MASK
constexpr unsigned int NC_MET_POSITION
constexpr unsigned int HEADER_SIZE_BIT
constexpr unsigned int ERROR_FLAG_MASK
constexpr std::array< unsigned int, 5 > JET_UNUSED_POSITION
constexpr unsigned int GRHO_POSITION
constexpr unsigned int JWOJ_SCALAR_POSITION
constexpr unsigned int JWOJ_MST_POSITION
constexpr unsigned int RMS_SCALAR_POSITION
constexpr unsigned int JWOJ_MET_POSITION
constexpr std::size_t n_words
size_t dataSize(TDA::PayloadIterator start)
Size in bytes of the buffer that is needed to decode next fragment data content.
gFexJetRoI_v1 gFexJetRoI
Define the latest version of the gFexJetRoI class.
setScaleOne setStatusOne setSaturated int16_t