ATLAS Offline Software
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
jFexRoiByteStreamTool Class Reference

#include <jFexRoiByteStreamTool.h>

Inheritance diagram for jFexRoiByteStreamTool:
Collaboration diagram for jFexRoiByteStreamTool:

Public Member Functions

 jFexRoiByteStreamTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~jFexRoiByteStreamTool () override=default
 
virtual StatusCode initialize () override
 
virtual StatusCode start () override
 
virtual StatusCode convertFromBS (const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vrobf, const EventContext &eventContext) const override
 BS->xAOD conversion. More...
 
virtual StatusCode convertToBS (std::vector< OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment * > &vrobf, const EventContext &eventContext) override
 xAOD->BS conversion More...
 
virtual const std::vector< uint32_t > & robIds () const override
 Declare ROB IDs for conversion. More...
 

Private Member Functions

std::array< uint32_t, 6 > TOBCounterTrailer (uint32_t word) const
 
std::array< uint32_t, 4 > xTOBCounterTrailer (uint32_t word) const
 
std::array< uint32_t, 4 > jFEXtoRODTrailer (uint32_t word0, uint32_t word1) const
 
std::array< uint32_t, 1 > RODTrailer (uint32_t word0, uint32_t word1) const
 
void jFEXtoRODHeader (uint32_t word0, uint32_t word1) const
 
std::array< float, 2 > getEtaPhi (unsigned int jfex, unsigned int fpga, uint32_t word, const char *obj) const
 
std::array< uint8_t, 2 > unpackLocalCoords (uint32_t word) const
 
StatusCode ReadfromFile (const std::string &)
 
void printError (const std::string &location, const std::string &title, MSG::Level type, const std::string &detail) const
 {map index, {eta,phi}} More...
 

Static Private Member Functions

constexpr static unsigned int mapIndex (unsigned int jfex, unsigned int fpga, unsigned int iEta, unsigned int iPhi)
 

Private Attributes

ToolHandle< GenericMonitoringToolm_monTool {this,"MonTool","","Monitoring tool"}
 
bool m_UseMonitoring = false
 
Gaudi::Property< std::vector< uint32_t > > m_robIds {this, "ROBIDs", {}, "List of ROB IDs required for conversion to/from xAOD RoI"}
 
Gaudi::Property< bool > m_convertExtendedTOBs {this, "ConvertExtendedTOBs", false, "Convert xTOBs instead of TOBs"}
 
Gaudi::Property< std::string > m_TobMapping {this, "jFexTobMapping", "L1CaloFEXByteStream/2022-10-19/jFexTobMap.txt", "Text file to convert from hardware internal coordinates to eta-phi location"}
 
