ATLAS Offline Software
Loading...
Searching...
No Matches
ZdcByteStreamTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5/*
6 * ZdcByteStreamTool.cxx
7 *
8 * Created on: May 7, 2009
9 * Author: leite
10 * (shameless based on the L1 Calo ByteStreamTool)
11 *
12 */
13
14#include <numeric>
15#include <utility>
16
17#include "GaudiKernel/IInterface.h"
18#include "GaudiKernel/MsgStream.h"
19
21
22
23#include "ZdcEvent/ZdcDigits.h"
28//#include "ZdcByteStream/ZdcModifySlices.h"
30
32
34
35
36//==================================================================================================
37// Interface ID
38static const InterfaceID IID_IZdcByteStreamTool("ZdcByteStreamTool", 1, 1);
39
41{
43}
44//==================================================================================================
45
47 const std::string& name,
48 const IInterface* parent) :
49 AthAlgTool(type, name, parent),
50 //m_version(1),
51 //m_compVers(4),
52 m_channels(64),
53 m_crates(8),
54 //m_modules(16),
55 m_subDetector(eformat::FORWARD_ZDC),
56 m_srcIdMap(nullptr),
57 //m_towerKey(0),
58 //m_errorBlock(0),
59 m_rodStatus(nullptr)
60
61{
62 declareInterface<ZdcByteStreamTool> (this);
63
64 declareProperty("PrintCompStats", m_printCompStats = 0, "Print compressed format statistics");
65
66 // Properties for reading bytestream only
67 declareProperty("ZeroSuppress", m_zeroSuppress = 0,
68 "Only make trigger towers with non-zero EM or Had energy");
69 declareProperty("ROBSourceIDs", m_sourceIDs, "ROB fragment source identifiers");
70 declareProperty("PedestalValue", m_pedestal = 10,
71 "Pedestal value - needed for compressed formats 0,1 only");
72
73 // Properties for writing bytestream only
74 declareProperty("DataFormat", m_dataFormat = 1, "Format identifier (0-3) in sub-block header");
75 declareProperty("FADCBaseline", m_fadcBaseline = 0,
76 "FADC baseline lower bound for compressed formats");
77 declareProperty("FADCThreshold", m_fadcThreshold = 1,
78 "FADC threshold for super-compressed format");
79 declareProperty("SlinksPerCrate", m_slinks = 4, "The number of S-Links per crate");
80 declareProperty("SimulSlicesLUT", m_dfltSlicesLut = 1,
81 "The number of LUT slices in the simulation");
82 declareProperty("SimulSlicesFADC", m_dfltSlicesFadc = 7,
83 "The number of FADC slices in the simulation");
84 declareProperty("ForceSlicesLUT", m_forceSlicesLut = 0,
85 "If >0, the number of LUT slices in bytestream");
86 declareProperty("ForceSlicesFADC", m_forceSlicesFadc = 0,
87 "If >0, the number of FADC slices in bytestream");
88
89}
90
91//==================================================================================================
92// Initialize the tool
94{
95 /*
96 * This would be used for crate/module/channel to eta/phi/layer mappings
97 StatusCode sc = m_zdcMaps.retrieve();
98 if (sc.isFailure())
99 {
100 msg(MSG::ERROR) << "Failed to retrieve tool " << m_zdcMaps << endmsg;
101 return sc;
102 }
103 else msg(MSG::INFO) << "Retrieved tool " << m_zdcMaps << endmsg;
104 */
105 m_srcIdMap = new ZdcSrcIdMap();
107 m_rodStatus = new std::vector<uint32_t>(2);
108
109 const ZdcID* zdcID = nullptr;
110 if (detStore()->retrieve( zdcID ).isFailure() ) {
111 msg(MSG::ERROR) << "execute: Could not retrieve ZdcID object from the detector store" << endmsg;
112 return StatusCode::FAILURE;
113 }
114 else {
115 msg(MSG::DEBUG) << "execute: retrieved ZdcID" << endmsg;
116 }
117 m_zdcID = zdcID;
118
119 return StatusCode::SUCCESS;
120}
121//==================================================================================================
122
123//==================================================================================================
124// Finalize the tool
126{
127 if (m_printCompStats && msgLvl(MSG::INFO))
128 {
129 msg(MSG::INFO);
131 }
132
133 delete m_rodStatus;
134 delete m_errorBlock;
135 //delete m_towerKey;
136 delete m_srcIdMap;
137 return StatusCode::SUCCESS;
138}
139//==================================================================================================
140
141//==================================================================================================
142// Conversion bytestream to ZDCCollection
144 ZdcDigitsCollection* const ttCollection)
145{
146
147 const bool debug = msgLvl(MSG::DEBUG);
148 //const bool debug = 1;
149 const bool verbose = msgLvl(MSG::VERBOSE);
150
151
152 if (debug) msg(MSG::DEBUG);
153 if (verbose) msg(MSG::VERBOSE);
154
155 // Clear trigger tower map
156
157 typedef std::map<uint32_t,ZdcDigits*> hashmapType;
158 hashmapType digits_map;
159
160 // Loop over ROB fragments
161 //msg(MSG::INFO) << "ZDC: Inside EVENT !" << endmsg;
162 int robCount = 0;
163 ROBIterator rob = robFrags.begin();
164 ROBIterator robEnd = robFrags.end();
165 for (; rob != robEnd; ++rob)
166 {
167
168 ++robCount;
169 if (debug)
170 {
171 msg() << "ZDC: Treating ROB fragment " << robCount << endmsg;
172 }
173
174 // Unpack ROD data (slinks)
175
176 RODPointer payloadBeg;
177 RODPointer payload;
178 RODPointer payloadEnd;
179 (*rob)->rod_data(payloadBeg);
180 payloadEnd = payloadBeg + (*rob)->rod_ndata();
181 payload = payloadBeg;
182 if (payload == payloadEnd)
183 {
184 if (debug) msg() << "ZDC: ROB fragment empty" << endmsg;
185 continue;
186 }
187
188 // Check identifier
189 const uint32_t sourceID = (*rob)->rod_source_id();
190 if (debug)
191 {
192 if (ZdcSrcIdMap::subDet(sourceID) != m_subDetector || ZdcSrcIdMap::daqOrRoi(sourceID)
193 != 0)
194 {
195 msg() << "ZDC: Wrong source identifier in data: " << MSG::hex << sourceID << MSG::dec
196 << endmsg;
197 }
198 }
199 const int rodCrate = ZdcSrcIdMap::crate(sourceID);
200 if (debug)
201 {
202 msg() << "ZDC: Treating crate " << rodCrate << " slink " << ZdcSrcIdMap::slink(sourceID)
203 << "From SubDetectorID " << ZdcSrcIdMap::subDet(sourceID) << endmsg;
204 }
205
206 /* Comment out - this needs adaptation as there are too much L1 dialect in here
207 * for now I wnat ot compile/run the bytestream to esd convertion, as I know how
208 * to unpack the ppm data
209 *
210 */
211 // First word is User Header
212 ZdcUserHeader userHeader(*payload);
213 const int minorVersion = (*rob)->rod_version() & 0xffff;
214 userHeader.setVersion(minorVersion);
215 const int headerWords = userHeader.words();
216 if (headerWords != 1 && debug)
217 {
218 msg() << "ZDC: Unexpected number of user header words: " << headerWords << endmsg;
219 }
220 // Does this makes sense??? Look above headerWords == 1
221 for (int i = 0; i < headerWords; ++i)
222 ++payload;
223 // triggered slice offsets
224 const int trigLut = userHeader.ppmLut();
225 const int trigFadc = userHeader.ppmFadc();
226 // FADC baseline lower bound
227 m_fadcBaseline = userHeader.lowerBound();
228 if (debug)
229 {
230 msg() << "ZDC: Minor format version number: " << MSG::hex << minorVersion << MSG::dec
231 << endmsg << "ZDC: LUT triggered slice offset: " << trigLut << endmsg
232 << "ZDC: FADC triggered slice offset: " << trigFadc << endmsg
233 << "ZDC: FADC baseline lower bound: " << m_fadcBaseline << endmsg;
234 }
235 const int runNumber = (*rob)->rod_run_no() & 0xffffff;
236
237 // Find the number of channels per sub-block
238 int chanPerSubBlock = 0;
239 if (payload != payloadEnd)
240 {
242 {
243 msg(MSG::ERROR) << "Missing Sub-block header" << endmsg;
244 return StatusCode::FAILURE;
245 }
246 ZdcPpmSubBlock testBlock;
247 //Fix coverity CID 19251
248 //payload = testBlock.read(payload, payloadEnd);
249 testBlock.read(payload, payloadEnd);
250 chanPerSubBlock = testBlock.channelsPerSubBlock();
251 if (chanPerSubBlock == 0)
252 {
253 msg(MSG::ERROR) << "Unsupported version/data format: " << testBlock.version()
254 << "/" << testBlock.format() << endmsg;
255 return StatusCode::FAILURE;
256 }
257 if (m_channels % chanPerSubBlock != 0)
258 {
259 msg(MSG::ERROR) << "Invalid channels per sub-block: " << chanPerSubBlock << endmsg;
260 return StatusCode::FAILURE;
261 }
262 if (debug) msg() << "Channels per sub-block: " << chanPerSubBlock << endmsg;
263 }
264 else
265 {
266 if (debug) msg() << "ROB fragment contains user header only" << endmsg;
267 continue;
268 }
269 const int numSubBlocks = m_channels / chanPerSubBlock;
270
271 // Loop over PPMs
272
273 payload = payloadBeg;
274 for (int i = 0; i < headerWords; ++i)
275 ++payload;
276 while (payload != payloadEnd)
277 {
278
279 // Get all sub-blocks for one PPM
280
281 int crate = 0;
282 int module = 0;
283 m_ppmBlocks.clear();
284 for (int block = 0; block < numSubBlocks; ++block)
285 {
287 || ZdcPpmSubBlock::errorBlock(*payload))
288 {
289 msg(MSG::ERROR) << "Unexpected data sequence" << endmsg;
290 return StatusCode::FAILURE;
291 }
292 if (chanPerSubBlock != m_channels && ZdcSubBlock::seqno(*payload) != block
293 * chanPerSubBlock)
294 {
295 if (debug)
296 {
297 msg() << "Unexpected channel sequence number: "
298 << ZdcSubBlock::seqno(*payload) << " expected " << block
299 * chanPerSubBlock << endmsg;
300 }
301 if (!m_ppmBlocks.empty()) break;
302 else
303 {
304 if (!debug)
305 {
306 msg(MSG::ERROR) << "Unexpected channel sequence number" << endmsg;
307 }
308 return StatusCode::FAILURE;
309 }
310 }
311 ZdcPpmSubBlock* const subBlock = new ZdcPpmSubBlock();
312 m_ppmBlocks.push_back(subBlock);
313 payload = subBlock->read(payload, payloadEnd);
314 if (block == 0)
315 {
316 crate = subBlock->crate();
317 module = subBlock->module();
318 if (debug)
319 {
320 msg() << "Module " << module << endmsg;
321 if (crate != rodCrate)
322 {
323 msg() << "Inconsistent crate number in ROD source ID" << endmsg;
324 }
325 }
326 }
327 else
328 {
329 if (subBlock->crate() != crate)
330 {
331 msg(MSG::ERROR) << "Inconsistent crate number in sub-blocks" << endmsg;
332 return StatusCode::FAILURE;
333 }
334 if (subBlock->module() != module)
335 {
336 msg(MSG::ERROR) << "Inconsistent module number in sub-blocks" << endmsg;
337 return StatusCode::FAILURE;
338 }
339 }
340 if (payload == payloadEnd && block != numSubBlocks - 1)
341 {
342 if (debug) msg() << "Premature end of data" << endmsg;
343 break;
344 }
345 }
346
347 // Is there an error block?
348
349 //delete m_errorBlock;
350 //m_errorBlock = 0;
351 m_errorBlock->clear();
352 if (payload != payloadEnd)
353 {
355 && ZdcPpmSubBlock::errorBlock(*payload))
356 {
357 if (debug) msg() << "Error block found" << endmsg;
358 //m_errorBlock = new ZdcPpmSubBlock();
359 payload = m_errorBlock->read(payload, payloadEnd);
360 if (m_errorBlock->crate() != crate)
361 {
362 msg(MSG::ERROR) << "Inconsistent crate number in error block" << endmsg;
363 return StatusCode::FAILURE;
364 }
365 if (m_errorBlock->module() != module)
366 {
367 msg(MSG::ERROR) << "Inconsistent module number in error block" << endmsg;
368 return StatusCode::FAILURE;
369 }
370 if (m_errorBlock->dataWords() && !m_errorBlock->unpack())
371 {
372 if (debug)
373 {
374 std::string errMsg(m_errorBlock->unpackErrorMsg());
375 msg() << "Unpacking error block failed: " << errMsg << endmsg;
376 }
377 }
378 //delete m_errorBlock;
379 }
380 }
381
382 // Loop over sub-blocks and fill trigger towers
383
384 const int actualSubBlocks = m_ppmBlocks.size();
385 for (int block = 0; block < actualSubBlocks; ++block)
386 {
387 ZdcPpmSubBlock* const subBlock = m_ppmBlocks[block];
388 subBlock->setLutOffset(trigLut);
389 subBlock->setFadcOffset(trigFadc);
390 subBlock->setPedestal(m_pedestal);
392 subBlock->setRunNumber(runNumber);
393 if (debug)
394 {
395 msg() << "Unpacking sub-block version/format/seqno: " << subBlock->version()
396 << "/" << subBlock->format() << "/" << subBlock->seqno() << endmsg;
397 }
398 if (subBlock->dataWords() && !subBlock->unpack())
399 {
400 if (debug)
401 {
402 std::string errMsg(subBlock->unpackErrorMsg());
403 msg() << "Unpacking PPM sub-block failed: " << errMsg << endmsg;
404 }
405 }
406 if (m_printCompStats) addCompStats(subBlock->compStats());
407 for (int chan = 0; chan < chanPerSubBlock; ++chan)
408 {
409 const int channel = block * chanPerSubBlock + chan;
410 std::vector<int> lut;
411 std::vector<int> fadc;
412 std::vector<int> bcidLut;
413 std::vector<int> bcidFadc;
414 subBlock->ppmData(channel, lut, fadc, bcidLut, bcidFadc);
415// int trigLutKeep = trigLut;
416// int trigFadcKeep = trigFadc;
417 if (lut.size() < size_t(trigLut + 1))
418 {
419 if (debug)
420 {
421 msg() << "Triggered LUT slice from header "
422 << "inconsistent with number of slices: " << trigLut << ", "
423 << lut.size() << ", reset to 0" << endmsg;
424 }
425// trigLutKeep = 0;
426 }
427 if (fadc.size() < size_t(trigFadc + 1))
428 {
429 if (debug)
430 {
431 msg() << "Triggered FADC slice from header "
432 << "inconsistent with number of slices: " << trigFadc << ", "
433 << fadc.size() << ", reset to 0" << endmsg;
434 }
435// trigFadcKeep = 0;
436 }
437 /*
438 LVL1::DataError errorBits(0);
439 if (m_errorBlock)
440 {
441 errorBits.set(LVL1::DataError::PPMErrorWord,
442 m_errorBlock->ppmError(channel));
443 errorBits.set(LVL1::DataError::SubStatusWord, m_errorBlock->subStatus());
444 }
445 else
446 {
447 errorBits.set(LVL1::DataError::PPMErrorWord, subBlock->ppmError(channel));
448 const ZdcPpmSubBlock* const lastBlock = m_ppmBlocks[actualSubBlocks - 1];
449 errorBits.set(LVL1::DataError::SubStatusWord, lastBlock->subStatus());
450 }
451 // Wrong bit set for compressed formats 1.01 to 1.03
452 if (subBlock->format() > 1 && subBlock->seqno() < 4)
453 {
454 errorBits.set(LVL1::DataError::ModuleError, (errorBits.error()
455 >> (LVL1::DataError::ModuleError + 1)) & 0x1);
456 }
457 const int error = errorBits.error();
458 */
459 // Only save non-zero data
460
461 const bool any = std::accumulate(lut.begin(), lut.end(), 0)
462 || std::accumulate(fadc.begin(), fadc.end(), 0)
463 || std::accumulate(bcidLut.begin(), bcidLut.end(), 0)
464 || std::accumulate(bcidFadc.begin(), bcidFadc.end(), 0);
465
466
467 // Channel as unpacked is a SLink channel ordering, which is different
468 // from PPM channel ordering
469 // the sequence is :
470 // All channel A MCM
471 // All channel D MCM
472 // All channel B MCM
473 // All channel C MCM
474 Identifier chan_id;
475
476 int ppmChannel = subBlock->getPpmChannel(channel);
477
478 msg(MSG::DEBUG) << "--> ZCS: " << ZdcCablingService::getInstance() << endmsg;
479 chan_id = ZdcCablingService::getInstance()->h2s_channel_id(module, ppmChannel);
480
481 const uint32_t chan_hash = chan_id.get_identifier32().get_compact();
482 msg(MSG::DEBUG) << "chan_hash = " << chan_hash << endmsg;
483
484 //Change after uncommenting the above
485 //if (any || error)
486 if (any)
487 {
488 int gain = ZdcCablingService::getInstance()->hwid2gain(module,ppmChannel);
489 int delay = ZdcCablingService::getInstance()->hwid2delay(module,ppmChannel);
490 if (debug)
491 {
492 msg(MSG::DEBUG) << endmsg;
493 msg(MSG::DEBUG) <<" --------------------------------------" << endmsg;
494 msg(MSG::DEBUG) <<
495 "--> ZDC: [SubDet., Crate, Mod., Slink Chn., PPM Chan.] ";
496 msg(MSG::DEBUG) <<
497 "[" << m_subDetector << ", " << crate << ", " <<
498 module << ", " << channel << "," << ppmChannel << "]" << endmsg;
499
500 msg(MSG::DEBUG) << "--> ZDC: LUT: ";
501 printVec(lut);
502 msg(MSG::DEBUG) << endmsg;
503
504 msg(MSG::DEBUG) << "--> ZDC: FADC: ";
505 printVec(fadc);
506 msg(MSG::DEBUG) << endmsg;
507
508 msg(MSG::DEBUG) << "--> ZDC: bcidLUT: ";
509 printVec(bcidLut);
510 msg(MSG::DEBUG) << endmsg;
511
512 msg(MSG::DEBUG) << "--> ZDC: bcidFADC: ";
513 printVec(bcidFadc);
514 msg(MSG::DEBUG) << endmsg;
515
516 msg(MSG::DEBUG) << "--> ZDC ID: " << chan_id.getString() << endmsg;
517 msg(MSG::DEBUG) << "--> ID side: " << m_zdcID->side(chan_id) << endmsg;
518 msg(MSG::DEBUG) << "--> ID module: " << m_zdcID->module(chan_id) << endmsg;
519 msg(MSG::DEBUG) << "--> ID type: " << m_zdcID->type(chan_id) << endmsg;
520 msg(MSG::DEBUG) << "--> ID channel: " << m_zdcID->channel(chan_id) << endmsg;
521
522 msg(MSG::DEBUG) << "gain=" << gain << " delay=" << delay << endmsg;
523
524 msg(MSG::DEBUG) <<" --------------------------------------" << endmsg;
525
526 }
527
528 hashmapType::iterator iter = digits_map.find(chan_hash);
529 if (iter == digits_map.end())
530 {
531 digits_map.insert(std::pair<uint32_t,ZdcDigits*>(chan_hash,new ZdcDigits(chan_id)));
532 iter = digits_map.find(chan_hash);
533 }
534 if (iter != digits_map.end())
535 {
536 if (gain==0&&delay==0) (*iter).second->set_digits_gain0_delay0(fadc);
537 if (gain==1&&delay==0) (*iter).second->set_digits_gain1_delay0(fadc);
538 if (gain==0&&delay==1) (*iter).second->set_digits_gain0_delay1(fadc);
539 if (gain==1&&delay==1) (*iter).second->set_digits_gain1_delay1(fadc);
540 }
541
542 }
543 }
544 }
545 }
546 }
547
548 hashmapType::iterator iter = digits_map.begin();
549 hashmapType::iterator iter_end = digits_map.end();
550
551 while (iter != iter_end)
552 {
553 ttCollection->push_back((*iter).second);
554 ++iter;
555 }
556
557 msg(MSG::DEBUG) << "-->ZDC: Collection has " << ttCollection->size() << " elements " << endmsg;
558
559 return StatusCode::SUCCESS;
560}
561//==================================================================================================
562
563//==================================================================================================
564// Conversion of ZDCCollection to bytestream
565StatusCode ZdcByteStreamTool::convert( const ZdcDigitsCollection* const /*ttCollection*/,
566 RawEventWrite* const /*re*/)
567{
568 //if (re) ttCollection->size();
569 //See PpmByteStreamTool for a implementation
570 return StatusCode::SUCCESS;
571}
572//==================================================================================================
573
574//==================================================================================================
575// Add compression stats to totals
576void ZdcByteStreamTool::addCompStats(const std::vector<uint32_t>& stats)
577{
578 if (stats.empty()) return;
579 const int n = stats.size();
580 if (m_compStats.empty()) m_compStats.resize(n);
581 for (int i = 0; i < n; ++i)
582 m_compStats[i] += stats[i];
583}
584//==================================================================================================
585
586//==================================================================================================
587// Print compression stats
589{
590 msg() << "Compression stats format/count: ";
591 const int n = m_compStats.size();
592 for (int i = 0; i < n; ++i)
593 {
594 msg() << " " << i << "/" << m_compStats[i];
595 }
596 msg() << endmsg;
597}
598//==================================================================================================
599
600//==================================================================================================
601// Return reference to vector with all possible Source Identifiers
602const std::vector<uint32_t>& ZdcByteStreamTool::sourceIDs()
603{
604 if (m_sourceIDs.empty()) {
605 const int maxlinks = ZdcSrcIdMap::maxSlinks();
606 for (int crate = 0; crate < m_crates; ++crate) {
607 for (int slink = 0; slink < maxlinks; ++slink) {
608 const int daqOrRoi = 0;
609 const uint32_t rodId = ZdcSrcIdMap::getRodID(crate, slink, daqOrRoi,
611 const uint32_t robId = ZdcSrcIdMap::getRobID(rodId);
612 m_sourceIDs.push_back(robId);
613 }
614 }
615 }
616 return m_sourceIDs;
617}
618//==================================================================================================
619
620//==================================================================================================
621// Print a vector
622void ZdcByteStreamTool::printVec(const std::vector<int>& vec) const
623{
624 std::vector<int>::const_iterator pos;
625 //msg() << "-----> " ;
626 for (pos = vec.begin(); pos != vec.end(); ++pos)
627 {
628 if (pos != vec.begin()) msg() << ",";
629 msg() << *pos;
630 }
631 //msg() << endmsg;
632}
633//==================================================================================================
634
#define endmsg
std::vector< size_t > vec
double delay(std::size_t d)
const bool debug
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::FullEventFragment RawEventWrite
data type for writing raw event
Definition RawEvent.h:39
static const InterfaceID IID_IZdcByteStreamTool("ZdcByteStreamTool", 1, 1)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
MsgStream & msg() const
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
std::vector< const ROBF * > VROBFRAG
value_type get_compact() const
Get the compact id.
std::string getString() const
Provide a string form of the identifier - hexadecimal.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
int m_dataFormat
Sub_block header version.
DataVector< ZdcPpmSubBlock > m_ppmBlocks
Vector for current PPM sub-blocks.
IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator
int m_fadcThreshold
FADC threshold for super-compressed format.
const std::vector< uint32_t > & sourceIDs()
Return reference to vector with all possible Source Identifiers.
int m_slinks
Number of modules per crate (may not all exist)
void printCompStats() const
Print compression stats.
int m_printCompStats
Compression version.
int m_zeroSuppress
Zero suppression on input.
int m_channels
Number of channels per module (may not all be used)
int m_fadcBaseline
FADC baseline lower bound.
OFFLINE_FRAGMENTS_NAMESPACE::PointerType RODPointer
int m_crates
Number of crates.
int m_dfltSlicesFadc
Default number of FADC slices in simulation.
std::vector< uint32_t > m_compStats
Vector for compression statistics.
std::vector< uint32_t > * m_rodStatus
ROD Status words.
void printVec(const std::vector< int > &vec) const
Print a vector.
StatusCode convert(const IROBDataProviderSvc::VROBFRAG &robFrags, ZdcDigitsCollection *ttCollection)
Convert ROB fragments to ZdcCollection.
eformat::SubDetector m_subDetector
Sub-detector type.
int m_forceSlicesLut
Force number of LUT slices in bytestream.
int m_pedestal
Pedestal value.
virtual StatusCode initialize() override
int m_forceSlicesFadc
Force number of FADC slices in bytestream.
std::vector< uint32_t > m_sourceIDs
ROB source IDs.
ZdcByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode finalize() override
void addCompStats(const std::vector< uint32_t > &stats)
Add compression stats to totals.
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
ZdcPpmSubBlock * m_errorBlock
Trigger tower key provider.
int m_dfltSlicesLut
Default number of LUT slices in simulation.
ZdcSrcIdMap * m_srcIdMap
Source ID converter.
int hwid2gain(int crate, int channel) const
static const ZdcCablingService * getInstance()
get pointer to service instance
int hwid2delay(int crate, int channel) const
Identifier h2s_channel_id(int crate, int channel) const
Definition ZdcID.h:25
Sub-Block class for PPM data.
void setPedestal(int pedval)
void setLutOffset(int offset)
void ppmData(int chan, std::vector< int > &lut, std::vector< int > &fadc, std::vector< int > &bcidLut, std::vector< int > &bcidFadc) const
Return unpacked data for given channel.
void setFadcBaseline(int baseline)
const std::vector< uint32_t > & compStats() const
Return reference to compression stats.
bool unpack()
Unpack data.
void setRunNumber(int run)
static bool errorBlock(uint32_t word)
Check if a header word is for an error block.
void setFadcOffset(int offset)
static int channelsPerSubBlock(int version, int format)
Return the number of channels per sub-block.
int getPpmChannel(const int channel) const
This class provides conversion between Lower level Source ID to higher level source ID for L1Calo Byt...
Definition ZdcSrcIdMap.h:24
static eformat::SubDetector subDet(uint32_t code)
ID -> sub-detector.
static uint32_t getRobID(uint32_t rod_id)
ROD -> ROB.
static int crate(uint32_t code)
moduleID -> crate
static uint32_t getRodID(int crate, int slink, int daqOrRoi, eformat::SubDetector subdet)
Make a ROD Source ID.
static int maxSlinks()
Return the maximum possible number of slinks.
static int daqOrRoi(uint32_t code)
moduleID -> daqOrRoi
static int slink(uint32_t code)
moduleID -> slink
int version() const
OFFLINE_FRAGMENTS_NAMESPACE::PointerType read(const OFFLINE_FRAGMENTS_NAMESPACE::PointerType beg, const OFFLINE_FRAGMENTS_NAMESPACE::PointerType end)
Input complete packed sub-block from ROD array.
int dataWords() const
Return number of data words.
int format() const
int crate() const
std::string unpackErrorMsg() const
Return the unpacking error message for printing.
static SubBlockWordType wordType(uint32_t word)
Word identification.
int module() const
int seqno() const
L1Calo User Header class.
int words() const
Return number of header words (should be one)
int ppmLut() const
int lowerBound() const
Return FADC lower bound.
void setVersion(int minorVersion)
Set version flag.
int ppmFadc() const
bool verbose
Definition hcg.cxx:73