ATLAS Offline Software
LArBadChannelState.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef LArBadChannelState_H
6 #define LArBadChannelState_H
7 
10 
11 #include <vector>
12 #include <string>
13 
14 
16  public:
17 
18  typedef std::pair<HWIdentifier, LArBadChannel> BadChanEntry;
19 
20  enum {NCoolChannels=8};
22  enum PosNegEnum { NEG, POS};
24 
26  public:
27 
28  typedef std::vector<BadChanEntry> BadChanVec;
29 
32  m_number(cc), m_entries( entries), m_changed(false) {}
33 
36  m_number(cc), m_entries(), m_changed(false) {}
37 
38  void reset() {
39  m_entries.clear();
40  m_changed = false;
41  }
42 
45  void add( const BadChanEntry& e) {
46  m_entries.push_back(e);
47  m_changed = true;
48  }
49 
50  void setFromDB( const BadChanVec& stateVec) {
51  m_entries = stateVec;
52  m_changed = false;
53  }
54 
55  void addFromDB( const BadChanVec& stateVec);
56 
57  void addUpdate( const BadChanVec& stateVec) {
58  m_entries.insert( m_entries.end(), stateVec.begin(), stateVec.end());
59  m_changed = true;
60  }
61 
63 
64  CoolChannelEnum number() const { return m_number;}
65 
66  bool changed() const { return m_changed;}
67 
68  BadChanVec::const_iterator begin() const {
69  return m_entries.begin();
70  }
72  return m_entries.begin();
73  }
74 
75  BadChanVec::const_iterator end() const {
76  return m_entries.end();
77  }
79  return m_entries.end();
80  }
81 
82  BadChanVec::size_type size() const {
83  return m_entries.size();
84  }
85 
86  bool empty() const {
87  return m_entries.empty();
88  }
89 
90  const BadChanVec& stateVector() const { return m_entries;}
91 
92  private:
95  bool m_changed;
96  };
97 
98 
100 
102 
103  int nCoolChannels() const { return m_DataVec.size();}
104 
106  bool empty() const {
107  for (const CoolChannelData& cd : m_DataVec) {
108  if (!cd.empty()) return false;
109  }
110  return true;
111  }
112 
114  void reset();
115 
117  void addFromDB( const BadChanVec& stateVec,
119 
121  void add( const BadChanEntry& entry, CoolChannelEnum chan);
122 
124  void setFromDB( const BadChanVec& stateVec,
126 
129  void addUpdate( const BadChanVec& stateVec,
131  m_DataVec[chan].addUpdate( stateVec);
132  }
133 
135  return m_DataVec.at(chan);
136  }
137 
138  static std::string coolChannelName( CoolChannelEnum chan);
139 
141  return static_cast<CoolChannelEnum>( 2 * static_cast<unsigned int>(part) +
142  1 - static_cast<unsigned int>(side));
143  }
144 
146  if (chan == EMBA || chan == EMBC) return 0;
147  else return 1;
148  }
149 
151  return static_cast<CaloPartEnum>(static_cast<int>(chan)/2);
152  }
153 
154  static int posNeg( CoolChannelEnum chan) {
155  return (static_cast<int>(chan)+1) % 2;
156  }
157 
158  static void mergeFlags( BadChanEntry& a, const BadChanEntry& b) {
159  a.second = LArBadChannel( a.second.packedData() | b.second.packedData());
160  }
161 
162  //void CurrentState
163  private:
164 
165  std::vector< CoolChannelData> m_DataVec;
166 
167  // Non-const access to channel data
169  return m_DataVec.at( static_cast<CoolChannelEnum>(i));
170  }
171 
172 };
173 
174 #endif
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
LArBadChannelState
Definition: LArBadChannelState.h:15
LArBadChannelState::FCALA
@ FCALA
Definition: LArBadChannelState.h:23
LArBadChannelState::BadChanVec
CoolChannelData::BadChanVec BadChanVec
Definition: LArBadChannelState.h:99
LArBadChannelState::CoolChannelData::CoolChannelData
CoolChannelData(CoolChannelEnum cc)
Construct an empty CoolChannelData.
Definition: LArBadChannelState.h:35
LArBadChannelState::caloPart
static CaloPartEnum caloPart(CoolChannelEnum chan)
Definition: LArBadChannelState.h:150
LArBadChannelState::HEC
@ HEC
Definition: LArBadChannelState.h:21
LArBadChannelState::PosNegEnum
PosNegEnum
Definition: LArBadChannelState.h:22
LArBadChannel.h
LArBadChannelState::barrelEndcap
static int barrelEndcap(CoolChannelEnum chan)
Definition: LArBadChannelState.h:145
LArBadChannelState::CoolChannelData::resolveDuplicateEntries
void resolveDuplicateEntries()
Definition: LArBadChannelState.cxx:81
LArBadChannelState::posNeg
static int posNeg(CoolChannelEnum chan)
Definition: LArBadChannelState.h:154
LArBadChannelState::CoolChannelData::begin
BadChanVec::iterator begin()
Definition: LArBadChannelState.h:71
LArBadChannelState::POS
@ POS
Definition: LArBadChannelState.h:22
LArBadChannelState::add
void add(const BadChanEntry &entry, CoolChannelEnum chan)
Add a bad channel entry to a specified cool channel data.
Definition: LArBadChannelState.cxx:16
LArBadChannelState::CoolChannelData::size
BadChanVec::size_type size() const
Definition: LArBadChannelState.h:82
LArBadChannelState::m_DataVec
std::vector< CoolChannelData > m_DataVec
Definition: LArBadChannelState.h:165
LArBadChannelState::CoolChannelData::addFromDB
void addFromDB(const BadChanVec &stateVec)
Definition: LArBadChannelState.cxx:73
LArBadChannelState::CoolChannelData::empty
bool empty() const
Definition: LArBadChannelState.h:86
LArBadChannelState::BadChanEntry
std::pair< HWIdentifier, LArBadChannel > BadChanEntry
Definition: LArBadChannelState.h:18
LArBadChannelState::CoolChannelData::begin
BadChanVec::const_iterator begin() const
Definition: LArBadChannelState.h:68
TRT::Hit::side
@ side
Definition: HitInfo.h:83
LArBadChannelState::reset
void reset()
Reset to an empty state, erasing all data in all cool channels.
Definition: LArBadChannelState.cxx:33
LArBadChannelState::CoolChannelData
Definition: LArBadChannelState.h:25
LArBadChannelState::coolChannelEnum
static CoolChannelEnum coolChannelEnum(CaloPartEnum part, PosNegEnum side)
Definition: LArBadChannelState.h:140
LArBadChannelState::CoolChannelData::BadChanVec
std::vector< BadChanEntry > BadChanVec
Definition: LArBadChannelState.h:28
LArBadChannelState::FCAL
@ FCAL
Definition: LArBadChannelState.h:21
LArBadChannelState::nCoolChannels
int nCoolChannels() const
Definition: LArBadChannelState.h:103
lumiFormat.i
int i
Definition: lumiFormat.py:85
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
LArBadChannelState::EMB
@ EMB
Definition: LArBadChannelState.h:21
LArBadChannelState::EMBC
@ EMBC
Definition: LArBadChannelState.h:23
LArBadChannelState::CoolChannelData::end
BadChanVec::iterator end()
Definition: LArBadChannelState.h:78
LArBadChannelState::CoolChannelData::CoolChannelData
CoolChannelData(CoolChannelEnum cc, const BadChanVec &entries)
Construct with bad channel data.
Definition: LArBadChannelState.h:31
LArBadChannel
Definition: LArBadChannel.h:10
LArBadChannelState::mergeFlags
static void mergeFlags(BadChanEntry &a, const BadChanEntry &b)
Definition: LArBadChannelState.h:158
LArBadChannelState::CoolChannelData::m_entries
BadChanVec m_entries
Definition: LArBadChannelState.h:94
LArBadChannelState::CoolChannelData::number
CoolChannelEnum number() const
Definition: LArBadChannelState.h:64
LArBadChannelState::coolChannel
CoolChannelData & coolChannel(int i)
Definition: LArBadChannelState.h:168
LArBadChannelState::LArBadChannelState
LArBadChannelState()
Definition: LArBadChannelState.cxx:9
LArBadChannelState::EMECA
@ EMECA
Definition: LArBadChannelState.h:23
LArBadChannelState::coolChannel
const CoolChannelData & coolChannel(CoolChannelEnum chan) const
Definition: LArBadChannelState.h:134
LArBadChannelState::CoolChannelData::addUpdate
void addUpdate(const BadChanVec &stateVec)
Definition: LArBadChannelState.h:57
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
LArBadChannelState::coolChannelName
static std::string coolChannelName(CoolChannelEnum chan)
Definition: LArBadChannelState.cxx:40
HWIdentifier.h
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
LArBadChannelState::CoolChannelData::changed
bool changed() const
Definition: LArBadChannelState.h:66
LArBadChannelState::setFromDB
void setFromDB(const BadChanVec &stateVec, CoolChannelEnum chan)
Set cool channel from vector<BadChanEntry>, for example when reading from DB.
Definition: LArBadChannelState.cxx:21
LArBadChannelState::NEG
@ NEG
Definition: LArBadChannelState.h:22
LArBadChannelState::CoolChannelEnum
CoolChannelEnum
Definition: LArBadChannelState.h:23
LArBadChannelState::CoolChannelData::m_number
CoolChannelEnum m_number
Definition: LArBadChannelState.h:93
a
TList * a
Definition: liststreamerinfos.cxx:10
LArBadChannelState::CoolChannelData::stateVector
const BadChanVec & stateVector() const
Definition: LArBadChannelState.h:90
LArBadChannelState::HECA
@ HECA
Definition: LArBadChannelState.h:23
LArBadChannelState::NCoolChannels
@ NCoolChannels
Definition: LArBadChannelState.h:20
entries
double entries
Definition: listroot.cxx:49
LArBadChannelState::EMBA
@ EMBA
Definition: LArBadChannelState.h:23
calibdata.cd
cd
Definition: calibdata.py:51
LArBadChannelState::CoolChannelData::m_changed
bool m_changed
Definition: LArBadChannelState.h:95
LArBadChannelState::CaloPartEnum
CaloPartEnum
Definition: LArBadChannelState.h:21
LArBadChannelState::addFromDB
void addFromDB(const BadChanVec &stateVec, CoolChannelEnum chan)
Add a complete cool channel from DB, with duplicate removal.
Definition: LArBadChannelState.cxx:27
LArBadChannelState::EMEC
@ EMEC
Definition: LArBadChannelState.h:21
LArBadChannelState::empty
bool empty() const
Returns true if all cool channels are empty.
Definition: LArBadChannelState.h:106
LArBadChannelState::CoolChannelData::setFromDB
void setFromDB(const BadChanVec &stateVec)
Definition: LArBadChannelState.h:50
LArBadChannelState::HECC
@ HECC
Definition: LArBadChannelState.h:23
LArBadChannelState::CoolChannelData::add
void add(const BadChanEntry &e)
the entry is assumed to belong to the cool channel and is not checked.
Definition: LArBadChannelState.h:45
LArBadChannelState::CoolChannelData::reset
void reset()
Definition: LArBadChannelState.h:38
LArBadChannelState::addUpdate
void addUpdate(const BadChanVec &stateVec, CoolChannelEnum chan)
Add updates, e.g.
Definition: LArBadChannelState.h:129
LArBadChannelState::MAXCOOLCHAN
@ MAXCOOLCHAN
Definition: LArBadChannelState.h:23
python.handimod.cc
int cc
Definition: handimod.py:523
LArBadChannelState::EMECC
@ EMECC
Definition: LArBadChannelState.h:23
LArBadChannelState::CoolChannelData::end
BadChanVec::const_iterator end() const
Definition: LArBadChannelState.h:75
LArBadChannelState::FCALC
@ FCALC
Definition: LArBadChannelState.h:23