SG::ReadHandleKey< TrigConf::L1Menum_l1MenuKey {this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu","Name of the L1Menu object to read configuration from"}
 
SG::WriteHandleKey< xAOD::jFexSRJetRoIContainerm_jJWriteKey {this,"jJRoIContainerWriteKey" ,"L1_jFexSRJetRoI","Write jFexEDM SRjet container"}
 
SG::WriteHandleKey< xAOD::jFexLRJetRoIContainerm_jLJWriteKey {this,"jLJRoIContainerWriteKey" ,"L1_jFexLRJetRoI","Write jFexEDM LRjet container"}
 
SG::WriteHandleKey< xAOD::jFexTauRoIContainerm_jTauWriteKey {this,"jTauRoIContainerWriteKey","L1_jFexTauRoI" ,"Write jFexEDM tau container"}
 
SG::WriteHandleKey< xAOD::jFexSumETRoIContainerm_jTEWriteKey {this,"jTERoIContainerWriteKey" ,"L1_jFexSumETRoI","Write jFexEDM SumET container"}
 
SG::WriteHandleKey< xAOD::jFexMETRoIContainerm_jXEWriteKey {this,"jXERoIContainerWriteKey" ,"L1_jFexMETRoI" ,"Write jFexEDM Met container"}
 
SG::WriteHandleKey< xAOD::jFexFwdElRoIContainerm_jEMWriteKey {this,"jEMRoIContainerWriteKey" ,"L1_jFexFwdElRoI","Write jFexEDM fwdEl container"}
 
SG::ReadHandleKey< xAOD::jFexSRJetRoIContainerm_jJReadKey {this,"jJRoIContainerReadKey" ,"L1_jFexSRJetRoI","Read jFexEDM SRjet container"}
 
SG::ReadHandleKey< xAOD::jFexLRJetRoIContainerm_jLJReadKey {this,"jLJRoIContainerReadKey" ,"L1_jFexLRJetRoI","Read jFexEDM LRjet container"}
 
SG::ReadHandleKey< xAOD::jFexTauRoIContainerm_jTauReadKey {this,"jTauRoIContainerReadKey","L1_jFexTauRoI" ,"Read jFexEDM tau container"}
 
SG::ReadHandleKey< xAOD::jFexSumETRoIContainerm_jTEReadKey {this,"jTERoIContainerReadKey" ,"L1_jFexSumETRoI","Read jFexEDM SumET container"}
 
SG::ReadHandleKey< xAOD::jFexMETRoIContainerm_jXEReadKey {this,"jXERoIContainerReadKey" ,"L1_jFexMETRoI" ,"Read jFexEDM Met container"}
 
SG::ReadHandleKey< xAOD::jFexFwdElRoIContainerm_jEMReadKey {this,"jEMRoIContainerReadKey" ,"L1_jFexFwdElRoI","Read jFexEDM fwdEl container"}
 
int m_jTauRes = 0
 
int m_jJRes = 0
 
int m_jLJRes = 0
 
int m_jEMRes = 0
 
int m_jXERes = 0
 
int m_jTERes = 0
 
std::unordered_map< unsigned int, std::array< float, 2 > > m_TobPos_map
 

Static Private Attributes

static const int s_etaBit = 5
 
static const int s_phiBit = 1
 
static const int s_etaMask = 0x1f
 
static const int s_phiMask = 0xf
 

Detailed Description

Definition at line 46 of file jFexRoiByteStreamTool.h.

Constructor & Destructor Documentation

◆ jFexRoiByteStreamTool()

jFexRoiByteStreamTool::jFexRoiByteStreamTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 41 of file jFexRoiByteStreamTool.cxx.

44  : base_class(type, name, parent) {}

◆ ~jFexRoiByteStreamTool()

virtual jFexRoiByteStreamTool::~jFexRoiByteStreamTool ( )
overridevirtualdefault

Member Function Documentation

◆ convertFromBS()

StatusCode jFexRoiByteStreamTool::convertFromBS ( const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &  vrobf,
const EventContext &  eventContext 
) const
overridevirtual

BS->xAOD conversion.

Definition at line 158 of file jFexRoiByteStreamTool.cxx.

158  {
159 
160  //WriteHandle for jFEX EDMs
161 
162  //---SRJet EDM
164  ATH_CHECK(jJContainer.record(std::make_unique<xAOD::jFexSRJetRoIContainer>(), std::make_unique<xAOD::jFexSRJetRoIAuxContainer>()));
165  ATH_MSG_DEBUG("Recorded jFexSRJetRoIContainer with key " << jJContainer.key());
166 
167  //---LRJet EDM
169  ATH_CHECK(jLJContainer.record(std::make_unique<xAOD::jFexLRJetRoIContainer>(), std::make_unique<xAOD::jFexLRJetRoIAuxContainer>()));
170  ATH_MSG_DEBUG("Recorded jFexLRJetRoIContainer with key " << jLJContainer.key());
171 
172  //---Tau EDM
174  ATH_CHECK(jTauContainer.record(std::make_unique<xAOD::jFexTauRoIContainer>(), std::make_unique<xAOD::jFexTauRoIAuxContainer>()));
175  ATH_MSG_DEBUG("Recorded jFexTauRoIContainer with key " << jTauContainer.key());
176 
177  //---EM EDM
179  ATH_CHECK(jEMContainer.record(std::make_unique<xAOD::jFexFwdElRoIContainer>(), std::make_unique<xAOD::jFexFwdElRoIAuxContainer>()));
180  ATH_MSG_DEBUG("Recorded jFexFwdElRoIContainer with key " << jEMContainer.key());
181 
182  //---SumET EDM
184  ATH_CHECK(jTEContainer.record(std::make_unique<xAOD::jFexSumETRoIContainer>(), std::make_unique<xAOD::jFexSumETRoIAuxContainer>()));
185  ATH_MSG_DEBUG("Recorded jFexSumETRoIContainer with key " << jTEContainer.key());
186 
187  //---MET EDM
189  ATH_CHECK(jXEContainer.record(std::make_unique<xAOD::jFexMETRoIContainer>(), std::make_unique<xAOD::jFexMETRoIAuxContainer>()));
190  ATH_MSG_DEBUG("Recorded jFexMETRoIContainer with key " << jXEContainer.key());
191 
192 
193 
194 
195  // Iterate over ROBFragments to decode
196  for (const ROBF* rob : vrobf) {
197  // Iterate over ROD words and decode
198 
199  ATH_MSG_DEBUG("Starting to decode " << rob->rod_ndata() << " ROD words from ROB 0x" << std::hex << rob->rob_source_id() << std::dec);
200 
201  //There is no data to decode.. not even the ROD trailers
202  if(rob->rod_ndata() <= 0){
203  std::stringstream sdetail;
204  sdetail << "Not enough ROB words to read: "<<rob->rod_ndata() ;
205  std::stringstream slocation;
206  slocation << "0x"<< std::hex << rob->rob_source_id();
207  std::stringstream stitle;
208  stitle << "Invalid amount of ROB words" ;
209  printError(slocation.str(),stitle.str(),MSG::WARNING,sdetail.str());
210 
211  continue;
212  }
213 
214  const auto dataArray = std::span{rob->rod_data(), rob->rod_ndata()};
215  std::vector<uint32_t> vec_words(dataArray.begin(),dataArray.end());
216 
217  std::stringstream myPrint;
218 
219  myPrint << "jFEX TOB words to decode:"<< std::endl;
220  int aux = 1;
221  for (const uint32_t word : vec_words) {
222  myPrint << aux << " raw word ---> 0x"<< std::hex << word << std::dec << std::endl;
223  aux++;
224  }
225  ATH_MSG_DEBUG(myPrint.str());
226 
227  // Starting to loop over the different jFEX blocks
228  bool READ_TOBS = true;
229  // jFEX to ROD trailer position after the ROD trailer
230  unsigned int trailers_pos = rob->rod_ndata() - jBits::ROD_WORDS;
231 
232  if(vec_words.size() < (jBits::ROD_WORDS+jBits::jFEX2ROD_WORDS) || trailers_pos < (jBits::ROD_WORDS+jBits::jFEX2ROD_WORDS) ){
233  std::stringstream sdetail;
234  sdetail << "Not enough jFEX TOB words to decode (<4). Number of word to decode: "<<vec_words.size()<< ". Position within the vector: "<<trailers_pos ;
235  std::stringstream slocation;
236  slocation << "0x"<< std::hex << rob->rob_source_id();
237  std::stringstream stitle;
238  stitle << "Less than 4 trailers" ;
239  printError(slocation.str(),stitle.str(),MSG::WARNING,sdetail.str());
240 
241  continue;
242  }
243 
244  //check ROD error
245  const auto [RODerror] = RODTrailer ( vec_words.at(rob->rod_ndata()-2), vec_words.at(rob->rod_ndata()-1) );
246 
247  // if ROD errors return gracefully
248  if(RODerror != 0){
249  bool corTrailer = ((RODerror >> jBits::ROD_ERROR_CORR_TRAILER ) & jBits::ROD_TRAILER_1b);
250  bool payloadCRC = ((RODerror >> jBits::ROD_ERROR_PAYLOAD_CRC ) & jBits::ROD_TRAILER_1b);
251  bool headerCRC = ((RODerror >> jBits::ROD_ERROR_HEADER_CRC ) & jBits::ROD_TRAILER_1b);
252  bool reserved = ((RODerror >> jBits::ROD_ERROR_RESERVED ) & jBits::ROD_TRAILER_1b);
253  bool lenerror = ((RODerror >> jBits::ROD_ERROR_LENGTH_MISMATCH ) & jBits::ROD_TRAILER_1b);
254  bool headmismatch = ((RODerror >> jBits::ROD_ERROR_HEADER_MISMATCH ) & jBits::ROD_TRAILER_1b);
255  bool processerror = ((RODerror >> jBits::ROD_ERROR_PROC_TIMEOUT ) & jBits::ROD_TRAILER_1b);
256 
257  std::stringstream sdetail;
258  sdetail << "ROD Trailer Error bits set - 7-bits error word: 0x"<< std::hex <<RODerror << std::dec<< std::endl;
259  sdetail << "Corrective Trailer: "<< corTrailer << std::endl;
260  sdetail << "Payload CRC : "<< payloadCRC << std::endl;
261  sdetail << "Header CRC : "<< headerCRC << std::endl;
262  sdetail << "Reserved (=0) : "<< reserved << std::endl;
263  sdetail << "Length Mismatch : "<< lenerror << std::endl;
264  sdetail << "Header Mismatch : "<< headmismatch << std::endl;
265  sdetail << "Processor timeout : "<< processerror << std::endl;
266  std::stringstream slocation;
267  slocation << "ROD Error";
268 
269  //Returning Status code failure, it needs to go to debug stream
270  if( corTrailer ){
271  std::stringstream stitle;
272  stitle << "Corrective Trailer" ;
273  printError(slocation.str(),stitle.str(),MSG::ERROR,stitle.str() + " - "+ sdetail.str());
274  return StatusCode::FAILURE;
275  }
276  if( payloadCRC ){
277  std::stringstream stitle;
278  stitle << "Payload CRC" ;
279  printError(slocation.str(),stitle.str(),MSG::ERROR,stitle.str() + " - "+ sdetail.str());
280  return StatusCode::FAILURE;
281  }
282  if( headerCRC ){
283  std::stringstream stitle;
284  stitle << "Header CRC" ;
285  printError(slocation.str(),stitle.str(),MSG::ERROR,stitle.str() + " - "+ sdetail.str());
286  return StatusCode::FAILURE;
287  }
288  if( lenerror ){
289  std::stringstream stitle;
290  stitle << "Length mismatch" ;
291  printError(slocation.str(),stitle.str(),MSG::ERROR,stitle.str() + " - "+ sdetail.str());
292  return StatusCode::FAILURE;
293  }
294  if( headmismatch ){
295  std::stringstream stitle;
296  stitle << "Header mismatch" ;
297  printError(slocation.str(),stitle.str(),MSG::ERROR,stitle.str() + " - "+ sdetail.str());
298  return StatusCode::FAILURE;
299  }
300  if( processerror ){
301  std::stringstream stitle;
302  stitle << "Processor Timeout" ;
303  printError(slocation.str(),stitle.str(),MSG::ERROR,stitle.str() + " - "+ sdetail.str());
304  return StatusCode::FAILURE;
305  }
306 
307  return StatusCode::FAILURE;
308  }
309 
310  while(READ_TOBS){
311 
312  const auto [payload, fpga, jfex, error] = jFEXtoRODTrailer ( vec_words.at(trailers_pos-2), vec_words.at(trailers_pos-1) );
313  const auto [n_xjJ, n_xjLJ, n_xjTau, n_xjEM] = xTOBCounterTrailer( vec_words.at(trailers_pos-3) );
314  const auto [n_jJ, n_jLJ, n_jTau, n_jEM, n_jTE, n_jXE] = TOBCounterTrailer ( vec_words.at(trailers_pos-4) );
315  unsigned int n_tobs = n_jJ + n_jLJ + n_jTau + n_jEM + n_jTE + n_jXE;
316  unsigned int n_xtobs = n_xjJ + n_xjLJ + n_xjTau + n_xjEM;
317  unsigned int total_tobs = n_tobs+n_xtobs;
318  //printf("----------> trailer_pos:%3d payload:%3d N.Words:%3d fpga:%3d jfex:%3d\n",trailers_pos,payload,total_tobs+jBits::TOB_TRAILERS,fpga,jfex);
319  //printf(" TOBs(0x%08x): jJ:%3d jLJ:%3d jTau:%3d jEM:%3d jTE:%3d jXE:%3d\n",vec_words.at(trailers_pos-4),n_jJ,n_jLJ,n_jTau,n_jEM,n_jTE,n_jXE);
320  //printf("xTOBs(0x%08x): xjJ:%3d xjLJ:%3d xjTau:%3d xjEM:%3d\n",vec_words.at(trailers_pos-3),n_xjJ,n_xjLJ,n_xjTau,n_xjEM);
321 
322  // First we need to check if there is a padding word.
323  //Padding wordis when there is an even number in the payload, but odd number of xTOB and TOB.. need to check and remove the extra word.
324  unsigned int paddingWord = 0;
325  if(total_tobs % 2){
326  ATH_MSG_DEBUG("Odd number of TOBs + xTOBs:"<< total_tobs<<", there is a padding word!");
327  paddingWord = 1;
328  }
329 
330  if(error != 0){
331 
332  bool corTrailer = ((error >> jBits::ERROR_CORR_TRAILER ) & jBits::ROD_TRAILER_1b);
333  bool safemode = ((error >> jBits::ERROR_SAFE_MODE ) & jBits::ROD_TRAILER_1b);
334  bool proterror = ((error >> jBits::ERROR_PROTOCOL_ERROR ) & jBits::ROD_TRAILER_1b);
335  bool lenerror = ((error >> jBits::ERROR_LENGTH_MISMATCH ) & jBits::ROD_TRAILER_1b);
336  bool headmismatch = ((error >> jBits::ERROR_HEADER_MISMATCH ) & jBits::ROD_TRAILER_1b);
337  bool processerror = ((error >> jBits::ERROR_PROC_TIMEOUT ) & jBits::ROD_TRAILER_1b);
338 
339  std::stringstream sdetail;
340  sdetail << "jFEX to ROD Trailer Error bits set - 6-bits error word: 0x"<< std::hex <<error << std::dec<< std::endl;
341  sdetail << "Corrective Trailer: "<< corTrailer << std::endl;
342  sdetail << "Safe Mode : "<< safemode << std::endl;
343  sdetail << "Protocol error : "<< proterror << std::endl;
344  sdetail << "Length Mismatch : "<< lenerror << std::endl;
345  sdetail << "Header Mismatch : "<< headmismatch << std::endl;
346  sdetail << "Processor timeout : "<< processerror << std::endl;
347  std::stringstream slocation;
348  slocation << "Error bit set";
349 
350  if( corTrailer ){
351  std::stringstream stitle;
352  stitle << "Corrective Trailer" ;
353  printError(slocation.str(),stitle.str(),MSG::ERROR,sdetail.str());
354 
355  //Returning Status code failure needs to go to debug stream
356  return StatusCode::FAILURE;
357  }
358  if( safemode ){
359  std::stringstream stitle;
360  stitle << "Safe Mode" ;
361  printError(slocation.str(),stitle.str(),MSG::WARNING,sdetail.str());
362  }
363  if( proterror ){
364  std::stringstream stitle;
365  stitle << "Protocol error" ;
366  printError(slocation.str(),stitle.str(),MSG::WARNING,sdetail.str());
367  }
368  if( lenerror ){
369  std::stringstream stitle;
370  stitle << "Length mismatch" ;
371  printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str());
372  }
373  if( headmismatch ){
374  std::stringstream stitle;
375  stitle << "Header mismatch" ;
376  printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str());
377  }
378  if( processerror ){
379  std::stringstream stitle;
380  stitle << "Processor Timeout" ;
381  printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str());
382  }
383 
384  }
385 
386  if(payload != (total_tobs + jBits::TOB_TRAILERS + paddingWord)){
387  std::stringstream sdetail;
388  sdetail << "Payload="<< payload<<" is different from TOBs+Trailers+padding words="<< total_tobs + jBits::TOB_TRAILERS + paddingWord <<" in FPGA: "<< fpga << " and jFEX: "<< jfex <<". SKIPPED!" ;
389  std::stringstream slocation;
390  slocation << "jFEX "<< jfex << " FPGA "<< fpga << " in 0x"<< std::hex << rob->rob_source_id();
391  std::stringstream stitle;
392  stitle << "Wrong payload" ;
393  printError(slocation.str(),stitle.str(),MSG::WARNING,sdetail.str());
394 
395  //Checking if we can continue decoding data for the rest of FPGAs. No negative positions
396  int neg_positions = trailers_pos - (payload + jBits::TOB_TRAILERS);
397  //If negative, whole event must be discarded!
398  if(neg_positions < 0){
399  std::stringstream sdetail;
400  sdetail << "jFEX TOB decoder has discarded the whole event. Due to a wrong payload cannot continue decoding" ;
401  std::stringstream slocation;
402  slocation << "jFEX "<< jfex << " FPGA "<< fpga << " in 0x"<< std::hex << rob->rob_source_id();
403  std::stringstream stitle;
404  stitle << "Event discarded" ;
405 
406  printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str());
407  break;
408  }
409 
410  //Jumping to next FPGA
411  trailers_pos -= (payload+jBits::TOB_TRAILERS);
412 
413  //Is it 0? then we finish the loop, next event
414  if(trailers_pos == 0) {
415  READ_TOBS = false;
416  }
417  continue;
418  }
419 
420  //The minimum number for the payload should be 2 (The TOB/xTOB counters). If lower send an error message
421  if(payload < jBits::TOB_TRAILERS){
422  std::stringstream sdetail;
423  sdetail << "Payload: "<< payload<<" is lower than the expected size (at least" << jBits::TOB_TRAILERS << "trailers)" ;
424  std::stringstream slocation;
425  slocation << "jFEX "<< jfex << " FPGA "<< fpga << " in 0x"<< std::hex << rob->rob_source_id();
426  std::stringstream stitle;
427  stitle << "Event discarded" ;
428 
429  printError(slocation.str(),stitle.str(),MSG::WARNING,sdetail.str());
430  break;
431  }
432 
433  //removing jFEX to ROD, TOB and xTOB Trailers from trailers_pos (4 positions), possible padding word added on the data to get even number of 32bit words
434  unsigned int tobIndex = trailers_pos - (jBits::jFEX2ROD_WORDS + jBits::TOB_TRAILERS + paddingWord);
435 
436  if(paddingWord == 1){
437  ATH_MSG_DEBUG("Padding word: "<< std::hex << vec_words.at(tobIndex) <<std::dec);
438  }
439 
441  /************************************************** DECODING xTOBS **************************************************/
442 
443  //saving xjEM into the EDM container
444  for(unsigned int i=tobIndex; i>tobIndex-n_xjEM; i--) {
445  const auto [eta, phi ] = getEtaPhi(jfex, fpga, vec_words.at(i-1),"jEM xTOB");
446  jEMContainer->push_back( std::make_unique<xAOD::jFexFwdElRoI>() );
447  jEMContainer->back()->initialize(jfex, fpga, vec_words.at(i-1),0, m_jEMRes, eta, phi);
448  }
449  //removing xjEM counter from TOBs
450  tobIndex -= n_xjEM;
451 
452  //saving xjTau into the EDM container
453  for(unsigned int i=tobIndex; i>tobIndex-n_xjTau; i--) {
454  const auto [eta, phi ] = getEtaPhi(jfex, fpga, vec_words.at(i-1),"jTau xTOB");
455  jTauContainer->push_back( std::make_unique<xAOD::jFexTauRoI>() );
456  jTauContainer->back()->initialize(jfex, fpga, vec_words.at(i-1),0, m_jTauRes, eta, phi);
457  }
458  //removing xjTau counter from TOBs
459  tobIndex -= n_xjTau;
460 
461  //saving xjLJ into the EDM container
462  for(unsigned int i=tobIndex; i>tobIndex-n_xjLJ; i--) {
463  const auto [eta, phi ] = getEtaPhi(jfex, fpga, vec_words.at(i-1),"jLJ xTOB");
464  jLJContainer->push_back( std::make_unique<xAOD::jFexLRJetRoI>() );
465  jLJContainer->back()->initialize(jfex, fpga, vec_words.at(i-1),0, m_jLJRes, eta, phi);
466  }
467  //removing xjLJ counter from TOBs
468  tobIndex -= n_xjLJ;
469 
470  //saving xjJ into the EDM container
471  for(unsigned int i=tobIndex; i>tobIndex-n_xjJ; i--) {
472  const auto [eta, phi ] = getEtaPhi(jfex, fpga, vec_words.at(i-1),"jJ xTOB");
473  jJContainer->push_back( std::make_unique<xAOD::jFexSRJetRoI>() );
474  jJContainer->back()->initialize(jfex, fpga, vec_words.at(i-1),0, m_jJRes, eta, phi);
475  }
476  //removing xjJ counter from TOBs
477  tobIndex -= n_xjJ;
478 
479  // skipping TOBs to jump to the next set of data
480  tobIndex -= n_tobs;
481 
482  }
483  else {
484  /************************************************** DECODING TOBS **************************************************/
485 
486  // skipping extended-TOBs
487  tobIndex -= n_xtobs;
488 
489  //saving jXE into the EDM container
490  //Only FPGA U1 and U4 are sent to L1Topo, it cover the full phi
491  if(fpga == jBits::FPGA_U1 || fpga == jBits::FPGA_U4 ){
492  for(unsigned int i=tobIndex; i>tobIndex-n_jXE; i--) {
493  jXEContainer->push_back( std::make_unique<xAOD::jFexMETRoI>() );
494  jXEContainer->back()->initialize(jfex, fpga, vec_words.at(i-1), m_jXERes);
495  }
496  }
497  //removing jXE counter from TOBs
498  tobIndex -= n_jXE;
499 
500  //saving jTE into the EDM container
501  //Only FPGA U1 and U4 are sent to L1Topo, it cover the full phi
502  if(fpga == jBits::FPGA_U1 || fpga == jBits::FPGA_U4 ) {
503  for(unsigned int i=tobIndex; i>tobIndex-n_jTE; i--) {
504  jTEContainer->push_back( std::make_unique<xAOD::jFexSumETRoI>() );
505  jTEContainer->back()->initialize(jfex, fpga, vec_words.at(i-1), m_jTERes);
506  }
507  }
508  //removing jTE counter from TOBs
509  tobIndex -= n_jTE;
510 
511  //saving jEM into the EDM container
512  for(unsigned int i=tobIndex; i>tobIndex-n_jEM; i--) {
513  const auto [eta, phi ] = getEtaPhi(jfex, fpga, vec_words.at(i-1),"jEM TOB");
514  jEMContainer->push_back( std::make_unique<xAOD::jFexFwdElRoI>() );
515  jEMContainer->back()->initialize(jfex, fpga, vec_words.at(i-1),1, m_jEMRes, eta, phi);
516  }
517  //removing jEM counter from TOBs
518  tobIndex -= n_jEM;
519 
520  //saving jTau into the EDM container
521  for(unsigned int i=tobIndex; i>tobIndex-n_jTau; i--) {
522  const auto [eta, phi ] = getEtaPhi(jfex, fpga, vec_words.at(i-1),"jTau TOB");
523  jTauContainer->push_back( std::make_unique<xAOD::jFexTauRoI>() );
524  jTauContainer->back()->initialize(jfex, fpga, vec_words.at(i-1),1, m_jTauRes, eta, phi);
525  }
526  //removing jTau counter from TOBs
527  tobIndex -= n_jTau;
528 
529  //saving jLJ into the EDM container
530  for(unsigned int i=tobIndex; i>tobIndex-n_jLJ; i--) {
531  const auto [eta, phi ] = getEtaPhi(jfex, fpga, vec_words.at(i-1),"jLJ TOB");
532  jLJContainer->push_back( std::make_unique<xAOD::jFexLRJetRoI>() );
533  jLJContainer->back()->initialize(jfex, fpga, vec_words.at(i-1),1, m_jLJRes, eta, phi);
534  }
535  //removing jLJ counter from TOBs
536  tobIndex -= n_jLJ;
537 
538  //saving jJ into the EDM container
539  for(unsigned int i=tobIndex; i>tobIndex-n_jJ; i--) {
540  const auto [eta, phi ] = getEtaPhi(jfex, fpga, vec_words.at(i-1),"jJ TOB");
541  jJContainer->push_back( std::make_unique<xAOD::jFexSRJetRoI>() );
542  jJContainer->back()->initialize(jfex, fpga, vec_words.at(i-1),1, m_jJRes, eta, phi);
543  }
544  //removing jJ counter from TOBs
545  tobIndex -= n_jJ;
546  }
547  //moving trailer position index to the next jFEX data block
548  trailers_pos -= (payload + jBits::jFEX2ROD_WORDS);
549 
550  if(trailers_pos != tobIndex){
551  std::stringstream sdetail;
552  sdetail << "Something went wrong decoding jFEX BS data. Trailer position: " << trailers_pos << " should match the TOB index position:" << tobIndex ;
553  std::stringstream slocation;
554  slocation << "jFEX "<< jfex << " FPGA "<< fpga << " in 0x"<< std::hex << rob->rob_source_id();
555  std::stringstream stitle;
556  stitle << "Wrong amount of words" ;
557 
558  printError(slocation.str(),stitle.str(),MSG::ERROR,sdetail.str());
559 
560  return StatusCode::FAILURE;
561  }
562 
563 
564  if(trailers_pos == 0){
565  READ_TOBS = false;
566  }
567  }
568  }
569 
570  return StatusCode::SUCCESS;
571 }

