ATLAS Offline Software
LArBadChanFebState.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef LArBadChanFebState_H
6 #define LArBadChanFebState_H
7 
11 #include <vector>
12 
18 public:
19 
21 
22  void resetChannels() {
23  if (m_vec.capacity() != 0) std::vector<LArBadChannel>().swap(m_vec); // clear() and free the memory
24  }
25 
26  // void setBad() {m_bad = true;} // replaced by setFebStatus
28  void resetBad() {m_status = LArBadFeb();}
29 
31  bool bad() const {return !m_status.good();}
32 
34  LArBadFeb febStatus() const {return m_status;}
35 
37  bool empty() const {return m_vec.empty();}
38 
39  void addChannel( unsigned int chan, LArBadChannel chanState) {
40  // FIXME 128 (number of channels per FEB) is a hard-wired constant here
41  if (m_vec.size() != 128) m_vec.resize(128);
42  m_vec.at(chan) = chanState;
43  }
44 
46  LArBadChannel status( unsigned int chan) const {
47  static LArBadChannel goodState(0);
48  static LArBadChannel badState = setBadState(); // initialized only at first call
49 
50  if (empty()) {
51  if (bad()) return badState;
52  else return goodState;
53  }
54  else {
55  if (!bad()) return m_vec.at(chan);
56  else return LArBadChannel( m_vec.at(chan).packedData() | badState.packedData());
57  }
58 
59  // does not return channel info in case the FEB is missing
60  // return ( bad() ? badState : ( m_vec.empty() ? goodState : m_vec.at(chan)));
61  }
62 
63 private:
64 
66  std::vector<LArBadChannel> m_vec;
67 
69  LArBadChanBitPacking packing;
70  LArBadChannel bs;
72  return bs;
73  }
74 
75 };
76 
77 #endif
LArBadChanBitPacking
Definition: LArBadChanBitPacking.h:13
LArBadChanFebState::empty
bool empty() const
Returns true if there are no bad channels in the FEB.
Definition: LArBadChanFebState.h:37
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
LArBadChanFebState::febStatus
LArBadFeb febStatus() const
Returns the FEB state.
Definition: LArBadChanFebState.h:34
LArBadChannel.h
LArBadChanFebState::m_vec
std::vector< LArBadChannel > m_vec
Definition: LArBadChanFebState.h:66
LArBadChannel::LArBadChannelEnum::missingFEBBit
@ missingFEBBit
Definition: LArBadChannel.h:36
LArBadChanFebState::status
LArBadChannel status(unsigned int chan) const
Returns an OR of the channel status and the missing FEB status.
Definition: LArBadChanFebState.h:46
LArBadChanFebState::resetBad
void resetBad()
Definition: LArBadChanFebState.h:28
LArBadFeb.h
LArBadFeb::good
bool good() const
Returns true if no problems at all (all bits at zero)
Definition: LArBadFeb.h:27
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
LArBadChannel
Definition: LArBadChannel.h:10
LArBadChanBitPacking.h
LArBadChanFebState::setBadState
LArBadChannel setBadState() const
Definition: LArBadChanFebState.h:68
LArBadFeb
Definition: LArBadFeb.h:10
LArBadChannel::packedData
BitWord packedData() const
Definition: LArBadChannel.h:143
LArBadChanFebState::setFebStatus
void setFebStatus(LArBadFeb s)
Definition: LArBadChanFebState.h:27
LArBadChanFebState::m_status
LArBadFeb m_status
Definition: LArBadChanFebState.h:65
LArBadChanFebState::addChannel
void addChannel(unsigned int chan, LArBadChannel chanState)
Definition: LArBadChanFebState.h:39
LArBadChanFebState
A class that stores the bad channels of a single FEB.
Definition: LArBadChanFebState.h:17
TLArBadChanBitPackingBase::setBit
void setBit(typename T::ProblemType pb, LArBadChannel::BitWord &word, bool value=true) const
LArBadChanFebState::LArBadChanFebState
LArBadChanFebState()
Definition: LArBadChanFebState.h:20
LArBadChanFebState::resetChannels
void resetChannels()
Definition: LArBadChanFebState.h:22
LArBadChanFebState::bad
bool bad() const
Returns true if the entire FEB is missing.
Definition: LArBadChanFebState.h:31