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