ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
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. More...
 
void printBitAssignment () const
 Print status bits and their assigned problem. More...
 
void printBitAssignment (std::ostream &stm) const
 Print status bits and their assigned problem. More...
 
TileBchStatus decode (uint32_t status_channel, uint32_t status_adc=0) const
 Decode the status word. More...
 
TileBchStatus decode (const TileBchWords &words) const
 Decode the status word. More...
 
TileBchWords encode (const TileBchStatus &status) const
 Encode an ADC status into channel and adc status word bits. More...
 

Private Member Functions

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

Private Attributes

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

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.

40  {
44  };

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 }

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]); }

◆ 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 }

◆ 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 }

◆ 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();
108 
109  //=== initialize problem to word/bit map
110  initPrbToBit();
111 }

◆ init_BitPat_onl01()

void TileBchDecoder::init_BitPat_onl01 ( )
private

Initializes bit pattern version "ofl01".

Definition at line 116 of file TileBchDecoder.cxx.

117 {
118  //=== assign decoder to channel problems
119  m_bitToPrbChn.clear();
132 
133  //=== assign decoder to adc problems
134  m_bitToPrbAdc.clear();
137 
138  //=== initialize problem to word/bit map
139  initPrbToBit();
140 }

◆ initPrbToBit()

void TileBchDecoder::initPrbToBit ( )
private

Initializes the problem to bit map.

Definition at line 145 of file TileBchDecoder.cxx.

146 {
147  m_prbToBit.clear();
148  //=== init channel problems
149  for(unsigned int i = 0; i < 32; ++i){
151  if(prb==TileBchPrbs::Invalid) continue;
152  //=== check for duplicates
153  if(m_prbToBit.find(prb) != m_prbToBit.end()){
154  throw TileCalib::InvalidBitPattern("TileBchDecoder::initPrbToBit(Chn)",i);
155  }
156  m_prbToBit[prb] = std::make_pair(0,i);
157  }
158 
159  //=== init adc problems
160  for(unsigned int i = 0; i < 32; ++i){
162  if(prb==TileBchPrbs::Invalid) continue;
163  //=== check for duplicates
164  if(m_prbToBit.find(prb)!=m_prbToBit.end()){
165  throw TileCalib::InvalidBitPattern("TileBchDecoder::initPrbToBit(Adc)",i);
166  }
167  m_prbToBit[prb] = std::make_pair(1, i);
168  }
169 }

◆ 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); }

◆ 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 174 of file TileBchDecoder.cxx.

