34 ATH_CHECK(gRhomode!=ConversionMode::Undefined);
37 ATH_MSG_DEBUG((gRhomode==ConversionMode::Encoding ?
"Encoding" :
"Decoding") <<
" gRho ");
41 ATH_CHECK(gSJmode!=ConversionMode::Undefined);
44 ATH_MSG_DEBUG((gSJmode==ConversionMode::Encoding ?
"Encoding" :
"Decoding") <<
" gSJ ");
48 ATH_CHECK(gLJmode!=ConversionMode::Undefined);
51 ATH_MSG_DEBUG((gLJmode==ConversionMode::Encoding ?
"Encoding" :
"Decoding") <<
" gLJ ");
55 ATH_CHECK(gScalarEJwojmode!=ConversionMode::Undefined);
58 ATH_MSG_DEBUG((gScalarEJwojmode==ConversionMode::Encoding ?
"Encoding" :
"Decoding") <<
" gScalarEJwoj ");
62 ATH_CHECK(gEspressomode!=ConversionMode::Undefined);
65 ATH_MSG_DEBUG((gEspressomode==ConversionMode::Encoding ?
"Encoding" :
"Decoding") <<
" gEspresso ");
69 ATH_CHECK(gMETComponentsJwojmode!=ConversionMode::Undefined);
72 ATH_MSG_DEBUG((gMETComponentsJwojmode==ConversionMode::Encoding ?
"Encoding" :
"Decoding") <<
" gMETComponentsJwoj ");
76 ATH_CHECK(gMHTComponentsJwojmode!=ConversionMode::Undefined);
79 ATH_MSG_DEBUG((gMHTComponentsJwojmode==ConversionMode::Encoding ?
"Encoding" :
"Decoding") <<
" gMHTComponentsJwoj ");
83 ATH_CHECK(gMSTComponentsJwojmode!=ConversionMode::Undefined);
86 ATH_MSG_DEBUG((gMSTComponentsJwojmode==ConversionMode::Encoding ?
"Encoding" :
"Decoding") <<
" gMSTComponentsJwoj ");
90 ATH_CHECK(gMETComponentsNoiseCutmode!=ConversionMode::Undefined);
93 ATH_MSG_DEBUG((gMETComponentsNoiseCutmode==ConversionMode::Encoding ?
"Encoding" :
"Decoding") <<
" gMETComponentsNoiseCut ");
97 ATH_CHECK(gMETComponentsRmsmode!=ConversionMode::Undefined);
100 ATH_MSG_DEBUG((gMETComponentsRmsmode==ConversionMode::Encoding ?
"Encoding" :
"Decoding") <<
" gMETComponentsRms ");
104 ATH_CHECK(gScalarENoiseCutmode!=ConversionMode::Undefined);
107 ATH_MSG_DEBUG((gScalarENoiseCutmode==ConversionMode::Encoding ?
"Encoding" :
"Decoding") <<
" gScalarENoiseCut ");
111 ATH_CHECK(gScalarERmsmode!=ConversionMode::Undefined);
114 ATH_MSG_DEBUG((gScalarERmsmode==ConversionMode::Encoding ?
"Encoding" :
"Decoding") <<
" gScalarERms ");
117 const std::array<ConversionMode,2> modes{gSJmode,gLJmode};
118 if (std::any_of(modes.begin(),modes.end(),[&gRhomode](ConversionMode m) { return m!=gRhomode; } )) {
120 return StatusCode::FAILURE;
132 return StatusCode::SUCCESS;
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
231 for (
const ROBF* rob : vrobf) {
235 ATH_MSG_DEBUG(
"Starting to decode " << rob->rod_ndata() <<
" ROD words from ROB 0x" << std::hex << rob->rob_source_id());
238 if(rob->rod_ndata() <= 0){
242 const auto dataArray = std::span{rob->rod_data(), rob->rod_ndata()};
247 unsigned int n_words = rob->rod_ndata();
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]));
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);
260 std::vector<uint32_t> GESPRESSO(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);
267 while (
index < n_words ) {
268 const uint32_t headerWord = 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) );
282 const uint32_t blockSize = headerSize + dataSize;
283 if ( (
index + blockSize) > n_words ) {
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());
302 std::stringstream sdetail;
303 sdetail <<
"L1CaloBsDecoderRun3::decodeGfexTobs: subblock type " << blockType <<
" with dataSize " << dataSize <<
" is not a multiple of " <<
gPos::WORDS_PER_SLICE <<
" words" ;
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());
318 bool isMet = (blockType >= 0x1 && blockType <= 0x3);
319 bool isJet = (blockType >= 0xA && blockType <= 0xC);
322 for (uint32_t sliceNumber = 0; sliceNumber < numSlices; sliceNumber++) {
323 if (sliceNumber == 0){
324 if ( !isJet && !isMet ) {
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());
350 gRhoContainer->push_back(std::move(myEDM));
356 gSJContainer->push_back(std::move(myEDM));
362 gLJContainer->push_back(std::move(myEDM));
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];}
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];}
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];}
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];}
404 if (blockType == 0x1) {GESPRESSO[0] = dataArray[
index+iWord];}
405 if (blockType == 0x2) {GESPRESSO[1] = dataArray[
index+iWord];}
406 if (blockType == 0x3) {GESPRESSO[2] = dataArray[
index+iWord];}
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];}
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];}
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];}
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];}
442 if (global_counter == 3) {
444 fillGlobal(JWOJ_MHT, 3, gMHTComponentsJwojContainer);
445 fillGlobal(JWOJ_MST, 4, gMSTComponentsJwojContainer);
446 int16_t scalar =
fillGlobal(JWOJ_MET, 2, gMETComponentsJwojContainer);
447 fillGlobal(JWOJ_SCALAR, 1, gScalarEJwojContainer, scalar);
449 fillGlobal(GESPRESSO, 1, gEspressoContainer, 0);
451 scalar =
fillGlobal(NC_MET, 2, gMETComponentsNoiseCutContainer);
452 fillGlobal(NC_SCALAR, 1, gScalarENoiseCutContainer, scalar);
454 scalar =
fillGlobal(RMS_MET, 2, gMETComponentsRmsContainer);
455 fillGlobal(RMS_SCALAR, 1, gScalarERmsContainer, scalar);
462 return StatusCode::SUCCESS;