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

Implementation of a tool for L1 input data conversion from BS to xAOD and from xAOD to BS (IL1TriggerByteStreamTool interface) More...

#include <jFexInputByteStreamTool.h>

Inheritance diagram for jFexInputByteStreamTool:
Collaboration diagram for jFexInputByteStreamTool:

Public Member Functions

 jFexInputByteStreamTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~jFexInputByteStreamTool () override=default
 
virtual StatusCode initialize () 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, 4 > jFEXtoRODTrailer (uint32_t, uint32_t) const
 
std::array< uint16_t, 2 > BulkStreamTrailer (uint32_t, uint32_t, uint32_t) const
 
std::array< uint16_t, 3 > Dataformat1 (uint32_t) const
 
std::array< uint16_t, 4 > Dataformat2 (uint32_t) 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, {IDsimulation,eta,phi,source,iEta,iPhi}} More...
 

Static Private Member Functions

constexpr static unsigned int mapIndex (unsigned int jfex, unsigned int fpga, unsigned int channel, unsigned int tower)
 

Private Attributes

ToolHandle< GenericMonitoringToolm_monTool {this,"MonTool","","Monitoring tool"}
 
bool m_UseMonitoring = false
 
Gaudi::Property< bool > m_doThinning {this, "DoThinning" , true, "Remove overlapped towers. Only FPGA Core region is saved"}
 
Gaudi::Property< std::vector< uint32_t > > m_robIds {this, "ROBIDs", {}, "List of ROB IDs required for conversion to/from xAOD RoI"}
 
Gaudi::Property< std::string > m_FiberMapping {this, "jFexTowerMapping", "L1CaloFEXByteStream/2023-08-01/jFexTowerMap.txt", "Text file to convert from hardware fiber to eta-phi location"}
 
SG::WriteHandleKey< xAOD::jFexTowerContainerm_jTowersWriteKey {this,"jTowersWriteKey" ,"L1_jFexDataTowers","Write jFexEDM Trigger Tower container"}
 
SG::ReadHandleKey< xAOD::jFexTowerContainerm_jTowersReadKey {this,"jTowersReadKey" ,"L1_jFexDataTowers","Read jFexEDM Trigger Tower container"}
 
std::unordered_map< unsigned int, std::array< float, 6 > > m_Firm2Tower_map
 

Detailed Description

Implementation of a tool for L1 input data conversion from BS to xAOD and from xAOD to BS (IL1TriggerByteStreamTool interface)

Definition at line 33 of file jFexInputByteStreamTool.h.

Constructor & Destructor Documentation

◆ jFexInputByteStreamTool()

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

Definition at line 41 of file jFexInputByteStreamTool.cxx.

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

◆ ~jFexInputByteStreamTool()

virtual jFexInputByteStreamTool::~jFexInputByteStreamTool ( )
overridevirtualdefault

Member Function Documentation

◆ BulkStreamTrailer()

std::array< uint16_t, 2 > jFexInputByteStreamTool::BulkStreamTrailer ( uint32_t  word0,
uint32_t  word1,
uint32_t  jfex 
) const
private

Definition at line 333 of file jFexInputByteStreamTool.cxx.

333  {
334 
335  uint16_t Satur_high = ((word1 >> jBits::BS_SATUR_1_TRAILER ) & jBits::BS_TRAILER_8b );
336  uint16_t Satur_down = ((word1 >> jBits::BS_SATUR_0_TRAILER ) & jBits::BS_TRAILER_8b );
337  uint16_t Channel = ((word0 >> jBits::BS_CHANNEL_TRAILER ) & jBits::BS_TRAILER_8b );
338 
339  //Tile fibre are decoded differently, no saturation bits are set for tile
340  bool isTileFibre = false;
341  for(unsigned int i=0; i< jBits::tile_channels.at(jfex).size(); i++){
342  if(jBits::tile_channels.at(jfex).at(i) == Channel){
343  isTileFibre=true;
344  break;
345  }
346  }
347 
348  if(isTileFibre){
349  //If it is tile then return just the channel number and sat = 0
350  return {Channel, 0};
351  }
352 
353  uint16_t Satur = ( Satur_high << jBits::BS_SATUR_1_TRAILER ) + Satur_down;
354 
355  return {Channel, Satur};
356 
357 }

