00001 #include "DQM/HcalMonitorClient/interface/HcalDetDiagLEDClient.h"
00002 #include "DQM/HcalMonitorClient/interface/HcalClientUtils.h"
00003 #include "DQM/HcalMonitorClient/interface/HcalHistoUtils.h"
00004
00005 #include "CondFormats/HcalObjects/interface/HcalChannelStatus.h"
00006 #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
00007 #include "CondFormats/HcalObjects/interface/HcalCondObjectContainer.h"
00008
00009 #include "CalibCalorimetry/HcalAlgos/interface/HcalLogicalMapGenerator.h"
00010 #include "CondFormats/HcalObjects/interface/HcalLogicalMap.h"
00011
00012 #include <iostream>
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 HcalDetDiagLEDClient::HcalDetDiagLEDClient(std::string myname){
00024 name_=myname; status=0;
00025 }
00026
00027 HcalDetDiagLEDClient::HcalDetDiagLEDClient(std::string myname, const edm::ParameterSet& ps){
00028 name_=myname;
00029 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
00030 debug_ = ps.getUntrackedParameter<int>("debug",0);
00031 prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
00032 if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
00033 prefixME_.append("/");
00034 subdir_ = ps.getUntrackedParameter<std::string>("DetDiagLEDFolder","DetDiagLEDMonitor_Hcal/");
00035 if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
00036 subdir_.append("/");
00037 subdir_=prefixME_+subdir_;
00038
00039 validHtmlOutput_ = ps.getUntrackedParameter<bool>("DetDiagLED_validHtmlOutput",true);
00040 cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00041 badChannelStatusMask_ = ps.getUntrackedParameter<int>("DetDiagLED_BadChannelStatusMask",
00042 ps.getUntrackedParameter<int>("BadChannelStatusMask",(1<<HcalChannelStatus::HcalCellDead)));
00043 }
00044
00045 void HcalDetDiagLEDClient::analyze(){
00046 if (debug_>2) std::cout <<"\tHcalDetDiagLEDClient::analyze()"<<std::endl;
00047 calculateProblems();
00048 }
00049
00050 void HcalDetDiagLEDClient::calculateProblems(){}
00051 void HcalDetDiagLEDClient::updateChannelStatus(std::map<HcalDetId, unsigned int>& myqual){
00052
00053
00054
00055
00056 }
00057
00058 void HcalDetDiagLEDClient::beginJob(){
00059 dqmStore_ = edm::Service<DQMStore>().operator->();
00060 if (debug_>0){
00061 std::cout <<"<HcalDetDiagLEDClient::beginJob()> Displaying dqmStore directory structure:"<<std::endl;
00062 dqmStore_->showDirStructure();
00063 }
00064 }
00065 void HcalDetDiagLEDClient::endJob(){}
00066
00067 void HcalDetDiagLEDClient::beginRun(void){
00068 if (!dqmStore_)
00069 {
00070 if (debug_>0) std::cout <<"<HcalDetDiagLEDClient::beginRun> dqmStore does not exist!"<<std::endl;
00071 return;
00072 }
00073 dqmStore_->setCurrentFolder(subdir_);
00074 problemnames_.clear();
00075
00076
00077 ProblemCells=dqmStore_->book2D(" ProblemDetDiagLED",
00078 " Problem DetDiagLED Rate for all HCAL;ieta;iphi",
00079 85,-42.5,42.5,
00080 72,0.5,72.5);
00081 problemnames_.push_back(ProblemCells->getName());
00082 if (debug_>1)
00083 std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
00084 dqmStore_->setCurrentFolder(subdir_+"problem_DetDiagLED");
00085 ProblemCellsByDepth = new EtaPhiHists();
00086 ProblemCellsByDepth->setup(dqmStore_," Problem DetDiagLED Rate");
00087 for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
00088 problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
00089 nevts_=0;
00090 }
00091 void HcalDetDiagLEDClient::endRun(void){analyze();}
00092 void HcalDetDiagLEDClient::setup(void){}
00093 void HcalDetDiagLEDClient::cleanup(void){}
00094
00095 bool HcalDetDiagLEDClient::hasErrors_Temp(void){
00096 if(status&2) return true;
00097 return false;
00098 }
00099 bool HcalDetDiagLEDClient::hasWarnings_Temp(void){
00100 if(status&1) return true;
00101 return false;
00102 }
00103 bool HcalDetDiagLEDClient::hasOther_Temp(void){return false;}
00104 bool HcalDetDiagLEDClient::test_enabled(void){return true;}
00105
00106 bool HcalDetDiagLEDClient::validHtmlOutput(){
00107 std::string s=subdir_+"HcalDetDiagLEDMonitor Event Number";
00108 MonitorElement *me = dqmStore_->get(s.c_str());
00109 int n=0;
00110 if ( me ) {
00111 s = me->valueString();
00112 sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &n);
00113 }
00114 if(n<100) return false;
00115 return true;
00116 }
00117 static void printTableHeader(ofstream& file,std::string header){
00118 file << "</html><html xmlns=\"https://www.w3.org/1999/xhtml\">"<< std::endl;
00119 file << "<head>"<< std::endl;
00120 file << "<meta https-equiv=\"Content-Type\" content=\"text/html\"/>"<< std::endl;
00121 file << "<title>"<< header <<"</title>"<< std::endl;
00122 file << "<style type=\"text/css\">"<< std::endl;
00123 file << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"<< std::endl;
00124 file << " td.s0 { font-family: arial, arial ce, helvetica; }"<< std::endl;
00125 file << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< std::endl;
00126 file << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }"<< std::endl;
00127 file << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }"<< std::endl;
00128 file << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }"<< std::endl;
00129 file << "</style>"<< std::endl;
00130 file << "<body>"<< std::endl;
00131 file << "<table>"<< std::endl;
00132 }
00133 static void printTableLine(ofstream& file,int ind,HcalDetId& detid,HcalFrontEndId& lmap_entry,HcalElectronicsId &emap_entry, std::string comment=""){
00134 if(ind==0){
00135 file << "<tr>";
00136 file << "<td class=\"s4\" align=\"center\">#</td>" << std::endl;
00137 file << "<td class=\"s1\" align=\"center\">ETA</td>" << std::endl;
00138 file << "<td class=\"s1\" align=\"center\">PHI</td>" << std::endl;
00139 file << "<td class=\"s1\" align=\"center\">DEPTH</td>"<< std::endl;
00140 file << "<td class=\"s1\" align=\"center\">RBX</td>" << std::endl;
00141 file << "<td class=\"s1\" align=\"center\">RM</td>" << std::endl;
00142 file << "<td class=\"s1\" align=\"center\">PIXEL</td>" << std::endl;
00143 file << "<td class=\"s1\" align=\"center\">RM_FIBER</td>" << std::endl;
00144 file << "<td class=\"s1\" align=\"center\">FIBER_CH</td>" << std::endl;
00145 file << "<td class=\"s1\" align=\"center\">QIE</td>" << std::endl;
00146 file << "<td class=\"s1\" align=\"center\">ADC</td>" << std::endl;
00147 file << "<td class=\"s1\" align=\"center\">CRATE</td>" << std::endl;
00148 file << "<td class=\"s1\" align=\"center\">DCC</td>" << std::endl;
00149 file << "<td class=\"s1\" align=\"center\">SPIGOT</td>" << std::endl;
00150 file << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>" << std::endl;
00151 file << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>" << std::endl;
00152 file << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>" << std::endl;
00153 if(comment[0]!=0) file << "<td class=\"s1\" align=\"center\">Comment</td>" << std::endl;
00154 file << "</tr>" << std::endl;
00155 }
00156 std::string raw_class;
00157 file << "<tr>"<< std::endl;
00158 if((ind%2)==1){
00159 raw_class="<td class=\"s2\" align=\"center\">";
00160 }else{
00161 raw_class="<td class=\"s3\" align=\"center\">";
00162 }
00163 file << "<td class=\"s4\" align=\"center\">" << ind+1 <<"</td>"<< std::endl;
00164 file << raw_class<< detid.ieta()<<"</td>"<< std::endl;
00165 file << raw_class<< detid.iphi()<<"</td>"<< std::endl;
00166 file << raw_class<< detid.depth() <<"</td>"<< std::endl;
00167 file << raw_class<< lmap_entry.rbx()<<"</td>"<< std::endl;
00168 file << raw_class<< lmap_entry.rm() <<"</td>"<< std::endl;
00169 file << raw_class<< lmap_entry.pixel()<<"</td>"<< std::endl;
00170 file << raw_class<< lmap_entry.rmFiber() <<"</td>"<< std::endl;
00171 file << raw_class<< lmap_entry.fiberChannel()<<"</td>"<< std::endl;
00172 file << raw_class<< lmap_entry.qieCard() <<"</td>"<< std::endl;
00173 file << raw_class<< lmap_entry.adc()<<"</td>"<< std::endl;
00174 file << raw_class<< emap_entry.readoutVMECrateId()<<"</td>"<< std::endl;
00175 file << raw_class<< emap_entry.dccid()<<"</td>"<< std::endl;
00176 file << raw_class<< emap_entry.spigot()<<"</td>"<< std::endl;
00177 file << raw_class<< emap_entry.fiberIndex()<<"</td>"<< std::endl;
00178 file << raw_class<< emap_entry.htrSlot()<<"</td>"<< std::endl;
00179 file << raw_class<< emap_entry.htrTopBottom()<<"</td>"<< std::endl;
00180 if(comment[0]!=0) file << raw_class<< comment<<"</td>"<< std::endl;
00181 }
00182 static void printTableTail(ofstream& file){
00183 file << "</table>"<< std::endl;
00184 file << "</body>"<< std::endl;
00185 file << "</html>"<< std::endl;
00186 }
00187 double HcalDetDiagLEDClient::get_channel_status(std::string subdet,int eta,int phi,int depth,int type){
00188 int subdetval=-1;
00189 if (subdet.compare("HB")==0) subdetval=(int)HcalBarrel;
00190 else if (subdet.compare("HE")==0) subdetval=(int)HcalEndcap;
00191 else if (subdet.compare("HO")==0) subdetval=(int)HcalOuter;
00192 else if (subdet.compare("HF")==0) subdetval=(int)HcalForward;
00193 else return -1.0;
00194 int ietabin=CalcEtaBin(subdetval, eta, depth)+1;
00195 if(type==1) return ChannelStatusMissingChannels[depth-1]->GetBinContent(ietabin,phi);
00196 if(type==2) return ChannelStatusUnstableChannels[depth-1]->GetBinContent(ietabin,phi);
00197 if(type==3) return ChannelStatusUnstableLEDsignal[depth-1]->GetBinContent(ietabin,phi);
00198 if(type==4) return ChannelStatusLEDMean[depth-1]->GetBinContent(ietabin,phi);
00199 if(type==5) return ChannelStatusLEDRMS[depth-1]->GetBinContent(ietabin,phi);
00200 if(type==6) return ChannelStatusTimeMean[depth-1]->GetBinContent(ietabin,phi);
00201 if(type==7) return ChannelStatusTimeRMS[depth-1]->GetBinContent(ietabin,phi);
00202 return -1.0;
00203 }
00204 double HcalDetDiagLEDClient::get_energy(std::string subdet,int eta,int phi,int depth,int type){
00205 int subdetval=-1;
00206 if (subdet.compare("HB")==0) subdetval=(int)HcalBarrel;
00207 else if (subdet.compare("HE")==0) subdetval=(int)HcalEndcap;
00208 else if (subdet.compare("HO")==0) subdetval=(int)HcalOuter;
00209 else if (subdet.compare("HF")==0) subdetval=(int)HcalForward;
00210 else return -1.0;
00211 int ietabin=CalcEtaBin(subdetval, eta, depth)+1;
00212 if(type==1) return ChannelsLEDEnergy[depth-1]->GetBinContent(ietabin,phi);
00213 if(type==2) return ChannelsLEDEnergyRef[depth-1]->GetBinContent(ietabin,phi);
00214 return -1.0;
00215 }
00216 void HcalDetDiagLEDClient::htmlOutput(std::string htmlDir){
00217 MonitorElement* me;
00218 int MissingCnt=0;
00219 int UnstableCnt=0;
00220 int UnstableLEDCnt=0;
00221 int BadTimingCnt=0;
00222 int HBP[7]={0,0,0,0,0,0,0},newHBP[7]={0,0,0,0,0,0,0};
00223 int HBM[7]={0,0,0,0,0,0,0},newHBM[7]={0,0,0,0,0,0,0};
00224 int HEP[7]={0,0,0,0,0,0,0},newHEP[7]={0,0,0,0,0,0,0};
00225 int HEM[7]={0,0,0,0,0,0,0},newHEM[7]={0,0,0,0,0,0,0};
00226 int HFP[7]={0,0,0,0,0,0,0},newHFP[7]={0,0,0,0,0,0,0};
00227 int HFM[7]={0,0,0,0,0,0,0},newHFM[7]={0,0,0,0,0,0,0};
00228 int HO[7] ={0,0,0,0,0,0,0},newHO[7] ={0,0,0,0,0,0,0};
00229 std::string subdet[4]={"HB","HE","HO","HF"};
00230
00231 if (debug_>0) std::cout << "<HcalDetDiagLEDClient::htmlOutput> Preparing html output ..." << std::endl;
00232 if(!dqmStore_) return;
00233 HcalLogicalMapGenerator gen;
00234 HcalLogicalMap lmap(gen.createMap());
00235 HcalElectronicsMap emap=lmap.generateHcalElectronicsMap();
00236 std::vector<std::string> name = HcalEtaPhiHistNames();
00237
00238 for(int i=0;i<4;++i){
00239 ChannelsLEDEnergy[i]=ChannelsLEDEnergyRef[i]=ChannelStatusMissingChannels[i]=ChannelStatusUnstableChannels[i]=0;
00240 ChannelStatusUnstableLEDsignal[i]=ChannelStatusLEDMean[i]=ChannelStatusLEDRMS[i]=ChannelStatusTimeMean[i]=0;
00241 ChannelStatusTimeRMS[i]=0;
00242 std::string s;
00243 s=subdir_+"channel status/"+name[i]+" Missing Channels";
00244 me=dqmStore_->get(s.c_str());
00245 if (me!=0) ChannelStatusMissingChannels[i]=HcalUtilsClient::getHisto<TH2F*>(me,cloneME_,ChannelStatusMissingChannels[i],debug_); else return;
00246 s=subdir_+"channel status/"+name[i]+" Unstable Channels";
00247 me=dqmStore_->get(s.c_str());
00248 if (me!=0) ChannelStatusUnstableChannels[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannelStatusUnstableChannels[i], debug_); else return;
00249 s=subdir_+"channel status/"+name[i]+" Unstable LED";
00250 me=dqmStore_->get(s.c_str());
00251 if (me!=0) ChannelStatusUnstableLEDsignal[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannelStatusUnstableLEDsignal[i], debug_); else return;
00252 s=subdir_+"channel status/"+name[i]+" LED Mean";
00253 me=dqmStore_->get(s.c_str());
00254 if (me!=0) ChannelStatusLEDMean[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannelStatusLEDMean[i], debug_); else return;
00255 s=subdir_+"channel status/"+name[i]+" LED RMS";
00256 me=dqmStore_->get(s.c_str());
00257 if (me!=0) ChannelStatusLEDRMS[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannelStatusLEDRMS[i], debug_); else return;
00258 s=subdir_+"channel status/"+name[i]+" Time Mean";
00259 me=dqmStore_->get(s.c_str());
00260 if (me!=0) ChannelStatusTimeMean[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannelStatusTimeMean[i], debug_); else return;
00261 s=subdir_+"channel status/"+name[i]+" Time RMS";
00262 me=dqmStore_->get(s.c_str());
00263 if (me!=0) ChannelStatusTimeRMS[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannelStatusTimeRMS[i], debug_); else return;
00264 s=subdir_+"Summary Plots/"+name[i]+" Channel LED Energy";
00265 me=dqmStore_->get(s.c_str());
00266 if (me!=0) ChannelsLEDEnergy[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannelsLEDEnergy[i], debug_); else return;
00267 s=subdir_+"Summary Plots/"+name[i]+" Channel LED Energy Reference";
00268 me=dqmStore_->get(s.c_str());
00269 if (me!=0) ChannelsLEDEnergyRef[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannelsLEDEnergyRef[i], debug_); else return;
00270 }
00271
00272
00273 for(int sd=0;sd<4;sd++){
00274 int feta=0,teta=0,fdepth=0,tdepth=0;
00275 if(sd==0){ feta=-16; teta=16 ;fdepth=1; tdepth=2; }
00276 if(sd==1){ feta=-29; teta=29 ;fdepth=1; tdepth=3; }
00277 if(sd==2){ feta=-15; teta=15 ;fdepth=4; tdepth=4; }
00278 if(sd==3){ feta=-42; teta=42 ;fdepth=1; tdepth=2; }
00279 for(int phi=1;phi<=72;phi++) for(int depth=fdepth;depth<=tdepth;depth++) for(int eta=feta;eta<=teta;eta++){
00280 if(sd==3 && eta>-29 && eta<29) continue;
00281 double problem[7]={0,0,0,0,0,0,0};
00282 for(int i=0;i<6;i++){
00283 problem[i] =get_channel_status(subdet[sd],eta,phi,depth,i+1);
00284 if(problem[i]!=0){
00285 HcalSubdetector SD=HcalEmpty;
00286 if(sd==0)SD=HcalBarrel;
00287 else if(sd==1) SD=HcalEndcap;
00288 else if(sd==2) SD=HcalOuter;
00289 else if(sd==3) SD=HcalForward;
00290 HcalDetId hcalid(SD, eta, phi, depth);
00291 if(sd==0){ if(eta>0){
00292 HBP[i]++;
00293 if(badstatusmap.find(hcalid)==badstatusmap.end())newHBP[i]++;
00294 }else{
00295 HBM[i]++;
00296 if(badstatusmap.find(hcalid)==badstatusmap.end())newHBM[i]++;
00297 }}
00298 if(sd==1){ if(eta>0){
00299 HEP[i]++;
00300 if(badstatusmap.find(hcalid)==badstatusmap.end())newHEP[i]++;
00301 }else{
00302 HEM[i]++;
00303 if(badstatusmap.find(hcalid)==badstatusmap.end())newHEM[i]++;
00304 }}
00305 if(sd==2){
00306 HO[i]++;
00307 if(badstatusmap.find(hcalid)==badstatusmap.end())newHO[i]++;
00308 }
00309 if(sd==3){ if(eta>0){
00310 HFP[i]++;
00311 if(badstatusmap.find(hcalid)==badstatusmap.end())newHFP[i]++;
00312 }else{
00313 HFM[i]++;
00314 if(badstatusmap.find(hcalid)==badstatusmap.end())newHFM[i]++;
00315 }}
00316 }
00317 }
00318 }
00319 }
00320
00321 ofstream Missing;
00322 Missing.open((htmlDir + "Missing.html").c_str());
00323 printTableHeader(Missing,"Missing Channels list");
00324
00325 ofstream BadTiming;
00326 BadTiming.open((htmlDir + "BadTiming.html").c_str());
00327 printTableHeader(BadTiming,"Bad Timing Channels list");
00328
00329 ofstream Unstable;
00330 Unstable.open((htmlDir + "Unstable.html").c_str());
00331 printTableHeader(Unstable,"Low LED signal Channels list");
00332
00333 ofstream BadLED;
00334 BadLED.open((htmlDir + "UnstableLED.html").c_str());
00335 printTableHeader(BadLED,"Unstable LED signal channels list");
00336
00337 for(int sd=0;sd<4;sd++){
00338 int cnt=0;
00339 if(sd==0 && ((HBM[0]+HBP[0])==0 || (HBM[0]+HBP[0])==(1296*2))) continue;
00340 if(sd==1 && ((HEM[0]+HEP[0])==0 || (HEM[0]+HEP[0])==(1296*2))) continue;
00341 if(sd==2 && ((HO[0])==0 || HO[0]==2160)) continue;
00342 if(sd==3 && ((HFM[0]+HFP[0])==0 || (HFM[0]+HFP[0])==(864*2))) continue;
00343 Missing << "<tr><td align=\"center\"><h3>"<< subdet[sd] <<"</h3></td></tr>" << std::endl;
00344 int feta=0,teta=0,fdepth=0,tdepth=0;
00345 if(sd==0){ feta=-16; teta=16 ;fdepth=1; tdepth=2; if(HBM[0]==1296) feta=0; if(HBP[0]==1296) teta=0;}
00346 if(sd==1){ feta=-29; teta=29 ;fdepth=1; tdepth=3; if(HEM[0]==1296) feta=0; if(HEP[0]==1296) teta=0;}
00347 if(sd==2){ feta=-15; teta=15 ;fdepth=4; tdepth=4; if(HO[0] ==2160) {feta=0; teta=0; }}
00348 if(sd==3){ feta=-42; teta=42 ;fdepth=1; tdepth=2; if(HFM[0]==864) feta=0; if(HFP[0]==864) teta=0; }
00349 for(int phi=1;phi<=72;phi++) for(int depth=fdepth;depth<=tdepth;depth++) for(int eta=feta;eta<=teta;eta++){
00350 if(sd==3 && eta>-29 && eta<29) continue;
00351 double missing =get_channel_status(subdet[sd],eta,phi,depth,1);
00352 if(missing>0){
00353 HcalDetId *detid=0;
00354 if(sd==0) detid=new HcalDetId(HcalBarrel,eta,phi,depth);
00355 if(sd==1) detid=new HcalDetId(HcalEndcap,eta,phi,depth);
00356 if(sd==2) detid=new HcalDetId(HcalOuter,eta,phi,depth);
00357 if(sd==3) detid=new HcalDetId(HcalForward,eta,phi,depth);
00358 HcalFrontEndId lmap_entry=lmap.getHcalFrontEndId(*detid);
00359 HcalElectronicsId emap_entry=emap.lookup(*detid);
00360 std::string s=" ";
00361 if(badstatusmap.find(*detid)!=badstatusmap.end()){ s="Known problem"; }
00362 printTableLine(Missing,cnt++,*detid,lmap_entry,emap_entry,s); MissingCnt++;
00363 delete detid;
00364 }
00365 }
00366 }
00367
00368 for(int sd=0;sd<4;sd++){
00369 int cnt=0;
00370 if(sd==0 && (HBM[5]+HBP[5])==0) continue;
00371 if(sd==1 && (HEM[5]+HEP[5])==0) continue;
00372 if(sd==2 && (HO[5])==0) continue;
00373 if(sd==3 && (HFM[5]+HFP[5])==0) continue;
00374 BadTiming << "<tr><td align=\"center\"><h3>"<< subdet[sd] <<"</h3></td></tr>" << std::endl;
00375 int feta=0,teta=0,fdepth=0,tdepth=0;
00376 if(sd==0){ feta=-16; teta=16 ;fdepth=1; tdepth=2; if(HBM[0]==1296) feta=0; if(HBP[0]==1296) teta=0;}
00377 if(sd==1){ feta=-29; teta=29 ;fdepth=1; tdepth=3; if(HEM[0]==1296) feta=0; if(HEP[0]==1296) teta=0;}
00378 if(sd==2){ feta=-15; teta=15 ;fdepth=4; tdepth=4; if(HO[0] ==2160) {feta=0; teta=0; }}
00379 if(sd==3){ feta=-42; teta=42 ;fdepth=1; tdepth=2; if(HFM[0]==864) feta=0; if(HFP[0]==864) teta=0; }
00380 for(int phi=1;phi<=72;phi++) for(int depth=fdepth;depth<=tdepth;depth++) for(int eta=feta;eta<=teta;eta++){
00381 if(sd==3 && eta>-29 && eta<29) continue;
00382 double badtiming =get_channel_status(subdet[sd],eta,phi,depth,6);
00383 if(badtiming!=0){
00384 try{
00385 char comment[100]; sprintf(comment,"Time-mean=%.1f\n",badtiming);
00386 HcalDetId *detid=0;
00387 if(sd==0) detid=new HcalDetId(HcalBarrel,eta,phi,depth);
00388 if(sd==1) detid=new HcalDetId(HcalEndcap,eta,phi,depth);
00389 if(sd==2) detid=new HcalDetId(HcalOuter,eta,phi,depth);
00390 if(sd==3) detid=new HcalDetId(HcalForward,eta,phi,depth);
00391 HcalFrontEndId lmap_entry=lmap.getHcalFrontEndId(*detid);
00392 HcalElectronicsId emap_entry=emap.lookup(*detid);
00393 printTableLine(BadTiming,cnt++,*detid,lmap_entry,emap_entry,comment); BadTimingCnt++;
00394 delete detid;
00395 }catch(...){ continue;}
00396 }
00397 }
00398 }
00399
00400 for(int sd=0;sd<4;sd++){
00401 int cnt=0;
00402 if(sd==0 && (HBM[1]+HBP[1])==0) continue;
00403 if(sd==1 && (HEM[1]+HEP[1])==0) continue;
00404 if(sd==2 && (HO[1])==0) continue;
00405 if(sd==3 && (HFM[1]+HFP[1])==0) continue;
00406 Unstable << "<tr><td align=\"center\"><h3>"<< subdet[sd] <<"</h3></td></tr>" << std::endl;
00407 int feta=0,teta=0,fdepth=0,tdepth=0;
00408 if(sd==0){ feta=-16; teta=16 ;fdepth=1; tdepth=2;}
00409 if(sd==1){ feta=-29; teta=29 ;fdepth=1; tdepth=3;}
00410 if(sd==2){ feta=-15; teta=15 ;fdepth=4; tdepth=4;}
00411 if(sd==3){ feta=-42; teta=42 ;fdepth=1; tdepth=2;}
00412 for(int phi=1;phi<=72;phi++) for(int depth=fdepth;depth<=tdepth;depth++) for(int eta=feta;eta<=teta;eta++){
00413 if(sd==3 && eta>-29 && eta<29) continue;
00414 double unstable =get_channel_status(subdet[sd],eta,phi,depth,2);
00415 if(unstable>0){
00416 try{
00417 char comment[100]; sprintf(comment,"%.3f%%\n",(1.0-unstable)*100.0);
00418 HcalDetId *detid=0;
00419 if(sd==0) detid=new HcalDetId(HcalBarrel,eta,phi,depth);
00420 if(sd==1) detid=new HcalDetId(HcalEndcap,eta,phi,depth);
00421 if(sd==2) detid=new HcalDetId(HcalOuter,eta,phi,depth);
00422 if(sd==3) detid=new HcalDetId(HcalForward,eta,phi,depth);
00423 HcalFrontEndId lmap_entry=lmap.getHcalFrontEndId(*detid);
00424 HcalElectronicsId emap_entry=emap.lookup(*detid);
00425 printTableLine(Unstable,cnt++,*detid,lmap_entry,emap_entry,comment); UnstableCnt++;
00426 delete detid;
00427 }catch(...){ continue;}
00428 }
00429 }
00430 }
00431
00432 for(int sd=0;sd<4;sd++){
00433 int cnt=0;
00434 if(sd==0 && (HBM[2]+HBP[2])==0) continue;
00435 if(sd==1 && (HEM[2]+HEP[2])==0) continue;
00436 if(sd==2 && (HO[2])==0) continue;
00437 if(sd==3 && (HFM[2]+HFP[2])==0) continue;
00438 BadLED << "<tr><td align=\"center\"><h3>"<< subdet[sd] <<"</h3></td></tr>" << std::endl;
00439 int feta=0,teta=0,fdepth=0,tdepth=0;
00440 if(sd==0){ feta=-16; teta=16 ;fdepth=1; tdepth=2;}
00441 if(sd==1){ feta=-29; teta=29 ;fdepth=1; tdepth=3;}
00442 if(sd==2){ feta=-15; teta=15 ;fdepth=4; tdepth=4;}
00443 if(sd==3){ feta=-42; teta=42 ;fdepth=1; tdepth=2;}
00444 for(int phi=1;phi<=72;phi++) for(int depth=fdepth;depth<=tdepth;depth++) for(int eta=feta;eta<=teta;eta++){
00445 if(sd==3 && eta>-29 && eta<29) continue;
00446 double badled =get_channel_status(subdet[sd],eta,phi,depth,3);
00447 if(badled>0){
00448 try{
00449 char comment[100]; sprintf(comment,"%.3f%%\n",(badled)*100.0);
00450 HcalDetId *detid=0;
00451 if(sd==0) detid=new HcalDetId(HcalBarrel,eta,phi,depth);
00452 if(sd==1) detid=new HcalDetId(HcalEndcap,eta,phi,depth);
00453 if(sd==2) detid=new HcalDetId(HcalOuter,eta,phi,depth);
00454 if(sd==3) detid=new HcalDetId(HcalForward,eta,phi,depth);
00455 HcalFrontEndId lmap_entry=lmap.getHcalFrontEndId(*detid);
00456 HcalElectronicsId emap_entry=emap.lookup(*detid);
00457 std::string s=" ";
00458 if(badstatusmap.find(*detid)!=badstatusmap.end()){ s="Known problem"; }
00459 printTableLine(BadLED,cnt++,*detid,lmap_entry,emap_entry,s); UnstableLEDCnt++;
00460 delete detid;
00461 }catch(...){ continue;}
00462 }
00463 }
00464 }
00465 printTableTail(Missing);
00466 Missing.close();
00467 printTableTail(BadTiming);
00468 BadTiming.close();
00469 printTableTail(Unstable);
00470 Unstable.close();
00471 printTableTail(BadLED);
00472 BadLED.close();
00474 int ievt_ = -1,runNo=-1;
00475 std::string ref_run;
00476 std::string s=subdir_+"HcalDetDiagLEDMonitor Event Number";
00477 me = dqmStore_->get(s.c_str());
00478 if ( me ) {
00479 s = me->valueString();
00480 sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &ievt_);
00481 }
00482 s=subdir_+"HcalDetDiagLEDMonitor Run Number";
00483 me = dqmStore_->get(s.c_str());
00484 if ( me ) {
00485 s = me->valueString();
00486 sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &runNo);
00487 }
00488 s=subdir_+"HcalDetDiagLEDMonitor Reference Run";
00489 me = dqmStore_->get(s.c_str());
00490 if(me) {
00491 std::string s=me->valueString();
00492 char str[200];
00493 sscanf((s.substr(2,s.length()-2)).c_str(), "%s", str);
00494 ref_run=str;
00495 }
00496 TH1F *Energy=0,*Timing=0,*EnergyHF=0,*TimingHF=0,*EnergyRMS=0,*TimingRMS=0,*EnergyRMSHF=0,*TimingRMSHF=0;
00497 TH2F *Time2Dhbhehf=0,*Time2Dho=0,*Energy2Dhbhehf=0,*Energy2Dho=0;
00498 TH2F *HBPphi=0,*HBMphi=0,*HEPphi=0,*HEMphi=0,*HFPphi=0,*HFMphi=0,*HO0phi=0,*HO1Pphi=0,*HO2Pphi=0,*HO1Mphi=0,*HO2Mphi=0;
00499
00500 s=subdir_+"Summary Plots/HBHEHO LED Energy Distribution"; me=dqmStore_->get(s.c_str());
00501 if(me!=0) Energy=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, Energy, debug_); else return;
00502 s=subdir_+"Summary Plots/HBHEHO LED Timing Distribution"; me=dqmStore_->get(s.c_str());
00503 if(me!=0) Timing=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, Timing, debug_); else return;
00504 s=subdir_+"Summary Plots/HBHEHO LED Energy RMS_div_Energy Distribution"; me=dqmStore_->get(s.c_str());
00505 if(me!=0) EnergyRMS=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, EnergyRMS, debug_); else return;
00506 s=subdir_+"Summary Plots/HBHEHO LED Timing RMS Distribution"; me=dqmStore_->get(s.c_str());
00507 if(me!=0) TimingRMS=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, TimingRMS, debug_); else return;
00508 s=subdir_+"Summary Plots/HF LED Energy Distribution"; me=dqmStore_->get(s.c_str());
00509 if(me!=0) EnergyHF=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, EnergyHF, debug_); else return;
00510 s=subdir_+"Summary Plots/HF LED Timing Distribution"; me=dqmStore_->get(s.c_str());
00511 if(me!=0) TimingHF=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, TimingHF, debug_); else return;
00512 s=subdir_+"Summary Plots/HF LED Energy RMS_div_Energy Distribution"; me=dqmStore_->get(s.c_str());
00513 if(me!=0) EnergyRMSHF=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, EnergyRMSHF, debug_); else return;
00514 s=subdir_+"Summary Plots/HF LED Timing RMS Distribution"; me=dqmStore_->get(s.c_str());
00515 if(me!=0) TimingRMSHF=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, TimingRMSHF, debug_); else return;
00516
00517 s=subdir_+"Summary Plots/LED Timing HBHEHF"; me=dqmStore_->get(s.c_str());
00518 if(me!=0) Time2Dhbhehf=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Time2Dhbhehf, debug_); else return;
00519 s=subdir_+"Summary Plots/LED Timing HO"; me=dqmStore_->get(s.c_str());
00520 if(me!=0) Time2Dho=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Time2Dho, debug_); else return;
00521 s=subdir_+"Summary Plots/LED Energy HBHEHF"; me=dqmStore_->get(s.c_str());
00522 if(me!=0) Energy2Dhbhehf=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Energy2Dhbhehf, debug_); else return;
00523 s=subdir_+"Summary Plots/LED Energy HO"; me=dqmStore_->get(s.c_str());
00524 if(me!=0) Energy2Dho=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Energy2Dho, debug_); else return;
00525
00526 s=subdir_+"Summary Plots/HBP Average over HPD LED Ref"; me=dqmStore_->get(s.c_str());
00527 if(me!=0) HBPphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HBPphi, debug_); else return;
00528 s=subdir_+"Summary Plots/HBM Average over HPD LED Ref"; me=dqmStore_->get(s.c_str());
00529 if(me!=0) HBMphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HBMphi, debug_); else return;
00530 s=subdir_+"Summary Plots/HEP Average over HPD LED Ref"; me=dqmStore_->get(s.c_str());
00531 if(me!=0) HEPphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HEPphi, debug_); else return;
00532 s=subdir_+"Summary Plots/HEM Average over HPD LED Ref"; me=dqmStore_->get(s.c_str());
00533 if(me!=0) HEMphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HEMphi, debug_); else return;
00534 s=subdir_+"Summary Plots/HFP Average over RM LED Ref"; me=dqmStore_->get(s.c_str());
00535 if(me!=0) HFPphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HFPphi, debug_); else return;
00536 s=subdir_+"Summary Plots/HFM Average over RM LED Ref"; me=dqmStore_->get(s.c_str());
00537 if(me!=0) HFMphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HFMphi, debug_); else return;
00538
00539 s=subdir_+"Summary Plots/HO0 Average over HPD LED Ref"; me=dqmStore_->get(s.c_str());
00540 if(me!=0) HO0phi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HO0phi, debug_); else return;
00541 s=subdir_+"Summary Plots/HO1P Average over HPD LED Ref"; me=dqmStore_->get(s.c_str());
00542 if(me!=0) HO1Pphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HO1Pphi, debug_); else return;
00543 s=subdir_+"Summary Plots/HO2P Average over HPD LED Ref"; me=dqmStore_->get(s.c_str());
00544 if(me!=0) HO2Pphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HO2Pphi, debug_); else return;
00545 s=subdir_+"Summary Plots/HO1M Average over HPD LED Ref"; me=dqmStore_->get(s.c_str());
00546 if(me!=0) HO1Mphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HO1Mphi, debug_); else return;
00547 s=subdir_+"Summary Plots/HO2M Average over HPD LED Ref"; me=dqmStore_->get(s.c_str());
00548 if(me!=0) HO2Mphi=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HO2Mphi, debug_); else return;
00549
00550 gROOT->SetBatch(true);
00551 gStyle->SetCanvasColor(0);
00552 gStyle->SetPadColor(0);
00553 gStyle->SetOptStat(111110);
00554 gStyle->SetPalette(1);
00555
00556 TCanvas *can=new TCanvas("HcalDetDiagLEDClient","HcalDetDiagLEDClient",0,0,500,350);
00557 can->SetGridy();
00558 can->SetGridx();
00559 can->cd();
00560
00561 ofstream htmlFile;
00562 std::string outfile=htmlDir+name_+".html";
00563 htmlFile.open(outfile.c_str());
00564
00565 htmlFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> " << std::endl;
00566 htmlFile << "<html> " << std::endl;
00567 htmlFile << "<head> " << std::endl;
00568 htmlFile << " <meta content=\"text/html; charset=ISO-8859-1\" " << std::endl;
00569 htmlFile << " https-equiv=\"content-type\"> " << std::endl;
00570 htmlFile << " <title>Detector Diagnostics LED Monitor</title> " << std::endl;
00571 htmlFile << "</head> " << std::endl;
00572 htmlFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << std::endl;
00573 htmlFile << "<style type=\"text/css\">"<< std::endl;
00574 htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FF7700; text-align: center;}"<< std::endl;
00575 htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< std::endl;
00576 htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: red; }"<< std::endl;
00577 htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: yellow; }"<< std::endl;
00578 htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: green; }"<< std::endl;
00579 htmlFile << " td.s5 { font-family: arial, arial ce, helvetica; background-color: silver; }"<< std::endl;
00580 std::string state[4]={"<td class=\"s2\" align=\"center\">",
00581 "<td class=\"s3\" align=\"center\">",
00582 "<td class=\"s4\" align=\"center\">",
00583 "<td class=\"s5\" align=\"center\">"};
00584 htmlFile << "</style>"<< std::endl;
00585 htmlFile << "<body> " << std::endl;
00586 htmlFile << "<br> " << std::endl;
00587 htmlFile << "<h2>Run: " << std::endl;
00588 htmlFile << " <span " << std::endl;
00589 htmlFile << " style=\"color: rgb(0, 0, 153);\">" << runNo << "</span></h2>" << std::endl;
00590 htmlFile << "<h2>Monitoring task: <span " << std::endl;
00591 htmlFile << " style=\"color: rgb(0, 0, 153);\">Detector Diagnostics LED Monitor</span></h2> " << std::endl;
00592 htmlFile << "<h2>Events processed: <span " << std::endl;
00593 htmlFile << " style=\"color: rgb(0, 0, 153);\">" << ievt_ << "</span></h2>" << std::endl;
00594 htmlFile << "<hr>" << std::endl;
00596 htmlFile << "<table width=100% border=1>" << std::endl;
00597 htmlFile << "<tr>" << std::endl;
00598 htmlFile << "<td class=\"s0\" width=15% align=\"center\">SebDet</td>" << std::endl;
00599 htmlFile << "<td class=\"s0\" width=17% align=\"center\">Missing</td>" << std::endl;
00600 htmlFile << "<td class=\"s0\" width=17% align=\"center\">Unstable</td>" << std::endl;
00601 htmlFile << "<td class=\"s0\" width=17% align=\"center\">low/no LED signal</td>" << std::endl;
00602 htmlFile << "<td class=\"s0\" width=17% align=\"center\">Bad Timing</td>" << std::endl;
00603 htmlFile << "<td class=\"s0\" width=17% align=\"center\">Bad LED signal</td>" << std::endl;
00604 htmlFile << "</tr><tr>" << std::endl;
00605 int ind1=0,ind2=0,ind3=0,ind4=0,ind5=0;
00606 htmlFile << "<td class=\"s1\" align=\"center\">HB+</td>" << std::endl;
00607 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;
00608 ind2=3; if(newHBP[1]==0) ind2=2; if(newHBP[1]>0) ind2=1; if(newHBP[1]>21) ind2=0;
00609 ind3=3; if(newHBP[2]==0) ind3=2; if(newHBP[2]>0) ind3=1; if(newHBP[2]>21) ind3=0;
00610 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;
00611 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;
00612 if(ind1==3) ind2=ind3=ind4=ind5=3;
00613 if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1) status|=1;
00614 htmlFile << state[ind1] << HBP[0] <<" (1296)</td>" << std::endl;
00615 htmlFile << state[ind2] << HBP[1] <<"</td>" << std::endl;
00616 htmlFile << state[ind3] << HBP[2] <<"</td>" << std::endl;
00617 htmlFile << state[ind5] << HBP[5]+HBP[6] <<"</td>" << std::endl;
00618 htmlFile << state[ind4] << HBP[3]+HBP[4] <<"</td>" << std::endl;
00619
00620 htmlFile << "</tr><tr>" << std::endl;
00621 htmlFile << "<td class=\"s1\" align=\"center\">HB-</td>" << std::endl;
00622 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;
00623 ind2=3; if(newHBM[1]==0) ind2=2; if(newHBM[1]>0) ind2=1; if(newHBM[1]>21) ind2=0;
00624 ind3=3; if(newHBM[2]==0) ind3=2; if(newHBM[2]>0) ind3=1; if(newHBM[2]>21) ind3=0;
00625 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;
00626 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;
00627 if(ind1==3) ind2=ind3=ind4=ind5=3;
00628 if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1)status|=1;
00629 htmlFile << state[ind1] << HBM[0] <<" (1296)</td>" << std::endl;
00630 htmlFile << state[ind2] << HBM[1] <<"</td>" << std::endl;
00631 htmlFile << state[ind3] << HBM[2] <<"</td>" << std::endl;
00632 htmlFile << state[ind5] << HBM[5]+HBM[6] <<"</td>" << std::endl;
00633 htmlFile << state[ind4] << HBM[3]+HBM[4] <<"</td>" << std::endl;
00634
00635 htmlFile << "</tr><tr>" << std::endl;
00636 htmlFile << "<td class=\"s1\" align=\"center\">HE+</td>" << std::endl;
00637 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;
00638 ind2=3; if(newHEP[1]==0) ind2=2; if(newHEP[1]>0) ind2=1; if(newHEP[1]>21) ind2=0;
00639 ind3=3; if(newHEP[2]==0) ind3=2; if(newHEP[2]>0) ind3=1; if(newHEP[2]>21) ind3=0;
00640 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;
00641 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;
00642 if(ind1==3) ind2=ind3=ind4=ind5=3;
00643 if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1)status|=1;
00644 htmlFile << state[ind1] << HEP[0] <<" (1296)</td>" << std::endl;
00645 htmlFile << state[ind2] << HEP[1] <<"</td>" << std::endl;
00646 htmlFile << state[ind3] << HEP[2] <<"</td>" << std::endl;
00647 htmlFile << state[ind5] << HEP[5]+HEP[6] <<"</td>" << std::endl;
00648 htmlFile << state[ind4] << HEP[3]+HEP[4] <<"</td>" << std::endl;
00649
00650 htmlFile << "</tr><tr>" << std::endl;
00651 htmlFile << "<td class=\"s1\" align=\"center\">HE-</td>" << std::endl;
00652 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;
00653 ind2=3; if(newHEM[1]==0) ind2=2; if(newHEM[1]>0) ind2=1; if(newHEM[1]>21) ind2=0;
00654 ind3=3; if(newHEM[2]==0) ind3=2; if(newHEM[2]>0) ind3=1; if(newHEM[2]>21) ind3=0;
00655 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;
00656 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;
00657 if(ind1==3) ind2=ind3=ind4=ind5=3;
00658 if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1)status|=1;
00659 htmlFile << state[ind1] << HEM[0] <<" (1296)</td>" << std::endl;
00660 htmlFile << state[ind2] << HEM[1] <<"</td>" << std::endl;
00661 htmlFile << state[ind3] << HEM[2] <<"</td>" << std::endl;
00662 htmlFile << state[ind5] << HEM[5]+HEM[6] <<"</td>" << std::endl;
00663 htmlFile << state[ind4] << HEM[3]+HEM[4] <<"</td>" << std::endl;
00664
00665 htmlFile << "</tr><tr>" << std::endl;
00666 htmlFile << "<td class=\"s1\" align=\"center\">HF+</td>" << std::endl;
00667 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;
00668 ind2=3; if(newHFP[1]==0) ind2=2; if(newHFP[1]>0) ind2=1; if(newHFP[1]>21) ind2=0;
00669 ind3=3; if(newHFP[2]==0) ind3=2; if(newHFP[2]>0) ind3=1; if(newHFP[2]>21) ind3=0;
00670 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;
00671 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;
00672 if(ind1==3) ind2=ind3=ind4=ind5=3;
00673 if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1)status|=1;
00674 htmlFile << state[ind1] << HFP[0] <<" (864)</td>" << std::endl;
00675 htmlFile << state[ind2] << HFP[1] <<"</td>" << std::endl;
00676 htmlFile << state[ind3] << HFP[2] <<"</td>" << std::endl;
00677 htmlFile << state[ind5] << HFP[5]+HFP[6] <<"</td>" << std::endl;
00678 htmlFile << state[ind4] << HFP[3]+HFP[4] <<"</td>" << std::endl;
00679
00680 htmlFile << "</tr><tr>" << std::endl;
00681 htmlFile << "<td class=\"s1\" align=\"center\">HF-</td>" << std::endl;
00682 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;
00683 ind2=3; if(newHFM[1]==0) ind2=2; if(newHFM[1]>0) ind2=1; if(newHFM[1]>21) ind2=0;
00684 ind3=3; if(newHFM[2]==0) ind3=2; if(newHFM[2]>0) ind3=1; if(newHFM[2]>21) ind3=0;
00685 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;
00686 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;
00687 if(ind1==3) ind2=ind3=ind4=ind5=3;
00688 if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1)status|=1;
00689 htmlFile << state[ind1] << HFM[0] <<" (864)</td>" << std::endl;
00690 htmlFile << state[ind2] << HFM[1] <<"</td>" << std::endl;
00691 htmlFile << state[ind3] << HFM[2] <<"</td>" << std::endl;
00692 htmlFile << state[ind5] << HFM[5]+HFM[6] <<"</td>" << std::endl;
00693 htmlFile << state[ind4] << HFM[3]+HFM[4] <<"</td>" << std::endl;
00694
00695 htmlFile << "</tr><tr>" << std::endl;
00696 htmlFile << "<td class=\"s1\" align=\"center\">HO</td>" << std::endl;
00697 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;
00698 ind2=3; if(newHO[1]==0) ind2=2; if(newHO[1]>0) ind2=1; if(newHO[1]>21) ind2=0;
00699 ind3=3; if(newHO[2]==0) ind3=2; if(newHO[2]>0) ind3=1; if(newHO[2]>21) ind3=0;
00700 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;
00701 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;
00702 if(ind1==3) ind2=ind3=ind4=ind5=3;
00703 if(ind1==0 || ind2==0 || ind3==0 || ind4==0) status|=2; else if(ind1==1 || ind2==1 || ind3==1 || ind4==1)status|=1;
00704
00705 htmlFile << state[ind1] << HO[0] <<" (2160)</td>" << std::endl;
00706 htmlFile << state[ind2] << HO[1] <<"</td>" << std::endl;
00707 htmlFile << state[ind3] << HO[2] <<"</td>" << std::endl;
00708 htmlFile << state[ind5] << HO[5]+HO[6] <<"</td>" << std::endl;
00709 htmlFile << state[ind4] << HO[3]+HO[4] <<"</td>" << std::endl;
00710
00711 htmlFile << "</tr></table>" << std::endl;
00712 htmlFile << "<hr>" << std::endl;
00714 if((MissingCnt+UnstableCnt+UnstableLEDCnt+BadTimingCnt)>0){
00715 htmlFile << "<table width=100% border=1><tr>" << std::endl;
00716 if(MissingCnt>0) htmlFile << "<td><a href=\"" << "Missing.html" <<"\">list of missing channels</a></td>";
00717 if(UnstableCnt>0) htmlFile << "<td><a href=\"" << "Unstable.html" <<"\">list of unstable channels</a></td>";
00718 if(UnstableLEDCnt>0)htmlFile << "<td><a href=\"" << "UnstableLED.html" <<"\">list of low LED signal channels</a></td>";
00719 if(BadTimingCnt>0)htmlFile << "<td><a href=\"" << "BadTiming.html" <<"\">list of Bad Timing channels</a></td>";
00720 htmlFile << "</tr></table>" << std::endl;
00721 }
00723
00725 htmlFile << "<h2 align=\"center\">Summary LED plots</h2>" << std::endl;
00726 htmlFile << "<table width=100% border=0><tr>" << std::endl;
00727 htmlFile << "<tr align=\"left\">" << std::endl;
00728 Time2Dhbhehf->SetMaximum(6);
00729 Time2Dho->SetMaximum(6);
00730 Time2Dhbhehf->SetNdivisions(36,"Y");
00731 Time2Dho->SetNdivisions(36,"Y");
00732 Time2Dhbhehf->SetStats(0);
00733 Time2Dho->SetStats(0);
00734 Time2Dhbhehf->Draw("COLZ"); can->SaveAs((htmlDir + "led_timing_hbhehf.gif").c_str());
00735 Time2Dho->Draw("COLZ"); can->SaveAs((htmlDir + "led_timing_ho.gif").c_str());
00736 htmlFile << "<td align=\"center\"><img src=\"led_timing_hbhehf.gif\" alt=\"led timing distribution\"> </td>" << std::endl;
00737 htmlFile << "<td align=\"center\"><img src=\"led_timing_ho.gif\" alt=\"led timing distribution\"> </td>" << std::endl;
00738 htmlFile << "</tr>" << std::endl;
00739
00740 htmlFile << "<tr align=\"left\">" << std::endl;
00741 Energy2Dhbhehf->SetStats(0);
00742 Energy2Dho->SetStats(0);
00743 Energy2Dhbhehf->SetNdivisions(36,"Y");
00744 Energy2Dho->SetNdivisions(36,"Y");
00745 Energy2Dhbhehf->Draw("COLZ"); can->SaveAs((htmlDir + "led_energy_hbhehf.gif").c_str());
00746 Energy2Dho->Draw("COLZ"); can->SaveAs((htmlDir + "led_energy_ho.gif").c_str());
00747 htmlFile << "<td align=\"center\"><img src=\"led_energy_hbhehf.gif\" alt=\"led energy distribution\"> </td>" << std::endl;
00748 htmlFile << "<td align=\"center\"><img src=\"led_energy_ho.gif\" alt=\"led energy distribution\"> </td>" << std::endl;
00749 htmlFile << "</tr>" << std::endl;
00750
00751 can->SetGridy(false);
00752 htmlFile << "<tr align=\"left\">" << std::endl;
00753 Energy->Draw(); can->SaveAs((htmlDir + "led_energy_distribution.gif").c_str());
00754 EnergyRMS->Draw(); can->SaveAs((htmlDir + "led_energy_rms_distribution.gif").c_str());
00755 htmlFile << "<td align=\"center\"><img src=\"led_energy_distribution.gif\" alt=\"led energy distribution\"> </td>" << std::endl;
00756 htmlFile << "<td align=\"center\"><img src=\"led_energy_rms_distribution.gif\" alt=\"led energy rms distribution\"> </td>" << std::endl;
00757 htmlFile << "</tr>" << std::endl;
00758 htmlFile << "<tr align=\"left\">" << std::endl;
00759 Timing->Draw(); can->SaveAs((htmlDir + "led_timing_distribution.gif").c_str());
00760 TimingRMS->Draw(); can->SaveAs((htmlDir + "led_timing_rms_distribution.gif").c_str());
00761 htmlFile << "<td align=\"center\"><img src=\"led_timing_distribution.gif\" alt=\"led timing distribution\"> </td>" << std::endl;
00762 htmlFile << "<td align=\"center\"><img src=\"led_timing_rms_distribution.gif\" alt=\"led timing rms distribution\"> </td>" << std::endl;
00763 htmlFile << "</tr>" << std::endl;
00764 htmlFile << "<tr align=\"left\">" << std::endl;
00765 EnergyHF->Draw(); can->SaveAs((htmlDir + "led_energyhf_distribution.gif").c_str());
00766 EnergyRMSHF->Draw(); can->SaveAs((htmlDir + "led_energyhf_rms_distribution.gif").c_str());
00767 htmlFile << "<td align=\"center\"><img src=\"led_energyhf_distribution.gif\" alt=\"hf led energy distribution\"> </td>" << std::endl;
00768 htmlFile << "<td align=\"center\"><img src=\"led_energyhf_rms_distribution.gif\" alt=\"hf led energy rms distribution\"> </td>" << std::endl;
00769 htmlFile << "</tr>" << std::endl;
00770 htmlFile << "<tr align=\"left\">" << std::endl;
00771 TimingHF->Draw(); can->SaveAs((htmlDir + "led_timinghf_distribution.gif").c_str());
00772 TimingRMSHF->Draw(); can->SaveAs((htmlDir + "led_timinghf_rms_distribution.gif").c_str());
00773 htmlFile << "<td align=\"center\"><img src=\"led_timinghf_distribution.gif\" alt=\"hf led timing distribution\"> </td>" << std::endl;
00774 htmlFile << "<td align=\"center\"><img src=\"led_timinghf_rms_distribution.gif\" alt=\"hf led timing rms distribution\"> </td>" << std::endl;
00775 htmlFile << "</tr>" << std::endl;
00776 htmlFile << "</table>" << std::endl;
00777
00779 htmlFile << "<h2 align=\"center\">Stability LED plots (Reference run "<<ref_run<<")</h2>" << std::endl;
00780 htmlFile << "<table width=100% border=0><tr>" << std::endl;
00781 htmlFile << "<tr align=\"left\">" << std::endl;
00782 HBPphi->GetXaxis()->SetNdivisions(418,kFALSE);
00783 HBMphi->GetXaxis()->SetNdivisions(418,kFALSE);
00784 HEPphi->GetXaxis()->SetNdivisions(418,kFALSE);
00785 HEMphi->GetXaxis()->SetNdivisions(418,kFALSE);
00786
00787 HBPphi->SetMarkerColor(kRed);
00788 HBPphi->SetMarkerStyle(23);
00789 HBPphi->SetXTitle("HPD Index = RBX*4+RM");
00790 HBMphi->SetMarkerColor(kRed);
00791 HBMphi->SetMarkerStyle(23);
00792 HBMphi->SetXTitle("HPD Index = RBX*4+RM");
00793 HBPphi->Draw(); can->SaveAs((htmlDir + "led_hbp_distribution.gif").c_str());
00794 HBMphi->Draw(); can->SaveAs((htmlDir + "led_hbm_distribution.gif").c_str());
00795 htmlFile << "<td align=\"center\"><img src=\"led_hbp_distribution.gif\" alt=\"led hbp distribution\"> </td>" << std::endl;
00796 htmlFile << "<td align=\"center\"><img src=\"led_hbm_distribution.gif\" alt=\"led hbm distribution\"> </td>" << std::endl;
00797 htmlFile << "</tr>" << std::endl;
00798
00799 htmlFile << "<tr align=\"left\">" << std::endl;
00800 HEPphi->SetMarkerColor(kRed);
00801 HEPphi->SetMarkerStyle(23);
00802 HEPphi->SetXTitle("HPD Index = RBX*4+RM");
00803 HEMphi->SetMarkerColor(kRed);
00804 HEMphi->SetMarkerStyle(23);
00805 HEMphi->SetXTitle("HPD Index = RBX*4+RM");
00806 HEPphi->Draw(); can->SaveAs((htmlDir + "led_hep_distribution.gif").c_str());
00807 HEMphi->Draw(); can->SaveAs((htmlDir + "led_hem_distribution.gif").c_str());
00808 htmlFile << "<td align=\"center\"><img src=\"led_hep_distribution.gif\" alt=\"led hep distribution\"> </td>" << std::endl;
00809 htmlFile << "<td align=\"center\"><img src=\"led_hem_distribution.gif\" alt=\"led hem distribution\"> </td>" << std::endl;
00810 htmlFile << "</tr>" << std::endl;
00811
00812 htmlFile << "<tr align=\"left\">" << std::endl;
00813 HFPphi->SetMarkerColor(kRed);
00814 HFPphi->SetMarkerStyle(23);
00815 HFPphi->SetXTitle("RM Index = RoBox*3+RM");
00816 HFMphi->SetMarkerColor(kRed);
00817 HFMphi->SetMarkerStyle(23);
00818 HFPphi->GetXaxis()->SetNdivisions(312,kFALSE);
00819 HFMphi->GetXaxis()->SetNdivisions(312,kFALSE);
00820
00821 HFMphi->SetXTitle("RM Index = RoBox*3+RM");
00822 HFPphi->Draw(); can->SaveAs((htmlDir + "led_hfp_distribution.gif").c_str());
00823 HFMphi->Draw(); can->SaveAs((htmlDir + "led_hfm_distribution.gif").c_str());
00824 htmlFile << "<td align=\"center\"><img src=\"led_hfp_distribution.gif\" alt=\"led hfp distribution\"> </td>" << std::endl;
00825 htmlFile << "<td align=\"center\"><img src=\"led_hfm_distribution.gif\" alt=\"led hfm distribution\"> </td>" << std::endl;
00826 htmlFile << "</tr>" << std::endl;
00827
00828 htmlFile << "<tr align=\"left\">" << std::endl;
00829 HO1Pphi->SetMarkerColor(kRed);
00830 HO1Pphi->SetMarkerStyle(23);
00831 HO1Pphi->SetXTitle("HPD Index = RBX*4+RM");
00832 HO1Mphi->SetMarkerColor(kRed);
00833 HO1Mphi->SetMarkerStyle(23);
00834 HO1Mphi->GetXaxis()->SetNdivisions(412,kFALSE);
00835 HO1Pphi->GetXaxis()->SetNdivisions(412,kFALSE);
00836
00837 HO1Mphi->SetXTitle("HPD Index = RBX*4+RM");
00838 HO1Pphi->Draw(); can->SaveAs((htmlDir + "led_ho1p_distribution.gif").c_str());
00839 HO1Mphi->Draw(); can->SaveAs((htmlDir + "led_ho1m_distribution.gif").c_str());
00840 htmlFile << "<td align=\"center\"><img src=\"led_ho1p_distribution.gif\" alt=\"led ho1p distribution\"> </td>" << std::endl;
00841 htmlFile << "<td align=\"center\"><img src=\"led_ho1m_distribution.gif\" alt=\"led ho1m distribution\"> </td>" << std::endl;
00842 htmlFile << "</tr>" << std::endl;
00843
00844 htmlFile << "<tr align=\"left\">" << std::endl;
00845 HO2Pphi->SetMarkerColor(kRed);
00846 HO2Pphi->SetMarkerStyle(23);
00847 HO2Pphi->SetXTitle("HPD Index = RBX*4+RM");
00848 HO2Mphi->SetMarkerColor(kRed);
00849 HO2Mphi->SetMarkerStyle(23);
00850 HO2Mphi->GetXaxis()->SetNdivisions(412,kFALSE);
00851 HO2Pphi->GetXaxis()->SetNdivisions(412,kFALSE);
00852
00853 HO2Mphi->SetXTitle("HPD Index = RBX*4+RM");
00854 HO2Pphi->Draw(); can->SaveAs((htmlDir + "led_ho2p_distribution.gif").c_str());
00855 HO2Mphi->Draw(); can->SaveAs((htmlDir + "led_ho2m_distribution.gif").c_str());
00856 htmlFile << "<td align=\"center\"><img src=\"led_ho2p_distribution.gif\" alt=\"led ho2p distribution\"> </td>" << std::endl;
00857 htmlFile << "<td align=\"center\"><img src=\"led_ho2m_distribution.gif\" alt=\"led ho2m distribution\"> </td>" << std::endl;
00858 htmlFile << "</tr>" << std::endl;
00859
00860 htmlFile << "<tr align=\"left\">" << std::endl;
00861 HO0phi->SetMarkerColor(kRed);
00862 HO0phi->SetMarkerStyle(23);
00863 HO0phi->SetXTitle("HPD Index = RBX*4+RM");
00864 HO0phi->GetXaxis()->SetNdivisions(412,kFALSE);
00865 HO0phi->Draw(); can->SaveAs((htmlDir + "led_ho0_distribution.gif").c_str());
00866 htmlFile << "<td align=\"center\"><img src=\"led_ho0_distribution.gif\" alt=\"led ho0 distribution\"> </td>" << std::endl;
00867 htmlFile << "</tr>" << std::endl;
00868
00869 htmlFile << "</table>" << std::endl;
00870
00871 htmlFile << "</body> " << std::endl;
00872 htmlFile << "</html> " << std::endl;
00873 htmlFile.close();
00874 can->Close();
00875 }