ATLAS Offline Software
Loading...
Searching...
No Matches
TileBchDecoder.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8//
9//________________________________________________________________
11{
13 else if(bitPatVer==TileBchDecoder::BitPat_onl01){ init_BitPat_onl01(); }
14 else{
15 throw TileCalib::InvalidBitPattern("TileBchDecoder::Ctor", bitPatVer);
16 }
17}
18
19//
20//________________________________________________________________
22TileBchDecoder::decode(uint32_t status_channel, uint32_t status_adc) const
23{
24 TileBchStatus status;
25 for(unsigned int i = 0; i < 32; ++i){
26 //=== decode channel problems
27 if(status_channel & 0x00000001){ status += m_bitToPrbChn[i]; }
28 //=== decode adc problems
29 if(status_adc & 0x00000001){ status += m_bitToPrbAdc[i]; }
30 //=== shift the status words by one bit
31 status_channel >>= 1;
32 status_adc >>= 1;
33 }
34 return status;
35}
36
37//
38//________________________________________________________________
41{
42 TileBchWords words;
43 const std::set<TileBchPrbs::Prb>& prbs = status.getPrbs();
44 for(std::set<TileBchPrbs::Prb>::const_iterator iPrb = prbs.begin();
45 iPrb!=prbs.end(); ++iPrb)
46 {
47 std::map<TileBchPrbs::Prb,std::pair<unsigned int,unsigned int> >::const_iterator
48 iMap = m_prbToBit.find(*iPrb);
49 if(iMap == m_prbToBit.end()){
50 //=== throw an exception if we can not encode the problem
51 throw TileCalib::InvalidBchProblem("TileBchDecoder::encode", *iPrb);
52 }
53 words[iMap->second.first] |= (1 << iMap->second.second);
54 }
55 return words;
56}
57
58//
59//________________________________________________________________
60void
62{
63 //=== assign decoder to channel problems
64 m_bitToPrbChn.clear();
89
90 //=== assign decoder to adc problems
91 m_bitToPrbAdc.clear();
109
110 //=== initialize problem to word/bit map
111 initPrbToBit();
112}
113
114//
115//________________________________________________________________
116void
142
143//
144//________________________________________________________________
145void
147{
148 m_prbToBit.clear();
149 //=== init channel problems
150 for(unsigned int i = 0; i < 32; ++i){
152 if(prb==TileBchPrbs::Invalid) continue;
153 //=== check for duplicates
154 if(m_prbToBit.find(prb) != m_prbToBit.end()){
155 throw TileCalib::InvalidBitPattern("TileBchDecoder::initPrbToBit(Chn)",i);
156 }
157 m_prbToBit[prb] = std::make_pair(0,i);
158 }
159
160 //=== init adc problems
161 for(unsigned int i = 0; i < 32; ++i){
163 if(prb==TileBchPrbs::Invalid) continue;
164 //=== check for duplicates
165 if(m_prbToBit.find(prb)!=m_prbToBit.end()){
166 throw TileCalib::InvalidBitPattern("TileBchDecoder::initPrbToBit(Adc)",i);
167 }
168 m_prbToBit[prb] = std::make_pair(1, i);
169 }
170}
171
172//
173//________________________________________________________________
174void
176{
177 stm << "Current bit to problem assignment" << std::endl;
178 stm << "---------------------------------" << std::endl;
179 stm << "Channel:" << std::endl;
180 for(unsigned int i = 0; i < 32; ++i){
182 std::string desc = TileBchPrbs::getDescription(prb);
183 stm << "bit "<<i<<"\t:\t" << desc << std::endl;
184 }
185 stm << "Adc:" << std::endl;
186 for(unsigned int i = 0; i < 32; ++i){
188 std::string desc = TileBchPrbs::getDescription(prb);
189 stm << "bit "<<i<<"\t:\t" << desc << std::endl;
190 }
191}
void init_BitPat_ofl01()
Initializes bit pattern version "ofl01".
TileBchStatus decode(uint32_t status_channel, uint32_t status_adc=0) const
Decode the status word.
std::vector< TileBchPrbs::Prb > m_bitToPrbChn
Bit to problem association for the channel word.
void printBitAssignment() const
Print status bits and their assigned problem.
TileBchDecoder(BitPatVer bitPatVer)
Ctor.
TileBchWords encode(const TileBchStatus &status) const
Encode an ADC status into channel and adc status word bits.
void init_BitPat_onl01()
Initializes bit pattern version "ofl01".
std::vector< TileBchPrbs::Prb > m_bitToPrbAdc
Bit to problem association for the ADC word.
void initPrbToBit()
Initializes the problem to bit map.
std::map< TileBchPrbs::Prb, std::pair< unsigned int, unsigned int > > m_prbToBit
Problem to status word and bit association.
@ OnlineTimingDmuBcOffsetNeg
Definition TileBchPrbs.h:93
@ SevereDataCorruption
Definition TileBchPrbs.h:38
@ TimingDmuBcOffsetPos
Definition TileBchPrbs.h:72
@ OnlineGeneralMaskAdc
Definition TileBchPrbs.h:98
@ TimingDmuBcOffsetNeg
Definition TileBchPrbs.h:73
@ OnlineTimingDmuBcOffsetPos
Definition TileBchPrbs.h:92
static std::string getDescription(const Prb &prb)
Get description of problem.
Class holding bad channel problems.