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