◆ convertToBS()

StatusCode jFexRoiByteStreamTool::convertToBS ( std::vector< OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment * > &  vrobf,
const EventContext &  eventContext 
)
overridevirtual

xAOD->BS conversion

Definition at line 765 of file jFexRoiByteStreamTool.cxx.

765  {
766 
767 /*
768  // Retrieve the RoI container
769  auto muonRoIs = SG::makeHandle(m_roiReadKey, eventContext);
770  ATH_CHECK(muonRoIs.isValid());
771 
772  // Clear BS data cache
773  clearCache(eventContext);
774 
775  // Create raw ROD data words
776  ATH_MSG_DEBUG("Converting " << muonRoIs->size() << " L1 Muon RoIs to ByteStream");
777  uint32_t* data = newRodData(eventContext, muonRoIs->size());
778  for (size_t i=0; i<muonRoIs->size(); ++i) {
779  data[i] = muonRoIs->at(i)->roiWord();
780  }
781 
782  // Create ROBFragment containing the ROD words
783  const eformat::helper::SourceIdentifier sid(eformat::TDAQ_MUON_CTP_INTERFACE, m_muCTPIModuleID.value());
784  vrobf.push_back(newRobFragment(
785  eventContext,
786  sid.code(),
787  muonRoIs->size(),
788  data,
789  eformat::STATUS_BACK // status_position is system-specific
790  ));
791 */
792  return StatusCode::SUCCESS;
793 }