◆ convertFromBS()

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

BS->xAOD conversion.

Definition at line 80 of file jFexInputByteStreamTool.cxx.

80  {
81 
82  //WriteHandle for jFEX EDMs
83 
84  //---jTower EDM
86  ATH_CHECK(jTowersContainer.record(std::make_unique<xAOD::jFexTowerContainer>(), std::make_unique<xAOD::jFexTowerAuxContainer>()));
87  ATH_MSG_DEBUG("Recorded jFexTowerContainer with key " << jTowersContainer.key());
88 
89 
90 
91  // Iterate over ROBFragments to decode
92  for (const ROBF* rob : vrobf) {
93  // Iterate over ROD words and decode
94 
95 
96  ATH_MSG_DEBUG("Starting to decode " << rob->rod_ndata() << " ROD words from ROB 0x" << std::hex << rob->rob_source_id() << std::dec);
97 
98  //There is no data to decode.. not even the ROD trailers
99  if(rob->rod_ndata() <= 0){
100  ATH_MSG_DEBUG(C.B_RED<<" No ROD words to decode: " << rob->rod_ndata() <<" in ROB 0x"<< std::hex << rob->rob_source_id()<< std::dec <<". Skipping"<<C.END);
101  continue;
102  }
103 
104  const auto dataArray = std::span{rob->rod_data(), rob->rod_ndata()};
105  std::vector<uint32_t> vec_words(dataArray.begin(),dataArray.end());
106 
107  // jFEX to ROD trailer position
108  unsigned int trailers_pos = rob->rod_ndata();
109 
110  // Starting to loop over the different jFEX blocks
111  bool READ_WORDS = true;
112  while(READ_WORDS){
113 
114  if( trailers_pos < jBits::jFEX2ROD_WORDS ){
115  std::stringstream sdetail;
116  sdetail << "There are not enough words ("<< trailers_pos <<") for the jFEX to ROD trailer decoder. Expected at least " << jBits::jFEX2ROD_WORDS<<". Skipping this FPGA(?)" ;
117  std::stringstream slocation;
118  slocation << "0x"<< std::hex << rob->rob_source_id();
119  std::stringstream stitle;
120  stitle << "Invalid trailer words" ;
121  printError(slocation.str(),stitle.str(),MSG::WARNING,sdetail.str());
122 
123 
124  READ_WORDS = false;
125  continue;
126  }
127 
128  const auto [payload, jfex, fpga, error] = jFEXtoRODTrailer ( vec_words.at(trailers_pos-2), vec_words.at(trailers_pos-1) );
129 
130  if(error != 0 ){
131 
132  bool corTrailer = ((error >> jBits::ERROR_CORR_TRAILER ) & jBits::ROD_TRAILER_1b);
133  bool safemode = ((error >> jBits::ERROR_SAFE_MODE ) & jBits::ROD_TRAILER_1b);
134  bool proterror = ((error >> jBits::ERROR_PROTOCOL_ERROR ) & jBits::ROD_TRAILER_1b);
135  bool lenerror = ((error >> jBits::ERROR_LENGTH_MISMATCH ) & jBits::ROD_TRAILER_1b);
136  bool headmismatch = ((error >> jBits::ERROR_HEADER_MISMATCH ) & jBits::ROD_TRAILER_1b);
137  bool processerror = ((error >> jBits::ERROR_PROC_TIMEOUT ) & jBits::ROD_TRAILER_1b);
138 
139  std::stringstream sdetail;
140  sdetail << "jFEX to ROD Trailer Error bits set - 6-bits error word: 0x"<< std::hex <<error << std::dec<< std::endl;
141  sdetail << "Corrective Trailer: "<< corTrailer << std::endl;
142  sdetail << "Safe Mode : "<< safemode << std::endl;
143  sdetail << "Protocol error : "<< proterror << std::endl;
144  sdetail << "Length Mismatch : "<< lenerror << std::endl;
145  sdetail << "Header Mismatch : "<< headmismatch << std::endl;
146  sdetail << "Processor timeout : "<< processerror << std::endl;
147  std::stringstream slocation;
148  slocation << "Error bit set";
149 
150  if( corTrailer ){
151  std::stringstream stitle;
152  stitle << "Corrective Trailer" ;
153  printError(slocation.str(),stitle.str(),MSG::WARNING,sdetail.str());
154  break;
155  }
156  if( safemode ){
157  std::stringstream stitle;
158  stitle << "Safe Mode" ;
159  printError(slocation.str(),stitle.str(),MSG::WARNING,sdetail.str());
160  break;
161  }
162  if( proterror ){
163  std::stringstream stitle;
164  stitle << "Protocol error" ;
165  printError(slocation.str(),stitle.str(),MSG::WARNING,sdetail.str());
166  break;
167  }
168  if( lenerror ){
169  std::stringstream stitle;
170  stitle << "Length mismatch" ;
171  printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str());
172  break;
173  }
174  if( headmismatch ){
175  std::stringstream stitle;
176  stitle << "Header mismatch" ;
177  printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str());
178  break;
179  }
180  if( processerror ){
181  std::stringstream stitle;
182  stitle << "Processor Timeout" ;
183  printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str());
184  break;
185  }
186  break;
187  }
188 
189  if(payload % jBits::DATA_BLOCKS != 0){
190  ATH_MSG_DEBUG(" Not full readout activated (" << payload << "). Data blocks/channels expected (" << jBits::DATA_BLOCKS <<")"<<C.END);
191  }
192 
193  if(payload % jBits::DATA_WORDS_PER_BLOCK != 0) {
194  std::stringstream sdetail;
195  sdetail << " Payload number (" << payload << ") not a multiple of data words per channel. Expected: " << jBits::DATA_WORDS_PER_BLOCK ;
196  std::stringstream slocation;
197  slocation << "jFEX "<< jfex << " FPGA "<< fpga << " in 0x"<< std::hex << rob->rob_source_id();
198  std::stringstream stitle;
199  stitle << "Invalid Data Blocks" ;
200  printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str());
201 
202  READ_WORDS = false;
203  continue;
204  }
205 
206  //Position index, 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
207  unsigned int wordIndex = trailers_pos - (jBits::jFEX2ROD_WORDS);
208 
209  // Number of iterations that must be done. It is divisible otherwise it throws out an error (Line 108)
210  unsigned int Max_iter = payload/jBits::DATA_WORDS_PER_BLOCK;
211 
212  if(Max_iter>trailers_pos) {
213  std::stringstream sdetail;
214  sdetail << "Block size error in fragment 0x"<< std::hex << rob->rob_source_id() << std::dec<<". Words available: " << trailers_pos << ". Number of words wanted to decode: " << Max_iter ;
215  std::stringstream slocation;
216  slocation << "jFEX "<< jfex << " FPGA "<< fpga << " in 0x"<< std::hex << rob->rob_source_id();
217  std::stringstream stitle;
218  stitle << "Block Size Error" ;
219 
220  //Currently under investigation...
221  printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str());
222  return StatusCode::SUCCESS;
223 
224  //DO NOT REMOVE, once fixed it should return and error and FAILURE
225  //printError(slocation.str(),stitle.str(),m_ERROR,sdetail.str());
226  //return StatusCode::FAILURE;
227  }
228 
229  for (unsigned int iblock = 0; iblock < Max_iter; iblock++){
230  const auto [channel, saturation] = BulkStreamTrailer(vec_words.at(wordIndex-1),vec_words.at(wordIndex-2), jfex);
231 
232  const auto [DATA13_low , DATA15, DATA14] = Dataformat1(vec_words.at(wordIndex-3));
233  const auto [DATA13_up,DATA10_up , DATA12, DATA11] = Dataformat2(vec_words.at(wordIndex-4));
234  const auto [DATA10_low , DATA9 , DATA8 ] = Dataformat1(vec_words.at(wordIndex-5));
235  const auto [DATA5_low , DATA7 , DATA6 ] = Dataformat1(vec_words.at(wordIndex-6));
236  const auto [DATA5_up ,DATA2_up , DATA4 , DATA3 ] = Dataformat2(vec_words.at(wordIndex-7));
237  const auto [DATA2_low , DATA1 , DATA0 ] = Dataformat1(vec_words.at(wordIndex-8));
238 
239  //uncomment for mergeing splitted Et
240  uint16_t DATA2 = ( DATA2_up << jBits::BS_MERGE_DATA ) + DATA2_low;
241  uint16_t DATA5 = ( DATA5_up << jBits::BS_MERGE_DATA ) + DATA5_low;
242  uint16_t DATA10 = ( DATA10_up << jBits::BS_MERGE_DATA ) + DATA10_low;
243  uint16_t DATA13 = ( DATA13_up << jBits::BS_MERGE_DATA ) + DATA13_low;
244 
245  std::array<uint16_t,16> allDATA = {DATA0, DATA1, DATA2, DATA3, DATA4, DATA5, DATA6, DATA7, DATA8, DATA9, DATA10, DATA11, DATA12, DATA13, DATA14, DATA15 };
246  //std::array<uint16_t,16> allsat = {0};
247 
248  for(uint idata = 0; idata < allDATA.size(); idata++){
249 
250  char et_saturation = ((saturation >> idata) & jBits::BS_TRAILER_1b);
251 
252  //allsat[idata] = et_saturation;
253 
254  // read ID, eta and phi from map
255  unsigned int intID = mapIndex(jfex, fpga, channel, idata);
256 
257  // Exists the jTower in the mapping?
258  auto it_Firm2Tower_map = m_Firm2Tower_map.find(intID);
259  if(it_Firm2Tower_map == m_Firm2Tower_map.end()){
260 
261  // jTower not found in the mapping.. skipping.
262  // If we are here means that the jTower is not actually used in the firmware
263  continue;
264  }
265 
266  const auto [IDsim, eta, phi, source, iEta, iPhi] = it_Firm2Tower_map->second;
267 
268  std::vector<uint16_t> vtower_ET;
269  vtower_ET.clear();
270  vtower_ET.push_back(allDATA[idata]);
271 
272  std::vector<char> vtower_SAT;
273  vtower_SAT.clear();
274  vtower_SAT.push_back(et_saturation);
275 
276  //initilize the jTower EDM
277  jTowersContainer->push_back( std::make_unique<xAOD::jFexTower>() );
278  jTowersContainer->back()->initialize(eta, phi, iEta, iPhi, IDsim, source, vtower_ET, jfex, fpga, channel, idata, vtower_SAT );
279 
280  if( m_doThinning && !jTowersContainer->back()->isCore() ){
281  jTowersContainer->pop_back();
282  }
283  }
284 
285  // keeping this for future x-checks
286  //if(m_verbose ){
287 
288  //printf("DATA00 :%5x DATA01 :%5x DATA02_lo :%5x\n" , DATA0 ,DATA1 ,DATA2_low);
289  //printf("DATA03 :%5x DATA04 :%5x DATA02_up :%5x DATA05_up :%5x\n" , DATA3 ,DATA4 ,DATA2_up ,DATA5_up);
290  //printf("DATA06 :%5x DATA07 :%5x DATA05_lo :%5x\n" , DATA6 ,DATA7 ,DATA5_low);
291  //printf("DATA08 :%5x DATA09 :%5x DATA10_lo :%5x\n" , DATA8 ,DATA9 ,DATA10_low);
292  //printf("DATA11 :%5x DATA12 :%5x DATA10_up :%5x DATA13_up :%5x\n" , DATA11 ,DATA12 ,DATA10_up ,DATA13_up );
293  //printf("DATA14 :%5x DATA15 :%5x DATA13_lo :%5x\n" , DATA14 ,DATA15 ,DATA13_low);
294  //printf("*merged* DATA02 :%5x DATA05 :%5x DATA10 :%5x DATA13 :%5x\n" , DATA2 ,DATA5 ,DATA10 ,DATA13 );
295 
296  //printf("DATA0 :%5d DATA1 :%5d DATA2 :%5d DATA3 :%5d\n",allsat[0] ,allsat[1] ,allsat[2] ,allsat[3] );
297  //printf("DATA4 :%5d DATA5 :%5d DATA6 :%5d DATA7 :%5d\n",allsat[4] ,allsat[5] ,allsat[6] ,allsat[7] );
298  //printf("DATA8 :%5d DATA8 :%5d DATA10:%5d DATA11:%5d\n",allsat[8] ,allsat[9] ,allsat[10] ,allsat[11] );
299  //printf("DATA12:%5d DATA13:%5d DATA14:%5d DATA15:%5d\n",allsat[12] ,allsat[13] ,allsat[14] ,allsat[15] );
300  //}
301 
302 
303  wordIndex -= jBits::DATA_WORDS_PER_BLOCK;
304  }
305 
306  //moving trailer position index to the next jFEX data block
307  trailers_pos -= (payload + jBits::jFEX2ROD_WORDS);
308 
309  if(trailers_pos == 0){
310  READ_WORDS = false;
311  }
312  }
313  }
314 
315  return StatusCode::SUCCESS;
316 }

