ATLAS Offline Software
OccupancyHoleFinder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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 <sstream>
20 #include <vector>
21 #include <algorithm>
22 #include <utility>
23 #include <map>
24 #include <cstdlib>
25 
26 #include <dqm_core/AlgorithmManager.h>
27 
28 
29 namespace {
32 }
33 
35  : m_name(n)
36 {
37 
38  if(m_name.size()) dqm_core::AlgorithmManager::instance().registerAlgorithm( m_name+"_OccupancyHoleFinder", this );
39  else dqm_core::AlgorithmManager::instance().registerAlgorithm( "OccupancyHoleFinder", this );
40 }
41 
43 {
44 }
45 
48 {
49  return new OccupancyHoleFinder(m_name);
50 }
51 
52 
55  const TObject & object,
56  const dqm_core::AlgorithmConfig & config )
57 {
58 
59  const TH2* histo = dynamic_cast<const TH2*> (&object);
60  if (!histo) {
61  throw dqm_core::BadConfig(ERS_HERE, name, "Input object is not a TH2");
62  }
63  TH1* histo_medians = getMedian(histo);
64  int active_lbns = 0;
65  //map of chamber bin number by number of lbns that it is dead
66  //more precisely the key is a y-axis bin number, while
67  //the value is a list of lbns in which the chamber was dead
68  std::map<int, std::vector<int> > dead_chambers_map;
69  //map of lbn by number of dead chambers
70  std::map<int, int> lbn_occupancy;
71 
72  double median_threshold;
73  double min_median;
74  //double gthreshold; // currently unused
75  double rthreshold;
76  try {
77  median_threshold = dqm_algorithms::tools::GetFirstFromMap( "MedianThreshold", config.getParameters() );
78  min_median = dqm_algorithms::tools::GetFirstFromMap( "MinMedian", config.getParameters() );
79  rthreshold = dqm_algorithms::tools::GetFromMap( "NBins", config.getRedThresholds() );
80  //gthreshold = dqm_algorithms::tools::GetFromMap( "NBins", config.getGreenThresholds() );
81  }
82  catch ( dqm_core::Exception & ex ) {
83  throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
84  }
85  //if percentage_alive > suppress_thresh, don't print to display
86  double suppress_thresh=0;
87  //this should be a bool, if true, then don't print info on web-display
88  double suppress_chamber=0;
89  try{
90  suppress_thresh = dqm_algorithms::tools::GetFirstFromMap( "SuppressThresh", config.getParameters() );
91  suppress_chamber = dqm_algorithms::tools::GetFirstFromMap( "SuppressChamber", config.getParameters() );
92  }
93  catch ( dqm_core::Exception & ex ) {
94  suppress_thresh=0;
95  suppress_chamber=0;
96  }
97 
98  for(int ibinx = 1; ibinx != histo->GetNbinsX()+1; ++ibinx){
99  float median = histo_medians->GetBinContent(ibinx);
100  //ignore strips where there are very few statistics
101  //can configure 'min_median'
102  if(median < min_median) {
103  lbn_occupancy[ibinx] = histo->GetNbinsY();
104  active_lbns++;
105  continue;
106  }
107  active_lbns++;
108  int ndead_chambers = 0;
109  for(int ibiny = 1; ibiny != histo->GetNbinsY()+1; ++ibiny){
110  float content = histo->GetBinContent(ibinx, ibiny);
111  //median_threshold is the percentage of the median strip
112  //content that an individual bin should satisfy
113  if(content < median*median_threshold) {
114  ndead_chambers++;
115  std::map<int, std::vector<int> >::iterator itr = dead_chambers_map.find(ibiny);
116  if(itr == dead_chambers_map.end()) {
117  std::vector<int> lbns;
118  lbns.push_back(ibinx);
119  dead_chambers_map.insert( std::make_pair(ibiny, lbns) );
120  }
121  else (*itr).second.push_back( ibinx );
122  }
123  lbn_occupancy[ibinx] = ndead_chambers;
124  }//ybins
125  }//xbins
126 
127  //Analyze chambers that died during run
129  std::map<std::string,double> tags;
130  //ensure that we do not write too much info to the webpage
131  int writes = 0;
132  if(suppress_chamber==false){
133  for(std::map<int, std::vector<int> >::const_iterator itr = dead_chambers_map.begin(); itr != dead_chambers_map.end(); ++itr){
134  const std::vector<int> &lbns = (*itr).second;
135  std::string chamber_name = getChamberName(histo, (*itr).first);
136  if(writes>100) break;
137  if( (int) lbns.size() == active_lbns ){
138  // out << "Completely dead chamber " << chamber_name << std::endl;
139  tags[TString::Format("Dead %s", chamber_name.c_str()).Data()] = -1;
140  writes++;
141  }
142  else {
143  writes++;
144  tags[TString::Format("N_lbns %s Dead", chamber_name.c_str()).Data()] = (*itr).second.size()*histo->GetXaxis()->GetBinWidth(1);
145  std::stringstream ss;
146  int start = -1;
147  int last_binx = start;
148  for(unsigned int ii = 0; ii != lbns.size(); ++ii){
149  int ibinx = lbns[ii];
150  if(start == -1) {
151  start = lbns[ii];
152  last_binx = start;
153  ss << histo->GetXaxis()->GetBinLowEdge(ibinx) << " - ";
154  continue;
155  }
156  if(ibinx > last_binx+1){
157  ss << histo->GetXaxis()->GetBinLowEdge(last_binx)+histo->GetXaxis()->GetBinWidth(last_binx) << ", ";
158  ss << histo->GetXaxis()->GetBinLowEdge(ibinx) << " - ";
159  start = ibinx;
160  last_binx = start;
161  continue;
162  }
163  if(ii+1 == lbns.size()){
164  //last element
165  ss << histo->GetXaxis()->GetBinLowEdge(ibinx)+histo->GetXaxis()->GetBinWidth(ibinx) << ", ";
166  }
167  last_binx = ibinx;
168  }
169  //out << "Chamber " << chamber_name << " : " << ss.str() << std::endl;
170  }//else
171  }
172  }//suppress_chamber
173 
174  int dead_lbns = 0;//number of strips where occupancy < 90% (configurable)
175  int start_bin_id = -1;
176  //int last_bin_id = start_bin_id; // currently unused (because last_lbn is currently unused)
177  int last_ndead = 0;
178  int counter = 0;//current entry in lbn_occupancy
179  for(std::map<int, int>::const_iterator itr = lbn_occupancy.begin(); itr != lbn_occupancy.end(); ++itr, ++counter){
180  int bin_id = (*itr).first;
181  int current_lbn = histo->GetXaxis()->GetBinLowEdge(bin_id);
182  int start_lbn = 0;
183  if(start_bin_id > -1) start_lbn = histo->GetXaxis()->GetBinLowEdge(start_bin_id);
184  else start_lbn = 1;
185  //int last_lbn = 0; // currently unused
186  //if(last_bin_id > -1) last_lbn = histo->GetXaxis()->GetBinLowEdge(last_bin_id);
187  //else last_bin_id = 1;
188  int lbn_width = histo->GetXaxis()->GetBinWidth(bin_id);
189 
190  float percentage_alive = 100*(1-(*itr).second*1./histo->GetNbinsY());
191  float last_percentage_alive = 100*(1-last_ndead*1./histo->GetNbinsY());
192  //bool good_lbn(true); // currently unused
193  //A value of dead_lbns>0 causes a red flag.
194  if(percentage_alive < rthreshold){
195  if((*itr).second != histo->GetNbinsY()) dead_lbns++; //do not flag red when entire strip is empty--likely this is not a problem
196  //good_lbn = false;
197  //tags[TString::Format("%i-%i", current_lbn, current_lbn+bin_width).Data()] = percentage_alive;
198  }
199 
200  //Attempt to write out in format:
201  //lbn_i-lbn_j XX% live
202  if(start_bin_id == -1) {
203  start_bin_id = bin_id;
204  //last_bin_id = start_bin_id;
205  last_ndead = (*itr).second;
206  continue;
207  }
208 
209  if(last_ndead != (*itr).second || counter+1 == (int) lbn_occupancy.size()){
210  if(writes<100){
211  if(counter+1 == (int) lbn_occupancy.size() && percentage_alive < suppress_thresh) {
212  //This should happen on the last strip
213  tags[TString::Format("%i-%i", start_lbn, current_lbn+lbn_width).Data()] = percentage_alive;
214  }
215  else if(last_percentage_alive < suppress_thresh) {
216  //This happens when the current number of dead bins differs from the last number of dead bins
217  //Thus we write out the previous percentage at this point
218  tags[TString::Format("%i-%i", start_lbn, current_lbn-1).Data()] = last_percentage_alive;
219  }
220  start_bin_id = bin_id;
221  //last_bin_id = bin_id;
222  last_ndead = (*itr).second;
223  writes++;
224  }
225  }
226  //last_bin_id = bin_id;
227  }
228  if(dead_lbns) {
229  result->status_ = dqm_core::Result::Red;
230  }
231  else result->status_ = dqm_core::Result::Green;
232 
233  result->tags_ = tags;
234  return result;
235 
236 }
237 
238 void
240 {
241 
242 // out<<"OccupancyHoleFinder: Checks number of bins N sigma away from reference histogram bin value or given Value\n"<<std::endl;
243 // out<<"Simply Dump the Bin Number/Name of Bin with bin contents as result" << std::endl;
244 }
245 
246 //return histogram with median in each vertical strip
247 TH1*
249 {
250  TH1F* h = new TH1F( TString::Format("%s_median", histo->GetName()),"", histo->GetNbinsX(), histo->GetXaxis()->GetXmin(), histo->GetXaxis()->GetXmax() );
251 
252  for(int ibinx = 1; ibinx != histo->GetNbinsX()+1; ++ibinx){
253  std::vector<float> y_bin_vals;
254  for(int ibiny = 1; ibiny != histo->GetNbinsY()+1; ++ibiny){
255  y_bin_vals.push_back(histo->GetBinContent(ibinx, ibiny));
256  //out << "THIS CHAMBER :" << ibiny << ": " << getChamberName(histo, ibiny) << std::endl;
257  }
258  std::sort( y_bin_vals.begin(), y_bin_vals.end());
259  int size = y_bin_vals.size();
260  if(size == 0) {
261  h->SetBinContent(ibinx, 0);
262  continue;
263  }
264  float median = (size%2 == 0 ? (y_bin_vals[size/2-1]+y_bin_vals[size/2])/2 : y_bin_vals[size/2]);
265  h->SetBinContent(ibinx, median);
266  }
267  return h;
268 }
269 
270 std::string
272  char char16 = histo->GetName()[16];
273  std:: string hname=histo->GetName();
274  std::size_t found = hname.find("ontrack");
275  std::string crate;
276  if (found!=std::string::npos){
277  char16 = histo->GetName()[24];
278  crate = hname.substr(22,4);
279  } else crate = hname.substr(14,4);
280  if(m_name == "MDT" && char16 != '0' ) return getMDTChamberName(histo, biny);
281  if(m_name == "MDT" && char16 == '0' ) return getMDTChamberNameByCrate(biny, crate);
282  if(std::string(histo->GetYaxis()->GetBinLabel(biny)).size()) return histo->GetYaxis()->GetBinLabel(biny);
283  std::stringstream ss;
284  ss << biny;
285  return ss.str();
286 }
287 
288 
289 
290 std::string
292 
293  std::string name = histo->GetYaxis()->GetBinLabel(biny);
294 
295  int count = 0;
296  while(name.size() == 0 && biny-count >= 1){
297  name = histo->GetYaxis()->GetBinLabel(biny-count);
298  if(name.size() == 0) count++;
299  }
300 
301  std::string hname = histo->GetName();
302 
303  char side = hname[15];
304  if(name == "BO0" && count == 2){
305  //hack around aesthetic choice
306  name = "BO1";
307  count = 0;
308  }
309  else if(name == "BO1" && side == 'A'){
310  //hack around aesthetic choice
311  count++;
312  }
313 
314  int phiStat = count+1;
315  char stat_type = '0';
316  int etaStat = atoi(&name[2]);
317  if(name[0] == 'B'){
318  if(name[1] == 'E') {
319  stat_type = 'E';
320  phiStat*=2;
321  }
322  else if(name[1] == 'I') {
323  if( etaStat <= 5){
324  if(phiStat%2 == 0 && phiStat <= 10) stat_type = 'S';
325  else if(phiStat%2 == 1 && phiStat <= 10) stat_type = 'L';
326  else if(phiStat == 11 || phiStat == 16) stat_type = 'R';
327  else if(phiStat == 12 || phiStat == 17) stat_type = 'M';
328  else if(phiStat == 13 || phiStat == 15 || phiStat == 18) stat_type = 'S';
329  else if(phiStat == 14) stat_type = 'L';
330  //fix phiStat
331  if (phiStat > 16) phiStat-=2;
332  else if (phiStat <=16 && phiStat > 11) phiStat--;
333  }
334  else if(etaStat == 6){
335  if(phiStat%2 == 0) stat_type = 'S';
336  else if(phiStat%2 == 1) stat_type = 'L';
337  if( phiStat == 11 || phiStat == 15) stat_type = 'R';
338  }
339  else {
340  stat_type = 'S';
341  phiStat*=2;
342  }
343  }
344  else if(name[1] == 'M') {
345  if(phiStat%2==0) stat_type = 'S';
346  if(phiStat%2==1) stat_type = 'L';
347  if(etaStat==6 && phiStat>12) phiStat = phiStat+1; //there is no phi=13 in eta=6, therefore phi=14,15,16
348  //was moved one bin down in the histogram we are looking at
349  if(phiStat==12 || phiStat==14){ //BMF and BMG
350  if(etaStat%2==0) stat_type='G';
351  //BMF naming does not correspond to the actual eta station. BMF eta station is 1,3,5 but the chambers are named
352  //BMF1, BMF2, BMF3. We set etaStat such that the proper name comes out at the end.
353  if(etaStat%2==1) {
354  stat_type = 'F';
355  if(etaStat==3) etaStat=2;
356  if(etaStat==5) etaStat=3;
357  }
358  }
359 
360  }
361  else {//'O'
362  if( etaStat == 0 ) {
363  stat_type = 'G';
364  phiStat = (phiStat == 1? 12 : 14);
365  side = 'B';
366  }
367  else if(etaStat <=6){
368  if(phiStat%2==0) stat_type='S';
369  else stat_type = 'L';
370 
371  if(etaStat%2==0 && (phiStat==12||phiStat==14) ) stat_type = 'G';
372  else if(etaStat%2==1 && (phiStat==12||phiStat==14)) stat_type = 'F';
373  }
374  else {
375  etaStat = (phiStat > 2? 8 : 7);
376  stat_type = (etaStat== 7 ? 'F' : 'G');
377  phiStat = (phiStat%2 == 1? 12 : 14);
378  }
379  }
380 
381  }
382  else{//Endcap
383  if(name[1] == 'E'){
384  stat_type = 'L';
385  etaStat = (phiStat > 3? 2: 1);
386  if(side == 'A'){
387  if(phiStat == 1) phiStat = 5;
388  else if(phiStat%2 == 0) phiStat = 11;
389  else phiStat = 13;
390  }
391  else{
392  if(phiStat == 1) phiStat = 5;
393  else if(phiStat%2==0) phiStat = 13;
394  else phiStat = 15;
395  }
396  }
397  else if(name[1] == 'I'){
398  if(etaStat<=2){
399  if(phiStat%2==0) stat_type = 'S';
400  else if(phiStat%2==1) stat_type = 'L';
401  }
402  else if(etaStat<=4){
403  stat_type='L';
404  phiStat*=2;
405  phiStat--;
406  }
407  else{
408  stat_type='L';
409  phiStat = (phiStat == 1? 1 : 9);
410  }
411  }
412  else {// 'M' or 'O'
413  if(phiStat%2==0) stat_type = 'S';
414  else stat_type = 'L';
415  }
416  }
417 
418  std::string phiStat_str = TString::Format("%i", phiStat).Data();
419  if(phiStat_str.size() == 1) phiStat_str = std::string("0")+phiStat_str;
420  std::string etaStat_c = TString::Format("%i", etaStat).Data();
421  name.resize(2);
422  name+=stat_type;
423  name+=etaStat_c;
424  name+=side;
425  name+=phiStat_str;
426  return name;
427 }
428 std::string
430 
431  int phiStat = -99;
432  int etaStat = -99;
433  std::string chamber_str = "xxx";
434 
435  if(crate.substr(0,1) == 'B' && crate.substr(2,2) == "01"){
436  if( (biny-61) > 0){ // BOS
437  chamber_str = "BOS";
438  etaStat = (biny+1 - 61)/2;
439  phiStat = 2*(biny - 2*etaStat - 61) +4;
440  } else if( (biny-49) > 0){ //BOL
441  chamber_str = "BOL";
442  etaStat = (biny+1 - 49)/2;
443  phiStat = 2*(biny - 49 - 2*etaStat)+ 3;
444  } else if( (biny-37) > 0){ //BMS
445  chamber_str = "BMS";
446  etaStat = (biny+1 - 37)/2;
447  phiStat = 2*(biny - 2*etaStat - 37) + 4;
448  } else if ( (biny-25) > 0){ //BML
449  chamber_str = "BML";
450  etaStat = (biny+1 - 25)/2;
451  phiStat = 2*(biny - 25 - 2*etaStat) +3;
452  } else if ( (biny-24) > 0){ //BME
453  chamber_str = "BME";
454  etaStat = 1;
455  phiStat = 13;
456  } else if ( (biny-12) > 0){ //BIS
457  chamber_str = "BIS";
458  etaStat = (biny+1 - 12)/2;
459  phiStat = 2*(biny - 2*etaStat - 12) + 4;
460  } else if ( (biny) > 0){ //BIL
461  chamber_str = "BIL";
462  etaStat = (biny+1)/2;
463  phiStat = 2*(biny - 2*etaStat) + 3;
464  }
465  }else if (crate.substr(0,1) == "B" && crate.substr(2,2) == "02"){
466  if( (biny-60) > 0){ // BOS
467  chamber_str = "BOS";
468  etaStat = (biny+1 - 60)/2;
469  phiStat = 2*(biny - 2*etaStat - 60) + 8;
470  } else if ( (biny-48) > 0){ //BOL
471  chamber_str = "BOL";
472  etaStat = (biny+1 - 48)/2;
473  phiStat = 2*(biny - 2*etaStat - 48) + 7;
474  } else if ( (biny-36) > 0){ //BMS
475  chamber_str = "BMS";
476  etaStat = (biny+1 - 36)/2;
477  phiStat = 2*(biny - 2*etaStat - 36) + 8;
478  } else if ( (biny-24) > 0){ //BML
479  chamber_str = "BML";
480  etaStat = (biny+1 - 24)/2;
481  phiStat = 2*(biny - 2*etaStat - 24) + 7;
482  } else if ( (biny-12) > 0){ //BIS
483  chamber_str = "BIS";
484  etaStat = (biny+1 - 12)/2;
485  phiStat = 2*(biny - 2*etaStat - 12) + 8;
486  } else if ( (biny) > 0){ //BIL
487  chamber_str = "BIL";
488  etaStat = (biny+1)/2;
489  phiStat = 2*(biny - 2*etaStat) + 7;
490  }
491  } else if(crate.substr(0,1) == "B" && crate.substr(2,2) == "03"){
492  int cOffset = 0;
493  if (crate.substr(1,1) == "C"){ cOffset = 1;}
494  if( (biny-74 + cOffset) > 0) { // BOS
495  chamber_str = "BOS";
496  etaStat = (biny - 74 + cOffset);
497  phiStat = 10;
498  } else if ( (biny-62 + cOffset) > 0){ //BOL
499  chamber_str = "BOL";
500  etaStat = (biny+1 - 62 + cOffset)/2;
501  phiStat = 2*(biny - 2*etaStat - 62 + cOffset) + 11;
502  } else if ( (biny - 57 ) > 0){
503  chamber_str = "BOG";
504  etaStat = 2*(biny - 57) - 2 + 2*cOffset;
505  phiStat = 12;
506  } else if ( (biny-53) > 0){
507  chamber_str = "BOF";
508  etaStat = 2*(biny - 53) - 1;
509  phiStat = 12;
510  } else if( (biny-47) > 0){ // BMS
511  chamber_str = "BMS";
512  etaStat = biny - 47;
513  phiStat = 10;
514  } else if ( (biny-35) > 0){ //BML
515  chamber_str = "BML";
516  etaStat = (biny+1 - 35)/2;
517  phiStat = 2*(biny - 2*etaStat - 35) + 11;
518  } else if ( (biny - 32) > 0){ //BMG
519  chamber_str = "BMG";
520  etaStat = (biny - 32)*2 ; //because its BMG2, BMG4, BMG6
521  phiStat = 12;
522  } else if ( (biny - 29) > 0){ //BMF
523  chamber_str = "BMF";
524  etaStat = biny - 29;
525  phiStat = 12;
526  } else if ( (biny-17) > 0){ //BIS
527  chamber_str = "BIS";
528  etaStat = (biny+1 - 17)/2;
529  phiStat = 2*(biny - 2*etaStat - 17) + 12;
530  } else if ( (biny-11) > 0){ //BIR
531  chamber_str = "BIR";
532  etaStat = biny-11;
533  phiStat = 11;
534  } else if ( (biny-6) > 0){ //BIM
535  chamber_str = "BIM";
536  etaStat = biny-6;
537  phiStat = 11;
538  } else if ( (biny) > 0){ //BIL
539  chamber_str = "BIL";
540  etaStat = biny;
541  phiStat = 9;
542  }
543  } else if(crate.substr(0,1) == "B" && crate.substr(2,2) == "04"){
544  int cOffset = 0;
545  if (crate.substr(1,1) == "C"){ cOffset = 1;}
546  if( (biny-74 + cOffset) > 0) { // BOS
547  chamber_str = "BOS";
548  etaStat = (biny - 74 + cOffset);
549  phiStat = 16;
550  } else if ( (biny-61 + cOffset) > 0){ //BOL
551  chamber_str = "BOL";
552  etaStat = (biny+1 - 61 + cOffset)/2;
553  phiStat = 2*(biny - 2*etaStat - 61 + cOffset) + 15;
554  } else if ( (biny - 56 ) > 0){
555  chamber_str = "BOG";
556  etaStat = 2*(biny - 56) - 2 + 2*cOffset;
557  phiStat = 14;
558  } else if ( (biny-52) > 0){
559  chamber_str = "BOF";
560  etaStat = 2*(biny - 52) - 1;
561  phiStat = 14;
562  } else if( (biny-46) > 0){ // BMS
563  chamber_str = "BMS";
564  etaStat = biny - 43;
565  phiStat = 16;
566  } else if ( (biny - 45) > 0){
567  chamber_str = "BML";
568  etaStat = 6;
569  phiStat = 15;
570  } else if ( (biny-35) > 0){ //BML
571  chamber_str = "BML";
572  etaStat = (biny+1 - 35)/2;
573  phiStat = 2*(biny - 2*etaStat - 35) + 15;
574  } else if ( (biny - 32) > 0){ //BMG
575  chamber_str = "BMG";
576  etaStat = (biny - 32)*2;
577  phiStat = 14;
578  } else if ( (biny - 29) > 0){ //BMF
579  chamber_str = "BMF";
580  etaStat = biny - 29;
581  phiStat = 14;
582  } else if ( (biny-17) > 0){ //BIS
583  chamber_str = "BIS";
584  etaStat = (biny+1 - 17)/2;
585  phiStat = 2*(biny - 2*etaStat - 17) + 16;
586  } else if ( (biny-11) > 0){ //BIR
587  chamber_str = "BIR";
588  etaStat = biny-11;
589  phiStat = 15;
590  } else if ( (biny-6) > 0){ //BIM
591  chamber_str = "BIM";
592  etaStat = biny-6;
593  phiStat = 15;
594  } else if ( (biny) > 0){ //BIL
595  chamber_str = "BIL";
596  etaStat = biny;
597  phiStat = 13;
598  }
599  } else if(crate.substr(0,1) == "E" && (crate.substr(2,2) == "01" || crate.substr(2,2) == "03") ){
600  int cOffset = 0;
601  if (crate.substr(2,2) == "03"){ cOffset = 8;}
602  if( (biny-61) > 0) { //EOS
603  chamber_str = "EOS";
604  etaStat = (biny+1 - 61)/2;
605  phiStat = 2*(biny - 2*etaStat - 61) + 4 + cOffset;
606  } else if ( (biny-49) > 0){ //EOL
607  chamber_str = "EOL";
608  etaStat = (biny+1 - 49)/2;
609  phiStat = 2*(biny - 2*etaStat - 49) + 3 + cOffset;
610  } else if ( (biny - 39 ) > 0){ //EMS
611  chamber_str = "EMS";
612  etaStat = (biny+1 - 39)/2;
613  phiStat = 2*(biny - 2*etaStat - 39) + 4 + cOffset;
614  } else if ( (biny-29) > 0){ //EML
615  chamber_str = "EML";
616  etaStat = (biny+1 - 29)/2;
617  phiStat = 2*(biny - 2*etaStat - 29) + 3 + cOffset;
618  } else if( (biny-25) > 0){ // EIS
619  chamber_str = "EIS";
620  etaStat = (biny+1 - 25)/2;
621  phiStat = 2*(biny - 2*etaStat - 25) + 4 + cOffset;
622  } else if ( (biny - 16) > 0){ //EIL
623  chamber_str = "EIL";
624  etaStat = (biny+1 - 16)/2;
625  phiStat = 2*(biny - 2*etaStat - 16) + 3 + cOffset;
626  } else if ( (biny-12) > 0){ //EES
627  chamber_str = "EES";
628  etaStat = (biny+1 - 12)/2;
629  phiStat = 2*(biny - 2*etaStat - 12) + 4 + cOffset;
630  } else if ( (biny - 8) > 0){ //EEL
631  chamber_str = "EEL";
632  etaStat = (biny+1 - 8)/2;
633  phiStat = 2*(biny - 2*etaStat - 8 ) + 3 + cOffset;
634  } else if ( (biny-4) > 0){ //BIS
635  chamber_str = "BIS";
636  etaStat = (biny+1 - 4)/2 + 6;
637  phiStat = 2*(biny - 2*(etaStat-6) - 4) + 4 + cOffset;
638  } else if ( (biny) > 0){ //BEE
639  chamber_str = "BEE";
640  etaStat = (biny+1)/2;
641  phiStat = 2*(biny - 2*etaStat) + 4 + cOffset;
642  }
643  } else if(crate.substr(0,1) == "E" && (crate.substr(2,2) == "02" || crate.substr(2,2) == "04") ){
644  int cOffset = 0; int phiOffset = 0;
645  if (crate.substr(2,2) == "04"){
646  cOffset = 1; phiOffset = 8;
647  }
648  if( (biny-59 - cOffset) > 0) { //EOS
649  chamber_str = "EOS";
650  etaStat = (biny+1 - 59 - cOffset)/2;
651  phiStat = 2*(biny - 2*etaStat - 59 - cOffset) + 8 + phiOffset;
652  } else if ( (biny-47 - cOffset) > 0){ //EOL
653  chamber_str = "EOL";
654  etaStat = (biny+1 - 47 - cOffset)/2;
655  phiStat = 2*(biny - 2*etaStat - 47 - cOffset) + 7 + phiOffset;
656  } else if ( (biny - 37 - cOffset ) > 0){ //EMS
657  chamber_str = "EMS";
658  etaStat = (biny+1 - 37 - cOffset)/2;
659  phiStat = 2*(biny - 2*etaStat - 37 - cOffset) + 8 + phiOffset;
660  } else if ( (biny-27 - cOffset) > 0){ //EML
661  chamber_str = "EML";
662  etaStat = (biny+1 - 27 - cOffset)/2;
663  phiStat = 2*(biny - 2*etaStat - 27 - cOffset) + 7 + phiOffset;
664  } else if( (biny-23 - cOffset) > 0){ // EIS
665  chamber_str = "EIS";
666  etaStat = (biny+1 - 23 - cOffset)/2;
667  phiStat = 2*(biny - 2*etaStat - 23 - cOffset) + 8 + phiOffset;
668  } else if ( (biny - 15 - cOffset) > 0){ //EIL
669  chamber_str = "EIL";
670  etaStat = (biny+1 - 15 - cOffset)/2;
671  phiStat = 2*(biny - 2*etaStat - 15 - cOffset) + 7 + phiOffset;
672  } else if ( (biny-11 - cOffset) > 0){ //EES
673  chamber_str = "EES";
674  etaStat = (biny+1 - 11 - cOffset)/2;
675  phiStat = 2*(biny - 2*etaStat - 11 - cOffset) + 8 + phiOffset;
676  } else if ( (biny - 8) > 0){ //EEL
677  chamber_str = "EEL";
678  etaStat = (biny+1 - 8)/2;
679  phiStat = 2*(biny - 2*etaStat - 8 ) + 7 + phiOffset;
680  if(cOffset == 0 && etaStat == 2){phiStat = 7;}
681  } else if ( (biny-4) > 0){ //BIS
682  chamber_str = "BIS";
683  etaStat = (biny+1 - 4)/2 + 6;
684  phiStat = 2*(biny - 2*(etaStat-6) - 4) + 8 + phiOffset;
685  } else if ( (biny) > 0){ //BEE
686  chamber_str = "BEE";
687  etaStat = (biny+1)/2;
688  phiStat = 2*(biny - 2*etaStat) + 8 + phiOffset;
689  }
690  }
691  std::string phiStat_str = TString::Format("%i", phiStat).Data();
692  if(phiStat_str.size() == 1) phiStat_str = std::string("0")+phiStat_str;
693  std::string etaStat_c = TString::Format("%i", etaStat).Data();
694  std::string chamber_name = chamber_str + etaStat_c + crate.substr(1,1) + phiStat_str;
695  if(chamber_str == "BOG" && etaStat == 0){
696  chamber_name = chamber_str + etaStat_c + "B" + phiStat_str;
697  }
698  return chamber_name;
699 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
MCP::SystVariation::Default
@ Default
Definition: EnumDef.h:72
get_generator_info.result
result
Definition: get_generator_info.py:21
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
dqt_zlumi_pandas.hname
string hname
Definition: dqt_zlumi_pandas.py:272
StateLessPT_NewConfig.Format
Format
Definition: StateLessPT_NewConfig.py:146
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
dqm_algorithms::OccupancyHoleFinder::getMDTChamberNameByCrate
std::string getMDTChamberNameByCrate(int biny, const std::string &crate)
Definition: OccupancyHoleFinder.cxx:429
InDet::median
float median(std::vector< float > &Vec)
Definition: BTagVrtSec.cxx:35
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
TRT::Hit::side
@ side
Definition: HitInfo.h:83
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
grepfile.content
string content
Definition: grepfile.py:56
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
dqm_algorithms::OccupancyHoleFinder::~OccupancyHoleFinder
~OccupancyHoleFinder()
Definition: OccupancyHoleFinder.cxx:42
tags
std::vector< std::string > tags
Definition: hcg.cxx:102
beamspotman.n
n
Definition: beamspotman.py:731
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
extractSporadic.h
list h
Definition: extractSporadic.py:97
dqm_algorithms::OccupancyHoleFinder::printDescription
void printDescription(std::ostream &out)
Definition: OccupancyHoleFinder.cxx:239
dqm_algorithms::OccupancyHoleFinder::execute
dqm_core::Result * execute(const std::string &, const TObject &, const dqm_core::AlgorithmConfig &)
Definition: OccupancyHoleFinder.cxx:54
OccupancyHoleFinder.h
python.handimod.Green
int Green
Definition: handimod.py:524
dqm_algorithms::OccupancyHoleFinder::getMDTChamberName
std::string getMDTChamberName(const TH2 *histo, int biny)
Definition: OccupancyHoleFinder.cxx:291
TH2
Definition: rootspy.cxx:373
python.handimod.Red
Red
Definition: handimod.py:551
checkFileSG.writes
writes
Definition: checkFileSG.py:127
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
dqm_algorithms::OccupancyHoleFinder::getChamberName
std::string getChamberName(const TH2 *histo, int biny)
Definition: OccupancyHoleFinder.cxx:271
TH1::GetBinContent
double GetBinContent(int) const
Definition: rootspy.cxx:298
h
TH1F
Definition: rootspy.cxx:320
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
TH1
Definition: rootspy.cxx:268
dqm_algorithms::OccupancyHoleFinder::clone
OccupancyHoleFinder * clone()
Definition: OccupancyHoleFinder.cxx:47
AlgorithmHelper.h
dqm_algorithms::tools::GetFromMap
const T & GetFromMap(const std::string &pname, const std::map< std::string, T > &params)
Definition: AlgorithmHelper.h:114
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition: Control/CxxUtils/Root/StringUtils.cxx:85
pickleTool.object
object
Definition: pickleTool.py:30
dqm_algorithms::OccupancyHoleFinder
Definition: OccupancyHoleFinder.h:18
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
dqm_algorithms::OccupancyHoleFinder::OccupancyHoleFinder
OccupancyHoleFinder(const std::string &name)
Definition: OccupancyHoleFinder.cxx:34
test_pyathena.counter
counter
Definition: test_pyathena.py:15
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::OccupancyHoleFinder::getMedian
TH1 * getMedian(const TH2 *histo)
Definition: OccupancyHoleFinder.cxx:248
MDT
@ MDT
Definition: RegSelEnums.h:31
dqm_algorithms::OccupancyHoleFinder::m_name
std::string m_name
Definition: OccupancyHoleFinder.h:38