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