◆ getEtaPhi()

std::array< float, 2 > jFexRoiByteStreamTool::getEtaPhi ( unsigned int  jfex,
unsigned int  fpga,
uint32_t  word,
const char *  obj = "" 
) const
private

Definition at line 747 of file jFexRoiByteStreamTool.cxx.

747  {
748 
749  const auto [iEta, iPhi] = unpackLocalCoords(word);
750  unsigned int index = mapIndex(jfex, fpga, iEta, iPhi);
751 
752  auto it = m_TobPos_map.find(index);
753  if(it == m_TobPos_map.end()){
754  //This should be a WARNING.. masked until jFEX firmware bug is fixed
755  ATH_MSG_DEBUG("No index found for "<< obj <<" word, jFex:"<<jfex << " Fpga:"<<fpga<< " iEta:"<<+iEta<< " iPhi:"<<+iPhi<< " for 32-bit word: 0x"<<std::hex<<word<<std::dec);
756  return {-99, -99};
757  }
758 
759  //returns an std::array<float,2> {eta, phi}
760  return it->second;
761 
762 }

◆ initialize()

StatusCode jFexRoiByteStreamTool::initialize ( )
overridevirtual

Definition at line 46 of file jFexRoiByteStreamTool.cxx.

46  {
47  // Conversion mode for jJ TOBs
48  ConversionMode jJmode = getConversionMode(m_jJReadKey, m_jJWriteKey, msg());
50  ATH_CHECK(m_jJWriteKey.initialize(jJmode==ConversionMode::Decoding));
51  ATH_CHECK(m_jJReadKey.initialize(jJmode==ConversionMode::Encoding));
52  ATH_MSG_DEBUG((jJmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " jJ ROB IDs: "
53  << MSG::hex << m_robIds.value() << MSG::dec);
54 
55  // Conversion mode for jLJ TOBs
56  ConversionMode jLJmode = getConversionMode(m_jLJReadKey, m_jLJWriteKey, msg());
58  ATH_CHECK(m_jLJWriteKey.initialize(jLJmode==ConversionMode::Decoding));
59  ATH_CHECK(m_jLJReadKey.initialize(jLJmode==ConversionMode::Encoding));
60  ATH_MSG_DEBUG((jLJmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " jLJ ROB IDs: "
61  << MSG::hex << m_robIds.value() << MSG::dec);
62 
63  // Conversion mode for jTau TOBs
64  ConversionMode jTaumode = getConversionMode(m_jTauReadKey, m_jTauWriteKey, msg());
66  ATH_CHECK(m_jTauWriteKey.initialize(jTaumode==ConversionMode::Decoding));
67  ATH_CHECK(m_jTauReadKey.initialize(jTaumode==ConversionMode::Encoding));
68  ATH_MSG_DEBUG((jTaumode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " jTau ROB IDs: "
69  << MSG::hex << m_robIds.value() << MSG::dec);
70 
71  // Conversion mode for jEM TOBs
72  ConversionMode jEMmode = getConversionMode(m_jEMReadKey, m_jEMWriteKey, msg());
74  ATH_CHECK(m_jEMWriteKey.initialize(jEMmode==ConversionMode::Decoding));
75  ATH_CHECK(m_jEMReadKey.initialize(jEMmode==ConversionMode::Encoding));
76  ATH_MSG_DEBUG((jEMmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " jEM ROB IDs: "
77  << MSG::hex << m_robIds.value() << MSG::dec);
78 
79  // Conversion mode for jTE TOBs
80  ConversionMode jTEmode = getConversionMode(m_jTEReadKey, m_jTEWriteKey, msg());
82  ATH_CHECK(m_jTEWriteKey.initialize(jTEmode==ConversionMode::Decoding));
83  ATH_CHECK(m_jTEReadKey.initialize(jTEmode==ConversionMode::Encoding));
84  ATH_MSG_DEBUG((jTEmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " jTE ROB IDs: "
85  << MSG::hex << m_robIds.value() << MSG::dec);
86 
87  // Conversion mode for jXE TOBs
88  ConversionMode jXEmode = getConversionMode(m_jXEReadKey, m_jXEWriteKey, msg());
90  ATH_CHECK(m_jXEWriteKey.initialize(jXEmode==ConversionMode::Decoding));
91  ATH_CHECK(m_jXEReadKey.initialize(jXEmode==ConversionMode::Encoding));
92  ATH_MSG_DEBUG((jXEmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " jXE ROB IDs: "
93  << MSG::hex << m_robIds.value() << MSG::dec);
94 
95  //checking all Conversion modes.. avoid misconfigurations
96  const std::array<ConversionMode,5> modes{jLJmode,jTaumode,jEMmode,jTEmode,jXEmode};
97  if (std::any_of(modes.begin(),modes.end(),[&jJmode](ConversionMode m) { return m!=jJmode; } )) {
98  ATH_MSG_ERROR("Inconsistent conversion modes");
99  return StatusCode::FAILURE;
100  }
101 
103 
104 
105  //Reading from CVMFS TOB mapping
107 
108  // Initialize monitoring tool if not empty
109  if (!m_monTool.empty()) {
110  ATH_CHECK(m_monTool.retrieve());
111  ATH_MSG_INFO("Logging errors to " << m_monTool.name() << " monitoring tool");
112  m_UseMonitoring = true;
113  }
114 
115  return StatusCode::SUCCESS;
116 }

◆ jFEXtoRODHeader()

void jFexRoiByteStreamTool::jFEXtoRODHeader ( uint32_t  word0,
uint32_t  word1 
) const
private

Definition at line 660 of file jFexRoiByteStreamTool.cxx.

660  {
661 
662  //std::cout << "jFEXtoRODHeader: word0 0x" << std::hex << word0 << std::dec << std::endl;
663  //std::cout << "jFEXtoRODHeader: word1 0x" << std::hex << word1 << std::dec << std::endl;
664 
665  //std::cout << "\tWord0 : " << std::bitset<32>(word0) << std::endl;
666  //std::cout << "\tWord1 : " << std::bitset<32>(word1) << std::endl;
667 
668 
669  //std::cout << "\tWord0 L1Calo: " << ((word0 >> jBits::L1CALO_STREAM_ID_ROD_HEADER ) & jBits::ROD_HEADER_8b ) << std::endl;
670  //std::cout << "\t\t L1Calo SLOT: " << ((word0 >> (jBits::L1CALO_STREAM_ID_ROD_HEADER + jBits::L1CALO_STREAM_ID_SLOT_ROD_HEADER) ) & 4 ) << std::endl;
671  //std::cout << "\t\t L1Calo FPGA: " << ((word0 >> (jBits::L1CALO_STREAM_ID_ROD_HEADER + jBits::L1CALO_STREAM_ID_FPGA_ROD_HEADER) ) & 2 ) << std::endl;
672  //std::cout << "\t\t L1Calo INFO: " << ((word0 >> (jBits::L1CALO_STREAM_ID_ROD_HEADER + jBits::L1CALO_STREAM_ID_INFO_ROD_HEADER) ) & 2 ) << std::endl;
673  //std::cout << "\tWord0 BCN : " << ((word0 >> jBits::BCN_ROD_HEADER ) & jBits::ROD_HEADER_12b ) << std::endl;
674  //std::cout << "\tWord0 CRC : " << ((word0 >> jBits::CRC_ROD_HEADER ) & jBits::ROD_HEADER_9b ) << std::endl;
675  //std::cout << "\tWord0 Vers : " << ((word0 >> jBits::VERS_ROD_HEADER ) & jBits::ROD_HEADER_3b ) << std::endl;
676 
677  //std::cout << "\tWord1 L1ID : " << ((word1 >> jBits::L1ID_ROD_HEADER ) & jBits::ROD_HEADER_24b ) << std::endl;
678  //std::cout << "\tWord1 ECRID : " << ((word1 >> jBits::ECRID_ROD_HEADER ) & jBits::ROD_HEADER_8b ) << std::endl;
679 
680 
681 
682 }

◆ jFEXtoRODTrailer()

std::array< uint32_t, 4 > jFexRoiByteStreamTool::jFEXtoRODTrailer ( uint32_t  word0,
uint32_t  word1 
) const
private

Definition at line 620 of file jFexRoiByteStreamTool.cxx.

620  {
621 
622  uint32_t payload = ((word0 >> jBits::PAYLOAD_ROD_TRAILER ) & jBits::ROD_TRAILER_16b);
623  uint32_t fpga = ((word0 >> jBits::FPGA_ROD_TRAILER ) & jBits::ROD_TRAILER_2b );
624  uint32_t jfex = ((word0 >> jBits::jFEX_ROD_TRAILER ) & jBits::ROD_TRAILER_4b );
625  uint32_t ROslice = ((word0 >> jBits::RO_ROD_TRAILER ) & jBits::ROD_TRAILER_4b );
626  uint32_t TSN = ((word0 >> jBits::TSN_ROD_TRAILER ) & jBits::ROD_TRAILER_4b );
627 
628  uint32_t error = ((word1 >> jBits::ERROR_ROD_TRAILER ) & jBits::ROD_TRAILER_6b );
629  uint32_t CRC = ((word1 >> jBits::CRC_ROD_TRAILER ) & jBits::ROD_TRAILER_20b);
630 
631 
632  std::stringstream sdetail;
633  sdetail << "jFEX to ROD Trailer. Word0: 0x"<< std::hex <<word0 << " and Word1: 0x"<< word1 << std::endl;
634  sdetail << "Payload (from word0): "<< payload << std::endl;
635  sdetail << "FPGA (from word0): "<< fpga << std::endl;
636  sdetail << "jFEX (from word0): "<< jfex << std::endl;
637  sdetail << "RO slice (from word0): "<< ROslice << std::endl;
638  sdetail << "TSN (from word0): "<< TSN << std::endl;
639  sdetail << "Error (from word1): "<< error << std::endl;
640  sdetail << "CRC (from word1): "<< CRC << std::dec << std::endl;
641 
642  ATH_MSG_DEBUG(sdetail.str());
643 
644  return {payload, fpga, jfex, error};
645 
646 }

◆ mapIndex()

constexpr unsigned int jFexRoiByteStreamTool::mapIndex ( unsigned int  jfex,
unsigned int  fpga,
unsigned int  iEta,
unsigned int  iPhi 
)
staticconstexprprivate

Definition at line 733 of file jFexRoiByteStreamTool.cxx.

733  {
734  // values from hardware: jfex=[0,5] 4 bits, fpga=[0,3] 4 bits, ieta=[0,24] 8 bits, iphi=[0,15] 4 bits
735  return (jfex << 16) | (fpga << 12) | (iEta << 4) | iPhi;
736 }

◆ printError()

void jFexRoiByteStreamTool::printError ( const std::string &  location,
const std::string &  title,
MSG::Level  type,
const std::string &  detail 
) const
private

{map index, {eta,phi}}

Definition at line 796 of file jFexRoiByteStreamTool.cxx.

796  {
797 
798  if(m_UseMonitoring){
800  Monitored::Scalar("jfexDecoderErrorLocation",location.empty() ? std::string("UNKNOWN") : location),
801  Monitored::Scalar("jfexDecoderErrorTitle" ,title.empty() ? std::string("UNKNOWN") : title)
802  );
803  }
804  else {
805  msg() << type << detail << endmsg;
806  }
807 }

◆ ReadfromFile()

StatusCode jFexRoiByteStreamTool::ReadfromFile ( const std::string &  fileName)
private

Definition at line 685 of file jFexRoiByteStreamTool.cxx.

685  {
686 
687  std::string myline;
688 
689  //openning file with ifstream
690  std::ifstream myfile(fileName);
691 
692  if ( !myfile.is_open() ){
693  ATH_MSG_ERROR("Could not open file:" << fileName);
694  return StatusCode::FAILURE;
695  }
696 
697  //loading the mapping information
698  while ( std::getline (myfile, myline) ) {
699 
700  //removing the header of the file (it is just information!)
701  if(myline[0] == '#') continue;
702 
703  //Splitting myline in different substrings
704  std::stringstream oneLine(myline);
705 
706  //reading elements
707  std::vector<float> elements;
708  std::string element;
709  while(std::getline(oneLine, element, ' '))
710  {
711  elements.push_back(std::stof(element));
712  }
713 
714  // It should have 6 elements
715  // ordered as: jfex fpga localEta localPhi eta phi
716  if(elements.size() != 6){
717  ATH_MSG_ERROR("Unexpected number of elemennts (6 expected) in file: "<< fileName);
718  myfile.close();
719  return StatusCode::FAILURE;
720  }
721  // building array of < eta, phi >
722  std::array<float,2> aux_arr{ {elements.at(4),elements.at(5)} };
723 
724  //filling the map with the hash given by mapIndex()
725  m_TobPos_map[ mapIndex(elements.at(0),elements.at(1),elements.at(2),elements.at(3)) ] = aux_arr;
726 
727  }
728  myfile.close();
729 
730  return StatusCode::SUCCESS;
731 }

◆ robIds()

virtual const std::vector<uint32_t>& jFexRoiByteStreamTool::robIds ( ) const
inlineoverridevirtual

Declare ROB IDs for conversion.

Definition at line 63 of file jFexRoiByteStreamTool.h.

63  {
64  return m_robIds.value();
65  }

◆ RODTrailer()

std::array< uint32_t, 1 > jFexRoiByteStreamTool::RODTrailer ( uint32_t  word0,
uint32_t  word1 
) const
private

Definition at line 649 of file jFexRoiByteStreamTool.cxx.

649  {
650 
651  uint32_t error = ((word1 >> jBits::ERROR_ROD_TRAILER ) & jBits::ROD_TRAILER_7b );
652 
653  //return an array since we can implement more features in the future
654  return {error};
655 
656 }

◆ start()

StatusCode jFexRoiByteStreamTool::start ( )
overridevirtual

Definition at line 118 of file jFexRoiByteStreamTool.cxx.

118  {
119 
120  // Retrieve the L1 menu configuration
122  ATH_CHECK(l1Menu.isValid());
123 
124  try {
125  const auto& thrExtraInfo = l1Menu->thrExtraInfo();
126  const TrigConf::L1ThrExtraInfo_jTAU & thr_jTAU = thrExtraInfo.jTAU();
127  const TrigConf::L1ThrExtraInfo_jJ & thr_jJ = thrExtraInfo.jJ();
128  const TrigConf::L1ThrExtraInfo_jLJ & thr_jLJ = thrExtraInfo.jLJ();
129  const TrigConf::L1ThrExtraInfo_jEM & thr_jEM = thrExtraInfo.jEM();
130  const TrigConf::L1ThrExtraInfo_jTE & thr_jTE = thrExtraInfo.jTE();
131  const TrigConf::L1ThrExtraInfo_jXE & thr_jXE = thrExtraInfo.jXE();
132 
133  ATH_CHECK(thr_jTAU.isValid());
134  ATH_CHECK(thr_jJ.isValid() );
135  ATH_CHECK(thr_jLJ.isValid() );
136  ATH_CHECK(thr_jEM.isValid() );
137  ATH_CHECK(thr_jTE.isValid() );
138  ATH_CHECK(thr_jXE.isValid() );
139 
140  m_jTauRes = thr_jTAU.resolutionMeV();
141  m_jJRes = thr_jJ.resolutionMeV();
142  m_jLJRes = thr_jLJ.resolutionMeV();
143  m_jEMRes = thr_jEM.resolutionMeV();
144  m_jXERes = thr_jXE.resolutionMeV();
145  m_jTERes = thr_jTE.resolutionMeV();
146 
147  } catch (const std::exception& e) {
148  ATH_MSG_ERROR("Exception reading L1Menu: " << e.what());
149  return StatusCode::FAILURE;
150  }
151 
152  return StatusCode::SUCCESS;
153 
154 }

◆ TOBCounterTrailer()

std::array< uint32_t, 6 > jFexRoiByteStreamTool::TOBCounterTrailer ( uint32_t  word) const
private

Definition at line 575 of file jFexRoiByteStreamTool.cxx.

575  {
576 
577  uint32_t jJ = ((word >> jBits::jJ_TOB_COUNTS ) & jBits::TOB_COUNTS_6b);
578  uint32_t jLJ = ((word >> jBits::jLJ_TOB_COUNTS ) & jBits::TOB_COUNTS_6b);
579  uint32_t jTau = ((word >> jBits::jTau_TOB_COUNTS) & jBits::TOB_COUNTS_6b);
580  uint32_t jEM = ((word >> jBits::jEM_TOB_COUNTS ) & jBits::TOB_COUNTS_6b);
581  uint32_t jTE = ((word >> jBits::jTE_TOB_COUNTS ) & jBits::TOB_COUNTS_1b);
582  uint32_t jXE = ((word >> jBits::jXE_TOB_COUNTS ) & jBits::TOB_COUNTS_1b);
583  //uint32_t TSM = ((word ) & jBits::TOB_COUNTS_1b); // Trigger Safe Mode. Not used for now, maybe is needed in the future
584 
585  std::stringstream sdetail;
586  sdetail << "TOB Counter Trailer. Word: 0x"<< std::hex <<word << std::dec << std::endl;
587  sdetail << "jJ Item : "<< jJ << std::endl;
588  sdetail << "jLJ Item : "<< jLJ << std::endl;
589  sdetail << "jTau Item : "<< jTau << std::endl;
590  sdetail << "jEM Item : "<< jEM << std::endl;
591  sdetail << "jTE Item : "<< jTE << std::endl;
592  sdetail << "jXE Item : "<< jXE << std::endl;
593  ATH_MSG_DEBUG(sdetail.str());
594 
595  return {jJ,jLJ,jTau,jEM,jTE,jXE};
596 
597 }

◆ unpackLocalCoords()

std::array< uint8_t, 2 > jFexRoiByteStreamTool::unpackLocalCoords ( uint32_t  word) const
private

Definition at line 738 of file jFexRoiByteStreamTool.cxx.

738  {
739 
740  uint8_t iEta = (word >> s_etaBit) & s_etaMask;
741  uint8_t iPhi = (word >> s_phiBit) & s_phiMask;
742 
743  return {iEta, iPhi};
744 
745 }

◆ xTOBCounterTrailer()

std::array< uint32_t, 4 > jFexRoiByteStreamTool::xTOBCounterTrailer ( uint32_t  word) const
private

Definition at line 600 of file jFexRoiByteStreamTool.cxx.

600  {
601 
602  uint32_t xjJ = ((word >> jBits::jJ_TOB_COUNTS ) & jBits::TOB_COUNTS_6b);
603  uint32_t xjLJ = ((word >> jBits::jLJ_TOB_COUNTS ) & jBits::TOB_COUNTS_6b);
604  uint32_t xjTau = ((word >> jBits::jTau_TOB_COUNTS) & jBits::TOB_COUNTS_6b);
605  uint32_t xjEM = ((word >> jBits::jEM_TOB_COUNTS ) & jBits::TOB_COUNTS_6b);
606 
607  std::stringstream sdetail;
608  sdetail << "xTOB Counter Trailer. Word: 0x"<< std::hex <<word << std::dec << std::endl;
609  sdetail << "xjJ Item : "<< xjJ << std::endl;
610  sdetail << "xjLJ Item : "<< xjLJ << std::endl;
611  sdetail << "xjTau Item : "<< xjTau << std::endl;
612  sdetail << "xjEM Item : "<< xjEM << std::endl;
613  ATH_MSG_DEBUG(sdetail.str());
614 
615  return {xjJ,xjLJ,xjTau,xjEM};
616 
617 }

Member Data Documentation

◆ m_convertExtendedTOBs

Gaudi::Property<bool> jFexRoiByteStreamTool::m_convertExtendedTOBs {this, "ConvertExtendedTOBs", false, "Convert xTOBs instead of TOBs"}
private

Definition at line 76 of file jFexRoiByteStreamTool.h.

◆ m_jEMReadKey

SG::ReadHandleKey< xAOD::jFexFwdElRoIContainer> jFexRoiByteStreamTool::m_jEMReadKey {this,"jEMRoIContainerReadKey" ,"L1_jFexFwdElRoI","Read jFexEDM fwdEl container"}
private

Definition at line 98 of file jFexRoiByteStreamTool.h.

◆ m_jEMRes

int jFexRoiByteStreamTool::m_jEMRes = 0
private

Definition at line 119 of file jFexRoiByteStreamTool.h.

◆ m_jEMWriteKey

SG::WriteHandleKey< xAOD::jFexFwdElRoIContainer> jFexRoiByteStreamTool::m_jEMWriteKey {this,"jEMRoIContainerWriteKey" ,"L1_jFexFwdElRoI","Write jFexEDM fwdEl container"}
private

Definition at line 90 of file jFexRoiByteStreamTool.h.

◆ m_jJReadKey

SG::ReadHandleKey< xAOD::jFexSRJetRoIContainer> jFexRoiByteStreamTool::m_jJReadKey {this,"jJRoIContainerReadKey" ,"L1_jFexSRJetRoI","Read jFexEDM SRjet container"}
private

Definition at line 93 of file jFexRoiByteStreamTool.h.

◆ m_jJRes

int jFexRoiByteStreamTool::m_jJRes = 0
private

Definition at line 117 of file jFexRoiByteStreamTool.h.

◆ m_jJWriteKey

SG::WriteHandleKey< xAOD::jFexSRJetRoIContainer> jFexRoiByteStreamTool::m_jJWriteKey {this,"jJRoIContainerWriteKey" ,"L1_jFexSRJetRoI","Write jFexEDM SRjet container"}
private

Definition at line 85 of file jFexRoiByteStreamTool.h.

◆ m_jLJReadKey

SG::ReadHandleKey< xAOD::jFexLRJetRoIContainer> jFexRoiByteStreamTool::m_jLJReadKey {this,"jLJRoIContainerReadKey" ,"L1_jFexLRJetRoI","Read jFexEDM LRjet container"}
private

Definition at line 94 of file jFexRoiByteStreamTool.h.

◆ m_jLJRes

int jFexRoiByteStreamTool::m_jLJRes = 0
private

Definition at line 118 of file jFexRoiByteStreamTool.h.

◆ m_jLJWriteKey

SG::WriteHandleKey< xAOD::jFexLRJetRoIContainer> jFexRoiByteStreamTool::m_jLJWriteKey {this,"jLJRoIContainerWriteKey" ,"L1_jFexLRJetRoI","Write jFexEDM LRjet container"}
private

Definition at line 86 of file jFexRoiByteStreamTool.h.

◆ m_jTauReadKey

SG::ReadHandleKey< xAOD::jFexTauRoIContainer > jFexRoiByteStreamTool::m_jTauReadKey {this,"jTauRoIContainerReadKey","L1_jFexTauRoI" ,"Read jFexEDM tau container"}
private

Definition at line 95 of file jFexRoiByteStreamTool.h.

◆ m_jTauRes

int jFexRoiByteStreamTool::m_jTauRes = 0
private

Definition at line 116 of file jFexRoiByteStreamTool.h.

◆ m_jTauWriteKey

SG::WriteHandleKey< xAOD::jFexTauRoIContainer > jFexRoiByteStreamTool::m_jTauWriteKey {this,"jTauRoIContainerWriteKey","L1_jFexTauRoI" ,"Write jFexEDM tau container"}
private

Definition at line 87 of file jFexRoiByteStreamTool.h.

◆ m_jTEReadKey

SG::ReadHandleKey< xAOD::jFexSumETRoIContainer> jFexRoiByteStreamTool::m_jTEReadKey {this,"jTERoIContainerReadKey" ,"L1_jFexSumETRoI","Read jFexEDM SumET container"}
private

Definition at line 96 of file jFexRoiByteStreamTool.h.

◆ m_jTERes

int jFexRoiByteStreamTool::m_jTERes = 0
private

Definition at line 121 of file jFexRoiByteStreamTool.h.

◆ m_jTEWriteKey

SG::WriteHandleKey< xAOD::jFexSumETRoIContainer> jFexRoiByteStreamTool::m_jTEWriteKey {this,"jTERoIContainerWriteKey" ,"L1_jFexSumETRoI","Write jFexEDM SumET container"}
private

Definition at line 88 of file jFexRoiByteStreamTool.h.

◆ m_jXEReadKey

SG::ReadHandleKey< xAOD::jFexMETRoIContainer > jFexRoiByteStreamTool::m_jXEReadKey {this,"jXERoIContainerReadKey" ,"L1_jFexMETRoI" ,"Read jFexEDM Met container"}
private

Definition at line 97 of file jFexRoiByteStreamTool.h.

◆ m_jXERes

int jFexRoiByteStreamTool::m_jXERes = 0
private

Definition at line 120 of file jFexRoiByteStreamTool.h.

◆ m_jXEWriteKey

SG::WriteHandleKey< xAOD::jFexMETRoIContainer > jFexRoiByteStreamTool::m_jXEWriteKey {this,"jXERoIContainerWriteKey" ,"L1_jFexMETRoI" ,"Write jFexEDM Met container"}
private

Definition at line 89 of file jFexRoiByteStreamTool.h.

◆ m_l1MenuKey

SG::ReadHandleKey<TrigConf::L1Menu> jFexRoiByteStreamTool::m_l1MenuKey {this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu","Name of the L1Menu object to read configuration from"}
private

Definition at line 81 of file jFexRoiByteStreamTool.h.

◆ m_monTool

ToolHandle<GenericMonitoringTool> jFexRoiByteStreamTool::m_monTool {this,"MonTool","","Monitoring tool"}
private

Definition at line 69 of file jFexRoiByteStreamTool.h.

◆ m_robIds

Gaudi::Property<std::vector<uint32_t> > jFexRoiByteStreamTool::m_robIds {this, "ROBIDs", {}, "List of ROB IDs required for conversion to/from xAOD RoI"}
private

Definition at line 75 of file jFexRoiByteStreamTool.h.

◆ m_TobMapping

Gaudi::Property<std::string> jFexRoiByteStreamTool::m_TobMapping {this, "jFexTobMapping", "L1CaloFEXByteStream/2022-10-19/jFexTobMap.txt", "Text file to convert from hardware internal coordinates to eta-phi location"}
private

Definition at line 78 of file jFexRoiByteStreamTool.h.

◆ m_TobPos_map

std::unordered_map<unsigned int, std::array<float,2> > jFexRoiByteStreamTool::m_TobPos_map
private

Definition at line 130 of file jFexRoiByteStreamTool.h.

◆ m_UseMonitoring

bool jFexRoiByteStreamTool::m_UseMonitoring = false
private

Definition at line 70 of file jFexRoiByteStreamTool.h.

◆ s_etaBit

const int jFexRoiByteStreamTool::s_etaBit = 5
staticprivate

Definition at line 111 of file jFexRoiByteStreamTool.h.

◆ s_etaMask

const int jFexRoiByteStreamTool::s_etaMask = 0x1f
staticprivate

Definition at line 113 of file jFexRoiByteStreamTool.h.

◆ s_phiBit

const int jFexRoiByteStreamTool::s_phiBit = 1
staticprivate

Definition at line 112 of file jFexRoiByteStreamTool.h.

◆ s_phiMask

const int jFexRoiByteStreamTool::s_phiMask = 0xf
staticprivate

Definition at line 114 of file jFexRoiByteStreamTool.h.


The documentation for this class was generated from the following files:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
PathResolver::find_calib_file
static std::string find_calib_file(const std::string &logical_file_name)
Definition: PathResolver.cxx:384
jFexRoiByteStreamTool::ReadfromFile
StatusCode ReadfromFile(const std::string &)
Definition: jFexRoiByteStreamTool.cxx:685
jFexRoiByteStreamTool::s_etaBit
static const int s_etaBit
Definition: jFexRoiByteStreamTool.h:111
jFexRoiByteStreamTool::m_jTEWriteKey
SG::WriteHandleKey< xAOD::jFexSumETRoIContainer > m_jTEWriteKey
Definition: jFexRoiByteStreamTool.h:88
CxxUtils::span
span(T *ptr, std::size_t sz) -> span< T >
A couple needed deduction guides.
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
Undefined
@ Undefined
Definition: MaterialTypes.h:8
jFexRoiByteStreamTool::m_jTERes
int m_jTERes
Definition: jFexRoiByteStreamTool.h:121
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
jFexRoiByteStreamTool::mapIndex
constexpr static unsigned int mapIndex(unsigned int jfex, unsigned int fpga, unsigned int iEta, unsigned int iPhi)
Definition: jFexRoiByteStreamTool.cxx:733
jFexRoiByteStreamTool::m_TobPos_map
std::unordered_map< unsigned int, std::array< float, 2 > > m_TobPos_map
Definition: jFexRoiByteStreamTool.h:130
xAOD::word1
word1
Definition: eFexEMRoI_v1.cxx:82
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
index
Definition: index.py:1
TrigConf::L1ThrExtraInfo_jTE
Definition: L1ThrExtraInfo.h:554
skel.it
it
Definition: skel.GENtoEVGEN.py:396
jFexRoiByteStreamTool::xTOBCounterTrailer
std::array< uint32_t, 4 > xTOBCounterTrailer(uint32_t word) const
Definition: jFexRoiByteStreamTool.cxx:600
jFexRoiByteStreamTool::m_jTEReadKey
SG::ReadHandleKey< xAOD::jFexSumETRoIContainer > m_jTEReadKey
Definition: jFexRoiByteStreamTool.h:96
detail
Definition: extract_histogram_tag.cxx:14
jFexRoiByteStreamTool::TOBCounterTrailer
std::array< uint32_t, 6 > TOBCounterTrailer(uint32_t word) const
Definition: jFexRoiByteStreamTool.cxx:575
PixelByteStreamErrors::Decoding
@ Decoding
Definition: PixelByteStreamErrors.h:14
jFexRoiByteStreamTool::jFEXtoRODTrailer
std::array< uint32_t, 4 > jFEXtoRODTrailer(uint32_t word0, uint32_t word1) const
Definition: jFexRoiByteStreamTool.cxx:620
TrigConf::L1ThrExtraInfo_jXE
Definition: L1ThrExtraInfo.h:542
TrigConf::DataStructure::isValid
bool isValid() const
Definition: DataStructure.h:215
ROBF
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment ROBF
Definition: ByteStreamMergeOutputSvc.cxx:16
jFexRoiByteStreamTool::RODTrailer
std::array< uint32_t, 1 > RODTrailer(uint32_t word0, uint32_t word1) const
Definition: jFexRoiByteStreamTool.cxx:649
jFexRoiByteStreamTool::m_jLJWriteKey
SG::WriteHandleKey< xAOD::jFexLRJetRoIContainer > m_jLJWriteKey
Definition: jFexRoiByteStreamTool.h:86
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
jFexRoiByteStreamTool::m_jJRes
int m_jJRes
Definition: jFexRoiByteStreamTool.h:117
jFexRoiByteStreamTool::m_jXEWriteKey
SG::WriteHandleKey< xAOD::jFexMETRoIContainer > m_jXEWriteKey
Definition: jFexRoiByteStreamTool.h:89
jFexRoiByteStreamTool::m_jXEReadKey
SG::ReadHandleKey< xAOD::jFexMETRoIContainer > m_jXEReadKey
Definition: jFexRoiByteStreamTool.h:97
jFexRoiByteStreamTool::m_jJReadKey
SG::ReadHandleKey< xAOD::jFexSRJetRoIContainer > m_jJReadKey
Definition: jFexRoiByteStreamTool.h:93
jFexRoiByteStreamTool::m_jEMReadKey
SG::ReadHandleKey< xAOD::jFexFwdElRoIContainer > m_jEMReadKey
Definition: jFexRoiByteStreamTool.h:98
jFexRoiByteStreamTool::getEtaPhi
std::array< float, 2 > getEtaPhi(unsigned int jfex, unsigned int fpga, uint32_t word, const char *obj) const
Definition: jFexRoiByteStreamTool.cxx:747
lumiFormat.i
int i
Definition: lumiFormat.py:85
jFexRoiByteStreamTool::m_jEMRes
int m_jEMRes
Definition: jFexRoiByteStreamTool.h:119
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
jFexRoiByteStreamTool::printError
void printError(const std::string &location, const std::string &title, MSG::Level type, const std::string &detail) const
{map index, {eta,phi}}
Definition: jFexRoiByteStreamTool.cxx:796
jFexRoiByteStreamTool::s_phiBit
static const int s_phiBit
Definition: jFexRoiByteStreamTool.h:112
jFexRoiByteStreamTool::m_l1MenuKey
SG::ReadHandleKey< TrigConf::L1Menu > m_l1MenuKey
Definition: jFexRoiByteStreamTool.h:81
jFexRoiByteStreamTool::unpackLocalCoords
std::array< uint8_t, 2 > unpackLocalCoords(uint32_t word) const
Definition: jFexRoiByteStreamTool.cxx:738
covarianceTool.title
title
Definition: covarianceTool.py:542
calibdata.exception
exception
Definition: calibdata.py:496
jFexRoiByteStreamTool::s_phiMask
static const int s_phiMask
Definition: jFexRoiByteStreamTool.h:114
test_pyathena.parent
parent
Definition: test_pyathena.py:15
jFexRoiByteStreamTool::m_robIds
Gaudi::Property< std::vector< uint32_t > > m_robIds
Definition: jFexRoiByteStreamTool.h:75
jFexRoiByteStreamTool::m_UseMonitoring
bool m_UseMonitoring
Definition: jFexRoiByteStreamTool.h:70
jFexRoiByteStreamTool::s_etaMask
static const int s_etaMask
Definition: jFexRoiByteStreamTool.h:113
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
jFexRoiByteStreamTool::m_TobMapping
Gaudi::Property< std::string > m_TobMapping
Definition: jFexRoiByteStreamTool.h:78
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
jFexRoiByteStreamTool::m_jJWriteKey
SG::WriteHandleKey< xAOD::jFexSRJetRoIContainer > m_jJWriteKey
Definition: jFexRoiByteStreamTool.h:85
jFexRoiByteStreamTool::m_convertExtendedTOBs
Gaudi::Property< bool > m_convertExtendedTOBs
Definition: jFexRoiByteStreamTool.h:76
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TrigConf::L1ThrExtraInfo_jTAU
Definition: L1ThrExtraInfo.h:296
TrigConf::L1ThrExtraInfoBase::resolutionMeV
unsigned int resolutionMeV() const
Definition: L1ThresholdBase.h:101
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
Trk::iPhi
@ iPhi
Definition: ParamDefs.h:47
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition: page_access.h:11
jFexRoiByteStreamTool::m_jEMWriteKey
SG::WriteHandleKey< xAOD::jFexFwdElRoIContainer > m_jEMWriteKey
Definition: jFexRoiByteStreamTool.h:90
jFexRoiByteStreamTool::m_jLJRes
int m_jLJRes
Definition: jFexRoiByteStreamTool.h:118
jFexRoiByteStreamTool::m_jLJReadKey
SG::ReadHandleKey< xAOD::jFexLRJetRoIContainer > m_jLJReadKey
Definition: jFexRoiByteStreamTool.h:94
jFexRoiByteStreamTool::m_jTauRes
int m_jTauRes
Definition: jFexRoiByteStreamTool.h:116
TrigConf::L1ThrExtraInfo_jLJ
Definition: L1ThrExtraInfo.h:435
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
TrigConf::L1ThrExtraInfo_jEM
Definition: L1ThrExtraInfo.h:189
get_generator_info.error
error
Definition: get_generator_info.py:40
jFexRoiByteStreamTool::m_jTauWriteKey
SG::WriteHandleKey< xAOD::jFexTauRoIContainer > m_jTauWriteKey
Definition: jFexRoiByteStreamTool.h:87
python.PyAthena.obj
obj
Definition: PyAthena.py:132
jFexRoiByteStreamTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: jFexRoiByteStreamTool.h:69
xAOD::iEta
setScale setgFexType iEta
Definition: gFexJetRoI_v1.cxx:74
error
Definition: IImpactPoint3dEstimator.h:70
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
jFexRoiByteStreamTool::m_jTauReadKey
SG::ReadHandleKey< xAOD::jFexTauRoIContainer > m_jTauReadKey
Definition: jFexRoiByteStreamTool.h:95
jFexRoiByteStreamTool::m_jXERes
int m_jXERes
Definition: jFexRoiByteStreamTool.h:120
TrigConf::L1ThrExtraInfo_jJ
Definition: L1ThrExtraInfo.h:390