ATLAS Offline Software
TileBchDecoder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 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 //________________________________________________________________
22 TileBchDecoder::decode(uint32_t status_channel, uint32_t status_adc) const
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 }
36 
37 //
38 //________________________________________________________________
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 }
57 
58 //
59 //________________________________________________________________
60 void
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 }
112 
113 //
114 //________________________________________________________________
115 void
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 }
141 
142 //
143 //________________________________________________________________
144 void
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 }
170 
171 //
172 //________________________________________________________________
173 void
174 TileBchDecoder::printBitAssignment(std::ostream& stm) const
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 }
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
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TileBchDecoder::TileBchDecoder
TileBchDecoder(BitPatVer bitPatVer)
Ctor.
Definition: TileBchDecoder.cxx:10
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
TileBchDecoder::encode
TileBchWords encode(const TileBchStatus &status) const
Encode an ADC status into channel and adc status word bits.
Definition: TileBchDecoder.cxx:40
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.h
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
TileBchDecoder::BitPatVer
BitPatVer
Definition: TileBchDecoder.h:40
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
Exception.h
TileBchPrbs::GeneralMaskChannel
@ GeneralMaskChannel
Definition: TileBchPrbs.h:53
TileBchPrbs::GeneralMaskAdc
@ GeneralMaskAdc
Definition: TileBchPrbs.h:32
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