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