ATLAS Offline Software
TileBchStatus.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TILECALIBBLOBOBJS_TILEBCHSTATUS_H
6 #define TILECALIBBLOBOBJS_TILEBCHSTATUS_H
7 
15 #include <set>
16 #include <string>
17 #include <mutex>
18 
20 {
21  public:
23  typedef std::set<Prb> PrbSet;
24 
25  TileBchStatus();
26  TileBchStatus(const PrbSet& prbSet);
27 
32  bool operator==(const TileBchStatus &other) const;
33  bool operator!=(const TileBchStatus &other) const;
34 
35  const PrbSet& getPrbs() const;
36  PrbSet testFor(const PrbSet& prbSet) const;
37  bool contains(const Prb& prb) const;
38  std::string getString() const;
39 
40  static void initClassifierDefinitions();
41  static void defineBad( const TileBchStatus& status);
42  static void defineNoisy(const TileBchStatus& status);
43  static void defineNoGainL1(const TileBchStatus& status);
44  static void defineBadTiming(const TileBchStatus& status);
45  static void defineTimingDmuBcOffset(const TileBchStatus& status);
46  static void defineWrongBCID(const TileBchStatus& status);
53 
54  bool isGood() const;
55  bool isBad() const;
56  bool isAffected() const;
57  bool isNoisy() const;
58  bool isIgnoredInDsp() const;
59  bool isIgnoredInHlt() const;
60  bool isNoGainL1() const;
61  bool isHalfGainL1() const;
62  bool isBadTiming() const;
63  bool isTimingDmuBcOffset() const;
64  bool isTimingDmuBcOffsetPos() const;
65  bool isTimingDmuBcOffsetNeg() const;
66  bool isWrongBCID() const;
67 
68  private:
70  //=== reference sets
71  struct LockedPrbSet
72  {
73  size_t size() const
74  {
75  std::lock_guard lock (m_mutex);
76  return m_set.size();
77  }
78  void set (const PrbSet& s)
79  {
80  std::lock_guard lock (m_mutex);
81  m_set = s;
82  }
83  void set (PrbSet&& s)
84  {
85  std::lock_guard lock (m_mutex);
86  m_set = std::move(s);
87  }
88  operator TileBchStatus() const
89  {
90  std::lock_guard lock (m_mutex);
91  return TileBchStatus (m_set, true);
92  }
93  bool test (const PrbSet& s) const;
94 
95  private:
98  };
99 
100  TileBchStatus (const PrbSet& s, bool) : m_prbSet (s) {}
101 
103  static LockedPrbSet s_refNoisy ATLAS_THREAD_SAFE;
104  static LockedPrbSet s_refNoGainL1 ATLAS_THREAD_SAFE;
105  static LockedPrbSet s_refBadTiming ATLAS_THREAD_SAFE;
106  static LockedPrbSet s_refWrongBCID ATLAS_THREAD_SAFE;
107  static LockedPrbSet s_refTimingDmuBcOffset ATLAS_THREAD_SAFE;
108 };
109 
110 //
111 //_________________________________________________________
112 inline const TileBchStatus::PrbSet&
114 {
115  return m_prbSet;
116 }
117 
118 //
119 //_________________________________________________________
120 inline bool
121 TileBchStatus::contains(const Prb& prb) const
122 {
123  return (m_prbSet.find(prb) != m_prbSet.end());
124 }
125 
126 //
127 //_________________________________________________________
128 inline bool
130 {
131  return (m_prbSet.size() == 0);
132 }
133 
134 //
135 //_________________________________________________________
136 inline bool
138 {
139  return (!isGood());
140 }
141 
142 //
143 //_________________________________________________________
144 inline bool
146 {
147  return m_prbSet.size() ? (s_refBad.test (m_prbSet)) : false;
148 }
149 
150 //
151 //_________________________________________________________
152 inline bool
154 {
155  return m_prbSet.size() ? (s_refNoisy.test (m_prbSet)) : false;
156 }
157 
158 //
159 //_________________________________________________________
160 inline bool
162 {
163  return m_prbSet.size() ? contains(TileBchPrbs::IgnoredInDsp) : false;
164 }
165 
166 //
167 //_________________________________________________________
168 inline bool
170 {
171  return m_prbSet.size() ? contains(TileBchPrbs::IgnoredInHlt) : false;
172 }
173 
174 //
175 //_________________________________________________________
176 inline bool
178 {
179  return m_prbSet.size() ? (s_refNoGainL1.test (m_prbSet)) : false;
180 }
181 
182 //
183 //_________________________________________________________
184 inline bool
186 {
187  return m_prbSet.size() ? contains(TileBchPrbs::TrigHalfGain) : false;
188 }
189 
190 //
191 //_________________________________________________________
192 inline bool
194 {
195  return m_prbSet.size() ? (s_refBadTiming.test (m_prbSet)) : false;
196 }
197 
198 //
199 //_________________________________________________________
200 inline bool
202 {
203  return m_prbSet.size() ? (s_refTimingDmuBcOffset.test (m_prbSet)) : false;
204 }
205 
206 //
207 //_________________________________________________________
208 inline bool
210 {
212 }
213 
214 //
215 //_________________________________________________________
216 inline bool
218 {
220 }
221 
222 //
223 //_________________________________________________________
224 inline bool
226 {
227  return m_prbSet.size() ? (s_refWrongBCID.test (m_prbSet)) : false;
228 }
229 
230 #endif
TileBchStatus::ATLAS_THREAD_SAFE
static LockedPrbSet s_refNoisy ATLAS_THREAD_SAFE
Definition: TileBchStatus.h:103
TileBchStatus::getDefinitionTimingDmuBcOffset
static TileBchStatus getDefinitionTimingDmuBcOffset()
Definition: TileBchStatus.cxx:237
TileBchPrbs::TrigHalfGain
@ TrigHalfGain
Definition: TileBchPrbs.h:80
TileBchStatus::getPrbs
const PrbSet & getPrbs() const
Definition: TileBchStatus.h:113
TileBchStatus::ATLAS_THREAD_SAFE
static LockedPrbSet s_refNoGainL1 ATLAS_THREAD_SAFE
Definition: TileBchStatus.h:104
TileBchStatus::isTimingDmuBcOffset
bool isTimingDmuBcOffset() const
Definition: TileBchStatus.h:201
TileBchStatus::operator!=
bool operator!=(const TileBchStatus &other) const
Definition: TileBchStatus.cxx:83
TileBchStatus::isNoisy
bool isNoisy() const
Definition: TileBchStatus.h:153
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
TileBchStatus::defineTimingDmuBcOffset
static void defineTimingDmuBcOffset(const TileBchStatus &status)
Definition: TileBchStatus.cxx:189
TileBchStatus::getDefinitionBadTiming
static TileBchStatus getDefinitionBadTiming()
Definition: TileBchStatus.cxx:229
TileBchStatus::initClassifierDefinitions
static void initClassifierDefinitions()
Definition: TileBchStatus.cxx:91
TileBchStatus::getDefinitionWrongBCID
static TileBchStatus getDefinitionWrongBCID()
Definition: TileBchStatus.cxx:245
TileBchPrbs::IgnoredInDsp
@ IgnoredInDsp
Definition: TileBchPrbs.h:86
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
TileBchStatus::isTimingDmuBcOffsetPos
bool isTimingDmuBcOffsetPos() const
Definition: TileBchStatus.h:209
TileBchPrbs::OnlineTimingDmuBcOffsetNeg
@ OnlineTimingDmuBcOffsetNeg
Definition: TileBchPrbs.h:92
TileBchPrbs::TimingDmuBcOffsetPos
@ TimingDmuBcOffsetPos
Definition: TileBchPrbs.h:71
TileBchStatus::LockedPrbSet::set
void set(PrbSet &&s)
Definition: TileBchStatus.h:83
TileBchStatus
Class holding bad channel problems.
Definition: TileBchStatus.h:20
TileBchStatus::ATLAS_THREAD_SAFE
static LockedPrbSet s_refTimingDmuBcOffset ATLAS_THREAD_SAFE
Definition: TileBchStatus.h:107
TileBchStatus::LockedPrbSet::size
size_t size() const
Definition: TileBchStatus.h:73
TileBchStatus::ATLAS_THREAD_SAFE
static LockedPrbSet s_refWrongBCID ATLAS_THREAD_SAFE
Definition: TileBchStatus.h:106
TileBchStatus::LockedPrbSet
Definition: TileBchStatus.h:72
TileBchStatus::isIgnoredInDsp
bool isIgnoredInDsp() const
Definition: TileBchStatus.h:161
TileBchStatus::isGood
bool isGood() const
Definition: TileBchStatus.h:129
TileBchStatus::operator-=
TileBchStatus & operator-=(const TileBchStatus &rhs)
Definition: TileBchStatus.cxx:54
TileBchStatus::PrbSet
std::set< Prb > PrbSet
Definition: TileBchStatus.h:23
TileBchStatus::isNoGainL1
bool isNoGainL1() const
Definition: TileBchStatus.h:177
TileBchStatus::LockedPrbSet::set
void set(const PrbSet &s)
Definition: TileBchStatus.h:78
TileBchStatus::ATLAS_THREAD_SAFE
static LockedPrbSet s_refBad ATLAS_THREAD_SAFE
Definition: TileBchStatus.h:102
TileBchStatus::defineBadTiming
static void defineBadTiming(const TileBchStatus &status)
Definition: TileBchStatus.cxx:181
TileBchStatus::TileBchStatus
TileBchStatus(const PrbSet &s, bool)
Definition: TileBchStatus.h:100
TileBchStatus::getDefinitionNoisy
static TileBchStatus getDefinitionNoisy()
Definition: TileBchStatus.cxx:213
TileBchPrbs::IgnoredInHlt
@ IgnoredInHlt
Definition: TileBchPrbs.h:87
TileBchStatus::TileBchStatus
TileBchStatus()
Definition: TileBchStatus.cxx:18
TileBchStatus::defineNoisy
static void defineNoisy(const TileBchStatus &status)
Definition: TileBchStatus.cxx:165
TileBchStatus::testFor
PrbSet testFor(const PrbSet &prbSet) const
Definition: TileBchStatus.cxx:253
TileBchPrbs::Prb
Prb
Definition: TileBchPrbs.h:24
TileBchStatus::Prb
TileBchPrbs::Prb Prb
Definition: TileBchStatus.h:22
TileBchStatus::defineNoGainL1
static void defineNoGainL1(const TileBchStatus &status)
Definition: TileBchStatus.cxx:173
TileBchStatus::isAffected
bool isAffected() const
Definition: TileBchStatus.h:137
TileBchStatus::defineBad
static void defineBad(const TileBchStatus &status)
Definition: TileBchStatus.cxx:157
TileBchPrbs::OnlineTimingDmuBcOffsetPos
@ OnlineTimingDmuBcOffsetPos
Definition: TileBchPrbs.h:91
TileBchStatus::LockedPrbSet::m_set
PrbSet m_set
Definition: TileBchStatus.h:96
TileBchStatus::operator+=
TileBchStatus & operator+=(const TileBchStatus &rhs)
Definition: TileBchStatus.cxx:34
TileBchStatus::m_prbSet
PrbSet m_prbSet
Definition: TileBchStatus.h:69
TileBchStatus::operator==
bool operator==(const TileBchStatus &other) const
Definition: TileBchStatus.cxx:75
TileBchStatus::LockedPrbSet::test
bool test(const PrbSet &s) const
Definition: TileBchStatus.cxx:275
TileBchStatus::isIgnoredInHlt
bool isIgnoredInHlt() const
Definition: TileBchStatus.h:169
TileBchStatus::defineWrongBCID
static void defineWrongBCID(const TileBchStatus &status)
Definition: TileBchStatus.cxx:197
TileBchStatus::ATLAS_THREAD_SAFE
static LockedPrbSet s_refBadTiming ATLAS_THREAD_SAFE
Definition: TileBchStatus.h:105
TileBchStatus::isHalfGainL1
bool isHalfGainL1() const
Definition: TileBchStatus.h:185
TileBchStatus::LockedPrbSet::m_mutex
std::mutex m_mutex
Definition: TileBchStatus.h:97
TileBchStatus::getDefinitionNoGainL1
static TileBchStatus getDefinitionNoGainL1()
Definition: TileBchStatus.cxx:221
TileBchStatus::getDefinitionBad
static TileBchStatus getDefinitionBad()
Definition: TileBchStatus.cxx:205
TileBchStatus::contains
bool contains(const Prb &prb) const
Definition: TileBchStatus.h:121
TileBchPrbs.h
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
TileBchPrbs::TimingDmuBcOffsetNeg
@ TimingDmuBcOffsetNeg
Definition: TileBchPrbs.h:72
TileBchStatus::isTimingDmuBcOffsetNeg
bool isTimingDmuBcOffsetNeg() const
Definition: TileBchStatus.h:217
TileBchStatus::isBadTiming
bool isBadTiming() const
Definition: TileBchStatus.h:193
merge.status
status
Definition: merge.py:17
TileBchStatus::isWrongBCID
bool isWrongBCID() const
Definition: TileBchStatus.h:225
checker_macros.h
Define macros for attributes used to control the static checker.
TileBchStatus::getString
std::string getString() const
Definition: TileBchStatus.cxx:264
TileBchStatus::isBad
bool isBad() const
Definition: TileBchStatus.h:145