ATLAS Offline Software
RPC_OccupancyHoleFinder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3  */
4 
9 #include <dqm_core/AlgorithmConfig.h>
12 #include <TH1.h>
13 #include <TH2.h>
14 #include <TClass.h>
15 #include <ers/ers.h>
16 
17 #include <iostream>
18 #include <string>
19 #include <string_view>
20 #include <array>
21 #include <initializer_list>
22 #include <tuple>
23 
24 #include <sstream>
25 #include <vector>
26 #include <algorithm>
27 #include <utility>
28 #include <map>
29 #include <cstdlib>
30 
31 #include <dqm_core/AlgorithmManager.h>
32 
33 
34 namespace {
37  bool
38  listContains(const std::initializer_list<int>& a, int i) {
39  return std::any_of(a.begin(), a.end(), [i](int x) {
40  return i == x;
41  });
42  }
43 }
44 
46  : m_name(n) {
47  if (m_name.size()) dqm_core::AlgorithmManager::instance().registerAlgorithm(m_name + "_RPC_OccupancyHoleFinder",
48  this);
49  else dqm_core::AlgorithmManager::instance().registerAlgorithm("RPC_OccupancyHoleFinder", this);
50 }
51 
53 }
54 
57  return new RPC_OccupancyHoleFinder(m_name);
58 }
59 
62  const TObject& object,
63  const dqm_core::AlgorithmConfig& config) {
64  const TH2* histo = dynamic_cast<const TH2*> (&object);
65 
66  if (!histo) {
67  throw dqm_core::BadConfig(ERS_HERE, name, "Input object is not a TH2");
68  }
69 
70  std::vector<std::string> dead_rpc_panel {};
71  std::vector<int> coun_rpc_panel {};
72 
73  const double minstat = dqm_algorithms::tools::GetFirstFromMap("MinStat", config.getParameters(), -1);
74 
75  if (histo->GetEntries() < minstat) {
77  result->tags_["InsufficientEntries"] = histo->GetEntries();
78  return result;
79  }
80 
81  int TotalPanels = (int) dqm_algorithms::tools::GetFirstFromMap("TotalPanels", config.getParameters(), -99999);
82 
83  double gthreshold {};
84  double rthreshold {};
85  double bin_threshold {};
86  try {
87  bin_threshold = dqm_algorithms::tools::GetFirstFromMap("BinThreshold", config.getParameters());
88  rthreshold = dqm_algorithms::tools::GetFromMap("NBins", config.getRedThresholds());
89  gthreshold = dqm_algorithms::tools::GetFromMap("NBins", config.getGreenThresholds());
90  }
91  catch (dqm_core::Exception& ex) {
92  throw dqm_core::BadConfig(ERS_HERE, name, ex.what(), ex);
93  }
94 
95  dead_rpc_panel.clear( );
96  coun_rpc_panel.clear( );
97  using namespace std::string_view_literals; //for sv suffix denoting a string view
98  for (int ibinx = 1; ibinx != histo->GetNbinsX() + 1; ++ibinx) {
99  for (int ibiny = 1; ibiny != histo->GetNbinsY() + 1; ++ibiny) {
100  float content = histo->GetBinContent(ibinx, ibiny);
101  if (content < bin_threshold) {
102  std::string chamber_name {};
103  std::string Title = histo->GetTitle();
104  if (Title.find("HighPt0_BA") != std::string::npos || Title.find("HighPt1_BA") != std::string::npos) {
105  if (listContains({1, 2, 5, 6, 9, 10, 13, 14, 17, 18, 21, 22, 29, 30}, ibiny)) {//14 values
106  constexpr int maxPossible {12};
107  if (ibinx > maxPossible) continue;
108  //note: the 'sv' suffix in namespace std::string_view_literals denotes a string_view
109  constexpr std::array<std::string_view, maxPossible> chamberNames {
110  "BOL1DZ1"sv,
111  "BOL1DZ2"sv,
112  "BOL2DZ1"sv,
113  "BOL2DZ2"sv,
114  "BOL3DZ1"sv,
115  "BOL3DZ2"sv,
116  "BOL4DZ1"sv,
117  "BOL4DZ2"sv,
118  "BOL5DZ1"sv,
119  "BOL5DZ2"sv,
120  "BOL6DZ1"sv,
121  "BOL6DZ2"sv
122  };
123  chamber_name = chamberNames[ibinx - 1];
124  } else if (listContains({3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 31, 32}, ibiny)) {
125  constexpr int maxPossible {12};
126  if (ibinx > maxPossible) continue;
127  constexpr std::array<std::string_view, maxPossible> chamberNames {
128  "BOS1DZ1"sv,
129  "BOS1DZ2"sv,
130  "BOS2DZ1"sv,
131  "BOS2DZ2"sv,
132  "BOS3DZ1"sv,
133  "BOS3DZ2"sv,
134  "BOS4DZ1"sv,
135  "BOS4DZ2"sv,
136  "BOS5DZ1"sv,
137  "BOS5DZ2"sv,
138  "BOS6DZ1"sv,
139  "BOS6DZ2"sv
140  };
141  chamber_name = chamberNames[ibinx - 1];
142  } else if (ibiny == 25 || ibiny == 26) {
143  constexpr int maxPossible {13};
144  constexpr std::array<std::string_view, maxPossible> chamberNames {
145  "BOL1DZ1"sv,
146  "BOL1DZ2"sv,
147  "BOL2DZ1"sv,
148  "BOL2DZ2"sv,
149  "BOL3DZ1"sv,
150  "BOL3DZ2"sv,
151  "BOL4DZ1"sv,
152  "BOL4DZ2"sv,
153  "BOL5DZ1"sv,
154  "BOL5DZ2"sv,
155  "BOL6DZ1"sv,
156  "BOL6DZ2"sv,
157  "BOL8DZ1"sv
158  };
159  //this recreates original logic, but is it correct? Perhaps should 'continue' ?
160  if (ibinx <= maxPossible) chamber_name = chamberNames[ibinx - 1];
161  //
162  } else {
163  constexpr int maxPossible {12};
164  if (ibinx > maxPossible) continue;
165  constexpr std::array<std::string_view, maxPossible> chamberNames {
166  "BOF1DZ1"sv,
167  "BOF1DZ2"sv,
168  "BOF2DZ1"sv,
169  "BOF2DZ2"sv,
170  "BOF3DZ1"sv,
171  "BOF3DZ2"sv,
172  "BOF4DZ1"sv,
173  "BOG0DZ1"sv,
174  "BOG1DZ1"sv,
175  "BOG2DZ1"sv,
176  "BOG3DZ1"sv,
177  "BOG4DZ1"sv
178  };
179  chamber_name = chamberNames[ibinx - 1];
180  }
181  } else if (Title.find("LowPt0_BA") != std::string::npos || Title.find("LowPt1_BA") != std::string::npos) {
182  if (listContains({1, 2, 5, 6, 9, 10}, ibiny)) {
183  constexpr int maxPossible {10};
184  if (ibinx > maxPossible) continue;
185  constexpr std::array<std::string_view, maxPossible> chamberNames {
186  "BML1DZ1"sv,
187  "BML1DZ2"sv,
188  "BML2DZ1"sv,
189  "BML2DZ2"sv,
190  "BML3DZ1"sv,
191  "BML3DZ2"sv,
192  "BML4DZ1"sv,
193  "BML5DZ1"sv,
194  "BML6DZ1"sv,
195  "BML6DZ2"sv
196  };
197  chamber_name = chamberNames[ibinx - 1];
198  } else if (listContains({13, 14, 17, 18, 21, 22, 29, 30}, ibiny)) {
199  constexpr int maxPossible {9};
200  if (ibinx > maxPossible) continue;
201  constexpr std::array<std::string_view, maxPossible> chamberNames {
202  "BML1DZ1"sv,
203  "BML2DZ1"sv,
204  "BML2DZ2"sv,
205  "BML3DZ1"sv,
206  "BML3DZ2"sv,
207  "BML4DZ1"sv,
208  "BML5DZ1"sv,
209  "BML6DZ1"sv,
210  "BML6DZ2"sv
211  };
212  chamber_name = chamberNames[ibinx - 1];
213  } else if (ibiny == 25 || ibiny == 26) {
214  constexpr int maxPossible {10};
215  if (ibinx > maxPossible) continue;
216  constexpr std::array<std::string_view, maxPossible> chamberNames {
217  "BMEDZ1"sv,
218  "BML1DZ1"sv,
219  "BML1DZ2"sv,
220  "BML2DZ1"sv,
221  "BML2DZ2"sv,
222  "BML3DZ1"sv,
223  "BML3DZ2"sv,
224  "BML4DZ1"sv,
225  "BML5DZ1"sv,
226  "BML5DZ2"sv
227  };
228  chamber_name = chamberNames[ibinx - 1];
229  } else if (listContains({3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 31, 32}, ibiny)) {
230  constexpr int maxPossible {12};
231  if (ibinx > maxPossible) continue;
232  constexpr std::array<std::string_view, maxPossible> chamberNames {
233  "BMS1DZ1"sv,
234  "BMS1DZ2"sv,
235  "BMS2DZ1"sv,
236  "BMS2DZ2"sv,
237  "BMH2DZ1"sv,
238  "BMS3DZ1"sv,
239  "BMS3DZ2"sv,
240  "BMS4DZ1"sv,
241  "BMH4DZ1"sv,
242  "BMS5DZ1"sv,
243  "BMS6DZ1"sv,
244  "BMS6DZ2"sv
245  };
246  chamber_name = chamberNames[ibinx - 1];
247  } else {
248  constexpr int maxPossible {5};
249  if (ibinx > maxPossible) continue;
250  constexpr std::array<std::string_view, maxPossible> chamberNames {
251  "BMF1DZ1"sv,
252  "BMF1DZ2"sv,
253  "BMF2DZ1"sv,
254  "BMF2DZ2"sv,
255  "BMF3DZ1"sv
256  };
257  chamber_name = chamberNames[ibinx - 1];
258  }
259  } else if (Title.find("Pivot0_BA") != std::string::npos || Title.find("Pivot1_BA") != std::string::npos ||
260  Title.find("LowPt_BA") != std::string::npos) {
261  if (listContains({1, 2, 5, 6, 9, 10}, ibiny)) {
262  constexpr int maxPossible {11};
263  if (ibinx > maxPossible) continue;
264  constexpr std::array<std::string_view, maxPossible> chamberNames {
265  "BML1DZ1"sv,
266  "BML1DZ2"sv,
267  "BML2DZ1"sv,
268  "BML2DZ2"sv,
269  "BML3DZ1"sv,
270  "BML3DZ2"sv,
271  "BML4DZ1"sv,
272  "BML5DZ1"sv,
273  "BML6DZ1"sv,
274  "BML6DZ2"sv,
275  "BML7DZ1"sv
276  };
277  chamber_name = chamberNames[ibinx - 1];
278  } else if (listContains({13, 14, 17, 18, 21, 22, 29, 30}, ibiny)) {
279  constexpr int maxPossible {10};
280  if (ibinx > maxPossible) continue;
281  constexpr std::array<std::string_view, maxPossible> chamberNames {
282  "BML1DZ1"sv,
283  "BML2DZ1"sv,
284  "BML2DZ2"sv,
285  "BML3DZ1"sv,
286  "BML3DZ2"sv,
287  "BML4DZ1"sv,
288  "BML5DZ1"sv,
289  "BML6DZ1"sv,
290  "BML6DZ2"sv,
291  "BML7DZ1"sv
292  };
293  chamber_name = chamberNames[ibinx - 1];
294  } else if (ibiny == 25 || ibiny == 26) {
295  constexpr int maxPossible {11};
296  if (ibinx > maxPossible) continue;
297  constexpr std::array<std::string_view, maxPossible> chamberNames {
298  "BMEDZ1"sv,
299  "BML1DZ1"sv,
300  "BML1DZ2"sv,
301  "BML2DZ1"sv,
302  "BML2DZ2"sv,
303  "BML3DZ1"sv,
304  "BML3DZ2"sv,
305  "BML4DZ1"sv,
306  "BML5DZ1"sv,
307  "BML5DZ2"sv,
308  "BML6DZ1"sv
309  };
310  chamber_name = chamberNames[ibinx - 1];
311  } else if (listContains({3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 31, 32}, ibiny)) {
312  constexpr int maxPossible {13};
313  if (ibinx > maxPossible) continue;
314  constexpr std::array<std::string_view, maxPossible> chamberNames {
315  "BMS1DZ1"sv,
316  "BMS1DZ2"sv,
317  "BMS2DZ1"sv,
318  "BMS2DZ2"sv,
319  "BMH2DZ1"sv,
320  "BMS3DZ1"sv,
321  "BMS3DZ2"sv,
322  "BMS4DZ1"sv,
323  "BMS4DZ2"sv,
324  "BMH4DZ1"sv,
325  "BMS5DZ1"sv,
326  "BMS6DZ1"sv,
327  "BMS6DZ2"sv
328  };
329  chamber_name = chamberNames[ibinx - 1];
330  } else {
331  constexpr int maxPossible {13};
332  if (ibinx > maxPossible) continue;
333  constexpr std::array<std::string_view, maxPossible> chamberNames {
334  "BMF1DZ1"sv,
335  "BMF1DZ2"sv,
336  "BMF2DZ1"sv,
337  "BMF2DZ2"sv,
338  "BMF3DZ1"sv,
339  "BMF3DZ2"sv,
340  "BOF2DZ1"sv,
341  "BOF2DZ2"sv,
342  "BOF3DZ1"sv,
343  "BOF3DZ2"sv,
344  "BOF4DZ1"sv,
345  "BOG3DZ1"sv,
346  "BOG4DZ1"sv
347  };
348  chamber_name = chamberNames[ibinx - 1];
349  }
350  } else if (Title.find("HighPt_BA") != std::string::npos) {
351  if (listContains({1, 2, 5, 6, 9, 10}, ibiny)) {
352  constexpr int maxPossible {11};
353  if (ibinx > maxPossible) continue;
354  constexpr std::array<std::string_view, maxPossible> chamberNames {
355  "BML1DZ1"sv,
356  "BML1DZ2"sv,
357  "BML2DZ1"sv,
358  "BML2DZ2"sv,
359  "BML3DZ1"sv,
360  "BML3DZ2"sv,
361  "BML4DZ1"sv,
362  "BML5DZ1"sv,
363  "BML6DZ1"sv,
364  "BML6DZ2"sv,
365  "BML7DZ1"sv
366  };
367  chamber_name = chamberNames[ibinx - 1];
368  } else if (listContains({13, 14, 17, 18, 21, 22, 29, 30}, ibiny)) {
369  constexpr int maxPossible {10};
370  if (ibinx > maxPossible) continue;
371  constexpr std::array<std::string_view, maxPossible> chamberNames {
372  "BML1DZ1"sv,
373  "BML2DZ1"sv,
374  "BML2DZ2"sv,
375  "BML3DZ1"sv,
376  "BML3DZ2"sv,
377  "BML4DZ1"sv,
378  "BML5DZ1"sv,
379  "BML6DZ1"sv,
380  "BML6DZ2"sv,
381  "BML7DZ1"sv
382  };
383  chamber_name = chamberNames[ibinx - 1];
384  } else if (ibiny == 25 || ibiny == 26) {
385  constexpr int maxPossible {11};
386  if (ibinx > maxPossible) continue;
387  constexpr std::array<std::string_view, maxPossible> chamberNames {
388  "BMEDZ1"sv,
389  "BML1DZ1"sv,
390  "BML1DZ2"sv,
391  "BML2DZ1"sv,
392  "BML2DZ2"sv,
393  "BML3DZ1"sv,
394  "BML3DZ2"sv,
395  "BML4DZ1"sv,
396  "BML5DZ1"sv,
397  "BML5DZ2"sv,
398  "BML6DZ1"sv
399  };
400  chamber_name = chamberNames[ibinx - 1];
401  } else if (listContains({3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 31, 32}, ibiny)) {
402  constexpr int maxPossible {13};
403  if (ibinx > maxPossible) continue;
404  constexpr std::array<std::string_view, maxPossible> chamberNames {
405  "BMS1DZ1"sv,
406  "BMS1DZ2"sv,
407  "BMS2DZ1"sv,
408  "BMS2DZ2"sv,
409  "BMH2DZ1"sv,
410  "BMS3DZ1"sv,
411  "BMS3DZ2"sv,
412  "BMS4DZ1"sv,
413  "BMS4DZ2"sv,
414  "BMH4DZ1"sv,
415  "BMS5DZ1"sv,
416  "BMS6DZ1"sv,
417  "BMS6DZ2"sv
418  };
419  chamber_name = chamberNames[ibinx - 1];
420  } else {
421  constexpr int maxPossible {6};
422  if (ibinx > maxPossible) continue;
423  constexpr std::array<std::string_view, maxPossible> chamberNames {
424  "BMF1DZ1"sv,
425  "BMF1DZ2"sv,
426  "BMF2DZ1"sv,
427  "BMF2DZ2"sv,
428  "BMF3DZ1"sv,
429  "BMF3DZ2"sv
430  };
431  chamber_name = chamberNames[ibinx - 1];
432  }
433  } else if (Title.find("HighPt0_BC") != std::string::npos || Title.find("HighPt1_BC") != std::string::npos) {
434  if (listContains({1, 2, 5, 6, 9, 10, 13, 14, 17, 18, 21, 22, 29, 30}, ibiny)) {
435  constexpr int maxPossible {12};
436  if (ibinx > maxPossible) continue;
437  constexpr std::array<std::string_view, maxPossible> chamberNames {
438  "BOL1DZ1"sv,
439  "BOL1DZ2"sv,
440  "BOL2DZ1"sv,
441  "BOL2DZ2"sv,
442  "BOL3DZ1"sv,
443  "BOL3DZ2"sv,
444  "BOL4DZ1"sv,
445  "BOL4DZ2"sv,
446  "BOL5DZ1"sv,
447  "BOL5DZ2"sv,
448  "BOL6DZ1"sv,
449  "BOL6DZ2"sv
450  };
451  chamber_name = chamberNames[ibinx - 1];
452  } else if (listContains({3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 31, 32}, ibiny)) {
453  constexpr int maxPossible {12};
454  if (ibinx > maxPossible) continue;
455  constexpr std::array<std::string_view, maxPossible> chamberNames {
456  "BOS1DZ1"sv,
457  "BOS1DZ2"sv,
458  "BOS2DZ1"sv,
459  "BOS2DZ2"sv,
460  "BOS3DZ1"sv,
461  "BOS3DZ2"sv,
462  "BOS4DZ1"sv,
463  "BOS4DZ2"sv,
464  "BOS5DZ1"sv,
465  "BOS5DZ2"sv,
466  "BOS6DZ1"sv,
467  "BOS6DZ2"sv
468  };
469  chamber_name = chamberNames[ibinx - 1];
470  } else if (ibiny == 25 || ibiny == 26) {
471  constexpr int maxPossible {13};
472  constexpr std::array<std::string_view, maxPossible> chamberNames {
473  "BOL1DZ1"sv,
474  "BOL1DZ2"sv,
475  "BOL2DZ1"sv,
476  "BOL2DZ2"sv,
477  "BOL3DZ1"sv,
478  "BOL3DZ2"sv,
479  "BOL4DZ1"sv,
480  "BOL4DZ2"sv,
481  "BOL5DZ1"sv,
482  "BOL5DZ2"sv,
483  "BOL6DZ1"sv,
484  "BOL6DZ2"sv,
485  "BOL8DZ1"sv
486  };
487  //recreates original logic, but perhaps should 'continue'?
488  chamber_name = (ibinx > maxPossible) ? "" : chamberNames[ibinx - 1];
489  } else {
490  constexpr int maxPossible {11};
491  if (ibinx > maxPossible) continue;
492  constexpr std::array<std::string_view, maxPossible> chamberNames {
493  "BOF1DZ1"sv,
494  "BOF1DZ2"sv,
495  "BOF2DZ1"sv,
496  "BOF2DZ2"sv,
497  "BOF3DZ1"sv,
498  "BOF3DZ2"sv,
499  "BOF4DZ1"sv,
500  "BOG1DZ1"sv,
501  "BOG2DZ1"sv,
502  "BOG3DZ1"sv,
503  "BOG4DZ1"sv
504  };
505  chamber_name = chamberNames[ibinx - 1];
506  }
507  } else if (Title.find("LowPt0_BC") != std::string::npos || Title.find("LowPt1_BC") != std::string::npos) {
508  if (ibiny == 5 || ibiny == 6 || ibiny == 9 || ibiny == 10) {
509  constexpr int maxPossible {10};
510  if (ibinx > maxPossible) continue;
511  constexpr std::array<std::string_view, maxPossible> chamberNames {
512  "BML1DZ1"sv,
513  "BML1DZ2"sv,
514  "BML2DZ1"sv,
515  "BML2DZ2"sv,
516  "BML3DZ1"sv,
517  "BML3DZ2"sv,
518  "BML4DZ1"sv,
519  "BML5DZ1"sv,
520  "BML6DZ1"sv,
521  "BML6DZ2"sv
522  };
523  chamber_name = chamberNames[ibinx - 1];
524  } else if (listContains({1, 2, 13, 14, 17, 18, 21, 22, 29, 30}, ibiny)) {
525  constexpr int maxPossible {9};
526  if (ibinx > maxPossible) continue;
527  constexpr std::array<std::string_view, maxPossible> chamberNames {
528  "BML1DZ1"sv,
529  "BML2DZ1"sv,
530  "BML2DZ2"sv,
531  "BML3DZ1"sv,
532  "BML3DZ2"sv,
533  "BML4DZ1"sv,
534  "BML5DZ1"sv,
535  "BML6DZ1"sv,
536  "BML6DZ2"sv
537  };
538  chamber_name = chamberNames[ibinx - 1];
539  } else if (ibiny == 25 || ibiny == 26) {
540  constexpr int maxPossible {10};
541  if (ibinx > maxPossible) continue;
542  constexpr std::array<std::string_view, maxPossible> chamberNames {
543  "BMEDZ1"sv,
544  "BML1DZ1"sv,
545  "BML1DZ2"sv,
546  "BML2DZ1"sv,
547  "BML2DZ2"sv,
548  "BML3DZ1"sv,
549  "BML3DZ2"sv,
550  "BML4DZ1"sv,
551  "BML5DZ1"sv,
552  "BML5DZ2"sv
553  };
554  chamber_name = chamberNames[ibinx - 1];
555  } else if (listContains({3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 31, 32}, ibiny)) {
556  constexpr int maxPossible {12};
557  if (ibinx > maxPossible) continue;
558  constexpr std::array<std::string_view, maxPossible> chamberNames {
559  "BMS1DZ1"sv,
560  "BMS1DZ2"sv,
561  "BMS2DZ1"sv,
562  "BMS2DZ2"sv,
563  "BMH2DZ1"sv,
564  "BMS3DZ1"sv,
565  "BMS3DZ2"sv,
566  "BMS4DZ1"sv,
567  "BMH4DZ1"sv,
568  "BMS5DZ1"sv,
569  "BMS6DZ1"sv,
570  "BMS6DZ2"sv
571  };
572  chamber_name = chamberNames[ibinx - 1];
573  } else {
574  constexpr int maxPossible {5};
575  if (ibinx > maxPossible) continue;
576  constexpr std::array<std::string_view, maxPossible> chamberNames {
577  "BMF1DZ1"sv,
578  "BMF1DZ2"sv,
579  "BMF2DZ1"sv,
580  "BMF2DZ2"sv,
581  "BMF3DZ1"sv
582  };
583  chamber_name = chamberNames[ibinx - 1];
584  }
585  } else if (Title.find("Pivot0_BC") != std::string::npos || Title.find("Pivot1_BC") != std::string::npos ||
586  Title.find("LowPt_BC") != std::string::npos) {
587  if (ibiny == 5 || ibiny == 6 || ibiny == 9 || ibiny == 10) {
588  constexpr int maxPossible {11};
589  if (ibinx > maxPossible) continue;
590  constexpr std::array<std::string_view, maxPossible> chamberNames {
591  "BML1DZ1"sv,
592  "BML1DZ2"sv,
593  "BML2DZ1"sv,
594  "BML2DZ2"sv,
595  "BML3DZ1"sv,
596  "BML3DZ2"sv,
597  "BML4DZ1"sv,
598  "BML5DZ1"sv,
599  "BML6DZ1"sv,
600  "BML6DZ2"sv,
601  "BML7DZ1"sv
602  };
603  chamber_name = chamberNames[ibinx - 1];
604  } else if (listContains({1, 2, 13, 14, 17, 18, 21, 22, 29, 30}, ibiny)) {
605  constexpr int maxPossible {10};
606  if (ibinx > maxPossible) continue;
607  constexpr std::array<std::string_view, maxPossible> chamberNames {
608  "BML1DZ1"sv,
609  "BML2DZ1"sv,
610  "BML2DZ2"sv,
611  "BML3DZ1"sv,
612  "BML3DZ2"sv,
613  "BML4DZ1"sv,
614  "BML5DZ1"sv,
615  "BML6DZ1"sv,
616  "BML6DZ2"sv,
617  "BML7DZ1"sv
618  };
619  chamber_name = chamberNames[ibinx - 1];
620  } else if (ibiny == 25 || ibiny == 26) {
621  constexpr int maxPossible {11};
622  if (ibinx > maxPossible) continue;
623  constexpr std::array<std::string_view, maxPossible> chamberNames {
624  "BMEDZ1"sv,
625  "BML1DZ1"sv,
626  "BML1DZ2"sv,
627  "BML2DZ1"sv,
628  "BML2DZ2"sv,
629  "BML3DZ1"sv,
630  "BML3DZ2"sv,
631  "BML4DZ1"sv,
632  "BML5DZ1"sv,
633  "BML5DZ2"sv,
634  "BML6DZ1"sv
635  };
636  chamber_name = chamberNames[ibinx - 1];
637  } else if (listContains({3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 31, 32}, ibiny)) {
638  constexpr int maxPossible {13};
639  if (ibinx > maxPossible) continue;
640  constexpr std::array<std::string_view, maxPossible> chamberNames {
641  "BMS1DZ1"sv,
642  "BMS1DZ2"sv,
643  "BMS2DZ1"sv,
644  "BMS2DZ2"sv,
645  "BMH2DZ1"sv,
646  "BMS3DZ1"sv,
647  "BMS3DZ2"sv,
648  "BMS4DZ1"sv,
649  "BMS4DZ2"sv,
650  "BMH4DZ1"sv,
651  "BMS5DZ1"sv,
652  "BMS6DZ1"sv,
653  "BMS6DZ2"sv
654  };
655  chamber_name = chamberNames[ibinx - 1];
656  } else {
657  constexpr int maxPossible {13};
658  if (ibinx > maxPossible) continue;
659  constexpr std::array<std::string_view, maxPossible> chamberNames {
660  "BMF1DZ1"sv,
661  "BMF1DZ2"sv,
662  "BMF2DZ1"sv,
663  "BMF2DZ2"sv,
664  "BMF3DZ1"sv,
665  "BMF3DZ2"sv,
666  "BOF2DZ1"sv,
667  "BOF2DZ2"sv,
668  "BOF3DZ1"sv,
669  "BOF3DZ2"sv,
670  "BOF4DZ1"sv,
671  "BOG3DZ1"sv,
672  "BOG4DZ1"sv
673  };
674  chamber_name = chamberNames[ibinx - 1];
675  }
676  } else if (Title.find("HighPt_BC") != std::string::npos) {
677  if (ibiny == 5 || ibiny == 6 || ibiny == 9 || ibiny == 10) {
678  constexpr int maxPossible {11};
679  if (ibinx > maxPossible) continue;
680  constexpr std::array<std::string_view, maxPossible> chamberNames {
681  "BML1DZ1"sv,
682  "BML1DZ2"sv,
683  "BML2DZ1"sv,
684  "BML2DZ2"sv,
685  "BML3DZ1"sv,
686  "BML3DZ2"sv,
687  "BML4DZ1"sv,
688  "BML5DZ1"sv,
689  "BML6DZ1"sv,
690  "BML6DZ2"sv,
691  "BML7DZ1"sv
692  };
693  chamber_name = chamberNames[ibinx - 1];
694  } else if (listContains({1, 2, 13, 14, 17, 18, 21, 22, 29, 30}, ibiny)) {
695  constexpr int maxPossible {10};
696  if (ibinx > maxPossible) continue;
697  constexpr std::array<std::string_view, maxPossible> chamberNames {
698  "BML1DZ1"sv,
699  "BML2DZ1"sv,
700  "BML2DZ2"sv,
701  "BML3DZ1"sv,
702  "BML3DZ2"sv,
703  "BML4DZ1"sv,
704  "BML5DZ1"sv,
705  "BML6DZ1"sv,
706  "BML6DZ2"sv,
707  "BML7DZ1"sv
708  };
709  chamber_name = chamberNames[ibinx - 1];
710  } else if (ibiny == 25 || ibiny == 26) {
711  constexpr int maxPossible {11};
712  if (ibinx > maxPossible) continue;
713  constexpr std::array<std::string_view, maxPossible> chamberNames {
714  "BMEDZ1"sv,
715  "BML1DZ1"sv,
716  "BML1DZ2"sv,
717  "BML2DZ1"sv,
718  "BML2DZ2"sv,
719  "BML3DZ1"sv,
720  "BML3DZ2"sv,
721  "BML4DZ1"sv,
722  "BML5DZ1"sv,
723  "BML5DZ2"sv,
724  "BML6DZ1"sv
725  };
726  chamber_name = chamberNames[ibinx - 1];
727  } else if (listContains({3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 31, 32}, ibiny)) {
728  constexpr int maxPossible {13};
729  if (ibinx > maxPossible) continue;
730  constexpr std::array<std::string_view, maxPossible> chamberNames {
731  "BMS1DZ1"sv,
732  "BMS1DZ2"sv,
733  "BMS2DZ1"sv,
734  "BMS2DZ2"sv,
735  "BMH2DZ1"sv,
736  "BMS3DZ1"sv,
737  "BMS3DZ2"sv,
738  "BMS4DZ1"sv,
739  "BMS4DZ2"sv,
740  "BMH4DZ1"sv,
741  "BMS5DZ1"sv,
742  "BMS6DZ1"sv,
743  "BMS6DZ2"sv
744  };
745  chamber_name = chamberNames[ibinx - 1];
746  } else {
747  constexpr int maxPossible {6};
748  if (ibinx > maxPossible) continue;
749  constexpr std::array<std::string_view, maxPossible> chamberNames {
750  "BMF1DZ1"sv,
751  "BMF1DZ2"sv,
752  "BMF2DZ1"sv,
753  "BMF2DZ2"sv,
754  "BMF3DZ1"sv,
755  "BMF3DZ2"sv
756  };
757  chamber_name = chamberNames[ibinx - 1];
758  }
759  }
760  //FORTMAT BMS4A10.Piv.Dp0.Ly0.Dz2.eta
761 
762  std::string sector_name = getChamberName(histo, ibiny);
763  std::string chamber {};
764  std::string sector {};
765  std::string secnum {};
766  std::string layer {};
767  std::string dphi {};
768  std::string gap {};
769  std::string dzeta {};
770  std::string view {};
771  std::string dot = ".";
772  if (Title.find("Eta") != std::string::npos) view = "eta";
773  if (Title.find("Phi") != std::string::npos) view = "phi";
774  secnum = sector_name.substr(1, 2);
775  if (sector_name.find("HV") != std::string::npos) {
776  dphi = "DP1";
777  if (secnum == "02" || secnum == "04" || secnum == "06" || secnum == "08" || secnum == "10" ||
778  secnum == "12" || secnum == "14" || secnum == "16") dphi = "DP2";
779  } else if (sector_name.find("RO") != std::string::npos) {
780  dphi = "DP2";
781  if (secnum == "02" || secnum == "04" || secnum == "06" || secnum == "08" || secnum == "10" ||
782  secnum == "12" || secnum == "14" || secnum == "16") dphi = "DP1";
783  }
784 
785  if (Title.find("HighPt0") != std::string::npos) {
786  layer = ".CO.";
787  gap = ".Ly0.";
788  }
789  if (Title.find("HighPt1") != std::string::npos) {
790  layer = ".CO.";
791  gap = ".Ly1.";
792  }
793  if (Title.find("LowPt0") != std::string::npos) {
794  layer = ".CO.";
795  gap = ".Ly0.";
796  }
797  if (Title.find("LowPt1") != std::string::npos) {
798  layer = ".CO.";
799  gap = ".Ly1.";
800  }
801  if (Title.find("Pivot0") != std::string::npos) {
802  layer = ".PI.";
803  gap = ".Ly0.";
804  }
805  if (Title.find("Pivot1") != std::string::npos) {
806  layer = ".PI.";
807  gap = ".Ly1.";
808  }
809  if (Title.find("LowPt_") != std::string::npos) {
810  layer = ".";
811  gap = ".";
812  }
813  if (Title.find("HighPt_") != std::string::npos) {
814  layer = ".";
815  gap = ".";
816  }
817  sector = sector_name.substr(0, 3);
818  dzeta = chamber_name;
819  dzeta.erase(0, 4);
820  chamber = chamber_name.substr(0, 4);
821  std::string panel_name = chamber + sector + layer + dphi + gap + dzeta + dot + view;
822  dead_rpc_panel.push_back(panel_name);
823  coun_rpc_panel.push_back(content);
824  }
825  }//ybins
826  }//xbins
827 
828  //Analyze chambers that died during run
830  std::map<std::string, double> tags;
831 
832  //ensure that we do not write too much info to the webpage
833  int writes = 0;
834 
835  for (std::vector<std::string>::const_iterator itr = dead_rpc_panel.begin(); itr != dead_rpc_panel.end(); ++itr) {
836  tags[TString::Format("%s", (*itr).c_str()).Data()] = coun_rpc_panel.at(writes);
837  writes++;
838  if (writes > 100) break;
839  }
840 
841  int count = TotalPanels - dead_rpc_panel.size();
842 
843  tags[TString::Format("Alive panels").Data()] = 100. * count / TotalPanels;
844  tags[TString::Format("# Alive panels").Data()] = count;
845  tags[TString::Format("# Dead panels").Data()] = writes;
846 
847 
848  if (count >= gthreshold) {
849  result->status_ = dqm_core::Result::Green;
850  } else if (count > rthreshold) {
851  result->status_ = dqm_core::Result::Yellow;
852  } else {
853  result->status_ = dqm_core::Result::Red;
854  }
855 
856  result->tags_ = tags;
857  return result;
858 }
859 
860 void
862 // out<<"RPC_OccupancyHoleFinder: Checks number of bins N sigma away from reference histogram bin value or given
863 // Value\n"<<std::endl;
864 // out<<"Simply Dump the Bin Number/Name of Bin with bin contents as result" << std::endl;
865 }
866 
867 std::string
869  if (std::string(histo->GetYaxis()->GetBinLabel(biny)).size()) {
870  std::string label = histo->GetYaxis()->GetBinLabel(biny);
871  label.erase(6, 4);
872  label.erase(3, 1);
873  return label;
874  }
875  std::stringstream ss;
876  ss << biny;
877  return ss.str();
878 }
RPC_OccupancyHoleFinder.h
MCP::SystVariation::Default
@ Default
Definition: EnumDef.h:72
Undefined
@ Undefined
Definition: MaterialTypes.h:8
get_generator_info.result
result
Definition: get_generator_info.py:21
dqm_algorithms::RPC_OccupancyHoleFinder::getChamberName
std::string getChamberName(const TH2 *histo, int biny)
Definition: RPC_OccupancyHoleFinder.cxx:868
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
calibdata.chamber
chamber
Definition: calibdata.py:32
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
dqm_algorithms::RPC_OccupancyHoleFinder::execute
dqm_core::Result * execute(const std::string &, const TObject &, const dqm_core::AlgorithmConfig &)
Definition: RPC_OccupancyHoleFinder.cxx:61
StateLessPT_NewConfig.Format
Format
Definition: StateLessPT_NewConfig.py:146
x
#define x
CaloSwCorrections.gap
def gap(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:212
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
createDCubeDigitHistograms_withSel.chamber_name
chamber_name
Definition: createDCubeDigitHistograms_withSel.py:109
dqm_algorithms::RPC_OccupancyHoleFinder::m_name
std::string m_name
Definition: RPC_OccupancyHoleFinder.h:31
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
grepfile.content
string content
Definition: grepfile.py:56
dqm_algorithms::RPC_OccupancyHoleFinder::RPC_OccupancyHoleFinder
RPC_OccupancyHoleFinder(const std::string &name)
Definition: RPC_OccupancyHoleFinder.cxx:45
tags
std::vector< std::string > tags
Definition: hcg.cxx:102
lumiFormat.i
int i
Definition: lumiFormat.py:92
beamspotman.n
n
Definition: beamspotman.py:731
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
dqm_algorithms::RPC_OccupancyHoleFinder
Definition: RPC_OccupancyHoleFinder.h:18
python.handimod.Green
int Green
Definition: handimod.py:524
TH2
Definition: rootspy.cxx:373
python.handimod.Red
Red
Definition: handimod.py:551
checkFileSG.writes
writes
Definition: checkFileSG.py:127
RPC
@ RPC
Definition: RegSelEnums.h:32
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
a
TList * a
Definition: liststreamerinfos.cxx:10
covarianceTool.Title
Title
Definition: covarianceTool.py:540
LArCellConditions.sv
bool sv
Definition: LArCellConditions.py:45
AlgorithmHelper.h
dqm_algorithms::tools::GetFromMap
const T & GetFromMap(const std::string &pname, const std::map< std::string, T > &params)
Definition: AlgorithmHelper.h:114
dqm_algorithms::RPC_OccupancyHoleFinder::~RPC_OccupancyHoleFinder
~RPC_OccupancyHoleFinder()
Definition: RPC_OccupancyHoleFinder.cxx:52
pickleTool.object
object
Definition: pickleTool.py:30
dot
Definition: dot.py:1
plotBeamSpotCompare.histo
histo
Definition: plotBeamSpotCompare.py:415
dqm_algorithms::tools::GetFirstFromMap
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
Definition: AlgorithmHelper.cxx:339
dqm_algorithms::RPC_OccupancyHoleFinder::printDescription
void printDescription(std::ostream &out)
Definition: RPC_OccupancyHoleFinder.cxx:861
dqm_algorithms::RPC_OccupancyHoleFinder::clone
RPC_OccupancyHoleFinder * clone()
Definition: RPC_OccupancyHoleFinder.cxx:56
drawFromPickle.view
view
Definition: drawFromPickle.py:294