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