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