CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalDetDiagLaserClient.cc
Go to the documentation of this file.
4 
8 
10 
11 #include <iostream>
12 
13 /*
14  * \file HcalDetDiagLaserClient.cc
15  *
16  * \author J. Temple
17  * \brief Hcal DetDiagLaser Client class
18  */
19 typedef struct{
20 int eta;
21 int phi;
22 }Raddam_ch;
23 static const Raddam_ch RADDAM_CH[56]={{-30,15},{-32,15},{-34,15},{-36,15},{-38,15},{-40,15},{-41,15},
24  {-30,35},{-32,35},{-34,35},{-36,35},{-38,35},{-40,35},{-41,35},
25  {-30,51},{-32,51},{-34,51},{-36,51},{-38,51},{-40,51},{-41,51},
26  {-30,71},{-32,71},{-34,71},{-36,71},{-38,71},{-40,71},{-41,71},
27  {30, 01},{32, 01},{34, 01},{36, 01},{38, 01},{40, 71},{41, 71},
28  {30, 21},{32, 21},{34, 21},{36, 21},{38, 21},{40, 19},{41, 19},
29  {30, 37},{32, 37},{34, 37},{36, 37},{38, 37},{40, 35},{41, 35},
30  {30, 57},{32, 57},{34, 57},{36, 57},{38, 57},{40, 55},{41, 55}};
31 using namespace std;
32 using namespace edm;
33 
35 {
36  name_=myname; status=0;
37  needLogicalMap_=true;
38 }
39 
41 {
42  name_=myname;
43  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
44  debug_ = ps.getUntrackedParameter<int>("debug",0);
45  prefixME_ = ps.getUntrackedParameter<string>("subSystemFolder","Hcal/");
46  if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
47  prefixME_.append("/");
48  subdir_ = ps.getUntrackedParameter<string>("DetDiagLaserFolder","DetDiagLaserMonitor_Hcal/"); // DetDiagLaserMonitor_Hcal/
49  if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
50  subdir_.append("/");
51  subdir_=prefixME_+subdir_;
52 
53  validHtmlOutput_ = ps.getUntrackedParameter<bool>("DetDiagLaser_validHtmlOutput",true);
54  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
55  badChannelStatusMask_ = ps.getUntrackedParameter<int>("DetDiagLaser_BadChannelStatusMask",
56  ps.getUntrackedParameter<int>("BadChannelStatusMask",0));
57 
58  minerrorrate_ = ps.getUntrackedParameter<double>("DetDiagLaser_minerrorrate",
59  ps.getUntrackedParameter<double>("minerrorrate",0.05));
60  minevents_ = ps.getUntrackedParameter<int>("DetDiagLaser_minevents",
61  ps.getUntrackedParameter<int>("minevents",1));
62  Online_ = ps.getUntrackedParameter<bool>("online",false);
63 
64  ProblemCells=0;
65  ProblemCellsByDepth=0;
66  needLogicalMap_=true;
67 
68  doProblemCellSetup_ = true;
69 }
70 
72 {
73  if (debug_>2) std::cout <<"\tHcalDetDiagLaserClient::analyze()"<<std::endl;
74  if ( doProblemCellSetup_ ) setupProblemCells(ib,ig);
75  calculateProblems(ib,ig);
76 }
77 
79 {
80  if (debug_>2) std::cout <<"\t\tHcalDetDiagLaserClient::calculateProblems()"<<std::endl;
81  double totalevents=0;
82  int etabins=0, phibins=0, zside=0;
83  double problemvalue=0;
84 
85  // Clear away old problems
86  if (ProblemCells!=0)
87  {
88  ProblemCells->Reset();
89  (ProblemCells->getTH2F())->SetMaximum(1.05);
90  (ProblemCells->getTH2F())->SetMinimum(0.);
91  }
92  for (unsigned int d=0;d<ProblemCellsByDepth->depth.size();++d)
93  {
94  if (ProblemCellsByDepth->depth[d]!=0)
95  {
96  ProblemCellsByDepth->depth[d]->Reset();
97  (ProblemCellsByDepth->depth[d]->getTH2F())->SetMaximum(1.05);
98  (ProblemCellsByDepth->depth[d]->getTH2F())->SetMinimum(0.);
99  }
100  }
101  enoughevents_=true;
102  // Get histograms that are used in testing
103  // currently none used,
104 
105  std::vector<std::string> name = HcalEtaPhiHistNames();
106 
107  // This is a sample of how to get a histogram from the task that can then be used for evaluation purposes
108  TH2F* BadTiming[4];
109  TH2F* BadEnergy[4];
110  MonitorElement* me;
111  for (int i=0;i<4;++i)
112  {
113  BadTiming[i]=0;
114  BadEnergy[i]=0;
115  string s=subdir_+name[i]+" Problem Bad Laser Timing";
116  me=ig.get(s.c_str());
117  if (me!=0) BadTiming[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, BadTiming[i], debug_);
118  else if (debug_>0) std::cout <<"<HcalDetDiagLaserClient::calculateProblems> could not get histogram '"<<s<<"'"<<std::endl;
119  s=subdir_+name[i]+" Problem Bad Laser Energy";
120  me=ig.get(s.c_str());
121  if (me!=0) BadEnergy[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, BadEnergy[i], debug_);
122  else if (debug_>0) std::cout <<"<HcalDetDiagLaserClient::calculateProblems> could not get histogram '"<<s<<"'"<<std::endl;
123  }
124 
125  // Because we're clearing and re-forming the problem cell histogram here, we don't need to do any cute
126  // setting of the underflow bin to 0, and we can plot results as a raw rate between 0-1.
127 
128  for (unsigned int d=0;d<ProblemCellsByDepth->depth.size();++d)
129  {
130  if (ProblemCellsByDepth->depth[d]==0) continue;
131 
132  //totalevents=DigiPresentByDepth[d]->GetBinContent(0);
133  totalevents=0;
134  // Check underflow bins for events processed
135  if (BadTiming[d]!=0) totalevents += BadTiming[d]->GetBinContent(0);
136  if (BadEnergy[d]!=0) totalevents += BadEnergy[d]->GetBinContent(0);
137  //if (totalevents==0 || totalevents<minevents_) continue;
138 
139  totalevents=1; // temporary value pending removal of histogram normalization from tasks
140 
141  etabins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsX();
142  phibins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsY();
143  for (int eta=0;eta<etabins;++eta)
144  {
145  int ieta=CalcIeta(eta,d+1);
146  if (ieta==-9999) continue;
147  for (int phi=0;phi<phibins;++phi)
148  {
149  problemvalue=0;
150  if (BadTiming[d]!=0) problemvalue += BadTiming[d]->GetBinContent(eta+1,phi+1)*1./totalevents;
151  if (BadEnergy[d]!=0) problemvalue += BadEnergy[d]->GetBinContent(eta+1,phi+1)*1./totalevents;
152  if (problemvalue==0) continue;
153  // problem value is a rate; we can normalize it here
154  problemvalue = min(1.,problemvalue);
155 
156  zside=0;
157  if (isHF(eta,d+1)) // shift ieta by 1 for HF
158  ieta<0 ? zside = -1 : zside = 1;
159 
160  // For problem cells that exceed our allowed rate,
161  // set the values to -1 if the cells are already marked in the status database
162  if (problemvalue>minerrorrate_)
163  {
164  HcalSubdetector subdet=HcalEmpty;
165  if (isHB(eta,d+1))subdet=HcalBarrel;
166  else if (isHE(eta,d+1)) subdet=HcalEndcap;
167  else if (isHF(eta,d+1)) subdet=HcalForward;
168  else if (isHO(eta,d+1)) subdet=HcalOuter;
169  HcalDetId hcalid(subdet, ieta, phi+1, (int)(d+1));
170  if (badstatusmap.find(hcalid)!=badstatusmap.end())
171  problemvalue=999;
172  }
173 
174  ProblemCellsByDepth->depth[d]->setBinContent(eta+1,phi+1,problemvalue);
175  if (ProblemCells!=0) ProblemCells->Fill(ieta+zside,phi+1,problemvalue);
176  } // loop on phi
177  } // loop on eta
178  } // loop on depth
179 
180  if (ProblemCells==0)
181  {
182  if (debug_>0) std::cout <<"<HcalDetDiagLaserClient::calculateProblems> ProblemCells histogram does not exist!"<<endl;
183  return;
184  }
185 
186  // Normalization of ProblemCell plot, in the case where there are errors in multiple depths
187  etabins=(ProblemCells->getTH2F())->GetNbinsX();
188  phibins=(ProblemCells->getTH2F())->GetNbinsY();
189  for (int eta=0;eta<etabins;++eta)
190  {
191  for (int phi=0;phi<phibins;++phi)
192  {
193  if (ProblemCells->getBinContent(eta+1,phi+1)>1. && ProblemCells->getBinContent(eta+1,phi+1)<999)
194  ProblemCells->setBinContent(eta+1,phi+1,1.);
195  }
196  }
197 
198  FillUnphysicalHEHFBins(*ProblemCellsByDepth);
199  FillUnphysicalHEHFBins(ProblemCells);
200  return;
201 }
202 
204 
206 {
207  ib.setCurrentFolder(subdir_);
208  problemnames_.clear();
209 
210  // Put the appropriate name of your problem summary here
211  ProblemCells=ib.book2D(" ProblemDetDiagLaser",
212  " Problem DetDiagLaser Rate for all HCAL;ieta;iphi",
213  85,-42.5,42.5,
214  72,0.5,72.5);
215  problemnames_.push_back(ProblemCells->getName());
216  if (debug_>1)
217  std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
218  ib.setCurrentFolder(subdir_+"problem_DetDiagLaser");
219  ProblemCellsByDepth = new EtaPhiHists();
220  ProblemCellsByDepth->setup(ib," Problem DetDiagLaser Rate");
221  for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
222  problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
223 
224  doProblemCellSetup_ = false;
225 
226 }
227 
229 {
230  enoughevents_=false;
231  nevts_=0;
232 }
233 
234 //void HcalDetDiagLaserClient::endRun(void){analyze();}
235 
238 
240 {
241  if(status&2) return true;
242  return false;
243 
244  if (!ProblemCells)
245  {
246  if (debug_>1) std::cout <<"<HcalDetDiagLaserClient::hasErrors_Temp> ProblemCells histogram does not exist!"<<std::endl;
247  return false;
248  }
249  int problemcount=0;
250  int ieta=-9999;
251 
252  for (int depth=0;depth<4; ++depth)
253  {
254  int etabins = (ProblemCells->getTH2F())->GetNbinsX();
255  int phibins = (ProblemCells->getTH2F())->GetNbinsY();
256  for (int hist_eta=0;hist_eta<etabins;++hist_eta)
257  {
258  for (int hist_phi=0; hist_phi<phibins;++hist_phi)
259  {
260  ieta=CalcIeta(hist_eta,depth+1);
261  if (ieta==-9999) continue;
262  if (ProblemCellsByDepth->depth[depth]==0)
263  continue;
264  if (ProblemCellsByDepth->depth[depth]->getBinContent(hist_eta,hist_phi)>minerrorrate_)
265  ++problemcount;
266 
267  } // for (int hist_phi=1;...)
268  } // for (int hist_eta=1;...)
269  } // for (int depth=0;...)
270 
271  if (problemcount>0) return true;
272  return false;
273 }
274 
276  if(status&1) return true;
277  return false;
278 }
279 bool HcalDetDiagLaserClient::hasOther_Temp(void){return false;}
280 bool HcalDetDiagLaserClient::test_enabled(void){return true;}
281 
282 
283 void HcalDetDiagLaserClient::updateChannelStatus(std::map<HcalDetId, unsigned int>& myqual)
284 {
285  // This gets called by HcalMonitorClient
286  // trigger primitives don't yet contribute to channel status (though they could...)
287  // see dead or hot cell code for an example
288 
289 } //void HcalDetDiagLaserClient::updateChannelStatus
290 static void printTableHeader(std::ofstream& file,std::string header){
291  file << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">"<< endl;
292  file << "<head>"<< endl;
293  file << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>"<< endl;
294  file << "<title>"<< header <<"</title>"<< endl;
295  file << "<style type=\"text/css\">"<< endl;
296  file << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"<< endl;
297  file << " td.s0 { font-family: arial, arial ce, helvetica; }"<< endl;
298  file << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< endl;
299  file << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }"<< endl;
300  file << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }"<< endl;
301  file << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }"<< endl;
302  file << "</style>"<< endl;
303  file << "<body>"<< endl;
304  file << "<table>"<< endl;
305 }
306 static void printTableLine(std::ofstream& file,int ind,HcalDetId& detid,HcalFrontEndId& lmap_entry,HcalElectronicsId &emap_entry,std::string comment=""){
307  if(ind==0){
308  file << "<tr>";
309  file << "<td class=\"s4\" align=\"center\">#</td>" << endl;
310  file << "<td class=\"s1\" align=\"center\">ETA</td>" << endl;
311  file << "<td class=\"s1\" align=\"center\">PHI</td>" << endl;
312  file << "<td class=\"s1\" align=\"center\">DEPTH</td>"<< endl;
313  file << "<td class=\"s1\" align=\"center\">RBX</td>" << endl;
314  file << "<td class=\"s1\" align=\"center\">RM</td>" << endl;
315  file << "<td class=\"s1\" align=\"center\">PIXEL</td>" << endl;
316  file << "<td class=\"s1\" align=\"center\">RM_FIBER</td>" << endl;
317  file << "<td class=\"s1\" align=\"center\">FIBER_CH</td>" << endl;
318  file << "<td class=\"s1\" align=\"center\">QIE</td>" << endl;
319  file << "<td class=\"s1\" align=\"center\">ADC</td>" << endl;
320  file << "<td class=\"s1\" align=\"center\">CRATE</td>" << endl;
321  file << "<td class=\"s1\" align=\"center\">DCC</td>" << endl;
322  file << "<td class=\"s1\" align=\"center\">SPIGOT</td>" << endl;
323  file << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>" << endl;
324  file << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>" << endl;
325  file << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>" << endl;
326  if(comment[0]!=0) file << "<td class=\"s1\" align=\"center\">Comment</td>" << endl;
327  file << "</tr>" << endl;
328  }
329  std::string raw_class;
330  file << "<tr>"<< endl;
331  if((ind%2)==1){
332  raw_class="<td class=\"s2\" align=\"center\">";
333  }else{
334  raw_class="<td class=\"s3\" align=\"center\">";
335  }
336  file << "<td class=\"s4\" align=\"center\">" << ind+1 <<"</td>"<< endl;
337  file << raw_class<< detid.ieta()<<"</td>"<< endl;
338  file << raw_class<< detid.iphi()<<"</td>"<< endl;
339  file << raw_class<< detid.depth() <<"</td>"<< endl;
340  file << raw_class<< lmap_entry.rbx()<<"</td>"<< endl;
341  file << raw_class<< lmap_entry.rm() <<"</td>"<< endl;
342  file << raw_class<< lmap_entry.pixel()<<"</td>"<< endl;
343  file << raw_class<< lmap_entry.rmFiber() <<"</td>"<< endl;
344  file << raw_class<< lmap_entry.fiberChannel()<<"</td>"<< endl;
345  file << raw_class<< lmap_entry.qieCard() <<"</td>"<< endl;
346  file << raw_class<< lmap_entry.adc()<<"</td>"<< endl;
347  file << raw_class<< emap_entry.readoutVMECrateId()<<"</td>"<< endl;
348  file << raw_class<< emap_entry.dccid()<<"</td>"<< endl;
349  file << raw_class<< emap_entry.spigot()<<"</td>"<< endl;
350  file << raw_class<< emap_entry.fiberIndex()<<"</td>"<< endl;
351  file << raw_class<< emap_entry.htrSlot()<<"</td>"<< endl;
352  file << raw_class<< emap_entry.htrTopBottom()<<"</td>"<< endl;
353  if(comment[0]!=0) file << raw_class<< comment<<"</td>"<< endl;
354 }
355 static void printTableTail(std::ofstream& file){
356  file << "</table>"<< endl;
357  file << "</body>"<< endl;
358  file << "</html>"<< endl;
359 }
360 
362  string s=subdir_+"HcalDetDiagLaserMonitor Event Number";
363  MonitorElement *me = ig.get(s.c_str());
364  int n=0;
365  if ( me ) {
366  s = me->valueString();
367  sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &n);
368  }
369  if(n<100) return false;
370  return true;
371 }
373 
374  if(debug_>2) std::cout <<"\t<HcalDetDiagLaserClient::htmlOutput> Preparing html for task: "<<name_<<std::endl;
376 
377  HcalElectronicsMap emap=logicalMap_->generateHcalElectronicsMap();
378 
380  string ref_run,s;
381  MonitorElement* me;
382  TH1F *hbheEnergy=0;
383  TH1F *hbheTiming=0;
384  TH1F *hbheEnergyRMS=0;
385  TH1F *hbheTimingRMS=0;
386  TH1F *hoEnergy=0;
387  TH1F *hoTiming=0;
388  TH1F *hoEnergyRMS=0;
389  TH1F *hoTimingRMS=0;
390  TH1F *hfEnergy=0;
391  TH1F *hfTiming=0;
392  TH1F *hfEnergyRMS=0;
393  TH1F *hfTimingRMS=0;
394  TH1F *hb=0;
395  TH1F *he=0;
396  TH1F *ho=0;
397  TH1F *hf=0;
398  TH2F *Time2Dhbhehf=0;
399  TH2F *Time2Dho=0;
400  TH2F *Energy2Dhbhehf=0;
401  TH2F *Energy2Dho=0;
402  TH2F *refTime2Dhbhehf=0;
403  TH2F *refTime2Dho=0;
404  TH2F *refEnergy2Dhbhehf=0;
405  TH2F *refEnergy2Dho=0;
406  int HBpresent_=0,HEpresent_=0,HOpresent_=0,HFpresent_=0;
407 
408 
409  me=ig.get(prefixME_+"HcalInfo/HBpresent");
410  if(me!=0) HBpresent_=me->getIntValue();
411  me=ig.get(prefixME_+"HcalInfo/HEpresent");
412  if(me!=0) HEpresent_=me->getIntValue();
413  me=ig.get(prefixME_+"HcalInfo/HOpresent");
414  if(me!=0) HOpresent_=me->getIntValue();
415  me=ig.get(prefixME_+"HcalInfo/HFpresent");
416  if(me!=0) HFpresent_=me->getIntValue();
417 
418  s=subdir_+"Summary Plots/HBHE Laser Energy Distribution"; me=ig.get(s.c_str());
419  if(me!=0) hbheEnergy=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hbheEnergy, debug_); else return;
420  s=subdir_+"Summary Plots/HBHE Laser Timing Distribution"; me=ig.get(s.c_str());
421  if(me!=0) hbheTiming=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hbheTiming, debug_); else return;
422  s=subdir_+"Summary Plots/HBHE Laser Energy RMS_div_Energy Distribution"; me=ig.get(s.c_str());
423  if(me!=0) hbheEnergyRMS= HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hbheEnergyRMS, debug_); else return;
424  s=subdir_+"Summary Plots/HBHE Laser Timing RMS Distribution"; me=ig.get(s.c_str());
425  if(me!=0) hbheTimingRMS= HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hbheTimingRMS, debug_); else return;
426  s=subdir_+"Summary Plots/HO Laser Energy Distribution"; me=ig.get(s.c_str());
427  if(me!=0) hoEnergy = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hoEnergy, debug_); else return;
428  s=subdir_+"Summary Plots/HO Laser Timing Distribution"; me=ig.get(s.c_str());
429  if(me!=0) hoTiming = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hoTiming, debug_); else return;
430  s=subdir_+"Summary Plots/HO Laser Energy RMS_div_Energy Distribution"; me=ig.get(s.c_str());
431  if(me!=0) hoEnergyRMS = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hoEnergyRMS, debug_); else return;
432  s=subdir_+"Summary Plots/HO Laser Timing RMS Distribution"; me=ig.get(s.c_str());
433  if(me!=0) hoTimingRMS = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hoTimingRMS, debug_); else return;
434  s=subdir_+"Summary Plots/HF Laser Energy Distribution"; me=ig.get(s.c_str());
435  if(me!=0) hfEnergy = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hfEnergy, debug_); else return;
436  s=subdir_+"Summary Plots/HF Laser Timing Distribution"; me=ig.get(s.c_str());
437  if(me!=0) hfTiming = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hfTiming, debug_); else return;
438  s=subdir_+"Summary Plots/HF Laser Energy RMS_div_Energy Distribution"; me=ig.get(s.c_str());
439  if(me!=0) hfEnergyRMS = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hfEnergyRMS, debug_); else return;
440  s=subdir_+"Summary Plots/HF Laser Timing RMS Distribution"; me=ig.get(s.c_str());
441  if(me!=0) hfTimingRMS = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hfTimingRMS, debug_); else return;
442 
443  s=subdir_+"Summary Plots/HB RBX average Time-Ref"; me=ig.get(s.c_str());
444  if(me!=0) hb = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hb, debug_); else return;
445  s=subdir_+"Summary Plots/HE RBX average Time-Ref"; me=ig.get(s.c_str());
446  if(me!=0) he = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, he, debug_); else return;
447  s=subdir_+"Summary Plots/HO RBX average Time-Ref"; me=ig.get(s.c_str());
448  if(me!=0) ho = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, ho, debug_); else return;
449  s=subdir_+"Summary Plots/HF RoBox average Time-Ref"; me=ig.get(s.c_str());
450  if(me!=0) hf = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hf, debug_); else return;
451 
452  s=subdir_+"Summary Plots/Laser Timing HBHEHF"; me=ig.get(s.c_str());
453  if(me!=0) Time2Dhbhehf = HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Time2Dhbhehf, debug_); else return;
454  s=subdir_+"Summary Plots/Laser Timing HO"; me=ig.get(s.c_str());
455  if(me!=0) Time2Dho = HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Time2Dho, debug_); else return;
456  s=subdir_+"Summary Plots/Laser Energy HBHEHF"; me=ig.get(s.c_str());
457  if(me!=0) Energy2Dhbhehf= HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Energy2Dhbhehf, debug_); else return;
458  s=subdir_+"Summary Plots/Laser Energy HO"; me=ig.get(s.c_str());
459  if(me!=0) Energy2Dho = HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Energy2Dho, debug_); else return;
460  s=subdir_+"Summary Plots/HBHEHF Laser (Timing-Ref)+1"; me=ig.get(s.c_str());
461  if(me!=0) refTime2Dhbhehf = HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, refTime2Dhbhehf, debug_); else return;
462  s=subdir_+"Summary Plots/HO Laser (Timing-Ref)+1"; me=ig.get(s.c_str());
463  if(me!=0) refTime2Dho = HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, refTime2Dho, debug_); else return;
464  s=subdir_+"Summary Plots/HBHEHF Laser Energy_div_Ref"; me=ig.get(s.c_str());
465  if(me!=0) refEnergy2Dhbhehf= HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, refEnergy2Dhbhehf, debug_); else return;
466  s=subdir_+"Summary Plots/HO Laser Energy_div_Ref"; me=ig.get(s.c_str());
467  if(me!=0) refEnergy2Dho = HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, refEnergy2Dho, debug_); else return;
468 
469  TH1F *Raddam[56];
470  char str[100];
471  for(int i=0;i<56;i++){
472  sprintf(str,"RADDAM (%i %i)",RADDAM_CH[i].eta,RADDAM_CH[i].phi);
473  s=subdir_+"Raddam Plots/"+str; me=ig.get(s.c_str());
474  if(me!=0) Raddam[i] = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, Raddam[i], debug_);
475  Raddam[i]->SetXTitle("TS");
476  Raddam[i]->SetTitle(str);
477  }
478 
479  int ievt_ = -1,runNo=-1;
480  s=subdir_+"HcalDetDiagLaserMonitor Event Number";
481  me = ig.get(s.c_str());
482  if ( me ) {
483  s = me->valueString();
484  sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &ievt_);
485  }
486  s=subdir_+"HcalDetDiagLaserMonitor Run Number";
487  me = ig.get(s.c_str());
488  if ( me ) {
489  s = me->valueString();
490  sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &runNo);
491  }
492  s=subdir_+"HcalDetDiagLaserMonitor Reference Run";
493  me = ig.get(s.c_str());
494  if(me) {
495  string s=me->valueString();
496  char str[200];
497  sscanf((s.substr(2,s.length()-2)).c_str(), "%s", str);
498  ref_run=str;
499  }
500 
501  int badT=0;
502  int badE=0;
503  int HBP[2]={0,0};
504  int HBM[2]={0,0};
505  int HEP[2]={0,0};
506  int HEM[2]={0,0};
507  int HFP[2]={0,0};
508  int HFM[2]={0,0};
509  int HO[2] ={0,0};
510  int newHBP[2]={0,0};
511  int newHBM[2]={0,0};
512  int newHEP[2]={0,0};
513  int newHEM[2]={0,0};
514  int newHFP[2]={0,0};
515  int newHFM[2]={0,0};
516  int newHO[2] ={0,0};
517 
518  TH2F* BadTiming_val[4];
519  TH2F* BadEnergy_val[4];
520  std::vector<std::string> name = HcalEtaPhiHistNames();
521  for(int i=0;i<4;++i){
522  BadTiming_val[i]=0;
523  BadEnergy_val[i]=0;
524  string s=subdir_+"Plots for client/"+name[i]+" Laser Timing difference";
525  me=ig.get(s.c_str());
526  if (me!=0) BadTiming_val[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, BadTiming_val[i], debug_); else return;
527  s=subdir_+"Plots for client/"+name[i]+" Laser Energy difference";
528  me=ig.get(s.c_str());
529  if (me!=0) BadEnergy_val[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, BadEnergy_val[i], debug_); else return;
530  }
531 
533  std::ofstream badTiming;
534  badTiming.open((htmlDir+"bad_timing_table.html").c_str());
535  printTableHeader(badTiming,"Bad Timing Channels list");
536  std::ofstream badEnergy;
537  badEnergy.open((htmlDir+"bad_energy_table.html").c_str());
538  printTableHeader(badEnergy,"Bad Energy Channels list");
539 
540  for(int d=0;d<4;++d){
541  int etabins=BadTiming_val[d]->GetNbinsX();
542  int phibins=BadTiming_val[d]->GetNbinsY();
543  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
544  int ieta=CalcIeta(eta,d+1);
545  if(ieta==-9999) continue;
546  HcalSubdetector subdet=HcalEmpty;
547  if(isHB(eta,d+1))subdet=HcalBarrel;
548  else if (isHE(eta,d+1)) subdet=HcalEndcap;
549  else if (isHF(eta,d+1)) subdet=HcalForward;
550  else if (isHO(eta,d+1)) subdet=HcalOuter;
551  HcalDetId hcalid(subdet, ieta, phi+1, (int)(d+1));
552  float val=BadTiming_val[d]->GetBinContent(eta+1,phi+1);
553  if(val!=0){
554  if(subdet==HcalBarrel){
555  if(ieta>0){ HBP[0]++;}else{ HBM[0]++;} badT++;
556  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHBP[0]++;}else{ newHBM[0]++;}}
557  }
558  if(subdet==HcalEndcap){
559  if(ieta>0){ HEP[0]++;}else{ HEM[0]++;} badT++;
560  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHEP[0]++;}else{ newHEM[0]++;}}
561  }
562  if(subdet==HcalForward){
563  if(ieta>0){ HFP[0]++;}else{ HFM[0]++;} badT++;
564  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHFP[0]++;}else{ newHFM[0]++;}}
565  }
566  if(subdet==HcalOuter){
567  HO[0]++;badT++;
568  if(badstatusmap.find(hcalid)==badstatusmap.end()){newHO[0]++;}
569  }
570  }
571  val=BadEnergy_val[d]->GetBinContent(eta+1,phi+1);
572  if(val!=0){
573  if(subdet==HcalBarrel){
574  if(ieta>0){ HBP[1]++;}else{ HBM[1]++;} badE++;
575  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHBP[1]++;}else{ newHBM[1]++;}}
576  }
577  if(subdet==HcalEndcap){
578  if(ieta>0){ HEP[1]++;}else{ HEM[1]++;} badE++;
579  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHEP[1]++;}else{ newHEM[1]++;}}
580  }
581  if(subdet==HcalForward){
582  if(ieta>0){ HFP[1]++;}else{ HFM[1]++;} badE++;
583  if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHFP[1]++;}else{ newHFM[1]++;}}
584  }
585  if(subdet==HcalOuter){
586  HO[1]++;badT++;
587  if(badstatusmap.find(hcalid)==badstatusmap.end()){newHO[1]++;}
588  }
589  }
590  }
591  }
592 
593 
594  int cnt=0;
595  if((HBP[0]+HBM[0])>0){
596  badTiming << "<tr><td align=\"center\"><h3>"<< "HB" <<"</h3></td></tr>" << endl;
597  for(int d=0;d<4;++d){
598  int etabins=BadTiming_val[d]->GetNbinsX();
599  int phibins=BadTiming_val[d]->GetNbinsY();
600  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
601  int ieta=CalcIeta(eta,d+1);
602  if(ieta==-9999) continue;
603  if(!isHB(eta,d+1)) continue;
604  float val=BadTiming_val[d]->GetBinContent(eta+1,phi+1);
605  if(val==0) continue;
606  HcalDetId hcalid(HcalBarrel,ieta,phi+1,d+1);
607  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
608  HcalElectronicsId emap_entry=emap.lookup(hcalid);
609  sprintf(str,"Time-Ref=%.2f",val);
610  printTableLine(badTiming,cnt++,hcalid,lmap_entry,emap_entry,str);
611  }
612  }
613  }
614  cnt=0;
615  if((HEP[0]+HEM[0])>0){
616  badTiming << "<tr><td align=\"center\"><h3>"<< "HE" <<"</h3></td></tr>" << endl;
617  for(int d=0;d<4;++d){
618  int etabins=BadTiming_val[d]->GetNbinsX();
619  int phibins=BadTiming_val[d]->GetNbinsY();
620  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
621  int ieta=CalcIeta(eta,d+1);
622  if(ieta==-9999) continue;
623  if(!isHE(eta,d+1)) continue;
624  float val=BadTiming_val[d]->GetBinContent(eta+1,phi+1);
625  if(val==0) continue;
626  HcalDetId hcalid(HcalEndcap,ieta,phi+1,d+1);
627  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
628  HcalElectronicsId emap_entry=emap.lookup(hcalid);
629  sprintf(str,"Time-Ref=%.2f",val);
630  printTableLine(badTiming,cnt++,hcalid,lmap_entry,emap_entry,str);
631  }
632  }
633  }
634  cnt=0;
635  if(HO[0]>0){
636  badTiming << "<tr><td align=\"center\"><h3>"<< "HO" <<"</h3></td></tr>" << endl;
637  for(int d=0;d<4;++d){
638  int etabins=BadTiming_val[d]->GetNbinsX();
639  int phibins=BadTiming_val[d]->GetNbinsY();
640  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
641  int ieta=CalcIeta(eta,d+1);
642  if(ieta==-9999) continue;
643  if(!isHO(eta,d+1)) continue;
644  float val=BadTiming_val[d]->GetBinContent(eta+1,phi+1);
645  if(val==0) continue;
646  HcalDetId hcalid(HcalOuter,ieta,phi+1,d+1);
647  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
648  HcalElectronicsId emap_entry=emap.lookup(hcalid);
649  sprintf(str,"Time-Ref=%.2f",val);
650  printTableLine(badTiming,cnt++,hcalid,lmap_entry,emap_entry,str);
651  }
652  }
653  }
654  cnt=0;
655  if((HFP[0]+HFM[0])>0){
656  badTiming << "<tr><td align=\"center\"><h3>"<< "HF" <<"</h3></td></tr>" << endl;
657  for(int d=0;d<4;++d){
658  int etabins=BadTiming_val[d]->GetNbinsX();
659  int phibins=BadTiming_val[d]->GetNbinsY();
660  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
661  int ieta=CalcIeta(eta,d+1);
662  if(ieta==-9999) continue;
663  if(!isHF(eta,d+1)) continue;
664  float val=BadTiming_val[d]->GetBinContent(eta+1,phi+1);
665  if(val==0) continue;
666  HcalDetId hcalid(HcalForward,ieta,phi+1,d+1);
667  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
668  HcalElectronicsId emap_entry=emap.lookup(hcalid);
669  sprintf(str,"Time-Ref=%.2f",val);
670  printTableLine(badTiming,cnt++,hcalid,lmap_entry,emap_entry,str);
671  }
672  }
673  }
675  cnt=0;
676  if((HBP[1]+HBM[1])>0){
677  badEnergy << "<tr><td align=\"center\"><h3>"<< "HB" <<"</h3></td></tr>" << endl;
678  for(int d=0;d<4;++d){
679  int etabins=BadEnergy_val[d]->GetNbinsX();
680  int phibins=BadEnergy_val[d]->GetNbinsY();
681  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
682  int ieta=CalcIeta(eta,d+1);
683  if(ieta==-9999) continue;
684  if(!isHB(eta,d+1)) continue;
685  float val=BadEnergy_val[d]->GetBinContent(eta+1,phi+1);
686  if(val==0) continue;
687  HcalDetId hcalid(HcalBarrel,ieta,phi+1,d+1);
688  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
689  HcalElectronicsId emap_entry=emap.lookup(hcalid);
690  sprintf(str,"Energy/Ref=%.2f",val);
691  printTableLine(badEnergy,cnt++,hcalid,lmap_entry,emap_entry,str);
692  }
693  }
694  }
695  cnt=0;
696  if((HEP[1]+HEM[1])>0){
697  badEnergy << "<tr><td align=\"center\"><h3>"<< "HE" <<"</h3></td></tr>" << endl;
698  for(int d=0;d<4;++d){
699  int etabins=BadEnergy_val[d]->GetNbinsX();
700  int phibins=BadEnergy_val[d]->GetNbinsY();
701  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
702  int ieta=CalcIeta(eta,d+1);
703  if(ieta==-9999) continue;
704  if(!isHE(eta,d+1)) continue;
705  float val=BadEnergy_val[d]->GetBinContent(eta+1,phi+1);
706  if(val==0) continue;
707  HcalDetId hcalid(HcalEndcap,ieta,phi+1,d+1);
708  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
709  HcalElectronicsId emap_entry=emap.lookup(hcalid);
710  sprintf(str,"Energy/Ref=%.2f",val);
711  printTableLine(badEnergy,cnt++,hcalid,lmap_entry,emap_entry,str);
712  }
713  }
714  }
715  cnt=0;
716  if(HO[1]>0){
717  badEnergy << "<tr><td align=\"center\"><h3>"<< "HO" <<"</h3></td></tr>" << endl;
718  for(int d=0;d<4;++d){
719  int etabins=BadEnergy_val[d]->GetNbinsX();
720  int phibins=BadEnergy_val[d]->GetNbinsY();
721  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
722  int ieta=CalcIeta(eta,d+1);
723  if(ieta==-9999) continue;
724  if(!isHO(eta,d+1)) continue;
725  float val=BadEnergy_val[d]->GetBinContent(eta+1,phi+1);
726  if(val==0) continue;
727  HcalDetId hcalid(HcalOuter,ieta,phi+1,d+1);
728  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
729  HcalElectronicsId emap_entry=emap.lookup(hcalid);
730  sprintf(str,"Energy/Ref=%.2f",val);
731  printTableLine(badEnergy,cnt++,hcalid,lmap_entry,emap_entry,str);
732  }
733  }
734  }
735  cnt=0;
736  if((HFP[1]+HFM[1])>0){
737  badEnergy << "<tr><td align=\"center\"><h3>"<< "HF" <<"</h3></td></tr>" << endl;
738  for(int d=0;d<4;++d){
739  int etabins=BadEnergy_val[d]->GetNbinsX();
740  int phibins=BadEnergy_val[d]->GetNbinsY();
741  for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
742  int ieta=CalcIeta(eta,d+1);
743  if(ieta==-9999) continue;
744  if(!isHF(eta,d+1)) continue;
745  float val=BadEnergy_val[d]->GetBinContent(eta+1,phi+1);
746  if(val==0) continue;
747  HcalDetId hcalid(HcalForward,ieta,phi+1,d+1);
748  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(hcalid);
749  HcalElectronicsId emap_entry=emap.lookup(hcalid);
750  sprintf(str,"Energy/Ref=%.2f",val);
751  printTableLine(badEnergy,cnt++,hcalid,lmap_entry,emap_entry,str);
752  }
753  }
754  }
755 
756  printTableTail(badTiming);
757  badTiming.close();
758  printTableTail(badEnergy);
759  badEnergy.close();
760 
762  std::ofstream htmlFile;
763  string outfile=htmlDir+name_+".html";
764  htmlFile.open(outfile.c_str());
766  gROOT->SetBatch(true);
767  gStyle->SetCanvasColor(0);
768  gStyle->SetPadColor(0);
769  gStyle->SetOptStat(111110);
770  gStyle->SetPalette(1);
771  TCanvas *can=new TCanvas("HcalDetDiagLaserClient","HcalDetDiagLaserClient",0,0,500,350);
772  can->cd();
773 
774  if(Raddam[0]->GetEntries()>0){
775  std::ofstream RADDAM;
776  RADDAM.open((htmlDir + "RADDAM_"+name_).c_str());
777  RADDAM << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">"<< endl;
778  RADDAM << "<head>"<< endl;
779  RADDAM << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>"<< endl;
780  RADDAM << "<title>"<< "RADDAM channels" <<"</title>"<< endl;
781  RADDAM << "<style type=\"text/css\">"<< endl;
782  RADDAM << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"<< endl;
783  RADDAM << " td.s0 { font-family: arial, arial ce, helvetica; }"<< endl;
784  RADDAM << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< endl;
785  RADDAM << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }"<< endl;
786  RADDAM << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }"<< endl;
787  RADDAM << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }"<< endl;
788  RADDAM << "</style>"<< endl;
789  RADDAM << "<body>"<< endl;
790  RADDAM << "<h2>Run "<< runNo<<": RADDAM channels event shape </h2>" << endl;
791  RADDAM << "<table>"<< endl;
792 
793  char str[100];
794  for(int i=0;i<28;i++){
795  RADDAM << "<tr align=\"left\">" << endl;
796  //Raddam[2*i]->SetStats(0);
797  //Raddam[2*i+1]->SetStats(0);
798  Raddam[2*i]->Draw(); sprintf(str,"%02d",2*i); can->SaveAs((htmlDir + "raddam_ch"+str+".gif").c_str());
799  Raddam[2*i+1]->Draw(); sprintf(str,"%02d",2*i+1); can->SaveAs((htmlDir + "raddam_ch"+str+".gif").c_str());
800  sprintf(str,"raddam_ch%02d.gif",2*i);
801  RADDAM << "<td align=\"center\"><img src=\""<<str<<"\" alt=\"raddam channel\"> </td>" << endl;
802  sprintf(str,"raddam_ch%02d.gif",2*i+1);
803  RADDAM << "<td align=\"center\"><img src=\""<<str<<"\" alt=\"raddam channel\"> </td>" << endl;
804  RADDAM << "</tr>" << endl;
805  }
806 
807  RADDAM << "</table>"<< endl;
808  RADDAM << "</body>"<< endl;
809  RADDAM << "</html>"<< endl;
810  RADDAM.close();
811  }
812 
813  Time2Dhbhehf->SetXTitle("i#eta");
814  Time2Dhbhehf->SetYTitle("i#phi");
815  Time2Dho->SetXTitle("i#eta");
816  Time2Dho->SetYTitle("i#phi");
817  Energy2Dhbhehf->SetXTitle("i#eta");
818  Energy2Dhbhehf->SetYTitle("i#phi");
819  Energy2Dho->SetXTitle("i#eta");
820  Energy2Dho->SetYTitle("i#phi");
821  refTime2Dhbhehf->SetXTitle("i#eta");
822  refTime2Dhbhehf->SetYTitle("i#phi");
823  refTime2Dho->SetXTitle("i#eta");
824  refTime2Dho->SetYTitle("i#phi");
825  refEnergy2Dhbhehf->SetXTitle("i#eta");
826  refEnergy2Dhbhehf->SetYTitle("i#phi");
827  refEnergy2Dho->SetXTitle("i#eta");
828  refEnergy2Dho->SetYTitle("i#phi");
829  refTime2Dhbhehf->SetMinimum(0);
830  refTime2Dhbhehf->SetMaximum(2);
831  refTime2Dho->SetMinimum(0);
832  refTime2Dho->SetMaximum(2);
833  refEnergy2Dhbhehf->SetMinimum(0.5);
834  refEnergy2Dhbhehf->SetMaximum(1.5);
835  refEnergy2Dho->SetMinimum(0.5);
836  refEnergy2Dho->SetMaximum(1.5);
837 
838  Time2Dhbhehf->SetNdivisions(36,"Y");
839  Time2Dho->SetNdivisions(36,"Y");
840  Energy2Dhbhehf->SetNdivisions(36,"Y");
841  Energy2Dho->SetNdivisions(36,"Y");
842  refTime2Dhbhehf->SetNdivisions(36,"Y");
843  refTime2Dho->SetNdivisions(36,"Y");
844  refEnergy2Dhbhehf->SetNdivisions(36,"Y");
845  refEnergy2Dho->SetNdivisions(36,"Y");
846 
847  // html page header
848  htmlFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> " << endl;
849  htmlFile << "<html> " << endl;
850  htmlFile << "<head> " << endl;
851  htmlFile << " <meta content=\"text/html; charset=ISO-8859-1\" " << endl;
852  htmlFile << " http-equiv=\"content-type\"> " << endl;
853  htmlFile << " <title>Detector Diagnostics Laser Monitor</title> " << endl;
854  htmlFile << "</head> " << endl;
855  htmlFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << endl;
856 
857  htmlFile << "<style type=\"text/css\">"<< endl;
858  htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FF7700; text-align: center;}"<< endl;
859  htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< endl;
860  htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: red; }"<< endl;
861  htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: yellow; }"<< endl;
862  htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: green; }"<< endl;
863  htmlFile << " td.s5 { font-family: arial, arial ce, helvetica; background-color: silver; }"<< endl;
864  std::string state[4]={"<td class=\"s2\" align=\"center\">",
865  "<td class=\"s3\" align=\"center\">",
866  "<td class=\"s4\" align=\"center\">",
867  "<td class=\"s5\" align=\"center\">"};
868  htmlFile << "</style>"<< endl;
869 
870  htmlFile << "<body> " << endl;
871  htmlFile << "<br> " << endl;
872  htmlFile << "<h2>Run:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" << endl;
873  htmlFile << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span " << endl;
874  htmlFile << " style=\"color: rgb(0, 0, 153);\">" << runNo << "</span></h2>" << endl;
875  htmlFile << "<h2>Monitoring task:&nbsp;&nbsp;&nbsp;&nbsp; <span " << endl;
876  htmlFile << " style=\"color: rgb(0, 0, 153);\">Detector Diagnostics Laser Monitor</span></h2> " << endl;
877  htmlFile << "<h2>Events processed:&nbsp;&nbsp;&nbsp;&nbsp;<span " << endl;
878  htmlFile << " style=\"color: rgb(0, 0, 153);\">" << ievt_ << "</span></h2>" << endl;
879  htmlFile << "<hr>" << endl;
880 
881  htmlFile << "<table width=100% border=1>" << endl;
882  htmlFile << "<tr>" << endl;
883  htmlFile << "<td class=\"s0\" width=20% align=\"center\">SebDet</td>" << endl;
884  htmlFile << "<td class=\"s0\" width=20% align=\"center\">Bad Timing</td>" << endl;
885  htmlFile << "<td class=\"s0\" width=20% align=\"center\">Bad Energy</td>" << endl;
886  htmlFile << "</tr><tr>" << endl;
887  int ind1=0,ind2=0;
888  htmlFile << "<td class=\"s1\" align=\"center\">HB+</td>" << endl;
889  if(HBP[0]==0) ind1=2; if(HBP[0]>0 && HBP[0]<=12) ind1=1; if(HBP[0]>12) ind1=0;
890  if(HBP[1]==0) ind2=2; if(HBP[1]>0 && HBP[1]<=12) ind2=1; if(HBP[1]>12) ind2=0;
891  if(!HBpresent_) ind1=ind2=3;
892  htmlFile << state[ind1] << HBP[0] <<"</td>" << endl;
893  htmlFile << state[ind2] << HBP[1] <<"</td>" << endl;
894  htmlFile << "</tr><tr>" << endl;
895  htmlFile << "<td class=\"s1\" align=\"center\">HB-</td>" << endl;
896  if(HBM[0]==0) ind1=2; if(HBM[0]>0 && HBP[0]<=12) ind1=1; if(HBM[0]>12) ind1=0;
897  if(HBM[1]==0) ind2=2; if(HBM[1]>0 && HBP[1]<=12) ind2=1; if(HBM[1]>12) ind2=0;
898  if(!HBpresent_) ind1=ind2=3;
899  htmlFile << state[ind1] << HBM[0] <<"</td>" << endl;
900  htmlFile << state[ind2] << HBM[1] <<"</td>" << endl;
901  htmlFile << "</tr><tr>" << endl;
902  htmlFile << "<td class=\"s1\" align=\"center\">HE+</td>" << endl;
903  if(HEP[0]==0) ind1=2; if(HEP[0]>0 && HEP[0]<=12) ind1=1; if(HEP[0]>12) ind1=0;
904  if(HEP[1]==0) ind2=2; if(HEP[1]>0 && HEP[1]<=12) ind2=1; if(HEP[1]>12) ind2=0;
905  if(!HEpresent_) ind1=ind2=3;
906  if(ind1==0 || ind2==0) status|=2; else if(ind1==1 || ind2==1) status|=1;
907  htmlFile << state[ind1] << HEP[0] <<"</td>" << endl;
908  htmlFile << state[ind2] << HEP[1] <<"</td>" << endl;
909  htmlFile << "</tr><tr>" << endl;
910  htmlFile << "<td class=\"s1\" align=\"center\">HE-</td>" << endl;
911  if(HEM[0]==0) ind1=2; if(HEM[0]>0 && HEM[0]<=12) ind1=1; if(HEM[0]>12) ind1=0;
912  if(HEM[1]==0) ind2=2; if(HEM[1]>0 && HEM[1]<=12) ind2=1; if(HEM[1]>12) ind2=0;
913  if(!HEpresent_) ind1=ind2=3;
914  if(ind1==0 || ind2==0) status|=2; else if(ind1==1 || ind2==1) status|=1;
915  htmlFile << state[ind1] << HEM[0] <<"</td>" << endl;
916  htmlFile << state[ind2] << HEM[1] <<"</td>" << endl;
917  htmlFile << "</tr><tr>" << endl;
918  htmlFile << "<td class=\"s1\" align=\"center\">HF+</td>" << endl;
919  if(HFP[0]==0) ind1=2; if(HFP[0]>0 && HFP[0]<=12) ind1=1; if(HFP[0]>12) ind1=0;
920  if(HFP[1]==0) ind2=2; if(HFP[1]>0 && HFP[1]<=12) ind2=1; if(HFP[1]>12) ind2=0;
921  if(!HOpresent_) ind1=ind2=3;
922  if(ind1==0 || ind2==0) status|=2; else if(ind1==1 || ind2==1) status|=1;
923  htmlFile << state[ind1] << HFP[0] <<"</td>" << endl;
924  htmlFile << state[ind2] << HFP[1] <<"</td>" << endl;
925  htmlFile << "</tr><tr>" << endl;
926  htmlFile << "<td class=\"s1\" align=\"center\">HF-</td>" << endl;
927  if(HFM[0]==0) ind1=2; if(HFM[0]>0 && HFM[0]<=12) ind1=1; if(HFM[0]>12) ind1=0;
928  if(HFM[1]==0) ind2=2; if(HFM[1]>0 && HFM[1]<=12) ind2=1; if(HFM[1]>12) ind2=0;
929  if(!HFpresent_) ind1=ind2=3;
930  if(ind1==0 || ind2==0) status|=2; else if(ind1==1 || ind2==1) status|=1;
931  htmlFile << state[ind1] << HFM[0] <<"</td>" << endl;
932  htmlFile << state[ind2] << HFM[1] <<"</td>" << endl;
933  htmlFile << "</tr><tr>" << endl;
934  htmlFile << "<td class=\"s1\" align=\"center\">HO</td>" << endl;
935  if(HO[0]==0) ind1=2; if(HO[0]>0 && HO[0]<=12) ind1=1; if(HO[0]>12) ind1=0;
936  if(HO[1]==0) ind2=2; if(HO[1]>0 && HO[1]<=12) ind2=1; if(HO[1]>12) ind2=0;
937  if(!HFpresent_) ind1=ind2=3;
938  if(ind1==0 || ind2==0) status|=2; else if(ind1==1 || ind2==1) status|=1;
939  htmlFile << state[ind1] << HO[0] <<"</td>" << endl;
940  htmlFile << state[ind2] << HO[1] <<"</td>" << endl;
941 
942  htmlFile << "</tr></table>" << endl;
943  htmlFile << "<hr>" << endl;
944 
945  if((badT+badE)>0){
946  htmlFile << "<table width=100% border=1><tr>" << endl;
947  if(badT>0) htmlFile << "<td><a href=\"" << "bad_timing_table.html" <<"\">list of bad timing channels</a></td>";
948  if(badE>0) htmlFile << "<td><a href=\"" << "bad_energy_table.html" <<"\">list of bad energy channels</a></td>";
949  htmlFile << "</tr></table>" << endl;
950  }
951 
953 
954  if(Raddam[0]->GetEntries()>0){
955  htmlFile << "<h2 align=\"center\"><a href=\"" << ("RADDAM_"+name_).c_str() <<"\">RADDAM channels</a><h2>";
956  htmlFile << "<hr>" << endl;
957  }
958 
959  htmlFile << "<h2 align=\"center\">Stability Laser plots (Reference run "<<ref_run<<")</h2>" << endl;
960  htmlFile << "<table width=100% border=0><tr>" << endl;
961 
962  can->SetGridy();
963  can->SetGridx();
964 
965  htmlFile << "<tr align=\"left\">" << endl;
966  refTime2Dhbhehf->SetStats(0);
967  refTime2Dho->SetStats(0);
968  refTime2Dhbhehf->Draw("COLZ"); can->SaveAs((htmlDir + "ref_laser_timing_hbhehf.gif").c_str());
969  refTime2Dho->Draw("COLZ"); can->SaveAs((htmlDir + "ref_laser_timing_ho.gif").c_str());
970  htmlFile << "<td align=\"center\"><img src=\"ref_laser_timing_hbhehf.gif\" alt=\"ref laser timing distribution\"> </td>" << endl;
971  htmlFile << "<td align=\"center\"><img src=\"ref_laser_timing_ho.gif\" alt=\"ref laser timing distribution\"> </td>" << endl;
972  htmlFile << "</tr>" << endl;
973 
974 
975  if(hb!=0 && he!=0 && ho!=0 && hf!=0){
976  hb->SetMarkerStyle(22);
977  hb->SetMarkerColor(kRed);
978  hb->GetYaxis()->SetRangeUser(hb->GetMinimum()-1,hb->GetMaximum()+1);
979  hb->GetXaxis()->SetNdivisions(520);
980 
981  he->SetMarkerStyle(22);
982  he->SetMarkerColor(kRed);
983  he->GetYaxis()->SetRangeUser(he->GetMinimum()-1,he->GetMaximum()+1);
984  he->GetXaxis()->SetNdivisions(520);
985 
986  ho->SetMarkerStyle(22);
987  ho->SetMarkerColor(kRed);
988  ho->GetYaxis()->SetRangeUser(ho->GetMinimum()-1,ho->GetMaximum()+1);
989  ho->GetXaxis()->SetNdivisions(520);
990 
991  hf->SetMarkerStyle(22);
992  hf->SetMarkerColor(kRed);
993  hf->GetYaxis()->SetRangeUser(hf->GetMinimum()-1,hf->GetMaximum()+1);
994  hf->GetXaxis()->SetNdivisions(520);
995  hb->SetStats(0);
996  he->SetStats(0);
997  ho->SetStats(0);
998  hf->SetStats(0);
999 
1000 
1001  hb->GetXaxis()->SetBit(TAxis::kLabelsVert);
1002  he->GetXaxis()->SetBit(TAxis::kLabelsVert);
1003  ho->GetXaxis()->SetBit(TAxis::kLabelsVert);
1004  hf->GetXaxis()->SetBit(TAxis::kLabelsVert);
1005  hb->GetXaxis()->SetLabelSize(0.05);
1006  he->GetXaxis()->SetLabelSize(0.05);
1007  ho->GetXaxis()->SetLabelSize(0.05);
1008  hf->GetXaxis()->SetLabelSize(0.05);
1009 
1010 
1011  htmlFile << "<tr align=\"left\">" << endl;
1012  htmlFile << "<td align=\"center\"><img src=\"hb_rbx_timing1D.gif\" alt=\"rbx timing\"> </td>" << endl;
1013  htmlFile << "<td align=\"center\"><img src=\"he_rbx_timing1D.gif\" alt=\"rbx timing\"> </td>" << endl;
1014  htmlFile << "</tr>" << endl;
1015  htmlFile << "<tr align=\"left\">" << endl;
1016  htmlFile << "<td align=\"center\"><img src=\"ho_rbx_timing1D.gif\" alt=\"rbx timing\"> </td>" << endl;
1017  htmlFile << "<td align=\"center\"><img src=\"hf_rbx_timing1D.gif\" alt=\"rbx timing\"> </td>" << endl;
1018  htmlFile << "</tr>" << endl;
1019  }else printf("Error\n");
1020 
1021 
1022 
1023  htmlFile << "<tr align=\"left\">" << endl;
1024  refEnergy2Dhbhehf->SetStats(0);
1025  refEnergy2Dho->SetStats(0);
1026  refEnergy2Dhbhehf->Draw("COLZ"); can->SaveAs((htmlDir + "ref_laser_energy_hbhehf.gif").c_str());
1027  refEnergy2Dho->Draw("COLZ"); can->SaveAs((htmlDir + "ref_laser_energy_ho.gif").c_str());
1028  htmlFile << "<td align=\"center\"><img src=\"ref_laser_energy_hbhehf.gif\" alt=\"ref laser energy distribution\"> </td>" << endl;
1029  htmlFile << "<td align=\"center\"><img src=\"ref_laser_energy_ho.gif\" alt=\"ref laser energy distribution\"> </td>" << endl;
1030  htmlFile << "</tr>" << endl;
1031 
1032  htmlFile << "</table>" << endl;
1033 
1034 
1035  htmlFile << "<h2 align=\"center\">Summary Laser plots</h2>" << endl;
1036  htmlFile << "<table width=100% border=0><tr>" << endl;
1037  htmlFile << "<tr align=\"left\">" << endl;
1038  Time2Dhbhehf->SetStats(0);
1039  Time2Dho->SetStats(0);
1040  Time2Dhbhehf->Draw("COLZ"); can->SaveAs((htmlDir + "laser_timing_hbhehf.gif").c_str());
1041  Time2Dho->Draw("COLZ"); can->SaveAs((htmlDir + "laser_timing_ho.gif").c_str());
1042  htmlFile << "<td align=\"center\"><img src=\"laser_timing_hbhehf.gif\" alt=\"laser timing distribution\"> </td>" << endl;
1043  htmlFile << "<td align=\"center\"><img src=\"laser_timing_ho.gif\" alt=\"laser timing distribution\"> </td>" << endl;
1044  htmlFile << "</tr>" << endl;
1045 
1046  htmlFile << "<tr align=\"left\">" << endl;
1047  Energy2Dhbhehf->SetStats(0);
1048  Energy2Dho->SetStats(0);
1049  Energy2Dhbhehf->Draw("COLZ"); can->SaveAs((htmlDir + "laser_energy_hbhehf.gif").c_str());
1050  Energy2Dho->Draw("COLZ"); can->SaveAs((htmlDir + "laser_energy_ho.gif").c_str());
1051  htmlFile << "<td align=\"center\"><img src=\"laser_energy_hbhehf.gif\" alt=\"laser energy distribution\"> </td>" << endl;
1052  htmlFile << "<td align=\"center\"><img src=\"laser_energy_ho.gif\" alt=\"laser energy distribution\"> </td>" << endl;
1053  htmlFile << "</tr>" << endl;
1054 
1055 
1056  htmlFile << "<tr align=\"left\">" << endl;
1057  hbheEnergy->Draw(); can->SaveAs((htmlDir + "hbhe_laser_energy_distribution.gif").c_str());
1058  hbheEnergyRMS->Draw(); can->SaveAs((htmlDir + "hbhe_laser_energy_rms_distribution.gif").c_str());
1059  htmlFile << "<td align=\"center\"><img src=\"hbhe_laser_energy_distribution.gif\" alt=\"hbhe laser energy distribution\"> </td>" << endl;
1060  htmlFile << "<td align=\"center\"><img src=\"hbhe_laser_energy_rms_distribution.gif\" alt=\"hbhelaser energy rms distribution\"> </td>" << endl;
1061  htmlFile << "</tr>" << endl;
1062  htmlFile << "<tr align=\"left\">" << endl;
1063  hbheTiming->Draw(); can->SaveAs((htmlDir + "hbhe_laser_timing_distribution.gif").c_str());
1064  hbheTimingRMS->Draw(); can->SaveAs((htmlDir + "hbhe_laser_timing_rms_distribution.gif").c_str());
1065  htmlFile << "<td align=\"center\"><img src=\"hbhe_laser_timing_distribution.gif\" alt=\"hbhe laser timing distribution\"> </td>" << endl;
1066  htmlFile << "<td align=\"center\"><img src=\"hbhe_laser_timing_rms_distribution.gif\" alt=\"hbhe laser timing rms distribution\"> </td>" << endl;
1067  htmlFile << "</tr>" << endl;
1068 
1069  htmlFile << "<tr align=\"left\">" << endl;
1070  hoEnergy->Draw(); can->SaveAs((htmlDir + "ho_laser_energy_distribution.gif").c_str());
1071  hoEnergyRMS->Draw(); can->SaveAs((htmlDir + "ho_laser_energy_rms_distribution.gif").c_str());
1072  htmlFile << "<td align=\"center\"><img src=\"ho_laser_energy_distribution.gif\" alt=\"ho laser energy distribution\"> </td>" << endl;
1073  htmlFile << "<td align=\"center\"><img src=\"ho_laser_energy_rms_distribution.gif\" alt=\"ho laser energy rms distribution\"> </td>" << endl;
1074  htmlFile << "</tr>" << endl;
1075  htmlFile << "<tr align=\"left\">" << endl;
1076  hoTiming->Draw(); can->SaveAs((htmlDir + "ho_laser_timing_distribution.gif").c_str());
1077  hoTimingRMS->Draw(); can->SaveAs((htmlDir + "ho_laser_timing_rms_distribution.gif").c_str());
1078  htmlFile << "<td align=\"center\"><img src=\"ho_laser_timing_distribution.gif\" alt=\"ho laser timing distribution\"> </td>" << endl;
1079  htmlFile << "<td align=\"center\"><img src=\"ho_laser_timing_rms_distribution.gif\" alt=\"ho laser timing rms distribution\"> </td>" << endl;
1080 
1081  htmlFile << "</tr>" << endl;
1082  htmlFile << "<tr align=\"left\">" << endl;
1083  hfEnergy->Draw(); can->SaveAs((htmlDir + "hf_laser_energy_distribution.gif").c_str());
1084  hfEnergyRMS->Draw(); can->SaveAs((htmlDir + "hf_laser_energy_rms_distribution.gif").c_str());
1085  htmlFile << "<td align=\"center\"><img src=\"hf_laser_energy_distribution.gif\" alt=\"hf laser energy distribution\"> </td>" << endl;
1086  htmlFile << "<td align=\"center\"><img src=\"hf_laser_energy_rms_distribution.gif\" alt=\"hf laser energy rms distribution\"> </td>" << endl;
1087  htmlFile << "</tr>" << endl;
1088  htmlFile << "<tr align=\"left\">" << endl;
1089  hfTiming->Draw(); can->SaveAs((htmlDir + "hf_laser_timing_distribution.gif").c_str());
1090  hfTimingRMS->Draw(); can->SaveAs((htmlDir + "hf_laser_timing_rms_distribution.gif").c_str());
1091  htmlFile << "<td align=\"center\"><img src=\"hf_laser_timing_distribution.gif\" alt=\"hf laser timing distribution\"> </td>" << endl;
1092  htmlFile << "<td align=\"center\"><img src=\"hf_laser_timing_rms_distribution.gif\" alt=\"hf laser timing rms distribution\"> </td>" << endl;
1093  htmlFile << "</tr>" << endl;
1094 
1095  can->SetBottomMargin(0.2);
1096  if(hb->GetEntries()>0)hb->Draw("P");else hb->Draw(); can->SaveAs((htmlDir + "hb_rbx_timing1D.gif").c_str());
1097  if(he->GetEntries()>0)he->Draw("P");else he->Draw(); can->SaveAs((htmlDir + "he_rbx_timing1D.gif").c_str());
1098  if(ho->GetEntries()>0)ho->Draw("P");else ho->Draw(); can->SaveAs((htmlDir + "ho_rbx_timing1D.gif").c_str());
1099  if(hf->GetEntries()>0)hf->Draw("P");else hf->Draw(); can->SaveAs((htmlDir + "hf_rbx_timing1D.gif").c_str());
1100 
1101  htmlFile << "</table>" << endl;
1102 
1103  htmlFile << "</body> " << endl;
1104  htmlFile << "</html> " << endl;
1105  can->Close();
1106  delete can;
1108  htmlFile.close();
1109  return;
1110 }
1111 
1113 {
1114  if ( ProblemCellsByDepth ) delete ProblemCellsByDepth;
1115 }
int fiberChannel() const
bool isHO(int etabin, int depth)
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
int fiberIndex() const
get the fiber index. For VME 1-8 (which of eight fibers carried by a spigot), for uTCA fibers are zer...
int pixel() const
int ib
Definition: cuy.py:660
static const Raddam_ch RADDAM_CH[56]
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
HcalDetDiagLaserClient()
Constructors.
std::vector< std::string > HcalEtaPhiHistNames()
int htrSlot() const
get the htr slot
int zside(DetId const &)
bool isHE(int etabin, int depth)
int readoutVMECrateId() const
get the readout VME crate number
std::string rbx() const
tuple d
Definition: ztail.py:151
bool validHtmlOutput(DQMStore::IBooker &, DQMStore::IGetter &)
int depth() const
get the tower depth
Definition: HcalDetId.h:55
list outfile
Definition: EdgesToViz.py:91
int CalcIeta(int subdet, int eta, int depth)
static void printTableHeader(std::ofstream &file, std::string header)
int htrTopBottom() const
get the htr top/bottom (1=top/0=bottom), valid for VME
int rm() const
int ieta() const
get the cell ieta
Definition: HcalDetId.h:51
int dccid() const
get the (Hcal local) DCC id for VME, crate number for uTCA
HcalSubdetector
Definition: HcalAssistant.h:31
void analyze(DQMStore::IBooker &, DQMStore::IGetter &)
void htmlOutput(DQMStore::IBooker &, DQMStore::IGetter &, std::string)
T min(T a, T b)
Definition: MathUtil.h:58
bool isHB(int etabin, int depth)
int spigot() const
get the spigot (input number on DCC, AMC card number for uTCA)
std::string valueString(void) const
int iphi() const
get the cell iphi
Definition: HcalDetId.h:53
virtual void calculateProblems(void)
bool isHF(int etabin, int depth)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
int64_t getIntValue(void) const
int adc() const
void FillUnphysicalHEHFBins(std::vector< TH2F > &hh)
Geom::Phi< T > phi() const
void setupProblemCells(DQMStore::IBooker &, DQMStore::IGetter &)
void updateChannelStatus(std::map< HcalDetId, unsigned int > &myqual)
static void printTableTail(std::ofstream &file)
tuple cout
Definition: gather_cfg.py:121
int rmFiber() const
tuple status
Definition: ntuplemaker.py:245
int qieCard() const
Readout chain identification for Hcal.
static void printTableLine(std::ofstream &file, int ind, HcalDetId &detid, HcalFrontEndId &lmap_entry, HcalElectronicsId &emap_entry, std::string comment="")
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
#define comment(par)
Definition: vmac.h:161