CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalDetDiagLEDClient.cc
Go to the documentation of this file.
4 
8 
10 
11 #include <iostream>
12 
13 /*
14  * \file HcalDetDiagLEDClient.cc
15  *
16  * \author J. Temple
17  * \brief Hcal DetDiagLED Client class
18  */
19 
21  name_=myname; status=0;
22  needLogicalMap_=true;
23 }
24 
26  name_=myname;
27  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
28  debug_ = ps.getUntrackedParameter<int>("debug",0);
29  prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
30  if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
31  prefixME_.append("/");
32  subdir_ = ps.getUntrackedParameter<std::string>("DetDiagLEDFolder","DetDiagLEDMonitor_Hcal/");
33  if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
34  subdir_.append("/");
35  subdir_=prefixME_+subdir_;
36 
37  validHtmlOutput_ = ps.getUntrackedParameter<bool>("DetDiagLED_validHtmlOutput",true);
38  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
39  badChannelStatusMask_ = ps.getUntrackedParameter<int>("DetDiagLED_BadChannelStatusMask",
40  ps.getUntrackedParameter<int>("BadChannelStatusMask",(1<<HcalChannelStatus::HcalCellDead)));
41  needLogicalMap_=true;
42 
43  doProblemCellSetup_ = true;
44 
46 }
47 
49  if (debug_>2) std::cout <<"\tHcalDetDiagLEDClient::analyze()"<<std::endl;
51  calculateProblems(ib,ig);
52 }
53 
55 void HcalDetDiagLEDClient::updateChannelStatus(std::map<HcalDetId, unsigned int>& myqual){
56  // This gets called by HcalMonitorClient
57  // trigger primitives don't yet contribute to channel status (though they could...)
58  // see dead or hot cell code for an example
59 
60 }
61 
62 
64 
66 {
67 
69  problemnames_.clear();
70 
71  // Put the appropriate name of your problem summary here
72  ProblemCells=ib.book2D(" ProblemDetDiagLED",
73  " Problem DetDiagLED Rate for all HCAL;ieta;iphi",
74  85,-42.5,42.5,
75  72,0.5,72.5);
76  problemnames_.push_back(ProblemCells->getName());
77  if (debug_>1)
78  std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
79  ib.setCurrentFolder(subdir_+"problem_DetDiagLED");
81  ProblemCellsByDepth->setup(ib," Problem DetDiagLED Rate");
82  for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
83  problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
84 
85  doProblemCellSetup_ = false;
86 
87 }
88 
90  nevts_=0;
91 }
92 //void HcalDetDiagLEDClient::endRun(void){analyze();}
95 
97  if(status&2) return true;
98  return false;
99 }
101  if(status&1) return true;
102  return false;
103 }
104 bool HcalDetDiagLEDClient::hasOther_Temp(void){return false;}
105 bool HcalDetDiagLEDClient::test_enabled(void){return true;}
106 
108  std::string s=subdir_+"HcalDetDiagLEDMonitor Event Number";
109  MonitorElement *me = ig.get(s.c_str());
110  int n=0;
111  if ( me ) {
112  s = me->valueString();
113  sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &n);
114  }
115  if(n<100) return false;
116  return true;
117 }
118 static void printTableHeader(std::ofstream& file,std::string header){
119  file << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">"<< std::endl;
120  file << "<head>"<< std::endl;
121  file << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>"<< std::endl;
122  file << "<title>"<< header <<"</title>"<< std::endl;
123  file << "<style type=\"text/css\">"<< std::endl;
124  file << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"<< std::endl;
125  file << " td.s0 { font-family: arial, arial ce, helvetica; }"<< std::endl;
126  file << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< std::endl;
127  file << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }"<< std::endl;
128  file << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }"<< std::endl;
129  file << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }"<< std::endl;
130  file << "</style>"<< std::endl;
131  file << "<body>"<< std::endl;
132  file << "<table>"<< std::endl;
133 }
134 static void printTableLine(std::ofstream& file,int ind,HcalDetId& detid,HcalFrontEndId& lmap_entry,HcalElectronicsId &emap_entry, std::string comment=""){
135  if(ind==0){
136  file << "<tr>";
137  file << "<td class=\"s4\" align=\"center\">#</td>" << std::endl;
138  file << "<td class=\"s1\" align=\"center\">ETA</td>" << std::endl;
139  file << "<td class=\"s1\" align=\"center\">PHI</td>" << std::endl;
140  file << "<td class=\"s1\" align=\"center\">DEPTH</td>"<< std::endl;
141  file << "<td class=\"s1\" align=\"center\">RBX</td>" << std::endl;
142  file << "<td class=\"s1\" align=\"center\">RM</td>" << std::endl;
143  file << "<td class=\"s1\" align=\"center\">PIXEL</td>" << std::endl;
144  file << "<td class=\"s1\" align=\"center\">RM_FIBER</td>" << std::endl;
145  file << "<td class=\"s1\" align=\"center\">FIBER_CH</td>" << std::endl;
146  file << "<td class=\"s1\" align=\"center\">QIE</td>" << std::endl;
147  file << "<td class=\"s1\" align=\"center\">ADC</td>" << std::endl;
148  file << "<td class=\"s1\" align=\"center\">CRATE</td>" << std::endl;
149  file << "<td class=\"s1\" align=\"center\">DCC</td>" << std::endl;
150  file << "<td class=\"s1\" align=\"center\">SPIGOT</td>" << std::endl;
151  file << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>" << std::endl;
152  file << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>" << std::endl;
153  file << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>" << std::endl;
154  if(comment[0]!=0) file << "<td class=\"s1\" align=\"center\">Comment</td>" << std::endl;
155  file << "</tr>" << std::endl;
156  }
157  std::string raw_class;
158  file << "<tr>"<< std::endl;
159  if((ind%2)==1){
160  raw_class="<td class=\"s2\" align=\"center\">";
161  }else{
162  raw_class="<td class=\"s3\" align=\"center\">";
163  }
164  file << "<td class=\"s4\" align=\"center\">" << ind+1 <<"</td>"<< std::endl;
165  file << raw_class<< detid.ieta()<<"</td>"<< std::endl;
166  file << raw_class<< detid.iphi()<<"</td>"<< std::endl;
167  file << raw_class<< detid.depth() <<"</td>"<< std::endl;
168  file << raw_class<< lmap_entry.rbx()<<"</td>"<< std::endl;
169  file << raw_class<< lmap_entry.rm() <<"</td>"<< std::endl;
170  file << raw_class<< lmap_entry.pixel()<<"</td>"<< std::endl;
171  file << raw_class<< lmap_entry.rmFiber() <<"</td>"<< std::endl;
172  file << raw_class<< lmap_entry.fiberChannel()<<"</td>"<< std::endl;
173  file << raw_class<< lmap_entry.qieCard() <<"</td>"<< std::endl;
174  file << raw_class<< lmap_entry.adc()<<"</td>"<< std::endl;
175  file << raw_class<< emap_entry.readoutVMECrateId()<<"</td>"<< std::endl;
176  file << raw_class<< emap_entry.dccid()<<"</td>"<< std::endl;
177  file << raw_class<< emap_entry.spigot()<<"</td>"<< std::endl;
178  file << raw_class<< emap_entry.fiberIndex()<<"</td>"<< std::endl;
179  file << raw_class<< emap_entry.htrSlot()<<"</td>"<< std::endl;
180  file << raw_class<< emap_entry.htrTopBottom()<<"</td>"<< std::endl;
181  if(comment[0]!=0) file << raw_class<< comment<<"</td>"<< std::endl;
182 }
183 static void printTableTail(std::ofstream& file){
184  file << "</table>"<< std::endl;
185  file << "</body>"<< std::endl;
186  file << "</html>"<< std::endl;
187 }
189  int subdetval=-1;
190  if (subdet.compare("HB")==0) subdetval=(int)HcalBarrel;
191  else if (subdet.compare("HE")==0) subdetval=(int)HcalEndcap;
192  else if (subdet.compare("HO")==0) subdetval=(int)HcalOuter;
193  else if (subdet.compare("HF")==0) subdetval=(int)HcalForward;
194  else return -1.0;
195  int ietabin=CalcEtaBin(subdetval, eta, depth)+1;
196  if(type==1) return ChannelStatusMissingChannels[depth-1]->GetBinContent(ietabin,phi);
197  if(type==2) return ChannelStatusUnstableChannels[depth-1]->GetBinContent(ietabin,phi);
198  if(type==3) return ChannelStatusUnstableLEDsignal[depth-1]->GetBinContent(ietabin,phi);
199  if(type==4) return ChannelStatusLEDMean[depth-1]->GetBinContent(ietabin,phi);
200  if(type==5) return ChannelStatusLEDRMS[depth-1]->GetBinContent(ietabin,phi);
201  if(type==6) return ChannelStatusTimeMean[depth-1]->GetBinContent(ietabin,phi);
202  if(type==7) return ChannelStatusTimeRMS[depth-1]->GetBinContent(ietabin,phi);
203  return -1.0;
204 }
206  int subdetval=-1;
207  if (subdet.compare("HB")==0) subdetval=(int)HcalBarrel;
208  else if (subdet.compare("HE")==0) subdetval=(int)HcalEndcap;
209  else if (subdet.compare("HO")==0) subdetval=(int)HcalOuter;
210  else if (subdet.compare("HF")==0) subdetval=(int)HcalForward;
211  else return -1.0;
212  int ietabin=CalcEtaBin(subdetval, eta, depth)+1;
213  if(type==1) return ChannelsLEDEnergy[depth-1]->GetBinContent(ietabin,phi);
214  if(type==2) return ChannelsLEDEnergyRef[depth-1]->GetBinContent(ietabin,phi);
215  return -1.0;
216 }
219 int MissingCnt=0;
220 int UnstableCnt=0;
221 int UnstableLEDCnt=0;
222 int BadTimingCnt=0;
223 int HBP[7]={0,0,0,0,0,0,0},newHBP[7]={0,0,0,0,0,0,0};
224 int HBM[7]={0,0,0,0,0,0,0},newHBM[7]={0,0,0,0,0,0,0};
225 int HEP[7]={0,0,0,0,0,0,0},newHEP[7]={0,0,0,0,0,0,0};
226 int HEM[7]={0,0,0,0,0,0,0},newHEM[7]={0,0,0,0,0,0,0};
227 int HFP[7]={0,0,0,0,0,0,0},newHFP[7]={0,0,0,0,0,0,0};
228 int HFM[7]={0,0,0,0,0,0,0},newHFM[7]={0,0,0,0,0,0,0};
229 int HO[7] ={0,0,0,0,0,0,0},newHO[7] ={0,0,0,0,0,0,0};
230 std::string subdet[4]={"HB","HE","HO","HF"};
231 
232  if (debug_>0) std::cout << "<HcalDetDiagLEDClient::htmlOutput> Preparing html output ..." << std::endl;
234  std::vector<std::string> name = HcalEtaPhiHistNames();
235 
236  for(int i=0;i<4;++i){
240  std::string s;
241  s=subdir_+"channel status/"+name[i]+" Missing Channels";
242  me=ig.get(s.c_str());
243  if (me!=0) ChannelStatusMissingChannels[i]=HcalUtilsClient::getHisto<TH2F*>(me,cloneME_,ChannelStatusMissingChannels[i],debug_); else return;
244  s=subdir_+"channel status/"+name[i]+" Unstable Channels";
245  me=ig.get(s.c_str());
246  if (me!=0) ChannelStatusUnstableChannels[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannelStatusUnstableChannels[i], debug_); else return;
247  s=subdir_+"channel status/"+name[i]+" Unstable LED";
248  me=ig.get(s.c_str());
249  if (me!=0) ChannelStatusUnstableLEDsignal[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannelStatusUnstableLEDsignal[i], debug_); else return;
250  s=subdir_+"channel status/"+name[i]+" LED Mean";
251  me=ig.get(s.c_str());
252  if (me!=0) ChannelStatusLEDMean[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannelStatusLEDMean[i], debug_); else return;
253  s=subdir_+"channel status/"+name[i]+" LED RMS";
254  me=ig.get(s.c_str());
255  if (me!=0) ChannelStatusLEDRMS[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannelStatusLEDRMS[i], debug_); else return;
256  s=subdir_+"channel status/"+name[i]+" Time Mean";
257  me=ig.get(s.c_str());
258  if (me!=0) ChannelStatusTimeMean[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannelStatusTimeMean[i], debug_); else return;
259  s=subdir_+"channel status/"+name[i]+" Time RMS";
260  me=ig.get(s.c_str());
261  if (me!=0) ChannelStatusTimeRMS[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannelStatusTimeRMS[i], debug_); else return;
262  s=subdir_+"Summary Plots/"+name[i]+" Channel LED Energy";
263  me=ig.get(s.c_str());
264  if (me!=0) ChannelsLEDEnergy[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannelsLEDEnergy[i], debug_); else return;
265  s=subdir_+"Summary Plots/"+name[i]+" Channel LED Energy Reference";
266  me=ig.get(s.c_str());
267  if (me!=0) ChannelsLEDEnergyRef[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannelsLEDEnergyRef[i], debug_); else return;
268  }
269 
270  // check how many problems we have:
271  for(int sd=0;sd<4;sd++){
272  int feta=0,teta=0,fdepth=0,tdepth=0;
273  if(sd==0){ feta=-16; teta=16 ;fdepth=1; tdepth=2; }
274  if(sd==1){ feta=-29; teta=29 ;fdepth=1; tdepth=3; }
275  if(sd==2){ feta=-15; teta=15 ;fdepth=4; tdepth=4; }
276  if(sd==3){ feta=-42; teta=42 ;fdepth=1; tdepth=2; }
277  for(int phi=1;phi<=72;phi++) for(int depth=fdepth;depth<=tdepth;depth++) for(int eta=feta;eta<=teta;eta++){
278  if(sd==3 && eta>-29 && eta<29) continue;
279  double problem[7]={0,0,0,0,0,0,0};
280  for(int i=0;i<6;i++){
281  problem[i] =get_channel_status(subdet[sd],eta,phi,depth,i+1);
282  if(problem[i]!=0){
284  if(sd==0)SD=HcalBarrel;
285  else if(sd==1) SD=HcalEndcap;
286  else if(sd==2) SD=HcalOuter;
287  else if(sd==3) SD=HcalForward;
288  HcalDetId hcalid(SD, eta, phi, depth);
289  if(sd==0){ if(eta>0){
290  HBP[i]++;
291  if(badstatusmap.find(hcalid)==badstatusmap.end())newHBP[i]++;
292  }else{
293  HBM[i]++;
294  if(badstatusmap.find(hcalid)==badstatusmap.end())newHBM[i]++;
295  }}
296  if(sd==1){ if(eta>0){
297  HEP[i]++;
298  if(badstatusmap.find(hcalid)==badstatusmap.end())newHEP[i]++;
299  }else{
300  HEM[i]++;
301  if(badstatusmap.find(hcalid)==badstatusmap.end())newHEM[i]++;
302  }}
303  if(sd==2){
304  HO[i]++;
305  if(badstatusmap.find(hcalid)==badstatusmap.end())newHO[i]++;
306  }
307  if(sd==3){ if(eta>0){
308  HFP[i]++;
309  if(badstatusmap.find(hcalid)==badstatusmap.end())newHFP[i]++;
310  }else{
311  HFM[i]++;
312  if(badstatusmap.find(hcalid)==badstatusmap.end())newHFM[i]++;
313  }}
314  }
315  }
316  }
317  }
318  // missing channels list
319  std::ofstream Missing;
320  Missing.open((htmlDir + "Missing.html").c_str());
321  printTableHeader(Missing,"Missing Channels list");
322  // Bad timing channels list
323  std::ofstream BadTiming;
324  BadTiming.open((htmlDir + "BadTiming.html").c_str());
325  printTableHeader(BadTiming,"Bad Timing Channels list");
326  // unstable channels list
327  std::ofstream Unstable;
328  Unstable.open((htmlDir + "Unstable.html").c_str());
329  printTableHeader(Unstable,"Low LED signal Channels list");
330  // unstable LED signal list
331  std::ofstream BadLED;
332  BadLED.open((htmlDir + "UnstableLED.html").c_str());
333  printTableHeader(BadLED,"Unstable LED signal channels list");
334 
335  for(int sd=0;sd<4;sd++){
336  int cnt=0;
337  if(sd==0 && ((HBM[0]+HBP[0])==0 || (HBM[0]+HBP[0])==(1296*2))) continue;
338  if(sd==1 && ((HEM[0]+HEP[0])==0 || (HEM[0]+HEP[0])==(1296*2))) continue;
339  if(sd==2 && ((HO[0])==0 || HO[0]==2160)) continue;
340  if(sd==3 && ((HFM[0]+HFP[0])==0 || (HFM[0]+HFP[0])==(864*2))) continue;
341  Missing << "<tr><td align=\"center\"><h3>"<< subdet[sd] <<"</h3></td></tr>" << std::endl;
342  int feta=0,teta=0,fdepth=0,tdepth=0;
343  if(sd==0){ feta=-16; teta=16 ;fdepth=1; tdepth=2; if(HBM[0]==1296) feta=0; if(HBP[0]==1296) teta=0;}
344  if(sd==1){ feta=-29; teta=29 ;fdepth=1; tdepth=3; if(HEM[0]==1296) feta=0; if(HEP[0]==1296) teta=0;}
345  if(sd==2){ feta=-15; teta=15 ;fdepth=4; tdepth=4; if(HO[0] ==2160) {feta=0; teta=0; }}
346  if(sd==3){ feta=-42; teta=42 ;fdepth=1; tdepth=2; if(HFM[0]==864) feta=0; if(HFP[0]==864) teta=0; }
347  for(int phi=1;phi<=72;phi++) for(int depth=fdepth;depth<=tdepth;depth++) for(int eta=feta;eta<=teta;eta++){
348  if(sd==3 && eta>-29 && eta<29) continue;
349  double missing =get_channel_status(subdet[sd],eta,phi,depth,1);
350  if(missing>0){
351  HcalDetId *detid=0;
352  if(sd==0) detid=new HcalDetId(HcalBarrel,eta,phi,depth);
353  if(sd==1) detid=new HcalDetId(HcalEndcap,eta,phi,depth);
354  if(sd==2) detid=new HcalDetId(HcalOuter,eta,phi,depth);
355  if(sd==3) detid=new HcalDetId(HcalForward,eta,phi,depth);
356  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(*detid);
357  HcalElectronicsId emap_entry=emap.lookup(*detid);
358  std::string s=" ";
359  if(badstatusmap.find(*detid)!=badstatusmap.end()){ s="Known problem"; }
360  printTableLine(Missing,cnt++,*detid,lmap_entry,emap_entry,s); MissingCnt++;
361  delete detid;
362  }
363  }
364  }
365 
366  for(int sd=0;sd<4;sd++){
367  int cnt=0;
368  if(sd==0 && (HBM[5]+HBP[5])==0) continue;
369  if(sd==1 && (HEM[5]+HEP[5])==0) continue;
370  if(sd==2 && (HO[5])==0) continue;
371  if(sd==3 && (HFM[5]+HFP[5])==0) continue;
372  BadTiming << "<tr><td align=\"center\"><h3>"<< subdet[sd] <<"</h3></td></tr>" << std::endl;
373  int feta=0,teta=0,fdepth=0,tdepth=0;
374  if(sd==0){ feta=-16; teta=16 ;fdepth=1; tdepth=2; if(HBM[0]==1296) feta=0; if(HBP[0]==1296) teta=0;}
375  if(sd==1){ feta=-29; teta=29 ;fdepth=1; tdepth=3; if(HEM[0]==1296) feta=0; if(HEP[0]==1296) teta=0;}
376  if(sd==2){ feta=-15; teta=15 ;fdepth=4; tdepth=4; if(HO[0] ==2160) {feta=0; teta=0; }}
377  if(sd==3){ feta=-42; teta=42 ;fdepth=1; tdepth=2; if(HFM[0]==864) feta=0; if(HFP[0]==864) teta=0; }
378  for(int phi=1;phi<=72;phi++) for(int depth=fdepth;depth<=tdepth;depth++) for(int eta=feta;eta<=teta;eta++){
379  if(sd==3 && eta>-29 && eta<29) continue;
380  double badtiming =get_channel_status(subdet[sd],eta,phi,depth,6);
381  if(badtiming!=0){
382  try{
383  char comment[100]; sprintf(comment,"Time-mean=%.1f\n",badtiming);
384  HcalDetId *detid=0;
385  if(sd==0) detid=new HcalDetId(HcalBarrel,eta,phi,depth);
386  if(sd==1) detid=new HcalDetId(HcalEndcap,eta,phi,depth);
387  if(sd==2) detid=new HcalDetId(HcalOuter,eta,phi,depth);
388  if(sd==3) detid=new HcalDetId(HcalForward,eta,phi,depth);
389  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(*detid);
390  HcalElectronicsId emap_entry=emap.lookup(*detid);
391  printTableLine(BadTiming,cnt++,*detid,lmap_entry,emap_entry,comment); BadTimingCnt++;
392  delete detid;
393  }catch(cms::Exception &){ continue;}
394  }
395  }
396  }
397 
398  for(int sd=0;sd<4;sd++){
399  int cnt=0;
400  if(sd==0 && (HBM[1]+HBP[1])==0) continue;
401  if(sd==1 && (HEM[1]+HEP[1])==0) continue;
402  if(sd==2 && (HO[1])==0) continue;
403  if(sd==3 && (HFM[1]+HFP[1])==0) continue;
404  Unstable << "<tr><td align=\"center\"><h3>"<< subdet[sd] <<"</h3></td></tr>" << std::endl;
405  int feta=0,teta=0,fdepth=0,tdepth=0;
406  if(sd==0){ feta=-16; teta=16 ;fdepth=1; tdepth=2;}
407  if(sd==1){ feta=-29; teta=29 ;fdepth=1; tdepth=3;}
408  if(sd==2){ feta=-15; teta=15 ;fdepth=4; tdepth=4;}
409  if(sd==3){ feta=-42; teta=42 ;fdepth=1; tdepth=2;}
410  for(int phi=1;phi<=72;phi++) for(int depth=fdepth;depth<=tdepth;depth++) for(int eta=feta;eta<=teta;eta++){
411  if(sd==3 && eta>-29 && eta<29) continue;
412  double unstable =get_channel_status(subdet[sd],eta,phi,depth,2);
413  if(unstable>0){
414  try{
415  char comment[100]; sprintf(comment,"%.3f%%\n",(1.0-unstable)*100.0);
416  HcalDetId *detid=0;
417  if(sd==0) detid=new HcalDetId(HcalBarrel,eta,phi,depth);
418  if(sd==1) detid=new HcalDetId(HcalEndcap,eta,phi,depth);
419  if(sd==2) detid=new HcalDetId(HcalOuter,eta,phi,depth);
420  if(sd==3) detid=new HcalDetId(HcalForward,eta,phi,depth);
421  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(*detid);
422  HcalElectronicsId emap_entry=emap.lookup(*detid);
423  printTableLine(Unstable,cnt++,*detid,lmap_entry,emap_entry,comment); UnstableCnt++;
424  delete detid;
425  }catch(cms::Exception &){ continue;}
426  }
427  }
428  }
429 
430  for(int sd=0;sd<4;sd++){
431  int cnt=0;
432  if(sd==0 && (HBM[2]+HBP[2])==0) continue;
433  if(sd==1 && (HEM[2]+HEP[2])==0) continue;
434  if(sd==2 && (HO[2])==0) continue;
435  if(sd==3 && (HFM[2]+HFP[2])==0) continue;
436  BadLED << "<tr><td align=\"center\"><h3>"<< subdet[sd] <<"</h3></td></tr>" << std::endl;
437  int feta=0,teta=0,fdepth=0,tdepth=0;
438  if(sd==0){ feta=-16; teta=16 ;fdepth=1; tdepth=2;}
439  if(sd==1){ feta=-29; teta=29 ;fdepth=1; tdepth=3;}
440  if(sd==2){ feta=-15; teta=15 ;fdepth=4; tdepth=4;}
441  if(sd==3){ feta=-42; teta=42 ;fdepth=1; tdepth=2;}
442  for(int phi=1;phi<=72;phi++) for(int depth=fdepth;depth<=tdepth;depth++) for(int eta=feta;eta<=teta;eta++){
443  if(sd==3 && eta>-29 && eta<29) continue;
444  double badled =get_channel_status(subdet[sd],eta,phi,depth,3);
445  if(badled>0){
446  try{
447  char comment[100]; sprintf(comment,"%.3f%%\n",(badled)*100.0);
448  HcalDetId *detid=0;
449  if(sd==0) detid=new HcalDetId(HcalBarrel,eta,phi,depth);
450  if(sd==1) detid=new HcalDetId(HcalEndcap,eta,phi,depth);
451  if(sd==2) detid=new HcalDetId(HcalOuter,eta,phi,depth);
452  if(sd==3) detid=new HcalDetId(HcalForward,eta,phi,depth);
453  HcalFrontEndId lmap_entry=logicalMap_->getHcalFrontEndId(*detid);
454  HcalElectronicsId emap_entry=emap.lookup(*detid);
455  std::string s=" ";
456  if(badstatusmap.find(*detid)!=badstatusmap.end()){ s="Known problem"; }
457  printTableLine(BadLED,cnt++,*detid,lmap_entry,emap_entry,s); UnstableLEDCnt++;
458  delete detid;
459  }catch(cms::Exception &){ continue;}
460  }
461  }
462  }
463  printTableTail(Missing);
464  Missing.close();
465  printTableTail(BadTiming);
466  BadTiming.close();
467  printTableTail(Unstable);
468  Unstable.close();
469  printTableTail(BadLED);
470  BadLED.close();
472  int ievt_ = -1,runNo=-1;
473  std::string ref_run;
474  std::string s=subdir_+"HcalDetDiagLEDMonitor Event Number";
475  me = ig.get(s.c_str());
476  if ( me ) {
477  s = me->valueString();
478  sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &ievt_);
479  }
480  s=subdir_+"HcalDetDiagLEDMonitor Run Number";
481  me = ig.get(s.c_str());
482  if ( me ) {
483  s = me->valueString();
484  sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &runNo);
485  }
486  s=subdir_+"HcalDetDiagLEDMonitor Reference Run";
487  me = ig.get(s.c_str());
488  if(me) {
489  std::string s=me->valueString();
490  char str[200];
491  sscanf((s.substr(2,s.length()-2)).c_str(), "%s", str);
492  ref_run=str;
493  }
494  TH1F *Energy=0,*Timing=0,*EnergyHF=0,*TimingHF=0,*EnergyRMS=0,*TimingRMS=0,*EnergyRMSHF=0,*TimingRMSHF=0;
495  TH2F *Time2Dhbhehf=0,*Time2Dho=0,*Energy2Dhbhehf=0,*Energy2Dho=0;
496  TH2F *HBPphi=0,*HBMphi=0,*HEPphi=0,*HEMphi=0,*HFPphi=0,*HFMphi=0,*HO0phi=0,*HO1Pphi=0,*HO2Pphi=0,*HO1Mphi=0,*HO2Mphi=0;
497 
498  s=subdir_+"Summary Plots/HBHEHO LED Energy Distribution"; me=ig.get(s.c_str());
499  if(me!=0) Energy=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, Energy, debug_); else return;
500  s=subdir_+"Summary Plots/HBHEHO LED Timing Distribution"; me=ig.get(s.c_str());
501  if(me!=0) Timing=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, Timing, debug_); else return;
502  s=subdir_+"Summary Plots/HBHEHO LED Energy RMS_div_Energy Distribution"; me=ig.get(s.c_str());
503  if(me!=0) EnergyRMS=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, EnergyRMS, debug_); else return;
504  s=subdir_+"Summary Plots/HBHEHO LED Timing RMS Distribution"; me=ig.get(s.c_str());
505  if(me!=0) TimingRMS=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, TimingRMS, debug_); else return;
506  s=subdir_+"Summary Plots/HF LED Energy Distribution"; me=ig.get(s.c_str());
507  if(me!=0) EnergyHF=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, EnergyHF, debug_); else return;
508  s=subdir_+"Summary Plots/HF LED Timing Distribution"; me=ig.get(s.c_str());
509  if(me!=0) TimingHF=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, TimingHF, debug_); else return;
510  s=subdir_+"Summary Plots/HF LED Energy RMS_div_Energy Distribution"; me=ig.get(s.c_str());
511  if(me!=0) EnergyRMSHF=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, EnergyRMSHF, debug_); else return;
512  s=subdir_+"Summary Plots/HF LED Timing RMS Distribution"; me=ig.get(s.c_str());
513  if(me!=0) TimingRMSHF=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, TimingRMSHF, debug_); else return;
514 
515  s=subdir_+"Summary Plots/LED Timing HBHEHF"; me=ig.get(s.c_str());
516  if(me!=0) Time2Dhbhehf=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Time2Dhbhehf, debug_); else return;
517  s=subdir_+"Summary Plots/LED Timing HO"; me=ig.get(s.c_str());
518  if(me!=0) Time2Dho=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Time2Dho, debug_); else return;
519  s=subdir_+"Summary Plots/LED Energy HBHEHF"; me=ig.get(s.c_str());
520  if(me!=0) Energy2Dhbhehf=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Energy2Dhbhehf, debug_); else return;
521  s=subdir_+"Summary Plots/LED Energy HO"; me=ig.get(s.c_str());
522  if(me!=0) Energy2Dho=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Energy2Dho, debug_); else return;
523 
524  s=subdir_+"Summary Plots/HBP Average over HPD LED Ref"; me=ig.get(s.c_str());
525  if(me!=0) HBPphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HBPphi, debug_); else return;
526  s=subdir_+"Summary Plots/HBM Average over HPD LED Ref"; me=ig.get(s.c_str());
527  if(me!=0) HBMphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HBMphi, debug_); else return;
528  s=subdir_+"Summary Plots/HEP Average over HPD LED Ref"; me=ig.get(s.c_str());
529  if(me!=0) HEPphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HEPphi, debug_); else return;
530  s=subdir_+"Summary Plots/HEM Average over HPD LED Ref"; me=ig.get(s.c_str());
531  if(me!=0) HEMphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HEMphi, debug_); else return;
532  s=subdir_+"Summary Plots/HFP Average over RM LED Ref"; me=ig.get(s.c_str());
533  if(me!=0) HFPphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HFPphi, debug_); else return;
534  s=subdir_+"Summary Plots/HFM Average over RM LED Ref"; me=ig.get(s.c_str());
535  if(me!=0) HFMphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HFMphi, debug_); else return;
536 
537  s=subdir_+"Summary Plots/HO0 Average over HPD LED Ref"; me=ig.get(s.c_str());
538  if(me!=0) HO0phi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HO0phi, debug_); else return;
539  s=subdir_+"Summary Plots/HO1P Average over HPD LED Ref"; me=ig.get(s.c_str());
540  if(me!=0) HO1Pphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HO1Pphi, debug_); else return;
541  s=subdir_+"Summary Plots/HO2P Average over HPD LED Ref"; me=ig.get(s.c_str());
542  if(me!=0) HO2Pphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HO2Pphi, debug_); else return;
543  s=subdir_+"Summary Plots/HO1M Average over HPD LED Ref"; me=ig.get(s.c_str());
544  if(me!=0) HO1Mphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HO1Mphi, debug_); else return;
545  s=subdir_+"Summary Plots/HO2M Average over HPD LED Ref"; me=ig.get(s.c_str());
546  if(me!=0) HO2Mphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HO2Mphi, debug_); else return;
547 
548  gROOT->SetBatch(true);
549  gStyle->SetCanvasColor(0);
550  gStyle->SetPadColor(0);
551  gStyle->SetOptStat(111110);
552  gStyle->SetPalette(1);
553 
554  TCanvas *can=new TCanvas("HcalDetDiagLEDClient","HcalDetDiagLEDClient",0,0,500,350);
555  can->SetGridy();
556  can->SetGridx();
557  can->cd();
558 
559  std::ofstream htmlFile;
560  std::string outfile=htmlDir+name_+".html";
561  htmlFile.open(outfile.c_str());
562  // html page header
563  htmlFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> " << std::endl;
564  htmlFile << "<html> " << std::endl;
565  htmlFile << "<head> " << std::endl;
566  htmlFile << " <meta content=\"text/html; charset=ISO-8859-1\" " << std::endl;
567  htmlFile << " http-equiv=\"content-type\"> " << std::endl;
568  htmlFile << " <title>Detector Diagnostics LED Monitor</title> " << std::endl;
569  htmlFile << "</head> " << std::endl;
570  htmlFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << std::endl;
571  htmlFile << "<style type=\"text/css\">"<< std::endl;
572  htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FF7700; text-align: center;}"<< std::endl;
573  htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< std::endl;
574  htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: red; }"<< std::endl;
575  htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: yellow; }"<< std::endl;
576  htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: green; }"<< std::endl;
577  htmlFile << " td.s5 { font-family: arial, arial ce, helvetica; background-color: silver; }"<< std::endl;
578  std::string state[4]={"<td class=\"s2\" align=\"center\">",
579  "<td class=\"s3\" align=\"center\">",
580  "<td class=\"s4\" align=\"center\">",
581  "<td class=\"s5\" align=\"center\">"};
582  htmlFile << "</style>"<< std::endl;
583  htmlFile << "<body> " << std::endl;
584  htmlFile << "<br> " << std::endl;
585  htmlFile << "<h2>Run:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" << std::endl;
586  htmlFile << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span " << std::endl;
587  htmlFile << " style=\"color: rgb(0, 0, 153);\">" << runNo << "</span></h2>" << std::endl;
588  htmlFile << "<h2>Monitoring task:&nbsp;&nbsp;&nbsp;&nbsp; <span " << std::endl;
589  htmlFile << " style=\"color: rgb(0, 0, 153);\">Detector Diagnostics LED Monitor</span></h2> " << std::endl;
590  htmlFile << "<h2>Events processed:&nbsp;&nbsp;&nbsp;&nbsp;<span " << std::endl;
591  htmlFile << " style=\"color: rgb(0, 0, 153);\">" << ievt_ << "</span></h2>" << std::endl;
592  htmlFile << "<hr>" << std::endl;
594  htmlFile << "<table width=100% border=1>" << std::endl;
595  htmlFile << "<tr>" << std::endl;
596  htmlFile << "<td class=\"s0\" width=15% align=\"center\">SebDet</td>" << std::endl;
597  htmlFile << "<td class=\"s0\" width=17% align=\"center\">Missing</td>" << std::endl;
598  htmlFile << "<td class=\"s0\" width=17% align=\"center\">Unstable</td>" << std::endl;
599  htmlFile << "<td class=\"s0\" width=17% align=\"center\">low/no LED signal</td>" << std::endl;
600  htmlFile << "<td class=\"s0\" width=17% align=\"center\">Bad Timing</td>" << std::endl;
601  htmlFile << "<td class=\"s0\" width=17% align=\"center\">Bad LED signal</td>" << std::endl;
602  htmlFile << "</tr><tr>" << std::endl;
603  int ind1=0,ind2=0,ind3=0,ind4=0,ind5=0;
604  htmlFile << "<td class=\"s1\" align=\"center\">HB+</td>" << std::endl;
605  ind1=3; if(newHBP[0]==0) ind1=2; if(newHBP[0]>0 && newHBP[0]<=12) ind1=1; if(newHBP[0]>=12 && HBP[0]<1296) ind1=0;
606  ind2=3; if(newHBP[1]==0) ind2=2; if(newHBP[1]>0) ind2=1; if(newHBP[1]>21) ind2=0;
607  ind3=3; if(newHBP[2]==0) ind3=2; if(newHBP[2]>0) ind3=1; if(newHBP[2]>21) ind3=0;
608  ind4=3; if((newHBP[3]+newHBP[4])==0) ind4=2; if((newHBP[3]+newHBP[4])>0) ind4=1; if((newHBP[3]+newHBP[4])>21) ind4=0;
609  ind5=3; if((newHBP[5]+newHBP[6])==0) ind5=2; if((newHBP[5]+newHBP[6])>0) ind5=1; if((newHBP[5]+newHBP[6])>21) ind5=0;
610  if(ind1==3) ind2=ind3=ind4=ind5=3;
611  if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1) status|=1;
612  htmlFile << state[ind1] << HBP[0] <<" (1296)</td>" << std::endl;
613  htmlFile << state[ind2] << HBP[1] <<"</td>" << std::endl;
614  htmlFile << state[ind3] << HBP[2] <<"</td>" << std::endl;
615  htmlFile << state[ind5] << HBP[5]+HBP[6] <<"</td>" << std::endl;
616  htmlFile << state[ind4] << HBP[3]+HBP[4] <<"</td>" << std::endl;
617 
618  htmlFile << "</tr><tr>" << std::endl;
619  htmlFile << "<td class=\"s1\" align=\"center\">HB-</td>" << std::endl;
620  ind1=3; if(newHBM[0]==0) ind1=2; if(newHBM[0]>0 && newHBM[0]<=12) ind1=1; if(newHBM[0]>=12 && HBM[0]<1296) ind1=0;
621  ind2=3; if(newHBM[1]==0) ind2=2; if(newHBM[1]>0) ind2=1; if(newHBM[1]>21) ind2=0;
622  ind3=3; if(newHBM[2]==0) ind3=2; if(newHBM[2]>0) ind3=1; if(newHBM[2]>21) ind3=0;
623  ind4=3; if((newHBM[3]+newHBM[4])==0) ind4=2; if((newHBM[3]+newHBM[4])>0) ind4=1; if((newHBM[3]+newHBM[4])>21) ind4=0;
624  ind5=3; if((newHBM[5]+newHBM[6])==0) ind5=2; if((newHBM[5]+newHBM[6])>0) ind5=1; if((newHBM[5]+newHBM[6])>21) ind5=0;
625  if(ind1==3) ind2=ind3=ind4=ind5=3;
626  if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1)status|=1;
627  htmlFile << state[ind1] << HBM[0] <<" (1296)</td>" << std::endl;
628  htmlFile << state[ind2] << HBM[1] <<"</td>" << std::endl;
629  htmlFile << state[ind3] << HBM[2] <<"</td>" << std::endl;
630  htmlFile << state[ind5] << HBM[5]+HBM[6] <<"</td>" << std::endl;
631  htmlFile << state[ind4] << HBM[3]+HBM[4] <<"</td>" << std::endl;
632 
633  htmlFile << "</tr><tr>" << std::endl;
634  htmlFile << "<td class=\"s1\" align=\"center\">HE+</td>" << std::endl;
635  ind1=3; if(newHEP[0]==0) ind1=2; if(newHEP[0]>0 && newHEP[0]<=12) ind1=1; if(newHEP[0]>=12 && HEP[0]<1296) ind1=0;
636  ind2=3; if(newHEP[1]==0) ind2=2; if(newHEP[1]>0) ind2=1; if(newHEP[1]>21) ind2=0;
637  ind3=3; if(newHEP[2]==0) ind3=2; if(newHEP[2]>0) ind3=1; if(newHEP[2]>21) ind3=0;
638  ind4=3; if((newHEP[3]+newHEP[4])==0) ind4=2; if((newHEP[3]+newHEP[4])>0) ind4=1; if((newHEP[3]+newHEP[4])>21) ind4=0;
639  ind5=3; if((newHEP[5]+newHEP[6])==0) ind5=2; if((newHEP[5]+newHEP[6])>0) ind5=1; if((newHEP[5]+newHEP[6])>21) ind5=0;
640  if(ind1==3) ind2=ind3=ind4=ind5=3;
641  if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1)status|=1;
642  htmlFile << state[ind1] << HEP[0] <<" (1296)</td>" << std::endl;
643  htmlFile << state[ind2] << HEP[1] <<"</td>" << std::endl;
644  htmlFile << state[ind3] << HEP[2] <<"</td>" << std::endl;
645  htmlFile << state[ind5] << HEP[5]+HEP[6] <<"</td>" << std::endl;
646  htmlFile << state[ind4] << HEP[3]+HEP[4] <<"</td>" << std::endl;
647 
648  htmlFile << "</tr><tr>" << std::endl;
649  htmlFile << "<td class=\"s1\" align=\"center\">HE-</td>" << std::endl;
650  ind1=3; if(newHEM[0]==0) ind1=2; if(newHEM[0]>0 && newHEM[0]<=12) ind1=1; if(newHEM[0]>=12 && HEM[0]<1296) ind1=0;
651  ind2=3; if(newHEM[1]==0) ind2=2; if(newHEM[1]>0) ind2=1; if(newHEM[1]>21) ind2=0;
652  ind3=3; if(newHEM[2]==0) ind3=2; if(newHEM[2]>0) ind3=1; if(newHEM[2]>21) ind3=0;
653  ind4=3; if((newHEM[3]+newHEM[4])==0) ind4=2; if((newHEM[3]+newHEM[4])>0) ind4=1; if((newHEM[3]+newHEM[4])>21) ind4=0;
654  ind5=3; if((newHEM[5]+newHEM[6])==0) ind5=2; if((newHEM[5]+newHEM[6])>0) ind5=1; if((newHEM[5]+newHEM[6])>21) ind5=0;
655  if(ind1==3) ind2=ind3=ind4=ind5=3;
656  if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1)status|=1;
657  htmlFile << state[ind1] << HEM[0] <<" (1296)</td>" << std::endl;
658  htmlFile << state[ind2] << HEM[1] <<"</td>" << std::endl;
659  htmlFile << state[ind3] << HEM[2] <<"</td>" << std::endl;
660  htmlFile << state[ind5] << HEM[5]+HEM[6] <<"</td>" << std::endl;
661  htmlFile << state[ind4] << HEM[3]+HEM[4] <<"</td>" << std::endl;
662 
663  htmlFile << "</tr><tr>" << std::endl;
664  htmlFile << "<td class=\"s1\" align=\"center\">HF+</td>" << std::endl;
665  ind1=3; if(newHFP[0]==0) ind1=2; if(newHFP[0]>0 && newHFP[0]<=12) ind1=1; if(newHFP[0]>=12 && HFP[0]<864) ind1=0;
666  ind2=3; if(newHFP[1]==0) ind2=2; if(newHFP[1]>0) ind2=1; if(newHFP[1]>21) ind2=0;
667  ind3=3; if(newHFP[2]==0) ind3=2; if(newHFP[2]>0) ind3=1; if(newHFP[2]>21) ind3=0;
668  ind4=3; if((newHFP[3]+newHFP[4])==0) ind4=2; if((newHFP[3]+newHFP[4])>0) ind4=1; if((newHFP[3]+newHFP[4])>21) ind4=0;
669  ind5=3; if((newHFP[5]+newHFP[6])==0) ind5=2; if((newHFP[5]+newHFP[6])>0) ind5=1; if((newHFP[5]+newHFP[6])>21) ind5=0;
670  if(ind1==3) ind2=ind3=ind4=ind5=3;
671  if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1)status|=1;
672  htmlFile << state[ind1] << HFP[0] <<" (864)</td>" << std::endl;
673  htmlFile << state[ind2] << HFP[1] <<"</td>" << std::endl;
674  htmlFile << state[ind3] << HFP[2] <<"</td>" << std::endl;
675  htmlFile << state[ind5] << HFP[5]+HFP[6] <<"</td>" << std::endl;
676  htmlFile << state[ind4] << HFP[3]+HFP[4] <<"</td>" << std::endl;
677 
678  htmlFile << "</tr><tr>" << std::endl;
679  htmlFile << "<td class=\"s1\" align=\"center\">HF-</td>" << std::endl;
680  ind1=3; if(newHFM[0]==0) ind1=2; if(newHFM[0]>0 && newHFM[0]<=12) ind1=1; if(newHFM[0]>=12 && HFM[0]<864) ind1=0;
681  ind2=3; if(newHFM[1]==0) ind2=2; if(newHFM[1]>0) ind2=1; if(newHFM[1]>21) ind2=0;
682  ind3=3; if(newHFM[2]==0) ind3=2; if(newHFM[2]>0) ind3=1; if(newHFM[2]>21) ind3=0;
683  ind4=3; if((HFM[3]+HFM[4])==0) ind4=2; if((HFM[3]+HFM[4])>0) ind4=1; if((HFM[3]+HFM[4])>21) ind4=0;
684  ind5=3; if((HFM[5]+HFM[6])==0) ind5=2; if((HFM[5]+HFM[6])>0) ind5=1; if((HFM[5]+HFM[6])>21) ind5=0;
685  if(ind1==3) ind2=ind3=ind4=ind5=3;
686  if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1)status|=1;
687  htmlFile << state[ind1] << HFM[0] <<" (864)</td>" << std::endl;
688  htmlFile << state[ind2] << HFM[1] <<"</td>" << std::endl;
689  htmlFile << state[ind3] << HFM[2] <<"</td>" << std::endl;
690  htmlFile << state[ind5] << HFM[5]+HFM[6] <<"</td>" << std::endl;
691  htmlFile << state[ind4] << HFM[3]+HFM[4] <<"</td>" << std::endl;
692 
693  htmlFile << "</tr><tr>" << std::endl;
694  htmlFile << "<td class=\"s1\" align=\"center\">HO</td>" << std::endl;
695  ind1=3; if(newHO[0]==0) ind1=2; if(newHO[0]>0 && newHO[0]<=12) ind1=1; if(newHO[0]>=12 && HO[0]<2160) ind1=0;
696  ind2=3; if(newHO[1]==0) ind2=2; if(newHO[1]>0) ind2=1; if(newHO[1]>21) ind2=0;
697  ind3=3; if(newHO[2]==0) ind3=2; if(newHO[2]>0) ind3=1; if(newHO[2]>21) ind3=0;
698  ind4=3; if((newHO[3]+newHO[4])==0) ind4=2; if((newHO[3]+newHO[4])>0) ind4=1; if((newHO[3]+newHO[4])>21) ind4=0;
699  ind5=3; if((newHO[5]+newHO[6])==0) ind5=2; if((newHO[5]+newHO[6])>0) ind5=1; if((newHO[5]+newHO[6])>21) ind5=0;
700  if(ind1==3) ind2=ind3=ind4=ind5=3;
701  if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1)status|=1;
702 
703  htmlFile << state[ind1] << HO[0] <<" (2160)</td>" << std::endl;
704  htmlFile << state[ind2] << HO[1] <<"</td>" << std::endl;
705  htmlFile << state[ind3] << HO[2] <<"</td>" << std::endl;
706  htmlFile << state[ind5] << HO[5]+HO[6] <<"</td>" << std::endl;
707  htmlFile << state[ind4] << HO[3]+HO[4] <<"</td>" << std::endl;
708 
709  htmlFile << "</tr></table>" << std::endl;
710  htmlFile << "<hr>" << std::endl;
712  if((MissingCnt+UnstableCnt+UnstableLEDCnt+BadTimingCnt)>0){
713  htmlFile << "<table width=100% border=1><tr>" << std::endl;
714  if(MissingCnt>0) htmlFile << "<td><a href=\"" << "Missing.html" <<"\">list of missing channels</a></td>";
715  if(UnstableCnt>0) htmlFile << "<td><a href=\"" << "Unstable.html" <<"\">list of unstable channels</a></td>";
716  if(UnstableLEDCnt>0)htmlFile << "<td><a href=\"" << "UnstableLED.html" <<"\">list of low LED signal channels</a></td>";
717  if(BadTimingCnt>0)htmlFile << "<td><a href=\"" << "BadTiming.html" <<"\">list of Bad Timing channels</a></td>";
718  htmlFile << "</tr></table>" << std::endl;
719  }
721 
723  htmlFile << "<h2 align=\"center\">Summary LED plots</h2>" << std::endl;
724  htmlFile << "<table width=100% border=0><tr>" << std::endl;
725  htmlFile << "<tr align=\"left\">" << std::endl;
726  Time2Dhbhehf->SetMaximum(6);
727  Time2Dho->SetMaximum(6);
728  Time2Dhbhehf->SetNdivisions(36,"Y");
729  Time2Dho->SetNdivisions(36,"Y");
730  Time2Dhbhehf->SetStats(0);
731  Time2Dho->SetStats(0);
732  Time2Dhbhehf->Draw("COLZ"); can->SaveAs((htmlDir + "led_timing_hbhehf.gif").c_str());
733  Time2Dho->Draw("COLZ"); can->SaveAs((htmlDir + "led_timing_ho.gif").c_str());
734  htmlFile << "<td align=\"center\"><img src=\"led_timing_hbhehf.gif\" alt=\"led timing distribution\"> </td>" << std::endl;
735  htmlFile << "<td align=\"center\"><img src=\"led_timing_ho.gif\" alt=\"led timing distribution\"> </td>" << std::endl;
736  htmlFile << "</tr>" << std::endl;
737 
738  htmlFile << "<tr align=\"left\">" << std::endl;
739  Energy2Dhbhehf->SetStats(0);
740  Energy2Dho->SetStats(0);
741  Energy2Dhbhehf->SetNdivisions(36,"Y");
742  Energy2Dho->SetNdivisions(36,"Y");
743  Energy2Dhbhehf->Draw("COLZ"); can->SaveAs((htmlDir + "led_energy_hbhehf.gif").c_str());
744  Energy2Dho->Draw("COLZ"); can->SaveAs((htmlDir + "led_energy_ho.gif").c_str());
745  htmlFile << "<td align=\"center\"><img src=\"led_energy_hbhehf.gif\" alt=\"led energy distribution\"> </td>" << std::endl;
746  htmlFile << "<td align=\"center\"><img src=\"led_energy_ho.gif\" alt=\"led energy distribution\"> </td>" << std::endl;
747  htmlFile << "</tr>" << std::endl;
748 
749  can->SetGridy(false);
750  htmlFile << "<tr align=\"left\">" << std::endl;
751  Energy->Draw(); can->SaveAs((htmlDir + "led_energy_distribution.gif").c_str());
752  EnergyRMS->Draw(); can->SaveAs((htmlDir + "led_energy_rms_distribution.gif").c_str());
753  htmlFile << "<td align=\"center\"><img src=\"led_energy_distribution.gif\" alt=\"led energy distribution\"> </td>" << std::endl;
754  htmlFile << "<td align=\"center\"><img src=\"led_energy_rms_distribution.gif\" alt=\"led energy rms distribution\"> </td>" << std::endl;
755  htmlFile << "</tr>" << std::endl;
756  htmlFile << "<tr align=\"left\">" << std::endl;
757  Timing->Draw(); can->SaveAs((htmlDir + "led_timing_distribution.gif").c_str());
758  TimingRMS->Draw(); can->SaveAs((htmlDir + "led_timing_rms_distribution.gif").c_str());
759  htmlFile << "<td align=\"center\"><img src=\"led_timing_distribution.gif\" alt=\"led timing distribution\"> </td>" << std::endl;
760  htmlFile << "<td align=\"center\"><img src=\"led_timing_rms_distribution.gif\" alt=\"led timing rms distribution\"> </td>" << std::endl;
761  htmlFile << "</tr>" << std::endl;
762  htmlFile << "<tr align=\"left\">" << std::endl;
763  EnergyHF->Draw(); can->SaveAs((htmlDir + "led_energyhf_distribution.gif").c_str());
764  EnergyRMSHF->Draw(); can->SaveAs((htmlDir + "led_energyhf_rms_distribution.gif").c_str());
765  htmlFile << "<td align=\"center\"><img src=\"led_energyhf_distribution.gif\" alt=\"hf led energy distribution\"> </td>" << std::endl;
766  htmlFile << "<td align=\"center\"><img src=\"led_energyhf_rms_distribution.gif\" alt=\"hf led energy rms distribution\"> </td>" << std::endl;
767  htmlFile << "</tr>" << std::endl;
768  htmlFile << "<tr align=\"left\">" << std::endl;
769  TimingHF->Draw(); can->SaveAs((htmlDir + "led_timinghf_distribution.gif").c_str());
770  TimingRMSHF->Draw(); can->SaveAs((htmlDir + "led_timinghf_rms_distribution.gif").c_str());
771  htmlFile << "<td align=\"center\"><img src=\"led_timinghf_distribution.gif\" alt=\"hf led timing distribution\"> </td>" << std::endl;
772  htmlFile << "<td align=\"center\"><img src=\"led_timinghf_rms_distribution.gif\" alt=\"hf led timing rms distribution\"> </td>" << std::endl;
773  htmlFile << "</tr>" << std::endl;
774  htmlFile << "</table>" << std::endl;
775 
777  htmlFile << "<h2 align=\"center\">Stability LED plots (Reference run "<<ref_run<<")</h2>" << std::endl;
778  htmlFile << "<table width=100% border=0><tr>" << std::endl;
779  htmlFile << "<tr align=\"left\">" << std::endl;
780  HBPphi->GetXaxis()->SetNdivisions(418,kFALSE);
781  HBMphi->GetXaxis()->SetNdivisions(418,kFALSE);
782  HEPphi->GetXaxis()->SetNdivisions(418,kFALSE);
783  HEMphi->GetXaxis()->SetNdivisions(418,kFALSE);
784 
785  HBPphi->SetMarkerColor(kRed);
786  HBPphi->SetMarkerStyle(23);
787  HBPphi->SetXTitle("HPD Index = RBX*4+RM");
788  HBMphi->SetMarkerColor(kRed);
789  HBMphi->SetMarkerStyle(23);
790  HBMphi->SetXTitle("HPD Index = RBX*4+RM");
791  HBPphi->Draw(); can->SaveAs((htmlDir + "led_hbp_distribution.gif").c_str());
792  HBMphi->Draw(); can->SaveAs((htmlDir + "led_hbm_distribution.gif").c_str());
793  htmlFile << "<td align=\"center\"><img src=\"led_hbp_distribution.gif\" alt=\"led hbp distribution\"> </td>" << std::endl;
794  htmlFile << "<td align=\"center\"><img src=\"led_hbm_distribution.gif\" alt=\"led hbm distribution\"> </td>" << std::endl;
795  htmlFile << "</tr>" << std::endl;
796 
797  htmlFile << "<tr align=\"left\">" << std::endl;
798  HEPphi->SetMarkerColor(kRed);
799  HEPphi->SetMarkerStyle(23);
800  HEPphi->SetXTitle("HPD Index = RBX*4+RM");
801  HEMphi->SetMarkerColor(kRed);
802  HEMphi->SetMarkerStyle(23);
803  HEMphi->SetXTitle("HPD Index = RBX*4+RM");
804  HEPphi->Draw(); can->SaveAs((htmlDir + "led_hep_distribution.gif").c_str());
805  HEMphi->Draw(); can->SaveAs((htmlDir + "led_hem_distribution.gif").c_str());
806  htmlFile << "<td align=\"center\"><img src=\"led_hep_distribution.gif\" alt=\"led hep distribution\"> </td>" << std::endl;
807  htmlFile << "<td align=\"center\"><img src=\"led_hem_distribution.gif\" alt=\"led hem distribution\"> </td>" << std::endl;
808  htmlFile << "</tr>" << std::endl;
809 
810  htmlFile << "<tr align=\"left\">" << std::endl;
811  HFPphi->SetMarkerColor(kRed);
812  HFPphi->SetMarkerStyle(23);
813  HFPphi->SetXTitle("RM Index = RoBox*3+RM");
814  HFMphi->SetMarkerColor(kRed);
815  HFMphi->SetMarkerStyle(23);
816  HFPphi->GetXaxis()->SetNdivisions(312,kFALSE);
817  HFMphi->GetXaxis()->SetNdivisions(312,kFALSE);
818 
819  HFMphi->SetXTitle("RM Index = RoBox*3+RM");
820  HFPphi->Draw(); can->SaveAs((htmlDir + "led_hfp_distribution.gif").c_str());
821  HFMphi->Draw(); can->SaveAs((htmlDir + "led_hfm_distribution.gif").c_str());
822  htmlFile << "<td align=\"center\"><img src=\"led_hfp_distribution.gif\" alt=\"led hfp distribution\"> </td>" << std::endl;
823  htmlFile << "<td align=\"center\"><img src=\"led_hfm_distribution.gif\" alt=\"led hfm distribution\"> </td>" << std::endl;
824  htmlFile << "</tr>" << std::endl;
825 
826  htmlFile << "<tr align=\"left\">" << std::endl;
827  HO1Pphi->SetMarkerColor(kRed);
828  HO1Pphi->SetMarkerStyle(23);
829  HO1Pphi->SetXTitle("HPD Index = RBX*4+RM");
830  HO1Mphi->SetMarkerColor(kRed);
831  HO1Mphi->SetMarkerStyle(23);
832  HO1Mphi->GetXaxis()->SetNdivisions(412,kFALSE);
833  HO1Pphi->GetXaxis()->SetNdivisions(412,kFALSE);
834 
835  HO1Mphi->SetXTitle("HPD Index = RBX*4+RM");
836  HO1Pphi->Draw(); can->SaveAs((htmlDir + "led_ho1p_distribution.gif").c_str());
837  HO1Mphi->Draw(); can->SaveAs((htmlDir + "led_ho1m_distribution.gif").c_str());
838  htmlFile << "<td align=\"center\"><img src=\"led_ho1p_distribution.gif\" alt=\"led ho1p distribution\"> </td>" << std::endl;
839  htmlFile << "<td align=\"center\"><img src=\"led_ho1m_distribution.gif\" alt=\"led ho1m distribution\"> </td>" << std::endl;
840  htmlFile << "</tr>" << std::endl;
841 
842  htmlFile << "<tr align=\"left\">" << std::endl;
843  HO2Pphi->SetMarkerColor(kRed);
844  HO2Pphi->SetMarkerStyle(23);
845  HO2Pphi->SetXTitle("HPD Index = RBX*4+RM");
846  HO2Mphi->SetMarkerColor(kRed);
847  HO2Mphi->SetMarkerStyle(23);
848  HO2Mphi->GetXaxis()->SetNdivisions(412,kFALSE);
849  HO2Pphi->GetXaxis()->SetNdivisions(412,kFALSE);
850 
851  HO2Mphi->SetXTitle("HPD Index = RBX*4+RM");
852  HO2Pphi->Draw(); can->SaveAs((htmlDir + "led_ho2p_distribution.gif").c_str());
853  HO2Mphi->Draw(); can->SaveAs((htmlDir + "led_ho2m_distribution.gif").c_str());
854  htmlFile << "<td align=\"center\"><img src=\"led_ho2p_distribution.gif\" alt=\"led ho2p distribution\"> </td>" << std::endl;
855  htmlFile << "<td align=\"center\"><img src=\"led_ho2m_distribution.gif\" alt=\"led ho2m distribution\"> </td>" << std::endl;
856  htmlFile << "</tr>" << std::endl;
857 
858  htmlFile << "<tr align=\"left\">" << std::endl;
859  HO0phi->SetMarkerColor(kRed);
860  HO0phi->SetMarkerStyle(23);
861  HO0phi->SetXTitle("HPD Index = RBX*4+RM");
862  HO0phi->GetXaxis()->SetNdivisions(412,kFALSE);
863  HO0phi->Draw(); can->SaveAs((htmlDir + "led_ho0_distribution.gif").c_str());
864  htmlFile << "<td align=\"center\"><img src=\"led_ho0_distribution.gif\" alt=\"led ho0 distribution\"> </td>" << std::endl;
865  htmlFile << "</tr>" << std::endl;
866 
867  htmlFile << "</table>" << std::endl;
868 
869  htmlFile << "</body> " << std::endl;
870  htmlFile << "</html> " << std::endl;
871  htmlFile.close();
872  can->Close();
873  delete can;
874 }
875 
877 {
879 }
int fiberChannel() const
type
Definition: HCALResponse.h:21
dictionary missing
Definition: combine.py:4
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
MonitorElement * ProblemCells
int fiberIndex() const
get the fiber index. For VME 1-8 (which of eight fibers carried by a spigot), for uTCA fibers are zer...
std::string name()
int pixel() const
TH2F * ChannelStatusUnstableChannels[4]
int ib
Definition: cuy.py:660
static void printTableLine(std::ofstream &file, int ind, HcalDetId &detid, HcalFrontEndId &lmap_entry, HcalElectronicsId &emap_entry, std::string comment="")
void analyze(DQMStore::IBooker &, DQMStore::IGetter &)
static void printTableTail(std::ofstream &file)
HcalDetDiagLEDClient()
Constructors.
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:304
void setupProblemCells(DQMStore::IBooker &, DQMStore::IGetter &)
std::vector< std::string > HcalEtaPhiHistNames()
int htrSlot() const
get the htr slot
static void printTableHeader(std::ofstream &file, std::string header)
int readoutVMECrateId() const
get the readout VME crate number
std::string rbx() const
static const float SD[]
Definition: sicif.h:67
int depth() const
get the tower depth
Definition: HcalDetId.cc:129
HcalElectronicsMap generateHcalElectronicsMap()
std::vector< MonitorElement * > depth
int htrTopBottom() const
get the htr top/bottom (1=top/0=bottom), valid for VME
std::vector< std::string > problemnames_
int rm() const
bool validHtmlOutput(DQMStore::IBooker &, DQMStore::IGetter &)
EtaPhiHists * ProblemCellsByDepth
int ieta() const
get the cell ieta
Definition: HcalDetId.h:56
int dccid() const
get the (Hcal local) DCC id for VME, crate number for uTCA
void updateChannelStatus(std::map< HcalDetId, unsigned int > &myqual)
HcalSubdetector
Definition: HcalAssistant.h:31
double get_energy(std::string subdet, int eta, int phi, int depth, int type)
void setup(DQMStore::IBooker &m_dbe, std::string Name, std::string Units="")
TH2F * ChannelStatusMissingChannels[4]
double get_channel_status(std::string subdet, int eta, int phi, int depth, int type)
int spigot() const
get the spigot (input number on DCC, AMC card number for uTCA)
std::string valueString(void) const
const HcalFrontEndId getHcalFrontEndId(const DetId &)
int iphi() const
get the cell iphi
Definition: HcalDetId.cc:124
virtual void calculateProblems(void)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
double sd
int adc() const
std::string subdir_
std::map< HcalDetId, unsigned int > badstatusmap
int CalcEtaBin(int subdet, int ieta, int depth)
Geom::Phi< T > phi() const
void htmlOutput(DQMStore::IBooker &, DQMStore::IGetter &, std::string)
std::string prefixME_
HcalLogicalMap * logicalMap_
tuple cout
Definition: gather_cfg.py:145
int rmFiber() const
~HcalDetDiagLEDClient()
Destructor.
TH2F * ChannelStatusUnstableLEDsignal[4]
int qieCard() const
Readout chain identification for Hcal.
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
#define comment(par)
Definition: vmac.h:161