test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalDetDiagPedestalClient.cc
Go to the documentation of this file.
4 
8 
10 
11 #include <iostream>
12 
13 /*
14  * \file HcalDetDiagPedestalClient.cc
15  *
16  * \author J. Temple
17  * \brief Hcal DetDiagPedestal Client class
18  */
19 
20 
22 {
23  name_=myname; status=0;
24  needLogicalMap_=true;
25 }
26 
28 {
29  name_=myname;
30  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
31  debug_ = ps.getUntrackedParameter<int>("debug",0);
32  prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
33  if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
34  prefixME_.append("/");
35  subdir_ = ps.getUntrackedParameter<std::string>("DetDiagPedestalFolder","DetDiagPedestalMonitor_Hcal/"); // DetDiagPedestalMonitor_Hcal/
36  if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
37  subdir_.append("/");
38  subdir_=prefixME_+subdir_;
39 
40  validHtmlOutput_ = ps.getUntrackedParameter<bool>("DetDiagPedestal_validHtmlOutput",true);
41  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
42  badChannelStatusMask_ = ps.getUntrackedParameter<int>("DetDiagPedestal_BadChannelStatusMask",
43  ps.getUntrackedParameter<int>("BadChannelStatusMask",(1<<HcalChannelStatus::HcalCellDead)));
44 
45  minerrorrate_ = ps.getUntrackedParameter<double>("DetDiagPedestal_minerrorrate",
46  ps.getUntrackedParameter<double>("minerrorrate",0.05));
47  minevents_ = ps.getUntrackedParameter<int>("DetDiagPedestal_minevents",
48  ps.getUntrackedParameter<int>("minevents",1));
49  Online_ = ps.getUntrackedParameter<bool>("online",false);
50 
51  ProblemCells=0;
53  needLogicalMap_=true;
54 
55  doProblemCellSetup_ = true;
56 }
57 
59 {
60  if (debug_>2) std::cout <<"\tHcalDetDiagPedestalClient::analyze()"<<std::endl;
62  calculateProblems(ib,ig);
63 }
64 
66 {
67  if (debug_>2) std::cout <<"\t\tHcalDetDiagPedestalClient::calculateProblems()"<<std::endl;
68  double totalevents=0;
69  int etabins=0, phibins=0, zside=0;
70  double problemvalue=0;
71 
72  // Clear away old problems
73  if (ProblemCells!=0)
74  {
76  (ProblemCells->getTH2F())->SetMaximum(1.05);
77  (ProblemCells->getTH2F())->SetMinimum(0.);
78  }
79  for (unsigned int d=0;d<ProblemCellsByDepth->depth.size();++d)
80  {
81  if (ProblemCellsByDepth->depth[d]!=0)
82  {
83  ProblemCellsByDepth->depth[d]->Reset();
84  (ProblemCellsByDepth->depth[d]->getTH2F())->SetMaximum(1.05);
85  (ProblemCellsByDepth->depth[d]->getTH2F())->SetMinimum(0.);
86  }
87  }
88  enoughevents_=true;
89  // Get histograms that are used in testing
90  // currently none used,
91 
92  std::vector<std::string> name = HcalEtaPhiHistNames();
93 
94  // This is a sample of how to get a histogram from the task that can then be used for evaluation purposes
95  TH2F* PedestalsMissing[4];
96  TH2F* PedestalsUnstable[4];
97  TH2F* PedestalsBadMean[4];
98  TH2F* PedestalsBadRMS[4];
99  MonitorElement* me;
100  for (int i=0;i<4;++i)
101  {
102  // Assume that histograms aren't found
103  PedestalsMissing[i]=0;
104  PedestalsUnstable[i]=0;
105  PedestalsBadMean[i]=0;
106  PedestalsBadRMS[i]=0;
107  std::string s=subdir_+name[i]+" Problem Missing Channels";
108  me=ig.get(s.c_str());
109  if (me!=0) PedestalsMissing[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, PedestalsMissing[i], debug_);
110  else
111  {
112  if (debug_>0)
113  std::cout <<"<HcalDetDiagPedestalClient::calcluateProblems> could not get histogram '"<<s<<"'"<<std::endl;
114  }
115 
116  s=subdir_+name[i]+" Problem Unstable Channels";
117  me=ig.get(s.c_str());
118  if (me!=0) PedestalsUnstable[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, PedestalsUnstable[i], debug_);
119  else if (debug_>0) std::cout <<"<HcalDetDiagPedestalClient::calculateProblems> could not get histogram '"<<s<<"'"<<std::endl;
120  s=subdir_+name[i]+" Problem Bad Pedestal Value";
121  me=ig.get(s.c_str());
122  if (me!=0) PedestalsBadMean[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, PedestalsBadMean[i], debug_);
123  else if (debug_>0) std::cout <<"<HcalDetDiagPedestalClient::calculateProblems> could not get histogram '"<<s<<"'"<<std::endl;
124  s=subdir_+name[i]+" Problem Bad Rms Value";
125  me=ig.get(s.c_str());
126  if (me!=0) PedestalsBadRMS[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, PedestalsBadRMS[i], debug_);
127  else if (debug_>0) std::cout <<"<HcalDetDiagPedestalClient::calculateProblems> could not get histogram '"<<s<<"'"<<std::endl;
128  }
129 
130  // Because we're clearing and re-forming the problem cell histogram here, we don't need to do any cute
131  // setting of the underflow bin to 0, and we can plot results as a raw rate between 0-1.
132 
133  for (unsigned int d=0;d<ProblemCellsByDepth->depth.size();++d)
134  {
135  if (ProblemCellsByDepth->depth[d]==0) continue;
136 
137  //totalevents=DigiPresentByDepth[d]->GetBinContent(0);
138  totalevents=0;
139  // Check underflow bins for events processed
140  if (PedestalsMissing[d]!=0) totalevents = PedestalsMissing[d]->GetBinContent(0);
141  else if (PedestalsUnstable[d]!=0) totalevents = PedestalsUnstable[d]->GetBinContent(0);
142  else if (PedestalsBadMean[d]!=0) totalevents = PedestalsBadMean[d]->GetBinContent(0);
143  else if (PedestalsBadRMS[d]!=0) totalevents = PedestalsBadRMS[d]->GetBinContent(0);
144  //if (totalevents==0 || totalevents<minevents_) continue;
145 
146  totalevents=1; // temporary value pending removal of normalization from task
147  etabins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsX();
148  phibins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsY();
149  for (int eta=0;eta<etabins;++eta)
150  {
151  int ieta=CalcIeta(eta,d+1);
152  if (ieta==-9999) continue;
153  for (int phi=0;phi<phibins;++phi)
154  {
155  problemvalue=0;
156  if (PedestalsMissing[d]!=0) problemvalue += PedestalsMissing[d]->GetBinContent(eta+1,phi+1)*1./totalevents;
157  if (PedestalsUnstable[d]!=0) problemvalue += PedestalsUnstable[d]->GetBinContent(eta+1,phi+1)*1./totalevents;
158  if (PedestalsBadMean[d]!=0) problemvalue += PedestalsBadMean[d]->GetBinContent(eta+1,phi+1)*1./totalevents;
159  if (PedestalsBadRMS[d]!=0) problemvalue += PedestalsBadRMS[d]->GetBinContent(eta+1,phi+1)*1./totalevents;
160 
161  if (problemvalue==0) continue;
162  // problem value is a rate; we can normalize it here
163  problemvalue = std::min(1.,problemvalue);
164 
165  zside=0;
166  if (isHF(eta,d+1)) // shift ieta by 1 for HF
167  ieta<0 ? zside = -1 : zside = 1;
168 
169  // For problem cells that exceed our allowed rate,
170  // set the values to -1 if the cells are already marked in the status database
171  if (problemvalue>minerrorrate_)
172  {
173  HcalSubdetector subdet=HcalEmpty;
174  if (isHB(eta,d+1))subdet=HcalBarrel;
175  else if (isHE(eta,d+1)) subdet=HcalEndcap;
176  else if (isHF(eta,d+1)) subdet=HcalForward;
177  else if (isHO(eta,d+1)) subdet=HcalOuter;
178  HcalDetId hcalid(subdet, ieta, phi+1, (int)(d+1));
179  if (badstatusmap.find(hcalid)!=badstatusmap.end())
180  problemvalue=999;
181  }
182 
183  ProblemCellsByDepth->depth[d]->setBinContent(eta+1,phi+1,problemvalue);
184  if (ProblemCells!=0) ProblemCells->Fill(ieta+zside,phi+1,problemvalue);
185  } // loop on phi
186  } // loop on eta
187  } // loop on depth
188 
189  if (ProblemCells==0)
190  {
191  if (debug_>0) std::cout <<"<HcalDetDiagPedestalClient::analyze> ProblemCells histogram does not exist!"<<std::endl;
192  return;
193  }
194 
195  // Normalization of ProblemCell plot, in the case where there are errors in multiple depths
196  etabins=(ProblemCells->getTH2F())->GetNbinsX();
197  phibins=(ProblemCells->getTH2F())->GetNbinsY();
198  for (int eta=0;eta<etabins;++eta)
199  {
200  for (int phi=0;phi<phibins;++phi)
201  {
204  }
205  }
206 
209  return;
210 }
211 
213 
215 {
216 
218  problemnames_.clear();
219 
220  // Put the appropriate name of your problem summary here
221  ProblemCells=ib.book2D(" ProblemDetDiagPedestal",
222  " Problem DetDiagPedestal Rate for all HCAL;ieta;iphi",
223  85,-42.5,42.5,
224  72,0.5,72.5);
225  problemnames_.push_back(ProblemCells->getName());
226  if (debug_>1)
227  std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
228  ib.setCurrentFolder(subdir_+"problem_DetDiagPedestal");
230  ProblemCellsByDepth->setup(ib," Problem DetDiagPedestal Rate");
231  for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
232  problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
233 
234  doProblemCellSetup_ = false;
235 }
236 
238 {
239  enoughevents_=false;
240  nevts_=0;
241 }
242 
243 //void HcalDetDiagPedestalClient::endRun(void){analyze();}
244 
247 
249 {
250  if(status&2) return true;
251  return false;
252 
253  if (!ProblemCells)
254  {
255  if (debug_>1) std::cout <<"<HcalDetDiagPedestalClient::hasErrors_Temp> ProblemCells histogram does not exist!"<<std::endl;
256  return false;
257  }
258  int problemcount=0;
259  int ieta=-9999;
260 
261  for (int depth=0;depth<4; ++depth)
262  {
263  int etabins = (ProblemCells->getTH2F())->GetNbinsX();
264  int phibins = (ProblemCells->getTH2F())->GetNbinsY();
265  for (int hist_eta=0;hist_eta<etabins;++hist_eta)
266  {
267  for (int hist_phi=0; hist_phi<phibins;++hist_phi)
268  {
269  ieta=CalcIeta(hist_eta,depth+1);
270  if (ieta==-9999) continue;
272  continue;
273  if (ProblemCellsByDepth->depth[depth]->getBinContent(hist_eta,hist_phi)>minerrorrate_)
274  ++problemcount;
275 
276  } // for (int hist_phi=1;...)
277  } // for (int hist_eta=1;...)
278  } // for (int depth=0;...)
279 
280  if (problemcount>0) return true;
281  return false;
282 }
283 
285  if(status&1) return true;
286  return false;
287 }
290 
291 
292 void HcalDetDiagPedestalClient::updateChannelStatus(std::map<HcalDetId, unsigned int>& myqual)
293 {
294  // This gets called by HcalMonitorClient
295  // trigger primitives don't yet contribute to channel status (though they could...)
296  // see dead or hot cell code for an example
297 
298 } //void HcalDetDiagPedestalClient::updateChannelStatus
299 
300 static void printTableHeader(std::ofstream& file,std::string header){
301  file << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">"<< std::endl;
302  file << "<head>"<< std::endl;
303  file << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>"<< std::endl;
304  file << "<title>"<< header <<"</title>"<< std::endl;
305  file << "<style type=\"text/css\">"<< std::endl;
306  file << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"<< std::endl;
307  file << " td.s0 { font-family: arial, arial ce, helvetica; }"<< std::endl;
308  file << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< std::endl;
309  file << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }"<< std::endl;
310  file << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }"<< std::endl;
311  file << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }"<< std::endl;
312  file << "</style>"<< std::endl;
313  file << "<body>"<< std::endl;
314  file << "<table>"<< std::endl;
315 }
316 
317 static void printTableLine(std::ofstream& file,int ind,HcalDetId& detid,HcalFrontEndId& lmap_entry,HcalElectronicsId &emap_entry,std::string comment=""){
318  if(ind==0){
319  file << "<tr>";
320  file << "<td class=\"s4\" align=\"center\">#</td>" << std::endl;
321  file << "<td class=\"s1\" align=\"center\">ETA</td>" << std::endl;
322  file << "<td class=\"s1\" align=\"center\">PHI</td>" << std::endl;
323  file << "<td class=\"s1\" align=\"center\">DEPTH</td>"<< std::endl;
324  file << "<td class=\"s1\" align=\"center\">RBX</td>" << std::endl;
325  file << "<td class=\"s1\" align=\"center\">RM</td>" << std::endl;
326  file << "<td class=\"s1\" align=\"center\">PIXEL</td>" << std::endl;
327  file << "<td class=\"s1\" align=\"center\">RM_FIBER</td>" << std::endl;
328  file << "<td class=\"s1\" align=\"center\">FIBER_CH</td>" << std::endl;
329  file << "<td class=\"s1\" align=\"center\">QIE</td>" << std::endl;
330  file << "<td class=\"s1\" align=\"center\">ADC</td>" << std::endl;
331  file << "<td class=\"s1\" align=\"center\">CRATE</td>" << std::endl;
332  file << "<td class=\"s1\" align=\"center\">DCC</td>" << std::endl;
333  file << "<td class=\"s1\" align=\"center\">SPIGOT</td>" << std::endl;
334  file << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>" << std::endl;
335  file << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>" << std::endl;
336  file << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>" << std::endl;
337  if(comment[0]!=0) file << "<td class=\"s1\" align=\"center\">Comment</td>" << std::endl;
338  file << "</tr>" << std::endl;
339  }
340  std::string raw_class;
341  file << "<tr>"<< std::endl;
342  if((ind%2)==1){
343  raw_class="<td class=\"s2\" align=\"center\">";
344  }else{
345  raw_class="<td class=\"s3\" align=\"center\">";
346  }
347  file << "<td class=\"s4\" align=\"center\">" << ind+1 <<"</td>"<< std::endl;
348  file << raw_class<< detid.ieta()<<"</td>"<< std::endl;
349  file << raw_class<< detid.iphi()<<"</td>"<< std::endl;
350  file << raw_class<< detid.depth() <<"</td>"<< std::endl;
351  file << raw_class<< lmap_entry.rbx()<<"</td>"<< std::endl;
352  file << raw_class<< lmap_entry.rm() <<"</td>"<< std::endl;
353  file << raw_class<< lmap_entry.pixel()<<"</td>"<< std::endl;
354  file << raw_class<< lmap_entry.rmFiber() <<"</td>"<< std::endl;
355  file << raw_class<< lmap_entry.fiberChannel()<<"</td>"<< std::endl;
356  file << raw_class<< lmap_entry.qieCard() <<"</td>"<< std::endl;
357  file << raw_class<< lmap_entry.adc()<<"</td>"<< std::endl;
358  file << raw_class<< emap_entry.readoutVMECrateId()<<"</td>"<< std::endl;
359  file << raw_class<< emap_entry.dccid()<<"</td>"<< std::endl;
360  file << raw_class<< emap_entry.spigot()<<"</td>"<< std::endl;
361  file << raw_class<< emap_entry.fiberIndex()<<"</td>"<< std::endl;
362  file << raw_class<< emap_entry.htrSlot()<<"</td>"<< std::endl;
363  file << raw_class<< emap_entry.htrTopBottom()<<"</td>"<< std::endl;
364  if(comment[0]!=0) file << raw_class<< comment<<"</td>"<< std::endl;
365 }
366 static void printTableTail(std::ofstream& file){
367  file << "</table>"<< std::endl;
368  file << "</body>"<< std::endl;
369  file << "</html>"<< std::endl;
370 }
371 
373  std::string s=subdir_+"HcalDetDiagPedestalMonitor Event Number";
374  MonitorElement *me = ig.get(s.c_str());
375  int n=0;
376  if ( me ) {
377  s = me->valueString();
378  sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &n);
379  }
380  if(n<100) return false;
381  return true;
382 }
383 
385 int MissingCnt=0,UnstableCnt=0,BadCnt=0;
386 int HBP[4]={0,0,0,0},HBM[4]={0,0,0,0},HEP[4]={0,0,0,0},HEM[4]={0,0,0,0},HFP[4]={0,0,0,0},HFM[4]={0,0,0,0},HO[4] ={0,0,0,0};
387 int newHBP[4]={0,0,0,0},newHBM[4]={0,0,0,0},newHEP[4]={0,0,0,0},newHEM[4]={0,0,0,0};
388 int newHFP[4]={0,0,0,0},newHFM[4]={0,0,0,0},newHO[4] ={0,0,0,0};
389  if (debug_>0) std::cout << "<HcalDetDiagPedestalClient::htmlOutput> Preparing html output ..." << std::endl;
390 
392  TH2F *Missing_val[4],*Unstable_val[4],*BadPed_val[4],*BadRMS_val[4];
393  MonitorElement* me;
394 
395 
396  TH1F *PedestalsAve4HB=0;
397  TH1F *PedestalsAve4HE=0;
398  TH1F *PedestalsAve4HO=0;
399  TH1F *PedestalsAve4HF=0;
400  TH1F *PedestalsAve4Simp=0;
401 
402  TH1F *PedestalsAve4HBref=0;
403  TH1F *PedestalsAve4HEref=0;
404  TH1F *PedestalsAve4HOref=0;
405  TH1F *PedestalsAve4HFref=0;
406  TH1F *PedestalsRmsHB=0;
407  TH1F *PedestalsRmsHE=0;
408  TH1F *PedestalsRmsHO=0;
409  TH1F *PedestalsRmsHF=0;
410  TH1F *PedestalsRmsSimp=0;
411 
412  TH1F *PedestalsRmsHBref=0;
413  TH1F *PedestalsRmsHEref=0;
414  TH1F *PedestalsRmsHOref=0;
415  TH1F *PedestalsRmsHFref=0;
416 
417  TH2F *Pedestals2DRmsHBHEHF=0;
418  TH2F *Pedestals2DRmsHO=0;
419  TH2F *Pedestals2DHBHEHF=0;
420  TH2F *Pedestals2DHO=0;
421  TH2F *Pedestals2DErrorHBHEHF=0;
422  TH2F *Pedestals2DErrorHO=0;
423 
424  std::string s=subdir_+"Summary Plots/HB Pedestal Distribution (average over 4 caps)"; me=ig.get(s.c_str());
425  if(me!=0) PedestalsAve4HB=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4HB, debug_); else return;
426  s=subdir_+"Summary Plots/HE Pedestal Distribution (average over 4 caps)"; me=ig.get(s.c_str());
427  if(me!=0) PedestalsAve4HE=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4HE, debug_); else return;
428  s=subdir_+"Summary Plots/HO Pedestal Distribution (average over 4 caps)"; me=ig.get(s.c_str());
429  if(me!=0) PedestalsAve4HO=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4HO, debug_); else return;
430  s=subdir_+"Summary Plots/HF Pedestal Distribution (average over 4 caps)"; me=ig.get(s.c_str());
431  if(me!=0) PedestalsAve4HF=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4HF, debug_); else return;
432  s=subdir_+"Summary Plots/SIPM Pedestal Distribution (average over 4 caps)"; me=ig.get(s.c_str());
433  if(me!=0) PedestalsAve4Simp=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4Simp, debug_); else return;
434 
435  s=subdir_+"Summary Plots/HB Pedestal-Reference Distribution (average over 4 caps)"; me=ig.get(s.c_str());
436  if(me!=0) PedestalsAve4HBref=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4HBref, debug_); else return;
437  s=subdir_+"Summary Plots/HE Pedestal-Reference Distribution (average over 4 caps)"; me=ig.get(s.c_str());
438  if(me!=0) PedestalsAve4HEref=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4HEref, debug_); else return;
439  s=subdir_+"Summary Plots/HO Pedestal-Reference Distribution (average over 4 caps)"; me=ig.get(s.c_str());
440  if(me!=0) PedestalsAve4HOref=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4HOref, debug_); else return;
441  s=subdir_+"Summary Plots/HF Pedestal-Reference Distribution (average over 4 caps)"; me=ig.get(s.c_str());
442  if(me!=0) PedestalsAve4HFref=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsAve4HFref, debug_); else return;
443 
444  s=subdir_+"Summary Plots/HB Pedestal RMS Distribution (individual cap)"; me=ig.get(s.c_str());
445  if(me!=0) PedestalsRmsHB=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsHB, debug_); else return;
446  s=subdir_+"Summary Plots/HE Pedestal RMS Distribution (individual cap)"; me=ig.get(s.c_str());
447  if(me!=0) PedestalsRmsHE=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsHE, debug_); else return;
448  s=subdir_+"Summary Plots/HO Pedestal RMS Distribution (individual cap)"; me=ig.get(s.c_str());
449  if(me!=0) PedestalsRmsHO=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsHO, debug_); else return;
450  s=subdir_+"Summary Plots/HF Pedestal RMS Distribution (individual cap)"; me=ig.get(s.c_str());
451  if(me!=0) PedestalsRmsHF=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsHF, debug_); else return;
452  s=subdir_+"Summary Plots/SIPM Pedestal RMS Distribution (individual cap)"; me=ig.get(s.c_str());
453  if(me!=0) PedestalsRmsSimp=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsSimp, debug_); else return;
454 
455  s=subdir_+"Summary Plots/HB Pedestal_rms-Reference_rms Distribution"; me=ig.get(s.c_str());
456  if(me!=0) PedestalsRmsHBref=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsHBref, debug_); else return;
457  s=subdir_+"Summary Plots/HE Pedestal_rms-Reference_rms Distribution"; me=ig.get(s.c_str());
458  if(me!=0) PedestalsRmsHEref=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsHEref, debug_); else return;
459  s=subdir_+"Summary Plots/HO Pedestal_rms-Reference_rms Distribution"; me=ig.get(s.c_str());
460  if(me!=0) PedestalsRmsHOref=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsHOref, debug_); else return;
461  s=subdir_+"Summary Plots/HF Pedestal_rms-Reference_rms Distribution"; me=ig.get(s.c_str());
462  if(me!=0) PedestalsRmsHFref=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, PedestalsRmsHFref, debug_); else return;
463 
464  s=subdir_+"Summary Plots/HBHEHF pedestal mean map"; me=ig.get(s.c_str());
465  if(me!=0) Pedestals2DHBHEHF=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Pedestals2DHBHEHF, debug_); else return;
466  s=subdir_+"Summary Plots/HO pedestal mean map"; me=ig.get(s.c_str());
467  if(me!=0) Pedestals2DHO=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Pedestals2DHO, debug_); else return;
468  s=subdir_+"Summary Plots/HBHEHF pedestal rms map"; me=ig.get(s.c_str());
469  if(me!=0) Pedestals2DRmsHBHEHF=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Pedestals2DRmsHBHEHF, debug_); else return;
470  s=subdir_+"Summary Plots/HO pedestal rms map"; me=ig.get(s.c_str());
471  if(me!=0) Pedestals2DRmsHO=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Pedestals2DRmsHO, debug_); else return;
472  s=subdir_+"Summary Plots/HBHEHF pedestal problems map"; me=ig.get(s.c_str());
473  if(me!=0) Pedestals2DErrorHBHEHF=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Pedestals2DErrorHBHEHF, debug_); else return;
474  s=subdir_+"Summary Plots/HO pedestal problems map"; me=ig.get(s.c_str());
475  if(me!=0) Pedestals2DErrorHO=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Pedestals2DErrorHO, debug_); else return;
476 
477 
478  std::vector<std::string> name = HcalEtaPhiHistNames();
479  for(int i=0;i<4;++i){
480  Missing_val[i]=Unstable_val[i]=BadPed_val[i]=BadRMS_val[i]=0;
481  std::string s=subdir_+"Plots for client/"+name[i]+" Missing channels";
482  me=ig.get(s.c_str());
483  if (me!=0) Missing_val[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Missing_val[i], debug_); else return;
484  s=subdir_+"Plots for client/"+name[i]+" Channel instability value";
485  me=ig.get(s.c_str());
486  if (me!=0) Unstable_val[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Unstable_val[i], debug_); else return;
487  s=subdir_+"Plots for client/"+name[i]+" Bad Pedestal-Ref Value";
488  me=ig.get(s.c_str());
489  if (me!=0) BadPed_val[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, BadPed_val[i], debug_); else return;
490  s=subdir_+"Plots for client/"+name[i]+" Bad Rms-ref Value";
491  me=ig.get(s.c_str());
492  if (me!=0) BadRMS_val[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, BadRMS_val[i], debug_); else return;
493  }
494  // Calculate problems
495  for(int d=0;d<4;++d){
496  int etabins=Missing_val[d]->GetNbinsX();
497  int phibins=Missing_val[d]->GetNbinsY();
498  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
499  int ieta=CalcIeta(eta,d+1);
500  if(ieta==-9999) continue;
501  HcalSubdetector subdet=HcalEmpty;
502  if(isHB(eta,d+1))subdet=HcalBarrel;
503  else if (isHE(eta,d+1)) subdet=HcalEndcap;
504  else if (isHF(eta,d+1)) subdet=HcalForward;
505  else if (isHO(eta,d+1)) subdet=HcalOuter;
506  HcalDetId hcalid(subdet, ieta, phi+1, (int)(d+1));
507  float val=Missing_val[d]->GetBinContent(eta+1,phi+1);
508  if(val!=0){
509  if(subdet==HcalBarrel){
510  if(ieta>0){ HBP[0]++;}else{ HBM[0]++;} MissingCnt++;
511  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHBP[0]++;}else{ newHBM[0]++;}}
512  }
513  if(subdet==HcalEndcap){
514  if(ieta>0){ HEP[0]++;}else{ HEM[0]++;} MissingCnt++;
515  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHEP[0]++;}else{ newHEM[0]++;}}
516  }
517  if(subdet==HcalForward){
518  if(ieta>0){ HFP[0]++;}else{ HFM[0]++;} MissingCnt++;
519  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHFP[0]++;}else{ newHFM[0]++;}}
520  }
521  if(subdet==HcalOuter){
522  HO[0]++;MissingCnt++;
523  if(badstatusmap.find(hcalid)==badstatusmap.end()){newHO[0]++;}
524  }
525  }
526  val=Unstable_val[d]->GetBinContent(eta+1,phi+1);
527  if(val!=0){
528  if(subdet==HcalBarrel){
529  if(ieta>0){ HBP[1]++;}else{ HBM[1]++;} UnstableCnt++;
530  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHBP[1]++;}else{ newHBM[1]++;}}
531  }
532  if(subdet==HcalEndcap){
533  if(ieta>0){ HEP[1]++;}else{ HEM[1]++;} UnstableCnt++;
534  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHEP[1]++;}else{ newHEM[1]++;}}
535  }
536  if(subdet==HcalForward){
537  if(ieta>0){ HFP[1]++;}else{ HFM[1]++;} UnstableCnt++;
538  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHFP[1]++;}else{ newHFM[1]++;}}
539  }
540  if(subdet==HcalOuter){
541  HO[1]++;UnstableCnt++;
542  if(badstatusmap.find(hcalid)==badstatusmap.end()){newHO[1]++;}
543  }
544  }
545  val=BadPed_val[d]->GetBinContent(eta+1,phi+1);
546  if(val!=0){
547  if(subdet==HcalBarrel){
548  if(ieta>0){ HBP[2]++;}else{ HBM[2]++;} BadCnt++;
549  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHBP[2]++;}else{ newHBM[2]++;}}
550  }
551  if(subdet==HcalEndcap){
552  if(ieta>0){ HEP[2]++;}else{ HEM[2]++;} BadCnt++;
553  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHEP[2]++;}else{ newHEM[2]++;}}
554  }
555  if(subdet==HcalForward){
556  if(ieta>0){ HFP[2]++;}else{ HFM[2]++;} BadCnt++;
557  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHFP[2]++;}else{ newHFM[2]++;}}
558  }
559  if(subdet==HcalOuter){
560  HO[2]++;BadCnt++;
561  if(badstatusmap.find(hcalid)==badstatusmap.end()){newHO[2]++;}
562  }
563  }
564  val=BadRMS_val[d]->GetBinContent(eta+1,phi+1);
565  if(val!=0){
566  if(subdet==HcalBarrel){
567  if(ieta>0){ HBP[3]++;}else{ HBM[3]++;} BadCnt++;
568  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHBP[3]++;}else{ newHBM[3]++;}}
569  }
570  if(subdet==HcalEndcap){
571  if(ieta>0){ HEP[3]++;}else{ HEM[3]++;} BadCnt++;
572  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHEP[3]++;}else{ newHEM[3]++;}}
573  }
574  if(subdet==HcalForward){
575  if(ieta>0){ HFP[3]++;}else{ HFM[3]++;} BadCnt++;
576  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHFP[3]++;}else{ newHFM[3]++;}}
577  }
578  if(subdet==HcalOuter){
579  HO[3]++;BadCnt++;
580  if(badstatusmap.find(hcalid)==badstatusmap.end()){newHO[3]++;}
581  }
582  }
583  }
584  }
585 
586 
587  std::ofstream badMissing;
588  badMissing.open((htmlDir+"bad_missing_table.html").c_str());
589  printTableHeader(badMissing,"Missing Channels list");
590  std::ofstream badUnstable;
591  badUnstable.open((htmlDir+"bad_unstable_table.html").c_str());
592  printTableHeader(badUnstable,"Unstable Channels list");
593  std::ofstream badPedRMS;
594  badPedRMS.open((htmlDir+"bad_badpedrms_table.html").c_str());
595  printTableHeader(badPedRMS,"Missing Channels list");
596 
597  int cnt=0;
598  if((HBP[0]+HBP[0])>0 && (HBM[0]+HBP[0])!=(1296*2)){
599  badMissing << "<tr><td align=\"center\"><h3>"<< "HB" <<"</h3></td></tr>" << std::endl;
600  for(int d=0;d<4;++d){
601  int etabins=Missing_val[d]->GetNbinsX();
602  int phibins=Missing_val[d]->GetNbinsY();
603  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
604  int ieta=CalcIeta(eta,d+1);
605  if(ieta==-9999) continue;
606  if(!isHB(eta,d+1)) continue;
607  float val=Missing_val[d]->GetBinContent(eta+1,phi+1);
608  if(val==0) continue;
609  HcalDetId hcalid(HcalBarrel,ieta,phi+1,d+1);
610  std::string s=" ";
611  if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s="Known problem";}
612  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
613  HcalElectronicsId emap_entry=emap.lookup(hcalid);
614  printTableLine(badMissing,cnt++,hcalid,lmap_entry,emap_entry,s);
615  }
616  }
617  }
618  cnt=0;
619  if((HEP[0]+HEP[0])>0 && (HEM[0]+HEP[0])!=(1296*2)){
620  badMissing << "<tr><td align=\"center\"><h3>"<< "HE" <<"</h3></td></tr>" << std::endl;
621  for(int d=0;d<4;++d){
622  int etabins=Missing_val[d]->GetNbinsX();
623  int phibins=Missing_val[d]->GetNbinsY();
624  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
625  int ieta=CalcIeta(eta,d+1);
626  if(ieta==-9999) continue;
627  if(!isHE(eta,d+1)) continue;
628  float val=Missing_val[d]->GetBinContent(eta+1,phi+1);
629  if(val==0) continue;
630  HcalDetId hcalid(HcalEndcap,ieta,phi+1,d+1);
631  std::string s=" ";
632  if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s="Known problem";}
633  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
634  HcalElectronicsId emap_entry=emap.lookup(hcalid);
635  printTableLine(badMissing,cnt++,hcalid,lmap_entry,emap_entry,s);
636  }
637  }
638  }
639  cnt=0;
640  if(HO[0]>0 && HO[0]!=2160){
641  badMissing << "<tr><td align=\"center\"><h3>"<< "HO" <<"</h3></td></tr>" << std::endl;
642  for(int d=0;d<4;++d){
643  int etabins=Missing_val[d]->GetNbinsX();
644  int phibins=Missing_val[d]->GetNbinsY();
645  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
646  int ieta=CalcIeta(eta,d+1);
647  if(ieta==-9999) continue;
648  if(!isHO(eta,d+1)) continue;
649  float val=Missing_val[d]->GetBinContent(eta+1,phi+1);
650  if(val==0) continue;
651  HcalDetId hcalid(HcalOuter,ieta,phi+1,d+1);
652  std::string s=" ";
653  if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s="Known problem";}
654  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
655  HcalElectronicsId emap_entry=emap.lookup(hcalid);
656  printTableLine(badMissing,cnt++,hcalid,lmap_entry,emap_entry,s);
657  }
658  }
659  }
660  cnt=0;
661  if((HFP[0]+HFP[0])>0 && (HFM[0]+HFP[0])!=(864*2)){
662  badMissing << "<tr><td align=\"center\"><h3>"<< "HF" <<"</h3></td></tr>" << std::endl;
663  for(int d=0;d<4;++d){
664  int etabins=Missing_val[d]->GetNbinsX();
665  int phibins=Missing_val[d]->GetNbinsY();
666  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
667  int ieta=CalcIeta(eta,d+1);
668  if(ieta==-9999) continue;
669  if(!isHF(eta,d+1)) continue;
670  float val=Missing_val[d]->GetBinContent(eta+1,phi+1);
671  if(val==0) continue;
672  HcalDetId hcalid(HcalForward,ieta,phi+1,d+1);
673  std::string s=" ";
674  if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s="Known problem";}
675  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
676  HcalElectronicsId emap_entry=emap.lookup(hcalid);
677  printTableLine(badMissing,cnt++,hcalid,lmap_entry,emap_entry,s);
678  }
679  }
680  }
682  cnt=0;
683  if((HBP[1]+HBP[1])>0){
684  badUnstable << "<tr><td align=\"center\"><h3>"<< "HB" <<"</h3></td></tr>" << std::endl;
685  for(int d=0;d<4;++d){
686  int etabins=Unstable_val[d]->GetNbinsX();
687  int phibins=Unstable_val[d]->GetNbinsY();
688  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
689  int ieta=CalcIeta(eta,d+1);
690  if(ieta==-9999) continue;
691  if(!isHB(eta,d+1)) continue;
692  float val=Unstable_val[d]->GetBinContent(eta+1,phi+1);
693  if(val==0) continue;
694  HcalDetId hcalid(HcalBarrel,ieta,phi+1,d+1);
695  char comment[100]; sprintf(comment,"Missing in %.3f%% of events\n",(1.0-val)*100.0);
697  if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s+=",Known problem";}
698  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
699  HcalElectronicsId emap_entry=emap.lookup(hcalid);
700  printTableLine(badUnstable,cnt++,hcalid,lmap_entry,emap_entry,s);
701  }
702  }
703  }
704  cnt=0;
705  if((HEP[1]+HEP[1])>0){
706  badUnstable << "<tr><td align=\"center\"><h3>"<< "HE" <<"</h3></td></tr>" << std::endl;
707  for(int d=0;d<4;++d){
708  int etabins=Unstable_val[d]->GetNbinsX();
709  int phibins=Unstable_val[d]->GetNbinsY();
710  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
711  int ieta=CalcIeta(eta,d+1);
712  if(ieta==-9999) continue;
713  if(!isHE(eta,d+1)) continue;
714  float val=Unstable_val[d]->GetBinContent(eta+1,phi+1);
715  if(val==0) continue;
716  HcalDetId hcalid(HcalEndcap,ieta,phi+1,d+1);
717  char comment[100]; sprintf(comment,"Missing in %.3f%% of events\n",(1.0-val)*100.0);
719  if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s+=",Known problem";}
720  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
721  HcalElectronicsId emap_entry=emap.lookup(hcalid);
722  printTableLine(badUnstable,cnt++,hcalid,lmap_entry,emap_entry,s);
723  }
724  }
725  }
726  cnt=0;
727  if(HO[1]>0){
728  badUnstable << "<tr><td align=\"center\"><h3>"<< "HO" <<"</h3></td></tr>" << std::endl;
729  for(int d=0;d<4;++d){
730  int etabins=Unstable_val[d]->GetNbinsX();
731  int phibins=Unstable_val[d]->GetNbinsY();
732  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
733  int ieta=CalcIeta(eta,d+1);
734  if(ieta==-9999) continue;
735  if(!isHO(eta,d+1)) continue;
736  float val=Unstable_val[d]->GetBinContent(eta+1,phi+1);
737  if(val==0) continue;
738  HcalDetId hcalid(HcalOuter,ieta,phi+1,d+1);
739  char comment[100]; sprintf(comment,"Missing in %.3f%% of events\n",(1.0-val)*100.0);
741  if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s+=",Known problem";}
742  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
743  HcalElectronicsId emap_entry=emap.lookup(hcalid);
744  printTableLine(badUnstable,cnt++,hcalid,lmap_entry,emap_entry,s);
745  }
746  }
747  }
748  cnt=0;
749  if((HFP[1]+HFP[1])>0){
750  badUnstable << "<tr><td align=\"center\"><h3>"<< "HF" <<"</h3></td></tr>" << std::endl;
751  for(int d=0;d<4;++d){
752  int etabins=Unstable_val[d]->GetNbinsX();
753  int phibins=Unstable_val[d]->GetNbinsY();
754  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
755  int ieta=CalcIeta(eta,d+1);
756  if(ieta==-9999) continue;
757  if(!isHF(eta,d+1)) continue;
758  float val=Unstable_val[d]->GetBinContent(eta+1,phi+1);
759  if(val==0) continue;
760  HcalDetId hcalid(HcalForward,ieta,phi+1,d+1);
761  char comment[100]; sprintf(comment,"Missing in %.3f%% of events\n",(1.0-val)*100.0);
763  if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s+=",Known problem";}
764  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
765  HcalElectronicsId emap_entry=emap.lookup(hcalid);
766  printTableLine(badUnstable,cnt++,hcalid,lmap_entry,emap_entry,s);
767  }
768  }
769  }
771  cnt=0;
772  if((HBP[2]+HBP[2]+HBP[3]+HBP[3])>0){
773  badPedRMS << "<tr><td align=\"center\"><h3>"<< "HB" <<"</h3></td></tr>" << std::endl;
774  for(int d=0;d<4;++d){
775  int etabins=BadPed_val[d]->GetNbinsX();
776  int phibins=BadPed_val[d]->GetNbinsY();
777  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
778  int ieta=CalcIeta(eta,d+1);
779  if(ieta==-9999) continue;
780  if(!isHB(eta,d+1)) continue;
781  float val1=BadPed_val[d]->GetBinContent(eta+1,phi+1);
782  float val2=BadRMS_val[d]->GetBinContent(eta+1,phi+1);
783  if(val1==0 && val2==0) continue;
784  HcalDetId hcalid(HcalBarrel,ieta,phi+1,d+1);
785  char comment[100];
786  if(val1!=0) sprintf(comment,"Ped-Ref=%.2f",val1);
787  if(val2!=0) sprintf(comment,"Rms-Ref=%.2f",val2);
788  if(val1!=0 && val2!=0) sprintf(comment,"Ped-Ref=%.2f,Rms-Ref=%.2f",val1,val2);
790  if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s+=",Known problem";}
791  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
792  HcalElectronicsId emap_entry=emap.lookup(hcalid);
793  printTableLine(badPedRMS,cnt++,hcalid,lmap_entry,emap_entry,s);
794  }
795  }
796  }
797  cnt=0;
798  if((HEP[2]+HEP[2]+HEP[3]+HEP[3])>0){
799  badPedRMS << "<tr><td align=\"center\"><h3>"<< "HE" <<"</h3></td></tr>" << std::endl;
800  for(int d=0;d<4;++d){
801  int etabins=BadPed_val[d]->GetNbinsX();
802  int phibins=BadPed_val[d]->GetNbinsY();
803  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
804  int ieta=CalcIeta(eta,d+1);
805  if(ieta==-9999) continue;
806  if(!isHE(eta,d+1)) continue;
807  float val1=BadPed_val[d]->GetBinContent(eta+1,phi+1);
808  float val2=BadRMS_val[d]->GetBinContent(eta+1,phi+1);
809  if(val1==0 && val2==0) continue;
810  HcalDetId hcalid(HcalEndcap,ieta,phi+1,d+1);
811  char comment[100];
812  if(val1!=0) sprintf(comment,"Ped-Ref=%.2f",val1);
813  if(val2!=0) sprintf(comment,"Rms-Ref=%.2f",val2);
814  if(val1!=0 && val2!=0) sprintf(comment,"Ped-Ref=%.2f,Rms-Ref=%.2f",val1,val2);
816  if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s+=",Known problem";}
817  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
818  HcalElectronicsId emap_entry=emap.lookup(hcalid);
819  printTableLine(badPedRMS,cnt++,hcalid,lmap_entry,emap_entry,s);
820  }
821  }
822  }
823  cnt=0;
824  if((HO[2]+HO[3])>0){
825  badPedRMS << "<tr><td align=\"center\"><h3>"<< "HO" <<"</h3></td></tr>" << std::endl;
826  for(int d=0;d<4;++d){
827  int etabins=BadPed_val[d]->GetNbinsX();
828  int phibins=BadPed_val[d]->GetNbinsY();
829  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
830  int ieta=CalcIeta(eta,d+1);
831  if(ieta==-9999) continue;
832  if(!isHO(eta,d+1)) continue;
833  float val1=BadPed_val[d]->GetBinContent(eta+1,phi+1);
834  float val2=BadRMS_val[d]->GetBinContent(eta+1,phi+1);
835  if(val1==0 && val2==0) continue;
836  HcalDetId hcalid(HcalOuter,ieta,phi+1,d+1);
837  char comment[100];
838  if(val1!=0) sprintf(comment,"Ped-Ref=%.2f",val1);
839  if(val2!=0) sprintf(comment,"Rms-Ref=%.2f",val2);
840  if(val1!=0 && val2!=0) sprintf(comment,"Ped-Ref=%.2f,Rms-Ref=%.2f",val1,val2);
842  if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s+=",Known problem";}
843  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
844  HcalElectronicsId emap_entry=emap.lookup(hcalid);
845  printTableLine(badPedRMS,cnt++,hcalid,lmap_entry,emap_entry,s);
846  }
847  }
848  }
849  cnt=0;
850  if((HFP[2]+HFP[2]+HFP[3]+HFP[3])>0){
851  badPedRMS << "<tr><td align=\"center\"><h3>"<< "HF" <<"</h3></td></tr>" << std::endl;
852  for(int d=0;d<4;++d){
853  int etabins=BadPed_val[d]->GetNbinsX();
854  int phibins=BadPed_val[d]->GetNbinsY();
855  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
856  int ieta=CalcIeta(eta,d+1);
857  if(ieta==-9999) continue;
858  if(!isHF(eta,d+1)) continue;
859  float val1=BadPed_val[d]->GetBinContent(eta+1,phi+1);
860  float val2=BadRMS_val[d]->GetBinContent(eta+1,phi+1);
861  if(val1==0 && val2==0) continue;
862  HcalDetId hcalid(HcalForward,ieta,phi+1,d+1);
863  char comment[100];
864  if(val1!=0) sprintf(comment,"Ped-Ref=%.2f",val1);
865  if(val2!=0) sprintf(comment,"Rms-Ref=%.2f",val2);
866  if(val1!=0 && val2!=0) sprintf(comment,"Ped-Ref=%.2f,Rms-Ref=%.2f",val1,val2);
868  if(badstatusmap.find(hcalid)!=badstatusmap.end()){ s+=",Known problem";}
869  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
870  HcalElectronicsId emap_entry=emap.lookup(hcalid);
871  printTableLine(badPedRMS,cnt++,hcalid,lmap_entry,emap_entry,s);
872  }
873  }
874  }
875 
876  printTableTail(badMissing);
877  badMissing.close();
878  printTableTail(badUnstable);
879  badUnstable.close();
880  printTableTail(badPedRMS);
881  badPedRMS.close();
882 
883  int ievt_ = -1,runNo=-1;
884  std::string ref_run;
885  s=subdir_+"HcalDetDiagPedestalMonitor Event Number";
886  me = ig.get(s.c_str());
887  if ( me ) {
888  s = me->valueString();
889  sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &ievt_);
890  }
891  s=subdir_+"HcalDetDiagPedestalMonitor Run Number";
892  me = ig.get(s.c_str());
893  if ( me ) {
894  s = me->valueString();
895  sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &runNo);
896  }
897  s=subdir_+"HcalDetDiagLaserMonitor Reference Run";
898  me = ig.get(s.c_str());
899  if(me) {
900  std::string s=me->valueString();
901  char str[200];
902  sscanf((s.substr(2,s.length()-2)).c_str(), "%s", str);
903  ref_run=str;
904  }
905 
906  gROOT->SetBatch(true);
907  gStyle->SetCanvasColor(0);
908  gStyle->SetPadColor(0);
909  gStyle->SetOptStat(111110);
910  gStyle->SetPalette(1);
911 
912  TCanvas *can=new TCanvas("HcalDetDiagPedestalClient","HcalDetDiagPedestalClient",0,0,500,350);
913  can->cd();
914 
915  std::ofstream htmlFile;
916  std::string outfile=htmlDir+name_+".html";
917  htmlFile.open(outfile.c_str());
918  // html page header
919  htmlFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> " << std::endl;
920  htmlFile << "<html> " << std::endl;
921  htmlFile << "<head> " << std::endl;
922  htmlFile << " <meta content=\"text/html; charset=ISO-8859-1\" " << std::endl;
923  htmlFile << " http-equiv=\"content-type\"> " << std::endl;
924  htmlFile << " <title>Detector Diagnostics Pedestal Monitor</title> " << std::endl;
925  htmlFile << "</head> " << std::endl;
926  htmlFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << std::endl;
927  htmlFile << "<style type=\"text/css\">"<< std::endl;
928  htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FF7700; text-align: center;}"<< std::endl;
929  htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< std::endl;
930  htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: red; }"<< std::endl;
931  htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: yellow; }"<< std::endl;
932  htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: green; }"<< std::endl;
933  htmlFile << " td.s5 { font-family: arial, arial ce, helvetica; background-color: silver; }"<< std::endl;
934  std::string state[4]={"<td class=\"s2\" align=\"center\">",
935  "<td class=\"s3\" align=\"center\">",
936  "<td class=\"s4\" align=\"center\">",
937  "<td class=\"s5\" align=\"center\">"};
938  htmlFile << "</style>"<< std::endl;
939  htmlFile << "<body> " << std::endl;
940  htmlFile << "<br> " << std::endl;
941  htmlFile << "<h2>Run:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" << std::endl;
942  htmlFile << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span " << std::endl;
943  htmlFile << " style=\"color: rgb(0, 0, 153);\">" << runNo << "</span></h2>" << std::endl;
944  htmlFile << "<h2>Monitoring task:&nbsp;&nbsp;&nbsp;&nbsp; <span " << std::endl;
945  htmlFile << " style=\"color: rgb(0, 0, 153);\">Detector Diagnostics Pedestal Monitor</span></h2> " << std::endl;
946  htmlFile << "<h2>Events processed:&nbsp;&nbsp;&nbsp;&nbsp;<span " << std::endl;
947  htmlFile << " style=\"color: rgb(0, 0, 153);\">" << ievt_ << "</span></h2>" << std::endl;
948  htmlFile << "<hr>" << std::endl;
950  htmlFile << "<table width=100% border=1>" << std::endl;
951  htmlFile << "<tr>" << std::endl;
952  htmlFile << "<td class=\"s0\" width=20% align=\"center\">SebDet</td>" << std::endl;
953  htmlFile << "<td class=\"s0\" width=20% align=\"center\">Missing</td>" << std::endl;
954  htmlFile << "<td class=\"s0\" width=20% align=\"center\">Unstable</td>" << std::endl;
955  htmlFile << "<td class=\"s0\" width=20% align=\"center\">Bad |Ped-Ref|</td>" << std::endl;
956  htmlFile << "<td class=\"s0\" width=20% align=\"center\">Bad |Rms-Ref|</td>" << std::endl;
957  htmlFile << "</tr><tr>" << std::endl;
958  int ind1=0,ind2=0,ind3=0,ind4=0;
959  htmlFile << "<td class=\"s1\" align=\"center\">HB+</td>" << std::endl;
960  ind1=3; if(newHBP[0]==0) ind1=2; if(newHBP[0]>0 && newHBP[0]<=12) ind1=1; if(newHBP[0]>=12 && newHBP[0]<1296) ind1=0;
961  ind2=3; if(newHBP[1]==0) ind2=2; if(newHBP[1]>0) ind2=1; if(newHBP[1]>21) ind2=0;
962  ind3=3; if(newHBP[2]==0) ind3=2; if(newHBP[2]>0) ind3=1; if(newHBP[2]>21) ind3=0;
963  ind4=3; if(newHBP[3]==0) ind4=2; if(newHBP[3]>0) ind4=1; if(newHBP[3]>21) ind4=0;
964  if(ind1==3) ind2=ind3=ind4=3;
965  if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1) status|=1;
966  htmlFile << state[ind1] << HBP[0] <<" (1296)</td>" << std::endl;
967  htmlFile << state[ind2] << HBP[1] <<"</td>" << std::endl;
968  htmlFile << state[ind3] << HBP[2] <<"</td>" << std::endl;
969  htmlFile << state[ind4] << HBP[3] <<"</td>" << std::endl;
970 
971  htmlFile << "</tr><tr>" << std::endl;
972  htmlFile << "<td class=\"s1\" align=\"center\">HB-</td>" << std::endl;
973  ind1=3; if(newHBM[0]==0) ind1=2; if(newHBM[0]>0 && newHBM[0]<=12) ind1=1; if(newHBM[0]>=12 && newHBM[0]<1296) ind1=0;
974  ind2=3; if(newHBM[1]==0) ind2=2; if(newHBM[1]>0) ind2=1; if(newHBM[1]>21) ind2=0;
975  ind3=3; if(newHBM[2]==0) ind3=2; if(newHBM[2]>0) ind3=1; if(newHBM[2]>21) ind3=0;
976  ind4=3; if(newHBM[3]==0) ind4=2; if(newHBM[3]>0) ind4=1; if(newHBM[3]>21) ind4=0;
977  if(ind1==3) ind2=ind3=ind4=3;
978  if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1) status|=1;
979  htmlFile << state[ind1] << HBM[0] <<" (1296)</td>" << std::endl;
980  htmlFile << state[ind2] << HBM[1] <<"</td>" << std::endl;
981  htmlFile << state[ind3] << HBM[2] <<"</td>" << std::endl;
982  htmlFile << state[ind4] << HBM[3] <<"</td>" << std::endl;
983 
984  htmlFile << "</tr><tr>" << std::endl;
985  htmlFile << "<td class=\"s1\" align=\"center\">HE+</td>" << std::endl;
986  ind1=3; if(newHEP[0]==0) ind1=2; if(newHEP[0]>0 && newHEP[0]<=12) ind1=1; if(newHEP[0]>=12 && newHEP[0]<1296) ind1=0;
987  ind2=3; if(newHEP[1]==0) ind2=2; if(newHEP[1]>0) ind2=1; if(newHEP[1]>21) ind2=0;
988  ind3=3; if(newHEP[2]==0) ind3=2; if(newHEP[2]>0) ind3=1; if(newHEP[2]>21) ind3=0;
989  ind4=3; if(newHEP[3]==0) ind4=2; if(newHEP[3]>0) ind4=1; if(newHEP[3]>21) ind4=0;
990  if(ind1==3) ind2=ind3=ind4=3;
991  if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1) status|=1;
992  htmlFile << state[ind1] << HEP[0] <<" (1296)</td>" << std::endl;
993  htmlFile << state[ind2] << HEP[1] <<"</td>" << std::endl;
994  htmlFile << state[ind3] << HEP[2] <<"</td>" << std::endl;
995  htmlFile << state[ind4] << HEP[3] <<"</td>" << std::endl;
996 
997  htmlFile << "</tr><tr>" << std::endl;
998  htmlFile << "<td class=\"s1\" align=\"center\">HE-</td>" << std::endl;
999  ind1=3; if(newHEM[0]==0) ind1=2; if(newHEM[0]>0 && newHEM[0]<=12) ind1=1; if(newHEM[0]>=12 && newHEM[0]<1296) ind1=0;
1000  ind2=3; if(newHEM[1]==0) ind2=2; if(newHEM[1]>0) ind2=1; if(newHEM[1]>21) ind2=0;
1001  ind3=3; if(newHEM[2]==0) ind3=2; if(newHEM[2]>0) ind3=1; if(newHEM[2]>21) ind3=0;
1002  ind4=3; if(newHEM[3]==0) ind4=2; if(newHEM[3]>0) ind4=1; if(newHEM[3]>21) ind4=0;
1003  if(ind1==3) ind2=ind3=ind4=3;
1004  if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1) status|=1;
1005  htmlFile << state[ind1] << HEM[0] <<" (1296)</td>" << std::endl;
1006  htmlFile << state[ind2] << HEM[1] <<"</td>" << std::endl;
1007  htmlFile << state[ind3] << HEM[2] <<"</td>" << std::endl;
1008  htmlFile << state[ind4] << HEM[3] <<"</td>" << std::endl;
1009 
1010  htmlFile << "</tr><tr>" << std::endl;
1011  htmlFile << "<td class=\"s1\" align=\"center\">HF+</td>" << std::endl;
1012  ind1=3; if(newHFP[0]==0) ind1=2; if(newHFP[0]>0 && newHFP[0]<=12) ind1=1; if(newHFP[0]>=12 && newHFP[0]<864) ind1=0;
1013  ind2=3; if(newHFP[1]==0) ind2=2; if(newHFP[1]>0) ind2=1; if(newHFP[1]>21) ind2=0;
1014  ind3=3; if(newHFP[2]==0) ind3=2; if(newHFP[2]>0) ind3=1; if(newHFP[2]>21) ind3=0;
1015  ind4=3; if(newHFP[3]==0) ind4=2; if(newHFP[3]>0) ind4=1; if(newHFP[3]>21) ind4=0;
1016  if(ind1==3) ind2=ind3=ind4=3;
1017  if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1) status|=1;
1018  htmlFile << state[ind1] << HFP[0] <<" (864)</td>" << std::endl;
1019  htmlFile << state[ind2] << HFP[1] <<"</td>" << std::endl;
1020  htmlFile << state[ind3] << HFP[2] <<"</td>" << std::endl;
1021  htmlFile << state[ind4] << HFP[3] <<"</td>" << std::endl;
1022 
1023  htmlFile << "</tr><tr>" << std::endl;
1024  htmlFile << "<td class=\"s1\" align=\"center\">HF-</td>" << std::endl;
1025  ind1=3; if(newHFM[0]==0) ind1=2; if(newHFM[0]>0 && newHFM[0]<=12) ind1=1; if(newHFM[0]>=12 && newHFM[0]<864) ind1=0;
1026  ind2=3; if(newHFM[1]==0) ind2=2; if(newHFM[1]>0) ind2=1; if(newHFM[1]>21) ind2=0;
1027  ind3=3; if(newHFM[2]==0) ind3=2; if(newHFM[2]>0) ind3=1; if(newHFM[2]>21) ind3=0;
1028  ind4=3; if(newHFM[3]==0) ind4=2; if(newHFM[3]>0) ind4=1; if(newHFM[3]>21) ind4=0;
1029  if(ind1==3) ind2=ind3=ind4=3;
1030  if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1) status|=1;
1031  htmlFile << state[ind1] << HFM[0] <<" (864)</td>" << std::endl;
1032  htmlFile << state[ind2] << HFM[1] <<"</td>" << std::endl;
1033  htmlFile << state[ind3] << HFM[2] <<"</td>" << std::endl;
1034  htmlFile << state[ind4] << HFM[3] <<"</td>" << std::endl;
1035 
1036  htmlFile << "</tr><tr>" << std::endl;
1037  htmlFile << "<td class=\"s1\" align=\"center\">HO</td>" << std::endl;
1038  ind1=3; if(newHO[0]==0) ind1=2; if(newHO[0]>0 && newHO[0]<=12) ind1=1; if(newHO[0]>=12 && newHO[0]<2160) ind1=0;
1039  ind2=3; if(newHO[1]==0) ind2=2; if(newHO[1]>0) ind2=1; if(newHO[1]>21) ind2=0;
1040  ind3=3; if(newHO[2]==0) ind3=2; if(newHO[2]>0) ind3=1; if(newHO[2]>21) ind3=0;
1041  ind4=3; if(newHO[3]==0) ind4=2; if(newHO[3]>0) ind4=1; if(newHO[3]>21) ind4=0;
1042  if(ind1==3) ind2=ind3=ind4=3;
1043  if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1) status|=1;
1044  htmlFile << state[ind1] << HO[0] <<" (2160)</td>" << std::endl;
1045  htmlFile << state[ind2] << HO[1] <<"</td>" << std::endl;
1046  htmlFile << state[ind3] << HO[2] <<"</td>" << std::endl;
1047  htmlFile << state[ind4] << HO[3] <<"</td>" << std::endl;
1048 
1049  htmlFile << "</tr></table>" << std::endl;
1050  htmlFile << "<hr>" << std::endl;
1052  if((MissingCnt+UnstableCnt+BadCnt)>0){
1053  htmlFile << "<table width=100% border=1><tr>" << std::endl;
1054  if(MissingCnt>0) htmlFile << "<td><a href=\"" << "bad_missing_table.html" <<"\">list of missing channels</a></td>";
1055  if(UnstableCnt>0) htmlFile << "<td><a href=\"" << "bad_unstable_table.html" <<"\">list of unstable channels</a></td>";
1056  if(BadCnt>0) htmlFile << "<td><a href=\"" << "bad_badpedrms_table.html" <<"\">list of bad pedestal/rms channels</a></td>";
1057  htmlFile << "</tr></table>" << std::endl;
1058  }
1059  can->SetGridy();
1060  can->SetGridx();
1061  can->SetLogy(0);
1062 
1063 
1064 
1066  htmlFile << "<h2 align=\"center\">Summary plots</h2>" << std::endl;
1067  htmlFile << "<table width=100% border=0><tr>" << std::endl;
1068  htmlFile << "<tr align=\"left\">" << std::endl;
1069  Pedestals2DHBHEHF->SetStats(0);
1070  Pedestals2DHBHEHF->SetMaximum(5);
1071  Pedestals2DHBHEHF->SetNdivisions(36,"Y");
1072  Pedestals2DHBHEHF->Draw("COLZ");
1073  can->SaveAs((htmlDir + "hbhehf_pedestal_map.gif").c_str());
1074  htmlFile << "<td><img src=\"hbhehf_pedestal_map.gif\" alt=\"hbhehf pedestal mean map\"> </td>" << std::endl;
1075  Pedestals2DHO->SetStats(0);
1076  Pedestals2DHO->SetMaximum(5);
1077  Pedestals2DHO->SetNdivisions(36,"Y");
1078  Pedestals2DHO->Draw("COLZ");
1079  can->SaveAs((htmlDir + "ho_pedestal_map.gif").c_str());
1080  htmlFile << "<td><img src=\"ho_pedestal_map.gif\" alt=\"ho pedestal mean map\"> </td>" << std::endl;
1081  htmlFile << "</tr>" << std::endl;
1082 
1083  htmlFile << "<tr align=\"left\">" << std::endl;
1084  Pedestals2DRmsHBHEHF->SetStats(0);
1085  Pedestals2DRmsHBHEHF->SetMaximum(2);
1086  Pedestals2DRmsHBHEHF->SetNdivisions(36,"Y");
1087  Pedestals2DRmsHBHEHF->Draw("COLZ");
1088  can->SaveAs((htmlDir + "hbhehf_rms_map.gif").c_str());
1089  htmlFile << "<td><img src=\"hbhehf_rms_map.gif\" alt=\"hbhehf pedestal rms map\"> </td>" << std::endl;
1090  Pedestals2DRmsHO->SetStats(0);
1091  Pedestals2DRmsHO->SetMaximum(2);
1092  Pedestals2DRmsHO->SetNdivisions(36,"Y");
1093  Pedestals2DRmsHO->Draw("COLZ");
1094  can->SaveAs((htmlDir + "ho_rms_map.gif").c_str());
1095  htmlFile << "<td><img src=\"ho_rms_map.gif\" alt=\"ho pedestal rms map\"> </td>" << std::endl;
1096  htmlFile << "</tr>" << std::endl;
1097 
1098  htmlFile << "<tr align=\"left\">" << std::endl;
1099  Pedestals2DErrorHBHEHF->SetStats(0);
1100  Pedestals2DErrorHBHEHF->SetNdivisions(36,"Y");
1101  Pedestals2DErrorHBHEHF->Draw("COLZ");
1102  can->SaveAs((htmlDir + "hbhehf_error_map.gif").c_str());
1103  htmlFile << "<td><img src=\"hbhehf_error_map.gif\" alt=\"hbhehf pedestal error map\"> </td>" << std::endl;
1104  Pedestals2DErrorHO->SetStats(0);
1105  Pedestals2DErrorHO->SetNdivisions(36,"Y");
1106  Pedestals2DErrorHO->Draw("COLZ");
1107  can->SaveAs((htmlDir + "ho_error_map.gif").c_str());
1108  htmlFile << "<td><img src=\"ho_error_map.gif\" alt=\"ho pedestal error map\"> </td>" << std::endl;
1109  htmlFile << "</tr>" << std::endl;
1110  htmlFile << "</table>" << std::endl;
1111  htmlFile << "<hr>" << std::endl;
1112 
1114  htmlFile << "<h2 align=\"center\">HB Pedestal plots (Reference run "<<ref_run<<")</h2>" << std::endl;
1115  htmlFile << "<table width=100% border=0><tr>" << std::endl;
1116  htmlFile << "<tr align=\"left\">" << std::endl;
1117  if(PedestalsAve4HB->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1118  PedestalsAve4HB->Draw();
1119  can->SaveAs((htmlDir + "hb_pedestal_distribution.gif").c_str());
1120  htmlFile << "<td><img src=\"hb_pedestal_distribution.gif\" alt=\"hb pedestal mean\"> </td>" << std::endl;
1121  if(PedestalsRmsHB->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1122  PedestalsRmsHB->Draw();
1123  can->SaveAs((htmlDir + "hb_pedestal_rms_distribution.gif").c_str());
1124  htmlFile << "<td><img src=\"hb_pedestal_rms_distribution.gif\" alt=\"hb pedestal rms mean\"> </td>" << std::endl;
1125  htmlFile << "</tr>" << std::endl;
1126 
1127  htmlFile << "<tr align=\"left\">" << std::endl;
1128  if(PedestalsAve4HBref->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1129  PedestalsAve4HBref->Draw();
1130  can->SaveAs((htmlDir + "hb_pedestal_ref_distribution.gif").c_str());
1131  htmlFile << "<td><img src=\"hb_pedestal_ref_distribution.gif\" alt=\"hb pedestal-reference mean\"> </td>" << std::endl;
1132  if(PedestalsRmsHBref->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1133  PedestalsRmsHBref->Draw();
1134  can->SaveAs((htmlDir + "hb_pedestal_rms_ref_distribution.gif").c_str());
1135  htmlFile << "<td><img src=\"hb_pedestal_rms_ref_distribution.gif\" alt=\"hb pedestal rms-reference mean\"> </td>" << std::endl;
1136  htmlFile << "</tr>" << std::endl;
1137  htmlFile << "</table>" << std::endl;
1139  htmlFile << "<h2 align=\"center\">HE Pedestal plots (Reference run "<<ref_run<<")</h2>" << std::endl;
1140  htmlFile << "<table width=100% border=0><tr>" << std::endl;
1141  htmlFile << "<tr align=\"left\">" << std::endl;
1142  if(PedestalsAve4HE->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1143  PedestalsAve4HE->Draw();
1144  can->SaveAs((htmlDir + "he_pedestal_distribution.gif").c_str());
1145  htmlFile << "<td><img src=\"he_pedestal_distribution.gif\" alt=\"he pedestal mean\"> </td>" << std::endl;
1146  if(PedestalsRmsHE->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1147  PedestalsRmsHE->Draw();
1148  can->SaveAs((htmlDir + "he_pedestal_rms_distribution.gif").c_str());
1149  htmlFile << "<td><img src=\"he_pedestal_rms_distribution.gif\" alt=\"he pedestal rms mean\"> </td>" << std::endl;
1150  htmlFile << "</tr>" << std::endl;
1151 
1152  htmlFile << "<tr align=\"left\">" << std::endl;
1153  if(PedestalsAve4HEref->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1154  PedestalsAve4HEref->Draw();
1155  can->SaveAs((htmlDir + "he_pedestal_ref_distribution.gif").c_str());
1156  htmlFile << "<td><img src=\"he_pedestal_ref_distribution.gif\" alt=\"he pedestal-reference mean\"> </td>" << std::endl;
1157  if(PedestalsRmsHEref->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1158  PedestalsRmsHEref->Draw();
1159  can->SaveAs((htmlDir + "he_pedestal_rms_ref_distribution.gif").c_str());
1160  htmlFile << "<td><img src=\"he_pedestal_rms_ref_distribution.gif\" alt=\"he pedestal rms-reference mean\"> </td>" << std::endl;
1161  htmlFile << "</tr>" << std::endl;
1162  htmlFile << "</table>" << std::endl;
1164  htmlFile << "<h2 align=\"center\">HO Pedestal plots (Reference run "<<ref_run<<")</h2>" << std::endl;
1165  htmlFile << "<table width=100% border=0><tr>" << std::endl;
1166  htmlFile << "<tr align=\"left\">" << std::endl;
1167  if(PedestalsAve4HO->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1168  PedestalsAve4HO->Draw();
1169  can->SaveAs((htmlDir + "ho_pedestal_distribution.gif").c_str());
1170  htmlFile << "<td><img src=\"ho_pedestal_distribution.gif\" alt=\"ho pedestal mean\"> </td>" << std::endl;
1171  if(PedestalsRmsHO->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1172  PedestalsRmsHO->Draw();
1173  can->SaveAs((htmlDir + "ho_pedestal_rms_distribution.gif").c_str());
1174  htmlFile << "<td><img src=\"ho_pedestal_rms_distribution.gif\" alt=\"ho pedestal rms mean\"> </td>" << std::endl;
1175  htmlFile << "</tr>" << std::endl;
1176  // SIMP
1177  htmlFile << "<tr align=\"left\">" << std::endl;
1178  if(PedestalsAve4Simp->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1179  PedestalsAve4Simp->Draw();
1180  can->SaveAs((htmlDir + "sipm_pedestal_distribution.gif").c_str());
1181  htmlFile << "<td><img src=\"sipm_pedestal_distribution.gif\" alt=\"sipm pedestal mean\"> </td>" << std::endl;
1182  if(PedestalsRmsSimp->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1183  PedestalsRmsSimp->Draw();
1184  can->SaveAs((htmlDir + "simp_pedestal_rms_distribution.gif").c_str());
1185  htmlFile << "<td><img src=\"simp_pedestal_rms_distribution.gif\" alt=\"sipm pedestal rms mean\"> </td>" << std::endl;
1186  htmlFile << "</tr>" << std::endl;
1187  // SIMP
1188  htmlFile << "<tr align=\"left\">" << std::endl;
1189  if(PedestalsAve4HOref->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1190  PedestalsAve4HOref->Draw();
1191  can->SaveAs((htmlDir + "ho_pedestal_ref_distribution.gif").c_str());
1192  htmlFile << "<td><img src=\"ho_pedestal_ref_distribution.gif\" alt=\"ho pedestal-reference mean\"> </td>" << std::endl;
1193  if(PedestalsRmsHOref->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1194  PedestalsRmsHOref->Draw();
1195  can->SaveAs((htmlDir + "ho_pedestal_rms_ref_distribution.gif").c_str());
1196  htmlFile << "<td><img src=\"ho_pedestal_rms_ref_distribution.gif\" alt=\"ho pedestal rms-reference mean\"> </td>" << std::endl;
1197  htmlFile << "</tr>" << std::endl;
1198  htmlFile << "</table>" << std::endl;
1200 
1201  htmlFile << "<h2 align=\"center\">HF Pedestal plots (Reference run "<<ref_run<<")</h2>" << std::endl;
1202  htmlFile << "<table width=100% border=0><tr>" << std::endl;
1203  htmlFile << "<tr align=\"left\">" << std::endl;
1204  if(PedestalsAve4HF->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1205  PedestalsAve4HF->Draw();
1206  can->SaveAs((htmlDir + "hf_pedestal_distribution.gif").c_str());
1207  htmlFile << "<td><img src=\"hf_pedestal_distribution.gif\" alt=\"hf pedestal mean\"> </td>" << std::endl;
1208  if(PedestalsRmsHF->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1209  PedestalsRmsHF->Draw();
1210  can->SaveAs((htmlDir + "hf_pedestal_rms_distribution.gif").c_str());
1211  htmlFile << "<td><img src=\"hf_pedestal_rms_distribution.gif\" alt=\"hf pedestal rms mean\"> </td>" << std::endl;
1212  htmlFile << "</tr>" << std::endl;
1213 
1214  htmlFile << "<tr align=\"left\">" << std::endl;
1215  if(PedestalsAve4HFref->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1216  PedestalsAve4HFref->Draw();
1217  can->SaveAs((htmlDir + "hf_pedestal_ref_distribution.gif").c_str());
1218  htmlFile << "<td><img src=\"hf_pedestal_ref_distribution.gif\" alt=\"hf pedestal-reference mean\"> </td>" << std::endl;
1219  if(PedestalsRmsHFref->GetMaximum()>0) can->SetLogy(1); else can->SetLogy(0);
1220  PedestalsRmsHFref->Draw();
1221  can->SaveAs((htmlDir + "hf_pedestal_rms_ref_distribution.gif").c_str());
1222  htmlFile << "<td><img src=\"hf_pedestal_rms_ref_distribution.gif\" alt=\"hf pedestal rms-reference mean\"> </td>" << std::endl;
1223  htmlFile << "</tr>" << std::endl;
1224  htmlFile << "</table>" << std::endl;
1225 
1226 
1227  htmlFile << "</body> " << std::endl;
1228  htmlFile << "</html> " << std::endl;
1229  htmlFile.close();
1230  can->Close();
1231 }
1232 
1234 {}
int fiberChannel() const
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
int fiberIndex() const
get the fiber index. For VME 1-8 (which of eight fibers carried by a spigot), for uTCA fibers are zer...
std::string name()
void setBinContent(int binx, double content)
set content of bin (1-D)
int pixel() const
int ib
Definition: cuy.py:660
static void printTableHeader(std::ofstream &file, std::string header)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:304
std::vector< std::string > HcalEtaPhiHistNames()
int htrSlot() const
get the htr slot
void setupProblemCells(DQMStore::IBooker &, DQMStore::IGetter &)
int zside(DetId const &)
bool isHE(int etabin, int depth)
int readoutVMECrateId() const
get the readout VME crate number
std::string rbx() const
bool validHtmlOutput(DQMStore::IBooker &, DQMStore::IGetter &)
void Fill(long long x)
tuple d
Definition: ztail.py:151
int depth() const
get the tower depth
Definition: HcalDetId.cc:106
HcalElectronicsMap generateHcalElectronicsMap()
std::vector< MonitorElement * > depth
int CalcIeta(int subdet, int eta, int depth)
int htrTopBottom() const
get the htr top/bottom (1=top/0=bottom), valid for VME
std::vector< std::string > problemnames_
int rm() const
EtaPhiHists * ProblemCellsByDepth
int ieta() const
get the cell ieta
Definition: HcalDetId.h:56
int dccid() const
get the (Hcal local) DCC id for VME, crate number for uTCA
HcalSubdetector
Definition: HcalAssistant.h:31
static void printTableLine(std::ofstream &file, int ind, HcalDetId &detid, HcalFrontEndId &lmap_entry, HcalElectronicsId &emap_entry, std::string comment="")
void setup(DQMStore::IBooker &m_dbe, std::string Name, std::string Units="")
T min(T a, T b)
Definition: MathUtil.h:58
static void printTableTail(std::ofstream &file)
bool isHB(int etabin, int depth)
void analyze(DQMStore::IBooker &, DQMStore::IGetter &)
int spigot() const
get the spigot (input number on DCC, AMC card number for uTCA)
std::string valueString(void) const
const HcalFrontEndId getHcalFrontEndId(const DetId &)
int iphi() const
get the cell iphi
Definition: HcalDetId.cc:101
virtual void calculateProblems(void)
bool isHF(int etabin, int depth)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
int adc() const
std::string subdir_
std::map< HcalDetId, unsigned int > badstatusmap
void FillUnphysicalHEHFBins(std::vector< TH2F > &hh)
double getBinContent(int binx) const
get content of bin (1-D)
std::string prefixME_
HcalLogicalMap * logicalMap_
tuple cout
Definition: gather_cfg.py:145
int rmFiber() const
TH2F * getTH2F(void) const
void updateChannelStatus(std::map< HcalDetId, unsigned int > &myqual)
int qieCard() const
void Reset(void)
reset ME (ie. contents, errors, etc)
Readout chain identification for Hcal.
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
void htmlOutput(DQMStore::IBooker &, DQMStore::IGetter &, std::string)
#define comment(par)
Definition: vmac.h:161