◆ convertToBS()

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

xAOD->BS conversion

Definition at line 385 of file jFexInputByteStreamTool.cxx.

385  {
386 
387 /*
388  // Retrieve the RoI container
389  auto muonRoIs = SG::makeHandle(m_roiReadKey, eventContext);
390  ATH_CHECK(muonRoIs.isValid());
391 
392  // Clear BS data cache
393  clearCache(eventContext);
394 
395  // Create raw ROD data words
396  ATH_MSG_DEBUG("Converting " << muonRoIs->size() << " L1 Muon RoIs to ByteStream");
397  uint32_t* data = newRodData(eventContext, muonRoIs->size());
398  for (size_t i=0; i<muonRoIs->size(); ++i) {
399  data[i] = muonRoIs->at(i)->roiWord();
400  }
401 
402  // Create ROBFragment containing the ROD words
403  const eformat::helper::SourceIdentifier sid(eformat::TDAQ_MUON_CTP_INTERFACE, m_muCTPIModuleID.value());
404  vrobf.push_back(newRobFragment(
405  eventContext,
406  sid.code(),
407  muonRoIs->size(),
408  data,
409  eformat::STATUS_BACK // status_position is system-specific
410  ));
411 */
412  return StatusCode::SUCCESS;
413 }

◆ Dataformat1()

