Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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();
109 
110  //=== initialize problem to word/bit map
111  initPrbToBit();
112 }

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

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

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

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:81
TileBchPrbs::WrongBCID
@ WrongBCID
Definition: TileBchPrbs.h:71
TileBchPrbs::HVReadoutPb
@ HVReadoutPb
Definition: TileBchPrbs.h:67
TileBchDecoder::initPrbToBit
void initPrbToBit()
Initializes the problem to bit map.
Definition: TileBchDecoder.cxx:146
TileBchPrbs::SevereDataCorruption
@ SevereDataCorruption
Definition: TileBchPrbs.h:38
TileBchPrbs::BrokenClearFibre
@ BrokenClearFibre
Definition: TileBchPrbs.h:68
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:87
TileBchPrbs::StuckBit
@ StuckBit
Definition: TileBchPrbs.h:40
TileBchPrbs::BadTiming
@ BadTiming
Definition: TileBchPrbs.h:65
TileBchPrbs::CorrelatedNoise
@ CorrelatedNoise
Definition: TileBchPrbs.h:43
TileBchPrbs::WrongDspConfig
@ WrongDspConfig
Definition: TileBchPrbs.h:36
TileBchPrbs::OnlineTimingDmuBcOffsetNeg
@ OnlineTimingDmuBcOffsetNeg
Definition: TileBchPrbs.h:93
TileBchPrbs::TimingDmuBcOffsetPos
@ TimingDmuBcOffsetPos
Definition: TileBchPrbs.h:72
TileBchStatus
Class holding bad channel problems.
Definition: TileBchStatus.h:20
TileBchPrbs::UnstableCs
@ UnstableCs
Definition: TileBchPrbs.h:70
TileBchPrbs::BadCesium
@ BadCesium
Definition: TileBchPrbs.h:63
TileBchPrbs::OnlineWrongBCID
@ OnlineWrongBCID
Definition: TileBchPrbs.h:91
TileBchPrbs::TrigNoGain
@ TrigNoGain
Definition: TileBchPrbs.h:80
TileBchPrbs::NoCis
@ NoCis
Definition: TileBchPrbs.h:45
TileBchPrbs::BurntIntegrator
@ BurntIntegrator
Definition: TileBchPrbs.h:74
TileBchPrbs::TrigNoisy
@ TrigNoisy
Definition: TileBchPrbs.h:82
TileBchPrbs::WrongHV
@ WrongHV
Definition: TileBchPrbs.h:57
TileBchPrbs::NoTiming
@ NoTiming
Definition: TileBchPrbs.h:64
TileBchPrbs::NoCesium
@ NoCesium
Definition: TileBchPrbs.h:62
TileBchPrbs::Emergency
@ Emergency
Definition: TileBchPrbs.h:66
ReadBchFromCool.prbs
prbs
Definition: ReadBchFromCool.py:466
TileBchPrbs::AdcDead
@ AdcDead
Definition: TileBchPrbs.h:33
TileBchPrbs::IgnoredInHlt
@ IgnoredInHlt
Definition: TileBchPrbs.h:88
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
TileBchPrbs::HalfGain
@ HalfGain
Definition: TileBchPrbs.h:48
lumiFormat.i
int i
Definition: lumiFormat.py:85
TileBchDecoder::BitPat_ofl01
@ BitPat_ofl01
Definition: TileBchDecoder.h:41
TileBchPrbs::Prb
Prb
Definition: TileBchPrbs.h:24
TileBchPrbs::NoLaser
@ NoLaser
Definition: TileBchPrbs.h:60
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:61
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:92
TileBchPrbs::BadCis
@ BadCis
Definition: TileBchPrbs.h:46
TileBchPrbs::Invalid
@ Invalid
Definition: TileBchPrbs.h:26
TileBchPrbs::NoPmt
@ NoPmt
Definition: TileBchPrbs.h:55
PlotCalibFromCool.words
words
Definition: PlotCalibFromCool.py:51
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:117
TileBchDecoder::init_BitPat_ofl01
void init_BitPat_ofl01()
Initializes bit pattern version "ofl01".
Definition: TileBchDecoder.cxx:61
TileBchPrbs::OnlineGeneralMaskAdc
@ OnlineGeneralMaskAdc
Definition: TileBchPrbs.h:98
TileBchPrbs::DisableForL1
@ DisableForL1
Definition: TileBchPrbs.h:89
TileBchPrbs::TimingDmuBcOffsetNeg
@ TimingDmuBcOffsetNeg
Definition: TileBchPrbs.h:73
TileBchPrbs::IgnoreCs
@ IgnoreCs
Definition: TileBchPrbs.h:69
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:79
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:56
TileBchPrbs::OnlineBadTiming
@ OnlineBadTiming
Definition: TileBchPrbs.h:90
TileBchPrbs::GeneralMaskChannel
@ GeneralMaskChannel
Definition: TileBchPrbs.h:54
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