00001 #include "DQM/HcalMonitorClient/interface/HcalDetDiagLaserClient.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 typedef struct{
00023 int eta;
00024 int phi;
00025 }Raddam_ch;
00026 Raddam_ch RADDAM_CH[56]={{-30,15},{-32,15},{-34,15},{-36,15},{-38,15},{-40,15},{-41,15},
00027 {-30,35},{-32,35},{-34,35},{-36,35},{-38,35},{-40,35},{-41,35},
00028 {-30,51},{-32,51},{-34,51},{-36,51},{-38,51},{-40,51},{-41,51},
00029 {-30,71},{-32,71},{-34,71},{-36,71},{-38,71},{-40,71},{-41,71},
00030 {30, 01},{32, 01},{34, 01},{36, 01},{38, 01},{40, 71},{41, 71},
00031 {30, 21},{32, 21},{34, 21},{36, 21},{38, 21},{40, 19},{41, 19},
00032 {30, 37},{32, 37},{34, 37},{36, 37},{38, 37},{40, 35},{41, 35},
00033 {30, 57},{32, 57},{34, 57},{36, 57},{38, 57},{40, 55},{41, 55}};
00034 using namespace std;
00035 using namespace edm;
00036
00037 HcalDetDiagLaserClient::HcalDetDiagLaserClient(std::string myname)
00038 {
00039 name_=myname; status=0;
00040 }
00041
00042 HcalDetDiagLaserClient::HcalDetDiagLaserClient(std::string myname, const edm::ParameterSet& ps)
00043 {
00044 name_=myname;
00045 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
00046 debug_ = ps.getUntrackedParameter<int>("debug",0);
00047 prefixME_ = ps.getUntrackedParameter<string>("subSystemFolder","Hcal/");
00048 if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
00049 prefixME_.append("/");
00050 subdir_ = ps.getUntrackedParameter<string>("DetDiagLaserFolder","DetDiagLaserMonitor_Hcal/");
00051 if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
00052 subdir_.append("/");
00053 subdir_=prefixME_+subdir_;
00054
00055 validHtmlOutput_ = ps.getUntrackedParameter<bool>("DetDiagLaser_validHtmlOutput",true);
00056 cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00057 badChannelStatusMask_ = ps.getUntrackedParameter<int>("DetDiagLaser_BadChannelStatusMask",
00058 ps.getUntrackedParameter<int>("BadChannelStatusMask",0));
00059
00060 minerrorrate_ = ps.getUntrackedParameter<double>("DetDiagLaser_minerrorrate",
00061 ps.getUntrackedParameter<double>("minerrorrate",0.05));
00062 minevents_ = ps.getUntrackedParameter<int>("DetDiagLaser_minevents",
00063 ps.getUntrackedParameter<int>("minevents",1));
00064 ProblemCells=0;
00065 ProblemCellsByDepth=0;
00066 }
00067
00068 void HcalDetDiagLaserClient::analyze()
00069 {
00070 if (debug_>2) std::cout <<"\tHcalDetDiagLaserClient::analyze()"<<std::endl;
00071 calculateProblems();
00072 }
00073
00074 void HcalDetDiagLaserClient::calculateProblems()
00075 {
00076 if (debug_>2) std::cout <<"\t\tHcalDetDiagLaserClient::calculateProblems()"<<std::endl;
00077 if(!dqmStore_) return;
00078 double totalevents=0;
00079 int etabins=0, phibins=0, zside=0;
00080 double problemvalue=0;
00081
00082
00083 if (ProblemCells!=0)
00084 {
00085 ProblemCells->Reset();
00086 (ProblemCells->getTH2F())->SetMaximum(1.05);
00087 (ProblemCells->getTH2F())->SetMinimum(0.);
00088 }
00089 for (unsigned int d=0;d<ProblemCellsByDepth->depth.size();++d)
00090 {
00091 if (ProblemCellsByDepth->depth[d]!=0)
00092 {
00093 ProblemCellsByDepth->depth[d]->Reset();
00094 (ProblemCellsByDepth->depth[d]->getTH2F())->SetMaximum(1.05);
00095 (ProblemCellsByDepth->depth[d]->getTH2F())->SetMinimum(0.);
00096 }
00097 }
00098 enoughevents_=true;
00099
00100
00101
00102 std::vector<std::string> name = HcalEtaPhiHistNames();
00103
00104
00105 TH2F* BadTiming[4];
00106 TH2F* BadEnergy[4];
00107 MonitorElement* me;
00108 for (int i=0;i<4;++i)
00109 {
00110 BadTiming[i]=0;
00111 BadEnergy[i]=0;
00112 string s=subdir_+name[i]+" Problem Bad Laser Timing";
00113 me=dqmStore_->get(s.c_str());
00114 if (me!=0) BadTiming[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, BadTiming[i], debug_);
00115 else if (debug_>0) std::cout <<"<HcalDetDiagLaserClient::calculateProblems> could not get histogram '"<<s<<"'"<<std::endl;
00116 s=subdir_+name[i]+" Problem Bad Laser Energy";
00117 me=dqmStore_->get(s.c_str());
00118 if (me!=0) BadEnergy[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, BadEnergy[i], debug_);
00119 else if (debug_>0) std::cout <<"<HcalDetDiagLaserClient::calculateProblems> could not get histogram '"<<s<<"'"<<std::endl;
00120 }
00121
00122
00123
00124
00125 for (unsigned int d=0;d<ProblemCellsByDepth->depth.size();++d)
00126 {
00127 if (ProblemCellsByDepth->depth[d]==0) continue;
00128
00129
00130 totalevents=0;
00131
00132 if (BadTiming[d]!=0) totalevents += BadTiming[d]->GetBinContent(0);
00133 if (BadEnergy[d]!=0) totalevents += BadEnergy[d]->GetBinContent(0);
00134
00135
00136 totalevents=1;
00137
00138 etabins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsX();
00139 phibins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsY();
00140 for (int eta=0;eta<etabins;++eta)
00141 {
00142 int ieta=CalcIeta(eta,d+1);
00143 if (ieta==-9999) continue;
00144 for (int phi=0;phi<phibins;++phi)
00145 {
00146 problemvalue=0;
00147 if (BadTiming[d]!=0) problemvalue += BadTiming[d]->GetBinContent(eta+1,phi+1)*1./totalevents;
00148 if (BadEnergy[d]!=0) problemvalue += BadEnergy[d]->GetBinContent(eta+1,phi+1)*1./totalevents;
00149 if (problemvalue==0) continue;
00150
00151 problemvalue = min(1.,problemvalue);
00152
00153 zside=0;
00154 if (isHF(eta,d+1))
00155 ieta<0 ? zside = -1 : zside = 1;
00156
00157
00158
00159 if (problemvalue>minerrorrate_)
00160 {
00161 HcalSubdetector subdet=HcalEmpty;
00162 if (isHB(eta,d+1))subdet=HcalBarrel;
00163 else if (isHE(eta,d+1)) subdet=HcalEndcap;
00164 else if (isHF(eta,d+1)) subdet=HcalForward;
00165 else if (isHO(eta,d+1)) subdet=HcalOuter;
00166 HcalDetId hcalid(subdet, ieta, phi+1, (int)(d+1));
00167 if (badstatusmap.find(hcalid)!=badstatusmap.end())
00168 problemvalue=999;
00169 }
00170
00171 ProblemCellsByDepth->depth[d]->setBinContent(eta+1,phi+1,problemvalue);
00172 if (ProblemCells!=0) ProblemCells->Fill(ieta+zside,phi+1,problemvalue);
00173 }
00174 }
00175 }
00176
00177 if (ProblemCells==0)
00178 {
00179 if (debug_>0) std::cout <<"<HcalDetDiagLaserClient::calculateProblems> ProblemCells histogram does not exist!"<<endl;
00180 return;
00181 }
00182
00183
00184 etabins=(ProblemCells->getTH2F())->GetNbinsX();
00185 phibins=(ProblemCells->getTH2F())->GetNbinsY();
00186 for (int eta=0;eta<etabins;++eta)
00187 {
00188 for (int phi=0;phi<phibins;++phi)
00189 {
00190 if (ProblemCells->getBinContent(eta+1,phi+1)>1. && ProblemCells->getBinContent(eta+1,phi+1)<999)
00191 ProblemCells->setBinContent(eta+1,phi+1,1.);
00192 }
00193 }
00194
00195 FillUnphysicalHEHFBins(*ProblemCellsByDepth);
00196 FillUnphysicalHEHFBins(ProblemCells);
00197 return;
00198 }
00199
00200 void HcalDetDiagLaserClient::beginJob()
00201 {
00202 dqmStore_ = Service<DQMStore>().operator->();
00203 if (debug_>0)
00204 {
00205 std::cout <<"<HcalDetDiagLaserClient::beginJob()> Displaying dqmStore directory structure:"<<std::endl;
00206 dqmStore_->showDirStructure();
00207 }
00208 }
00209 void HcalDetDiagLaserClient::endJob(){}
00210
00211 void HcalDetDiagLaserClient::beginRun(void)
00212 {
00213 enoughevents_=false;
00214 if (!dqmStore_)
00215 {
00216 if (debug_>0) std::cout <<"<HcalDetDiagLaserClient::beginRun> dqmStore does not exist!"<<std::endl;
00217 return;
00218 }
00219 dqmStore_->setCurrentFolder(subdir_);
00220 problemnames_.clear();
00221
00222
00223 ProblemCells=dqmStore_->book2D(" ProblemDetDiagLaser",
00224 " Problem DetDiagLaser Rate for all HCAL;ieta;iphi",
00225 85,-42.5,42.5,
00226 72,0.5,72.5);
00227 problemnames_.push_back(ProblemCells->getName());
00228 if (debug_>1)
00229 std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
00230 dqmStore_->setCurrentFolder(subdir_+"problem_DetDiagLaser");
00231 ProblemCellsByDepth = new EtaPhiHists();
00232 ProblemCellsByDepth->setup(dqmStore_," Problem DetDiagLaser Rate");
00233 for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
00234 problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
00235 nevts_=0;
00236 }
00237
00238 void HcalDetDiagLaserClient::endRun(void){analyze();}
00239
00240 void HcalDetDiagLaserClient::setup(void){}
00241 void HcalDetDiagLaserClient::cleanup(void){}
00242
00243 bool HcalDetDiagLaserClient::hasErrors_Temp(void)
00244 {
00245 if(status&2) return true;
00246 return false;
00247
00248 if (!ProblemCells)
00249 {
00250 if (debug_>1) std::cout <<"<HcalDetDiagLaserClient::hasErrors_Temp> ProblemCells histogram does not exist!"<<std::endl;
00251 return false;
00252 }
00253 int problemcount=0;
00254 int ieta=-9999;
00255
00256 for (int depth=0;depth<4; ++depth)
00257 {
00258 int etabins = (ProblemCells->getTH2F())->GetNbinsX();
00259 int phibins = (ProblemCells->getTH2F())->GetNbinsY();
00260 for (int hist_eta=0;hist_eta<etabins;++hist_eta)
00261 {
00262 for (int hist_phi=0; hist_phi<phibins;++hist_phi)
00263 {
00264 ieta=CalcIeta(hist_eta,depth+1);
00265 if (ieta==-9999) continue;
00266 if (ProblemCellsByDepth->depth[depth]==0)
00267 continue;
00268 if (ProblemCellsByDepth->depth[depth]->getBinContent(hist_eta,hist_phi)>minerrorrate_)
00269 ++problemcount;
00270
00271 }
00272 }
00273 }
00274
00275 if (problemcount>0) return true;
00276 return false;
00277 }
00278
00279 bool HcalDetDiagLaserClient::hasWarnings_Temp(void){
00280 if(status&1) return true;
00281 return false;
00282 }
00283 bool HcalDetDiagLaserClient::hasOther_Temp(void){return false;}
00284 bool HcalDetDiagLaserClient::test_enabled(void){return true;}
00285
00286
00287 void HcalDetDiagLaserClient::updateChannelStatus(std::map<HcalDetId, unsigned int>& myqual)
00288 {
00289
00290
00291
00292
00293 }
00294 static void printTableHeader(ofstream& file,std::string header){
00295 file << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">"<< endl;
00296 file << "<head>"<< endl;
00297 file << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>"<< endl;
00298 file << "<title>"<< header <<"</title>"<< endl;
00299 file << "<style type=\"text/css\">"<< endl;
00300 file << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"<< endl;
00301 file << " td.s0 { font-family: arial, arial ce, helvetica; }"<< endl;
00302 file << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< endl;
00303 file << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }"<< endl;
00304 file << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }"<< endl;
00305 file << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }"<< endl;
00306 file << "</style>"<< endl;
00307 file << "<body>"<< endl;
00308 file << "<table>"<< endl;
00309 }
00310 static void printTableLine(ofstream& file,int ind,HcalDetId& detid,HcalFrontEndId& lmap_entry,HcalElectronicsId &emap_entry,std::string comment=""){
00311 if(ind==0){
00312 file << "<tr>";
00313 file << "<td class=\"s4\" align=\"center\">#</td>" << endl;
00314 file << "<td class=\"s1\" align=\"center\">ETA</td>" << endl;
00315 file << "<td class=\"s1\" align=\"center\">PHI</td>" << endl;
00316 file << "<td class=\"s1\" align=\"center\">DEPTH</td>"<< endl;
00317 file << "<td class=\"s1\" align=\"center\">RBX</td>" << endl;
00318 file << "<td class=\"s1\" align=\"center\">RM</td>" << endl;
00319 file << "<td class=\"s1\" align=\"center\">PIXEL</td>" << endl;
00320 file << "<td class=\"s1\" align=\"center\">RM_FIBER</td>" << endl;
00321 file << "<td class=\"s1\" align=\"center\">FIBER_CH</td>" << endl;
00322 file << "<td class=\"s1\" align=\"center\">QIE</td>" << endl;
00323 file << "<td class=\"s1\" align=\"center\">ADC</td>" << endl;
00324 file << "<td class=\"s1\" align=\"center\">CRATE</td>" << endl;
00325 file << "<td class=\"s1\" align=\"center\">DCC</td>" << endl;
00326 file << "<td class=\"s1\" align=\"center\">SPIGOT</td>" << endl;
00327 file << "<td class=\"s1\" align=\"center\">HTR_FIBER</td>" << endl;
00328 file << "<td class=\"s1\" align=\"center\">HTR_SLOT</td>" << endl;
00329 file << "<td class=\"s1\" align=\"center\">HTR_FPGA</td>" << endl;
00330 if(comment[0]!=0) file << "<td class=\"s1\" align=\"center\">Comment</td>" << endl;
00331 file << "</tr>" << endl;
00332 }
00333 std::string raw_class;
00334 file << "<tr>"<< endl;
00335 if((ind%2)==1){
00336 raw_class="<td class=\"s2\" align=\"center\">";
00337 }else{
00338 raw_class="<td class=\"s3\" align=\"center\">";
00339 }
00340 file << "<td class=\"s4\" align=\"center\">" << ind+1 <<"</td>"<< endl;
00341 file << raw_class<< detid.ieta()<<"</td>"<< endl;
00342 file << raw_class<< detid.iphi()<<"</td>"<< endl;
00343 file << raw_class<< detid.depth() <<"</td>"<< endl;
00344 file << raw_class<< lmap_entry.rbx()<<"</td>"<< endl;
00345 file << raw_class<< lmap_entry.rm() <<"</td>"<< endl;
00346 file << raw_class<< lmap_entry.pixel()<<"</td>"<< endl;
00347 file << raw_class<< lmap_entry.rmFiber() <<"</td>"<< endl;
00348 file << raw_class<< lmap_entry.fiberChannel()<<"</td>"<< endl;
00349 file << raw_class<< lmap_entry.qieCard() <<"</td>"<< endl;
00350 file << raw_class<< lmap_entry.adc()<<"</td>"<< endl;
00351 file << raw_class<< emap_entry.readoutVMECrateId()<<"</td>"<< endl;
00352 file << raw_class<< emap_entry.dccid()<<"</td>"<< endl;
00353 file << raw_class<< emap_entry.spigot()<<"</td>"<< endl;
00354 file << raw_class<< emap_entry.fiberIndex()<<"</td>"<< endl;
00355 file << raw_class<< emap_entry.htrSlot()<<"</td>"<< endl;
00356 file << raw_class<< emap_entry.htrTopBottom()<<"</td>"<< endl;
00357 if(comment[0]!=0) file << raw_class<< comment<<"</td>"<< endl;
00358 }
00359 static void printTableTail(ofstream& file){
00360 file << "</table>"<< endl;
00361 file << "</body>"<< endl;
00362 file << "</html>"<< endl;
00363 }
00364
00365 bool HcalDetDiagLaserClient::validHtmlOutput(){
00366 string s=subdir_+"HcalDetDiagLaserMonitor Event Number";
00367 MonitorElement *me = dqmStore_->get(s.c_str());
00368 int n=0;
00369 if ( me ) {
00370 s = me->valueString();
00371 sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &n);
00372 }
00373 if(n<100) return false;
00374 return true;
00375 }
00376 void HcalDetDiagLaserClient::htmlOutput(string htmlDir){
00377 if(dqmStore_==0){
00378 if (debug_>0) std::cout <<"<HcalDetDiagLaserClient::htmlOutput> dqmStore object does not exist!"<<std::endl;
00379 return;
00380 }
00381 if(debug_>2) std::cout <<"\t<HcalDetDiagLaserClient::htmlOutput> Preparing html for task: "<<name_<<std::endl;
00383
00384 HcalLogicalMapGenerator gen;
00385 HcalLogicalMap lmap(gen.createMap());
00386 HcalElectronicsMap emap=lmap.generateHcalElectronicsMap();
00387
00389 string ref_run,s;
00390 MonitorElement* me;
00391 TH1F *hbheEnergy=0;
00392 TH1F *hbheTiming=0;
00393 TH1F *hbheEnergyRMS=0;
00394 TH1F *hbheTimingRMS=0;
00395 TH1F *hoEnergy=0;
00396 TH1F *hoTiming=0;
00397 TH1F *hoEnergyRMS=0;
00398 TH1F *hoTimingRMS=0;
00399 TH1F *hfEnergy=0;
00400 TH1F *hfTiming=0;
00401 TH1F *hfEnergyRMS=0;
00402 TH1F *hfTimingRMS=0;
00403 TH1F *hb=0;
00404 TH1F *he=0;
00405 TH1F *ho=0;
00406 TH1F *hf=0;
00407 TH2F *Time2Dhbhehf=0;
00408 TH2F *Time2Dho=0;
00409 TH2F *Energy2Dhbhehf=0;
00410 TH2F *Energy2Dho=0;
00411 TH2F *refTime2Dhbhehf=0;
00412 TH2F *refTime2Dho=0;
00413 TH2F *refEnergy2Dhbhehf=0;
00414 TH2F *refEnergy2Dho=0;
00415 int HBpresent_=0,HEpresent_=0,HOpresent_=0,HFpresent_=0;
00416
00417
00418 me=dqmStore_->get(prefixME_+"HcalInfo/HBpresent");
00419 if(me!=0) HBpresent_=me->getIntValue();
00420 me=dqmStore_->get(prefixME_+"HcalInfo/HEpresent");
00421 if(me!=0) HEpresent_=me->getIntValue();
00422 me=dqmStore_->get(prefixME_+"HcalInfo/HOpresent");
00423 if(me!=0) HOpresent_=me->getIntValue();
00424 me=dqmStore_->get(prefixME_+"HcalInfo/HFpresent");
00425 if(me!=0) HFpresent_=me->getIntValue();
00426
00427 s=subdir_+"Summary Plots/HBHE Laser Energy Distribution"; me=dqmStore_->get(s.c_str());
00428 if(me!=0) hbheEnergy=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hbheEnergy, debug_); else return;
00429 s=subdir_+"Summary Plots/HBHE Laser Timing Distribution"; me=dqmStore_->get(s.c_str());
00430 if(me!=0) hbheTiming=HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hbheTiming, debug_); else return;
00431 s=subdir_+"Summary Plots/HBHE Laser Energy RMS_div_Energy Distribution"; me=dqmStore_->get(s.c_str());
00432 if(me!=0) hbheEnergyRMS= HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hbheEnergyRMS, debug_); else return;
00433 s=subdir_+"Summary Plots/HBHE Laser Timing RMS Distribution"; me=dqmStore_->get(s.c_str());
00434 if(me!=0) hbheTimingRMS= HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hbheTimingRMS, debug_); else return;
00435 s=subdir_+"Summary Plots/HO Laser Energy Distribution"; me=dqmStore_->get(s.c_str());
00436 if(me!=0) hoEnergy = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hoEnergy, debug_); else return;
00437 s=subdir_+"Summary Plots/HO Laser Timing Distribution"; me=dqmStore_->get(s.c_str());
00438 if(me!=0) hoTiming = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hoTiming, debug_); else return;
00439 s=subdir_+"Summary Plots/HO Laser Energy RMS_div_Energy Distribution"; me=dqmStore_->get(s.c_str());
00440 if(me!=0) hoEnergyRMS = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hoEnergyRMS, debug_); else return;
00441 s=subdir_+"Summary Plots/HO Laser Timing RMS Distribution"; me=dqmStore_->get(s.c_str());
00442 if(me!=0) hoTimingRMS = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hoTimingRMS, debug_); else return;
00443 s=subdir_+"Summary Plots/HF Laser Energy Distribution"; me=dqmStore_->get(s.c_str());
00444 if(me!=0) hfEnergy = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hfEnergy, debug_); else return;
00445 s=subdir_+"Summary Plots/HF Laser Timing Distribution"; me=dqmStore_->get(s.c_str());
00446 if(me!=0) hfTiming = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hfTiming, debug_); else return;
00447 s=subdir_+"Summary Plots/HF Laser Energy RMS_div_Energy Distribution"; me=dqmStore_->get(s.c_str());
00448 if(me!=0) hfEnergyRMS = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hfEnergyRMS, debug_); else return;
00449 s=subdir_+"Summary Plots/HF Laser Timing RMS Distribution"; me=dqmStore_->get(s.c_str());
00450 if(me!=0) hfTimingRMS = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hfTimingRMS, debug_); else return;
00451
00452 s=subdir_+"Summary Plots/HB RBX average Time-Ref"; me=dqmStore_->get(s.c_str());
00453 if(me!=0) hb = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hb, debug_); else return;
00454 s=subdir_+"Summary Plots/HE RBX average Time-Ref"; me=dqmStore_->get(s.c_str());
00455 if(me!=0) he = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, he, debug_); else return;
00456 s=subdir_+"Summary Plots/HO RBX average Time-Ref"; me=dqmStore_->get(s.c_str());
00457 if(me!=0) ho = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, ho, debug_); else return;
00458 s=subdir_+"Summary Plots/HF RoBox average Time-Ref"; me=dqmStore_->get(s.c_str());
00459 if(me!=0) hf = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, hf, debug_); else return;
00460
00461 s=subdir_+"Summary Plots/Laser Timing HBHEHF"; me=dqmStore_->get(s.c_str());
00462 if(me!=0) Time2Dhbhehf = HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Time2Dhbhehf, debug_); else return;
00463 s=subdir_+"Summary Plots/Laser Timing HO"; me=dqmStore_->get(s.c_str());
00464 if(me!=0) Time2Dho = HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Time2Dho, debug_); else return;
00465 s=subdir_+"Summary Plots/Laser Energy HBHEHF"; me=dqmStore_->get(s.c_str());
00466 if(me!=0) Energy2Dhbhehf= HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Energy2Dhbhehf, debug_); else return;
00467 s=subdir_+"Summary Plots/Laser Energy HO"; me=dqmStore_->get(s.c_str());
00468 if(me!=0) Energy2Dho = HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Energy2Dho, debug_); else return;
00469 s=subdir_+"Summary Plots/HBHEHF Laser (Timing-Ref)+1"; me=dqmStore_->get(s.c_str());
00470 if(me!=0) refTime2Dhbhehf = HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, refTime2Dhbhehf, debug_); else return;
00471 s=subdir_+"Summary Plots/HO Laser (Timing-Ref)+1"; me=dqmStore_->get(s.c_str());
00472 if(me!=0) refTime2Dho = HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, refTime2Dho, debug_); else return;
00473 s=subdir_+"Summary Plots/HBHEHF Laser Energy_div_Ref"; me=dqmStore_->get(s.c_str());
00474 if(me!=0) refEnergy2Dhbhehf= HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, refEnergy2Dhbhehf, debug_); else return;
00475 s=subdir_+"Summary Plots/HO Laser Energy_div_Ref"; me=dqmStore_->get(s.c_str());
00476 if(me!=0) refEnergy2Dho = HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, refEnergy2Dho, debug_); else return;
00477
00478 TH1F *Raddam[56];
00479 char str[100];
00480 for(int i=0;i<56;i++){
00481 sprintf(str,"RADDAM (%i %i)",RADDAM_CH[i].eta,RADDAM_CH[i].phi);
00482 s=subdir_+"Raddam Plots/"+str; me=dqmStore_->get(s.c_str());
00483 if(me!=0) Raddam[i] = HcalUtilsClient::getHisto<TH1F*>(me, cloneME_, Raddam[i], debug_);
00484 Raddam[i]->SetXTitle("TS");
00485 Raddam[i]->SetTitle(str);
00486 }
00487
00488 int ievt_ = -1,runNo=-1;
00489 s=subdir_+"HcalDetDiagLaserMonitor Event Number";
00490 me = dqmStore_->get(s.c_str());
00491 if ( me ) {
00492 s = me->valueString();
00493 sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &ievt_);
00494 }
00495 s=subdir_+"HcalDetDiagLaserMonitor Run Number";
00496 me = dqmStore_->get(s.c_str());
00497 if ( me ) {
00498 s = me->valueString();
00499 sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &runNo);
00500 }
00501 s=subdir_+"HcalDetDiagLaserMonitor Reference Run";
00502 me = dqmStore_->get(s.c_str());
00503 if(me) {
00504 string s=me->valueString();
00505 char str[200];
00506 sscanf((s.substr(2,s.length()-2)).c_str(), "%s", str);
00507 ref_run=str;
00508 }
00509
00510 int badT=0;
00511 int badE=0;
00512 int HBP[2]={0,0};
00513 int HBM[2]={0,0};
00514 int HEP[2]={0,0};
00515 int HEM[2]={0,0};
00516 int HFP[2]={0,0};
00517 int HFM[2]={0,0};
00518 int HO[2] ={0,0};
00519 int newHBP[2]={0,0};
00520 int newHBM[2]={0,0};
00521 int newHEP[2]={0,0};
00522 int newHEM[2]={0,0};
00523 int newHFP[2]={0,0};
00524 int newHFM[2]={0,0};
00525 int newHO[2] ={0,0};
00526
00527 TH2F* BadTiming_val[4];
00528 TH2F* BadEnergy_val[4];
00529 std::vector<std::string> name = HcalEtaPhiHistNames();
00530 for(int i=0;i<4;++i){
00531 BadTiming_val[i]=0;
00532 BadEnergy_val[i]=0;
00533 string s=subdir_+"Plots for client/"+name[i]+" Laser Timing difference";
00534 me=dqmStore_->get(s.c_str());
00535 if (me!=0) BadTiming_val[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, BadTiming_val[i], debug_); else return;
00536 s=subdir_+"Plots for client/"+name[i]+" Laser Energy difference";
00537 me=dqmStore_->get(s.c_str());
00538 if (me!=0) BadEnergy_val[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, BadEnergy_val[i], debug_); else return;
00539 }
00540
00542 ofstream badTiming;
00543 badTiming.open((htmlDir+"bad_timing_table.html").c_str());
00544 printTableHeader(badTiming,"Bad Timing Channels list");
00545 ofstream badEnergy;
00546 badEnergy.open((htmlDir+"bad_energy_table.html").c_str());
00547 printTableHeader(badEnergy,"Bad Energy Channels list");
00548
00549 for(int d=0;d<4;++d){
00550 int etabins=BadTiming_val[d]->GetNbinsX();
00551 int phibins=BadTiming_val[d]->GetNbinsY();
00552 for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00553 int ieta=CalcIeta(eta,d+1);
00554 if(ieta==-9999) continue;
00555 HcalSubdetector subdet=HcalEmpty;
00556 if(isHB(eta,d+1))subdet=HcalBarrel;
00557 else if (isHE(eta,d+1)) subdet=HcalEndcap;
00558 else if (isHF(eta,d+1)) subdet=HcalForward;
00559 else if (isHO(eta,d+1)) subdet=HcalOuter;
00560 HcalDetId hcalid(subdet, ieta, phi+1, (int)(d+1));
00561 float val=BadTiming_val[d]->GetBinContent(eta+1,phi+1);
00562 if(val!=0){
00563 if(subdet==HcalBarrel){
00564 if(ieta>0){ HBP[0]++;}else{ HBM[0]++;} badT++;
00565 if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHBP[0]++;}else{ newHBM[0]++;}}
00566 }
00567 if(subdet==HcalEndcap){
00568 if(ieta>0){ HEP[0]++;}else{ HEM[0]++;} badT++;
00569 if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHEP[0]++;}else{ newHEM[0]++;}}
00570 }
00571 if(subdet==HcalForward){
00572 if(ieta>0){ HFP[0]++;}else{ HFM[0]++;} badT++;
00573 if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHFP[0]++;}else{ newHFM[0]++;}}
00574 }
00575 if(subdet==HcalOuter){
00576 HO[0]++;badT++;
00577 if(badstatusmap.find(hcalid)==badstatusmap.end()){newHO[0]++;}
00578 }
00579 }
00580 val=BadEnergy_val[d]->GetBinContent(eta+1,phi+1);
00581 if(val!=0){
00582 if(subdet==HcalBarrel){
00583 if(ieta>0){ HBP[1]++;}else{ HBM[1]++;} badE++;
00584 if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHBP[1]++;}else{ newHBM[1]++;}}
00585 }
00586 if(subdet==HcalEndcap){
00587 if(ieta>0){ HEP[1]++;}else{ HEM[1]++;} badE++;
00588 if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHEP[1]++;}else{ newHEM[1]++;}}
00589 }
00590 if(subdet==HcalForward){
00591 if(ieta>0){ HFP[1]++;}else{ HFM[1]++;} badE++;
00592 if(badstatusmap.find(hcalid)==badstatusmap.end()){if(ieta>0){ newHFP[1]++;}else{ newHFM[1]++;}}
00593 }
00594 if(subdet==HcalOuter){
00595 HO[1]++;badT++;
00596 if(badstatusmap.find(hcalid)==badstatusmap.end()){newHO[1]++;}
00597 }
00598 }
00599 }
00600 }
00601
00602
00603 int cnt=0;
00604 if((HBP[0]+HBM[0])>0){
00605 badTiming << "<tr><td align=\"center\"><h3>"<< "HB" <<"</h3></td></tr>" << endl;
00606 for(int d=0;d<4;++d){
00607 int etabins=BadTiming_val[d]->GetNbinsX();
00608 int phibins=BadTiming_val[d]->GetNbinsY();
00609 for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00610 int ieta=CalcIeta(eta,d+1);
00611 if(ieta==-9999) continue;
00612 if(!isHB(eta,d+1)) continue;
00613 float val=BadTiming_val[d]->GetBinContent(eta+1,phi+1);
00614 if(val==0) continue;
00615 HcalDetId hcalid(HcalBarrel,ieta,phi+1,d+1);
00616 HcalFrontEndId lmap_entry=lmap.getHcalFrontEndId(hcalid);
00617 HcalElectronicsId emap_entry=emap.lookup(hcalid);
00618 sprintf(str,"Time-Ref=%.2f",val);
00619 printTableLine(badTiming,cnt++,hcalid,lmap_entry,emap_entry,str);
00620 }
00621 }
00622 }
00623 cnt=0;
00624 if((HEP[0]+HEM[0])>0){
00625 badTiming << "<tr><td align=\"center\"><h3>"<< "HE" <<"</h3></td></tr>" << endl;
00626 for(int d=0;d<4;++d){
00627 int etabins=BadTiming_val[d]->GetNbinsX();
00628 int phibins=BadTiming_val[d]->GetNbinsY();
00629 for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00630 int ieta=CalcIeta(eta,d+1);
00631 if(ieta==-9999) continue;
00632 if(!isHE(eta,d+1)) continue;
00633 float val=BadTiming_val[d]->GetBinContent(eta+1,phi+1);
00634 if(val==0) continue;
00635 HcalDetId hcalid(HcalEndcap,ieta,phi+1,d+1);
00636 HcalFrontEndId lmap_entry=lmap.getHcalFrontEndId(hcalid);
00637 HcalElectronicsId emap_entry=emap.lookup(hcalid);
00638 sprintf(str,"Time-Ref=%.2f",val);
00639 printTableLine(badTiming,cnt++,hcalid,lmap_entry,emap_entry,str);
00640 }
00641 }
00642 }
00643 cnt=0;
00644 if(HO[0]>0){
00645 badTiming << "<tr><td align=\"center\"><h3>"<< "HO" <<"</h3></td></tr>" << endl;
00646 for(int d=0;d<4;++d){
00647 int etabins=BadTiming_val[d]->GetNbinsX();
00648 int phibins=BadTiming_val[d]->GetNbinsY();
00649 for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00650 int ieta=CalcIeta(eta,d+1);
00651 if(ieta==-9999) continue;
00652 if(!isHO(eta,d+1)) continue;
00653 float val=BadTiming_val[d]->GetBinContent(eta+1,phi+1);
00654 if(val==0) continue;
00655 HcalDetId hcalid(HcalOuter,ieta,phi+1,d+1);
00656 HcalFrontEndId lmap_entry=lmap.getHcalFrontEndId(hcalid);
00657 HcalElectronicsId emap_entry=emap.lookup(hcalid);
00658 sprintf(str,"Time-Ref=%.2f",val);
00659 printTableLine(badTiming,cnt++,hcalid,lmap_entry,emap_entry,str);
00660 }
00661 }
00662 }
00663 cnt=0;
00664 if((HFP[0]+HFM[0])>0){
00665 badTiming << "<tr><td align=\"center\"><h3>"<< "HF" <<"</h3></td></tr>" << endl;
00666 for(int d=0;d<4;++d){
00667 int etabins=BadTiming_val[d]->GetNbinsX();
00668 int phibins=BadTiming_val[d]->GetNbinsY();
00669 for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00670 int ieta=CalcIeta(eta,d+1);
00671 if(ieta==-9999) continue;
00672 if(!isHF(eta,d+1)) continue;
00673 float val=BadTiming_val[d]->GetBinContent(eta+1,phi+1);
00674 if(val==0) continue;
00675 HcalDetId hcalid(HcalForward,ieta,phi+1,d+1);
00676 HcalFrontEndId lmap_entry=lmap.getHcalFrontEndId(hcalid);
00677 HcalElectronicsId emap_entry=emap.lookup(hcalid);
00678 sprintf(str,"Time-Ref=%.2f",val);
00679 printTableLine(badTiming,cnt++,hcalid,lmap_entry,emap_entry,str);
00680 }
00681 }
00682 }
00684 cnt=0;
00685 if((HBP[1]+HBM[1])>0){
00686 badEnergy << "<tr><td align=\"center\"><h3>"<< "HB" <<"</h3></td></tr>" << endl;
00687 for(int d=0;d<4;++d){
00688 int etabins=BadEnergy_val[d]->GetNbinsX();
00689 int phibins=BadEnergy_val[d]->GetNbinsY();
00690 for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00691 int ieta=CalcIeta(eta,d+1);
00692 if(ieta==-9999) continue;
00693 if(!isHB(eta,d+1)) continue;
00694 float val=BadEnergy_val[d]->GetBinContent(eta+1,phi+1);
00695 if(val==0) continue;
00696 HcalDetId hcalid(HcalBarrel,ieta,phi+1,d+1);
00697 HcalFrontEndId lmap_entry=lmap.getHcalFrontEndId(hcalid);
00698 HcalElectronicsId emap_entry=emap.lookup(hcalid);
00699 sprintf(str,"Energy/Ref=%.2f",val);
00700 printTableLine(badEnergy,cnt++,hcalid,lmap_entry,emap_entry,str);
00701 }
00702 }
00703 }
00704 cnt=0;
00705 if((HEP[1]+HEM[1])>0){
00706 badEnergy << "<tr><td align=\"center\"><h3>"<< "HE" <<"</h3></td></tr>" << endl;
00707 for(int d=0;d<4;++d){
00708 int etabins=BadEnergy_val[d]->GetNbinsX();
00709 int phibins=BadEnergy_val[d]->GetNbinsY();
00710 for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00711 int ieta=CalcIeta(eta,d+1);
00712 if(ieta==-9999) continue;
00713 if(!isHE(eta,d+1)) continue;
00714 float val=BadEnergy_val[d]->GetBinContent(eta+1,phi+1);
00715 if(val==0) continue;
00716 HcalDetId hcalid(HcalEndcap,ieta,phi+1,d+1);
00717 HcalFrontEndId lmap_entry=lmap.getHcalFrontEndId(hcalid);
00718 HcalElectronicsId emap_entry=emap.lookup(hcalid);
00719 sprintf(str,"Energy/Ref=%.2f",val);
00720 printTableLine(badEnergy,cnt++,hcalid,lmap_entry,emap_entry,str);
00721 }
00722 }
00723 }
00724 cnt=0;
00725 if(HO[1]>0){
00726 badEnergy << "<tr><td align=\"center\"><h3>"<< "HO" <<"</h3></td></tr>" << endl;
00727 for(int d=0;d<4;++d){
00728 int etabins=BadEnergy_val[d]->GetNbinsX();
00729 int phibins=BadEnergy_val[d]->GetNbinsY();
00730 for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00731 int ieta=CalcIeta(eta,d+1);
00732 if(ieta==-9999) continue;
00733 if(!isHO(eta,d+1)) continue;
00734 float val=BadEnergy_val[d]->GetBinContent(eta+1,phi+1);
00735 if(val==0) continue;
00736 HcalDetId hcalid(HcalOuter,ieta,phi+1,d+1);
00737 HcalFrontEndId lmap_entry=lmap.getHcalFrontEndId(hcalid);
00738 HcalElectronicsId emap_entry=emap.lookup(hcalid);
00739 sprintf(str,"Energy/Ref=%.2f",val);
00740 printTableLine(badEnergy,cnt++,hcalid,lmap_entry,emap_entry,str);
00741 }
00742 }
00743 }
00744 cnt=0;
00745 if((HFP[1]+HFM[1])>0){
00746 badEnergy << "<tr><td align=\"center\"><h3>"<< "HF" <<"</h3></td></tr>" << endl;
00747 for(int d=0;d<4;++d){
00748 int etabins=BadEnergy_val[d]->GetNbinsX();
00749 int phibins=BadEnergy_val[d]->GetNbinsY();
00750 for(int phi=0;phi<phibins;++phi)for(int eta=0;eta<etabins;++eta){
00751 int ieta=CalcIeta(eta,d+1);
00752 if(ieta==-9999) continue;
00753 if(!isHF(eta,d+1)) continue;
00754 float val=BadEnergy_val[d]->GetBinContent(eta+1,phi+1);
00755 if(val==0) continue;
00756 HcalDetId hcalid(HcalForward,ieta,phi+1,d+1);
00757 HcalFrontEndId lmap_entry=lmap.getHcalFrontEndId(hcalid);
00758 HcalElectronicsId emap_entry=emap.lookup(hcalid);
00759 sprintf(str,"Energy/Ref=%.2f",val);
00760 printTableLine(badEnergy,cnt++,hcalid,lmap_entry,emap_entry,str);
00761 }
00762 }
00763 }
00764
00765 printTableTail(badTiming);
00766 badTiming.close();
00767 printTableTail(badEnergy);
00768 badEnergy.close();
00769
00771 ofstream htmlFile;
00772 string outfile=htmlDir+name_+".html";
00773 htmlFile.open(outfile.c_str());
00775 gROOT->SetBatch(true);
00776 gStyle->SetCanvasColor(0);
00777 gStyle->SetPadColor(0);
00778 gStyle->SetOptStat(111110);
00779 gStyle->SetPalette(1);
00780 TCanvas *can=new TCanvas("HcalDetDiagLaserClient","HcalDetDiagLaserClient",0,0,500,350);
00781 can->cd();
00782
00783 if(Raddam[0]->GetEntries()>0){
00784 ofstream RADDAM;
00785 RADDAM.open((htmlDir + "RADDAM_"+name_).c_str());
00786 RADDAM << "</html><html xmlns=\"http://www.w3.org/1999/xhtml\">"<< endl;
00787 RADDAM << "<head>"<< endl;
00788 RADDAM << "<meta http-equiv=\"Content-Type\" content=\"text/html\"/>"<< endl;
00789 RADDAM << "<title>"<< "RADDAM channels" <<"</title>"<< endl;
00790 RADDAM << "<style type=\"text/css\">"<< endl;
00791 RADDAM << " body,td{ background-color: #FFFFCC; font-family: arial, arial ce, helvetica; font-size: 12px; }"<< endl;
00792 RADDAM << " td.s0 { font-family: arial, arial ce, helvetica; }"<< endl;
00793 RADDAM << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< endl;
00794 RADDAM << " td.s2 { font-family: arial, arial ce, helvetica; background-color: #eeeeee; }"<< endl;
00795 RADDAM << " td.s3 { font-family: arial, arial ce, helvetica; background-color: #d0d0d0; }"<< endl;
00796 RADDAM << " td.s4 { font-family: arial, arial ce, helvetica; background-color: #FFC169; }"<< endl;
00797 RADDAM << "</style>"<< endl;
00798 RADDAM << "<body>"<< endl;
00799 RADDAM << "<h2>Run "<< runNo<<": RADDAM channels event shape </h2>" << endl;
00800 RADDAM << "<table>"<< endl;
00801
00802 char str[100];
00803 for(int i=0;i<28;i++){
00804 RADDAM << "<tr align=\"left\">" << endl;
00805
00806
00807 Raddam[2*i]->Draw(); sprintf(str,"%02d",2*i); can->SaveAs((htmlDir + "raddam_ch"+str+".gif").c_str());
00808 Raddam[2*i+1]->Draw(); sprintf(str,"%02d",2*i+1); can->SaveAs((htmlDir + "raddam_ch"+str+".gif").c_str());
00809 sprintf(str,"raddam_ch%02d.gif",2*i);
00810 RADDAM << "<td align=\"center\"><img src=\""<<str<<"\" alt=\"raddam channel\"> </td>" << endl;
00811 sprintf(str,"raddam_ch%02d.gif",2*i+1);
00812 RADDAM << "<td align=\"center\"><img src=\""<<str<<"\" alt=\"raddam channel\"> </td>" << endl;
00813 RADDAM << "</tr>" << endl;
00814 }
00815
00816 RADDAM << "</table>"<< endl;
00817 RADDAM << "</body>"<< endl;
00818 RADDAM << "</html>"<< endl;
00819 RADDAM.close();
00820 }
00821
00822 Time2Dhbhehf->SetXTitle("i#eta");
00823 Time2Dhbhehf->SetYTitle("i#phi");
00824 Time2Dho->SetXTitle("i#eta");
00825 Time2Dho->SetYTitle("i#phi");
00826 Energy2Dhbhehf->SetXTitle("i#eta");
00827 Energy2Dhbhehf->SetYTitle("i#phi");
00828 Energy2Dho->SetXTitle("i#eta");
00829 Energy2Dho->SetYTitle("i#phi");
00830 refTime2Dhbhehf->SetXTitle("i#eta");
00831 refTime2Dhbhehf->SetYTitle("i#phi");
00832 refTime2Dho->SetXTitle("i#eta");
00833 refTime2Dho->SetYTitle("i#phi");
00834 refEnergy2Dhbhehf->SetXTitle("i#eta");
00835 refEnergy2Dhbhehf->SetYTitle("i#phi");
00836 refEnergy2Dho->SetXTitle("i#eta");
00837 refEnergy2Dho->SetYTitle("i#phi");
00838 refTime2Dhbhehf->SetMinimum(0);
00839 refTime2Dhbhehf->SetMaximum(2);
00840 refTime2Dho->SetMinimum(0);
00841 refTime2Dho->SetMaximum(2);
00842 refEnergy2Dhbhehf->SetMinimum(0.5);
00843 refEnergy2Dhbhehf->SetMaximum(1.5);
00844 refEnergy2Dho->SetMinimum(0.5);
00845 refEnergy2Dho->SetMaximum(1.5);
00846
00847 Time2Dhbhehf->SetNdivisions(36,"Y");
00848 Time2Dho->SetNdivisions(36,"Y");
00849 Energy2Dhbhehf->SetNdivisions(36,"Y");
00850 Energy2Dho->SetNdivisions(36,"Y");
00851 refTime2Dhbhehf->SetNdivisions(36,"Y");
00852 refTime2Dho->SetNdivisions(36,"Y");
00853 refEnergy2Dhbhehf->SetNdivisions(36,"Y");
00854 refEnergy2Dho->SetNdivisions(36,"Y");
00855
00856
00857 htmlFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> " << endl;
00858 htmlFile << "<html> " << endl;
00859 htmlFile << "<head> " << endl;
00860 htmlFile << " <meta content=\"text/html; charset=ISO-8859-1\" " << endl;
00861 htmlFile << " http-equiv=\"content-type\"> " << endl;
00862 htmlFile << " <title>Detector Diagnostics Laser Monitor</title> " << endl;
00863 htmlFile << "</head> " << endl;
00864 htmlFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << endl;
00865
00866 htmlFile << "<style type=\"text/css\">"<< endl;
00867 htmlFile << " td.s0 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FF7700; text-align: center;}"<< endl;
00868 htmlFile << " td.s1 { font-family: arial, arial ce, helvetica; font-weight: bold; background-color: #FFC169; text-align: center;}"<< endl;
00869 htmlFile << " td.s2 { font-family: arial, arial ce, helvetica; background-color: red; }"<< endl;
00870 htmlFile << " td.s3 { font-family: arial, arial ce, helvetica; background-color: yellow; }"<< endl;
00871 htmlFile << " td.s4 { font-family: arial, arial ce, helvetica; background-color: green; }"<< endl;
00872 htmlFile << " td.s5 { font-family: arial, arial ce, helvetica; background-color: silver; }"<< endl;
00873 std::string state[4]={"<td class=\"s2\" align=\"center\">",
00874 "<td class=\"s3\" align=\"center\">",
00875 "<td class=\"s4\" align=\"center\">",
00876 "<td class=\"s5\" align=\"center\">"};
00877 htmlFile << "</style>"<< endl;
00878
00879 htmlFile << "<body> " << endl;
00880 htmlFile << "<br> " << endl;
00881 htmlFile << "<h2>Run: " << endl;
00882 htmlFile << " <span " << endl;
00883 htmlFile << " style=\"color: rgb(0, 0, 153);\">" << runNo << "</span></h2>" << endl;
00884 htmlFile << "<h2>Monitoring task: <span " << endl;
00885 htmlFile << " style=\"color: rgb(0, 0, 153);\">Detector Diagnostics Laser Monitor</span></h2> " << endl;
00886 htmlFile << "<h2>Events processed: <span " << endl;
00887 htmlFile << " style=\"color: rgb(0, 0, 153);\">" << ievt_ << "</span></h2>" << endl;
00888 htmlFile << "<hr>" << endl;
00889
00890 htmlFile << "<table width=100% border=1>" << endl;
00891 htmlFile << "<tr>" << endl;
00892 htmlFile << "<td class=\"s0\" width=20% align=\"center\">SebDet</td>" << endl;
00893 htmlFile << "<td class=\"s0\" width=20% align=\"center\">Bad Timing</td>" << endl;
00894 htmlFile << "<td class=\"s0\" width=20% align=\"center\">Bad Energy</td>" << endl;
00895 htmlFile << "</tr><tr>" << endl;
00896 int ind1=0,ind2=0;
00897 htmlFile << "<td class=\"s1\" align=\"center\">HB+</td>" << endl;
00898 if(HBP[0]==0) ind1=2; if(HBP[0]>0 && HBP[0]<=12) ind1=1; if(HBP[0]>12) ind1=0;
00899 if(HBP[1]==0) ind2=2; if(HBP[1]>0 && HBP[1]<=12) ind2=1; if(HBP[1]>12) ind2=0;
00900 if(!HBpresent_) ind1=ind2=3;
00901 htmlFile << state[ind1] << HBP[0] <<"</td>" << endl;
00902 htmlFile << state[ind2] << HBP[1] <<"</td>" << endl;
00903 htmlFile << "</tr><tr>" << endl;
00904 htmlFile << "<td class=\"s1\" align=\"center\">HB-</td>" << endl;
00905 if(HBM[0]==0) ind1=2; if(HBM[0]>0 && HBP[0]<=12) ind1=1; if(HBM[0]>12) ind1=0;
00906 if(HBM[1]==0) ind2=2; if(HBM[1]>0 && HBP[1]<=12) ind2=1; if(HBM[1]>12) ind2=0;
00907 if(!HBpresent_) ind1=ind2=3;
00908 htmlFile << state[ind1] << HBM[0] <<"</td>" << endl;
00909 htmlFile << state[ind2] << HBM[1] <<"</td>" << endl;
00910 htmlFile << "</tr><tr>" << endl;
00911 htmlFile << "<td class=\"s1\" align=\"center\">HE+</td>" << endl;
00912 if(HEP[0]==0) ind1=2; if(HEP[0]>0 && HEP[0]<=12) ind1=1; if(HEP[0]>12) ind1=0;
00913 if(HEP[1]==0) ind2=2; if(HEP[1]>0 && HEP[1]<=12) ind2=1; if(HEP[1]>12) ind2=0;
00914 if(!HEpresent_) ind1=ind2=3;
00915 if(ind1==0 || ind2==0) status|=2; else if(ind1==1 || ind2==1) status|=1;
00916 htmlFile << state[ind1] << HEP[0] <<"</td>" << endl;
00917 htmlFile << state[ind2] << HEP[1] <<"</td>" << endl;
00918 htmlFile << "</tr><tr>" << endl;
00919 htmlFile << "<td class=\"s1\" align=\"center\">HE-</td>" << endl;
00920 if(HEM[0]==0) ind1=2; if(HEM[0]>0 && HEM[0]<=12) ind1=1; if(HEM[0]>12) ind1=0;
00921 if(HEM[1]==0) ind2=2; if(HEM[1]>0 && HEM[1]<=12) ind2=1; if(HEM[1]>12) ind2=0;
00922 if(!HEpresent_) ind1=ind2=3;
00923 if(ind1==0 || ind2==0) status|=2; else if(ind1==1 || ind2==1) status|=1;
00924 htmlFile << state[ind1] << HEM[0] <<"</td>" << endl;
00925 htmlFile << state[ind2] << HEM[1] <<"</td>" << endl;
00926 htmlFile << "</tr><tr>" << endl;
00927 htmlFile << "<td class=\"s1\" align=\"center\">HF+</td>" << endl;
00928 if(HFP[0]==0) ind1=2; if(HFP[0]>0 && HFP[0]<=12) ind1=1; if(HFP[0]>12) ind1=0;
00929 if(HFP[1]==0) ind2=2; if(HFP[1]>0 && HFP[1]<=12) ind2=1; if(HFP[1]>12) ind2=0;
00930 if(!HOpresent_) ind1=ind2=3;
00931 if(ind1==0 || ind2==0) status|=2; else if(ind1==1 || ind2==1) status|=1;
00932 htmlFile << state[ind1] << HFP[0] <<"</td>" << endl;
00933 htmlFile << state[ind2] << HFP[1] <<"</td>" << endl;
00934 htmlFile << "</tr><tr>" << endl;
00935 htmlFile << "<td class=\"s1\" align=\"center\">HF-</td>" << endl;
00936 if(HFM[0]==0) ind1=2; if(HFM[0]>0 && HFM[0]<=12) ind1=1; if(HFM[0]>12) ind1=0;
00937 if(HFM[1]==0) ind2=2; if(HFM[1]>0 && HFM[1]<=12) ind2=1; if(HFM[1]>12) ind2=0;
00938 if(!HFpresent_) ind1=ind2=3;
00939 if(ind1==0 || ind2==0) status|=2; else if(ind1==1 || ind2==1) status|=1;
00940 htmlFile << state[ind1] << HFM[0] <<"</td>" << endl;
00941 htmlFile << state[ind2] << HFM[1] <<"</td>" << endl;
00942 htmlFile << "</tr><tr>" << endl;
00943 htmlFile << "<td class=\"s1\" align=\"center\">HO</td>" << endl;
00944 if(HO[0]==0) ind1=2; if(HO[0]>0 && HO[0]<=12) ind1=1; if(HO[0]>12) ind1=0;
00945 if(HO[1]==0) ind2=2; if(HO[1]>0 && HO[1]<=12) ind2=1; if(HO[1]>12) ind2=0;
00946 if(!HFpresent_) ind1=ind2=3;
00947 if(ind1==0 || ind2==0) status|=2; else if(ind1==1 || ind2==1) status|=1;
00948 htmlFile << state[ind1] << HO[0] <<"</td>" << endl;
00949 htmlFile << state[ind2] << HO[1] <<"</td>" << endl;
00950
00951 htmlFile << "</tr></table>" << endl;
00952 htmlFile << "<hr>" << endl;
00953
00954 if((badT+badE)>0){
00955 htmlFile << "<table width=100% border=1><tr>" << endl;
00956 if(badT>0) htmlFile << "<td><a href=\"" << "bad_timing_table.html" <<"\">list of bad timing channels</a></td>";
00957 if(badE>0) htmlFile << "<td><a href=\"" << "bad_energy_table.html" <<"\">list of bad energy channels</a></td>";
00958 htmlFile << "</tr></table>" << endl;
00959 }
00960
00962
00963 if(Raddam[0]->GetEntries()>0){
00964 htmlFile << "<h2 align=\"center\"><a href=\"" << ("RADDAM_"+name_).c_str() <<"\">RADDAM channels</a><h2>";
00965 htmlFile << "<hr>" << endl;
00966 }
00967
00968 htmlFile << "<h2 align=\"center\">Stability Laser plots (Reference run "<<ref_run<<")</h2>" << endl;
00969 htmlFile << "<table width=100% border=0><tr>" << endl;
00970
00971 can->SetGridy();
00972 can->SetGridx();
00973
00974 htmlFile << "<tr align=\"left\">" << endl;
00975 refTime2Dhbhehf->SetStats(0);
00976 refTime2Dho->SetStats(0);
00977 refTime2Dhbhehf->Draw("COLZ"); can->SaveAs((htmlDir + "ref_laser_timing_hbhehf.gif").c_str());
00978 refTime2Dho->Draw("COLZ"); can->SaveAs((htmlDir + "ref_laser_timing_ho.gif").c_str());
00979 htmlFile << "<td align=\"center\"><img src=\"ref_laser_timing_hbhehf.gif\" alt=\"ref laser timing distribution\"> </td>" << endl;
00980 htmlFile << "<td align=\"center\"><img src=\"ref_laser_timing_ho.gif\" alt=\"ref laser timing distribution\"> </td>" << endl;
00981 htmlFile << "</tr>" << endl;
00982
00983
00984 if(hb!=0 && he!=0 && ho!=0 && hf!=0){
00985 hb->SetMarkerStyle(22);
00986 hb->SetMarkerColor(kRed);
00987 hb->GetYaxis()->SetRangeUser(hb->GetMinimum()-1,hb->GetMaximum()+1);
00988 hb->GetXaxis()->SetNdivisions(520);
00989
00990 he->SetMarkerStyle(22);
00991 he->SetMarkerColor(kRed);
00992 he->GetYaxis()->SetRangeUser(he->GetMinimum()-1,he->GetMaximum()+1);
00993 he->GetXaxis()->SetNdivisions(520);
00994
00995 ho->SetMarkerStyle(22);
00996 ho->SetMarkerColor(kRed);
00997 ho->GetYaxis()->SetRangeUser(ho->GetMinimum()-1,ho->GetMaximum()+1);
00998 ho->GetXaxis()->SetNdivisions(520);
00999
01000 hf->SetMarkerStyle(22);
01001 hf->SetMarkerColor(kRed);
01002 hf->GetYaxis()->SetRangeUser(hf->GetMinimum()-1,hf->GetMaximum()+1);
01003 hf->GetXaxis()->SetNdivisions(520);
01004 hb->SetStats(0);
01005 he->SetStats(0);
01006 ho->SetStats(0);
01007 hf->SetStats(0);
01008
01009
01010 hb->GetXaxis()->SetBit(TAxis::kLabelsVert);
01011 he->GetXaxis()->SetBit(TAxis::kLabelsVert);
01012 ho->GetXaxis()->SetBit(TAxis::kLabelsVert);
01013 hf->GetXaxis()->SetBit(TAxis::kLabelsVert);
01014 hb->GetXaxis()->SetLabelSize(0.05);
01015 he->GetXaxis()->SetLabelSize(0.05);
01016 ho->GetXaxis()->SetLabelSize(0.05);
01017 hf->GetXaxis()->SetLabelSize(0.05);
01018
01019
01020 htmlFile << "<tr align=\"left\">" << endl;
01021 htmlFile << "<td align=\"center\"><img src=\"hb_rbx_timing1D.gif\" alt=\"rbx timing\"> </td>" << endl;
01022 htmlFile << "<td align=\"center\"><img src=\"he_rbx_timing1D.gif\" alt=\"rbx timing\"> </td>" << endl;
01023 htmlFile << "</tr>" << endl;
01024 htmlFile << "<tr align=\"left\">" << endl;
01025 htmlFile << "<td align=\"center\"><img src=\"ho_rbx_timing1D.gif\" alt=\"rbx timing\"> </td>" << endl;
01026 htmlFile << "<td align=\"center\"><img src=\"hf_rbx_timing1D.gif\" alt=\"rbx timing\"> </td>" << endl;
01027 htmlFile << "</tr>" << endl;
01028 }else printf("Error\n");
01029
01030
01031
01032 htmlFile << "<tr align=\"left\">" << endl;
01033 refEnergy2Dhbhehf->SetStats(0);
01034 refEnergy2Dho->SetStats(0);
01035 refEnergy2Dhbhehf->Draw("COLZ"); can->SaveAs((htmlDir + "ref_laser_energy_hbhehf.gif").c_str());
01036 refEnergy2Dho->Draw("COLZ"); can->SaveAs((htmlDir + "ref_laser_energy_ho.gif").c_str());
01037 htmlFile << "<td align=\"center\"><img src=\"ref_laser_energy_hbhehf.gif\" alt=\"ref laser energy distribution\"> </td>" << endl;
01038 htmlFile << "<td align=\"center\"><img src=\"ref_laser_energy_ho.gif\" alt=\"ref laser energy distribution\"> </td>" << endl;
01039 htmlFile << "</tr>" << endl;
01040
01041 htmlFile << "</table>" << endl;
01042
01043
01044 htmlFile << "<h2 align=\"center\">Summary Laser plots</h2>" << endl;
01045 htmlFile << "<table width=100% border=0><tr>" << endl;
01046 htmlFile << "<tr align=\"left\">" << endl;
01047 Time2Dhbhehf->SetStats(0);
01048 Time2Dho->SetStats(0);
01049 Time2Dhbhehf->Draw("COLZ"); can->SaveAs((htmlDir + "laser_timing_hbhehf.gif").c_str());
01050 Time2Dho->Draw("COLZ"); can->SaveAs((htmlDir + "laser_timing_ho.gif").c_str());
01051 htmlFile << "<td align=\"center\"><img src=\"laser_timing_hbhehf.gif\" alt=\"laser timing distribution\"> </td>" << endl;
01052 htmlFile << "<td align=\"center\"><img src=\"laser_timing_ho.gif\" alt=\"laser timing distribution\"> </td>" << endl;
01053 htmlFile << "</tr>" << endl;
01054
01055 htmlFile << "<tr align=\"left\">" << endl;
01056 Energy2Dhbhehf->SetStats(0);
01057 Energy2Dho->SetStats(0);
01058 Energy2Dhbhehf->Draw("COLZ"); can->SaveAs((htmlDir + "laser_energy_hbhehf.gif").c_str());
01059 Energy2Dho->Draw("COLZ"); can->SaveAs((htmlDir + "laser_energy_ho.gif").c_str());
01060 htmlFile << "<td align=\"center\"><img src=\"laser_energy_hbhehf.gif\" alt=\"laser energy distribution\"> </td>" << endl;
01061 htmlFile << "<td align=\"center\"><img src=\"laser_energy_ho.gif\" alt=\"laser energy distribution\"> </td>" << endl;
01062 htmlFile << "</tr>" << endl;
01063
01064
01065 htmlFile << "<tr align=\"left\">" << endl;
01066 hbheEnergy->Draw(); can->SaveAs((htmlDir + "hbhe_laser_energy_distribution.gif").c_str());
01067 hbheEnergyRMS->Draw(); can->SaveAs((htmlDir + "hbhe_laser_energy_rms_distribution.gif").c_str());
01068 htmlFile << "<td align=\"center\"><img src=\"hbhe_laser_energy_distribution.gif\" alt=\"hbhe laser energy distribution\"> </td>" << endl;
01069 htmlFile << "<td align=\"center\"><img src=\"hbhe_laser_energy_rms_distribution.gif\" alt=\"hbhelaser energy rms distribution\"> </td>" << endl;
01070 htmlFile << "</tr>" << endl;
01071 htmlFile << "<tr align=\"left\">" << endl;
01072 hbheTiming->Draw(); can->SaveAs((htmlDir + "hbhe_laser_timing_distribution.gif").c_str());
01073 hbheTimingRMS->Draw(); can->SaveAs((htmlDir + "hbhe_laser_timing_rms_distribution.gif").c_str());
01074 htmlFile << "<td align=\"center\"><img src=\"hbhe_laser_timing_distribution.gif\" alt=\"hbhe laser timing distribution\"> </td>" << endl;
01075 htmlFile << "<td align=\"center\"><img src=\"hbhe_laser_timing_rms_distribution.gif\" alt=\"hbhe laser timing rms distribution\"> </td>" << endl;
01076 htmlFile << "</tr>" << endl;
01077
01078 htmlFile << "<tr align=\"left\">" << endl;
01079 hoEnergy->Draw(); can->SaveAs((htmlDir + "ho_laser_energy_distribution.gif").c_str());
01080 hoEnergyRMS->Draw(); can->SaveAs((htmlDir + "ho_laser_energy_rms_distribution.gif").c_str());
01081 htmlFile << "<td align=\"center\"><img src=\"ho_laser_energy_distribution.gif\" alt=\"ho laser energy distribution\"> </td>" << endl;
01082 htmlFile << "<td align=\"center\"><img src=\"ho_laser_energy_rms_distribution.gif\" alt=\"ho laser energy rms distribution\"> </td>" << endl;
01083 htmlFile << "</tr>" << endl;
01084 htmlFile << "<tr align=\"left\">" << endl;
01085 hoTiming->Draw(); can->SaveAs((htmlDir + "ho_laser_timing_distribution.gif").c_str());
01086 hoTimingRMS->Draw(); can->SaveAs((htmlDir + "ho_laser_timing_rms_distribution.gif").c_str());
01087 htmlFile << "<td align=\"center\"><img src=\"ho_laser_timing_distribution.gif\" alt=\"ho laser timing distribution\"> </td>" << endl;
01088 htmlFile << "<td align=\"center\"><img src=\"ho_laser_timing_rms_distribution.gif\" alt=\"ho laser timing rms distribution\"> </td>" << endl;
01089
01090 htmlFile << "</tr>" << endl;
01091 htmlFile << "<tr align=\"left\">" << endl;
01092 hfEnergy->Draw(); can->SaveAs((htmlDir + "hf_laser_energy_distribution.gif").c_str());
01093 hfEnergyRMS->Draw(); can->SaveAs((htmlDir + "hf_laser_energy_rms_distribution.gif").c_str());
01094 htmlFile << "<td align=\"center\"><img src=\"hf_laser_energy_distribution.gif\" alt=\"hf laser energy distribution\"> </td>" << endl;
01095 htmlFile << "<td align=\"center\"><img src=\"hf_laser_energy_rms_distribution.gif\" alt=\"hf laser energy rms distribution\"> </td>" << endl;
01096 htmlFile << "</tr>" << endl;
01097 htmlFile << "<tr align=\"left\">" << endl;
01098 hfTiming->Draw(); can->SaveAs((htmlDir + "hf_laser_timing_distribution.gif").c_str());
01099 hfTimingRMS->Draw(); can->SaveAs((htmlDir + "hf_laser_timing_rms_distribution.gif").c_str());
01100 htmlFile << "<td align=\"center\"><img src=\"hf_laser_timing_distribution.gif\" alt=\"hf laser timing distribution\"> </td>" << endl;
01101 htmlFile << "<td align=\"center\"><img src=\"hf_laser_timing_rms_distribution.gif\" alt=\"hf laser timing rms distribution\"> </td>" << endl;
01102 htmlFile << "</tr>" << endl;
01103
01104 can->SetBottomMargin(0.2);
01105 if(hb->GetEntries()>0)hb->Draw("P");else hb->Draw(); can->SaveAs((htmlDir + "hb_rbx_timing1D.gif").c_str());
01106 if(he->GetEntries()>0)he->Draw("P");else he->Draw(); can->SaveAs((htmlDir + "he_rbx_timing1D.gif").c_str());
01107 if(ho->GetEntries()>0)ho->Draw("P");else ho->Draw(); can->SaveAs((htmlDir + "ho_rbx_timing1D.gif").c_str());
01108 if(hf->GetEntries()>0)hf->Draw("P");else hf->Draw(); can->SaveAs((htmlDir + "hf_rbx_timing1D.gif").c_str());
01109
01110 htmlFile << "</table>" << endl;
01111
01112 htmlFile << "</body> " << endl;
01113 htmlFile << "</html> " << endl;
01114 can->Close();
01116 htmlFile.close();
01117 return;
01118 }
01119