ATLAS Offline Software
Loading...
Searching...
No Matches
TileROD_Decoder.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TILEBYTESTREAM_TILEROD_DECODER_H
6#define TILEBYTESTREAM_TILEROD_DECODER_H
7
8
9// Tile includes
17
29#include "TileEvent/TileCell.h"
32#include "TileEvent/TileL2.h"
41
42// Atlas includes
45#include "eformat/ROBFragment.h"
48
49// Gaudi includes
50#include "GaudiKernel/ToolHandle.h"
51
53
54
55#include <map>
56#include <vector>
57#include <string>
58#include <iostream>
59#include <cassert>
60#include <atomic>
61#include <mutex>
62#include <stdint.h>
63
64
66class TileCellBuilder;
67class TileHid2RESrcID;
68
69namespace TileROD_Helper {
70
71
72// Helper to find the Tile container type corresponding to a collection.
73template <class COLLECTION>
75
76template <>
81
82template <>
87
88template <>
93
94
95} // namespace TileROD_Helper
96
97
118
120
121 public:
122
135
138 TileROD_Decoder(const std::string& type, const std::string& name, const IInterface* parent);
139
142 virtual ~TileROD_Decoder();
143
146 static const InterfaceID& interfaceID();
147
148 virtual StatusCode initialize();
149 virtual StatusCode finalize();
150
154
155 template<class COLLECTION>
159 void fillCollection(const ROBData * rob,
160 COLLECTION& v,
161 typename TileROD_Helper::ContainerForCollection<COLLECTION>::type* container = nullptr) const;
162 uint32_t fillCollectionHLT(const ROBData * rob,
164 D0CellsHLT & d0cells,
165 TileCellCollection * MBTS,
166 const TileHid2RESrcID* hid2reHLT) const;
167 void fillCollectionL2(const ROBData * rob, TileL2Container & v) const;
168 void fillCollectionL2ROS(const ROBData * rob, TileL2Container & v) const;
169 void fillTileLaserObj(const ROBData * rob, TileLaserObject & v) const;
173 void fillCollection_FELIX_Digi(const ROBData* rob, TileDigitsCollection& v) const;
174
175 void setLaserVersion(TileLaserObject & laserObject) const {
176 laserObject.setVersion((m_runPeriod >= 2) ? -2 : -1);
177 }
178
179 void loadRw2Cell(const int section, const std::vector<int>& vec) {
180 // std::cout << vec.size() << std::endl;
181 for (unsigned int i = 0; i < vec.size(); ++i) {
182 // std::cout << vec[i] << std::endl;
183 m_Rw2Cell[section].push_back(vec[i]);
184 }
185 }
186 void loadMBTS(std::map<unsigned int, unsigned int>& mapMBTS, int MBTS_channel);
187 inline const TileHWID* getTileHWID() const { return m_tileHWID;}
188 inline const TileFragHash* hashFunc() const { return &m_hashFunc; }
189
190 StatusCode convert(const RawEvent* re, TileL2Container* L2Cnt) const;
191 StatusCode convertLaser(const RawEvent* re, TileLaserObject* TileLaserObj) const;
192 StatusCode convertTMDBDecision(const RawEvent* re, TileMuonReceiverContainer* tileMuRcv) const;
193
194 void mergeD0cellsHLT (const D0CellsHLT& d0cells, TileCellCollection&) const;
195
196 void loadRw2Pmt(const int section, const std::vector<int>& vec) {
197 for (unsigned int i = 0; i < vec.size(); ++i) {
198 // std::cout << vec[i] << std::endl;
199 m_Rw2Pmt[section].push_back(vec[i]);
200 }
201 }
202
203 // Error reporting
204 void printErrorCounter(bool printIfNoError);
205 int getErrorCounter();
206
207 void printWarningCounter(bool printIfNoWarning);
208 int getWarningCounter();
209
211 return m_hid2reHLT;
212 }
213
215 std::lock_guard<std::mutex> lock (m_HidMutex);
216 if (!m_hid2re) initHid2re();
217 return m_hid2re;
218 }
219
220 const std::vector<int>& getDemoChannelMapLB() { return m_demoChanLB;}
221 const std::vector<int>& getDemoChannelMapEB() { return m_demoChanEB;}
222
223 void setUseFrag0 (bool f) { m_useFrag0 = f; }
224 void setUseFrag1 (bool f) { m_useFrag1 = f; }
225 void setUseFrag4 (bool f) { m_useFrag4 = f; }
226 void setUseFrag5Raw (bool f) { m_useFrag5Raw = f; }
227 void setUseFrag5Reco (bool f) { m_useFrag5Reco = f; }
228
229 enum TileFragStatus {ALL_OK=0, CRC_ERR=1, ALL_FF=0x10, ALL_00=0x20, NO_FRAG=0x40, NO_ROB=0x80};
230
231 private:
232 friend class TileHid2RESrcID;
233
234 typedef std::vector<TileCell *> pCellVec;
235 typedef std::vector<TileDigits *> pDigiVec;
236 typedef std::vector<TileBeamElem *> pBeamVec;
237 typedef std::vector<TileRawChannel *> pRwChVec;
238 typedef std::vector<TileFastRawChannel> FRwChVec;
239
240 // Save ROD metadata (size frag id,Chip CRC+Headers, Trailer DMUMask+CRC)
241 // First element is vector with size,frag,BCID for whole fragment,
242 // second is vector with all trailer words
243 // third is 16 chip headers and forth is 16 chip CRC
244 // In case of calib mode, there are 2 additional vectors, one header and one CRC
245 typedef std::vector<std::vector<uint32_t> > DigitsMetaData_t;
246
247 typedef std::vector<std::vector<uint32_t> > RawChannelMetaData_t;
248
253 const uint32_t* getOFW(int fragId, int unit) const;
254
257 void unpack_frag0(uint32_t version, uint32_t sizeOverhead,
258 DigitsMetaData_t& digitsMetaData,
259 const uint32_t* p, pDigiVec & pDigits, int fragID, int demoType) const;
260
264 void unpack_frag1(uint32_t version, uint32_t sizeOverhead,
265 DigitsMetaData_t& digitsMetaData,
266 const uint32_t* p, pDigiVec & pDigits, int fragID, int demoType) const;
267
275 void unpack_frag2(uint32_t version, uint32_t sizeOverhead,
276 const uint32_t* p, pRwChVec & pChannel, int fragID, int demoType) const;
277
285 void unpack_frag3(uint32_t version, uint32_t sizeOverhead,
286 const uint32_t* p, pRwChVec & pChannel, int fragID, int demoType) const;
287
299 void unpack_frag4(uint32_t version, uint32_t sizeOverhead, unsigned int unit,
300 RawChannelMetaData_t& rawchannelMetaData,
301 const uint32_t* p, pRwChVec & pChannel, int fragID, int demoType) const;
302
303
315 void unpack_frag5(uint32_t version, uint32_t sizeOverhead, unsigned int unit,
316 DigitsMetaData_t& digitsMetaData,
317 const uint32_t* p, pDigiVec & pDigits, pRwChVec & pChannel, int fragID, int demoType) const;
318
321 void unpack_frag6(uint32_t version, uint32_t sizeOverhead,
322 DigitsMetaData_t& digitsMetaData,
323 const uint32_t* p, pDigiVec & pDigits, int fragID, int demoType) const;
324
333 void unpack_frag3HLT(uint32_t version, uint32_t sizeOverhead,
334 const uint32_t* p, FRwChVec & pChannel, int fragID, int demoType) const;
335
344 void unpack_frag2HLT(uint32_t version, uint32_t sizeOverhead,
345 const uint32_t* p, FRwChVec & pChannel, int fragID, int demoType) const;
346
359 void unpack_frag4HLT(uint32_t version, uint32_t sizeOverhead, unsigned int unit, const uint32_t* p, FRwChVec & pChannel, int fragID, int demoType) const;
360
372 void unpack_frag5HLT(uint32_t version, uint32_t sizeOverhead, unsigned int unit, const uint32_t* p, FRwChVec & pChannel, int fragID, int demoType) const;
373
376 void unpack_fragA(uint32_t version,
377 RawChannelMetaData_t& rawchannelMetaData,
378 const uint32_t* p, pRwChVec & pChannel, int fragID, int demoType) const;
381 void unpack_fragAHLT(uint32_t version, const uint32_t* p, uint16_t rob_bcid,
382 uint16_t& mask, int fragID, int demoType) const;
383
391 void unpack_frag10(uint32_t version, const uint32_t* p, TileL2Container & v, int fragID, int demoType) const;
392
400 void unpack_frag11(uint32_t version, const uint32_t* p, TileL2Container & v, int fragID, int demoType) const;
401
407 void unpack_frag12(uint32_t version, const uint32_t* p, TileL2Container & v, int fragID, int demoType) const;
408
415 void unpack_frag13(uint32_t version, const uint32_t* p, TileL2Container & v, int fragID, int demoType) const;
416
419 void unpack_frag14(uint32_t version, const uint32_t* p, TileL2Container & v, int fragID, int demoType) const;
420
424 void unpack_frag15(uint32_t version, const uint32_t* p, TileL2Container & v, int fragID, int demoType) const;
425
428 bool unpack_frag4L2(uint32_t version, uint32_t sizeOverhead, const uint32_t* p, TileL2Container & v, int fragID, int demoType) const;
429
432 bool unpack_frag5L2(uint32_t version, const uint32_t* p, TileL2Container & v, int fragID, int demoType) const;
433
436 void unpack_frag16(uint32_t version, const uint32_t* p, TileLaserObject & v) const; // LASERI
437
440 void unpack_frag17(uint32_t version, uint32_t sizeOverhead, const uint32_t* p, TileLaserObject & v) const; // LASERII
441
444 void unpack_brod(uint32_t version, uint32_t sizeOverhead, const uint32_t* p, pBeamVec & pBeam, int fragID) const;
445
447 void unpack_frag40(uint32_t collid, uint32_t version, const uint32_t* p, int size, TileDigitsCollection &coll) const;
448 void unpack_frag41(uint32_t collid, uint32_t version, const uint32_t* p, int size, TileRawChannelCollection &coll) const;
449 void unpack_frag42(uint32_t sourceid, uint32_t version, const uint32_t* p, int size, TileMuonReceiverContainer &v) const;
450
451 /**/
452
453 inline void make_copy(uint32_t bsflags,
454 TileFragHash::TYPE rChType,
456 DigitsMetaData_t& digitsMetaData,
457 RawChannelMetaData_t& rawchannelMetaData,
458 const ROBData * rob, pDigiVec & pDigits, pRwChVec & pChannel,
460 TileBeamElemContainer* container) const;
461 inline void make_copy(uint32_t bsflags,
462 TileFragHash::TYPE rChType,
464 DigitsMetaData_t& digitsMetaData,
465 RawChannelMetaData_t& rawchannelMetaData,
466 const ROBData * rob, pDigiVec & pDigits, pRwChVec & pChannel,
468 TileDigitsContainer* container) const;
469 inline void make_copy(uint32_t bsflags,
470 TileFragHash::TYPE rChType,
472 DigitsMetaData_t& digitsMetaData,
473 RawChannelMetaData_t& rawchannelMetaData,
474 const ROBData * rob, pDigiVec & pDigits, pRwChVec & pChannel,
476 TileRawChannelContainer* container) const;
477
478 uint32_t make_copyHLT(bool of2,
480 bool correctAmplitude,
481 const FRwChVec & pChannel,
482 TileCellCollection& v, const uint16_t DQuality,
483 D0CellsHLT& d0cells,
484 TileCellCollection * MBTS) const;
485 std::vector<uint32_t> get_correct_data(const uint32_t* p) const;
486 inline void make_copy(const ROBData * rob, pBeamVec & pBeam, TileBeamElemCollection& v) const;
487 inline void make_copy(const ROBData * rob, pBeamVec & pBeam, TileDigitsCollection& v) const;
488 inline void make_copy(const ROBData * rob, pBeamVec & pBeam, TileRawChannelCollection& v) const;
489 inline void make_copy(const ROBData * rob, pBeamVec & pBeam, TileCellCollection& v) const;
490
491 template<typename ELEMENT>
492 inline void delete_vec(std::vector<ELEMENT *> & v) const;
493
494 template<typename ELEMENT, class COLLECTION>
495 inline void copy_vec(std::vector<ELEMENT *> & v, COLLECTION & coll) const;
496
499 bool checkBit(const uint32_t* p, int chan) const;
500
506
507 const TileHWID* m_tileHWID = nullptr;
508
509 Gaudi::Property<bool> m_useFrag0{this, "useFrag0", true, "Use frag0"};
510 Gaudi::Property<bool> m_useFrag1{this, "useFrag1", true, "Use frag1"};
511 Gaudi::Property<bool> m_useFrag4{this, "useFrag4", true, "User frag4"};
512 Gaudi::Property<bool> m_useFrag5Raw{this, "useFrag5Raw", false, "Use frag5 raw"};
513 Gaudi::Property<bool> m_useFrag5Reco{this, "useFrag5Reco", false, "Use frag5 reco"};
514 Gaudi::Property<bool> m_ignoreFrag4HLT{this, "ignoreFrag4HLT", false, "Ignore frag4 HLT"};
515
516 // Outside this time withdow, all amplitudes taken from Reco fragment will be set to zero
517 Gaudi::Property<float> m_allowedTimeMin{this, "AllowedTimeMin", -50.0,
518 "Set amplitude to zero if time is below allowed time minimum"};
519 Gaudi::Property<float> m_allowedTimeMax{this, "AllowedTimeMax", 50.0,
520 "Set amplitude to zero if time is above allowed time maximum"};
521
522 // Thresholds for parabolic amplitude correction
523 Gaudi::Property<float> m_ampMinThresh{this, "AmpMinForAmpCorrection", 15.0,
524 "Correct amplitude if it's above amplitude threshold (in ADC counts)"};
525 Gaudi::Property<float> m_timeMinThresh{this, "TimeMinForAmpCorrection", -12.5,
526 "Correct amplitude is time is above time minimum threshold"};
527 Gaudi::Property<float> m_timeMaxThresh{this, "TimeMaxForAmpCorrection", 12.5,
528 "Correct amplitude is time is below time maximum threshold"};
529
530 Gaudi::Property<unsigned int> m_fullTileRODs{this, "fullTileMode", 320000,
531 "Run from which to take the cabling (for the moment, either 320000 - full 2017 mode (default) - or 0 - 2016 mode)"};
532
533 Gaudi::Property<std::vector<int>> m_demoFragIDs{this,
534 "DemoFragIDs", {}, "List of Tile frag IDs with new electronics (demonstrator)"};
535
536 Gaudi::Property<bool> m_verbose{this, "VerboseOutput", false, "Print extra information"};
537 Gaudi::Property<bool> m_calibrateEnergy{this, "calibrateEnergy", true, "Convert ADC counts to pCb for RawChannels"};
538 Gaudi::Property<bool> m_suppressDummyFragments{this, "suppressDummyFragments", false, "Suppress dummy fragments"};
539 Gaudi::Property<bool> m_maskBadDigits{this, "maskBadDigits", false,
540 "Put -1 in digits vector for channels with bad BCID or CRC in unpack_frag0"};
541
542 Gaudi::Property<int> m_maxWarningPrint{this, "MaxWarningPrint", 1000, "Maximum warning messages to print"};
543 Gaudi::Property<int> m_maxErrorPrint{this, "MaxErrorPrint", 1000, "Maximum error messages to print"};
544
546 "TileHid2RESrcID", "TileHid2RESrcID", "TileHid2RESrcID key"};
547
548 ToolHandle<TileCondToolTiming> m_tileToolTiming{this,
549 "TileCondToolTiming", "TileCondToolTiming", "Tile timing tool"};
550 ToolHandle<TileCondToolOfcCool> m_tileCondToolOfcCool{this,
551 "TileCondToolOfcCool", "TileCondToolOfcCool", "Tile OFC tool"};
552 ToolHandle<TileCondToolEmscale> m_tileToolEmscale{this,
553 "TileCondToolEmscale", "TileCondToolEmscale", "Tile EM scale calibration tool"};
554 ToolHandle<ITileBadChanTool> m_tileBadChanTool{this,
555 "TileBadChanTool", "TileBadChanTool", "Tile bad channel tool"};
556 ToolHandle<TileL2Builder> m_L2Builder{this,
557 "TileL2Builder", "", "Tile L2 builder tool"};
558
559 /*
560 * @brief Name of Tile cabling service
561 */
563 "TileCablingSvc", "TileCablingSvc", "The Tile cabling service"};
564
565 // thresholds for parabolic amplitude correction
568 void updateAmpThreshold(int run = -1);
569
570 // OFWeights for different units and different drawers:
571 // every element contains OFC for single drawer and one of 4 different units
572 mutable std::vector<uint32_t> m_OFWeights[4 * TileCalibUtils::MAX_DRAWERIDX] ATLAS_THREAD_SAFE;
573
574 // Pointers to the start of the data for each vector.
575 mutable std::atomic<const uint32_t*> m_OFPtrs[4 * TileCalibUtils::MAX_DRAWERIDX] ATLAS_THREAD_SAFE;
576
577 // Mutex protecting access to weight vectors.
578 mutable std::mutex m_OFWeightMutex;
579
580 // Mutex protecting access to m_hid2re.
581 mutable std::mutex m_HidMutex;
582
583 // fast decoding
584 std::vector<int> m_Rw2Cell[4];
585 std::vector<int> m_Rw2Pmt[4];
586
589
590 // Map from frag id to MBTS idx
591 std::map<unsigned int, unsigned int> m_mapMBTS;
592 // index of the MBTS channel
594
595 mutable std::atomic<int> m_WarningCounter;
596 mutable std::atomic<int> m_ErrorCounter;
597
600
601 std::vector<int> m_list_of_masked_drawers;
602 void initHid2re();
603 void initHid2reHLT();
604
605 unsigned int m_maxChannels;
608
609 std::vector<int> m_demoChanLB;
610 std::vector<int> m_demoChanEB;
611
612 const uint32_t * get_data(const ROBData * rob) const {
613 const uint32_t * p;
614 if (rob->rod_status_position()==0 &&
615 rob->rod_nstatus() + rob->rod_header_size_word() + rob->rod_trailer_size_word() >= rob->rod_fragment_size_word()) {
616 rob->rod_status(p);
617 } else {
618 rob->rod_data(p);
619 }
620 return p;
621 }
622
623 uint32_t data_size(const ROBData * rob, uint32_t& error) const {
624 uint32_t size = rob->rod_ndata();
625 uint32_t max_allowed_size = rob->rod_fragment_size_word();
626 uint32_t delta = rob->rod_header_size_word() + rob->rod_trailer_size_word();
627 if (max_allowed_size > delta)
628 max_allowed_size -= delta;
629 else
630 max_allowed_size = 0;
631 if (size < 3 && size > 0) {
632 if (rob->rod_source_id() > 0x50ffff) error |= 0x10000; // indicate error in frag size, but ignore error in laser ROD
634 ATH_MSG_WARNING("ROB " << MSG::hex << rob->source_id()
635 << " ROD " << rob->rod_source_id() << MSG::dec
636 << " has unexpected data size: " << size << " - assuming zero size " );
637 }
638 return 0;
639 } else if (rob->rod_header_size_word() >= rob->rod_fragment_size_word()) {
640 if (rob->rod_source_id() > 0x50ffff) error |= 0x10000; // indicate error in frag size, but ignore error in laser ROD
642 ATH_MSG_WARNING("ROB " << MSG::hex << rob->source_id()
643 << " ROD " << rob->rod_source_id() << MSG::dec
644 << " has unexpected header size: " << rob->rod_header_size_word()
645 << " bigger than full size " << rob->rod_fragment_size_word()
646 << " - assuming no data " );
647 }
648 return 0;
649 } else if (size > max_allowed_size) {
650 if (rob->rod_source_id() > 0x50ffff) error |= 0x10000; // indicate error in frag size, but ignore error in laser ROD
651
652 if (size - rob->rod_trailer_size_word() < max_allowed_size) {
654 ATH_MSG_WARNING("ROB " << MSG::hex << rob->source_id()
655 << " ROD " << rob->rod_source_id() << MSG::dec
656 << " data size " << size << " is longer than allowed size " << max_allowed_size
657 << " - assuming that ROD trailer is shorter: "
658 << rob->rod_trailer_size_word()-(size-max_allowed_size)
659 << " words instead of " << rob->rod_trailer_size_word());
660 }
661 max_allowed_size = size;
662 } else if (size - rob->rod_trailer_size_word() == max_allowed_size) {
664 ATH_MSG_WARNING("ROB " << MSG::hex << rob->source_id()
665 << " ROD " << rob->rod_source_id() << MSG::dec
666 << " data size " << size << " is longer than allowed size " << max_allowed_size
667 << " - assuming that ROD trailer ("
668 << rob->rod_trailer_size_word()
669 << " words) is absent");
670 }
671 max_allowed_size = size;
672 } else {
673 max_allowed_size += rob->rod_trailer_size_word();
675 ATH_MSG_WARNING("ROB " << MSG::hex << rob->source_id()
676 << " ROD " << rob->rod_source_id() << MSG::dec
677 << " has unexpected data size: " << size
678 << " - assuming data size = " << max_allowed_size << " words and no ROD trailer at all" );
679 }
680 }
681 return max_allowed_size;
682 } else {
683 return size;
684 }
685 }
686};
687
688template<typename ELEMENT>
689inline void TileROD_Decoder::delete_vec(std::vector<ELEMENT *> & v) const {
690 typedef typename std::vector<ELEMENT *>::const_iterator ELEMENT_const_iterator;
691
692 ELEMENT_const_iterator iCh = v.begin();
693 ELEMENT_const_iterator iEnd = v.end();
694 for (; iCh != iEnd; ++iCh) delete (*iCh);
695 v.clear();
696}
697
698template<typename ELEMENT, class COLLECTION>
699inline void TileROD_Decoder::copy_vec(std::vector<ELEMENT *> & v, COLLECTION & coll) const {
700 typedef typename std::vector<ELEMENT *>::const_iterator ELEMENT_const_iterator;
701
702 ELEMENT_const_iterator iCh = v.begin();
703 ELEMENT_const_iterator iEnd = v.end();
704 for (; iCh != iEnd; ++iCh) coll.push_back(*iCh);
705}
706
707inline
708void TileROD_Decoder::make_copy(uint32_t /*bsflags*/,
709 TileFragHash::TYPE /*rChType*/,
710 TileRawChannelUnit::UNIT /*rChUnit*/,
711 DigitsMetaData_t& digitsMetaData,
712 RawChannelMetaData_t& /*rawchannelMetaData*/,
713 const ROBData * rob,
714 pDigiVec & pDigits,
715 pRwChVec & pChannel,
717 TileDigitsContainer* /*container*/) const
718{
719 copy_vec(pDigits, v); // Digits stored
720
721 if (pChannel.size() > 0) { // RawChannels deleted
722 delete_vec(pChannel);
723 }
724
725 v.setLvl1Id(rob->rod_lvl1_id());
726 v.setLvl1Type(rob->rod_lvl1_trigger_type());
727 v.setDetEvType(rob->rod_detev_type());
728 v.setRODBCID(rob->rod_bc_id());
729
730 uint32_t status = TileFragStatus::ALL_OK;
731 for (size_t j=0; j<digitsMetaData[6].size(); ++j) {
732 status |= digitsMetaData[6][j];
733 }
734
735 if (v.size() > 0) {
736 // Set meta data
737 v.setFragSize(digitsMetaData[0][0]);
738 v.setFragBCID(digitsMetaData[0][2] | (status<<16));
739
740 v.setFragExtraWords(digitsMetaData[1]);
741
742 v.setFragChipHeaderWords(digitsMetaData[2]);
743 v.setFragChipCRCWords(digitsMetaData[3]);
744
745 if (v.isCalibMode()) {
746 v.setFragChipHeaderWordsHigh(digitsMetaData[4]);
747 v.setFragChipCRCWordsHigh(digitsMetaData[5]);
748 }
749 if (m_verbose) v.printExtra();
750 } else if ( digitsMetaData[0].size() == 0 ) {
751 // no useful digi fragment or no data inside fragment
752 status |= TileFragStatus::NO_FRAG;
753 v.setFragBCID(0xDEAD | (status<<16));
754 v.setFragSize(0);
755 }
756
757 if (status!=TileFragStatus::ALL_OK)
758 ATH_MSG_DEBUG( "Status for drawer 0x" << MSG::hex << v.identify() << " in Digi frag is 0x" << status << MSG::dec);
759}
760
761inline
762void TileROD_Decoder::make_copy(uint32_t bsflags,
763 TileFragHash::TYPE rChType,
765 DigitsMetaData_t& /*digitsMetaData*/,
766 RawChannelMetaData_t& rawchannelMetaData,
767 const ROBData * rob,
768 pDigiVec & pDigits,
769 pRwChVec & pChannel,
771 TileRawChannelContainer* container) const
772{
773 if (pChannel.size() > 0) { // take available raw channels
774 // and store in collection
775 if (container) {
776 ATH_MSG_VERBOSE( "RawChannel unit is " << rChUnit
777 << " - setting unit in TileRawChannelContainer " );
778 container->set_unit(rChUnit);
779 container->set_type(rChType);
780 container->set_bsflags(bsflags);
781 } else {
782 ATH_MSG_ERROR( "Can't set unit=" << rChUnit << " in TileRawChannelContainer" );
783 }
784
785 copy_vec(pChannel, v);
786
787 if (pDigits.size() > 0) delete_vec(pDigits); // Digits deleted
788
789 } else {
790
791 if (pDigits.size() > 0) { // convert digits to raw channels
792 // and store directly in collection
793 ATH_MSG_VERBOSE( " No reco frag in BS " );
794 //m_RCBuilder->build(pDigits.begin(),pDigits.end(),(&v));
795
796 delete_vec(pDigits); // Digits deleted
797
798 } else {
799 ATH_MSG_DEBUG( "data for drawer 0x" << MSG::hex << v.identify() << MSG::dec << " not found in BS" );
800 }
801 rawchannelMetaData[6].push_back(TileFragStatus::NO_FRAG);
802 HWIdentifier drawerID = m_tileHWID->drawer_id(v.identify());
803 for (unsigned int ch = 0; ch < m_maxChannels; ++ch) {
804 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, ch, 0);
805 v.push_back(new TileRawChannel(adcID, 0.0, -100.0, 31));
806 }
807
808 }
809
810 v.setLvl1Id(rob->rod_lvl1_id());
811 v.setLvl1Type(rob->rod_lvl1_trigger_type());
812 v.setDetEvType(rob->rod_detev_type());
813 v.setRODBCID(rob->rod_bc_id());
814
815 if (rChUnit < TileRawChannelUnit::OnlineOffset && rChType > TileFragHash::OptFilterDsp) { // set good status for BS from MC
816 rawchannelMetaData[0].push_back(0);
817 rawchannelMetaData[0].push_back(0xDEAD);
818 rawchannelMetaData[5].push_back(0xFFFF);
819 rawchannelMetaData[5].push_back(0xFFFF);
820 }
821
822 for (unsigned int i = 0; i < 6; ++i) {
823 for (size_t j=rawchannelMetaData[i].size(); j<2; ++j) {
824 rawchannelMetaData[i].push_back(0);
825 }
826 }
827
828 uint32_t status = (rawchannelMetaData[0][0] & 0x1) ? TileFragStatus::CRC_ERR : TileFragStatus::ALL_OK ;
829 for (size_t j=0; j<rawchannelMetaData[6].size(); ++j) {
830 status |= rawchannelMetaData[6][j];
831 }
832 if (status>TileFragStatus::CRC_ERR)
833 ATH_MSG_DEBUG( "Status for drawer 0x" << MSG::hex << v.identify() << " is 0x" << status << MSG::dec);
834
835 v.setFragGlobalCRC(status);
836 v.setFragDSPBCID(rawchannelMetaData[0][1]);
837 v.setFragBCID(rawchannelMetaData[1][0]);
838 v.setFragMemoryPar(rawchannelMetaData[1][1]);
839 v.setFragSstrobe(rawchannelMetaData[2][0]);
840 v.setFragDstrobe(rawchannelMetaData[2][1]);
841 v.setFragHeaderBit(rawchannelMetaData[3][0]);
842 v.setFragHeaderPar(rawchannelMetaData[3][1]);
843 v.setFragSampleBit(rawchannelMetaData[4][0]);
844 v.setFragSamplePar(rawchannelMetaData[4][1]);
845 v.setFragFEChipMask(rawchannelMetaData[5][0]);
846 if (std::binary_search(m_demoFragIDs.begin(), m_demoFragIDs.end(), v.identify()))
847 v.setFragRODChipMask(rawchannelMetaData[5][0]);
848 else
849 v.setFragRODChipMask(rawchannelMetaData[5][1]);
850}
851
852inline
853void TileROD_Decoder::make_copy(uint32_t /*bsflags*/,
854 TileFragHash::TYPE /*rChType*/,
855 TileRawChannelUnit::UNIT /*rChUnit*/,
856 DigitsMetaData_t& /*digitsMetaData*/,
857 RawChannelMetaData_t& /*rawchannelMetaData*/,
858 const ROBData * /* rob */, pDigiVec & pDigits,
859 pRwChVec & pChannel, TileBeamElemCollection &,
860 TileBeamElemContainer* /*container*/) const
861{
862 // do nothing
863 delete_vec(pDigits);
864 delete_vec(pChannel);
865}
866
867inline
869 TileBeamElemCollection & v) const {
870 copy_vec(pBeam, v);
871
872 v.setLvl1Id(rob->rod_lvl1_id());
873 v.setLvl1Type(rob->rod_lvl1_trigger_type());
874 v.setDetEvType(rob->rod_detev_type());
875 v.setRODBCID(rob->rod_bc_id());
876}
877
878inline
879void TileROD_Decoder::make_copy(const ROBData * /* rob */, pBeamVec & pBeam,
880 TileDigitsCollection &) const {
881 // do nothing
882 delete_vec(pBeam);
883}
884
885inline
886void TileROD_Decoder::make_copy(const ROBData * /* rob */, pBeamVec & pBeam,
887 TileRawChannelCollection &) const {
888 // do nothing
889 delete_vec(pBeam);
890}
891
892inline
893void TileROD_Decoder::make_copy(const ROBData * /* rob */, pBeamVec & pBeam,
894 TileCellCollection &) const {
895 // do nothing
896 delete_vec(pBeam);
897}
898
899
900// ---- Implement the template method:
901
906template<class COLLECTION>
908 COLLECTION & v,
909 typename TileROD_Helper::ContainerForCollection<COLLECTION>::type* container /*= nullptr*/) const
910{
911 //
912 // get info from ROD header
913 //
914 // if (msgLvl(MSG::VERBOSE)) {
915 // msg(MSG::VERBOSE) << "ROD header info: " << endmsg
916 // msg(MSG::VERBOSE) << " Format Vers. " << MSG::hex << "0x" << rob->rod_version() << MSG::dec << endmsg;
917 // msg(MSG::VERBOSE) << " Source ID " << MSG::hex << "0x" << rob->rod_source_id() << MSG::dec << endmsg;
918 // msg(MSG::VERBOSE) << " Source ID str " << eformat::helper::SourceIdentifier(rob->source_id()).human().c_str() << endmsg;
919 // msg(MSG::VERBOSE) << " Run number " << (int) rob->rod_run_no() << endmsg;
920 // msg(MSG::VERBOSE) << " Level1 ID " << rob->rod_lvl1_id() << endmsg;
921 // msg(MSG::VERBOSE) << " BCID " << rob->rod_bc_id() << endmsg;
922 // msg(MSG::VERBOSE) << " Lvl1 TrigType " << rob->rod_lvl1_trigger_type() << endmsg;
923 // msg(MSG::VERBOSE) << " Event Type " << rob->rod_detev_type() << endmsg;
924 // msg(MSG::VERBOSE) << " Fragment size " << rob->rod_fragment_size_word() << endmsg;
925 // msg(MSG::VERBOSE) << " Header size " << rob->rod_header_size_word() << endmsg;
926 // msg(MSG::VERBOSE) << " Trailer size " << rob->rod_trailer_size_word() << endmsg;
927 // msg(MSG::VERBOSE) << " N data " << rob->rod_ndata() << endmsg;
928 // msg(MSG::VERBOSE) << " N status " << rob->rod_nstatus() << endmsg;
929 // msg(MSG::VERBOSE) << " Status pos " << rob->rod_status_position() << endmsg;
930 // }
931
932 uint32_t version = rob->rod_version() & 0xFFFF;
933
934 bool isBeamROD = false;
935 // figure out which fragment we want to unpack
936 TileRawChannelCollection::ID frag_id = v.identify();
938 const std::vector<uint32_t> & drawer_info = hid2re->getDrawerInfo(frag_id);
939 int bs_frag_id = drawer_info.size()>1 ? static_cast<int>(drawer_info[1]) : frag_id;
940 int drawer_type = drawer_info.size()>2 ? static_cast<int>(drawer_info[2]) : -1;
941
942 uint32_t mask = 0xFFFF;
943
944 // special conversion for sub-fragments in beam ROD
945 if (frag_id < 0x100) {
946 isBeamROD = true;
947 mask = 0xFF; // this is needed for TB 2003, when beam frag_id >= 0x400
948 }
949
950 // find all fragments with given Fragment ID
951 // and possibly with different types
952 std::vector<const uint32_t *> pFrag;
953 pFrag.reserve(5);
954
955 uint32_t error = 0;
956 uint32_t wc = 0;
957 uint32_t size = data_size(rob, error);
958 const uint32_t * p = get_data(rob);
959
960 // 2 extra words in every frag by default (frag id + frag size)
961 // but for all data after 2005 it is set to 3 later in the code
962 uint32_t sizeOverhead = 2;
963
964 // bool skipWords = ( ! isBeamROD && version == 0x1 );
965 // std::cout << " *(p) = 0x" << std::hex << (*(p)) << std::dec << std::endl;
966 if (size) {
967 bool V3format = (*(p) == 0xff1234ff); // additional frag marker since Sep 2005
968 V3format |= (*(p) == 0x00123400); // additional frag marker since Sep 2005 (can appear in buggy ROD frags)
969 if (!V3format && version>0xff) {
970 V3format = true;
972 ATH_MSG_WARNING("fillCollection: corrupted frag separator 0x" << MSG::hex << (*p) << " instead of 0xff1234ff in ROB 0x" << rob->rod_source_id() << MSG::dec );
973 }
974 if (V3format) {
975 ++p; // skip frag marker
976 sizeOverhead = 3;
977 } else {
978 sizeOverhead = 2;
979 }
980 }
981
982 //std::cout << std::hex << " frag_id " << frag_id << " mask " << mask
983 // << " version " << version << " sizeOverhead " << sizeOverhead
984 // << " skipWords " << skipWords << " V3format " << V3format
985 // << std::dec << std::endl;
986 //std::cout << " size is "<< size << std::endl;
987
988 while (wc < size) { // iterator over all words in a ROD
989
990 // first word is frag size
991 uint32_t count = *(p);
992 // second word is frag ID (16 bits) frag type (8 bits) and additional flags
993 uint32_t idAndType = *(p + 1);
994 int frag = (idAndType & mask);
995 int type = (idAndType & 0xF00000) >> 16; // note special mask, we ignore one digit, keep only 0x10, 0x20, 0x30, ...
996
998 int cnt = 0;
999 for (; wc < size; ++wc, ++cnt, ++p) {
1000 if ((*p) == 0xff1234ff) {
1001 ++cnt;
1002 ++wc;
1003 ++p;
1004 break;
1005 }
1006 }
1007 if ((m_ErrorCounter++) < m_maxErrorPrint) {
1008 msg(MSG::WARNING) << "Frag 0x" << MSG::hex << frag << MSG::dec
1009 << " has unexpected size: " << count;
1010 if (wc < size) {
1011 msg(MSG::WARNING) << " skipping " << cnt << " words to the next frag" << endmsg;
1012 } else {
1013 msg(MSG::WARNING) << " ignoring " << cnt << " words till the end of ROD frag" << endmsg;
1014 }
1015 }
1016 continue;
1017 }
1018
1019 if (type != 0x10 && frag == bs_frag_id) pFrag.push_back(p);
1020
1021 p += count;
1022 wc += count;
1023
1024 //std::cout << " frag ="<<frag<<" type = "<<type<<" count="<<count<<std::endl;
1025
1026 // this is not needed anymore, since we can't read very old BS files anyhow.
1027 //if ( skipWords && type == 0 && wc < size ) { // special treatment of preROD output with digits
1028 // wc+=7; p+=7; // skip extra header
1029 //}
1030 }
1031
1032 if (wc != size) {
1033 // check word count
1034 if ((m_ErrorCounter++) < m_maxErrorPrint) {
1035 ATH_MSG_WARNING( "Incorrect ROD size: " << wc << " words instead of " << size );
1036 }
1037 assert(0);
1038 // return;
1039 }
1040
1041 static const bool unpackDigits = std::is_same_v<COLLECTION, TileDigitsCollection>;
1042 static const bool unpackChannels = std::is_same_v<COLLECTION, TileRawChannelCollection>;
1043
1044 if (isBeamROD) {
1045
1046 pBeamVec pBeam;
1047 pBeam.reserve(16);
1048
1049 std::vector<const uint32_t *>::const_iterator it = pFrag.begin();
1050 std::vector<const uint32_t *>::const_iterator itEnd = pFrag.end();
1051
1052 for (; it != itEnd; ++it) {
1053
1054 p = (*it);
1055
1056 unpack_brod(version, sizeOverhead, p, pBeam, frag_id);
1057 }
1058
1059 make_copy(rob, pBeam, v);
1060
1061 } else {
1062
1063 pDigiVec pDigits;
1064 pRwChVec pChannel;
1065 pChannel.reserve(48);
1066
1067 // initialize meta data storage
1068 DigitsMetaData_t digitsMetaData (7);
1069 RawChannelMetaData_t rawchannelMetaData (7);
1070 for (unsigned int i = 0; i < 7; ++i) {
1071 digitsMetaData[i].reserve(16);
1072 rawchannelMetaData[i].reserve(2);
1073 }
1074
1075 // now unpack all channels in all fragments
1076 // and fill temporary array of TileDigits and/or TileRawChannels
1077
1078 std::vector<const uint32_t *>::const_iterator it = pFrag.begin();
1079 std::vector<const uint32_t *>::const_iterator itEnd = pFrag.end();
1080
1081 uint32_t bsflags = 0;
1084
1085 for (; it != itEnd; ++it) {
1086
1087 p = (*it);
1088 // first word is frag size
1089 // uint32_t count = *(p);
1090 // second word is frag ID (16 bits) frag type (8 bits) and additional flags
1091 uint32_t idAndType = *(p + 1);
1092 int type = (idAndType & 0x00FF0000) >> 16;
1093
1094 ATH_MSG_VERBOSE( "Unpacking frag: 0x" << MSG::hex << (idAndType & 0xFFFF)
1095 << " type " << type << MSG::dec );
1096
1097 switch (type) {
1098 case 0:
1099 if (unpackDigits && m_useFrag0) unpack_frag0(version, sizeOverhead, digitsMetaData, p, pDigits, frag_id, drawer_type);
1100 break;
1101 case 1:
1102 if (unpackDigits && m_useFrag1) unpack_frag1(version, sizeOverhead, digitsMetaData, p, pDigits, frag_id, drawer_type);
1103 break;
1104 case 2:
1105 if (unpackChannels && m_useFrag4) unpack_frag2(version, sizeOverhead, p, pChannel, frag_id, drawer_type);
1106 break;
1107 case 3:
1108 if (unpackChannels && m_useFrag4) unpack_frag3(version, sizeOverhead, p, pChannel, frag_id, drawer_type);
1109 break;
1110 case 4:
1111 if (unpackChannels && m_useFrag4) {
1112 bsflags = idAndType & 0xFFFF0000; // ignore frag num, keep all the rest
1113 int unit = (idAndType & 0xC0000000) >> 30;
1114
1115 int DataType = (idAndType & 0x30000000) >> 28;
1116
1117 if (DataType < 3) { // real data
1118
1119 // only one bit for type and next 2 bits for number of iterations
1120 //int AlgoType = (idAndType & 0x4000000) >> 26;
1121 //if (AlgoType == 0) rChType = TileFragHash::OF1Filter;
1122 //else rChType = TileFragHash::OF2Filter;
1123 // always set special type, which means now that OF is done inside DSP
1125
1126 // Attention! Switching to Online Units for release 14.2.0
1127 rChUnit = (TileRawChannelUnit::UNIT) (unit + TileRawChannelUnit::OnlineOffset); // Online units in real data
1128 // rChUnit = (TileRawChannelUnit::UNIT) ( unit );
1129
1130 } else { // simulated data
1131
1132 // all 3 bits for type
1133 int AlgoType = (idAndType & 0x7000000) >> 24;
1134 rChType = (TileFragHash::TYPE) AlgoType;
1135
1136 rChUnit = (TileRawChannelUnit::UNIT) (unit); // Offline units in simulated data
1137
1138 }
1139
1140 unpack_frag4(version, sizeOverhead, unit, rawchannelMetaData, p, pChannel, frag_id, drawer_type);
1141 }
1142 break;
1143
1144 case 5:
1146 bsflags = idAndType & 0xFFFF0000; // ignore frag num, keep all the rest
1147 int unit = (idAndType & 0xC0000000) >> 30;
1148
1149 // always set special type, which means now that OF is done inside DSP
1151
1153 unpack_frag5(version, sizeOverhead, unit,
1154 digitsMetaData,
1155 p, pDigits, pChannel, frag_id, drawer_type);
1156 }
1157 break;
1158
1159 case 6:
1160 break;
1161
1162 case 0xA:
1163 if (unpackChannels) unpack_fragA(version, rawchannelMetaData, p, pChannel, frag_id, drawer_type);
1164 break;
1165
1166 default:
1167 int frag = idAndType & 0xFFFF;
1168 ATH_MSG_WARNING( "Unknown frag type=" << type << " for frag=" << frag );
1169 assert(0);
1170 break;
1171 }
1172 } // end of all frags
1173
1174 make_copy(bsflags, rChType, rChUnit, digitsMetaData, rawchannelMetaData,
1175 rob, pDigits, pChannel, v, container);
1176 }
1177
1178 return;
1179}
1180
1181#endif
const std::regex re(r_e)
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
#define endmsg
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
std::vector< size_t > vec
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition RawEvent.h:37
size_t size() const
Number of registered mappings.
void section(const std::string &sec)
TileContainer< TileMuonReceiverObj > TileMuonReceiverContainer
TileContainer< TileL2 > TileL2Container
Define macros for attributes used to control the static checker.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
MsgStream & msg() const
static const unsigned int MAX_DRAWERIDX
Maximal drawer index.
This class creates Cells from RawChannels and stores them in a container.
This class converts TileDigits to and from bytestream in ROD format.
Hash table for Tile fragments (==drawers ==collections in StoreGate).
TYPE
initialize
Helper class for TileCal online (hardware) identifiers.
Definition TileHWID.h:49
This class provides conversion between fragment ID and RESrcID.
void setVersion(const int version)
void unpack_frag11(uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
unpack_frag11 decodes tile subfragment type 0x11.
const TileHWID * getTileHWID() const
Gaudi::Property< bool > m_useFrag1
std::vector< int > m_Rw2Pmt[4]
void make_copy(uint32_t bsflags, TileFragHash::TYPE rChType, TileRawChannelUnit::UNIT rChUnit, DigitsMetaData_t &digitsMetaData, RawChannelMetaData_t &rawchannelMetaData, const ROBData *rob, pDigiVec &pDigits, pRwChVec &pChannel, TileBeamElemCollection &v, TileBeamElemContainer *container) const
uint32_t fillCollectionHLT(const ROBData *rob, TileCellCollection &v, D0CellsHLT &d0cells, TileCellCollection *MBTS, const TileHid2RESrcID *hid2reHLT) const
std::vector< int > m_demoChanEB
void mergeD0cellsHLT(const D0CellsHLT &d0cells, TileCellCollection &) const
float m_ampMinThresh_pC
correct amplitude if it's above amplitude threshold (in pC)
Gaudi::Property< float > m_allowedTimeMin
void fillTileLaserObj(const ROBData *rob, TileLaserObject &v) const
void unpack_frag14(uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
unpack_frag14 decodes tile subfragment type 0x14.
const TileHid2RESrcID * getHid2reHLT()
SG::ReadCondHandleKey< TileHid2RESrcID > m_hid2RESrcIDKey
TileHid2RESrcID * m_hid2re
StatusCode convert(const RawEvent *re, TileL2Container *L2Cnt) const
Gaudi::Property< bool > m_calibrateEnergy
void unpack_frag42(uint32_t sourceid, uint32_t version, const uint32_t *p, int size, TileMuonReceiverContainer &v) const
std::vector< uint32_t > get_correct_data(const uint32_t *p) const
void unpack_frag5(uint32_t version, uint32_t sizeOverhead, unsigned int unit, DigitsMetaData_t &digitsMetaData, const uint32_t *p, pDigiVec &pDigits, pRwChVec &pChannel, int fragID, int demoType) const
unpack_frag5 decodes tile subfragment type 0x4.
void unpack_frag15(uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
unpack_frag15 decodes tile subfragment type 0x15.
std::vector< TileDigits * > pDigiVec
void unpack_frag12(uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
unpack_frag12 decodes tile subfragment type 0x12.
void updateAmpThreshold(int run=-1)
void unpack_frag41(uint32_t collid, uint32_t version, const uint32_t *p, int size, TileRawChannelCollection &coll) const
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
void copy_vec(std::vector< ELEMENT * > &v, COLLECTION &coll) const
uint32_t make_copyHLT(bool of2, TileRawChannelUnit::UNIT rChUnit, bool correctAmplitude, const FRwChVec &pChannel, TileCellCollection &v, const uint16_t DQuality, D0CellsHLT &d0cells, TileCellCollection *MBTS) const
const std::vector< int > & getDemoChannelMapEB()
friend class TileHid2RESrcID
Gaudi::Property< bool > m_useFrag4
Gaudi::Property< int > m_maxWarningPrint
void fillContainer_TileMuRcv_Decision(const ROBData *rob, TileMuonReceiverContainer &v) const
Gaudi::Property< int > m_maxErrorPrint
void unpack_frag3(uint32_t version, uint32_t sizeOverhead, const uint32_t *p, pRwChVec &pChannel, int fragID, int demoType) const
unpack_frag3 decodes tile subfragment type 0x3.
void unpack_frag4(uint32_t version, uint32_t sizeOverhead, unsigned int unit, RawChannelMetaData_t &rawchannelMetaData, const uint32_t *p, pRwChVec &pChannel, int fragID, int demoType) const
unpack_frag4 decodes tile subfragment type 0x4.
void unpack_frag4HLT(uint32_t version, uint32_t sizeOverhead, unsigned int unit, const uint32_t *p, FRwChVec &pChannel, int fragID, int demoType) const
unpack_frag4HLT decodes tile subfragment type 0x4 for the high level trigger (HLT).
TileRawChannel2Bytes5 m_rc2bytes5
void unpack_frag1(uint32_t version, uint32_t sizeOverhead, DigitsMetaData_t &digitsMetaData, const uint32_t *p, pDigiVec &pDigits, int fragID, int demoType) const
unpack_frag1 decodes tile subfragment type 0x1.
void unpack_frag10(uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
unpack_frag10 decodes tile subfragment type 0x10.
void loadRw2Cell(const int section, const std::vector< int > &vec)
void fillCollectionL2(const ROBData *rob, TileL2Container &v) const
const TileHWID * m_tileHWID
std::vector< std::vector< uint32_t > > RawChannelMetaData_t
Gaudi::Property< float > m_ampMinThresh
Gaudi::Property< float > m_timeMinThresh
Gaudi::Property< bool > m_useFrag5Reco
std::map< unsigned int, unsigned int > m_mapMBTS
std::vector< uint32_t > m_OFWeights[4 *TileCalibUtils::MAX_DRAWERIDX] ATLAS_THREAD_SAFE
std::mutex m_OFWeightMutex
TileRawChannel2Bytes m_rc2bytes
void printWarningCounter(bool printIfNoWarning)
std::vector< TileFastRawChannel > FRwChVec
TileRawChannel2Bytes4 m_rc2bytes4
void loadMBTS(std::map< unsigned int, unsigned int > &mapMBTS, int MBTS_channel)
ToolHandle< TileL2Builder > m_L2Builder
TileDigits2Bytes m_d2Bytes
bool unpack_frag4L2(uint32_t version, uint32_t sizeOverhead, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
unpack_frag4L2 decodes tile subfragment type 0x4 and extract transverse energy from this fragment
unsigned int m_maxChannels
void setUseFrag1(bool f)
const std::vector< int > & getDemoChannelMapLB()
ToolHandle< TileCondToolOfcCool > m_tileCondToolOfcCool
std::vector< int > m_Rw2Cell[4]
Gaudi::Property< float > m_allowedTimeMax
void unpack_frag6(uint32_t version, uint32_t sizeOverhead, DigitsMetaData_t &digitsMetaData, const uint32_t *p, pDigiVec &pDigits, int fragID, int demoType) const
unpack_frag6 decodes tile subfragment type 0x6.
TileHid2RESrcID * m_hid2reHLT
void fillCollection_TileMuRcv_RawChannel(const ROBData *rob, TileRawChannelCollection &v) const
Gaudi::Property< std::vector< int > > m_demoFragIDs
void unpack_frag16(uint32_t version, const uint32_t *p, TileLaserObject &v) const
unpack_frag16 decodes tile subfragment type 0x16 or 0x20.
virtual StatusCode finalize()
Gaudi::Property< bool > m_maskBadDigits
std::vector< TileCell * > pCellVec
void unpack_fragAHLT(uint32_t version, const uint32_t *p, uint16_t rob_bcid, uint16_t &mask, int fragID, int demoType) const
unpack_fragAHLT decodes tile subfragment type 0XA.
void unpack_frag2(uint32_t version, uint32_t sizeOverhead, const uint32_t *p, pRwChVec &pChannel, int fragID, int demoType) const
unpack_frag2 decodes tile subfragment type 0x2.
std::vector< int > m_list_of_masked_drawers
void setUseFrag5Reco(bool f)
virtual ~TileROD_Decoder()
destructor
const uint32_t * get_data(const ROBData *rob) const
TileFragHash m_hashFunc
Gaudi::Property< bool > m_verbose
StatusCode convertTMDBDecision(const RawEvent *re, TileMuonReceiverContainer *tileMuRcv) const
std::atomic< int > m_ErrorCounter
void unpack_frag40(uint32_t collid, uint32_t version, const uint32_t *p, int size, TileDigitsCollection &coll) const
unpacking methods dedicated to the TMDB ROD format sub-fragments 0x40 0x41 0x42
ToolHandle< ITileBadChanTool > m_tileBadChanTool
std::vector< std::vector< uint32_t > > DigitsMetaData_t
void unpack_frag17(uint32_t version, uint32_t sizeOverhead, const uint32_t *p, TileLaserObject &v) const
unpack_frag17 decodes tile subfragment type 0x17 or 0x20.
std::vector< TileRawChannel * > pRwChVec
void fillCollectionL2ROS(const ROBData *rob, TileL2Container &v) const
void fillCollection_TileMuRcv_Digi(const ROBData *rob, TileDigitsCollection &v) const
bool checkBit(const uint32_t *p, int chan) const
check the bitmap for a channel
void unpack_frag3HLT(uint32_t version, uint32_t sizeOverhead, const uint32_t *p, FRwChVec &pChannel, int fragID, int demoType) const
unpack_frag3HLT decodes tile subfragment type 0x3 for the high level trigger (HLT).
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
void printErrorCounter(bool printIfNoError)
void unpack_frag5HLT(uint32_t version, uint32_t sizeOverhead, unsigned int unit, const uint32_t *p, FRwChVec &pChannel, int fragID, int demoType) const
unpack_frag5HLT decodes tile subfragment type 0x5 for the high level trigger (HLT).
Gaudi::Property< float > m_timeMaxThresh
void unpack_frag0(uint32_t version, uint32_t sizeOverhead, DigitsMetaData_t &digitsMetaData, const uint32_t *p, pDigiVec &pDigits, int fragID, int demoType) const
unpack_frag0 decodes tile subfragment type 0x0.
virtual StatusCode initialize()
const TileFragHash * hashFunc() const
std::vector< TileBeamElem * > pBeamVec
void loadRw2Pmt(const int section, const std::vector< int > &vec)
std::mutex m_HidMutex
void setUseFrag5Raw(bool f)
void delete_vec(std::vector< ELEMENT * > &v) const
void setUseFrag4(bool f)
bool unpack_frag5L2(uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
unpack_frag5L2 decodes tile subfragment type 0x5 and extract transverse energy from this fragment
TileROD_Decoder(const std::string &type, const std::string &name, const IInterface *parent)
constructor
void setLaserVersion(TileLaserObject &laserObject) const
ToolHandle< TileCondToolTiming > m_tileToolTiming
float m_ampMinThresh_MeV
correct amplitude if it's above amplitude threshold (in MeV)
void fillCollection(const ROBData *rob, COLLECTION &v, typename TileROD_Helper::ContainerForCollection< COLLECTION >::type *container=nullptr) const
This method calls the unpacking methods to decode the ROD data and fills the TileDigitsContainer and/...
Gaudi::Property< bool > m_useFrag5Raw
Gaudi::Property< unsigned int > m_fullTileRODs
Gaudi::Property< bool > m_useFrag0
ServiceHandle< TileCablingSvc > m_cablingSvc
uint32_t data_size(const ROBData *rob, uint32_t &error) const
void unpack_frag13(uint32_t version, const uint32_t *p, TileL2Container &v, int fragID, int demoType) const
unpack_frag13 decodes tile subfragment type 0x13.
eformat::ROBFragment< const uint32_t * > ROBData
convert ROD Data words into either TileCell or TileRawChannel.
void setUseFrag0(bool f)
Gaudi::Property< bool > m_ignoreFrag4HLT
std::vector< int > m_demoChanLB
const uint32_t * getOFW(int fragId, int unit) const
getOFW returns Optimal Filtering Weights for Frag5 decoder loaded from COOL for correspondent units.
TileRawChannel2Bytes2 m_rc2bytes2
const TileHid2RESrcID * getHid2re()
std::atomic< int > m_WarningCounter
StatusCode convertLaser(const RawEvent *re, TileLaserObject *TileLaserObj) const
void fillCollection_FELIX_Digi(const ROBData *rob, TileDigitsCollection &v) const
void unpack_brod(uint32_t version, uint32_t sizeOverhead, const uint32_t *p, pBeamVec &pBeam, int fragID) const
unpack_brod decodes all ancillary tile subfragments coming from beam ROD at the testbeam or LASTROD i...
Gaudi::Property< bool > m_suppressDummyFragments
void unpack_frag2HLT(uint32_t version, uint32_t sizeOverhead, const uint32_t *p, FRwChVec &pChannel, int fragID, int demoType) const
unpack_frag2HLT decodes tile subfragment type 0x2 for the high level trigger (HLT).
void unpack_fragA(uint32_t version, RawChannelMetaData_t &rawchannelMetaData, const uint32_t *p, pRwChVec &pChannel, int fragID, int demoType) const
unpack_fragA decodes tile subfragment type 0XA.
Converts the TileRawChannel object into bytes as it is defined at the testbeam.
Converts the TileRawChannel object into bytes as it is defined at the commissioning 2007.
Converts the TileRawChannel object into bytes as it.
Converts the TileRawChannel object into bytes.
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:148
TileFastRawChannel m_D0channeg[64]
TileFastRawChannel m_D0chanpos[64]
int run(int argc, char *argv[])