std::array< uint16_t, 3 > jFexInputByteStreamTool::Dataformat1 ( uint32_t  word0) const
private

Definition at line 361 of file jFexInputByteStreamTool.cxx.

361  {
362 
363  uint16_t data_low = ((word0 >> jBits::BS_ET_DATA_0 ) & jBits::BS_TRAILER_12b);
364  uint16_t data_mid = ((word0 >> jBits::BS_ET_DATA_1 ) & jBits::BS_TRAILER_12b );
365  uint16_t data_up = ((word0 >> jBits::BS_ET_DATA_4 ) & jBits::BS_TRAILER_8b );
366 
367  return {data_up,data_mid,data_low};
368 }

◆ Dataformat2()

std::array< uint16_t, 4 > jFexInputByteStreamTool::Dataformat2 ( uint32_t  word0) const
private

Definition at line 372 of file jFexInputByteStreamTool.cxx.

372  {
373 
374  uint16_t data_low = ((word0 >> jBits::BS_ET_DATA_0 ) & jBits::BS_TRAILER_12b);
375  uint16_t data_mid = ((word0 >> jBits::BS_ET_DATA_1 ) & jBits::BS_TRAILER_12b );
376  uint16_t data_up_1 = ((word0 >> jBits::BS_ET_DATA_4 ) & jBits::BS_TRAILER_4b );
377  uint16_t data_up_2 = ((word0 >> jBits::BS_ET_DATA_7 ) & jBits::BS_TRAILER_4b );
378 
379  return {data_up_2,data_up_1,data_mid,data_low};
380 }

