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