ATLAS Offline Software
Loading...
Searching...
No Matches
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
16
18public:
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
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
63private:
64
66 std::vector<LArBadChannel> m_vec;
67
74
75};
76
77#endif
LArBadChannel status(unsigned int chan) const
Returns an OR of the channel status and the missing FEB status.
bool empty() const
Returns true if there are no bad channels in the FEB.
LArBadChannel setBadState() const
std::vector< LArBadChannel > m_vec
void setFebStatus(LArBadFeb s)
bool bad() const
Returns true if the entire FEB is missing.
void addChannel(unsigned int chan, LArBadChannel chanState)
LArBadFeb febStatus() const
Returns the FEB state.
BitWord packedData() const
void setBit(typename T::ProblemType pb, LArBadChannel::BitWord &word, bool value=true) const