◆ initialize()

StatusCode jFexInputByteStreamTool::initialize ( )
overridevirtual

Definition at line 46 of file jFexInputByteStreamTool.cxx.

46  {
47 
48  ATH_MSG_INFO( "Initializing L1CaloFEXByteStream/jFexInputByteStreamTool algorithm with name: "<< name());
49  ATH_MSG_INFO( "Reading into SG key: "<< m_jTowersReadKey);
50  ATH_MSG_INFO( "Writting into SG key: "<< m_jTowersWriteKey);
51  ATH_MSG_INFO( "Thinnig towers: "<< m_doThinning);
52 
53 
54  // Conversion mode for jTowers
55  ConversionMode jTowersmode = getConversionMode(m_jTowersReadKey, m_jTowersWriteKey, msg());
57  ATH_CHECK(m_jTowersWriteKey.initialize(jTowersmode==ConversionMode::Decoding));
58  ATH_CHECK(m_jTowersReadKey.initialize(jTowersmode==ConversionMode::Encoding));
59  ATH_MSG_DEBUG((jTowersmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " jTowers ROB IDs: " << MSG::hex << m_robIds.value() << MSG::dec);
60 
61 
62 
63  //Since the mapping is constant in everyentry, better to be read in the initialize function
64  //Reading from CVMFS Fiber mapping
66 
67 
68  // Initialize monitoring tool if not empty
69  if (!m_monTool.empty()) {
70  ATH_CHECK(m_monTool.retrieve());
71  ATH_MSG_INFO("Logging errors to " << m_monTool.name() << " monitoring tool");
72  m_UseMonitoring = true;
73  }
74 
75 
76  return StatusCode::SUCCESS;
77 }

◆ jFEXtoRODTrailer()

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

Definition at line 320 of file jFexInputByteStreamTool.cxx.

320  {
321 
322  uint32_t payload = ((word0 >> jBits::PAYLOAD_ROD_TRAILER ) & jBits::ROD_TRAILER_16b);
323  uint32_t jfex = ((word0 >> jBits::jFEX_ROD_TRAILER ) & jBits::ROD_TRAILER_4b );
324  uint32_t fpga = ((word0 >> jBits::FPGA_ROD_TRAILER ) & jBits::ROD_TRAILER_2b );
325 
326  uint32_t error = ((word1 >> jBits::ERROR_ROD_TRAILER ) & jBits::ROD_TRAILER_6b );
327 
328  return {payload,jfex,fpga,error};
329 
330 }

◆ mapIndex()

constexpr unsigned int jFexInputByteStreamTool::mapIndex ( unsigned int  jfex,
unsigned int  fpga,
unsigned int  channel,
unsigned int  tower 
)
staticconstexprprivate

Definition at line 463 of file jFexInputByteStreamTool.cxx.

463  {
464  // values from hardware: jfex=[0,5] 4 bits, fpga=[0,3] 4 bits, channel=[0,59] 8 bits, tower=[0,15] 4 bits
465  return (jfex << 16) | (fpga << 12) | (channel << 4) | tower;
466 }

◆ printError()

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

{map index, {IDsimulation,eta,phi,source,iEta,iPhi}}

Definition at line 468 of file jFexInputByteStreamTool.cxx.

468  {
469 
470  if(m_UseMonitoring){
472  Monitored::Scalar("jfexDecoderErrorLocation",location.empty() ? std::string("UNKNOWN") : location),
473  Monitored::Scalar("jfexDecoderErrorTitle" ,title.empty() ? std::string("UNKNOWN") : title)
474  );
475  }
476  else {
477  msg() << type << detail << endmsg;
478  }
479 }

