00001 #include <DQM/HcalMonitorClient/interface/HcalHotCellClient.h>
00002 #include <DQM/HcalMonitorClient/interface/HcalClientUtils.h>
00003 #include "DQMServices/Core/interface/DQMStore.h"
00004 #include "DQMServices/Core/interface/MonitorElement.h"
00005 #include <math.h>
00006 #include <iostream>
00007
00008 HcalHotCellClient::HcalHotCellClient(){}
00009
00010 void HcalHotCellClient::init(const ParameterSet& ps, DQMStore* dbe,string clientName){
00011
00012 HcalBaseClient::init(ps,dbe,clientName);
00013 if (showTiming_)
00014 {
00015 cpu_timer.reset(); cpu_timer.start();
00016 }
00017
00018
00019
00020 hotclient_test_persistent_ = ps.getUntrackedParameter<bool>("HotCellClient_test_persistent",true);
00021 hotclient_test_pedestal_ = ps.getUntrackedParameter<bool>("HotCellClient_test_pedestal",true);
00022 hotclient_test_neighbor_ = ps.getUntrackedParameter<bool>("HotCellClient_test_neighbor",true);
00023 hotclient_test_energy_ = ps.getUntrackedParameter<bool>("HotCellClient_test_energy",true);
00024
00025 hotclient_checkNevents_ = ps.getUntrackedParameter<int>("HotCellClient_checkNevents",100);
00026 hotclient_checkNevents_persistent_ = ps.getUntrackedParameter<int>("HotCellClient_checkNevents_persistent",hotclient_checkNevents_);
00027 hotclient_checkNevents_pedestal_ = ps.getUntrackedParameter<int>("HotCellClient_checkNevents_pedestal" ,hotclient_checkNevents_);
00028 hotclient_checkNevents_neighbor_ = ps.getUntrackedParameter<int>("HotCellClient_checkNevents_neighbor" ,hotclient_checkNevents_);
00029 hotclient_checkNevents_energy_ = ps.getUntrackedParameter<int>("HotCellClient_checkNevents_energy" ,hotclient_checkNevents_);
00030
00031 minErrorFlag_ = ps.getUntrackedParameter<double>("HotCellClient_minErrorFlag",0.0);
00032
00033 hotclient_makeDiagnostics_ = ps.getUntrackedParameter<bool>("HotCellClient_makeDiagnosticPlots",false);
00034
00035
00036 ProblemHotCells=0;
00037 for (int i=0;i<6;++i)
00038 {
00039
00040 ProblemHotCellsByDepth[i] =0;
00041 AbovePersistentThresholdCellsByDepth[i] =0;
00042 AbovePedestalHotCellsByDepth[i] =0;
00043 AboveNeighborsHotCellsByDepth[i] =0;
00044 AboveEnergyThresholdCellsByDepth[i] =0;
00045 d_avgrechitenergymap[i] =0;
00046 }
00047
00048 if (hotclient_makeDiagnostics_)
00049 {
00050 d_HBnormped=0;
00051 d_HBrechitenergy=0;
00052 d_HBenergyVsNeighbor=0;
00053 d_HEnormped=0;
00054 d_HErechitenergy=0;
00055 d_HEenergyVsNeighbor=0;
00056 d_HOnormped=0;
00057 d_HOrechitenergy=0;
00058 d_HOenergyVsNeighbor=0;
00059 d_HFnormped=0;
00060 d_HFrechitenergy=0;
00061 d_HFenergyVsNeighbor=0;
00062 d_ZDCnormped=0;
00063 d_ZDCrechitenergy=0;
00064 d_ZDCenergyVsNeighbor=0;
00065 }
00066
00067 subdets_.push_back("HB HF Depth 1 ");
00068 subdets_.push_back("HB HF Depth 2 ");
00069 subdets_.push_back("HE Depth 3 ");
00070 subdets_.push_back("HO ZDC ");
00071 subdets_.push_back("HE Depth 1 ");
00072 subdets_.push_back("HE Depth 2 ");
00073
00074 if (showTiming_)
00075 {
00076 cpu_timer.stop(); cout <<"TIMER:: HcalHotCellClient INIT -> "<<cpu_timer.cpuTime()<<endl;
00077 }
00078
00079 return;
00080 }
00081
00082
00083 HcalHotCellClient::~HcalHotCellClient()
00084 {
00085 this->cleanup();
00086 }
00087
00088
00089 void HcalHotCellClient::beginJob(const EventSetup& eventSetup)
00090 {
00091 if (showTiming_)
00092 {
00093 cpu_timer.reset(); cpu_timer.start();
00094 }
00095
00096 if ( debug_>1 ) cout << "HcalHotCellClient: beginJob" << endl;
00097
00098 ievt_ = 0;
00099 jevt_ = 0;
00100 this->setup();
00101 if (showTiming_)
00102 {
00103 cpu_timer.stop(); cout <<"TIMER:: HcalHotCellClient BEGINJOB -> "<<cpu_timer.cpuTime()<<endl;
00104 }
00105
00106 return;
00107 }
00108
00109
00110 void HcalHotCellClient::beginRun(void)
00111 {
00112 if ( debug_>1 ) cout << "HcalHotCellClient: beginRun" << endl;
00113
00114 jevt_ = 0;
00115 this->setup();
00116 this->resetAllME();
00117 if (showTiming_)
00118 {
00119 cpu_timer.stop(); cout <<"TIMER:: HcalHotCellClient BEGINRUN -> "<<cpu_timer.cpuTime()<<endl;
00120 }
00121
00122 return;
00123 }
00124
00125
00126 void HcalHotCellClient::endJob(void)
00127 {
00128 if (showTiming_)
00129 {
00130 cpu_timer.reset(); cpu_timer.start();
00131 }
00132
00133 if ( debug_>1 ) cout << "HcalHotCellClient: endJob, ievt = " << ievt_ << endl;
00134
00135 this->cleanup();
00136 if (showTiming_)
00137 {
00138 cpu_timer.stop(); cout <<"TIMER:: HcalHotCellClient ENDJOB -> "<<cpu_timer.cpuTime()<<endl;
00139 }
00140
00141 return;
00142 }
00143
00144
00145 void HcalHotCellClient::endRun(void)
00146 {
00147 if (showTiming_)
00148 {
00149 cpu_timer.reset(); cpu_timer.start();
00150 }
00151
00152 if ( debug_>1 ) cout << "HcalHotCellClient: endRun, jevt = " << jevt_ << endl;
00153
00154 this->cleanup();
00155 if (showTiming_)
00156 {
00157 cpu_timer.stop(); cout <<"TIMER:: HcalHotCellClient ENDRUN -> "<<cpu_timer.cpuTime()<<endl;
00158 }
00159
00160 return;
00161 }
00162
00163
00164 void HcalHotCellClient::setup(void)
00165 {
00166 return;
00167 }
00168
00169
00170 void HcalHotCellClient::cleanup(void)
00171 {
00172 if (showTiming_)
00173 {
00174 cpu_timer.reset(); cpu_timer.start();
00175 }
00176
00177 if(cloneME_)
00178 {
00179
00180 if (ProblemHotCells) delete ProblemHotCells;
00181
00182 for (int i=0;i<6;++i)
00183 {
00184
00185 if (ProblemHotCellsByDepth[i]) delete ProblemHotCellsByDepth[i];
00186
00187 if (AbovePersistentThresholdCellsByDepth[i]) delete AbovePersistentThresholdCellsByDepth[i];
00188 if (AbovePedestalHotCellsByDepth[i]) delete AbovePedestalHotCellsByDepth[i];
00189 if (AboveNeighborsHotCellsByDepth[i]) delete AboveNeighborsHotCellsByDepth[i];
00190 if (AboveEnergyThresholdCellsByDepth[i]) delete AboveEnergyThresholdCellsByDepth[i];
00191 if (d_avgrechitenergymap[i]) delete d_avgrechitenergymap[i];
00192 }
00193
00194 if (hotclient_makeDiagnostics_)
00195 {
00196 if (d_HBnormped) delete d_HBnormped;
00197 if (d_HBrechitenergy) delete d_HBrechitenergy;
00198 if (d_HBenergyVsNeighbor) delete d_HBenergyVsNeighbor;
00199 if (d_HEnormped) delete d_HEnormped;
00200 if (d_HErechitenergy) delete d_HErechitenergy;
00201 if (d_HEenergyVsNeighbor) delete d_HEenergyVsNeighbor;
00202 if (d_HOnormped) delete d_HOnormped;
00203 if (d_HOrechitenergy) delete d_HOrechitenergy;
00204 if (d_HOenergyVsNeighbor) delete d_HOenergyVsNeighbor;
00205 if (d_HFnormped) delete d_HFnormped;
00206 if (d_HFrechitenergy) delete d_HFrechitenergy;
00207 if (d_HFenergyVsNeighbor) delete d_HFenergyVsNeighbor;
00208 if (d_ZDCnormped) delete d_ZDCnormped;
00209 if (d_ZDCrechitenergy) delete d_ZDCrechitenergy;
00210 if (d_ZDCenergyVsNeighbor)delete d_ZDCenergyVsNeighbor;
00211
00212 }
00213
00214
00215 }
00216
00217
00218 ProblemHotCells = 0;
00219
00220 for (int i=0;i<6;++i)
00221 {
00222
00223 ProblemHotCellsByDepth[i] =0;
00224 AbovePersistentThresholdCellsByDepth[i] =0;
00225 AbovePedestalHotCellsByDepth[i] =0;
00226 AboveNeighborsHotCellsByDepth[i] =0;
00227 AboveEnergyThresholdCellsByDepth[i] =0;
00228 d_avgrechitenergymap[i] =0;
00229 }
00230
00231 if (hotclient_makeDiagnostics_)
00232 {
00233 d_HBnormped=0;
00234 d_HBrechitenergy=0;
00235 d_HBenergyVsNeighbor=0;
00236 d_HEnormped=0;
00237 d_HErechitenergy=0;
00238 d_HEenergyVsNeighbor=0;
00239 d_HOnormped=0;
00240 d_HOrechitenergy=0;
00241 d_HOenergyVsNeighbor=0;
00242 d_HFnormped=0;
00243 d_HFrechitenergy=0;
00244 d_HFenergyVsNeighbor=0;
00245 d_ZDCnormped=0;
00246 d_ZDCrechitenergy=0;
00247 d_ZDCenergyVsNeighbor=0;
00248
00249 }
00250
00251 dqmReportMapErr_.clear();
00252 dqmReportMapWarn_.clear();
00253 dqmReportMapOther_.clear();
00254 dqmQtests_.clear();
00255 if (showTiming_)
00256 {
00257 cpu_timer.stop(); cout <<"TIMER:: HcalHotCellClient CLEANUP -> "<<cpu_timer.cpuTime()<<endl;
00258 }
00259
00260 return;
00261 }
00262
00263
00264 void HcalHotCellClient::report()
00265 {
00266 if(!dbe_) return;
00267 if (showTiming_)
00268 {
00269 cpu_timer.reset(); cpu_timer.start();
00270 }
00271
00272 if ( debug_>1 ) cout << "HcalHotCellClient: report" << endl;
00273 this->setup();
00274
00275 ostringstream name;
00276 name<<process_.c_str()<<"Hcal/HotCellMonitor_Hcal/Hot Cell Task Event Number";
00277 MonitorElement* me = dbe_->get(name.str().c_str());
00278 if ( me ) {
00279 string s = me->valueString();
00280 ievt_ = -1;
00281 sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &ievt_);
00282 if ( debug_>1 ) cout << "Found '" << name.str().c_str() << "'" << endl;
00283 }
00284 getHistograms();
00285 if (showTiming_)
00286 {
00287 cpu_timer.stop(); cout <<"TIMER:: HcalHotCellClient REPORT -> "<<cpu_timer.cpuTime()<<endl;
00288 }
00289
00290 return;
00291 }
00292
00293
00294 void HcalHotCellClient::getHistograms()
00295 {
00296 if(!dbe_) return;
00297 if (showTiming_)
00298 {
00299 cpu_timer.reset(); cpu_timer.start();
00300 }
00301
00302 ostringstream name;
00303
00304 TH2F* dummy2D = new TH2F();
00305 TH1F* dummy1D = new TH1F();
00306
00307
00308
00309
00310
00311 name<<process_.c_str()<<"HotCellMonitor_Hcal/ ProblemHotCells";
00312 ProblemHotCells = getAnyHisto(dummy2D, name.str(), process_, dbe_, debug_, cloneME_);
00313 name.str("");
00314
00315 getSJ6histos("HotCellMonitor_Hcal/problem_hotcells/", " Problem Hot Cell Rate", ProblemHotCellsByDepth);
00316
00317 if (hotclient_test_persistent_) getSJ6histos("HotCellMonitor_Hcal/hot_rechit_always_above_threshold/", "Hot Cells Persistently Above Energy Threshold", AbovePersistentThresholdCellsByDepth);
00318 if (hotclient_test_pedestal_) getSJ6histos("HotCellMonitor_Hcal/hot_pedestaltest/", "Hot Cells Above Pedestal", AbovePedestalHotCellsByDepth);
00319 if (hotclient_test_neighbor_) getSJ6histos("HotCellMonitor_Hcal/hot_neighbortest/", "Hot Cells Failing Neighbor Test", AboveNeighborsHotCellsByDepth);
00320 if (hotclient_test_energy_) getSJ6histos("HotCellMonitor_Hcal/hot_rechit_above_threshold/", "Hot Cells Above Energy Threshold", AboveEnergyThresholdCellsByDepth);
00321
00322 if (hotclient_makeDiagnostics_)
00323 {
00324 getSJ6histos("HotCellMonitor_Hcal/diagnostics/rechitenergy/","Average rec hit energy per cell",d_avgrechitenergymap);
00325 d_HBnormped=getAnyHisto(dummy1D,(process_+"HotCellMonitor_Hcal/diagnostics/pedestal/HB_normped").c_str(), process_, dbe_, debug_, cloneME_);
00326 d_HBrechitenergy=getAnyHisto(dummy1D,(process_+"HotCellMonitor_Hcal/diagnostics/rechitenergy/HB_rechitenergy").c_str(), process_, dbe_, debug_, cloneME_);
00327 d_HBenergyVsNeighbor=getAnyHisto(dummy2D,(process_+"HotCellMonitor_Hcal/diagnostics/neighborcells/HB_energyVsNeighbor").c_str(), process_, dbe_, debug_, cloneME_);
00328 d_HEnormped=getAnyHisto(dummy1D,(process_+"HotCellMonitor_Hcal/diagnostics/pedestal/HE_normped").c_str(), process_, dbe_, debug_, cloneME_);
00329 d_HErechitenergy=getAnyHisto(dummy1D,(process_+"HotCellMonitor_Hcal/diagnostics/rechitenergy/HE_rechitenergy").c_str(), process_, dbe_, debug_, cloneME_);
00330 d_HEenergyVsNeighbor=getAnyHisto(dummy2D,(process_+"HotCellMonitor_Hcal/diagnostics/neighborcells/HE_energyVsNeighbor").c_str(), process_, dbe_, debug_, cloneME_);
00331 d_HOnormped=getAnyHisto(dummy1D,(process_+"HotCellMonitor_Hcal/diagnostics/pedestal/HO_normped").c_str(), process_, dbe_, debug_, cloneME_);
00332 d_HOrechitenergy=getAnyHisto(dummy1D,(process_+"HotCellMonitor_Hcal/diagnostics/rechitenergy/HO_rechitenergy").c_str(), process_, dbe_, debug_, cloneME_);
00333 d_HOenergyVsNeighbor=getAnyHisto(dummy2D,(process_+"HotCellMonitor_Hcal/diagnostics/neighborcells/HO_energyVsNeighbor").c_str(), process_, dbe_, debug_, cloneME_);
00334 d_HFnormped=getAnyHisto(dummy1D,(process_+"HotCellMonitor_Hcal/diagnostics/pedestal/HF_normped").c_str(), process_, dbe_, debug_, cloneME_);
00335 d_HFrechitenergy=getAnyHisto(dummy1D,(process_+"HotCellMonitor_Hcal/diagnostics/rechitenergy/HF_rechitenergy").c_str(), process_, dbe_, debug_, cloneME_);
00336 d_HFenergyVsNeighbor=getAnyHisto(dummy2D,(process_+"HotCellMonitor_Hcal/diagnostics/neighborcells/HF_energyVsNeighbor").c_str(), process_, dbe_, debug_, cloneME_);
00337 }
00338
00339
00340
00341 for (int i=0;i<6;++i)
00342 {
00343 if (ProblemHotCellsByDepth[i])
00344 {
00345 ProblemHotCellsByDepth[i]->SetMaximum(1);
00346 ProblemHotCellsByDepth[i]->SetMinimum(0);
00347 }
00348 name.str("");
00349
00350 }
00351 if (showTiming_)
00352 {
00353 cpu_timer.stop(); cout <<"TIMER:: HcalHotCellClient GETHISTOGRAMS -> "<<cpu_timer.cpuTime()<<endl;
00354 }
00355
00356 return;
00357 }
00358
00359
00360 void HcalHotCellClient::analyze(void)
00361 {
00362 if (showTiming_)
00363 {
00364 cpu_timer.reset(); cpu_timer.start();
00365 }
00366
00367 jevt_++;
00368 if ( jevt_ % 10 == 0 )
00369 {
00370 if ( debug_>1 ) cout << "<HcalHotCellClient::analyze> Running analyze "<<endl;
00371 }
00372
00373 if (showTiming_)
00374 {
00375 cpu_timer.stop(); cout <<"TIMER:: HcalHotCellClient ANALYZE -> "<<cpu_timer.cpuTime()<<endl;
00376 }
00377
00378 return;
00379 }
00380
00381
00382 void HcalHotCellClient::createTests()
00383 {
00384
00385
00386 if(!dbe_) return;
00387 return;
00388 }
00389
00390
00391 void HcalHotCellClient::resetAllME()
00392 {
00393 if(!dbe_) return;
00394 if (showTiming_)
00395 {
00396 cpu_timer.reset(); cpu_timer.start();
00397 }
00398
00399 ostringstream name;
00400
00401
00402 name<<process_.c_str()<<"HotCellMonitor_Hcal/ ProblemHotCells";
00403 resetME(name.str().c_str(),dbe_);
00404 name.str("");
00405
00406 for (int i=0;i<6;++i)
00407 {
00408
00409
00410 name<<process_.c_str()<<"HotCellMonitor_Hcal/problem_hotcells/"<<subdets_[i]<<" Problem Hot Cell Rate";
00411 resetME(name.str().c_str(),dbe_);
00412 name.str("");
00413 if (hotclient_test_persistent_)
00414 {
00415 name<<process_.c_str()<<"HotCellMonitor_Hcal/hot_unoccupied_digi/"<<subdets_[i]<<"Hot Cells with No Digis";
00416 resetME(name.str().c_str(),dbe_);
00417 name.str("");
00418 }
00419 if (hotclient_test_pedestal_)
00420 {
00421 name<<process_.c_str()<<"HotCellMonitor_Hcal/hot_pedestaltest"<<subdets_[i]<<"Hot Cells Failing Pedestal Test";
00422 resetME(name.str().c_str(),dbe_);
00423 name.str("");
00424 }
00425 if (hotclient_test_neighbor_)
00426 {
00427 name<<process_.c_str()<<"HotCellMonitor_Hcal/hot_neighbortest"<<subdets_[i]<<"Hot Cells Failing Neighbor Test";
00428 resetME(name.str().c_str(),dbe_);
00429 name.str("");
00430 }
00431 if (hotclient_test_energy_)
00432 {
00433 name<<process_.c_str()<<"HotCellMonitor_Hcal/hot_energytest"<<subdets_[i]<<"Hot Cells Failing Energy Threshold Test";
00434 resetME(name.str().c_str(),dbe_);
00435 name.str("");
00436 }
00437 if (hotclient_makeDiagnostics_)
00438 {
00439 resetME((process_+"HotCellMonitor_Hcal/diagnostics/pedestal/HB_normped").c_str(),dbe_);
00440 resetME((process_+"HotCellMonitor_Hcal/diagnostics/rechitenergy/HB_rechitenergy").c_str(),dbe_);
00441 resetME((process_+"HotCellMonitor_Hcal/diagnostics/neighborcells/HB_energyVsNeighbor").c_str(),dbe_);
00442 resetME((process_+"HotCellMonitor_Hcal/diagnostics/pedestal/HE_normped").c_str(),dbe_);
00443 resetME((process_+"HotCellMonitor_Hcal/diagnostics/rechitenergy/HE_rechitenergy").c_str(),dbe_);
00444 resetME((process_+"HotCellMonitor_Hcal/diagnostics/neighborcells/HE_energyVsNeighbor").c_str(),dbe_);
00445 resetME((process_+"HotCellMonitor_Hcal/diagnostics/pedestal/HO_normped").c_str(),dbe_);
00446 resetME((process_+"HotCellMonitor_Hcal/diagnostics/rechitenergy/HO_rechitenergy").c_str(),dbe_);
00447 resetME((process_+"HotCellMonitor_Hcal/diagnostics/neighborcells/HO_energyVsNeighbor").c_str(),dbe_);
00448 resetME((process_+"HotCellMonitor_Hcal/diagnostics/pedestal/HF_normped").c_str(),dbe_);
00449 resetME((process_+"HotCellMonitor_Hcal/diagnostics/rechitenergy/HF_rechitenergy").c_str(),dbe_);
00450 resetME((process_+"HotCellMonitor_Hcal/diagnostics/neighborcells/HF_energyVsNeighbor").c_str(),dbe_);
00451 }
00452
00453 }
00454 if (showTiming_)
00455 {
00456 cpu_timer.stop(); cout <<"TIMER:: HcalHotCellClient RESETALLME -> "<<cpu_timer.cpuTime()<<endl;
00457 }
00458
00459 return;
00460 }
00461
00462
00463 void HcalHotCellClient::htmlOutput(int runNo, string htmlDir, string htmlName)
00464 {
00465 getHistograms();
00466 if (showTiming_)
00467 {
00468 cpu_timer.reset(); cpu_timer.start();
00469 }
00470
00471 if (debug_>1) cout << "Preparing HcalHotCellClient html output ..." << endl;
00472
00473 string client = "HotCellMonitor";
00474
00475 ofstream htmlFile;
00476 htmlFile.open((htmlDir + htmlName).c_str());
00477
00478
00479 htmlFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> " << endl;
00480 htmlFile << "<html> " << endl;
00481 htmlFile << "<head> " << endl;
00482 htmlFile << " <meta content=\"text/html; charset=ISO-8859-1\" " << endl;
00483 htmlFile << " https-equiv=\"content-type\"> " << endl;
00484 htmlFile << " <title>Monitor: Hcal Hot Cell Task output</title> " << endl;
00485 htmlFile << "</head> " << endl;
00486 htmlFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << endl;
00487 htmlFile << "<body> " << endl;
00488 htmlFile << "<br> " << endl;
00489 htmlFile << "<h2>Run: " << endl;
00490 htmlFile << " <span " << endl;
00491 htmlFile << " style=\"color: rgb(0, 0, 153);\">" << runNo << "</span></h2>" << endl;
00492 htmlFile << "<h2>Monitoring task: <span " << endl;
00493 htmlFile << " style=\"color: rgb(0, 0, 153);\">Hcal Hot Cells</span></h2> " << endl;
00494
00495 htmlFile << "<h2>Events processed: " << endl;
00496 htmlFile << " <span " << endl;
00497 htmlFile << " style=\"color: rgb(0, 0, 153);\">" << ievt_ << "</span></h2>" << endl;
00498 htmlFile << "<hr>" << endl;
00499
00500 htmlFile << "<h2><strong>Hcal Hot Cell Status</strong></h2>" << endl;
00501 htmlFile << "<h3>" << endl;
00502 htmlFile << "</h3>" << endl;
00503
00504 htmlFile << "<table align=\"center\" border=\"0\" cellspacing=\"0\" " << endl;
00505 htmlFile << "cellpadding=\"10\"> " << endl;
00506 htmlFile << "<tr align=\"center\">" << endl;
00507 gStyle->SetPalette(20,pcol_error_);
00508 htmlAnyHisto(runNo,ProblemHotCells,"i#eta","i#phi", 92, htmlFile, htmlDir);
00509 htmlFile<<"</tr>"<<endl;
00510 htmlFile<<"<tr align=\"center\"><td> A cell is considered hot if it meets any of the following criteria:"<<endl;
00511 if (hotclient_test_persistent_) htmlFile<<"<br> A cell's ADC sum is more than (pedestal + N sigma); "<<endl;
00512 if (hotclient_test_pedestal_ ) htmlFile<<"<br> A cell's energy is above some threshold value X;"<<endl;
00513 if (hotclient_test_energy_ ) htmlFile<<"<br> A cell's energy is consistently above some threshold value Y (where Y does not necessarily equal X);"<<endl;
00514 if (hotclient_test_neighbor_ ) htmlFile<<"<br> A cell's energy is much more than the sum of its neighbors;"<<endl;
00515 htmlFile<<"</td>"<<endl;
00516 htmlFile<<"</tr></table>"<<endl;
00517 htmlFile<<"<hr><table align=\"center\" border=\"0\" cellspacing=\"0\" " << endl;
00518 htmlFile << "cellpadding=\"10\"> " << endl;
00519 htmlFile << "<tr align=\"center\">" << endl;
00520 htmlFile<<"<tr><td align=center><a href=\"Expert_"<< htmlName<<"\"><h2>Detailed Hot Cell Plots</h2> </a></br></td>"<<endl;
00521 htmlFile<<"</tr></table><br><hr>"<<endl;
00522
00523
00524 htmlFile <<"<br>"<<endl;
00525 htmlFile << "<h2><strong>Hcal Problem Cells</strong></h2>" << endl;
00526 htmlFile << "(A problem cell is listed below if its failure rate exceeds "<<(100.*minErrorFlag_)<<"%).<br><br>"<<endl;
00527 htmlFile << "<table align=\"center\" border=\"1\" cellspacing=\"0\" " << endl;
00528 htmlFile << "cellpadding=\"10\"> " << endl;
00529 htmlFile << "<tr align=\"center\">" << endl;
00530 htmlFile <<"<td> Problem Hot Cells<br>(ieta, iphi, depth)</td><td align=\"center\"> Fraction of Events <br>in which cells are bad (%)</td></tr>"<<endl;
00531
00532 if (ProblemHotCells==0)
00533 {
00534 if (debug_) cout <<"<HcalHotCellClient::htmlOutput> ERROR: can't find Problem Hot Cell plot!"<<endl;
00535 return;
00536 }
00537 int etabins = ProblemHotCells->GetNbinsX();
00538 int phibins = ProblemHotCells->GetNbinsY();
00539 float etaMin = ProblemHotCells->GetXaxis()->GetXmin();
00540 float phiMin = ProblemHotCells->GetYaxis()->GetXmin();
00541
00542 int eta,phi;
00543
00544 ostringstream name;
00545 for (int depth=0;depth<6; ++depth)
00546 {
00547 for (int ieta=1;ieta<=etabins;++ieta)
00548 {
00549 for (int iphi=1; iphi<=phibins;++iphi)
00550 {
00551 eta=ieta+int(etaMin)-1;
00552 phi=iphi+int(phiMin)-1;
00553 if (abs(eta)>20 && phi%2!=1) continue;
00554 if (abs(eta)>39 && phi%4!=3) continue;
00555 int mydepth=depth+1;
00556 if (mydepth>4) mydepth-=4;
00557 if (ProblemHotCellsByDepth[depth]==0)
00558 {
00559 continue;
00560 }
00561 if (ProblemHotCellsByDepth[depth]->GetBinContent(ieta,iphi)>minErrorFlag_)
00562 {
00563 if (depth<2)
00564 (fabs(eta)<29) ? name<<"HB" : name<<"HF";
00565 else if (depth==3)
00566 (fabs(eta)<42) ? name<<"HO" : name<<"ZDC";
00567 else name <<"HE";
00568 htmlFile<<"<td>"<<name.str().c_str()<<" ("<<eta<<", "<<phi<<", "<<mydepth<<")</td><td align=\"center\">"<<ProblemHotCellsByDepth[depth]->GetBinContent(ieta,iphi)*100.<<"</td></tr>"<<endl;
00569
00570 name.str("");
00571 }
00572 }
00573 }
00574 }
00575
00576
00577
00578 htmlFile <<"</table> " << endl;
00579 htmlFile << "</body> " << endl;
00580 htmlFile << "</html> " << endl;
00581
00582 htmlFile.close();
00583 htmlExpertOutput(runNo, htmlDir, htmlName);
00584
00585 if (showTiming_)
00586 {
00587 cpu_timer.stop(); cout <<"TIMER:: HcalHotCellClient HTMLOUTPUT -> "<<cpu_timer.cpuTime()<<endl;
00588 }
00589
00590 return;
00591 }
00592
00593
00594 void HcalHotCellClient::htmlExpertOutput(int runNo, string htmlDir, string htmlName)
00595 {
00596 if (showTiming_)
00597 {
00598 cpu_timer.reset(); cpu_timer.start();
00599 }
00600
00601 if (debug_>1)
00602 cout <<" <HcalHotCellClient::htmlExpertOutput> Preparing Expert html output ..." <<endl;
00603
00604 string client = "HotCellMonitor";
00605 htmlErrors(runNo,htmlDir,client,process_,dbe_,dqmReportMapErr_,dqmReportMapWarn_,dqmReportMapOther_);
00606
00607 ofstream htmlFile;
00608 htmlFile.open((htmlDir +"Expert_"+ htmlName).c_str());
00609
00610
00611 htmlFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> " << endl;
00612 htmlFile << "<html> " << endl;
00613 htmlFile << "<head> " << endl;
00614 htmlFile << " <meta content=\"text/html; charset=ISO-8859-1\" " << endl;
00615 htmlFile << " https-equiv=\"content-type\"> " << endl;
00616 htmlFile << " <title>Monitor: Hcal Hot Cell Task output</title> " << endl;
00617 htmlFile << "</head> " << endl;
00618 htmlFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << endl;
00619 htmlFile << "<body> " << endl;
00620 htmlFile <<"<a name=\"EXPERT_HOTCELL_TOP\" href = \".\"> Back to Main HCAL DQM Page </a><br>"<<endl;
00621 htmlFile <<"<a href= \""<<htmlName.c_str()<<"\" > Back to Hot Cell Status Page </a><br>"<<endl;
00622 htmlFile << "<br> " << endl;
00623 htmlFile << "<h2>Run: " << endl;
00624 htmlFile << " <span " << endl;
00625 htmlFile << " style=\"color: rgb(0, 0, 153);\">" << runNo << "</span></h2>" << endl;
00626 htmlFile << "<h2>Monitoring task: <span " << endl;
00627 htmlFile << " style=\"color: rgb(0, 0, 153);\">Hcal Hot Cells</span></h2> " << endl;
00628 htmlFile << "<h2>Events processed: " << endl;
00629 htmlFile << " <span " << endl;
00630 htmlFile << " style=\"color: rgb(0, 0, 153);\">" << ievt_ << "</span></h2>" << endl;
00631 htmlFile << "<hr>" << endl;
00632
00633 htmlFile << "<table width=100% border = 1>"<<endl;
00634 htmlFile << "<tr><td align=\"center\" colspan=1><a href=\"#OVERALL_PROBLEMS\">PROBLEM CELLS BY DEPTH </a></td></tr>"<<endl;
00635 htmlFile << "<tr><td align=\"center\">"<<endl;
00636 if (hotclient_test_pedestal_ ) htmlFile<<"<br><a href=\"#PED_PROBLEMS\">Hot cell according to Pedestal Test </a>"<<endl;
00637 if (hotclient_test_energy_ ) htmlFile<<"<br><a href=\"#ENERGY_PROBLEMS\">Hot cell according to Energy Threshold Test </a>"<<endl;
00638 if (hotclient_test_persistent_) htmlFile<<"<br><a href=\"#PERSISTENT_PROBLEMS\">Hot cell consistently above a certain energy </a>"<<endl;
00639 if (hotclient_test_neighbor_ ) htmlFile<<"<br><a href=\"#NEIGHBOR_PROBLEMS\">Hot cell according to Neighbor Test </a>"<<endl;
00640 htmlFile << "</td></tr>"<<endl;
00641 htmlFile <<"</table>"<<endl;
00642 htmlFile <<"<br><br>"<<endl;
00643
00644
00645
00646 htmlFile << "<h2><strong><a name=\"OVERALL_PROBLEMS\">Eta-Phi Maps of Problem Cells By Depth</strong></h2>"<<endl;
00647 htmlFile <<" These plots of problem cells combine results from all hot cell tests<br>"<<endl;
00648 htmlFile <<"<a href= \"#EXPERT_HOTCELL_TOP\" > Back to Top</a><br>"<<endl;
00649 htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
00650 htmlFile << "cellpadding=\"10\"> " << endl;
00651 gStyle->SetPalette(20,pcol_error_);
00652
00653
00654
00655 int mydepth[6]={0,1,4,5,2,3};
00656 for (int i=0;i<3;++i)
00657 {
00658 htmlFile << "<tr align=\"left\">" << endl;
00659 htmlAnyHisto(runNo,ProblemHotCellsByDepth[mydepth[2*i]],"i#eta","i#phi", 92, htmlFile, htmlDir);
00660 htmlAnyHisto(runNo,ProblemHotCellsByDepth[mydepth[2*i]+1],"i#eta","i#phi", 92, htmlFile, htmlDir);
00661 htmlFile <<"</tr>"<<endl;
00662 }
00663
00664 htmlFile <<"</table>"<<endl;
00665 htmlFile <<"<br><hr><br>"<<endl;
00666
00667
00668
00669 if (hotclient_test_pedestal_)
00670 {
00671 htmlFile << "<h2><strong><a name=\"PED_PROBLEMS\">Pedestal Test Problems</strong></h2>"<<endl;
00672 htmlFile <<"A cell fails this test if its ADC sum is above (pedestal + Nsigma) for "<<hotclient_checkNevents_pedestal_<<" consecutive events <br>"<<endl;
00673 htmlFile <<"<a href= \"#EXPERT_HOTCELL_TOP\" > Back to Top</a><br>"<<endl;
00674 htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
00675 htmlFile << "cellpadding=\"10\"> " << endl;
00676 gStyle->SetPalette(20,pcol_error_);
00677 for (int i=0;i<3;++i)
00678 {
00679 htmlFile << "<tr align=\"left\">" << endl;
00680 htmlAnyHisto(runNo,AbovePedestalHotCellsByDepth[mydepth[2*i]],"i#eta","i#phi", 92, htmlFile, htmlDir);
00681 htmlAnyHisto(runNo,AbovePedestalHotCellsByDepth[mydepth[2*i]+1],"i#eta","i#phi", 92, htmlFile, htmlDir);
00682 htmlFile <<"</tr>"<<endl;
00683 }
00684 if (hotclient_makeDiagnostics_)
00685 {
00686 htmlFile <<"<tr align=\"left\">" <<endl;
00687 htmlAnyHisto(runNo, d_HBnormped, "(ADC-ped)/width","", 92, htmlFile, htmlDir,1);
00688 htmlAnyHisto(runNo, d_HEnormped, "(ADC-ped)/width","", 92, htmlFile, htmlDir,1);
00689 htmlFile <<"</tr>"<<endl;
00690 htmlFile <<"<tr align=\"left\">" <<endl;
00691 htmlAnyHisto(runNo, d_HOnormped, "(ADC-ped)/width","", 92, htmlFile, htmlDir,1);
00692 htmlAnyHisto(runNo, d_HFnormped, "(ADC-ped)/width","", 92, htmlFile, htmlDir,1);
00693 htmlFile <<"</tr>"<<endl;
00694 }
00695 htmlFile <<"</table>"<<endl;
00696 htmlFile <<"<br><hr><br>"<<endl;
00697 }
00698
00699
00700 if (hotclient_test_energy_)
00701 {
00702 htmlFile << "<h2><strong><a name=\"ENERGY_PROBLEMS\">Energy Threshold Test Problems</strong></h2>"<<endl;
00703 htmlFile <<"A cell fails this test if its rechit energy is above threshold at any time.<br>"<<endl;
00704 htmlFile <<"<a href= \"#EXPERT_HOTCELL_TOP\" > Back to Top</a><br>"<<endl;
00705 htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
00706 htmlFile << "cellpadding=\"10\"> " << endl;
00707 gStyle->SetPalette(20,pcol_error_);
00708 for (int i=0;i<3;++i)
00709 {
00710 htmlFile << "<tr align=\"left\">" << endl;
00711 htmlAnyHisto(runNo,AboveEnergyThresholdCellsByDepth[mydepth[2*i]],"i#eta","i#phi", 92, htmlFile, htmlDir);
00712 htmlAnyHisto(runNo,AboveEnergyThresholdCellsByDepth[mydepth[2*i]+1],"i#eta","i#phi", 92, htmlFile, htmlDir);
00713 htmlFile <<"</tr>"<<endl;
00714 }
00715 if (hotclient_makeDiagnostics_)
00716 {
00717 htmlFile <<"<tr align=\"left\">" <<endl;
00718 htmlAnyHisto(runNo, d_HBrechitenergy, "Energy (GeV)","", 92, htmlFile, htmlDir,1,1);
00719 htmlAnyHisto(runNo, d_HErechitenergy, "Energy (GeV)","", 92, htmlFile, htmlDir,1,1);
00720 htmlFile <<"</tr>"<<endl;
00721 htmlFile <<"<tr align=\"left\">" <<endl;
00722 htmlAnyHisto(runNo, d_HOrechitenergy, "Energy (GeV)","", 92, htmlFile, htmlDir,1,1);
00723 htmlAnyHisto(runNo, d_HFrechitenergy, "Energy (GeV)","", 92, htmlFile, htmlDir,1,1);
00724 htmlFile <<"</tr>"<<endl;
00725 }
00726
00727 htmlFile <<"</table>"<<endl;
00728 htmlFile <<"<br><hr><br>"<<endl;
00729 }
00730
00731
00732 if (hotclient_test_persistent_)
00733 {
00734 htmlFile << "<h2><strong><a name=\"PERSISTENT_PROBLEMS\">Persistent Hot Cell Problems</strong></h2>"<<endl;
00735 htmlFile <<"A cell fails this test if its rechit energy is above threshold for "<<hotclient_checkNevents_persistent_<<" consecutive events.<br>"<<endl;
00736 htmlFile <<"<a href= \"#EXPERT_HOTCELL_TOP\" > Back to Top</a><br>"<<endl;
00737 htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
00738 htmlFile << "cellpadding=\"10\"> " << endl;
00739 gStyle->SetPalette(20,pcol_error_);
00740 for (int i=0;i<3;++i)
00741 {
00742 htmlFile << "<tr align=\"left\">" << endl;
00743 htmlAnyHisto(runNo,AbovePersistentThresholdCellsByDepth[mydepth[2*i]],"i#eta","i#phi", 92, htmlFile, htmlDir,0,0);
00744 htmlAnyHisto(runNo,AbovePersistentThresholdCellsByDepth[mydepth[2*i]+1],"i#eta","i#phi", 92, htmlFile, htmlDir,0,0);
00745 htmlFile <<"</tr>"<<endl;
00746 }
00747 htmlFile <<"</table>"<<endl;
00748 htmlFile <<"<br><hr><br>"<<endl;
00749 }
00750
00751
00752
00753 if (hotclient_test_neighbor_)
00754 {
00755 htmlFile << "<h2><strong><a name=\"NEIGHBOR_PROBLEMS\">Neighbor Energy Test Problems</strong></h2>"<<endl;
00756 htmlFile <<"A cell fails this test if its rechit energy is significantly greater than the sum of its surrounding neighbors <br>"<<endl;
00757 htmlFile <<"<a href= \"#EXPERT_HOTCELL_TOP\" > Back to Top</a><br>"<<endl;
00758 htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
00759 htmlFile << "cellpadding=\"10\"> " << endl;
00760 gStyle->SetPalette(20,pcol_error_);
00761 for (int i=0;i<3;++i)
00762 {
00763 htmlFile << "<tr align=\"left\">" << endl;
00764 htmlAnyHisto(runNo,AboveNeighborsHotCellsByDepth[mydepth[2*i]],"i#eta","i#phi", 92, htmlFile, htmlDir);
00765 htmlAnyHisto(runNo,AboveNeighborsHotCellsByDepth[mydepth[2*i]+1],"i#eta","i#phi", 92, htmlFile, htmlDir);
00766 htmlFile <<"</tr>"<<endl;
00767 }
00768 if (hotclient_makeDiagnostics_)
00769 {
00770 gStyle->SetPalette(1);
00771 htmlFile <<"<tr align=\"left\">" <<endl;
00772 htmlAnyHisto(runNo, d_HBenergyVsNeighbor, "Cell energy (GeV)","Neighbor energy (GeV)", 92, htmlFile, htmlDir);
00773 htmlAnyHisto(runNo, d_HEenergyVsNeighbor, "Cell energy (GeV)","Neighbor energy (GeV)", 92, htmlFile, htmlDir);
00774 htmlFile <<"</tr>"<<endl;
00775 htmlFile <<"<tr align=\"left\">" <<endl;
00776 htmlAnyHisto(runNo, d_HOenergyVsNeighbor, "Cell energy (GeV)","Neighbor energy (GeV)", 92, htmlFile, htmlDir);
00777 htmlAnyHisto(runNo, d_HFenergyVsNeighbor, "Cell energy (GeV)","Neighbor energy (GeV)", 92, htmlFile, htmlDir);
00778 htmlFile <<"</tr>"<<endl;
00779 }
00780
00781 htmlFile <<"</table>"<<endl;
00782 htmlFile <<"<br><hr><br>"<<endl;
00783 }
00784
00785
00786 htmlFile <<"<br><hr><br><a href= \"#EXPERT_HOTCELL_TOP\" > Back to Top of Page </a><br>"<<endl;
00787 htmlFile <<"<a href = \".\"> Back to Main HCAL DQM Page </a><br>"<<endl;
00788 htmlFile <<"<a href= \""<<htmlName.c_str()<<"\" > Back to Hot Cell Status Page </a><br>"<<endl;
00789
00790 htmlFile << "</body> " << endl;
00791 htmlFile << "</html> " << endl;
00792
00793 htmlFile.close();
00794
00795 if (showTiming_)
00796 {
00797 cpu_timer.stop(); cout <<"TIMER:: HcalHotCellClient HTMLEXPERTOUTPUT ->"<<cpu_timer.cpuTime()<<endl;
00798 }
00799 return;
00800 }
00801
00802
00803
00804 void HcalHotCellClient::loadHistograms(TFile* infile)
00805 {
00806 if (showTiming_)
00807 {
00808 cpu_timer.reset(); cpu_timer.start();
00809 }
00810
00811 TNamed* tnd = (TNamed*)infile->Get("DQMData/Hcal/HotCellMonitor_Hcal/Hot Cell Task Event Number");
00812 if(tnd)
00813 {
00814 string s =tnd->GetTitle();
00815 ievt_ = -1;
00816 sscanf((s.substr(2,s.length()-2)).c_str(), "%d", &ievt_);
00817 }
00818
00819 ostringstream name;
00820
00821 name<<process_.c_str()<<"HotCellMonitor_Hcal/ ProblemHotCells";
00822 ProblemHotCells = (TH2F*)infile->Get(name.str().c_str());
00823 name.str("");
00824
00825 for (int i=0;i<6;++i)
00826 {
00827
00828 name<<process_.c_str()<<"HotCellMonitor_Hcal/problem_pedestals/"<<subdets_[i]<<" Problem Pedestal Rate";
00829 ProblemHotCellsByDepth[i] = (TH2F*)infile->Get(name.str().c_str());
00830 name.str("");
00831 if (hotclient_test_persistent_)
00832 {
00833 name<<process_.c_str()<<"HotCellMonitor_Hcal/hot_unoccupied_digi/"<<subdets_[i]<<"Hot Cells with No Digis";
00834 AbovePersistentThresholdCellsByDepth[i] = (TH2F*)infile->Get(name.str().c_str());
00835 name.str("");
00836 }
00837 if (hotclient_test_pedestal_)
00838 {
00839 name<<process_.c_str()<<"HotCellMonitor_Hcal/hot_pedestaltest"<<subdets_[i]<<"Hot Cells Failing Pedestal Test";
00840 AbovePedestalHotCellsByDepth[i] = (TH2F*)infile->Get(name.str().c_str());
00841 name.str("");
00842 }
00843 if (hotclient_test_neighbor_)
00844 {
00845 name<<process_.c_str()<<"HotCellMonitor_Hcal/hot_neighbortest"<<subdets_[i]<<"Hot Cells Failing Neighbor Test";
00846 AboveNeighborsHotCellsByDepth[i] = (TH2F*)infile->Get(name.str().c_str());
00847 name.str("");
00848 }
00849 if (hotclient_test_energy_)
00850 {
00851 name<<process_.c_str()<<"HotCellMonitor_Hcal/hot_energytest"<<subdets_[i]<<"Hot Cells Failing Energy Threshold Test";
00852 AboveEnergyThresholdCellsByDepth[i] = (TH2F*)infile->Get(name.str().c_str());
00853 name.str("");
00854 }
00855
00856 }
00857 if (showTiming_)
00858 {
00859 cpu_timer.stop(); cout <<"TIMER:: HcalHotCellClient LOAD HISTOGRAMS -> "<<cpu_timer.cpuTime()<<endl;
00860 }
00861
00862 return;
00863 }
00864