CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalSummaryClient.cc
Go to the documentation of this file.
4 
8 
12 
13 #include <iostream>
14 
15 /*
16  * \file HcalSummaryClient.cc
17  *
18  * \author J. Temple
19  * \brief Summary Client class
20  */
21 
23 {
24  name_=myname;
26  minevents_=0;
27  minerrorrate_=0;
29  ProblemCells=0;
31  StatusVsLS_=0;
33  reportMap_=0;
35 }
36 
38 {
39  name_=myname;
40  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
41  debug_ = ps.getUntrackedParameter<int>("debug",0);
42  prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
43  if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
44  prefixME_.append("/");
45  subdir_ = ps.getUntrackedParameter<std::string>("SummaryFolder","EventInfo/"); // SummaryMonitor_Hcal
46  if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
47  subdir_.append("/");
48  subdir_=prefixME_+subdir_;
49  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
50 
51  NLumiBlocks_ = ps.getUntrackedParameter<int>("NLumiBlocks",4000);
52  UseBadChannelStatusInSummary_ = ps.getUntrackedParameter<bool>("UseBadChannelStatusInSummary",false);
53 
54  // These aren't used in summary client, are they?
55  badChannelStatusMask_ = ps.getUntrackedParameter<int>("Summary_BadChannelStatusMask",
56  ps.getUntrackedParameter<int>("BadChannelStatusMask",0));
57  minerrorrate_ = ps.getUntrackedParameter<double>("Summary_minerrorrate",
58  ps.getUntrackedParameter<double>("minerrorrate",0));
59  minevents_ = ps.getUntrackedParameter<int>("Summary_minevents",
60  ps.getUntrackedParameter<int>("minevents",0));
61  Online_ = ps.getUntrackedParameter<bool>("online",false);
62 
64  ProblemCells=0;
66  StatusVsLS_=0;
68  reportMap_=0;
70 }
71 
73 {
74  if (debug_>2) std::cout <<"\tHcalSummaryClient::analyze()"<<std::endl;
75 
76  //
77 
78  // Start with counters in 'unknown' status; they'll be set by analyze_everything routines
79  status_global_=-1;
80  status_HB_=-1;
81  status_HE_=-1;
82  status_HO_=-1;
83  status_HF_=-1;
84 
85  status_HO0_=-1;
86  status_HO12_=-1;
87  status_HFlumi_=-1;
88  status_global_=-1;
89 
91  enoughevents_=true; // assume we have enough events for all tests to have run
93  {
94  if (debug_>2) std::cout <<"<HcalSummaryClient::analyze> CLIENT = "<<clients_[i]->name_<<" ENOUGH = "<<clients_[i]->enoughevents_<<std::endl;
95  enoughevents_&=clients_[i]->enoughevents_;
97  {
98  if (clients_[i]->enoughevents_==false && debug_>1)
99  std::cout <<"Failed enoughevents test for monitor "<<clients_[i]->name()<<std::endl;
100  }
101  }
102 
103  // check to find which subdetectors are present -- need to do this prior to checking whether enoughevents_ == false!
104  MonitorElement* temp_present;
105  if (HBpresent_!=1)
106  {
107  temp_present=dqmStore_->get(prefixME_+"HcalInfo/HBpresent");
108  if (temp_present!=0)
109  HBpresent_=temp_present->getIntValue();
110  }
111  if (HEpresent_!=1)
112  {
113  temp_present=dqmStore_->get(prefixME_+"HcalInfo/HEpresent");
114  if (temp_present!=0)
115  HEpresent_=temp_present->getIntValue();
116  }
117  if (HOpresent_!=1)
118  {
119  temp_present=dqmStore_->get(prefixME_+"HcalInfo/HOpresent");
120  if (temp_present!=0)
121  HOpresent_=temp_present->getIntValue();
122  }
123  if (HFpresent_!=1)
124  {
125  temp_present=dqmStore_->get(prefixME_+"HcalInfo/HFpresent");
126  if (temp_present!=0)
127  HFpresent_=temp_present->getIntValue();
128  }
129 
130  if (debug_>1)
131  std::cout <<"<HcalSummaryClient::analyze> HB present = "<<HBpresent_<<" "<<"HE present = "<<HEpresent_<<" "<<"HO present = "<<HOpresent_<<" "<<"HF present = "<<HFpresent_<<std::endl;
132 
133  if (enoughevents_==false)
134  {
135  if (debug_>0) std::cout <<"<HcalSummaryClient::analyze> Not enough events processed to evaluate summary status!"<<std::endl;
136 
137  // 'HXpresent_' values are set to -1 by default.
138  // They are set to +1 when a channel is present.
139  // I don't think there are any cases where values =0,
140  // but I'm not positive of this yet -- Jeff, 10 Aug 2010
141 
142  // Check whether any events are found for each subdetector
143  if (HBpresent_>0) status_HB_=1;
144  else status_HB_=-1; // HB not present or unknown
145  if (HEpresent_>0) status_HE_=1;
146  else status_HE_=-1; // HE not present or unknown
147  if (HOpresent_>0) status_HO_=1;
148  else status_HO_=-1; // HO not present or unknown
149  if (HFpresent_>0) status_HF_=1;
150  else status_HF_=-1; // HF not present or unknown
151 
152  // Update this in the future? Use '||' instead of '&&'?
153  if (HBpresent_<=0 && HEpresent_<=0 && HOpresent_<=0 && HFpresent_<=0)
154  status_global_=-1;
155  else
156  status_global_=1;
157 
158  // Set other statuses based on subdetectors
162 
163  if (debug_>1)
164  {
165  std::cout <<"Insufficient events processed. Subdetector status is:"<<std::endl;
166  std::cout<<"\tHB: "<<status_HB_<<std::endl;
167  std::cout<<"\tHE: "<<status_HE_<<std::endl;
168  std::cout<<"\tHO: "<<status_HO_<<std::endl;
169  std::cout<<"\tHF: "<<status_HF_<<std::endl;
170  std::cout<<"\tHO0: "<<status_HO0_<<std::endl;
171  std::cout<<"\tHO12: "<<status_HO12_<<std::endl;
172  std::cout<<"\tHFlumi: "<<status_HFlumi_<<std::endl;
173  }
174 
175  fillReportSummary(LS);
176  return;
177  }
178  if (EnoughEvents_!=0) EnoughEvents_->setBinContent(clients_.size()+1,1); // summary is good to go!
179 
180  // set status to 0 if subdetector is present (or assumed present)
181  if (HBpresent_>0) status_HB_=0;
182  if (HEpresent_>0) status_HE_=0;
184  if (HFpresent_>0) {status_HF_=0; status_HFlumi_=0;}
185 
186  if (HBpresent_>0 || HEpresent_>0 ||
187  HOpresent_>0 || HFpresent_>0 )
188  status_global_=0;
189 
190  // don't want to fool with variable-sized arrays at the moment; revisit later
191  //const unsigned int csize=clients_.size();
192  double localHB[20]={0};
193  double localHE[20]={0};
194  double localHF[20]={0};
195  double localHO[20]={0};
196  double localHFlumi[20]={0};
197  double localHO0[20]={0};
198  double localHO12[20]={0};
199 
200  // reset all depth histograms
201  if (SummaryMapByDepth==0)
202  {
203  if (debug_>0)
204  std::cout <<"<HcalSummaryClient::analyze> ERROR: SummaryMapByDepth can't be found!"<<std::endl;
205  }
206  else
207  {
208  for (unsigned int i=0;i<(SummaryMapByDepth->depth).size();++i)
209  SummaryMapByDepth->depth[i]->Reset();
210 
211  int etabins=-9999;
212  int phibins=-9999;
213 
214  // Get Channel Status histograms here
215  std::vector<MonitorElement*> chStat;
216  chStat.push_back(dqmStore_->get(prefixME_+"HcalInfo/ChannelStatus/HB HE HF Depth 1 ChannelStatus"));
217  chStat.push_back(dqmStore_->get(prefixME_+"HcalInfo/ChannelStatus/HB HE HF Depth 2 ChannelStatus"));
218  chStat.push_back(dqmStore_->get(prefixME_+"HcalInfo/ChannelStatus/HE Depth 3 ChannelStatus"));
219  chStat.push_back(dqmStore_->get(prefixME_+"HcalInfo/ChannelStatus/HO Depth 4 ChannelStatus"));
220 
221 
222  for (int d=0;d<4;++d)
223  {
224  etabins=(SummaryMapByDepth->depth[d])->getNbinsX();
225  phibins=(SummaryMapByDepth->depth[d])->getNbinsY();
226  for (int eta=1;eta<=etabins;++eta)
227  {
228  int ieta=CalcIeta(eta-1,d+1);
229  for (int phi=1;phi<=phibins;++phi)
230  {
231  // local phi counter is the same as iphi
232  // for |ieta|>20, iphi%2==0 cells are unphysical; skip 'em
233  // for |ieta|>39, iphi%4!=3 cells are unphysical
234  if (abs(ieta)>20 && phi%2==0) continue;
235  if (abs(ieta)>39 && phi%4!=3) continue;
236 
237  // First loop calculates "local" error rates for each individual client
238  // This must be done separately from the SummaryMap overall loop, because that loop issues a
239  // 'break' the first time an error is found (to avoid double-counting multiple errors in a single channel).
240  for (unsigned int cl=0;cl<clients_.size();++cl)
241  {
242  if (clients_[cl]->ProblemCellsByDepth==0) continue;
243 
244  if ((clients_[cl]->ProblemCellsByDepth)->depth[d]==0) continue;
245  if ((clients_[cl]->ProblemCellsByDepth)->depth[d]->getBinContent(eta,phi)>clients_[cl]->minerrorrate_)
246  {
247  if (isHF(eta-1,d+1))
248  {
249  ++localHF[cl];
250  if ((d==0 && (abs(ieta)==33 || abs(ieta)==34)) || // depth 1, rings 33,34
251  (d==1 && (abs(ieta)==35 || abs(ieta)==36))) // depth 2, rings 35,36
252  ++localHFlumi[cl];
253  }
254  else if (isHO(eta-1,d+1))
255  {
256  ++localHO[cl];
257  if (abs(ieta)<5) ++localHO0[cl];
258  else ++localHO12[cl];
259  }
260  else if (isHB(eta-1,d+1)) ++localHB[cl];
261  else if (isHE(eta-1,d+1)) ++localHE[cl];
262  }
263  } // for (loop on clients_.size() to determine individual client error rates)
264 
265  // Check for certification errors -- do we want to add some extra warnings (filling channel status db plot with new value, etc?) in this case?
266 
267  if (UseBadChannelStatusInSummary_ && chStat[d]!=0)
268  {
269  double chanStat=chStat[d]->getBinContent(eta,phi);
270  // chanStat<0 indicates original status from database was <0; this is counted as an error,
271  // since such values should never appear in the database.
272  if (chanStat<0)
273  {
274  if (isHF(eta-1,d+1))
275  {
276  ++status_HF_;
277  if ((d==0 && (abs(ieta)==33 || abs(ieta)==34)) || // depth 1, rings 33,34
278  (d==1 && (abs(ieta)==35 || abs(ieta)==36))) // depth 2, rings 35,36
279  {
280  ++status_HFlumi_;
281  }
282  continue; // don't bother looking at individual clients for results; channel status is already corrupted
283  }
284  else if (isHO(eta-1,d+1))
285  {
286  ++status_HO_;
287  if (abs(ieta)<5)
288  ++status_HO0_;
289  else ++status_HO12_;
290  continue;
291  }
292  else if (isHB(eta-1,d+1))
293  {
294  ++status_HB_;
295  continue;
296  }
297  else if (isHE(eta-1,d+1))
298  {
299  ++status_HE_;
300  continue;
301  }
302  } // if (chanStat<0)
303  } // if (UseBadChannelStatusInSummary_)
304 
305  // loop over all client tests
306 
307  // SummaryMapByDepth is slightly different from previous version -- it now just shows cells
308  // that contribute as "problems", rather than giving good channels a status of 1, and bad a status of 0
309  for (unsigned int cl=0;cl<clients_.size();++cl)
310  {
311  // Best way to handle this?
312  // We know that first element is HcalMonitorModule info, which has
313  // no problem cells defined. Create some, or start counting from cl=1?
314  if (debug_>4 && eta==1 && phi==1) std::cout <<"Checking summary for client "<<clients_[cl]->name()<<std::endl;
315  if (clients_[cl]->ProblemCellsByDepth==0) continue;
316 
317  if ((clients_[cl]->ProblemCellsByDepth)->depth[d]==0) continue;
318  if ((clients_[cl]->ProblemCellsByDepth)->depth[d]->getBinContent(eta,phi)>clients_[cl]->minerrorrate_)
319  {
320  if ((clients_[cl]->ProblemCellsByDepth)->depth[d]->getBinContent(eta,phi)<999)
321  SummaryMapByDepth->depth[d]->setBinContent(eta,phi,1);
322  else
323  SummaryMapByDepth->depth[d]->setBinContent(eta,phi,999); // known problems filled with a value of 999
324  if (isHF(eta-1,d+1))
325  {
326  ++status_HF_;
327  if ((d==0 && (abs(ieta)==33 || abs(ieta)==34)) || // depth 1, rings 33,34
328  (d==1 && (abs(ieta)==35 || abs(ieta)==36))) // depth 2, rings 35,36
329  {
330  ++status_HFlumi_;
331  }
332  }
333  else if (isHO(eta-1,d+1))
334  {
335  ++status_HO_;
336  if (abs(ieta)<5)
337  ++status_HO0_;
338  else ++status_HO12_;
339  }
340  else if (isHB(eta-1,d+1)) ++status_HB_;
341  else if (isHE(eta-1,d+1)) ++status_HE_;
342  break; // man, this break causes problems for certificationMap!!! -- Jason; WHY? -- Jeff
343  }
344  } // for (main loop on clients_.size() to calculate reportSummary statuses)
345  }
346  }
347  } // for (int d=0;d<4;++d)
348 
350  } // else (SummaryMapByDepth exists)
351 
352  // We've checked all problems; now compute overall status
353  int totalcells=0;
354  std::map<std::string, int>::const_iterator it;
355 
356  if (HBpresent_>0)
357  {
359  it=subdetCells_.find("HB");
360  totalcells+=it->second;
361  status_HB_= 1-(status_HB_/it->second);
362  for (unsigned int i=0;i<clients_.size();++i)
363  {
364  localHB[i]=1-(1.*localHB[i]/it->second);
365  localHB[i]=std::max(0.,localHB[i]);
366  }
367  status_HB_=std::max(0.,status_HB_); // converts fraction of bad channels to good fraction
368  }
369  else status_HB_=-1; // enoughevents_ can be true even if HB not present; need to set status_HB_=-1 in both cases
370 
371  if (HEpresent_>0)
372  {
374  it=subdetCells_.find("HE");
375  totalcells+=it->second;
376  status_HE_= 1-(status_HE_/it->second);
377  for (unsigned int i=0;i<clients_.size();++i)
378  {
379  localHE[i]=1-(1.*localHE[i]/it->second);
380  localHE[i]=std::max(0.,localHE[i]);
381  }
382  status_HE_=std::max(0.,status_HE_); // converts fraction of bad channels to good fraction
383  }
384  else status_HE_=-1;
385 
386  if (HOpresent_>0)
387  {
389  it=subdetCells_.find("HO");
390  totalcells+=it->second;
391  status_HO_= 1-(status_HO_/it->second);
392  status_HO_=std::max(0.,status_HO_); // converts fraction of bad channels to good fraction
393  for (unsigned int i=0;i<clients_.size();++i)
394  {
395  localHO[i]=1-(1.*localHO[i]/it->second);
396  localHO[i]=std::max(0.,localHO[i]);
397  }
398  it=subdetCells_.find("HO0");
399  status_HO0_= 1-(status_HO0_/it->second);
400  for (unsigned int i=0;i<clients_.size();++i)
401  {
402  localHO0[i]=1-(1.*localHO0[i]/it->second);
403  localHO0[i]=std::max(0.,localHO0[i]);
404  }
405  status_HO0_=std::max(0.,status_HO0_); // converts fraction of bad channels to good fraction
406  it=subdetCells_.find("HO12");
407  status_HO12_= 1-(status_HO12_/it->second);
408  status_HO12_=std::max(0.,status_HO12_); // converts fraction of bad channels to good fraction
409  for (unsigned int i=0;i<clients_.size();++i)
410  {
411  localHO12[i]=1-(1.*localHO12[i]/it->second);
412  localHO12[i]=std::max(0.,localHO12[i]);
413  }
414  }
415  else
416  {
417  status_HO_=-1;
418  status_HO0_=-1;
419  status_HO12_=-1;
420  }
421  if (HFpresent_>0)
422  {
424  it=subdetCells_.find("HF");
425  totalcells+=it->second;
426  status_HF_= 1-(status_HF_/it->second);
427  status_HF_=std::max(0.,status_HF_); // converts fraction of bad channels to good fraction
428  for (unsigned int i=0;i<clients_.size();++i)
429  {
430  localHF[i]=1-(1.*localHF[i]/it->second);
431  localHF[i]=std::max(0.,localHF[i]);
432  }
433  it=subdetCells_.find("HFlumi");
434  status_HFlumi_= 1-(status_HFlumi_/it->second);
435  status_HFlumi_=std::max(0.,status_HFlumi_); // converts fraction of bad channels to good fraction
436  for (unsigned int i=0;i<clients_.size();++i)
437  {
438  localHFlumi[i]=1-(1.*localHFlumi[i]/it->second);
439  localHFlumi[i]=std::max(0.,localHFlumi[i]);
440  }
441  }
442  else
443  {
444  status_HF_=-1;
445  status_HFlumi_=-1;
446  }
447 
448  if (totalcells==0)
449  status_global_=-1;
450  else
451  {
452  status_global_=1-status_global_/totalcells;
453  status_global_=std::max(0.,status_global_); // convert to good fraction
454  }
455 
456 
457  // Fill certification map here
458 
459  dqmStore_->setCurrentFolder(prefixME_+"HcalInfo");
460  certificationMap_=dqmStore_->get(prefixME_+"HcalInfo/CertificationMap");
462  certificationMap_=dqmStore_->book2D("CertificationMap","Certification Map",7,0,7,
463  clients_.size()+1,0,clients_.size()+1);
464 
465  certificationMap_->getTH2F()->GetYaxis()->SetBinLabel(1,"Summary");
466  (certificationMap_->getTH2F())->SetOption("textcolz");
467 
468  for (int i=0;i<(int)clients_.size();++i)
469  {
470  certificationMap_->getTH2F()->GetYaxis()->SetBinLabel(i+2,(clients_[i]->name()).c_str());
471  }
472  certificationMap_->getTH2F()->GetYaxis()->SetLabelSize(0.02);
473  certificationMap_->getTH2F()->GetXaxis()->SetBinLabel(1,"HB");
474  certificationMap_->getTH2F()->GetXaxis()->SetBinLabel(2,"HE");
475  certificationMap_->getTH2F()->GetXaxis()->SetBinLabel(3,"HO");
476  certificationMap_->getTH2F()->GetXaxis()->SetBinLabel(4,"HF");
477  certificationMap_->getTH2F()->GetXaxis()->SetBinLabel(5,"HO0");
478  certificationMap_->getTH2F()->GetXaxis()->SetBinLabel(6,"HO12");
479  certificationMap_->getTH2F()->GetXaxis()->SetBinLabel(7,"HFlumi");
480  certificationMap_->getTH2F()->SetMinimum(-1);
481  certificationMap_->getTH2F()->SetMaximum(1);
482 
483  for (unsigned int i=0;i<clients_.size();++i)
484  {
485  certificationMap_->setBinContent(1,i+2,localHB[i]);
486  certificationMap_->setBinContent(2,i+2,localHE[i]);
487  certificationMap_->setBinContent(3,i+2,localHO[i]);
488  certificationMap_->setBinContent(4,i+2,localHF[i]);
489  certificationMap_->setBinContent(5,i+2,localHO0[i]);
490  certificationMap_->setBinContent(6,i+2,localHO12[i]);
491  certificationMap_->setBinContent(7,i+2,localHF[i]);
492  }
500  fillReportSummary(LS);
501 } // analyze
502 
504 {
505 
506  // We've now checked all tasks; now let's calculate summary values
507 
508  if (debug_>2) std::cout <<"<HcalSummaryClient::fillReportSummary>"<<std::endl;
509 
510  if (debug_>3)
511  {
512  std::cout <<"STATUS = "<<std::endl;
513  std::cout <<"HB = "<<status_HB_<<std::endl;
514  std::cout <<"HE = "<<status_HE_<<std::endl;
515  std::cout <<"HO = "<<status_HO_<<std::endl;
516  std::cout <<"HF = "<<status_HF_<<std::endl;
517  std::cout <<"HO0 = "<<status_HO0_<<std::endl;
518  std::cout <<"HO12 = "<<status_HO12_<<std::endl;
519  std::cout <<"HFlumi = "<<status_HFlumi_<<std::endl;
520  }
521 
522  // put the summary values into MonitorElements
523 
524  if (LS>0)
525  {
526  if (StatusVsLS_)
527  {
535  }
536  }
537 
538  MonitorElement* me;
540 
541  //me=dqmStore_->get(subdir_+"reportSummaryMap");
542  if (reportMap_)
543  {
551  // Set reportMap underflow bin based on whether enough total events have been processed
552  if (enoughevents_==false)
553  reportMap_->setBinContent(0,0,-1);
554  else
555  reportMap_->setBinContent(0,0,1);
556  }
557  else if (debug_>0) std::cout <<"<HcalSummaryClient::fillReportSummary> CANNOT GET REPORT SUMMARY MAP!!!!!"<<std::endl;
558 
559  if (reportMapShift_)
560  {
567  // Set reportMap underflow bin based on whether enough total events have been processed
568  if (enoughevents_==false)
570  else
572  }
573  else if (debug_>0) std::cout <<"<HcalSummaryClient::fillReportSummary> CANNOT GET REPORT SUMMARY MAP!!!!!"<<std::endl;
574 
575  me=dqmStore_->get(subdir_+"reportSummary");
576  // Clear away old versions
577  if (me) me->Fill(status_global_);
578 
579  // Create floats for each subdetector status
580  std::string subdets[7] = {"HB","HE","HO","HF","HO0","HO12","HFlumi"};
581  for (unsigned int i=0;i<7;++i)
582  {
583  // Create floats showing subtasks status
584  dqmStore_->setCurrentFolder( subdir_+ "reportSummaryContents" );
585  me=dqmStore_->get(subdir_+"reportSummaryContents/Hcal_"+subdets[i]);
586  if (me==0)
587  {
588  if (debug_>0) std::cout <<"<HcalSummaryClient::analyze()> Could not get Monitor Element named 'Hcal_"<<subdets[i]<<"'"<<std::endl;
589  continue;
590  }
591  if (subdets[i]=="HB") me->Fill(status_HB_);
592  else if (subdets[i]=="HE") me->Fill(status_HE_);
593  else if (subdets[i]=="HO") me->Fill(status_HO_);
594  else if (subdets[i]=="HF") me->Fill(status_HF_);
595  else if (subdets[i]=="HO0") me->Fill(status_HO0_);
596  else if (subdets[i]=="HO12") me->Fill(status_HO12_);
597  else if (subdets[i]=="HFlumi") me->Fill(status_HFlumi_);
598  } // for (unsigned int i=0;...)
599 
600 } // fillReportSummary()
601 
602 
604 {
605 
606  MonitorElement* me;
607  dqmStore_->setCurrentFolder(prefixME_+"LSbyLS_Hcal/LSvalues");
608 
609  float status_HB=-1;
610  float status_HE=-1;
611  float status_HO=-1;
612  float status_HF=-1;
613  float status_HO0=-1;
614  float status_HO12=-1;
615  float status_HFlumi=-1;
616  float status_global=-1;
617 
618  me=dqmStore_->get(prefixME_+"LSbyLS_Hcal/LSvalues/ProblemsThisLS");
619  if (me!=0)
620  {
621  //check to see if enough events were processed to make tests
622  int events=(int)me->getBinContent(-1);
623  if (events>0)
624  {
625  std::map<std::string, int>::const_iterator it;
626  int totalcells=0;
627 
628  status_HB=me->getBinContent(1,1);
629  status_HE=me->getBinContent(2,1);
630  status_HO=me->getBinContent(3,1);
631  status_HF=me->getBinContent(4,1);
632  status_HO0=me->getBinContent(5,1);
633  status_HO12=me->getBinContent(6,1);
634  status_HFlumi=me->getBinContent(7,1);
635 
636  status_global=status_HB+status_HE+status_HO+status_HF;
637  if (debug_>1) std::cout <<"<HcalSummaryClient::fillReportsummaryLSbyLS> BAD CHANNELS*EVENTS = HB: "<<status_HB<<" HE: "<<status_HE<<" HO: "<<status_HO<<" HO0: "<<status_HO0<<" HO12: "<<status_HO12<<" HF:"<<status_HF<<" HFlumi: "<<status_HFlumi<<" TOTAL BAD CHANNELS*EVENTS = "<<status_global<<" TOTAL EVENTS = "<<events<<std::endl;
638 
639  it=subdetCells_.find("HB");
640  totalcells+=it->second;
641  if (it->second>0)
642  status_HB=1-(status_HB)/events/it->second;
643 
644  it=subdetCells_.find("HE");
645  totalcells+=it->second;
646  if (it->second>0)
647  status_HE=1-(status_HE)/events/it->second;
648 
649  it=subdetCells_.find("HO");
650  totalcells+=it->second;
651  if (it->second>0)
652  status_HO=1-(status_HO)/events/it->second;
653 
654  it=subdetCells_.find("HF");
655  totalcells+=it->second;
656  if (it->second>0)
657  status_HF=1-(status_HF)/events/it->second;
658 
659  it=subdetCells_.find("HO0");
660  if (it->second>0)
661  status_HO0=1-(status_HO0)/events/it->second;
662 
663  it=subdetCells_.find("HO12");
664  if (it->second>0)
665  status_HO12=1-(status_HO12)/events/it->second;
666 
667  it=subdetCells_.find("HFlumi");
668  if (it->second>0)
669  status_HFlumi=1-(status_HFlumi)/events/it->second;
670  if (totalcells>0)
671  status_global=1-status_global/events/totalcells;
672  if (debug_>1) std::cout <<"<HcalSummaryClient::fillReportsummaryLSbyLS> STATUS= HB: "<<status_HB<<" HE: "<<status_HE<<" HO: "<<status_HO<<" HO0: "<<status_HO0<<" HO12: "<<status_HO12<<" HF:"<<status_HF<<" HFlumi: "<<status_HFlumi<<" GLOBAL STATUS = "<<status_global<<" TOTAL EVENTS = "<<events<<std::endl;
673  } // if (events(>0)
674  } // if (me!=0)
675 
677  if (reportMap_)
678  {
679  reportMap_->setBinContent(1,1,status_HB);
680  reportMap_->setBinContent(2,1,status_HE);
681  reportMap_->setBinContent(3,1,status_HO);
682  reportMap_->setBinContent(4,1,status_HF);
683  reportMap_->setBinContent(5,1,status_HO0);
684  reportMap_->setBinContent(6,1,status_HO12);
685  reportMap_->setBinContent(7,1,status_HFlumi);
686  // Set reportMap underflow bin based on whether enough total events have been processed
687  if (enoughevents_==false)
688  reportMap_->setBinContent(0,0,-1);
689  else
690  reportMap_->setBinContent(0,0,1);
691 
692  }
693  else if (debug_>0) std::cout <<"<HcalSummaryClient::fillReportSummaryLSbyLS> CANNOT GET REPORT SUMMARY MAP!!!!!"<<std::endl;
694 
695  if (reportMapShift_)
696  {
697  reportMapShift_->setBinContent(1,1,status_HB);
698  reportMapShift_->setBinContent(2,1,status_HE);
699  reportMapShift_->setBinContent(3,1,status_HO);
700  reportMapShift_->setBinContent(4,1,status_HF);
701  reportMapShift_->setBinContent(5,1,status_HO0);
702  reportMapShift_->setBinContent(6,1,status_HO12);
703  // Set reportMap underflow bin based on whether enough total events have been processed
704  if (enoughevents_==false)
706  else
708 
709  }
710  else if (debug_>0) std::cout <<"<HcalSummaryClient::fillReportSummaryLSbyLS> CANNOT GET REPORT SUMMARY MAP!!!!!"<<std::endl;
711 
712  me=dqmStore_->get(subdir_+"reportSummary");
713  // Clear away old versions
714  if (me) me->Fill(status_global);
715 
716  // Create floats for each subdetector status
717  std::string subdets[7] = {"HB","HE","HO","HF","HO0","HO12","HFlumi"};
718  for (unsigned int i=0;i<7;++i)
719  {
720  // Create floats showing subtasks status
721  dqmStore_->setCurrentFolder( subdir_+ "reportSummaryContents" );
722  me=dqmStore_->get(subdir_+"reportSummaryContents/Hcal_"+subdets[i]);
723  if (me==0)
724  {
725  if (debug_>0) std::cout <<"<HcalSummaryClient::LSbyLS> Could not get Monitor Element named 'Hcal_"<<subdets[i]<<"'"<<std::endl;
726  continue;
727  }
728  if (subdets[i]=="HB") me->Fill(status_HB);
729  else if (subdets[i]=="HE") me->Fill(status_HE);
730  else if (subdets[i]=="HO") me->Fill(status_HO);
731  else if (subdets[i]=="HF") me->Fill(status_HF);
732  else if (subdets[i]=="HO0") me->Fill(status_HO0);
733  else if (subdets[i]=="HO12") me->Fill(status_HO12);
734  else if (subdets[i]=="HFlumi") me->Fill(status_HFlumi);
735  } // for (unsigned int i=0;...)
736 
737 
738  if (StatusVsLS_)
739  {
740  StatusVsLS_->setBinContent(LS,1,status_HB);
741  StatusVsLS_->setBinContent(LS,2,status_HE);
742  StatusVsLS_->setBinContent(LS,3,status_HO);
743  StatusVsLS_->setBinContent(LS,4,status_HF);
744  StatusVsLS_->setBinContent(LS,5,status_HO0);
745  StatusVsLS_->setBinContent(LS,6,status_HO12);
746  StatusVsLS_->setBinContent(LS,7,status_HFlumi);
747  }
748 
749  return;
750 
751 
752 } // void HcalSummaryClient::fillReportSummaryLSbyLS()
753 
754 
755 
757 {
759  // set total number of cells in each subdetector
760  subdetCells_.insert(std::make_pair("HB",2592));
761  subdetCells_.insert(std::make_pair("HE",2592));
762  subdetCells_.insert(std::make_pair("HO",2160));
763  subdetCells_.insert(std::make_pair("HF",1728));
764  subdetCells_.insert(std::make_pair("HO0",576));
765  subdetCells_.insert(std::make_pair("HO12",1584));
766  subdetCells_.insert(std::make_pair("HFlumi",288)); // 8 rings, 36 cells/ring
767  // Assume subdetectors are 'unknown'
768  HBpresent_=-1;
769  HEpresent_=-1;
770  HOpresent_=-1;
771  HFpresent_=-1;
772 
773  EnoughEvents_=0;
774  MinEvents_=0;
775  MinErrorRate_=0;
776 }
777 
779 
781 {
782  if (!dqmStore_)
783  {
784  if (debug_>0) std::cout <<"<HcalSummaryClient::beginRun> dqmStore does not exist!"<<std::endl;
785  return;
786  }
787  nevts_=0;
788 
790 
791  MonitorElement* me;
792  // reportSummary holds overall detector status
793  me=dqmStore_->get(subdir_+"reportSummary");
794  // Clear away old versions
795  if (me) dqmStore_->removeElement(me->getName());
796  me = dqmStore_->bookFloat("reportSummary");
797  me->Fill(-1); // set status to unknown at startup
798 
799  // Create floats for each subdetector status
800  std::string subdets[7] = {"HB","HE","HO","HF","HO0","HO12","HFlumi"};
801  for (unsigned int i=0;i<7;++i)
802  {
803  // Create floats showing subtasks status
804  dqmStore_->setCurrentFolder( subdir_+ "reportSummaryContents" );
805  me=dqmStore_->get(subdir_+"reportSummaryContents/Hcal_"+subdets[i]);
806  if (me) dqmStore_->removeElement(me->getName());
807  me = dqmStore_->bookFloat("Hcal_"+subdets[i]);
808  me->Fill(-1);
809  } // for (unsigned int i=0;...)
810 
811  dqmStore_->setCurrentFolder(prefixME_+"HcalInfo/SummaryClientPlots");
812  me=dqmStore_->get(prefixME_+"HcalInfo/SummaryClientPlots/HB HE HF Depth 1 Problem Summary Map");
813  if (me) dqmStore_->removeElement(me->getName());
814  me=dqmStore_->get(prefixME_+"HcalInfo/SummaryClientPlots/HB HE HF Depth 2 Problem Summary Map");
815  if (me) dqmStore_->removeElement(me->getName());
816  me=dqmStore_->get(prefixME_+"HcalInfo/SummaryClientPlots/HE Depth 3 Problem Summary Map");
817  if (me) dqmStore_->removeElement(me->getName());
818  me=dqmStore_->get(prefixME_+"HcalInfo/SummaryClientPlots/HO Depth 4 Problem Summary Map");
819  if (me) dqmStore_->removeElement(me->getName());
820 
821  if (EnoughEvents_==0)
822  EnoughEvents_=dqmStore_->book1D("EnoughEvents","Enough Events Passed From Each Task To Form Summary",1+(int)clients_.size(),0,1+(int)clients_.size());
824  EnoughEvents_->setBinLabel(i+1,clients_[i]->name());
825  EnoughEvents_->setBinLabel(1+(int)clients_.size(),"Summary");
826 
827  if (MinEvents_==0)
828  MinEvents_=dqmStore_->book1D("MinEvents","Minimum Events Required From Each Task To Form Summary",
829  1+(int)clients_.size(),0,1+(int)clients_.size());
830  int summin=0;
832  {
835  summin=std::max(summin,clients_[i]->minevents_);
836  }
837  if (MinErrorRate_==0)
838  MinErrorRate_=dqmStore_->book1D("MinErrorRate",
839  "Minimum Error Rate Required For Channel To Be Counted As Problem",
840  (int)clients_.size(),0,(int)clients_.size());
842  {
845  }
846 
847  // Extra fix provided by Giuseppe
848 
849  if (SummaryMapByDepth!=0)
850  {
851  delete SummaryMapByDepth;
853  }
854 
855  if (SummaryMapByDepth==0)
856  {
858  SummaryMapByDepth->setup(dqmStore_,"Problem Summary Map");
859  }
860  // Set histogram values to -1
861  // Set all bins to "unknown" to start
862  int etabins=0;
863  for (unsigned int depth=0;depth<4;++depth)
864  {
865  if (SummaryMapByDepth->depth[depth]==0) continue;
866  SummaryMapByDepth->depth[depth]->Reset();
867  etabins=(SummaryMapByDepth->depth[depth])->getNbinsX();
868  for (int ieta=0;ieta<etabins;++ieta)
869  {
870  for (int iphi=0;iphi<72;++iphi)
871  SummaryMapByDepth->depth[depth]->setBinContent(ieta+1,iphi+1,-1);
872  }
873  }
874 
875  // Make histogram of status vs LS
876  StatusVsLS_ = dqmStore_->get(prefixME_+"HcalInfo/SummaryClientPlots/StatusVsLS");
878  StatusVsLS_ = dqmStore_->book2D("StatusVsLS","Status vs. Luminosity Section",
879  NLumiBlocks_,0.5,NLumiBlocks_+0.5,
880  7,0,7);
881  // Set all status values to -1 to begin
882  for (int i=1;i<=NLumiBlocks_;++i)
883  for (int j=1;j<=7;++j)
885  (StatusVsLS_->getTH2F())->GetYaxis()->SetBinLabel(1,"HB");
886  (StatusVsLS_->getTH2F())->GetYaxis()->SetBinLabel(2,"HE");
887  (StatusVsLS_->getTH2F())->GetYaxis()->SetBinLabel(3,"HO");
888  (StatusVsLS_->getTH2F())->GetYaxis()->SetBinLabel(4,"HF");
889  (StatusVsLS_->getTH2F())->GetYaxis()->SetBinLabel(5,"HO0");
890  (StatusVsLS_->getTH2F())->GetYaxis()->SetBinLabel(6,"HO12");
891  (StatusVsLS_->getTH2F())->GetYaxis()->SetBinLabel(7,"HFlumi");
892  (StatusVsLS_->getTH2F())->GetXaxis()->SetTitle("Lumi Section");
893  (StatusVsLS_->getTH2F())->SetMinimum(-1);
894  (StatusVsLS_->getTH2F())->SetMaximum(1);
895 
896  // Finally, form report Summary Map
898 
899  reportMap_=dqmStore_->get(subdir_+"reportSummaryMap");
900  if (reportMap_)
902  reportMap_ = dqmStore_->book2D("reportSummaryMap","reportSummaryMap",
903  7,0,7,1,0,1);
904  (reportMap_->getTH2F())->GetXaxis()->SetBinLabel(1,"HB");
905  (reportMap_->getTH2F())->GetXaxis()->SetBinLabel(2,"HE");
906  (reportMap_->getTH2F())->GetXaxis()->SetBinLabel(3,"HO");
907  (reportMap_->getTH2F())->GetXaxis()->SetBinLabel(4,"HF");
908  (reportMap_->getTH2F())->GetXaxis()->SetBinLabel(5,"HO0");
909  (reportMap_->getTH2F())->GetXaxis()->SetBinLabel(6,"HO12");
910  (reportMap_->getTH2F())->GetXaxis()->SetBinLabel(7,"HFlumi");
911  (reportMap_->getTH2F())->GetYaxis()->SetBinLabel(1,"Status");
912  (reportMap_->getTH2F())->SetMarkerSize(3);
913  (reportMap_->getTH2F())->SetOption("text90colz");
914  //(reportMap_->getTH2F())->SetOption("textcolz");
915  (reportMap_->getTH2F())->SetMinimum(-1);
916  (reportMap_->getTH2F())->SetMaximum(1);
917 
918  if (reportMapShift_)
920  reportMapShift_ = dqmStore_->book2D("reportSummaryMapShift","reportSummaryMapShift",
921  6,0,6,1,0,1);
922  (reportMapShift_->getTH2F())->GetXaxis()->SetBinLabel(1,"HB");
923  (reportMapShift_->getTH2F())->GetXaxis()->SetBinLabel(2,"HE");
924  (reportMapShift_->getTH2F())->GetXaxis()->SetBinLabel(3,"HO");
925  (reportMapShift_->getTH2F())->GetXaxis()->SetBinLabel(4,"HF");
926  (reportMapShift_->getTH2F())->GetXaxis()->SetBinLabel(5,"HO0");
927  (reportMapShift_->getTH2F())->GetXaxis()->SetBinLabel(6,"HO12");
928  (reportMapShift_->getTH2F())->GetYaxis()->SetBinLabel(1,"Status");
929  (reportMapShift_->getTH2F())->SetMarkerSize(3);
930  (reportMapShift_->getTH2F())->SetOption("text90colz");
931  //(reportMapShift_->getTH2F())->SetOption("textcolz");
932  (reportMapShift_->getTH2F())->SetMinimum(-1);
933  (reportMapShift_->getTH2F())->SetMaximum(1);
934 
935  // Set initial counters to -1 (unknown)
936  status_global_=-1;
937  status_HB_=-1;
938  status_HE_=-1;
939  status_HO_=-1;
940  status_HF_=-1;
941 
942  status_HO0_=-1;
943  status_HO12_=-1;
944  status_HFlumi_=-1;
945  for (int i=1;i<=(reportMap_->getTH2F())->GetNbinsX();++i)
946  reportMap_->setBinContent(i,1,-1);
947  for (int i=1;i<=(reportMapShift_->getTH2F())->GetNbinsX();++i)
949 } // void HcalSummaryClient::beginRun(void)
950 
951 
953 
956 
957 bool HcalSummaryClient::hasErrors_Temp(void){ return false;}
958 
959 bool HcalSummaryClient::hasWarnings_Temp(void){return false;}
960 bool HcalSummaryClient::hasOther_Temp(void){return false;}
961 bool HcalSummaryClient::test_enabled(void){return true;}
962 
963 void HcalSummaryClient::updateChannelStatus(std::map<HcalDetId, unsigned int>& myqual){return;}
964 
965 
967 {}
bool isHO(int etabin, int depth)
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
MonitorElement * ProblemCells
std::string name()
void setBinContent(int binx, double content)
set content of bin (1-D)
HcalSummaryClient()
Constructors.
std::map< std::string, int > subdetCells_
void updateChannelStatus(std::map< HcalDetId, unsigned int > &myqual)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:942
void fillReportSummaryLSbyLS(int LS)
void setup(DQMStore *&m_dbe, std::string Name, std::string Units="")
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
bool isHE(int etabin, int depth)
T eta() const
MonitorElement * StatusVsLS_
uint16_t size_type
MonitorElement * EnoughEvents_
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:879
void Fill(long long x)
std::vector< MonitorElement * > depth
int CalcIeta(int subdet, int eta, int depth)
const T & max(const T &a, const T &b)
EtaPhiHists * ProblemCellsByDepth
void removeElement(const std::string &name)
Definition: DQMStore.cc:3093
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
~HcalSummaryClient()
Destructor.
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1696
bool isHB(int etabin, int depth)
std::vector< HcalBaseDQClient * > clients_
bool isHF(int etabin, int depth)
constexpr char const * subdets[11]
int64_t getIntValue(void) const
EtaPhiHists * SummaryMapByDepth
std::string subdir_
void FillUnphysicalHEHFBins(std::vector< TH2F > &hh)
MonitorElement * MinEvents_
MonitorElement * certificationMap_
MonitorElement * reportMap_
MonitorElement * reportMapShift_
double getBinContent(int binx) const
get content of bin (1-D)
std::string prefixME_
tuple events
Definition: patZpeak.py:19
if(dp >Float(M_PI)) dp-
tuple cout
Definition: gather_cfg.py:121
virtual void analyze(void)
TH2F * getTH2F(void) const
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1070
void Reset(void)
reset ME (ie. contents, errors, etc)
DQMStore * dqmStore_
tuple size
Write out results.
MonitorElement * MinErrorRate_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
void fillReportSummary(int LS)
Definition: DDAxes.h:10