◆ ReadfromFile()

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

Definition at line 415 of file jFexInputByteStreamTool.cxx.

415  {
416 
417  std::string myline;
418 
419  //openning file with ifstream
420  std::ifstream myfile(fileName);
421 
422  if ( !myfile.is_open() ){
423  ATH_MSG_ERROR("Could not open file:" << fileName);
424  return StatusCode::FAILURE;
425  }
426 
427  //loading the mapping information
428  while ( std::getline (myfile, myline) ) {
429 
430  //removing the header of the file (it is just information!)
431  if(myline[0] == '#') continue;
432 
433  //Splitting myline in different substrings
434  std::stringstream oneLine(myline);
435 
436  //reading elements
437  std::vector<float> elements;
438  std::string element;
439  while(std::getline(oneLine, element, ' '))
440  {
441  elements.push_back(std::stof(element));
442  }
443 
444  // It should have 10 elements
445  // ordered as: jfex fpga channel towerNr source globalEtaIndex globalPhiIndex IDSimulation eta phi
446  if(elements.size() != 10){
447  ATH_MSG_ERROR("Unexpected number of elemennts (10 expected) in file: "<< fileName);
448  return StatusCode::FAILURE;
449  }
450  // building array of <IDSimulation, eta, phi, source, iEta, iPhi>
451  std::array<float,6> aux_arr{ {elements.at(7),elements.at(8),elements.at(9),elements.at(4),elements.at(5),elements.at(6)} };
452 
453  //filling the map with the hash given by mapIndex()
454  m_Firm2Tower_map[ mapIndex(elements.at(0),elements.at(1),elements.at(2),elements.at(3)) ] = aux_arr;
455 
456  }
457  myfile.close();
458 
459  return StatusCode::SUCCESS;
460 }