175 {
176  stm << "Current bit to problem assignment" << std::endl;
177  stm << "---------------------------------" << std::endl;
178  stm << "Channel:" << std::endl;
179  for(unsigned int i = 0; i < 32; ++i){
181  std::string desc = TileBchPrbs::getDescription(prb);
182  stm << "bit "<<i<<"\t:\t" << desc << std::endl;
183  }
184  stm << "Adc:" << std::endl;
185  for(unsigned int i = 0; i < 32; ++i){
187  std::string desc = TileBchPrbs::getDescription(prb);
188  stm << "bit "<<i<<"\t:\t" << desc << std::endl;
189  }
190 }

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:
TileBchDecoder::decode
TileBchStatus decode(uint32_t status_channel, uint32_t status_adc=0) const
Decode the status word.
Definition: TileBchDecoder.cxx:22
TileBchPrbs::TrigHalfGain
@ TrigHalfGain
Definition: TileBchPrbs.h:80
TileBchPrbs::WrongBCID
@ WrongBCID
Definition: TileBchPrbs.h:70
TileBchPrbs::HVReadoutPb
@ HVReadoutPb
Definition: TileBchPrbs.h:66
TileBchDecoder::initPrbToBit
void initPrbToBit()
Initializes the problem to bit map.
Definition: TileBchDecoder.cxx:145
TileBchPrbs::SevereDataCorruption
@ SevereDataCorruption
Definition: TileBchPrbs.h:38
TileBchPrbs::BrokenClearFibre
@ BrokenClearFibre
Definition: TileBchPrbs.h:67
TileBchDecoder::m_bitToPrbAdc
std::vector< TileBchPrbs::Prb > m_bitToPrbAdc
Bit to problem association for the ADC word.
Definition: TileBchDecoder.h:84
TileBchPrbs::IgnoredInDsp
@ IgnoredInDsp
Definition: TileBchPrbs.h:86
TileBchPrbs::StuckBit
@ StuckBit
Definition: TileBchPrbs.h:40
TileBchPrbs::BadTiming
@ BadTiming
Definition: TileBchPrbs.h:64
TileBchPrbs::CorrelatedNoise
@ CorrelatedNoise
Definition: TileBchPrbs.h:43
TileBchPrbs::WrongDspConfig
@ WrongDspConfig
Definition: TileBchPrbs.h:36
TileBchPrbs::OnlineTimingDmuBcOffsetNeg
@ OnlineTimingDmuBcOffsetNeg
Definition: TileBchPrbs.h:92
TileBchPrbs::TimingDmuBcOffsetPos
@ TimingDmuBcOffsetPos
Definition: TileBchPrbs.h:71
TileBchStatus
Class holding bad channel problems.
Definition: TileBchStatus.h:20
TileBchPrbs::UnstableCs
@ UnstableCs
Definition: TileBchPrbs.h:69
TileBchPrbs::BadCesium
@ BadCesium
Definition: TileBchPrbs.h:62
TileBchPrbs::OnlineWrongBCID
@ OnlineWrongBCID
Definition: TileBchPrbs.h:90
TileBchPrbs::TrigNoGain
@ TrigNoGain
Definition: TileBchPrbs.h:79
TileBchPrbs::NoCis
@ NoCis
Definition: TileBchPrbs.h:45
TileBchPrbs::BurntIntegrator
@ BurntIntegrator
Definition: TileBchPrbs.h:73
TileBchPrbs::TrigNoisy
@ TrigNoisy
Definition: TileBchPrbs.h:81
TileBchPrbs::WrongHV
@ WrongHV
Definition: TileBchPrbs.h:56
TileBchPrbs::NoTiming
@ NoTiming
Definition: TileBchPrbs.h:63
TileBchPrbs::NoCesium
@ NoCesium
Definition: TileBchPrbs.h:61
TileBchPrbs::Emergency
@ Emergency
Definition: TileBchPrbs.h:65
ReadBchFromCool.prbs
prbs
Definition: ReadBchFromCool.py:466
TileBchPrbs::AdcDead
@ AdcDead
Definition: TileBchPrbs.h:33
TileBchPrbs::IgnoredInHlt
@ IgnoredInHlt
Definition: TileBchPrbs.h:87
CaloCondBlobAlgs_fillNoiseFromASCII.desc
desc
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:54
TileBchDecoder::m_prbToBit
std::map< TileBchPrbs::Prb, std::pair< unsigned int, unsigned int > > m_prbToBit
Problem to status word and bit association.
Definition: TileBchDecoder.h:88
lumiFormat.i
int i
Definition: lumiFormat.py:92
TileBchDecoder::BitPat_ofl01
@ BitPat_ofl01
Definition: TileBchDecoder.h:41
TileBchPrbs::Prb
Prb
Definition: TileBchPrbs.h:24
TileBchPrbs::NoLaser
@ NoLaser
Definition: TileBchPrbs.h:59
TileBchPrbs::LargeLfNoise
@ LargeLfNoise
Definition: TileBchPrbs.h:44
TileCalib::InvalidBchProblem
Thrown by TileBchBits if unkown problem is detected.
Definition: TileCalorimeter/TileCalib/TileCalibBlobObjs/TileCalibBlobObjs/Exception.h:204
TileBchDecoder::printBitAssignment
void printBitAssignment() const
Print status bits and their assigned problem.
Definition: TileBchDecoder.h:50
TileBchPrbs::BadLaser
@ BadLaser
Definition: TileBchPrbs.h:60
TileBchDecoder::m_bitToPrbChn
std::vector< TileBchPrbs::Prb > m_bitToPrbChn
Bit to problem association for the channel word.
Definition: TileBchDecoder.h:82
TileBchPrbs::VeryLargeHfNoise
@ VeryLargeHfNoise
Definition: TileBchPrbs.h:34
TileBchPrbs::NoData
@ NoData
Definition: TileBchPrbs.h:35
TileBchPrbs::OnlineTimingDmuBcOffsetPos
@ OnlineTimingDmuBcOffsetPos
Definition: TileBchPrbs.h:91
TileBchPrbs::BadCis
@ BadCis
Definition: TileBchPrbs.h:46
TileBchPrbs::Invalid
@ Invalid
Definition: TileBchPrbs.h:26
TileBchPrbs::NoPmt
@ NoPmt
Definition: TileBchPrbs.h:54
TileBchPrbs::IgnoredByDQV
@ IgnoredByDQV
Definition: TileBchPrbs.h:47
TileBchPrbs::DataCorruption
@ DataCorruption
Definition: TileBchPrbs.h:41
TileBchDecoder::init_BitPat_onl01
void init_BitPat_onl01()
Initializes bit pattern version "ofl01".
Definition: TileBchDecoder.cxx:116
TileBchDecoder::init_BitPat_ofl01
void init_BitPat_ofl01()
Initializes bit pattern version "ofl01".
Definition: TileBchDecoder.cxx:61
TileBchPrbs::OnlineGeneralMaskAdc
@ OnlineGeneralMaskAdc
Definition: TileBchPrbs.h:97
TileBchPrbs::DisableForL1
@ DisableForL1
Definition: TileBchPrbs.h:88
TileBchPrbs::TimingDmuBcOffsetNeg
@ TimingDmuBcOffsetNeg
Definition: TileBchPrbs.h:72
TileBchPrbs::IgnoreCs
@ IgnoreCs
Definition: TileBchPrbs.h:68
TileBchWords
Definition: TileBchWords.h:12
TileCalib::InvalidBitPattern
Thrown by TileBchBits if invalid bit pattern is detected.
Definition: TileCalorimeter/TileCalib/TileCalibBlobObjs/TileCalibBlobObjs/Exception.h:185
TileBchPrbs::TrigGeneralMask
@ TrigGeneralMask
Definition: TileBchPrbs.h:78
merge.status
status
Definition: merge.py:17
TileBchPrbs::LargeHfNoise
@ LargeHfNoise
Definition: TileBchPrbs.h:42
TileBchPrbs::SevereStuckBit
@ SevereStuckBit
Definition: TileBchPrbs.h:37
TileBchPrbs::NoHV
@ NoHV
Definition: TileBchPrbs.h:55
TileBchPrbs::OnlineBadTiming
@ OnlineBadTiming
Definition: TileBchPrbs.h:89
checkFileSG.words
words
Definition: checkFileSG.py:76
TileBchPrbs::GeneralMaskChannel
@ GeneralMaskChannel
Definition: TileBchPrbs.h:53
TileBchPrbs::GeneralMaskAdc
@ GeneralMaskAdc
Definition: TileBchPrbs.h:32
TileBchDecoder::MaxVersion
@ MaxVersion
Definition: TileBchDecoder.h:43
TileBchDecoder::BitPat_onl01
@ BitPat_onl01
Definition: TileBchDecoder.h:42
TileBchPrbs::getDescription
static std::string getDescription(const Prb &prb)
Get description of problem.
Definition: TileBchPrbs.cxx:11