00001 #include "DQM/HcalMonitorClient/interface/HcalSummaryClient.h"
00002
00003 #define ETAMAX 44.5
00004 #define ETAMIN -44.5
00005 #define PHIMAX 73.5
00006 #define PHIMIN -0.5
00007
00008 using namespace cms;
00009 using namespace edm;
00010 using namespace std;
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 HcalSummaryClient::HcalSummaryClient() {}
00046
00047 void HcalSummaryClient::init(const ParameterSet& ps, DQMStore* dbe, string clientName)
00048 {
00049
00050 HcalBaseClient::init(ps,dbe,clientName);
00051
00052
00053 cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00054
00055
00056 debug_ = ps.getUntrackedParameter<int>("debug", 0);
00057
00058
00059 prefixME_ = ps.getUntrackedParameter<string>("prefixME", "Hcal");
00060
00061
00062 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00063
00064
00065
00066
00067 digiMon_.onoff=(ps.getUntrackedParameter<bool>("DigiClient",false));
00068 recHitMon_.onoff=(ps.getUntrackedParameter<bool>("RecHitClient",false));
00069 pedestalMon_.onoff=(ps.getUntrackedParameter<bool>("PedestalClient",false));
00070 pedestalMon_.onoff=false;
00071
00072 hotCellMon_.onoff=(ps.getUntrackedParameter<bool>("HotCellClient",false));
00073 deadCellMon_.onoff=(ps.getUntrackedParameter<bool>("DeadCellClient",false));
00074
00075
00076
00077
00078 dataFormatMon_.problemName = "";
00079 digiMon_.problemName = "Problem Digi Rate";
00080 recHitMon_.problemName = "Problem RecHit Rate";
00081 pedestalMon_.problemName = " Problem Pedestal Rate";
00082 ledMon_.problemName = "";
00083 hotCellMon_.problemName = " Problem Hot Cell Rate";
00084 deadCellMon_.problemName = " Problem Dead Cell Rate";
00085 trigPrimMon_.problemName = "";
00086 caloTowerMon_.problemName = "";
00087
00088 dataFormatMon_.problemDir = "";
00089 digiMon_.problemDir = "DigiMonitor_Hcal/problem_digis";
00090 recHitMon_.problemDir = "";
00091 pedestalMon_.problemDir = "PedestalMonitor_Hcal/problem_pedestals";
00092 ledMon_.problemDir = "";
00093 hotCellMon_.problemDir = "HotCellMonitor_Hcal/problem_hotcells";
00094 deadCellMon_.problemDir = "DeadCellMonitor_Hcal/problem_deadcells";
00095 trigPrimMon_.problemDir = "";
00096 caloTowerMon_.problemDir = "";
00097
00098
00099 status_HB_=-1;
00100 status_HE_=-1;
00101 status_HO_=-1;
00102 status_HF_=-1;
00103 status_ZDC_=-1;
00104 status_global_=-1;
00105
00106
00107 subdetCells_.insert(make_pair("HB",2592));
00108 subdetCells_.insert(make_pair("HE",2592));
00109 subdetCells_.insert(make_pair("HO",2160));
00110 subdetCells_.insert(make_pair("HF",1728));
00111
00112
00113 HBpresent_=0;
00114 HEpresent_=0;
00115 HOpresent_=0;
00116 HFpresent_=0;
00117 ZDCpresent_=0;
00118
00119
00120 etaMax_ = ps.getUntrackedParameter<double>("MaxEta", ETAMAX);
00121 etaMin_ = ps.getUntrackedParameter<double>("MinEta", ETAMIN);
00122 if (etaMax_ > 44.5)
00123 {
00124 cout <<"<HcalBaseMonitor> WARNING: etaMax_ value of "<<etaMax_<<" exceeds maximum allowed value of 44.5"<<endl;
00125 cout <<" Value being set back to 44.5."<<endl;
00126 cout <<" Additional code changes are necessary to allow value of "<<etaMax_<<endl;
00127 etaMax_ = 44.5;
00128 }
00129 if (etaMin_ < ETAMIN)
00130 {
00131 cout <<"<HcalBaseMonitor> WARNING: etaMin_ value of "<<etaMin_<<" exceeds minimum allowed value of 44.5"<<endl;
00132 cout <<" Value being set back to -44.5."<<endl;
00133 cout <<" Additional code changes are necessary to allow value of "<<etaMin_<<endl;
00134 etaMin_ = -44.5;
00135 }
00136 etaBins_ = (int)(etaMax_ - etaMin_);
00137 phiMax_ = ps.getUntrackedParameter<double>("MaxPhi", PHIMAX);
00138 phiMin_ = ps.getUntrackedParameter<double>("MinPhi", PHIMIN);
00139 phiBins_ = (int)(phiMax_ - phiMin_);
00140
00141 }
00142
00143 HcalSummaryClient::~HcalSummaryClient()
00144 {
00145 }
00146
00147 void HcalSummaryClient::beginJob(DQMStore* dqmStore)
00148 {
00149 dqmStore_=dqmStore;
00150 if (debug_>0)
00151 cout <<"<HcalSummaryClient: beginJob>"<<endl;
00152 ievt_ = 0;
00153 jevt_ = 0;
00154 lastupdate_=0;
00155 }
00156
00157 void HcalSummaryClient::beginRun(void)
00158 {
00159 if ( debug_>0 ) cout << "<HcalSummaryClient: beginRun>" << endl;
00160
00161 jevt_ = 0;
00162 this->setup();
00163 }
00164
00165 void HcalSummaryClient::endJob(void)
00166 {
00167 if ( debug_>0 ) cout << "<HcalSummaryClient: endJob> ievt = " << ievt_ << endl;
00168
00169 if (ievt_>lastupdate_)
00170 analyze();
00171 this->cleanup();
00172 }
00173
00174 void HcalSummaryClient::endRun(void)
00175 {
00176 if ( debug_ ) cout << "<HcalSummaryClient: endRun> jevt = " << jevt_ << endl;
00177
00178 analyze();
00179 lastupdate_=ievt_;
00180 this->cleanup();
00181 }
00182
00183 void HcalSummaryClient::setup(void)
00184 {
00185 MonitorElement* me;
00186 ostringstream histo;
00187
00188 dqmStore_->setCurrentFolder( prefixME_ + "/EventInfo");
00189 histo<<"reportSummary";
00190 me=dqmStore_->get(prefixME_+"/EventInfo/"+histo.str().c_str());
00191 if (me)
00192 dqmStore_->removeElement(me->getName());
00193 me = dqmStore_->bookFloat(histo.str().c_str());
00194 me->Fill(-1);
00195 histo.str("");
00196
00197 std::string subdets[4] = {"HB","HE","HO","HF"};
00198 for (unsigned int i=0;i<4;++i)
00199 {
00200
00201 dqmStore_->setCurrentFolder( prefixME_ + "/EventInfo/reportSummaryContents" ); histo<<"Hcal_"<<subdets[i].c_str();
00202 me=dqmStore_->get(prefixME_+"/EventInfo/"+histo.str().c_str());
00203 if (me)
00204 dqmStore_->removeElement(me->getName());
00205 me = dqmStore_->bookFloat(histo.str().c_str());
00206 me->Fill(-1);
00207 histo.str("");
00208 }
00209
00210
00211 dqmStore_->setCurrentFolder(prefixME_+"/EventInfo/");
00212 histo<<"advancedReportSummaryMap";
00213 me=dqmStore_->get(prefixME_+"/EventInfo/"+histo.str().c_str());
00214 if (me)
00215 dqmStore_->removeElement(me->getName());
00216 me = dqmStore_->book2D(histo.str().c_str(), histo.str().c_str(),
00217 etaBins_,etaMin_,etaMax_,
00218 phiBins_,phiMin_,phiMax_);
00219
00220
00221 for (int ieta=1;ieta<=etaBins_;++ieta)
00222 for (int iphi=1; iphi<=phiBins_;++iphi)
00223 me->setBinContent(ieta,iphi,-1);
00224
00225
00226 histo.str("");
00227 histo<<"reportSummaryMap";
00228 me=dqmStore_->get(prefixME_+"/EventInfo/"+histo.str().c_str());
00229 if (me)
00230 dqmStore_->removeElement(me->getName());
00231 me = dqmStore_->book2D(histo.str().c_str(), histo.str().c_str(),
00232 5,0,5,1,0,1);
00233 TH2F* myhist=me->getTH2F();
00234 myhist->GetXaxis()->SetBinLabel(1,"HB");
00235 myhist->GetXaxis()->SetBinLabel(2,"HE");
00236 myhist->GetXaxis()->SetBinLabel(3,"HO");
00237 myhist->GetXaxis()->SetBinLabel(4,"HF");
00238 myhist->GetYaxis()->SetBinLabel(1,"Status");
00239
00240 myhist->GetXaxis()->SetBinLabel(5,"ZDC");
00241 myhist->SetBinContent(5,1,-1);
00242 myhist->SetOption("textcolz");
00243
00244
00245 return;
00246
00247 }
00248
00249
00250 void HcalSummaryClient::cleanup(void)
00251 {
00252
00253 if ( ! enableCleanup_ ) return;
00254
00255 MonitorElement* me;
00256
00257 if ( me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummary") )
00258 {
00259 dqmStore_->removeElement(me->getName());
00260 }
00261 }
00262
00263
00264 void HcalSummaryClient::incrementCounters(void)
00265 {
00266 ++ievt_;
00267 ++jevt_;
00268 return;
00269 }
00270
00271
00272 void HcalSummaryClient::analyze(void)
00273 {
00274 if (debug_>0)
00275 cout <<"<HcalSummaryClient::analyze> Running analyze..."<<endl;
00276 if ( ievt_ % 10 == 0 )
00277 {
00278 if ( debug_>1 )
00279 cout << "<HcalSummaryClient::analyze> ievt/jevt = " << ievt_ << "/" << jevt_ << endl;
00280 }
00281
00282
00283
00284 MonitorElement* simpleMap = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryMap");
00285 if (!simpleMap)
00286 {
00287 cout <<"<HcalSummaryClient::analyze> Could not get advancedReportSummaryMap!"<<endl;
00288 return;
00289 }
00290 for (int ix=1;ix<=5;++ix)
00291 simpleMap->setBinContent(ix,1,-1);
00292
00293 MonitorElement* reportMap = dqmStore_->get(prefixME_ + "/EventInfo/advancedReportSummaryMap");
00294
00295 for (int ieta=1;ieta<=etaBins_;++ieta)
00296 for (int iphi=1; iphi<=phiBins_;++iphi)
00297 reportMap->setBinContent(ieta,iphi,-1);
00298
00299
00300
00301
00302
00303 status_global_=-1;
00304 status_HB_=-1;
00305 status_HE_=-1;
00306 status_HO_=-1;
00307 status_HF_=-1;
00308 status_ZDC_=-1;
00309
00310
00311 MonitorElement* temp_present;
00312 if (HBpresent_==0)
00313 {
00314 temp_present = dqmStore_->get(prefixME_+"/DQM Job Status/HBpresent");
00315 if (temp_present)
00316 HBpresent_=temp_present->getIntValue();
00317 }
00318 if (HEpresent_==0)
00319 {
00320 temp_present = dqmStore_->get(prefixME_+"/DQM Job Status/HEpresent");
00321 if (temp_present)
00322 HEpresent_=temp_present->getIntValue();
00323 }
00324 if (HOpresent_==0)
00325 {
00326 temp_present = dqmStore_->get(prefixME_+"/DQM Job Status/HOpresent");
00327 if (temp_present)
00328 HOpresent_=temp_present->getIntValue();
00329 }
00330 if (HFpresent_==0)
00331 {
00332 temp_present = dqmStore_->get(prefixME_+"/DQM Job Status/HFpresent");
00333 if (temp_present)
00334 HFpresent_=temp_present->getIntValue();
00335 }
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347 if (debug_>1)
00348 cout <<"<HcalSummaryClient::analyze> HB present = "<<HBpresent_<<" "<<"HE present = "<<HEpresent_<<" "<<"HO present = "<<HOpresent_<<" "<<"HF present = "<<HFpresent_<<" ZDC present = "<<ZDCpresent_<<endl;
00349
00350 if (HBpresent_) status_HB_=0;
00351 if (HEpresent_) status_HE_=0;
00352 if (HOpresent_) status_HO_=0;
00353 if (HFpresent_) status_HF_=0;
00354 if (ZDCpresent_) status_ZDC_=0;
00355 if (HBpresent_ || HEpresent_ || HOpresent_ || HFpresent_ )
00356 status_global_=0;
00357
00358
00359 if (HBpresent_) resetSummaryPlot(1);
00360 if (HEpresent_) resetSummaryPlot(2);
00361 if (HOpresent_) resetSummaryPlot(3);
00362 if (HFpresent_) resetSummaryPlot(4);
00363
00364
00365 if (dataFormatMon_.IsOn()) analyze_subtask(dataFormatMon_);
00366 if (digiMon_.IsOn()) analyze_subtask(digiMon_);
00367 if (recHitMon_.IsOn()) analyze_subtask(recHitMon_);
00368 if (pedestalMon_.IsOn()) analyze_subtask(pedestalMon_);
00369 if (ledMon_.IsOn()) analyze_subtask(ledMon_);
00370 if (hotCellMon_.IsOn()) analyze_subtask(hotCellMon_);
00371 if (deadCellMon_.IsOn()) analyze_subtask(deadCellMon_);
00372 if (trigPrimMon_.IsOn()) analyze_subtask(trigPrimMon_);
00373 if (caloTowerMon_.IsOn()) analyze_subtask(caloTowerMon_);
00374
00375
00376
00377 int totalcells=0;
00378 std::map<std::string, int>::const_iterator it;
00379 if (HBpresent_)
00380 {
00381 status_global_+=status_HB_;
00382 it=subdetCells_.find("HB");
00383 totalcells+=it->second;
00384 status_HB_/=it->second;
00385 status_HB_=max(0.,1-status_HB_);
00386 }
00387 if (HEpresent_)
00388 {
00389 status_global_+=status_HE_;
00390 it=subdetCells_.find("HE");
00391 totalcells+=it->second;
00392 status_HE_/=it->second;
00393 status_HE_=max(0.,1-status_HE_);
00394 }
00395 if (HOpresent_)
00396 {
00397 status_global_+=status_HO_;
00398 it=subdetCells_.find("HO");
00399 totalcells+=it->second;
00400 status_HO_/=it->second;
00401 status_HO_=max(0.,1-status_HO_);
00402 }
00403 if (HFpresent_)
00404 {
00405 status_global_+=status_HF_;
00406 it=subdetCells_.find("HF");
00407 totalcells+=it->second;
00408 status_HF_/=it->second;
00409 status_HF_=max(0.,1-status_HF_);
00410 }
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423 if (totalcells==0)
00424 status_global_=-1;
00425 else
00426 {
00427 status_global_/=totalcells;
00428 status_global_=max(0.,1-status_global_);
00429
00430
00431 int eta,phi;
00432 for (int ieta=1;ieta<=etaBins_;++ieta)
00433 {
00434 eta=ieta+int(etaMin_)-1;
00435 for (int iphi=1; iphi<=phiBins_;++iphi)
00436 {
00437 if (reportMap->getBinContent(ieta,iphi)>-1)
00438 {
00439 phi=iphi+int(phiMin_)-1;
00440 if (abs(eta)>20 && phi%2!=1)
00441 continue;
00442 if (abs(eta)>39 &&phi%4!=3)
00443 continue;
00444 reportMap->setBinContent(ieta,iphi,max(0.,(double)(1-reportMap->getBinContent(ieta,iphi))));
00445
00446 if (fillUnphysical_)
00447 {
00448
00449
00450 if (abs(eta)>20 && abs(eta)<40 && phi%2==1 &&phi<73)
00451 {
00452 reportMap->setBinContent(ieta,iphi+1,reportMap->getBinContent(ieta,iphi));
00453 }
00454
00455
00456
00457 if (abs(eta)>39 && phi%4==3 && phi<73)
00458 {
00459 reportMap->setBinContent(ieta,iphi+1,reportMap->getBinContent(ieta,iphi));
00460 reportMap->setBinContent(ieta,iphi-1,reportMap->getBinContent(ieta,iphi));
00461 reportMap->setBinContent(ieta,iphi-2,reportMap->getBinContent(ieta,iphi));
00462 }
00463 }
00464 }
00465 }
00466 }
00467 }
00468
00469
00470 MonitorElement* me;
00471 dqmStore_->setCurrentFolder( prefixME_ + "/EventInfo" );
00472
00473 me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummary");
00474 if (me)
00475 {
00476 me->Fill(status_global_);
00477
00478 }
00479
00480 dqmStore_->setCurrentFolder( prefixME_ + "/EventInfo/reportSummaryContents" );
00481 if ( me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryContents/Hcal_HB") )
00482 {
00483 me->Fill(status_HB_);
00484 simpleMap->setBinContent(1,1,status_HB_);
00485 }
00486 if ( me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryContents/Hcal_HE") )
00487 {
00488 me->Fill(status_HE_);
00489 simpleMap->setBinContent(2,1,status_HE_);
00490 }
00491 if ( me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryContents/Hcal_HO") )
00492 {
00493 me->Fill(status_HO_);
00494 simpleMap->setBinContent(3,1,status_HO_);
00495 }
00496 if ( me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryContents/Hcal_HF") )
00497 {
00498 me->Fill(status_HF_);
00499 simpleMap->setBinContent(4,1,status_HF_);
00500 }
00501
00502 if ( me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryContents/Hcal_ZDC") )
00503 {
00504 me->Fill(status_ZDC_);
00505 simpleMap->setBinContent(5,1,status_ZDC_);
00506 }
00507
00508 dqmStore_->setCurrentFolder( prefixME_);
00509
00510 return;
00511 }
00512
00513
00514 void HcalSummaryClient::analyze_subtask(SubTaskSummaryStatus &s)
00515 {
00516 double HBstatus=0;
00517 double HEstatus=0;
00518 double HOstatus=0;
00519 double HFstatus=0;
00520 double ZDCstatus=-1;
00521 double ALLstatus=0;
00522
00523 double etamin, etamax, phimin, phimax;
00524 int etabins, phibins;
00525 int eta, phi;
00526 double bincontent;
00527
00528 ostringstream name;
00529 MonitorElement* me;
00530 TH2F* hist;
00531 MonitorElement* reportMap = dqmStore_->get(prefixME_ + "/EventInfo/advancedReportSummaryMap");
00532
00533
00534 if (HBpresent_ || HFpresent_)
00535 {
00536 name.str("");
00537 name <<prefixME_<<"/"<<s.problemDir<<"/"<<"HB HF Depth 1 "<<s.problemName;
00538 me=dqmStore_->get(name.str().c_str());
00539
00540 if (me)
00541 {
00542 hist=me->getTH2F();
00543 etabins=hist->GetNbinsX();
00544 phibins=hist->GetNbinsY();
00545 etamin=hist->GetXaxis()->GetXmin();
00546 etamax=hist->GetXaxis()->GetXmax();
00547 phimin=hist->GetYaxis()->GetXmin();
00548 phimax=hist->GetYaxis()->GetXmax();
00549 for (int ieta=1;ieta<=etabins;++ieta)
00550 {
00551 for (int iphi=1; iphi<=phibins;++iphi)
00552 {
00553 bincontent=hist->GetBinContent(ieta,iphi);
00554 if (bincontent>0)
00555 {
00556 eta=ieta+int(etamin)-1;
00557 phi=iphi+int(phimin)-1;
00558 reportMap->Fill(eta,phi,bincontent);
00559 if (abs(eta)<17 && HBpresent_)
00560 {
00561 HBstatus+=bincontent;
00562 }
00563 else if (HFpresent_)
00564 {
00565 if (phi%2==0) continue;
00566 if (abs(eta)>39 && phi%4!=3) continue;
00567 HFstatus+=bincontent;
00568 }
00569 }
00570 }
00571 }
00572 }
00573 }
00574
00575
00576 if (HBpresent_ || HFpresent_)
00577 {
00578 name.str("");
00579 name <<prefixME_<<"/"<<s.problemDir<<"/"<<"HB HF Depth 2 "<<s.problemName;
00580 me=dqmStore_->get(name.str().c_str());
00581
00582 if (me)
00583 {
00584 hist=me->getTH2F();
00585 etabins=hist->GetNbinsX();
00586 phibins=hist->GetNbinsY();
00587 etamin=hist->GetXaxis()->GetXmin();
00588 etamax=hist->GetXaxis()->GetXmax();
00589 phimin=hist->GetYaxis()->GetXmin();
00590 phimax=hist->GetYaxis()->GetXmax();
00591 for (int ieta=1;ieta<=etabins;++ieta)
00592 {
00593 for (int iphi=1; iphi<=phibins;++iphi)
00594 {
00595 bincontent=hist->GetBinContent(ieta,iphi);
00596 if (bincontent>0)
00597 {
00598 eta=ieta+int(etamin)-1;
00599 phi=iphi+int(phimin)-1;
00600 reportMap->Fill(eta,phi,bincontent);
00601 if (abs(eta)<17 && HBpresent_)
00602 {
00603 HBstatus+=bincontent;
00604 }
00605 else if (HFpresent_)
00606 {
00607 if (phi%2==0) continue;
00608 if (abs(eta)>39 && phi%4!=3) continue;
00609 HFstatus+=bincontent;
00610 }
00611 }
00612 }
00613 }
00614 }
00615 }
00616
00617
00618 if (HOpresent_ || ZDCpresent_)
00619 {
00620 name.str("");
00621 name <<prefixME_<<"/"<<s.problemDir<<"/"<<"HO ZDC "<<s.problemName;
00622 me=dqmStore_->get(name.str().c_str());
00623
00624 if (me)
00625 {
00626 hist=me->getTH2F();
00627 etabins=hist->GetNbinsX();
00628 phibins=hist->GetNbinsY();
00629 etamin=hist->GetXaxis()->GetXmin();
00630 etamax=hist->GetXaxis()->GetXmax();
00631 phimin=hist->GetYaxis()->GetXmin();
00632 phimax=hist->GetYaxis()->GetXmax();
00633 for (int ieta=1;ieta<=etabins;++ieta)
00634 {
00635 for (int iphi=1; iphi<=phibins;++iphi)
00636 {
00637 bincontent=hist->GetBinContent(ieta,iphi);
00638 if (bincontent>0)
00639 {
00640 eta=ieta+int(etamin)-1;
00641 phi=iphi+int(phimin)-1;
00642 reportMap->Fill(eta,phi,bincontent);
00643 if (abs(eta)<42 && HOpresent_)
00644 {
00645 HOstatus+=bincontent;
00646 }
00647 else if (ZDCpresent_)
00648 {
00649 ZDCstatus+=bincontent;
00650 }
00651 }
00652 }
00653 }
00654 }
00655 }
00656
00657
00658 if (HEpresent_)
00659 {
00660 name.str("");
00661 name <<prefixME_<<"/"<<s.problemDir<<"/"<<"HE Depth 1 "<<s.problemName;
00662 me=dqmStore_->get(name.str().c_str());
00663
00664 if (me)
00665 {
00666 hist=me->getTH2F();
00667 etabins=hist->GetNbinsX();
00668 phibins=hist->GetNbinsY();
00669 etamin=hist->GetXaxis()->GetXmin();
00670 etamax=hist->GetXaxis()->GetXmax();
00671 phimin=hist->GetYaxis()->GetXmin();
00672 phimax=hist->GetYaxis()->GetXmax();
00673 for (int ieta=1;ieta<=etabins;++ieta)
00674 {
00675 for (int iphi=1; iphi<=phibins;++iphi)
00676 {
00677 phi=iphi+int(phimin)-1;
00678 if (phi%2==0) continue;
00679
00680 bincontent=hist->GetBinContent(ieta,iphi);
00681 if (bincontent>0)
00682 {
00683 eta=ieta+int(etamin)-1;
00684 reportMap->Fill(eta,phi,bincontent);
00685 HEstatus+=bincontent;
00686 }
00687 }
00688 }
00689 }
00690 }
00691
00692
00693 if (HEpresent_)
00694 {
00695 name.str("");
00696 name <<prefixME_<<"/"<<s.problemDir<<"/"<<"HE Depth 2 "<<s.problemName;
00697 me=dqmStore_->get(name.str().c_str());
00698
00699 if (me)
00700 {
00701 hist=me->getTH2F();
00702 etabins=hist->GetNbinsX();
00703 phibins=hist->GetNbinsY();
00704 etamin=hist->GetXaxis()->GetXmin();
00705 etamax=hist->GetXaxis()->GetXmax();
00706 phimin=hist->GetYaxis()->GetXmin();
00707 phimax=hist->GetYaxis()->GetXmax();
00708 for (int ieta=1;ieta<=etabins;++ieta)
00709 {
00710 for (int iphi=1; iphi<=phibins;++iphi)
00711 {
00712 phi=iphi+int(phimin)-1;
00713 if (phi%2==0) continue;
00714 bincontent=hist->GetBinContent(ieta,iphi);
00715 if (bincontent>0)
00716 {
00717 eta=ieta+int(etamin)-1;
00718 reportMap->Fill(eta,phi,bincontent);
00719 HEstatus+=bincontent;
00720 }
00721 }
00722 }
00723 }
00724 }
00725
00726
00727 if (HEpresent_)
00728 {
00729 name.str("");
00730 name <<prefixME_<<"/"<<s.problemDir<<"/"<<"HE Depth 3 "<<s.problemName;
00731 me=dqmStore_->get(name.str().c_str());
00732
00733 if (me)
00734 {
00735 hist=me->getTH2F();
00736 etabins=hist->GetNbinsX();
00737 phibins=hist->GetNbinsY();
00738 etamin=hist->GetXaxis()->GetXmin();
00739 etamax=hist->GetXaxis()->GetXmax();
00740 phimin=hist->GetYaxis()->GetXmin();
00741 phimax=hist->GetYaxis()->GetXmax();
00742 for (int ieta=1;ieta<=etabins;++ieta)
00743 {
00744 for (int iphi=1; iphi<=phibins;++iphi)
00745 {
00746 phi=iphi+int(phimin)-1;
00747 if (phi%2==0) continue;
00748 bincontent=hist->GetBinContent(ieta,iphi);
00749 if (bincontent>0)
00750 {
00751 eta=ieta+int(etamin)-1;
00752 phi=iphi+int(phimin)-1;
00753 reportMap->Fill(eta,phi,bincontent);
00754 HEstatus+=bincontent;
00755 }
00756 }
00757 }
00758 }
00759 }
00760
00761 ALLstatus=HBstatus+HEstatus+HOstatus+HFstatus;
00762 int totalcells=0;
00763 std::map<std::string, int>::const_iterator it;
00764 if (HBpresent_)
00765 {
00766 status_HB_+=HBstatus;
00767 it=subdetCells_.find("HB");
00768 totalcells+=it->second;
00769 HBstatus/=it->second;
00770 HBstatus=1-HBstatus;
00771 if (HBstatus<0) HBstatus=0;
00772 s.status[0]=HBstatus;
00773 }
00774 if (HEpresent_)
00775 {
00776 status_HE_+=HEstatus;
00777 it=subdetCells_.find("HE");
00778 totalcells+=it->second;
00779 HEstatus/=it->second;
00780 HEstatus=1-HEstatus;
00781 if (HEstatus<0)
00782 HEstatus=0;
00783 s.status[1]=HEstatus;
00784 }
00785
00786 if (HOpresent_)
00787 {
00788 status_HO_+=HOstatus;
00789 it=subdetCells_.find("HO");
00790 totalcells+=it->second;
00791 HOstatus/=it->second;
00792 HOstatus=1-HOstatus;
00793 if (HOstatus<0)
00794 HOstatus=0;
00795 s.status[2]=HOstatus;
00796 }
00797 if (HFpresent_)
00798 {
00799 status_HF_+=HFstatus;
00800 it=subdetCells_.find("HF");
00801 totalcells+=it->second;
00802 HFstatus/=it->second;
00803 HFstatus=1-HFstatus;
00804 if (HFstatus<0)
00805 HFstatus=0;
00806 s.status[3]=HFstatus;
00807 }
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821 if (totalcells>0)
00822 {
00823 ALLstatus/=totalcells;
00824 ALLstatus=1-ALLstatus;
00825 if (ALLstatus<0)
00826 ALLstatus=0;
00827 s.ALLstatus=ALLstatus;
00828 }
00829
00830 if (debug_>0)
00831 {
00832 cout <<s.problemDir<<endl;
00833 cout <<"HB = "<<HBstatus<<endl;
00834 cout <<"HE = "<<HEstatus<<endl;
00835 cout <<"HO = "<<HOstatus<<endl;
00836 cout <<"HF = "<<HFstatus<<endl;
00837 cout <<"TOTAL = "<<s.ALLstatus<<endl;
00838 cout <<"sumHB = "<<status_HB_<<endl;
00839 cout <<"sumHE = "<<status_HE_<<endl;
00840 cout <<"sumHO = "<<status_HO_<<endl;
00841 cout <<"sumHF = "<<status_HF_<<endl;
00842 cout <<"________________"<<endl;
00843
00844 }
00845
00846 return;
00847 }
00848
00849
00850
00851 void HcalSummaryClient::resetSummaryPlot(int Subdet)
00852 {
00853 MonitorElement* reportMap = dqmStore_->get(prefixME_ + "/EventInfo/advancedReportSummaryMap");
00854 if (!reportMap)
00855 {
00856 cout <<"<HcalSummaryClient::resetSummaryPlot> Could not get advancedReportSummaryMap!"<<endl;
00857 return;
00858 }
00859 TH2F* hist=reportMap->getTH2F();
00860 int etabins=hist->GetNbinsX();
00861 int phibins=hist->GetNbinsY();
00862 double etamin=hist->GetXaxis()->GetXmin();
00863 double phimin=hist->GetYaxis()->GetXmin();
00864 int eta,phi;
00865
00866
00867
00868 for (int ieta=1;ieta<=etabins;++ieta)
00869 {
00870 for (int iphi=1; iphi<=phibins;++iphi)
00871 {
00872 for (int d=1;d<=4;++d)
00873 {
00874 eta=ieta+int(etamin)-1;
00875 phi=iphi+int(phimin)-1;
00876 if (validDetId((HcalSubdetector)Subdet,eta,phi,d))
00877 hist->SetBinContent(ieta,iphi,0.);
00878 }
00879
00880 }
00881 }
00882 return;
00883 }
00884
00885
00886 void HcalSummaryClient::htmlOutput(int& run, time_t& mytime, int& minlumi, int& maxlumi, string& htmlDir, string& htmlName)
00887 {
00888
00889 if (debug_) cout << "Preparing HcalSummaryClient html output ..." << endl;
00890
00891 htmlFile.open((htmlDir + htmlName).c_str());
00892
00893
00894 htmlFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> " << endl;
00895 htmlFile << "<html> " << endl;
00896 htmlFile << "<head> " << endl;
00897 htmlFile << " <meta content=\"text/html; charset=ISO-8859-1\" " << endl;
00898 htmlFile << " https-equiv=\"content-type\"> " << endl;
00899 htmlFile << " <title>Monitor:Summary output</title> " << endl;
00900 htmlFile << "</head> " << endl;
00901 htmlFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << endl;
00902 htmlFile << "<body> " << endl;
00903
00904 htmlFile << "<a name=""top""></a>" << endl;
00905 htmlFile << "<h2>Run: " << endl;
00906 htmlFile << " <span " << endl;
00907 htmlFile << " style=\"color: rgb(0, 0, 153);\">" << run << "</span>" << endl;
00908
00909 std::string startTime=ctime(&mytime);
00910 htmlFile << " LS: " << endl;
00911 htmlFile << "<span style=\"color: rgb(0, 0, 153);\">" << minlumi << "</span>" << endl;
00912 htmlFile << "-" << endl;
00913 htmlFile << "<span style=\"color: rgb(0, 0, 153);\">" << maxlumi << "</span>" << endl;
00914 htmlFile << " Start Time: <spa\n style=\"color: rgb(0, 0, 153);\">" << startTime << "</span></h2> " << endl;
00915
00916 htmlFile << "<h2>Monitoring task: <span " << endl;
00917 htmlFile << " style=\"color: rgb(0, 0, 153);\">SUMMARY</span> </h2> " << endl;
00918
00919
00920 htmlFile << "<h2>Events processed: " << endl;
00921 htmlFile << " <span " << endl;
00922 htmlFile << " style=\"color: rgb(0, 0, 153);\">" << ievt_ << "</span></h2>" << endl;
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934 TH2F* obj2f;
00935 std::string imgNameMap="";
00936 std::string imgName;
00937 gStyle->SetPaintTextFormat("+g");
00938
00939
00940 MonitorElement* me;
00941 me = dqmStore_->get(prefixME_ + "/EventInfo/advancedReportSummaryMap");
00942 obj2f = me->getTH2F();
00943
00944 me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryMap");
00945 TH2F* simple2f = me->getTH2F();
00946
00947
00948 static int pcol[40];
00949 float rgb[20][3];
00950
00951 for( int i=0; i<20; ++i )
00952 {
00953
00954 pcol[i]=18;
00955 if ( i < 17 )
00956 {
00957 rgb[i][0] = 0.80+0.01*i;
00958 rgb[i][1] = 0.00+0.03*i;
00959 rgb[i][2] = 0.00;
00960 }
00961 else if ( i < 19 )
00962 {
00963 rgb[i][0] = 0.80+0.01*i;
00964 rgb[i][1] = 0.00+0.03*i+0.15+0.10*(i-17);
00965 rgb[i][2] = 0.00;
00966 } else if ( i == 19 )
00967 {
00968 rgb[i][0] = 0.00;
00969 rgb[i][1] = 0.80;
00970 rgb[i][2] = 0.00;
00971 }
00972 pcol[20+i] = 1101+i;
00973 TColor* color = gROOT->GetColor( 1101+i );
00974 if( ! color ) color = new TColor(1101+i, 0, 0, 0, "" );
00975 color->SetRGB( rgb[i][0], rgb[i][1], rgb[i][2] );
00976 }
00977
00978 gStyle->SetPalette(40, pcol);
00979 gStyle->SetOptStat(0);
00980 if( obj2f )
00981 {
00982 obj2f->SetMinimum(-1.);
00983 obj2f->SetMaximum(+1.0);
00984 obj2f->SetOption("colz");
00985 }
00986
00987 if (obj2f)
00988 {
00989 htmlFile << "<table width=100% border=1><tr>" << endl;
00990 htmlFile << "<tr align=\"center\">" << endl;
00991 htmlAnyHisto(run,obj2f,"i#eta","i#phi",92,htmlFile,htmlDir);
00992 htmlAnyHisto(run,simple2f,"","",92,htmlFile,htmlDir);
00993 htmlFile <<"</tr></table>"<<endl;
00994
00995 }
00996
00997
00998
00999
01000 htmlFile<<"<hr><br><h2>Summary Values for Each Subdetector</h2><br>"<<endl;
01001 htmlFile << "<table border=\"2\" cellspacing=\"0\" " << endl;
01002 htmlFile << "cellpadding=\"10\" align=\"center\"> " << endl;
01003 htmlFile << "<tr align=\"center\">" << endl;
01004 htmlFile <<"<td>Task</td><td>HB</td><td>HE</td><td>HO</td><td>HF</td><td>ZDC</td><td>HCAL</td></tr>"<<endl;
01005 if (dataFormatMon_.onoff)
01006 htmlFile<<"<td>Data Format Monitor</td><td>"<<dataFormatMon_.status[0]<<"</td><td>"<<dataFormatMon_.status[1]<<"</td><td>"<<dataFormatMon_.status[2]<<"</td><td>"<<dataFormatMon_.status[3]<<"</td><td>"<<dataFormatMon_.status[4]<<"</td><td>"<<dataFormatMon_.ALLstatus<<"</td></tr>"<<endl;
01007 if (digiMon_.onoff)
01008 htmlFile<<"<td>Digi Monitor</td><td>"<<digiMon_.status[0]<<"</td><td>"<<digiMon_.status[1]<<"</td><td>"<<digiMon_.status[2]<<"</td><td>"<<digiMon_.status[3]<<"</td><td>"<<digiMon_.status[4]<<"</td><td>"<<digiMon_.ALLstatus<<"</td></tr>"<<endl;
01009 if (recHitMon_.onoff)
01010 htmlFile<<"<td>Rec Hit Monitor</td><td>"<<recHitMon_.status[0]<<"</td><td>"<<recHitMon_.status[1]<<"</td><td>"<<recHitMon_.status[2]<<"</td><td>"<<recHitMon_.status[3]<<"</td><td>"<<recHitMon_.status[4]<<"</td><td>"<<recHitMon_.ALLstatus<<"</td></tr>"<<endl;
01011 if (pedestalMon_.onoff)
01012 htmlFile<<"<td>Pedestal Monitor</td><td>"<<pedestalMon_.status[0]<<"</td><td>"<<pedestalMon_.status[1]<<"</td><td>"<<pedestalMon_.status[2]<<"</td><td>"<<pedestalMon_.status[3]<<"</td><td>"<<pedestalMon_.status[4]<<"</td><td>"<<pedestalMon_.ALLstatus<<"</td></tr>"<<endl;
01013 if (ledMon_.onoff)
01014 htmlFile<<"<td>LED Monitor</td><td>"<<ledMon_.status[0]<<"</td><td>"<<ledMon_.status[1]<<"</td><td>"<<ledMon_.status[2]<<"</td><td>"<<ledMon_.status[3]<<"</td><td>"<<ledMon_.status[4]<<"</td><td>"<<ledMon_.ALLstatus<<"</td></tr>"<<endl;
01015 if (hotCellMon_.onoff)
01016 htmlFile<<"<td>Hot Cell Monitor</td><td>"<<hotCellMon_.status[0]<<"</td><td>"<<hotCellMon_.status[1]<<"</td><td>"<<hotCellMon_.status[2]<<"</td><td>"<<hotCellMon_.status[3]<<"</td><td>"<<hotCellMon_.status[4]<<"</td><td>"<<hotCellMon_.ALLstatus<<"</td></tr>"<<endl;
01017 if (deadCellMon_.onoff)
01018 htmlFile<<"<td>Dead Cell Monitor</td><td>"<<deadCellMon_.status[0]<<"</td><td>"<<deadCellMon_.status[1]<<"</td><td>"<<deadCellMon_.status[2]<<"</td><td>"<<deadCellMon_.status[3]<<"</td><td>"<<deadCellMon_.status[4]<<"</td><td>"<<deadCellMon_.ALLstatus<<"</td></tr>"<<endl;
01019 if (trigPrimMon_.onoff)
01020 htmlFile<<"<td>Trigger Primitive Monitor</td><td>"<<trigPrimMon_.status[0]<<"</td><td>"<<trigPrimMon_.status[1]<<"</td><td>"<<trigPrimMon_.status[2]<<"</td><td>"<<trigPrimMon_.status[3]<<"</td><td>"<<trigPrimMon_.status[4]<<"</td><td>"<<trigPrimMon_.ALLstatus<<"</td></tr>"<<endl;
01021 if (caloTowerMon_.onoff)
01022 htmlFile<<"<td>CaloTower Monitor</td><td>"<<caloTowerMon_.status[0]<<"</td><td>"<<caloTowerMon_.status[1]<<"</td><td>"<<caloTowerMon_.status[2]<<"</td><td>"<<caloTowerMon_.status[3]<<"</td><td>"<<caloTowerMon_.status[4]<<"</td><td>"<<caloTowerMon_.ALLstatus<<"</td></tr>"<<endl;
01023
01024 htmlFile<<"<td><font color = \"blue\">Overall Status</font></td>"<<"<td><font color = \"blue\">"<<status_HB_<<"</font></td><td><font color = \"blue\">"<<status_HE_<<"</font></td><td><font color = \"blue\">"<<status_HO_<<"</font></td><td><font color = \"blue\">"<<status_HF_<<"</font></td><td><font color = \"blue\">"<< status_ZDC_<<"</font></td><td><font color = \"blue\">"<< status_global_<<"</font></td></tr>"<<endl;
01025 htmlFile <<"</tr></table>"<<endl;
01026
01027 htmlFile <<"<br><h2> A note on Status Values </h2><br>"<<endl;
01028 htmlFile <<"Status values in each subdetector task represent the average fraction of good channels per event. (For example, a value of .99 in the HB Hot Cell monitor means that, on average, 1% of the cells in HB are hot.) Status values should range from 0 to 1, with a perfectly-functioning detector will have all status values = 1. If the status is unknown, a value of -1 or \"--\" will be shown. <br>"<<endl;
01029 htmlFile <<"<br>The HCAL status values for each task are a weighted average from each subdetector. Weights are assigned as (# of cells in the subdetector)/(total # of cells being checked).<br>"<<endl;
01030 htmlFile <<"<br>The overall Status Values at the bottom of the table are a combination of the individual status values. These values are not quite the same as the overall fraction of good channels in an event, because of ambiguities in the eta-phi plots. (The summary code does not store the results of monitor tests on individual events, and thus can't tell the difference between a run where the digi monitor failed in the first half of events and the dead cell monitor failed the second half and a run in which the digi and dead cell monitors were both bad only for the first 50% of the run. For the moment, the errors from the different monitors are added together, but this can lead to double-counting, and an overall status value less than the individual values.)"<<endl;
01031
01032 htmlFile <<"<br><hr><br>"<<endl;
01033 htmlFile <<"Run #: "<<run<<"   Starting Time: "<<startTime<<" ";
01034 htmlFile<<"Luminosity blocks: "<<minlumi<<" - "<<maxlumi <<"  ";
01035 htmlFile <<"# of events: "<<ievt_<<"  ";
01036 if (dataFormatMon_.onoff)
01037 htmlFile <<" Data Format Status: HB: "<<dataFormatMon_.status[0]<<" HE: "<<dataFormatMon_.status[1]<<" HO: "<<dataFormatMon_.status[2]<<" HF: "<<dataFormatMon_.status[3]<<" ZDC: "<<dataFormatMon_.status[4]<<endl;
01038 if (digiMon_.onoff)
01039 htmlFile <<" Digi Monitor Status: HB: "<<digiMon_.status[0]<<" HE: "<<digiMon_.status[1]<<" HO: "<<digiMon_.status[2]<<" HF: "<<digiMon_.status[3]<<" ZDC: "<<digiMon_.status[4]<<endl;
01040 if (recHitMon_.onoff)
01041 htmlFile <<" RecHit Monitor Status: HB: "<<recHitMon_.status[0]<<" HE: "<<recHitMon_.status[1]<<" HO: "<<recHitMon_.status[2]<<" HF: "<<recHitMon_.status[3]<<" ZDC: "<<recHitMon_.status[4]<<endl;
01042 if (pedestalMon_.onoff)
01043 htmlFile <<" Pedestal Monitor Status: HB: "<<pedestalMon_.status[0]<<" HE: "<<pedestalMon_.status[1]<<" HO: "<<pedestalMon_.status[2]<<" HF: "<<pedestalMon_.status[3]<<" ZDC: "<<pedestalMon_.status[4]<<endl;
01044 if (ledMon_.onoff)
01045 htmlFile <<" LED Monitor Status: HB: "<<ledMon_.status[0]<<" HE: "<<ledMon_.status[1]<<" HO: "<<ledMon_.status[2]<<" HF: "<<ledMon_.status[3]<<" ZDC: "<<ledMon_.status[4]<<endl;
01046 if (hotCellMon_.onoff)
01047 htmlFile <<" Hot Cell Monitor Status: HB: "<<hotCellMon_.status[0]<<" HE: "<<hotCellMon_.status[1]<<" HO: "<<hotCellMon_.status[2]<<" HF: "<<hotCellMon_.status[3]<<" ZDC: "<<hotCellMon_.status[4]<<endl;
01048 if (deadCellMon_.onoff)
01049 htmlFile <<" Dead Cell Monitor Status: HB: "<<deadCellMon_.status[0]<<" HE: "<<deadCellMon_.status[1]<<" HO: "<<deadCellMon_.status[2]<<" HF: "<<deadCellMon_.status[3]<<" ZDC: "<<deadCellMon_.status[4]<<endl;
01050 if (trigPrimMon_.onoff)
01051 htmlFile <<" Trigger Primitive Monitor Status: HB: "<<trigPrimMon_.status[0]<<" HE: "<<trigPrimMon_.status[1]<<" HO: "<<trigPrimMon_.status[2]<<" HF: "<<trigPrimMon_.status[3]<<" ZDC: "<<trigPrimMon_.status[4]<<endl;
01052 if (caloTowerMon_.onoff)
01053 htmlFile <<" CaloTower Monitor Status: HB: "<<caloTowerMon_.status[0]<<" HE: "<<caloTowerMon_.status[1]<<" HO: "<<caloTowerMon_.status[2]<<" HF: "<<caloTowerMon_.status[3]<<" ZDC: "<<caloTowerMon_.status[4]<<endl;
01054 htmlFile <<" OVERALL STATUS: "<<status_global_<<endl;
01055 htmlFile.close();
01056 }