◆ robIds()

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

Declare ROB IDs for conversion.

Definition at line 49 of file jFexInputByteStreamTool.h.

49  {
50  return m_robIds.value();
51  }

Member Data Documentation

◆ m_doThinning

Gaudi::Property<bool> jFexInputByteStreamTool::m_doThinning {this, "DoThinning" , true, "Remove overlapped towers. Only FPGA Core region is saved"}
private

Definition at line 59 of file jFexInputByteStreamTool.h.

◆ m_FiberMapping

Gaudi::Property<std::string> jFexInputByteStreamTool::m_FiberMapping {this, "jFexTowerMapping", "L1CaloFEXByteStream/2023-08-01/jFexTowerMap.txt", "Text file to convert from hardware fiber to eta-phi location"}
private

Definition at line 65 of file jFexInputByteStreamTool.h.

◆ m_Firm2Tower_map

std::unordered_map<unsigned int, std::array<float,6> > jFexInputByteStreamTool::m_Firm2Tower_map
private

Definition at line 84 of file jFexInputByteStreamTool.h.

◆ m_jTowersReadKey

SG::ReadHandleKey< xAOD::jFexTowerContainer> jFexInputByteStreamTool::m_jTowersReadKey {this,"jTowersReadKey" ,"L1_jFexDataTowers","Read jFexEDM Trigger Tower container"}
private

Definition at line 71 of file jFexInputByteStreamTool.h.

◆ m_jTowersWriteKey

SG::WriteHandleKey< xAOD::jFexTowerContainer> jFexInputByteStreamTool::m_jTowersWriteKey {this,"jTowersWriteKey" ,"L1_jFexDataTowers","Write jFexEDM Trigger Tower container"}
private

Definition at line 68 of file jFexInputByteStreamTool.h.

◆ m_monTool

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

Definition at line 56 of file jFexInputByteStreamTool.h.

◆ m_robIds

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

Definition at line 62 of file jFexInputByteStreamTool.h.

◆ m_UseMonitoring

bool jFexInputByteStreamTool::m_UseMonitoring = false
private

Definition at line 57 of file jFexInputByteStreamTool.h.


