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