80 {
81
82
83
84
85 SG::WriteHandle<xAOD::jFexTowerContainer> jTowersContainer(
m_jTowersWriteKey, ctx);
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
92 for (
const ROBF* rob : vrobf) {
93
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
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
108 unsigned int trailers_pos = rob->rod_ndata();
109
110
111 bool READ_WORDS = true;
112 while(READ_WORDS){
113
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
129
130 if(error != 0 ){
131
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
191 }
192
194 std::stringstream sdetail;
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
208
209
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
221 printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str());
222 return StatusCode::SUCCESS;
223
224
225
226
227 }
228
229 for (unsigned int iblock = 0; iblock < Max_iter; iblock++){
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
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
247
248 for(
uint idata = 0; idata < allDATA.size(); idata++){
249
251
252
253
254
255 unsigned int intID =
mapIndex(jfex, fpga, channel, idata);
256
257
260
261
262
263 continue;
264 }
265
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
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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
304 }
305
306
308
309 if(trailers_pos == 0){
310 READ_WORDS = false;
311 }
312 }
313 }
314
315 return StatusCode::SUCCESS;
316}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment ROBF
static constexpr uint32_t ERROR_SAFE_MODE
static constexpr uint32_t ERROR_HEADER_MISMATCH
static constexpr uint32_t BS_MERGE_DATA
static constexpr uint32_t ROD_TRAILER_1b
Masking words.
static constexpr uint32_t DATA_WORDS_PER_BLOCK
static constexpr uint32_t BS_TRAILER_1b
Masking words.
static constexpr uint32_t ERROR_CORR_TRAILER
static constexpr uint32_t jFEX2ROD_WORDS
static constexpr uint32_t ERROR_PROC_TIMEOUT
static constexpr uint32_t ERROR_PROTOCOL_ERROR
static constexpr uint32_t DATA_BLOCKS
static constexpr uint32_t ERROR_LENGTH_MISMATCH
setScale setgFexType iEta