The documentation for this class was generated from the following files:
PathResolver::find_calib_file
static std::string find_calib_file(const std::string &logical_file_name)
Definition: PathResolver.cxx:384
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
xAOD::word1
word1
Definition: eFexEMRoI_v1.cxx:82
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
jFexInputByteStreamTool::m_FiberMapping
Gaudi::Property< std::string > m_FiberMapping
Definition: jFexInputByteStreamTool.h:65
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
jFexInputByteStreamTool::mapIndex
constexpr static unsigned int mapIndex(unsigned int jfex, unsigned int fpga, unsigned int channel, unsigned int tower)
Definition: jFexInputByteStreamTool.cxx:463
LArBadChanBlobUtils::Channel
Identifier32::value_type Channel
Definition: LArBadChanBlobUtils.h:24
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
jFexInputByteStreamTool::m_robIds
Gaudi::Property< std::vector< uint32_t > > m_robIds
Definition: jFexInputByteStreamTool.h:62
jFexInputByteStreamTool::Dataformat2
std::array< uint16_t, 4 > Dataformat2(uint32_t) const
Definition: jFexInputByteStreamTool.cxx:372
jFexInputByteStreamTool::m_jTowersWriteKey
SG::WriteHandleKey< xAOD::jFexTowerContainer > m_jTowersWriteKey
Definition: jFexInputByteStreamTool.h:68
color::END
std::string END
Definition: jFexInputByteStreamTool.cxx:32
Data_rel21.DATA15
list DATA15
Definition: Data_rel21.py:7
LVL1::jFEXBits::tile_channels
const std::unordered_map< uint32_t, std::vector< uint16_t > > tile_channels
Definition: jFexBits.h:144
detail
Definition: extract_histogram_tag.cxx:14
jFexInputByteStreamTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: jFexInputByteStreamTool.h:56
jFexInputByteStreamTool::BulkStreamTrailer
std::array< uint16_t, 2 > BulkStreamTrailer(uint32_t, uint32_t, uint32_t) const
Definition: jFexInputByteStreamTool.cxx:333
PixelByteStreamErrors::Decoding
@ Decoding
Definition: PixelByteStreamErrors.h:14
jFexInputByteStreamTool::printError
void printError(const std::string &location, const std::string &title, MSG::Level type, const std::string &detail) const
{map index, {IDsimulation,eta,phi,source,iEta,iPhi}}
Definition: jFexInputByteStreamTool.cxx:468
jFexInputByteStreamTool::m_UseMonitoring
bool m_UseMonitoring
Definition: jFexInputByteStreamTool.h:57
ROBF
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment ROBF
Definition: ByteStreamMergeOutputSvc.cxx:16
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
jFexInputByteStreamTool::ReadfromFile
StatusCode ReadfromFile(const std::string &)
Definition: jFexInputByteStreamTool.cxx:415
jFexInputByteStreamTool::m_doThinning
Gaudi::Property< bool > m_doThinning
Definition: jFexInputByteStreamTool.h:59
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
lumiFormat.i
int i
Definition: lumiFormat.py:92
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
python.sizes.location
string location
Definition: sizes.py:11
covarianceTool.title
title
Definition: covarianceTool.py:542
jFexInputByteStreamTool::Dataformat1
std::array< uint16_t, 3 > Dataformat1(uint32_t) const
Definition: jFexInputByteStreamTool.cxx:361
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
jFexInputByteStreamTool::m_jTowersReadKey
SG::ReadHandleKey< xAOD::jFexTowerContainer > m_jTowersReadKey
Definition: jFexInputByteStreamTool.h:71
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
Trk::iPhi
@ iPhi
Definition: ParamDefs.h:53
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
color::B_RED
std::string B_RED
Definition: jFexInputByteStreamTool.cxx:37
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition: page_access.h:11
jFexInputByteStreamTool::jFEXtoRODTrailer
std::array< uint32_t, 4 > jFEXtoRODTrailer(uint32_t, uint32_t) const
Definition: jFexInputByteStreamTool.cxx:320
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
jFexInputByteStreamTool::m_Firm2Tower_map
std::unordered_map< unsigned int, std::array< float, 6 > > m_Firm2Tower_map
Definition: jFexInputByteStreamTool.h:84
get_generator_info.error
error
Definition: get_generator_info.py:40
xAOD::iEta
setScale setgFexType iEta
Definition: gFexJetRoI_v1.cxx:74
error
Definition: IImpactPoint3dEstimator.h:70
C
struct color C
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7