ATLAS Offline Software
Loading...
Searching...
No Matches
TileROD_Decoder.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 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,
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 void setUseFrag0 (bool f) { m_useFrag0 = f; }
221 void setUseFrag1 (bool f) { m_useFrag1 = f; }
222 void setUseFrag4 (bool f) { m_useFrag4 = f; }
223 void setUseFrag5Raw (bool f) { m_useFrag5Raw = f; }
224 void setUseFrag5Reco (bool f) { m_useFrag5Reco = f; }
225
226 enum TileFragStatus {ALL_OK=0, CRC_ERR=1, ALL_FF=0x10, ALL_00=0x20, NO_FRAG=0x40, NO_ROB=0x80};
227
228 private:
229 friend class TileHid2RESrcID;
230
231 typedef std::vector<TileCell *> pCellVec;
232 typedef std::vector<TileDigits *> pDigiVec;
233 typedef std::vector<TileBeamElem *> pBeamVec;
234 typedef std::vector<TileRawChannel *> pRwChVec;
235 typedef std::vector<TileFastRawChannel> FRwChVec;
236
237 // Save ROD metadata (size frag id,Chip CRC+Headers, Trailer DMUMask+CRC)
238 // First element is vector with size,frag,BCID for whole fragment,
239 // second is vector with all trailer words
240 // third is 16 chip headers and forth is 16 chip CRC
241 // In case of calib mode, there are 2 additional vectors, one header and one CRC
242 typedef std::vector<std::vector<uint32_t> > DigitsMetaData_t;
243
244 typedef std::vector<std::vector<uint32_t> > RawChannelMetaData_t;
245
250 const uint32_t* getOFW(int fragId, int unit) const;
251
254 void unpack_frag0(uint32_t version, uint32_t sizeOverhead,
255 DigitsMetaData_t& digitsMetaData,
256 const uint32_t* p, pDigiVec & pDigits, int fragID, int demoType) const;
257
261 void unpack_frag1(uint32_t version, uint32_t sizeOverhead,
262 DigitsMetaData_t& digitsMetaData,
263 const uint32_t* p, pDigiVec & pDigits, int fragID, int demoType) const;
264
272 void unpack_frag2(uint32_t version, uint32_t sizeOverhead,
273 const uint32_t* p, pRwChVec & pChannel, int fragID, int demoType) const;
274
282 void unpack_frag3(uint32_t version, uint32_t sizeOverhead,
283 const uint32_t* p, pRwChVec & pChannel, int fragID, int demoType) const;
284
296 void unpack_frag4(uint32_t version, uint32_t sizeOverhead, unsigned int unit,
297 RawChannelMetaData_t& rawchannelMetaData,
298 const uint32_t* p, pRwChVec & pChannel, int fragID, int demoType) const;
299
300
312 void unpack_frag5(uint32_t version, uint32_t sizeOverhead, unsigned int unit,
313 DigitsMetaData_t& digitsMetaData,
314 const uint32_t* p, pDigiVec & pDigits, pRwChVec & pChannel, int fragID, int demoType) const;
315
318 void unpack_frag6(uint32_t version, uint32_t sizeOverhead,
319 DigitsMetaData_t& digitsMetaData,
320 const uint32_t* p, pDigiVec & pDigits, int fragID, int demoType) const;
321
330 void unpack_frag3HLT(uint32_t version, uint32_t sizeOverhead,
331 const uint32_t* p, FRwChVec & pChannel, int fragID, int demoType) const;
332
341 void unpack_frag2HLT(uint32_t version, uint32_t sizeOverhead,
342 const uint32_t* p, FRwChVec & pChannel, int fragID, int demoType) const;
343
356 void unpack_frag4HLT(uint32_t version, uint32_t sizeOverhead, unsigned int unit, const uint32_t* p, FRwChVec & pChannel, int fragID, int demoType) const;
357
369 void unpack_frag5HLT(uint32_t version, uint32_t sizeOverhead, unsigned int unit, const uint32_t* p, FRwChVec & pChannel, int fragID, int demoType) const;
370
373 void unpack_fragA(uint32_t version,
374 RawChannelMetaData_t& rawchannelMetaData,
375 const uint32_t* p, pRwChVec & pChannel, int fragID, int demoType) const;
378 void unpack_fragAHLT(uint32_t version, const uint32_t* p, uint16_t rob_bcid,
379 uint16_t& mask, int fragID, int demoType) const;
380
388 void unpack_frag10(uint32_t version, const uint32_t* p, TileL2Container & v, int fragID, int demoType) const;
389
397 void unpack_frag11(uint32_t version, const uint32_t* p, TileL2Container & v, int fragID, int demoType) const;
398
404 void unpack_frag12(uint32_t version, const uint32_t* p, TileL2Container & v, int fragID, int demoType) const;
405
412 void unpack_frag13(uint32_t version, const uint32_t* p, TileL2Container & v, int fragID, int demoType) const;
413
416 void unpack_frag14(uint32_t version, const uint32_t* p, TileL2Container & v, int fragID, int demoType) const;
417
421 void unpack_frag15(uint32_t version, const uint32_t* p, TileL2Container & v, int fragID, int demoType) const;
422
425 bool unpack_frag4L2(uint32_t version, uint32_t sizeOverhead, const uint32_t* p, TileL2Container & v, int fragID, int demoType) const;
426
429 bool unpack_frag5L2(uint32_t version, const uint32_t* p, TileL2Container & v, int fragID, int demoType) const;
430
433 void unpack_frag16(uint32_t version, const uint32_t* p, TileLaserObject & v) const; // LASERI
434
437 void unpack_frag17(uint32_t version, uint32_t sizeOverhead, const uint32_t* p, TileLaserObject & v) const; // LASERII
438
441 void unpack_brod(uint32_t version, uint32_t sizeOverhead, const uint32_t* p, pBeamVec & pBeam, int fragID) const;
442
444 void unpack_frag40(uint32_t collid, uint32_t version, const uint32_t* p, int size, TileDigitsCollection &coll) const;
445 void unpack_frag41(uint32_t collid, uint32_t version, const uint32_t* p, int size, TileRawChannelCollection &coll) const;
446 void unpack_frag42(uint32_t sourceid, uint32_t version, const uint32_t* p, int size, TileMuonReceiverContainer &v) const;
447
448 /**/
449
450 inline void make_copy(uint32_t bsflags,
451 TileFragHash::TYPE rChType,
453 DigitsMetaData_t& digitsMetaData,
454 RawChannelMetaData_t& rawchannelMetaData,
455 const ROBData * rob, pDigiVec & pDigits, pRwChVec & pChannel,
458 inline void make_copy(uint32_t bsflags,
459 TileFragHash::TYPE rChType,
461 DigitsMetaData_t& digitsMetaData,
462 RawChannelMetaData_t& rawchannelMetaData,
463 const ROBData * rob, pDigiVec & pDigits, pRwChVec & pChannel,
466 inline void make_copy(uint32_t bsflags,
467 TileFragHash::TYPE rChType,
469 DigitsMetaData_t& digitsMetaData,
470 RawChannelMetaData_t& rawchannelMetaData,
471 const ROBData * rob, pDigiVec & pDigits, pRwChVec & pChannel,
474
475 uint32_t make_copyHLT(bool of2,
477 bool correctAmplitude,
478 const FRwChVec & pChannel,
479 TileCellCollection& v, const uint16_t DQuality,
480 D0CellsHLT& d0cells,
481 TileCellCollection * MBTS) const;
482 std::vector<uint32_t> get_correct_data(const uint32_t* p) const;
483 inline void make_copy(const ROBData * rob, pBeamVec & pBeam, TileBeamElemCollection& v) const;
484 inline void make_copy(const ROBData * rob, pBeamVec & pBeam, TileDigitsCollection& v) const;
485 inline void make_copy(const ROBData * rob, pBeamVec & pBeam, TileRawChannelCollection& v) const;
486 inline void make_copy(const ROBData * rob, pBeamVec & pBeam, TileCellCollection& v) const;
487
488 template<typename ELEMENT>
489 inline void delete_vec(std::vector<ELEMENT *> & v) const;
490
491 template<typename ELEMENT, class COLLECTION>
492 inline void copy_vec(std::vector<ELEMENT *> & v, COLLECTION & coll) const;
493
496 bool checkBit(const uint32_t* p, int chan) const;
497
503
504 const TileHWID* m_tileHWID = nullptr;
505
506 Gaudi::Property<bool> m_useFrag0{this, "useFrag0", true, "Use frag0"};
507 Gaudi::Property<bool> m_useFrag1{this, "useFrag1", true, "Use frag1"};
508 Gaudi::Property<bool> m_useFrag4{this, "useFrag4", true, "User frag4"};
509 Gaudi::Property<bool> m_useFrag5Raw{this, "useFrag5Raw", false, "Use frag5 raw"};
510 Gaudi::Property<bool> m_useFrag5Reco{this, "useFrag5Reco", false, "Use frag5 reco"};
511 Gaudi::Property<bool> m_ignoreFrag4HLT{this, "ignoreFrag4HLT", false, "Ignore frag4 HLT"};
512
513 // Outside this time withdow, all amplitudes taken from Reco fragment will be set to zero
514 Gaudi::Property<float> m_allowedTimeMin{this, "AllowedTimeMin", -50.0,
515 "Set amplitude to zero if time is below allowed time minimum"};
516 Gaudi::Property<float> m_allowedTimeMax{this, "AllowedTimeMax", 50.0,
517 "Set amplitude to zero if time is above allowed time maximum"};
518
519 // Thresholds for parabolic amplitude correction
520 Gaudi::Property<float> m_ampMinThresh{this, "AmpMinForAmpCorrection", 15.0,
521 "Correct amplitude if it's above amplitude threshold (in ADC counts)"};
522 Gaudi::Property<float> m_timeMinThresh{this, "TimeMinForAmpCorrection", -12.5,
523 "Correct amplitude is time is above time minimum threshold"};
524 Gaudi::Property<float> m_timeMaxThresh{this, "TimeMaxForAmpCorrection", 12.5,
525 "Correct amplitude is time is below time maximum threshold"};
526
527 Gaudi::Property<unsigned int> m_fullTileRODs{this, "fullTileMode", 320000,
528 "Run from which to take the cabling (for the moment, either 320000 - full 2017 mode (default) - or 0 - 2016 mode)"};
529
530 Gaudi::Property<std::vector<int>> m_demoFragIDs{this,
531 "DemoFragIDs", {}, "List of Tile frag IDs with new electronics (demonstrator)"};
532
533 Gaudi::Property<bool> m_verbose{this, "VerboseOutput", false, "Print extra information"};
534 Gaudi::Property<bool> m_calibrateEnergy{this, "calibrateEnergy", true, "Convert ADC counts to pCb for RawChannels"};
535 Gaudi::Property<bool> m_suppressDummyFragments{this, "suppressDummyFragments", false, "Suppress dummy fragments"};
536 Gaudi::Property<bool> m_maskBadDigits{this, "maskBadDigits", false,
537 "Put -1 in digits vector for channels with bad BCID or CRC in unpack_frag0"};
538
539 Gaudi::Property<int> m_maxWarningPrint{this, "MaxWarningPrint", 1000, "Maximum warning messages to print"};
540 Gaudi::Property<int> m_maxErrorPrint{this, "MaxErrorPrint", 1000, "Maximum error messages to print"};
541
543 "TileHid2RESrcID", "TileHid2RESrcID", "TileHid2RESrcID key"};
544
545 ToolHandle<TileCondToolTiming> m_tileToolTiming{this,
546 "TileCondToolTiming", "TileCondToolTiming", "Tile timing tool"};
547 ToolHandle<TileCondToolOfcCool> m_tileCondToolOfcCool{this,
548 "TileCondToolOfcCool", "TileCondToolOfcCool", "Tile OFC tool"};
549 ToolHandle<TileCondToolEmscale> m_tileToolEmscale{this,
550 "TileCondToolEmscale", "TileCondToolEmscale", "Tile EM scale calibration tool"};
551 ToolHandle<ITileBadChanTool> m_tileBadChanTool{this,
552 "TileBadChanTool", "TileBadChanTool", "Tile bad channel tool"};
553 ToolHandle<TileL2Builder> m_L2Builder{this,
554 "TileL2Builder", "", "Tile L2 builder tool"};
555
556 /*
557 * @brief Name of Tile cabling service
558 */
560 "TileCablingSvc", "TileCablingSvc", "The Tile cabling service"};
561
562 // thresholds for parabolic amplitude correction
565 void updateAmpThreshold(int run = -1);
566
567 // OFWeights for different units and different drawers:
568 // every element contains OFC for single drawer and one of 4 different units
569 mutable std::vector<uint32_t> m_OFWeights[4 * TileCalibUtils::MAX_DRAWERIDX] ATLAS_THREAD_SAFE;
570
571 // Pointers to the start of the data for each vector.
572 mutable std::atomic<const uint32_t*> m_OFPtrs[4 * TileCalibUtils::MAX_DRAWERIDX] ATLAS_THREAD_SAFE;
573
574 // Mutex protecting access to weight vectors.
575 mutable std::mutex m_OFWeightMutex;
576
577 // Mutex protecting access to m_hid2re.
578 mutable std::mutex m_HidMutex;
579
580 // fast decoding
581 std::vector<int> m_Rw2Cell[4];
582 std::vector<int> m_Rw2Pmt[4];
583
586
587 // Map from frag id to MBTS idx
588 std::map<unsigned int, unsigned int> m_mapMBTS;
589 // index of the MBTS channel
591
592 mutable std::atomic<int> m_WarningCounter;
593 mutable std::atomic<int> m_ErrorCounter;
594
597
598 std::vector<int> m_list_of_masked_drawers;
599 void initHid2re();
600 void initHid2reHLT();
601
602 unsigned int m_maxChannels;
605
606 std::vector<int> m_demoChanLB;
607 std::vector<int> m_demoChanEB;
608
609 const uint32_t * get_data(const ROBData * rob) const {
610 const uint32_t * p;
611 if (rob->rod_status_position()==0 &&
612 rob->rod_nstatus() + rob->rod_header_size_word() + rob->rod_trailer_size_word() >= rob->rod_fragment_size_word()) {
613 rob->rod_status(p);
614 } else {
615 rob->rod_data(p);
616 }
617 return p;
618 }
619
620 uint32_t data_size(const ROBData * rob, uint32_t& error) const {
621 uint32_t size = rob->rod_ndata();
622 uint32_t max_allowed_size = rob->rod_fragment_size_word();
623 uint32_t delta = rob->rod_header_size_word() + rob->rod_trailer_size_word();
624 if (max_allowed_size > delta)
625 max_allowed_size -= delta;
626 else
627 max_allowed_size = 0;
628 if (size < 3 && size > 0) {
629 if (rob->rod_source_id() > 0x50ffff) error |= 0x10000; // indicate error in frag size, but ignore error in laser ROD
631 ATH_MSG_WARNING("ROB " << MSG::hex << rob->source_id()
632 << " ROD " << rob->rod_source_id() << MSG::dec
633 << " has unexpected data size: " << size << " - assuming zero size " );
634 }
635 return 0;
636 } else if (rob->rod_header_size_word() >= rob->rod_fragment_size_word()) {
637 if (rob->rod_source_id() > 0x50ffff) error |= 0x10000; // indicate error in frag size, but ignore error in laser ROD
639 ATH_MSG_WARNING("ROB " << MSG::hex << rob->source_id()
640 << " ROD " << rob->rod_source_id() << MSG::dec
641 << " has unexpected header size: " << rob->rod_header_size_word()
642 << " bigger than full size " << rob->rod_fragment_size_word()
643 << " - assuming no data " );
644 }
645 return 0;
646 } else if (size > max_allowed_size) {
647 if (rob->rod_source_id() > 0x50ffff) error |= 0x10000; // indicate error in frag size, but ignore error in laser ROD
648
649 if (size - rob->rod_trailer_size_word() < max_allowed_size) {
651 ATH_MSG_WARNING("ROB " << MSG::hex << rob->source_id()
652 << " ROD " << rob->rod_source_id() << MSG::dec
653 << " data size " << size << " is longer than allowed size " << max_allowed_size
654 << " - assuming that ROD trailer is shorter: "
655 << rob->rod_trailer_size_word()-(size-max_allowed_size)
656 << " words instead of " << rob->rod_trailer_size_word());
657 }
658 max_allowed_size = size;
659 } else if (size - rob->rod_trailer_size_word() == max_allowed_size) {
661 ATH_MSG_WARNING("ROB " << MSG::hex << rob->source_id()
662 << " ROD " << rob->rod_source_id() << MSG::dec
663 << " data size " << size << " is longer than allowed size " << max_allowed_size
664 << " - assuming that ROD trailer ("
665 << rob->rod_trailer_size_word()
666 << " words) is absent");
667 }
668 max_allowed_size = size;
669 } else {
670 max_allowed_size += rob->rod_trailer_size_word();
672 ATH_MSG_WARNING("ROB " << MSG::hex << rob->source_id()
673 << " ROD " << rob->rod_source_id() << MSG::dec
674 << " has unexpected data size: " << size
675 << " - assuming data size = " << max_allowed_size << " words and no ROD trailer at all" );
676 }
677 }
678 return max_allowed_size;
679 } else {
680 return size;
681 }
682 }
683};
684
685template<typename ELEMENT>
686inline void TileROD_Decoder::delete_vec(std::vector<ELEMENT *> & v) const {
687 typedef typename std::vector<ELEMENT *>::const_iterator ELEMENT_const_iterator;
688
689 ELEMENT_const_iterator iCh = v.begin();
690 ELEMENT_const_iterator iEnd = v.end();
691 for (; iCh != iEnd; ++iCh) delete (*iCh);
692 v.clear();
693}
694
695template<typename ELEMENT, class COLLECTION>
696inline void TileROD_Decoder::copy_vec(std::vector<ELEMENT *> & v, COLLECTION & coll) const {
697 typedef typename std::vector<ELEMENT *>::const_iterator ELEMENT_const_iterator;
698
699 ELEMENT_const_iterator iCh = v.begin();
700 ELEMENT_const_iterator iEnd = v.end();
701 for (; iCh != iEnd; ++iCh) coll.push_back(*iCh);
702}
703
704inline
705void TileROD_Decoder::make_copy(uint32_t /*bsflags*/,
706 TileFragHash::TYPE /*rChType*/,
707 TileRawChannelUnit::UNIT /*rChUnit*/,
708 DigitsMetaData_t& digitsMetaData,
709 RawChannelMetaData_t& /*rawchannelMetaData*/,
710 const ROBData * rob,
711 pDigiVec & pDigits,
712 pRwChVec & pChannel,
714 TileDigitsContainer* /*container*/) const
715{
716 copy_vec(pDigits, v); // Digits stored
717
718 if (pChannel.size() > 0) { // RawChannels deleted
719 delete_vec(pChannel);
720 }
721
722 v.setLvl1Id(rob->rod_lvl1_id());
723 v.setLvl1Type(rob->rod_lvl1_trigger_type());
724 v.setDetEvType(rob->rod_detev_type());
725 v.setRODBCID(rob->rod_bc_id());
726
727 uint32_t status = TileFragStatus::ALL_OK;
728 for (size_t j=0; j<digitsMetaData[6].size(); ++j) {
729 status |= digitsMetaData[6][j];
730 }
731
732 if (v.size() > 0) {
733 // Set meta data
734 v.setFragSize(digitsMetaData[0][0]);
735 v.setFragBCID(digitsMetaData[0][2] | (status<<16));
736
737 v.setFragExtraWords(digitsMetaData[1]);
738
739 v.setFragChipHeaderWords(digitsMetaData[2]);
740 v.setFragChipCRCWords(digitsMetaData[3]);
741
742 if (v.isCalibMode()) {
743 v.setFragChipHeaderWordsHigh(digitsMetaData[4]);
744 v.setFragChipCRCWordsHigh(digitsMetaData[5]);
745 }
746 if (m_verbose) v.printExtra();
747 } else if ( digitsMetaData[0].size() == 0 ) {
748 // no useful digi fragment or no data inside fragment
749 status |= TileFragStatus::NO_FRAG;
750 v.setFragBCID(0xDEAD | (status<<16));
751 v.setFragSize(0);
752 }
753
754 if (status!=TileFragStatus::ALL_OK)
755 ATH_MSG_DEBUG( "Status for drawer 0x" << MSG::hex << v.identify() << " in Digi frag is 0x" << status << MSG::dec);
756}
757
758inline
759void TileROD_Decoder::make_copy(uint32_t bsflags,
760 TileFragHash::TYPE rChType,
762 DigitsMetaData_t& /*digitsMetaData*/,
763 RawChannelMetaData_t& rawchannelMetaData,
764 const ROBData * rob,
765 pDigiVec & pDigits,
766 pRwChVec & pChannel,
769{
770 if (pChannel.size() > 0) { // take available raw channels
771 // and store in collection
772 if (container) {
773 ATH_MSG_VERBOSE( "RawChannel unit is " << rChUnit
774 << " - setting unit in TileRawChannelContainer " );
775 container->set_unit(rChUnit);
776 container->set_type(rChType);
777 container->set_bsflags(bsflags);
778 } else {
779 ATH_MSG_ERROR( "Can't set unit=" << rChUnit << " in TileRawChannelContainer" );
780 }
781
782 copy_vec(pChannel, v);
783
784 if (pDigits.size() > 0) delete_vec(pDigits); // Digits deleted
785
786 } else {
787
788 if (pDigits.size() > 0) { // convert digits to raw channels
789 // and store directly in collection
790 ATH_MSG_VERBOSE( " No reco frag in BS " );
791 //m_RCBuilder->build(pDigits.begin(),pDigits.end(),(&v));
792
793 delete_vec(pDigits); // Digits deleted
794
795 } else {
796 ATH_MSG_DEBUG( "data for drawer 0x" << MSG::hex << v.identify() << MSG::dec << " not found in BS" );
797 }
798 rawchannelMetaData[6].push_back(TileFragStatus::NO_FRAG);
799 HWIdentifier drawerID = m_tileHWID->drawer_id(v.identify());
800 for (unsigned int ch = 0; ch < m_maxChannels; ++ch) {
801 HWIdentifier adcID = m_tileHWID->adc_id(drawerID, ch, 0);
802 v.push_back(new TileRawChannel(adcID, 0.0, -100.0, 31));
803 }
804
805 }
806
807 v.setLvl1Id(rob->rod_lvl1_id());
808 v.setLvl1Type(rob->rod_lvl1_trigger_type());
809 v.setDetEvType(rob->rod_detev_type());
810 v.setRODBCID(rob->rod_bc_id());
811
812 if (rChUnit < TileRawChannelUnit::OnlineOffset && rChType > TileFragHash::OptFilterDsp) { // set good status for BS from MC
813 rawchannelMetaData[0].push_back(0);
814 rawchannelMetaData[0].push_back(0xDEAD);
815 rawchannelMetaData[5].push_back(0xFFFF);
816 rawchannelMetaData[5].push_back(0xFFFF);
817 }
818
819 for (unsigned int i = 0; i < 6; ++i) {
820 for (size_t j=rawchannelMetaData[i].size(); j<2; ++j) {
821 rawchannelMetaData[i].push_back(0);
822 }
823 }
824
825 uint32_t status = (rawchannelMetaData[0][0] & 0x1) ? TileFragStatus::CRC_ERR : TileFragStatus::ALL_OK ;
826 for (size_t j=0; j<rawchannelMetaData[6].size(); ++j) {
827 status |= rawchannelMetaData[6][j];
828 }
829 if (status>TileFragStatus::CRC_ERR)
830 ATH_MSG_DEBUG( "Status for drawer 0x" << MSG::hex << v.identify() << " is 0x" << status << MSG::dec);
831
832 v.setFragGlobalCRC(status);
833 v.setFragDSPBCID(rawchannelMetaData[0][1]);
834 v.setFragBCID(rawchannelMetaData[1][0]);
835 v.setFragMemoryPar(rawchannelMetaData[1][1]);
836 v.setFragSstrobe(rawchannelMetaData[2][0]);
837 v.setFragDstrobe(rawchannelMetaData[2][1]);
838 v.setFragHeaderBit(rawchannelMetaData[3][0]);
839 v.setFragHeaderPar(rawchannelMetaData[3][1]);
840 v.setFragSampleBit(rawchannelMetaData[4][0]);
841 v.setFragSamplePar(rawchannelMetaData[4][1]);
842 v.setFragFEChipMask(rawchannelMetaData[5][0]);
843 if (std::binary_search(m_demoFragIDs.begin(), m_demoFragIDs.end(), v.identify()))
844 v.setFragRODChipMask(rawchannelMetaData[5][0]);
845 else
846 v.setFragRODChipMask(rawchannelMetaData[5][1]);
847}
848
849inline
850void TileROD_Decoder::make_copy(uint32_t /*bsflags*/,
851 TileFragHash::TYPE /*rChType*/,
852 TileRawChannelUnit::UNIT /*rChUnit*/,
853 DigitsMetaData_t& /*digitsMetaData*/,
854 RawChannelMetaData_t& /*rawchannelMetaData*/,
855 const ROBData * /* rob */, pDigiVec & pDigits,
856 pRwChVec & pChannel, TileBeamElemCollection &,
857 TileBeamElemContainer* /*container*/) const
858{
859 // do nothing
860 delete_vec(pDigits);
861 delete_vec(pChannel);
862}
863
864inline
866 TileBeamElemCollection & v) const {
867 copy_vec(pBeam, v);
868
869 v.setLvl1Id(rob->rod_lvl1_id());
870 v.setLvl1Type(rob->rod_lvl1_trigger_type());
871 v.setDetEvType(rob->rod_detev_type());
872 v.setRODBCID(rob->rod_bc_id());
873}
874
875inline
876void TileROD_Decoder::make_copy(const ROBData * /* rob */, pBeamVec & pBeam,
877 TileDigitsCollection &) const {
878 // do nothing
879 delete_vec(pBeam);
880}
881
882inline
883void TileROD_Decoder::make_copy(const ROBData * /* rob */, pBeamVec & pBeam,
884 TileRawChannelCollection &) const {
885 // do nothing
886 delete_vec(pBeam);
887}
888
889inline
890void TileROD_Decoder::make_copy(const ROBData * /* rob */, pBeamVec & pBeam,
891 TileCellCollection &) const {
892 // do nothing
893 delete_vec(pBeam);
894}
895
896
897// ---- Implement the template method:
898
903template<class COLLECTION>
905 COLLECTION & v,
907{
908 //
909 // get info from ROD header
910 //
911 // if (msgLvl(MSG::VERBOSE)) {
912 // msg(MSG::VERBOSE) << "ROD header info: " << endmsg
913 // msg(MSG::VERBOSE) << " Format Vers. " << MSG::hex << "0x" << rob->rod_version() << MSG::dec << endmsg;
914 // msg(MSG::VERBOSE) << " Source ID " << MSG::hex << "0x" << rob->rod_source_id() << MSG::dec << endmsg;
915 // msg(MSG::VERBOSE) << " Source ID str " << eformat::helper::SourceIdentifier(rob->source_id()).human().c_str() << endmsg;
916 // msg(MSG::VERBOSE) << " Run number " << (int) rob->rod_run_no() << endmsg;
917 // msg(MSG::VERBOSE) << " Level1 ID " << rob->rod_lvl1_id() << endmsg;
918 // msg(MSG::VERBOSE) << " BCID " << rob->rod_bc_id() << endmsg;
919 // msg(MSG::VERBOSE) << " Lvl1 TrigType " << rob->rod_lvl1_trigger_type() << endmsg;
920 // msg(MSG::VERBOSE) << " Event Type " << rob->rod_detev_type() << endmsg;
921 // msg(MSG::VERBOSE) << " Fragment size " << rob->rod_fragment_size_word() << endmsg;
922 // msg(MSG::VERBOSE) << " Header size " << rob->rod_header_size_word() << endmsg;
923 // msg(MSG::VERBOSE) << " Trailer size " << rob->rod_trailer_size_word() << endmsg;
924 // msg(MSG::VERBOSE) << " N data " << rob->rod_ndata() << endmsg;
925 // msg(MSG::VERBOSE) << " N status " << rob->rod_nstatus() << endmsg;
926 // msg(MSG::VERBOSE) << " Status pos " << rob->rod_status_position() << endmsg;
927 // }
928
929 uint32_t version = rob->rod_version() & 0xFFFF;
930
931 bool isBeamROD = false;
932 // figure out which fragment we want to unpack
933 TileRawChannelCollection::ID frag_id = v.identify();
935 const std::vector<uint32_t> & drawer_info = hid2re->getDrawerInfo(frag_id);
936 int bs_frag_id = drawer_info.size()>1 ? static_cast<int>(drawer_info[1]) : frag_id;
937 int drawer_type = drawer_info.size()>2 ? static_cast<int>(drawer_info[2]) : -1;
938
939 uint32_t mask = 0xFFFF;
940
941 // special conversion for sub-fragments in beam ROD
942 if (frag_id < 0x100) {
943 isBeamROD = true;
944 mask = 0xFF; // this is needed for TB 2003, when beam frag_id >= 0x400
945 }
946
947 // find all fragments with given Fragment ID
948 // and possibly with different types
949 std::vector<const uint32_t *> pFrag;
950 pFrag.reserve(5);
951
952 uint32_t error = 0;
953 uint32_t wc = 0;
954 uint32_t size = data_size(rob, error);
955 const uint32_t * p = get_data(rob);
956
957 // 2 extra words in every frag by default (frag id + frag size)
958 // but for all data after 2005 it is set to 3 later in the code
959 uint32_t sizeOverhead = 2;
960
961 // bool skipWords = ( ! isBeamROD && version == 0x1 );
962 // std::cout << " *(p) = 0x" << std::hex << (*(p)) << std::dec << std::endl;
963 if (size) {
964 bool V3format = (*(p) == 0xff1234ff); // additional frag marker since Sep 2005
965 V3format |= (*(p) == 0x00123400); // additional frag marker since Sep 2005 (can appear in buggy ROD frags)
966 if (!V3format && version>0xff) {
967 V3format = true;
969 ATH_MSG_WARNING("fillCollection: corrupted frag separator 0x" << MSG::hex << (*p) << " instead of 0xff1234ff in ROB 0x" << rob->rod_source_id() << MSG::dec );
970 }
971 if (V3format) {
972 ++p; // skip frag marker
973 sizeOverhead = 3;
974 } else {
975 sizeOverhead = 2;
976 }
977 }
978
979 //std::cout << std::hex << " frag_id " << frag_id << " mask " << mask
980 // << " version " << version << " sizeOverhead " << sizeOverhead
981 // << " skipWords " << skipWords << " V3format " << V3format
982 // << std::dec << std::endl;
983 //std::cout << " size is "<< size << std::endl;
984
985 while (wc < size) { // iterator over all words in a ROD
986
987 // first word is frag size
988 uint32_t count = *(p);
989 // second word is frag ID (16 bits) frag type (8 bits) and additional flags
990 uint32_t idAndType = *(p + 1);
991 int frag = (idAndType & mask);
992 int type = (idAndType & 0xF00000) >> 16; // note special mask, we ignore one digit, keep only 0x10, 0x20, 0x30, ...
993
994 if (count < sizeOverhead || count > size - wc) {
995 int cnt = 0;
996 for (; wc < size; ++wc, ++cnt, ++p) {
997 if ((*p) == 0xff1234ff) {
998 ++cnt;
999 ++wc;
1000 ++p;
1001 break;
1002 }
1003 }
1004 if ((m_ErrorCounter++) < m_maxErrorPrint) {
1005 msg(MSG::WARNING) << "Frag 0x" << MSG::hex << frag << MSG::dec
1006 << " has unexpected size: " << count;
1007 if (wc < size) {
1008 msg(MSG::WARNING) << " skipping " << cnt << " words to the next frag" << endmsg;
1009 } else {
1010 msg(MSG::WARNING) << " ignoring " << cnt << " words till the end of ROD frag" << endmsg;
1011 }
1012 }
1013 continue;
1014 }
1015
1016 if (type != 0x10 && frag == bs_frag_id) pFrag.push_back(p);
1017
1018 p += count;
1019 wc += count;
1020
1021 //std::cout << " frag ="<<frag<<" type = "<<type<<" count="<<count<<std::endl;
1022
1023 // this is not needed anymore, since we can't read very old BS files anyhow.
1024 //if ( skipWords && type == 0 && wc < size ) { // special treatment of preROD output with digits
1025 // wc+=7; p+=7; // skip extra header
1026 //}
1027 }
1028
1029 if (wc != size) {
1030 // check word count
1031 if ((m_ErrorCounter++) < m_maxErrorPrint) {
1032 ATH_MSG_WARNING( "Incorrect ROD size: " << wc << " words instead of " << size );
1033 }
1034 assert(0);
1035 // return;
1036 }
1037
1038 static const bool unpackDigits = std::is_same_v<COLLECTION, TileDigitsCollection>;
1039 static const bool unpackChannels = std::is_same_v<COLLECTION, TileRawChannelCollection>;
1040
1041 if (isBeamROD) {
1042
1043 pBeamVec pBeam;
1044 pBeam.reserve(16);
1045
1046 std::vector<const uint32_t *>::const_iterator it = pFrag.begin();
1047 std::vector<const uint32_t *>::const_iterator itEnd = pFrag.end();
1048
1049 for (; it != itEnd; ++it) {
1050
1051 p = (*it);
1052
1053 unpack_brod(version, sizeOverhead, p, pBeam, frag_id);
1054 }
1055
1056 make_copy(rob, pBeam, v);
1057
1058 } else {
1059
1060 pDigiVec pDigits;
1061 pRwChVec pChannel;
1062 pChannel.reserve(48);
1063
1064 // initialize meta data storage
1065 DigitsMetaData_t digitsMetaData (7);
1066 RawChannelMetaData_t rawchannelMetaData (7);
1067 for (unsigned int i = 0; i < 7; ++i) {
1068 digitsMetaData[i].reserve(16);
1069 rawchannelMetaData[i].reserve(2);
1070 }
1071
1072 // now unpack all channels in all fragments
1073 // and fill temporary array of TileDigits and/or TileRawChannels
1074
1075 std::vector<const uint32_t *>::const_iterator it = pFrag.begin();
1076 std::vector<const uint32_t *>::const_iterator itEnd = pFrag.end();
1077
1078 uint32_t bsflags = 0;
1081
1082 for (; it != itEnd; ++it) {
1083
1084 p = (*it);
1085 // first word is frag size
1086 // uint32_t count = *(p);
1087 // second word is frag ID (16 bits) frag type (8 bits) and additional flags
1088 uint32_t idAndType = *(p + 1);
1089 int type = (idAndType & 0x00FF0000) >> 16;
1090
1091 ATH_MSG_VERBOSE( "Unpacking frag: 0x" << MSG::hex << (idAndType & 0xFFFF)
1092 << " type " << type << MSG::dec );
1093
1094 switch (type) {
1095 case 0:
1096 if (unpackDigits && m_useFrag0) unpack_frag0(version, sizeOverhead, digitsMetaData, p, pDigits, frag_id, drawer_type);
1097 break;
1098 case 1:
1099 if (unpackDigits && m_useFrag1) unpack_frag1(version, sizeOverhead, digitsMetaData, p, pDigits, frag_id, drawer_type);
1100 break;
1101 case 2:
1102 if (unpackChannels && m_useFrag4) unpack_frag2(version, sizeOverhead, p, pChannel, frag_id, drawer_type);
1103 break;
1104 case 3:
1105 if (unpackChannels && m_useFrag4) unpack_frag3(version, sizeOverhead, p, pChannel, frag_id, drawer_type);
1106 break;
1107 case 4:
1108 if (unpackChannels && m_useFrag4) {
1109 bsflags = idAndType & 0xFFFF0000; // ignore frag num, keep all the rest
1110 int unit = (idAndType & 0xC0000000) >> 30;
1111
1112 int DataType = (idAndType & 0x30000000) >> 28;
1113
1114 if (DataType < 3) { // real data
1115
1116 // only one bit for type and next 2 bits for number of iterations
1117 //int AlgoType = (idAndType & 0x4000000) >> 26;
1118 //if (AlgoType == 0) rChType = TileFragHash::OF1Filter;
1119 //else rChType = TileFragHash::OF2Filter;
1120 // always set special type, which means now that OF is done inside DSP
1122
1123 // Attention! Switching to Online Units for release 14.2.0
1124 rChUnit = (TileRawChannelUnit::UNIT) (unit + TileRawChannelUnit::OnlineOffset); // Online units in real data
1125 // rChUnit = (TileRawChannelUnit::UNIT) ( unit );
1126
1127 } else { // simulated data
1128
1129 // all 3 bits for type
1130 int AlgoType = (idAndType & 0x7000000) >> 24;
1131 rChType = (TileFragHash::TYPE) AlgoType;
1132
1133 rChUnit = (TileRawChannelUnit::UNIT) (unit); // Offline units in simulated data
1134
1135 if (!m_demoFragIDs.empty()) {
1136 const_cast<Gaudi::Property<std::vector<int>> &> ( m_demoFragIDs ) = {}; // No demonstator cabling in MC
1137 ATH_MSG_INFO("Disable channel remapping for demonstrator in MC");
1138 }
1139 }
1140
1141 unpack_frag4(version, sizeOverhead, unit, rawchannelMetaData, p, pChannel, frag_id, drawer_type);
1142 }
1143 break;
1144
1145 case 5:
1147 bsflags = idAndType & 0xFFFF0000; // ignore frag num, keep all the rest
1148 int unit = (idAndType & 0xC0000000) >> 30;
1149
1150 // always set special type, which means now that OF is done inside DSP
1152
1154 unpack_frag5(version, sizeOverhead, unit,
1155 digitsMetaData,
1156 p, pDigits, pChannel, frag_id, drawer_type);
1157 }
1158 break;
1159
1160 case 6:
1161 break;
1162
1163 case 0xA:
1164 if (unpackChannels) unpack_fragA(version, rawchannelMetaData, p, pChannel, frag_id, drawer_type);
1165 break;
1166
1167 default:
1168 int frag = idAndType & 0xFFFF;
1169 ATH_MSG_WARNING( "Unknown frag type=" << type << " for frag=" << frag );
1170 assert(0);
1171 break;
1172 }
1173 } // end of all frags
1174
1175 make_copy(bsflags, rChType, rChUnit, digitsMetaData, rawchannelMetaData,
1176 rob, pDigits, pChannel, v, container);
1177 }
1178
1179 return;
1180}
1181
1182#endif
const boost::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_INFO(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
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition RawEvent.h:37
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
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)
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:146
Definition run.py:1
TileFastRawChannel m_D0channeg[64]
TileFastRawChannel m_D0chanpos[64]