ATLAS Offline Software
Loading...
Searching...
No Matches
gFexByteStreamTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5//***************************************************************************
6// gFexByteStreamTool - description
7// -------------------
8// begin : 20 07 2022
9// email : cecilia.tosciri@cern.ch
10// ***************************************************************************/
11
12#include "gFexByteStreamTool.h"
14#include "eformat/SourceIdentifier.h"
15#include "eformat/Status.h"
17
18#include <span>
19
22
23namespace gPos = LVL1::gFEXPos;
24
26 const std::string& name,
27 const IInterface* parent)
28 : base_class(type, name, parent) {}
29
31 // Conversion mode for gRho TOBs
32 ATH_MSG_DEBUG(" ROB IDs: " << MSG::hex << m_robIds.value() << MSG::dec);
33
34 // When both read and write keys are empty for standard containers, they are disabled.
35 // This happens in TOBs=False mode: standard L1A containers come from the HLT result
36 // and only gEspresso/gRistretto/OutOfTime containers are decoded from the L1 ROB.
37 const bool stdTOBsEnabled = !m_gFexRhoReadKey.key().empty() || !m_gFexRhoWriteKey.key().empty();
38
39 ConversionMode gRhomode = ConversionMode::Undefined;
40 ConversionMode gSJmode = ConversionMode::Undefined;
41 ConversionMode gLJmode = ConversionMode::Undefined;
42
43 if (stdTOBsEnabled) {
44 gRhomode = getConversionMode(m_gFexRhoReadKey, m_gFexRhoWriteKey, msg());
45 ATH_CHECK(gRhomode!=ConversionMode::Undefined);
46 ATH_CHECK(m_gFexRhoWriteKey.initialize(gRhomode==ConversionMode::Decoding));
47 ATH_CHECK(m_gFexRhoReadKey.initialize(gRhomode==ConversionMode::Encoding));
48 ATH_MSG_DEBUG((gRhomode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " gRho ");
49
50 gSJmode = getConversionMode(m_gFexBlockReadKey, m_gFexBlockWriteKey, msg());
51 ATH_CHECK(gSJmode!=ConversionMode::Undefined);
52 ATH_CHECK(m_gFexBlockWriteKey.initialize(gSJmode==ConversionMode::Decoding));
53 ATH_CHECK(m_gFexBlockReadKey.initialize(gSJmode==ConversionMode::Encoding));
54 ATH_MSG_DEBUG((gSJmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " gSJ ");
55
56 gLJmode = getConversionMode(m_gFexJetReadKey, m_gFexJetWriteKey, msg());
57 ATH_CHECK(gLJmode!=ConversionMode::Undefined);
58 ATH_CHECK(m_gFexJetWriteKey.initialize(gLJmode==ConversionMode::Decoding));
59 ATH_CHECK(m_gFexJetReadKey.initialize(gLJmode==ConversionMode::Encoding));
60 ATH_MSG_DEBUG((gLJmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " gLJ ");
61
62 ConversionMode gScalarEJwojmode = getConversionMode(m_gScalarEJwojReadKey, m_gScalarEJwojWriteKey, msg());
63 ATH_CHECK(gScalarEJwojmode!=ConversionMode::Undefined);
64 ATH_CHECK(m_gScalarEJwojWriteKey.initialize(gScalarEJwojmode==ConversionMode::Decoding));
65 ATH_CHECK(m_gScalarEJwojReadKey.initialize(gScalarEJwojmode==ConversionMode::Encoding));
66 ATH_MSG_DEBUG((gScalarEJwojmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " gScalarEJwoj ");
67
68 ConversionMode gMETComponentsJwojmode = getConversionMode(m_gMETComponentsJwojReadKey, m_gMETComponentsJwojWriteKey, msg());
69 ATH_CHECK(gMETComponentsJwojmode!=ConversionMode::Undefined);
70 ATH_CHECK(m_gMETComponentsJwojWriteKey.initialize(gMETComponentsJwojmode==ConversionMode::Decoding));
71 ATH_CHECK(m_gMETComponentsJwojReadKey.initialize(gMETComponentsJwojmode==ConversionMode::Encoding));
72 ATH_MSG_DEBUG((gMETComponentsJwojmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " gMETComponentsJwoj ");
73
74 ConversionMode gMHTComponentsJwojmode = getConversionMode(m_gMHTComponentsJwojReadKey, m_gMHTComponentsJwojWriteKey, msg());
75 ATH_CHECK(gMHTComponentsJwojmode!=ConversionMode::Undefined);
76 ATH_CHECK(m_gMHTComponentsJwojWriteKey.initialize(gMHTComponentsJwojmode==ConversionMode::Decoding));
77 ATH_CHECK(m_gMHTComponentsJwojReadKey.initialize(gMHTComponentsJwojmode==ConversionMode::Encoding));
78 ATH_MSG_DEBUG((gMHTComponentsJwojmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " gMHTComponentsJwoj ");
79
80 ConversionMode gMSTComponentsJwojmode = getConversionMode(m_gMSTComponentsJwojReadKey, m_gMSTComponentsJwojWriteKey, msg());
81 ATH_CHECK(gMSTComponentsJwojmode!=ConversionMode::Undefined);
82 ATH_CHECK(m_gMSTComponentsJwojWriteKey.initialize(gMSTComponentsJwojmode==ConversionMode::Decoding));
83 ATH_CHECK(m_gMSTComponentsJwojReadKey.initialize(gMSTComponentsJwojmode==ConversionMode::Encoding));
84 ATH_MSG_DEBUG((gMSTComponentsJwojmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " gMSTComponentsJwoj ");
85
86 ConversionMode gMETComponentsNoiseCutmode = getConversionMode(m_gMETComponentsNoiseCutReadKey, m_gMETComponentsNoiseCutWriteKey, msg());
87 ATH_CHECK(gMETComponentsNoiseCutmode!=ConversionMode::Undefined);
88 ATH_CHECK(m_gMETComponentsNoiseCutWriteKey.initialize(gMETComponentsNoiseCutmode==ConversionMode::Decoding));
89 ATH_CHECK(m_gMETComponentsNoiseCutReadKey.initialize(gMETComponentsNoiseCutmode==ConversionMode::Encoding));
90 ATH_MSG_DEBUG((gMETComponentsNoiseCutmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " gMETComponentsNoiseCut ");
91
92 ConversionMode gMETComponentsRmsmode = getConversionMode(m_gMETComponentsRmsReadKey, m_gMETComponentsRmsWriteKey, msg());
93 ATH_CHECK(gMETComponentsRmsmode!=ConversionMode::Undefined);
94 ATH_CHECK(m_gMETComponentsRmsWriteKey.initialize(gMETComponentsRmsmode==ConversionMode::Decoding));
95 ATH_CHECK(m_gMETComponentsRmsReadKey.initialize(gMETComponentsRmsmode==ConversionMode::Encoding));
96 ATH_MSG_DEBUG((gMETComponentsRmsmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " gMETComponentsRms ");
97
98 ConversionMode gScalarENoiseCutmode = getConversionMode(m_gScalarENoiseCutReadKey, m_gScalarENoiseCutWriteKey, msg());
99 ATH_CHECK(gScalarENoiseCutmode!=ConversionMode::Undefined);
100 ATH_CHECK(m_gScalarENoiseCutWriteKey.initialize(gScalarENoiseCutmode==ConversionMode::Decoding));
101 ATH_CHECK(m_gScalarENoiseCutReadKey.initialize(gScalarENoiseCutmode==ConversionMode::Encoding));
102 ATH_MSG_DEBUG((gScalarENoiseCutmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " gScalarENoiseCut ");
103
104 ConversionMode gScalarERmsmode = getConversionMode(m_gScalarERmsReadKey, m_gScalarERmsWriteKey, msg());
105 ATH_CHECK(gScalarERmsmode!=ConversionMode::Undefined);
106 ATH_CHECK(m_gScalarERmsWriteKey.initialize(gScalarERmsmode==ConversionMode::Decoding));
107 ATH_CHECK(m_gScalarERmsReadKey.initialize(gScalarERmsmode==ConversionMode::Encoding));
108 ATH_MSG_DEBUG((gScalarERmsmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " gScalarERms ");
109
110 //checking all Conversion modes.. avoid misconfigurations
111 const std::array<ConversionMode,2> modes{gSJmode,gLJmode};
112 if (std::any_of(modes.begin(),modes.end(),[&gRhomode](ConversionMode m) { return m!=gRhomode; } )) {
113 ATH_MSG_ERROR("Inconsistent conversion modes");
114 return StatusCode::FAILURE;
115 }
116 } else {
117 // Standard L1A containers disabled (decoded from HLT result instead)
118 ATH_MSG_INFO("Standard L1A gFex TOB containers disabled (decoded from HLT result)");
119 ATH_CHECK(m_gFexRhoWriteKey.initialize(false));
120 ATH_CHECK(m_gFexRhoReadKey.initialize(false));
121 ATH_CHECK(m_gFexBlockWriteKey.initialize(false));
122 ATH_CHECK(m_gFexBlockReadKey.initialize(false));
123 ATH_CHECK(m_gFexJetWriteKey.initialize(false));
124 ATH_CHECK(m_gFexJetReadKey.initialize(false));
125 ATH_CHECK(m_gScalarEJwojWriteKey.initialize(false));
126 ATH_CHECK(m_gScalarEJwojReadKey.initialize(false));
127 ATH_CHECK(m_gMETComponentsJwojWriteKey.initialize(false));
128 ATH_CHECK(m_gMETComponentsJwojReadKey.initialize(false));
129 ATH_CHECK(m_gMHTComponentsJwojWriteKey.initialize(false));
130 ATH_CHECK(m_gMHTComponentsJwojReadKey.initialize(false));
131 ATH_CHECK(m_gMSTComponentsJwojWriteKey.initialize(false));
132 ATH_CHECK(m_gMSTComponentsJwojReadKey.initialize(false));
135 ATH_CHECK(m_gMETComponentsRmsWriteKey.initialize(false));
136 ATH_CHECK(m_gMETComponentsRmsReadKey.initialize(false));
137 ATH_CHECK(m_gScalarENoiseCutWriteKey.initialize(false));
138 ATH_CHECK(m_gScalarENoiseCutReadKey.initialize(false));
139 ATH_CHECK(m_gScalarERmsWriteKey.initialize(false));
140 ATH_CHECK(m_gScalarERmsReadKey.initialize(false));
141 }
142
143 // gEspresso and gRistretto are always enabled (not provided by HLT result)
144 ConversionMode gEspressomode = getConversionMode(m_gEspressoReadKey, m_gEspressoWriteKey, msg());
145 ATH_CHECK(gEspressomode!=ConversionMode::Undefined);
146 ATH_CHECK(m_gEspressoWriteKey.initialize(gEspressomode==ConversionMode::Decoding));
147 ATH_CHECK(m_gEspressoReadKey.initialize(gEspressomode==ConversionMode::Encoding));
148 ATH_MSG_DEBUG((gEspressomode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " gEspresso ");
149
150 ConversionMode gRistrettomode = getConversionMode(m_gRistrettoReadKey, m_gRistrettoWriteKey, msg());
151 ATH_CHECK(gRistrettomode!=ConversionMode::Undefined);
152 ATH_CHECK(m_gRistrettoWriteKey.initialize(gRistrettomode==ConversionMode::Decoding));
153 ATH_CHECK(m_gRistrettoReadKey.initialize(gRistrettomode==ConversionMode::Encoding));
154 ATH_MSG_DEBUG((gRistrettomode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " gRistretto ");
155
156 // Initialize multi-slice write handle keys (only if configured with non-empty key)
170
171 // Initialize slice number decoration keys for out-of-time containers.
172 // Multi-slice mode is activated based on m_gFexJetSliceWriteKey being non-empty,
173 // so all decoration keys are initialized based on that same condition.
174 // When multi-slice mode is enabled, all OOT container keys must be configured together.
188
189 ATH_CHECK(m_l1MenuKey.initialize());
190
191 if (!m_monTool.empty()) {
192 ATH_CHECK(m_monTool.retrieve());
193 ATH_MSG_INFO("Logging errors to " << m_monTool.name() << " monitoring tool");
194 m_UseMonitoring = true;
195 }
196
197
198 return StatusCode::SUCCESS;
199}
200
202 // Retrieve the L1 menu configuration
204 ATH_CHECK(l1Menu.isValid());
205
206 try {
207 const auto & l1Menu_gJ = l1Menu->thrExtraInfo().gJ();
208 const auto & l1Menu_gLJ = l1Menu->thrExtraInfo().gLJ();
209 const auto & l1Menu_gXE = l1Menu->thrExtraInfo().gXE();
210 const auto & l1Menu_gTE = l1Menu->thrExtraInfo().gTE();
211
212 ATH_CHECK(l1Menu_gJ.isValid());
213 ATH_CHECK(l1Menu_gLJ.isValid());
214 ATH_CHECK(l1Menu_gXE.isValid());
215 ATH_CHECK(l1Menu_gTE.isValid());
216
217 m_gJ_scale = l1Menu_gJ.resolutionMeV();
218 m_gLJ_scale = l1Menu_gLJ.resolutionMeV();
219 m_gXE_scale = l1Menu_gXE.resolutionMeV();
220 m_gTE_scale = l1Menu_gTE.resolutionMeV();
221 } catch (const std::exception& e) {
222 ATH_MSG_ERROR("Exception reading L1Menu: " << e.what());
223 return StatusCode::FAILURE;
224 }
225
226 return StatusCode::SUCCESS;
227
228}
229
230// BS->xAOD conversion
231StatusCode gFexByteStreamTool::convertFromBS(const std::vector<const ROBF*>& vrobf, const EventContext& ctx) const {
232
233 //WriteHandle for gFEX EDMs
234
235 // Check if standard L1A containers should be decoded (TOBs=True mode)
236 // or are disabled (TOBs=False mode, standard containers come from HLT result)
237 const bool decodeStdTOBs = !m_gFexRhoWriteKey.key().empty();
238
239 //---Standard L1A TOB containers (only created and recorded when decodeStdTOBs is true)
244 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gMETComponentsJwojContainer;
245 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gMHTComponentsJwojContainer;
246 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gMSTComponentsJwojContainer;
247 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gMETComponentsNoiseCutContainer;
248 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gMETComponentsRmsContainer;
249 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gScalarENoiseCutContainer;
251
252 if (decodeStdTOBs) {
264
265 ATH_CHECK(gRhoContainer.record(std::make_unique<xAOD::gFexJetRoIContainer>(), std::make_unique<xAOD::gFexJetRoIAuxContainer>()));
266 ATH_MSG_DEBUG("Recorded gFexJetRoIContainer with key " << gRhoContainer.key());
267 ATH_CHECK(gSJContainer.record(std::make_unique<xAOD::gFexJetRoIContainer>(), std::make_unique<xAOD::gFexJetRoIAuxContainer>()));
268 ATH_MSG_DEBUG("Recorded gFexJetRoIContainer with key " << gSJContainer.key());
269 ATH_CHECK(gLJContainer.record(std::make_unique<xAOD::gFexJetRoIContainer>(), std::make_unique<xAOD::gFexJetRoIAuxContainer>()));
270 ATH_MSG_DEBUG("Recorded gFexJetRoIContainer with key " << gLJContainer.key());
271 ATH_CHECK(gScalarEJwojContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
272 ATH_MSG_DEBUG("Recorded gFexJetGlobalContainer with key " << gScalarEJwojContainer.key());
273 ATH_CHECK(gMETComponentsJwojContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
274 ATH_MSG_DEBUG("Recorded gFexJetGlobalContainer with key " << gMETComponentsJwojContainer.key());
275 ATH_CHECK(gMHTComponentsJwojContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
276 ATH_MSG_DEBUG("Recorded gFexJetGlobalContainer with key " << gMHTComponentsJwojContainer.key());
277 ATH_CHECK(gMSTComponentsJwojContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
278 ATH_MSG_DEBUG("Recorded gFexJetGlobalContainer with key " << gMSTComponentsJwojContainer.key());
279 ATH_CHECK(gMETComponentsNoiseCutContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
280 ATH_MSG_DEBUG("Recorded gFexJetGlobalContainer with key " << gMETComponentsNoiseCutContainer.key());
281 ATH_CHECK(gMETComponentsRmsContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
282 ATH_MSG_DEBUG("Recorded gFexJetGlobalContainer with key " << gMETComponentsRmsContainer.key());
283 ATH_CHECK(gScalarENoiseCutContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
284 ATH_MSG_DEBUG("Recorded gFexJetGlobalContainer with key " << gScalarENoiseCutContainer.key());
285 ATH_CHECK(gScalarERmsContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
286 ATH_MSG_DEBUG("Recorded gFexJetGlobalContainer with key " << gScalarERmsContainer.key());
287 }
288
289 //---gEspresso Container (always decoded - not in HLT result)
291 ATH_CHECK(gEspressoContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
292 ATH_MSG_DEBUG("Recorded gFexJetGlobalContainer with key " << gEspressoContainer.key());
293
294 //---gRistretto Container (always decoded - not in HLT result)
296 ATH_CHECK(gRistrettoContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
297 ATH_MSG_DEBUG("Recorded gFexJetGlobalContainer with key " << gRistrettoContainer.key());
298
299 // Determine if multi-slice mode is enabled (slice 0 = L1A, slices 1,2 = out-of-time)
300 const bool multiSlice = !m_gFexJetSliceWriteKey.empty();
301
302 // Create out-of-time containers for jet TOBs if multi-slice enabled
306 // Create out-of-time containers for global TOBs if multi-slice enabled
307 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gScalarEJwojSliceContainer;
308 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gMETComponentsJwojSliceContainer;
309 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gMHTComponentsJwojSliceContainer;
310 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gMSTComponentsJwojSliceContainer;
311 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gEspressoSliceContainer;
312 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gRistrettoSliceContainer;
313 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gMETComponentsNoiseCutSliceContainer;
314 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gScalarENoiseCutSliceContainer;
315 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gMETComponentsRmsSliceContainer;
316 SG::WriteHandle<xAOD::gFexGlobalRoIContainer> gScalarERmsSliceContainer;
317
318 if (multiSlice) {
320 ATH_CHECK(gRhoSliceContainer.record(std::make_unique<xAOD::gFexJetRoIContainer>(), std::make_unique<xAOD::gFexJetRoIAuxContainer>()));
321 ATH_MSG_DEBUG("Recorded gFexJetRoIContainer (out-of-time) with key " << gRhoSliceContainer.key());
322
324 ATH_CHECK(gSJSliceContainer.record(std::make_unique<xAOD::gFexJetRoIContainer>(), std::make_unique<xAOD::gFexJetRoIAuxContainer>()));
325 ATH_MSG_DEBUG("Recorded gFexJetRoIContainer (out-of-time) with key " << gSJSliceContainer.key());
326
328 ATH_CHECK(gLJSliceContainer.record(std::make_unique<xAOD::gFexJetRoIContainer>(), std::make_unique<xAOD::gFexJetRoIAuxContainer>()));
329 ATH_MSG_DEBUG("Recorded gFexJetRoIContainer (out-of-time) with key " << gLJSliceContainer.key());
330
332 ATH_CHECK(gScalarEJwojSliceContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
333 ATH_MSG_DEBUG("Recorded gFexGlobalRoIContainer (out-of-time) with key " << gScalarEJwojSliceContainer.key());
334
336 ATH_CHECK(gMETComponentsJwojSliceContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
337 ATH_MSG_DEBUG("Recorded gFexGlobalRoIContainer (out-of-time) with key " << gMETComponentsJwojSliceContainer.key());
338
340 ATH_CHECK(gMHTComponentsJwojSliceContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
341 ATH_MSG_DEBUG("Recorded gFexGlobalRoIContainer (out-of-time) with key " << gMHTComponentsJwojSliceContainer.key());
342
344 ATH_CHECK(gMSTComponentsJwojSliceContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
345 ATH_MSG_DEBUG("Recorded gFexGlobalRoIContainer (out-of-time) with key " << gMSTComponentsJwojSliceContainer.key());
346
348 ATH_CHECK(gEspressoSliceContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
349 ATH_MSG_DEBUG("Recorded gFexGlobalRoIContainer (out-of-time) with key " << gEspressoSliceContainer.key());
350
352 ATH_CHECK(gRistrettoSliceContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
353 ATH_MSG_DEBUG("Recorded gFexGlobalRoIContainer (out-of-time) with key " << gRistrettoSliceContainer.key());
354
356 ATH_CHECK(gMETComponentsNoiseCutSliceContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
357 ATH_MSG_DEBUG("Recorded gFexGlobalRoIContainer (out-of-time) with key " << gMETComponentsNoiseCutSliceContainer.key());
358
360 ATH_CHECK(gScalarENoiseCutSliceContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
361 ATH_MSG_DEBUG("Recorded gFexGlobalRoIContainer (out-of-time) with key " << gScalarENoiseCutSliceContainer.key());
362
364 ATH_CHECK(gMETComponentsRmsSliceContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
365 ATH_MSG_DEBUG("Recorded gFexGlobalRoIContainer (out-of-time) with key " << gMETComponentsRmsSliceContainer.key());
366
368 ATH_CHECK(gScalarERmsSliceContainer.record(std::make_unique<xAOD::gFexGlobalRoIContainer>(), std::make_unique<xAOD::gFexGlobalRoIAuxContainer>()));
369 ATH_MSG_DEBUG("Recorded gFexGlobalRoIContainer (out-of-time) with key " << gScalarERmsSliceContainer.key());
370 }
371
372
373 // Iterate over ROBFragments to decode
374 for (const ROBF* rob : vrobf) {
375 // Iterate over ROD words and decode
376
377
378 ATH_MSG_DEBUG("Starting to decode " << rob->rod_ndata() << " ROD words from ROB 0x" << std::hex << rob->rob_source_id());
379
380 //There is no data to decode.. not even the ROD trailers
381 if(rob->rod_ndata() <= 0){
382 continue;
383 }
384
385 const auto dataArray = std::span{rob->rod_data(), rob->rod_ndata()};
386
387
388 // Starting to loop over the gFEX words
389
390 unsigned int n_words = rob->rod_ndata();
391
392 //saving Jet TOBs into the EDM container
393 for(unsigned int iWord=0; iWord<n_words; iWord++) {
394 ATH_MSG_DEBUG("Raw word 0x" << std::hex << dataArray[iWord] << " " << std::bitset<32> (dataArray[iWord]));
395 }
396
397 // Vectors to temporarily store global tob before they are summed together
398 // For multi-slice support, we use vectors of arrays: [sliceNumber][fpga]
399 // Vectors are dynamically resized based on the actual number of slices in the data
400 // Inner arrays are fixed size 3 (one element per FPGA)
401 std::vector<int> global_counter;
402 std::vector<std::array<uint32_t, 3>> JWOJ_MHT;
403 std::vector<std::array<uint32_t, 3>> JWOJ_MST;
404 std::vector<std::array<uint32_t, 3>> JWOJ_MET;
405 std::vector<std::array<uint32_t, 3>> JWOJ_SCALAR;
406 std::vector<std::array<uint32_t, 3>> GESPRESSO;
407 std::vector<std::array<uint32_t, 3>> GRISTRETTO;
408 std::vector<std::array<uint32_t, 3>> NC_MET;
409 std::vector<std::array<uint32_t, 3>> NC_SCALAR;
410 std::vector<std::array<uint32_t, 3>> RMS_MET;
411 std::vector<std::array<uint32_t, 3>> RMS_SCALAR;
412 // Track slice numbers for global TOBs (to be assigned when fillGlobal is called)
413 std::vector<uint32_t> globalSliceNumbers;
414
415 // Helper lambda to ensure vectors are large enough for a given slice
416 auto ensureSliceCapacity = [&](size_t sliceNum) {
417 if (sliceNum >= global_counter.size()) {
418 size_t newSize = sliceNum + 1;
419 global_counter.resize(newSize, 0);
420 JWOJ_MHT.resize(newSize, {0, 0, 0});
421 JWOJ_MST.resize(newSize, {0, 0, 0});
422 JWOJ_MET.resize(newSize, {0, 0, 0});
423 JWOJ_SCALAR.resize(newSize, {0, 0, 0});
424 GESPRESSO.resize(newSize, {0, 0, 0});
425 GRISTRETTO.resize(newSize, {0, 0, 0});
426 NC_MET.resize(newSize, {0, 0, 0});
427 NC_SCALAR.resize(newSize, {0, 0, 0});
428 RMS_MET.resize(newSize, {0, 0, 0});
429 RMS_SCALAR.resize(newSize, {0, 0, 0});
430 }
431 };
432
433 size_t index = 0;
434 while ( index < n_words ) {
435 const uint32_t headerWord = dataArray[index];//Identify the header words. The first is a header word.
436 const uint32_t blockType = (headerWord >> gPos::BLOCK_TYPE_BIT) & gPos::BLOCK_TYPE_MASK;
437 const uint32_t headerSize = (headerWord >> gPos::HEADER_SIZE_BIT) & gPos::HEADER_SIZE_MASK;
438 const uint32_t errorFlags = (headerWord >> gPos::ERROR_FLAG_BIT) & gPos::ERROR_FLAG_MASK;
439 const uint32_t dataSize = headerWord & gPos::DATA_SIZE_MASK;
440
441 ATH_MSG_DEBUG( "index "<< index );
442 ATH_MSG_DEBUG( "word "<< std::bitset<32> (dataArray[index]) );
443 ATH_MSG_DEBUG( "headerWord "<< std::bitset<32> (headerWord) );
444 ATH_MSG_DEBUG( "blockType "<< std::bitset<4> (blockType) );
445 ATH_MSG_DEBUG( "headerSize "<< std::bitset<2> (headerSize) );
446 ATH_MSG_DEBUG( "errorFlags "<< std::bitset<1> (errorFlags) );
447 ATH_MSG_DEBUG( "dataSize "<< std::bitset<12> (dataSize) );
448
449 const uint32_t blockSize = headerSize + dataSize;
450 if ( (index + blockSize) > n_words ) {
451
452 std::stringstream sdetail;
453 sdetail << "Remaining block size " << (n_words - index) << " is too small for subblock of type " << blockType << " with headerSize " << headerSize << " and dataSize " << dataSize ;
454 std::stringstream slocation;
455 slocation << "0x"<< std::hex << rob->rob_source_id() << std::dec << " type:"<<blockType;
456 std::stringstream stitle;
457 stitle << "Small subblock size " ;
458 printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str());
459
460 }
461
462 index += headerSize;
463
464 const uint32_t numSlices = dataSize / gPos::WORDS_PER_SLICE;
465 ATH_MSG_DEBUG( "numSlices " << numSlices );
466
467 if ( numSlices * gPos::WORDS_PER_SLICE != dataSize ) {
468
469 std::stringstream sdetail;
470 sdetail << "L1CaloBsDecoderRun3::decodeGfexTobs: subblock type " << blockType << " with dataSize " << dataSize << " is not a multiple of " << gPos::WORDS_PER_SLICE << " words" ;
471 std::stringstream slocation;
472 slocation << "0x"<< std::hex << rob->rob_source_id()<< std::dec << " type:"<<blockType;
473 std::stringstream stitle;
474 stitle << "Wrong dataSize" ;
475 printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str());
476
477 //skip decode of this fragment
478 index+=dataSize;
479 continue;
480
481 }
482
483 // The subblock type is 0xA,B,C for jet TOBs from FPGA A,B,C
484 // and 0x1,2,3 for global (MET) TOBs.
485 bool isMet = (blockType >= 0x1 && blockType <= 0x3);
486 bool isJet = (blockType >= 0xA && blockType <= 0xC);
487
488 for (uint32_t sliceNumber = 0; sliceNumber < numSlices; sliceNumber++) {
489
490 // Skip out-of-time slices (slice != 0) if multi-slice mode is disabled
491 if (sliceNumber != 0 && !multiSlice) {
493 continue;
494 }
495
496 if ( !isJet && !isMet ) {
497 std::stringstream sdetail;
498 sdetail << "gFexByteStreamTool::decodeGfexTobSlice: Invalid block type " << blockType ;
499 std::stringstream slocation;
500 slocation << "0x"<< std::hex << rob->rob_source_id();
501 std::stringstream stitle;
502 stitle << "Invalid block type" ;
503 printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str());
504 }
505
506 // Select target containers based on slice (slice 0 = L1A -> main containers, others -> out-of-time containers)
507 auto& targetRhoContainer = (sliceNumber == 0) ? gRhoContainer : gRhoSliceContainer;
508 auto& targetSJContainer = (sliceNumber == 0) ? gSJContainer : gSJSliceContainer;
509 auto& targetLJContainer = (sliceNumber == 0) ? gLJContainer : gLJSliceContainer;
510
511 for(unsigned int iWord=0; iWord<gPos::WORDS_PER_SLICE; iWord++) {
512
513 // Skip jet TOB fill at slice 0 when standard containers are disabled
514 if (isJet && (sliceNumber != 0 || decodeStdTOBs)) {
515 //Skipping the unused words
516 if (std::find(gPos::JET_UNUSED_POSITION.begin(),gPos::JET_UNUSED_POSITION.end(),iWord)!=gPos::JET_UNUSED_POSITION.end()){
517 continue;
518 }
519 //Skipping the trailer words
520 if (std::find(gPos::TRAILER_POSITION.begin(),gPos::TRAILER_POSITION.end(),iWord)!=gPos::TRAILER_POSITION.end()){
521 continue;
522 }
523 // Decorator for slice number - only needed for out-of-time containers
524 // (L1A containers by definition only contain slice 0)
525 static const SG::AuxElement::Decorator<uint32_t> sliceNumberDec("sliceNumber");
526
527 //Saving gRho TOBs into the EDM container
528 if (iWord == gPos::GRHO_POSITION){
529 std::unique_ptr<xAOD::gFexJetRoI> myEDM (new xAOD::gFexJetRoI());
530 targetRhoContainer->push_back(std::move(myEDM));
531 targetRhoContainer->back()->initialize(dataArray[index+iWord], m_gJ_scale);
532 if (sliceNumber != 0) sliceNumberDec(*targetRhoContainer->back()) = sliceNumber;
533 }
534 //Saving gBlock TOBs into the EDM container
535 if (std::find(gPos::GBLOCK_POSITION.begin(),gPos::GBLOCK_POSITION.end(),iWord)!=gPos::GBLOCK_POSITION.end()){
536 std::unique_ptr<xAOD::gFexJetRoI> myEDM (new xAOD::gFexJetRoI());
537 targetSJContainer->push_back(std::move(myEDM));
538 targetSJContainer->back()->initialize(dataArray[index+iWord], m_gJ_scale);
539 if (sliceNumber != 0) sliceNumberDec(*targetSJContainer->back()) = sliceNumber;
540 }
541 //Saving gJet TOBs into the EDM container
542 if (std::find(gPos::GJET_POSITION.begin(),gPos::GJET_POSITION.end(),iWord)!=gPos::GJET_POSITION.end()){
543 std::unique_ptr<xAOD::gFexJetRoI> myEDM (new xAOD::gFexJetRoI());
544 targetLJContainer->push_back(std::move(myEDM));
545 targetLJContainer->back()->initialize(dataArray[index+iWord], m_gLJ_scale);
546 if (sliceNumber != 0) sliceNumberDec(*targetLJContainer->back()) = sliceNumber;
547 }
548
549 }
550
551 // Global TOBs - decode for all slices, store per-slice data
552 // They require data from all 3 FPGAs to be combined later
553 if (isMet){
554 // Ensure we have storage for this slice
555 ensureSliceCapacity(sliceNumber);
556
557 //Skipping the unused words
559 continue;
560 }
561 //Skipping the trailer words
562 if (std::find(gPos::TRAILER_POSITION.begin(),gPos::TRAILER_POSITION.end(),iWord)!=gPos::TRAILER_POSITION.end()){
563 continue;
564 }
565 //Saving jwoj MHT TOBs into the EDM container
566 if (iWord == gPos::JWOJ_MHT_POSITION){
567 global_counter[sliceNumber]++;
568 if (blockType == 0x1) {JWOJ_MHT[sliceNumber][0] = dataArray[index+iWord];}
569 if (blockType == 0x2) {JWOJ_MHT[sliceNumber][1] = dataArray[index+iWord];}
570 if (blockType == 0x3) {JWOJ_MHT[sliceNumber][2] = dataArray[index+iWord];}
571 }
572 //Saving jwoj MST TOBs into the EDM container
573 if (iWord == gPos::JWOJ_MST_POSITION){
574 if (blockType == 0x1) {JWOJ_MST[sliceNumber][0] = dataArray[index+iWord];}
575 if (blockType == 0x2) {JWOJ_MST[sliceNumber][1] = dataArray[index+iWord];}
576 if (blockType == 0x3) {JWOJ_MST[sliceNumber][2] = dataArray[index+iWord];}
577 }
578 //Saving jwoj MET TOBs into the EDM container
579 if (iWord == gPos::JWOJ_MET_POSITION){
580 if (blockType == 0x1) {JWOJ_MET[sliceNumber][0] = dataArray[index+iWord];}
581 if (blockType == 0x2) {JWOJ_MET[sliceNumber][1] = dataArray[index+iWord];}
582 if (blockType == 0x3) {JWOJ_MET[sliceNumber][2] = dataArray[index+iWord];}
583 }
584 //Saving jwoj Scalar TOBs into the EDM container
585 if (iWord == gPos::JWOJ_SCALAR_POSITION){
586 if (blockType == 0x1) {JWOJ_SCALAR[sliceNumber][0] = dataArray[index+iWord];}
587 if (blockType == 0x2) {JWOJ_SCALAR[sliceNumber][1] = dataArray[index+iWord];}
588 if (blockType == 0x3) {JWOJ_SCALAR[sliceNumber][2] = dataArray[index+iWord];}
589 }
590 //Saving gEspresso TOBs into the EDM container
591 if (iWord == gPos::GESPRESSO_POSITION){
592 if (blockType == 0x1) {GESPRESSO[sliceNumber][0] = dataArray[index+iWord];}
593 if (blockType == 0x2) {GESPRESSO[sliceNumber][1] = dataArray[index+iWord];}
594 if (blockType == 0x3) {GESPRESSO[sliceNumber][2] = dataArray[index+iWord];}
595 }
596 //Saving gRistretto TOBs into the EDM container
597 if (iWord == gPos::GRISTRETTO_POSITION){
598 if (blockType == 0x1) {GRISTRETTO[sliceNumber][0] = dataArray[index+iWord];}
599 if (blockType == 0x2) {GRISTRETTO[sliceNumber][1] = dataArray[index+iWord];}
600 if (blockType == 0x3) {GRISTRETTO[sliceNumber][2] = dataArray[index+iWord];}
601 }
602 //Saving Noise Cut MET TOBs into the EDM container
603 if (iWord == gPos::NC_MET_POSITION){
604 if (blockType == 0x1) {NC_MET[sliceNumber][0] = dataArray[index+iWord];}
605 if (blockType == 0x2) {NC_MET[sliceNumber][1] = dataArray[index+iWord];}
606 if (blockType == 0x3) {NC_MET[sliceNumber][2] = dataArray[index+iWord];}
607 }
608 //Saving Noise Cut Scalar TOBs into the EDM container
609 if (iWord == gPos::NC_SCALAR_POSITION){
610 if (blockType == 0x1) {NC_SCALAR[sliceNumber][0] = dataArray[index+iWord];}
611 if (blockType == 0x2) {NC_SCALAR[sliceNumber][1] = dataArray[index+iWord];}
612 if (blockType == 0x3) {NC_SCALAR[sliceNumber][2] = dataArray[index+iWord];}
613 }
614 //Saving Rho+RMS MET TOBs into the EDM container
615 if (iWord == gPos::RMS_MET_POSITION){
616 if (blockType == 0x1) {RMS_MET[sliceNumber][0] = dataArray[index+iWord];}
617 if (blockType == 0x2) {RMS_MET[sliceNumber][1] = dataArray[index+iWord];}
618 if (blockType == 0x3) {RMS_MET[sliceNumber][2] = dataArray[index+iWord];}
619 }
620 //Saving Rho+RMS Scalar TOBs into the EDM container
621 if (iWord == gPos::RMS_SCALAR_POSITION){
622 if (blockType == 0x1) {RMS_SCALAR[sliceNumber][0] = dataArray[index+iWord];}
623 if (blockType == 0x2) {RMS_SCALAR[sliceNumber][1] = dataArray[index+iWord];}
624 if (blockType == 0x3) {RMS_SCALAR[sliceNumber][2] = dataArray[index+iWord];}
625 }
626
627 }
628
629 }
630
632 }
633
634 // Fill global TOBs for each slice that has complete data from all 3 FPGAs
635 for (size_t slice = 0; slice < global_counter.size(); slice++) {
636 ATH_MSG_DEBUG("global_counter[" << slice << "] is " << global_counter[slice]);
637 if (global_counter[slice] == 3) {
638 // Skip out-of-time slices if multi-slice mode is disabled
639 if (slice != 0 && !multiSlice) {
640 global_counter[slice] = 0;
641 continue;
642 }
643
644 // Select target containers based on slice (slice 0 = L1A, others = out-of-time)
645 if (slice == 0 && !decodeStdTOBs) {
646 // Only fill gEspresso and gRistretto when standard TOBs are disabled
647 fillGlobal(GESPRESSO[slice], 1, gEspressoContainer, slice, 0);
648 fillGlobal(GRISTRETTO[slice], 1, gRistrettoContainer, slice, 0);
649 } else {
650 auto& targetMHTContainer = (slice == 0) ? gMHTComponentsJwojContainer : gMHTComponentsJwojSliceContainer;
651 auto& targetMSTContainer = (slice == 0) ? gMSTComponentsJwojContainer : gMSTComponentsJwojSliceContainer;
652 auto& targetMETContainer = (slice == 0) ? gMETComponentsJwojContainer : gMETComponentsJwojSliceContainer;
653 auto& targetScalarContainer = (slice == 0) ? gScalarEJwojContainer : gScalarEJwojSliceContainer;
654 auto& targetEspressoContainer = (slice == 0) ? gEspressoContainer : gEspressoSliceContainer;
655 auto& targetRistrettoContainer = (slice == 0) ? gRistrettoContainer : gRistrettoSliceContainer;
656 auto& targetNCMETContainer = (slice == 0) ? gMETComponentsNoiseCutContainer : gMETComponentsNoiseCutSliceContainer;
657 auto& targetNCScalarContainer = (slice == 0) ? gScalarENoiseCutContainer : gScalarENoiseCutSliceContainer;
658 auto& targetRMSMETContainer = (slice == 0) ? gMETComponentsRmsContainer : gMETComponentsRmsSliceContainer;
659 auto& targetRMSScalarContainer = (slice == 0) ? gScalarERmsContainer : gScalarERmsSliceContainer;
660
661 fillGlobal(JWOJ_MHT[slice], 3, targetMHTContainer, slice);
662 fillGlobal(JWOJ_MST[slice], 4, targetMSTContainer, slice);
663 int16_t scalar = fillGlobal(JWOJ_MET[slice], 2, targetMETContainer, slice);
664 fillGlobal(JWOJ_SCALAR[slice], 1, targetScalarContainer, slice, scalar);
665
666 fillGlobal(GESPRESSO[slice], 1, targetEspressoContainer, slice, 0);
667
668 fillGlobal(GRISTRETTO[slice], 1, targetRistrettoContainer, slice, 0);
669
670 scalar = fillGlobal(NC_MET[slice], 2, targetNCMETContainer, slice);
671 fillGlobal(NC_SCALAR[slice], 1, targetNCScalarContainer, slice, scalar);
672
673 scalar = fillGlobal(RMS_MET[slice], 2, targetRMSMETContainer, slice);
674 fillGlobal(RMS_SCALAR[slice], 1, targetRMSScalarContainer, slice, scalar);
675 } // end else (standard TOBs enabled or out-of-time slice)
676
677 global_counter[slice] = 0;
678 }
679 }
680
681 }
682 }
683 return StatusCode::SUCCESS;
684}
685
686// For MHT, MST, and MET, it sums the x and y components across FPGAs, and also returnes
687// the sum in quadrature (which is actually only used for MET, and discared for MHT and MST)
688// This function also accepts "scalar" as optional variable, which is used to fill the X
689// component of the SCALAR tob.
690int16_t gFexByteStreamTool::fillGlobal(const std::array<uint32_t, 3> &tob, const int type,
692 uint32_t sliceNumber, int16_t scalar/* = -1*/) const {
693
694 ATH_MSG_DEBUG("fillGlobal with type " << type << " slice " << sliceNumber);
695
696 // 32 bit integers to avoid interim overflows when summing 16b (signed)
697 // quantities from each pFPGA. Proper clamping and bit masking follows afterwards
698 int32_t sum_x = 0;
699 int32_t sum_y = 0;
700
701 // Extract the x and y components and sum them for the three FPGAs
702 for (size_t fpga = 0; fpga < 3; fpga++) {
703 int16_t x = tob[fpga] >> gPos::GLOBAL_X_BIT & gPos::GLOBAL_X_MASK;
704 int16_t y = tob[fpga] >> gPos::GLOBAL_Y_BIT & gPos::GLOBAL_Y_MASK;
705 if (x & 0x00080000) { x = 0xFFFF0000 | x; }
706 if (y & 0x00080000) { y = 0xFFFF0000 | y; }
707 sum_x += x;
708 if (container.key() == "L1_gScalarEJwoj" && y < 0) y = 0;
709 sum_y += y;
710 }
711
712 // Special case for gEspresso/gRistretto: in the readout these quantities are stored in x. We need to move them to y to armonize this with the other scalar quantities
713 // This is true for the readout only. On the realtime path gEspresso is sent to Topo on y (see https://docs.google.com/spreadsheets/d/15YVVtGofhXMtV7jXRFzWO0FVUtUAjS-X-aQjh3FKE_w/edit?gid=1546010783#gid=1546010783).
714 if (container.key() == "L1_gEspresso" || container.key() == "L1_gRistretto" ) {
715 sum_y = sum_x;
716 }
717
718 if (type == 1) {//we are considering the scalar case (sum_x = MET and sum_y = SumEt)
719 ATH_MSG_DEBUG(" scalar tob, saving " << scalar << " in X component");
720 sum_x = scalar; //Total MET
721 if( sum_y > 0x000FFF) sum_y = 0x000FFF; //Overflow control for SumEt
722 if( sum_y < 0) sum_y = 0;
723
724 } else {
725 if (sum_x < -0x000800) sum_x = -0x000800; //-2048
726 if (sum_x > 0x0007FF) sum_x = 0x0007FF; //2047
727
728 if (sum_y < -0x000800) sum_y = -0x000800; //-2048
729 if (sum_y > 0x0007FF) sum_y = 0x0007FF; //2047
730 }
731
732 ATH_MSG_DEBUG(" fillGlobal type " << type << std::dec << " sum_x " << sum_x << " sum_y " << sum_y);
733
734 uint32_t METword = 0;
735
736 METword = (sum_y & 0x00000FFF) << 0; //set the Quantity2 to the corresponding slot (LSB)
737 METword = METword | (sum_x & 0x00000FFF) << 12;//Quantity 1 (in bit number 12)
738 if (sum_y != 0) METword = METword | 0x00000001 << 24;//Status bit for Quantity 2 (0 if quantity is null)
739 if (sum_x != 0) METword = METword | 0x00000001 << 25;//Status bit for Quantity 1 (0 if quantity is null)
740 METword = METword | (type & 0x0000001F) << 26;//TOB ID (5 bits starting at 26)
741
742 // Save to the EDM
743 std::unique_ptr<xAOD::gFexGlobalRoI> myEDM (new xAOD::gFexGlobalRoI());
744 container->push_back(std::move(myEDM));
745 container->back()->setWord(METword);
746 container->back()->setQuantityOne(sum_x);
747 container->back()->setQuantityTwo(sum_y);
748 container->back()->setScaleOne(m_gXE_scale);
749 container->back()->setScaleTwo(m_gTE_scale);
750 container->back()->setStatusOne(1);
751 container->back()->setStatusTwo(1);
752 container->back()->setSaturated(0);
753 container->back()->setGlobalType(type);
754
755 // Add slice number decoration only for out-of-time TOBs
756 // (L1A containers by definition only contain slice 0)
757 if (sliceNumber != 0) {
758 static const SG::AuxElement::Decorator<uint32_t> sliceNumberDec("sliceNumber");
759 sliceNumberDec(*container->back()) = sliceNumber;
760 }
761
762 int MET2 = sum_x * sum_x + sum_y * sum_y;
763 int16_t MET = std::sqrt(MET2);
764 if (MET > 0x000FFF) MET = 0x000FFF;
765
766 return MET;
767
768}
769
770
772StatusCode gFexByteStreamTool::convertToBS(std::vector<WROBF*>& /*vrobf*/,
773 const xAOD::TrigCompositeContainer* /*tc*/,
774 const EventContext& /*eventContext*/) {
775
776 return StatusCode::SUCCESS;
777
778}
779
780
781void gFexByteStreamTool::printError(const std::string& location, const std::string& title, MSG::Level type, const std::string& detail) const{
782
783 if(m_UseMonitoring){
785 Monitored::Scalar("gfexDecoderErrorLocation",location.empty() ? std::string("UNKNOWN") : location),
786 Monitored::Scalar("gfexDecoderErrorTitle" ,title.empty() ? std::string("UNKNOWN") : title)
787 );
788 }
789 else {
790 msg() << type << detail << endmsg;
791 }
792}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment ROBF
void printError()
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment WROBF
Handle class for adding a decoration to an object.
#define y
#define x
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsRmsWriteKey
virtual StatusCode start() override
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsNoiseCutWriteKey
SG::ReadHandleKey< xAOD::gFexJetRoIContainer > m_gFexRhoReadKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gRistrettoSliceWriteKey
SG::ReadHandleKey< xAOD::gFexGlobalRoIContainer > m_gMHTComponentsJwojReadKey
virtual StatusCode convertToBS(std::vector< OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment * > &vrobf, const xAOD::TrigCompositeContainer *tc, const EventContext &eventContext) override
xAOD->BS conversion
virtual StatusCode initialize() override
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarENoiseCutSliceWriteKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarERmsSliceWriteKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gMSTComponentsJwojOOTDecorKey
SG::ReadHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarEJwojReadKey
virtual StatusCode convertFromBS(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vrobf, const EventContext &eventContext) const override
BS->xAOD conversion.
SG::WriteDecorHandleKey< xAOD::gFexJetRoIContainer > m_gFexRhoOOTDecorKey
SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexRhoSliceWriteKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gRistrettoOOTDecorKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gEspressoSliceWriteKey
gFexByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
SG::ReadHandleKey< TrigConf::L1Menu > m_l1MenuKey
SG::ReadHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsJwojReadKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMSTComponentsJwojSliceWriteKey
SG::ReadHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsNoiseCutReadKey
SG::WriteDecorHandleKey< xAOD::gFexJetRoIContainer > m_gFexJetOOTDecorKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMSTComponentsJwojWriteKey
SG::ReadHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarERmsReadKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarEJwojSliceWriteKey
ToolHandle< GenericMonitoringTool > m_monTool
void printError(const std::string &location, const std::string &title, MSG::Level type, const std::string &detail) const
SG::ReadHandleKey< xAOD::gFexJetRoIContainer > m_gFexJetReadKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gRistrettoWriteKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarENoiseCutOOTDecorKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMHTComponentsJwojWriteKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMHTComponentsJwojSliceWriteKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsNoiseCutSliceWriteKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarENoiseCutWriteKey
int16_t fillGlobal(const std::array< uint32_t, 3 > &tob, const int type, SG::WriteHandle< xAOD::gFexGlobalRoIContainer > &container, uint32_t sliceNumber, int16_t scalar=-1) const
SG::ReadHandleKey< xAOD::gFexGlobalRoIContainer > m_gEspressoReadKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gMHTComponentsJwojOOTDecorKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarERmsOOTDecorKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsJwojWriteKey
SG::ReadHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsRmsReadKey
SG::ReadHandleKey< xAOD::gFexJetRoIContainer > m_gFexBlockReadKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarEJwojWriteKey
SG::ReadHandleKey< xAOD::gFexGlobalRoIContainer > m_gMSTComponentsJwojReadKey
SG::WriteDecorHandleKey< xAOD::gFexJetRoIContainer > m_gFexBlockOOTDecorKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsRmsOOTDecorKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gEspressoOOTDecorKey
Gaudi::Property< std::vector< uint32_t > > m_robIds
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarEJwojOOTDecorKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gEspressoWriteKey
SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexJetWriteKey
SG::ReadHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarENoiseCutReadKey
SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexBlockWriteKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarERmsWriteKey
SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexRhoWriteKey
SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexJetSliceWriteKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsJwojSliceWriteKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsNoiseCutOOTDecorKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsRmsSliceWriteKey
SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexBlockSliceWriteKey
SG::ReadHandleKey< xAOD::gFexGlobalRoIContainer > m_gRistrettoReadKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsJwojOOTDecorKey
constexpr unsigned int WORDS_PER_SLICE
Definition gFexPos.h:22
constexpr std::array< unsigned int, 4 > GBLOCK_POSITION
Definition gFexPos.h:31
constexpr unsigned int GLOBAL_Y_MASK
Definition gFexPos.h:50
constexpr unsigned int BLOCK_TYPE_BIT
Definition gFexPos.h:14
constexpr std::array< unsigned int, 2 > GJET_POSITION
Definition gFexPos.h:32
constexpr unsigned int DATA_SIZE_MASK
Definition gFexPos.h:20
constexpr unsigned int JWOJ_MHT_POSITION
Definition gFexPos.h:35
constexpr unsigned int GESPRESSO_POSITION
Definition gFexPos.h:41
constexpr unsigned int RMS_MET_POSITION
Definition gFexPos.h:46
constexpr unsigned int NC_SCALAR_POSITION
Definition gFexPos.h:44
constexpr unsigned int GLOBAL_X_MASK
Definition gFexPos.h:49
constexpr std::array< unsigned int, 2 > GLOBAL_UNUSED_POSITION
Definition gFexPos.h:29
constexpr unsigned int BLOCK_TYPE_MASK
Definition gFexPos.h:15
constexpr unsigned int ERROR_FLAG_BIT
Definition gFexPos.h:18
constexpr std::array< unsigned int, 2 > TRAILER_POSITION
Definition gFexPos.h:27
constexpr unsigned int GLOBAL_Y_BIT
Definition gFexPos.h:52
constexpr unsigned int HEADER_SIZE_MASK
Definition gFexPos.h:17
constexpr unsigned int NC_MET_POSITION
Definition gFexPos.h:43
constexpr unsigned int HEADER_SIZE_BIT
Definition gFexPos.h:16
constexpr unsigned int ERROR_FLAG_MASK
Definition gFexPos.h:19
constexpr std::array< unsigned int, 5 > JET_UNUSED_POSITION
Definition gFexPos.h:28
constexpr unsigned int GRHO_POSITION
Definition gFexPos.h:33
constexpr unsigned int JWOJ_SCALAR_POSITION
Definition gFexPos.h:38
constexpr unsigned int GRISTRETTO_POSITION
Definition gFexPos.h:40
constexpr unsigned int JWOJ_MST_POSITION
Definition gFexPos.h:36
constexpr unsigned int RMS_SCALAR_POSITION
Definition gFexPos.h:47
constexpr unsigned int JWOJ_MET_POSITION
Definition gFexPos.h:37
constexpr unsigned int GLOBAL_X_BIT
Definition gFexPos.h:51
Definition MET.py:1
eformat::write::ROBFragment ROBFragment
Definition RawEvent.h:33
eformat::ROBFragment< PointerType > ROBFragment
Definition RawEvent.h:27
Definition index.py:1
TrigCompositeContainer_v1 TrigCompositeContainer
Declare the latest version of the container.
gFexJetRoI_v1 gFexJetRoI
Define the latest version of the gFexJetRoI class.
Definition gFexJetRoI.h:16
gFexGlobalRoI_v1 gFexGlobalRoI
Define the latest version of the eFexEMRoI class.
MsgStream & msg
Definition testRead.cxx:32