ATLAS Offline Software
Loading...
Searching...
No Matches
TileBchDecoder Class Reference

Class providing the association between TileCal problems and status word bits. More...

#include <TileBchDecoder.h>

Collaboration diagram for TileBchDecoder:

Public Types

enum  BitPatVer { BitPat_ofl01 , BitPat_onl01 , MaxVersion }

Public Member Functions

 TileBchDecoder (BitPatVer bitPatVer)
 Ctor.
void printBitAssignment () const
 Print status bits and their assigned problem.
void printBitAssignment (std::ostream &stm) const
 Print status bits and their assigned problem.
TileBchStatus decode (uint32_t status_channel, uint32_t status_adc=0) const
 Decode the status word.
TileBchStatus decode (const TileBchWords &words) const
 Decode the status word.
TileBchWords encode (const TileBchStatus &status) const
 Encode an ADC status into channel and adc status word bits.

Private Member Functions

void init_BitPat_ofl01 ()
 Initializes bit pattern version "ofl01".
void init_BitPat_onl01 ()
 Initializes bit pattern version "ofl01".
void initPrbToBit ()
 Initializes the problem to bit map.

Private Attributes

std::vector< TileBchPrbs::Prbm_bitToPrbChn
 Bit to problem association for the channel word.
std::vector< TileBchPrbs::Prbm_bitToPrbAdc
 Bit to problem association for the ADC word.
std::map< TileBchPrbs::Prb, std::pair< unsigned int, unsigned int > > m_prbToBit
 Problem to status word and bit association.

Detailed Description

Class providing the association between TileCal problems and status word bits.

Author
Nils Gollub nils..nosp@m.goll.nosp@m.ub@ce.nosp@m.rn.c.nosp@m.h

The status of each TileCal ADC is stored in the database as a combination of two 32 bit integers: One 32 bit word encodes channel problems common to both ADCs (stored in gain=2), and one 32 bit word encodes ADC specific problems (gain=0 or 1).

Each bit is assigned to a specific problem. The association between bits and problems is generally not static and could change over time. This class provides a flexible mechanism to translate between problems and current bit pattern implementation. The different problems are encoded as enums (see TileBchPrbs class).

One TileBchDecoder object should be instanciated for each bitPatternVersion.

Definition at line 36 of file TileBchDecoder.h.

Member Enumeration Documentation

◆ BitPatVer

Enumerator
BitPat_ofl01 
BitPat_onl01 
MaxVersion 

Definition at line 40 of file TileBchDecoder.h.

Constructor & Destructor Documentation

◆ TileBchDecoder()

TileBchDecoder::TileBchDecoder ( BitPatVer bitPatVer)

Ctor.

Definition at line 10 of file TileBchDecoder.cxx.

11{
13 else if(bitPatVer==TileBchDecoder::BitPat_onl01){ init_BitPat_onl01(); }
14 else{
15 throw TileCalib::InvalidBitPattern("TileBchDecoder::Ctor", bitPatVer);
16 }
17}
void init_BitPat_ofl01()
Initializes bit pattern version "ofl01".
void init_BitPat_onl01()
Initializes bit pattern version "ofl01".

Member Function Documentation

◆ decode() [1/2]

TileBchStatus TileBchDecoder::decode ( const TileBchWords & words) const
inline

Decode the status word.

Definition at line 59 of file TileBchDecoder.h.

60 { return decode(words[0],words[1]); }
TileBchStatus decode(uint32_t status_channel, uint32_t status_adc=0) const
Decode the status word.

◆ decode() [2/2]

TileBchStatus TileBchDecoder::decode ( uint32_t status_channel,
uint32_t status_adc = 0 ) const

Decode the status word.

Definition at line 22 of file TileBchDecoder.cxx.

23{
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}
std::vector< TileBchPrbs::Prb > m_bitToPrbChn
Bit to problem association for the channel word.
std::vector< TileBchPrbs::Prb > m_bitToPrbAdc
Bit to problem association for the ADC word.
status
Definition merge.py:16

◆ encode()

TileBchWords TileBchDecoder::encode ( const TileBchStatus & status) const

Encode an ADC status into channel and adc status word bits.

The returned vector is of length 2, where the first word encodes the common channel problems and the second word the specific adc problems.

Parameters
statusThe ADC status

Definition at line 40 of file TileBchDecoder.cxx.

41{
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}
std::map< TileBchPrbs::Prb, std::pair< unsigned int, unsigned int > > m_prbToBit
Problem to status word and bit association.

◆ init_BitPat_ofl01()

void TileBchDecoder::init_BitPat_ofl01 ( )
private

Initializes bit pattern version "ofl01".

Definition at line 61 of file TileBchDecoder.cxx.

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}
void initPrbToBit()
Initializes the problem to bit map.
@ SevereDataCorruption
Definition TileBchPrbs.h:38
@ TimingDmuBcOffsetPos
Definition TileBchPrbs.h:72
@ TimingDmuBcOffsetNeg
Definition TileBchPrbs.h:73

◆ init_BitPat_onl01()

void TileBchDecoder::init_BitPat_onl01 ( )
private

Initializes bit pattern version "ofl01".

Definition at line 117 of file TileBchDecoder.cxx.

118{
119 //=== assign decoder to channel problems
120 m_bitToPrbChn.clear();
133
134 //=== assign decoder to adc problems
135 m_bitToPrbAdc.clear();
138
139 //=== initialize problem to word/bit map
140 initPrbToBit();
141}
@ OnlineTimingDmuBcOffsetNeg
Definition TileBchPrbs.h:93
@ OnlineGeneralMaskAdc
Definition TileBchPrbs.h:98
@ OnlineTimingDmuBcOffsetPos
Definition TileBchPrbs.h:92

◆ initPrbToBit()

void TileBchDecoder::initPrbToBit ( )
private

Initializes the problem to bit map.

Definition at line 146 of file TileBchDecoder.cxx.

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}

◆ printBitAssignment() [1/2]

void TileBchDecoder::printBitAssignment ( ) const
inline

Print status bits and their assigned problem.

Definition at line 50 of file TileBchDecoder.h.

50{ printBitAssignment(std::cout); }
void printBitAssignment() const
Print status bits and their assigned problem.

◆ printBitAssignment() [2/2]

void TileBchDecoder::printBitAssignment ( std::ostream & stm) const

Print status bits and their assigned problem.

Parameters
stmThe stream to print to

Definition at line 175 of file TileBchDecoder.cxx.

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}
static std::string getDescription(const Prb &prb)
Get description of problem.

Member Data Documentation

◆ m_bitToPrbAdc

std::vector<TileBchPrbs::Prb> TileBchDecoder::m_bitToPrbAdc
private

Bit to problem association for the ADC word.

Definition at line 84 of file TileBchDecoder.h.

◆ m_bitToPrbChn

std::vector<TileBchPrbs::Prb> TileBchDecoder::m_bitToPrbChn
private

Bit to problem association for the channel word.

Definition at line 82 of file TileBchDecoder.h.

◆ m_prbToBit

std::map<TileBchPrbs::Prb, std::pair<unsigned int,unsigned int> > TileBchDecoder::m_prbToBit
private

Problem to status word and bit association.


pair.first==0 means channel status word, pair.first==1 means adc status word. pair.second is the bit number.

Definition at line 88 of file TileBchDecoder.h.


The documentation for this class was generated from the following files: