00001 #include "DQM/HcalMonitorClient/interface/HcalSummaryClient.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 "DQM/HcalMonitorClient/interface/HcalBaseDQClient.h"
00010 #include "DQM/HcalMonitorTasks/interface/HcalEtaPhiHists.h"
00011 #include "DQMServices/Core/interface/MonitorElement.h"
00012
00013 #include <iostream>
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 HcalSummaryClient::HcalSummaryClient(std::string myname)
00025 {
00026 name_=myname;
00027 SummaryMapByDepth=0;
00028 minevents_=0;
00029 minerrorrate_=0;
00030 badChannelStatusMask_=0;
00031 ProblemCells=0;
00032 ProblemCellsByDepth=0;
00033 StatusVsLS_=0;
00034 certificationMap_=0;
00035 reportMap_=0;
00036 reportMapShift_=0;
00037 }
00038
00039 HcalSummaryClient::HcalSummaryClient(std::string myname, const edm::ParameterSet& ps)
00040 {
00041 name_=myname;
00042 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
00043 debug_ = ps.getUntrackedParameter<int>("debug",0);
00044 prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
00045 if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
00046 prefixME_.append("/");
00047 subdir_ = ps.getUntrackedParameter<std::string>("SummaryFolder","EventInfo/");
00048 if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
00049 subdir_.append("/");
00050 subdir_=prefixME_+subdir_;
00051 cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00052
00053 NLumiBlocks_ = ps.getUntrackedParameter<int>("NLumiBlocks",4000);
00054 UseBadChannelStatusInSummary_ = ps.getUntrackedParameter<bool>("UseBadChannelStatusInSummary",false);
00055
00056
00057 badChannelStatusMask_ = ps.getUntrackedParameter<int>("Summary_BadChannelStatusMask",
00058 ps.getUntrackedParameter<int>("BadChannelStatusMask",0));
00059 minerrorrate_ = ps.getUntrackedParameter<double>("Summary_minerrorrate",
00060 ps.getUntrackedParameter<double>("minerrorrate",0));
00061 minevents_ = ps.getUntrackedParameter<int>("Summary_minevents",
00062 ps.getUntrackedParameter<int>("minevents",0));
00063 Online_ = ps.getUntrackedParameter<bool>("online",false);
00064
00065 SummaryMapByDepth=0;
00066 ProblemCells=0;
00067 ProblemCellsByDepth=0;
00068 StatusVsLS_=0;
00069 certificationMap_=0;
00070 reportMap_=0;
00071 reportMapShift_=0;
00072 }
00073
00074 void HcalSummaryClient::analyze(int LS)
00075 {
00076 if (debug_>2) std::cout <<"\tHcalSummaryClient::analyze()"<<std::endl;
00077
00078
00079
00080
00081 status_global_=-1;
00082 status_HB_=-1;
00083 status_HE_=-1;
00084 status_HO_=-1;
00085 status_HF_=-1;
00086
00087 status_HO0_=-1;
00088 status_HO12_=-1;
00089 status_HFlumi_=-1;
00090 status_global_=-1;
00091
00092 if (EnoughEvents_!=0) EnoughEvents_->Reset();
00093 enoughevents_=true;
00094 for (std::vector<HcalBaseDQClient*>::size_type i=0;i<clients_.size();++i)
00095 {
00096 if (debug_>2) std::cout <<"<HcalSummaryClient::analyze> CLIENT = "<<clients_[i]->name_<<" ENOUGH = "<<clients_[i]->enoughevents_<<std::endl;
00097 enoughevents_&=clients_[i]->enoughevents_;
00098 if (EnoughEvents_!=0) EnoughEvents_->setBinContent(i+1,clients_[i]->enoughevents_);
00099 {
00100 if (clients_[i]->enoughevents_==false && debug_>1)
00101 std::cout <<"Failed enoughevents test for monitor "<<clients_[i]->name()<<std::endl;
00102 }
00103 }
00104
00105
00106 MonitorElement* temp_present;
00107 if (HBpresent_!=1)
00108 {
00109 temp_present=dqmStore_->get(prefixME_+"HcalInfo/HBpresent");
00110 if (temp_present!=0)
00111 HBpresent_=temp_present->getIntValue();
00112 }
00113 if (HEpresent_!=1)
00114 {
00115 temp_present=dqmStore_->get(prefixME_+"HcalInfo/HEpresent");
00116 if (temp_present!=0)
00117 HEpresent_=temp_present->getIntValue();
00118 }
00119 if (HOpresent_!=1)
00120 {
00121 temp_present=dqmStore_->get(prefixME_+"HcalInfo/HOpresent");
00122 if (temp_present!=0)
00123 HOpresent_=temp_present->getIntValue();
00124 }
00125 if (HFpresent_!=1)
00126 {
00127 temp_present=dqmStore_->get(prefixME_+"HcalInfo/HFpresent");
00128 if (temp_present!=0)
00129 HFpresent_=temp_present->getIntValue();
00130 }
00131
00132 if (debug_>1)
00133 std::cout <<"<HcalSummaryClient::analyze> HB present = "<<HBpresent_<<" "<<"HE present = "<<HEpresent_<<" "<<"HO present = "<<HOpresent_<<" "<<"HF present = "<<HFpresent_<<std::endl;
00134
00135 if (enoughevents_==false)
00136 {
00137 if (debug_>0) std::cout <<"<HcalSummaryClient::analyze> Not enough events processed to evaluate summary status!"<<std::endl;
00138
00139
00140
00141
00142
00143
00144
00145 if (HBpresent_>0) status_HB_=1;
00146 else status_HB_=-1;
00147 if (HEpresent_>0) status_HE_=1;
00148 else status_HE_=-1;
00149 if (HOpresent_>0) status_HO_=1;
00150 else status_HO_=-1;
00151 if (HFpresent_>0) status_HF_=1;
00152 else status_HF_=-1;
00153
00154
00155 if (HBpresent_<=0 && HEpresent_<=0 && HOpresent_<=0 && HFpresent_<=0)
00156 status_global_=-1;
00157 else
00158 status_global_=1;
00159
00160
00161 status_HO0_ = status_HO_;
00162 status_HO12_ = status_HO_;
00163 status_HFlumi_ = status_HF_;
00164
00165 if (debug_>1)
00166 {
00167 std::cout <<"Insufficient events processed. Subdetector status is:"<<std::endl;
00168 std::cout<<"\tHB: "<<status_HB_<<std::endl;
00169 std::cout<<"\tHE: "<<status_HE_<<std::endl;
00170 std::cout<<"\tHO: "<<status_HO_<<std::endl;
00171 std::cout<<"\tHF: "<<status_HF_<<std::endl;
00172 std::cout<<"\tHO0: "<<status_HO0_<<std::endl;
00173 std::cout<<"\tHO12: "<<status_HO12_<<std::endl;
00174 std::cout<<"\tHFlumi: "<<status_HFlumi_<<std::endl;
00175 }
00176
00177 fillReportSummary(LS);
00178 return;
00179 }
00180 if (EnoughEvents_!=0) EnoughEvents_->setBinContent(clients_.size()+1,1);
00181
00182
00183 if (HBpresent_>0) status_HB_=0;
00184 if (HEpresent_>0) status_HE_=0;
00185 if (HOpresent_>0) {status_HO_=0; status_HO0_=0; status_HO12_=0;}
00186 if (HFpresent_>0) {status_HF_=0; status_HFlumi_=0;}
00187
00188 if (HBpresent_>0 || HEpresent_>0 ||
00189 HOpresent_>0 || HFpresent_>0 )
00190 status_global_=0;
00191
00192
00193
00194 double localHB[20]={0};
00195 double localHE[20]={0};
00196 double localHF[20]={0};
00197 double localHO[20]={0};
00198 double localHFlumi[20]={0};
00199 double localHO0[20]={0};
00200 double localHO12[20]={0};
00201
00202
00203 if (SummaryMapByDepth==0)
00204 {
00205 if (debug_>0)
00206 std::cout <<"<HcalSummaryClient::analyze> ERROR: SummaryMapByDepth can't be found!"<<std::endl;
00207 }
00208 else
00209 {
00210 for (unsigned int i=0;i<(SummaryMapByDepth->depth).size();++i)
00211 SummaryMapByDepth->depth[i]->Reset();
00212
00213 int etabins=-9999;
00214 int phibins=-9999;
00215
00216
00217 std::vector<MonitorElement*> chStat;
00218 chStat.push_back(dqmStore_->get(prefixME_+"HcalInfo/ChannelStatus/HB HE HF Depth 1 ChannelStatus"));
00219 chStat.push_back(dqmStore_->get(prefixME_+"HcalInfo/ChannelStatus/HB HE HF Depth 2 ChannelStatus"));
00220 chStat.push_back(dqmStore_->get(prefixME_+"HcalInfo/ChannelStatus/HE Depth 3 ChannelStatus"));
00221 chStat.push_back(dqmStore_->get(prefixME_+"HcalInfo/ChannelStatus/HO Depth 4 ChannelStatus"));
00222
00223
00224 for (int d=0;d<4;++d)
00225 {
00226 etabins=(SummaryMapByDepth->depth[d])->getNbinsX();
00227 phibins=(SummaryMapByDepth->depth[d])->getNbinsY();
00228 for (int eta=1;eta<=etabins;++eta)
00229 {
00230 int ieta=CalcIeta(eta-1,d+1);
00231 for (int phi=1;phi<=phibins;++phi)
00232 {
00233
00234
00235
00236 if (abs(ieta)>20 && phi%2==0) continue;
00237 if (abs(ieta)>39 && phi%4!=3) continue;
00238
00239
00240
00241
00242 for (unsigned int cl=0;cl<clients_.size();++cl)
00243 {
00244 if (clients_[cl]->ProblemCellsByDepth==0) continue;
00245
00246 if ((clients_[cl]->ProblemCellsByDepth)->depth[d]==0) continue;
00247 if ((clients_[cl]->ProblemCellsByDepth)->depth[d]->getBinContent(eta,phi)>clients_[cl]->minerrorrate_)
00248 {
00249 if (isHF(eta-1,d+1))
00250 {
00251 ++localHF[cl];
00252 if ((d==0 && (abs(ieta)==33 || abs(ieta)==34)) ||
00253 (d==1 && (abs(ieta)==35 || abs(ieta)==36)))
00254 ++localHFlumi[cl];
00255 }
00256 else if (isHO(eta-1,d+1))
00257 {
00258 ++localHO[cl];
00259 if (abs(ieta)<5) ++localHO0[cl];
00260 else ++localHO12[cl];
00261 }
00262 else if (isHB(eta-1,d+1)) ++localHB[cl];
00263 else if (isHE(eta-1,d+1)) ++localHE[cl];
00264 }
00265 }
00266
00267
00268
00269 if (UseBadChannelStatusInSummary_ && chStat[d]!=0)
00270 {
00271 double chanStat=chStat[d]->getBinContent(eta,phi);
00272
00273
00274 if (chanStat<0)
00275 {
00276 if (isHF(eta-1,d+1))
00277 {
00278 ++status_HF_;
00279 if ((d==0 && (abs(ieta)==33 || abs(ieta)==34)) ||
00280 (d==1 && (abs(ieta)==35 || abs(ieta)==36)))
00281 {
00282 ++status_HFlumi_;
00283 }
00284 continue;
00285 }
00286 else if (isHO(eta-1,d+1))
00287 {
00288 ++status_HO_;
00289 if (abs(ieta)<5)
00290 ++status_HO0_;
00291 else ++status_HO12_;
00292 continue;
00293 }
00294 else if (isHB(eta-1,d+1))
00295 {
00296 ++status_HB_;
00297 continue;
00298 }
00299 else if (isHE(eta-1,d+1))
00300 {
00301 ++status_HE_;
00302 continue;
00303 }
00304 }
00305 }
00306
00307
00308
00309
00310
00311 for (unsigned int cl=0;cl<clients_.size();++cl)
00312 {
00313
00314
00315
00316 if (debug_>4 && eta==1 && phi==1) std::cout <<"Checking summary for client "<<clients_[cl]->name()<<std::endl;
00317 if (clients_[cl]->ProblemCellsByDepth==0) continue;
00318
00319 if ((clients_[cl]->ProblemCellsByDepth)->depth[d]==0) continue;
00320 if ((clients_[cl]->ProblemCellsByDepth)->depth[d]->getBinContent(eta,phi)>clients_[cl]->minerrorrate_)
00321 {
00322 if ((clients_[cl]->ProblemCellsByDepth)->depth[d]->getBinContent(eta,phi)<999)
00323 SummaryMapByDepth->depth[d]->setBinContent(eta,phi,1);
00324 else
00325 SummaryMapByDepth->depth[d]->setBinContent(eta,phi,999);
00326 if (isHF(eta-1,d+1))
00327 {
00328 ++status_HF_;
00329 if ((d==0 && (abs(ieta)==33 || abs(ieta)==34)) ||
00330 (d==1 && (abs(ieta)==35 || abs(ieta)==36)))
00331 {
00332 ++status_HFlumi_;
00333 }
00334 }
00335 else if (isHO(eta-1,d+1))
00336 {
00337 ++status_HO_;
00338 if (abs(ieta)<5)
00339 ++status_HO0_;
00340 else ++status_HO12_;
00341 }
00342 else if (isHB(eta-1,d+1)) ++status_HB_;
00343 else if (isHE(eta-1,d+1)) ++status_HE_;
00344 break;
00345 }
00346 }
00347 }
00348 }
00349 }
00350
00351 FillUnphysicalHEHFBins(*SummaryMapByDepth);
00352 }
00353
00354
00355 int totalcells=0;
00356 std::map<std::string, int>::const_iterator it;
00357
00358 if (HBpresent_>0)
00359 {
00360 status_global_+=status_HB_;
00361 it=subdetCells_.find("HB");
00362 totalcells+=it->second;
00363 status_HB_= 1-(status_HB_/it->second);
00364 for (unsigned int i=0;i<clients_.size();++i)
00365 {
00366 localHB[i]=1-(1.*localHB[i]/it->second);
00367 localHB[i]=std::max(0.,localHB[i]);
00368 }
00369 status_HB_=std::max(0.,status_HB_);
00370 }
00371 else status_HB_=-1;
00372
00373 if (HEpresent_>0)
00374 {
00375 status_global_+=status_HE_;
00376 it=subdetCells_.find("HE");
00377 totalcells+=it->second;
00378 status_HE_= 1-(status_HE_/it->second);
00379 for (unsigned int i=0;i<clients_.size();++i)
00380 {
00381 localHE[i]=1-(1.*localHE[i]/it->second);
00382 localHE[i]=std::max(0.,localHE[i]);
00383 }
00384 status_HE_=std::max(0.,status_HE_);
00385 }
00386 else status_HE_=-1;
00387
00388 if (HOpresent_>0)
00389 {
00390 status_global_+=status_HO_;
00391 it=subdetCells_.find("HO");
00392 totalcells+=it->second;
00393 status_HO_= 1-(status_HO_/it->second);
00394 status_HO_=std::max(0.,status_HO_);
00395 for (unsigned int i=0;i<clients_.size();++i)
00396 {
00397 localHO[i]=1-(1.*localHO[i]/it->second);
00398 localHO[i]=std::max(0.,localHO[i]);
00399 }
00400 it=subdetCells_.find("HO0");
00401 status_HO0_= 1-(status_HO0_/it->second);
00402 for (unsigned int i=0;i<clients_.size();++i)
00403 {
00404 localHO0[i]=1-(1.*localHO0[i]/it->second);
00405 localHO0[i]=std::max(0.,localHO0[i]);
00406 }
00407 status_HO0_=std::max(0.,status_HO0_);
00408 it=subdetCells_.find("HO12");
00409 status_HO12_= 1-(status_HO12_/it->second);
00410 status_HO12_=std::max(0.,status_HO12_);
00411 for (unsigned int i=0;i<clients_.size();++i)
00412 {
00413 localHO12[i]=1-(1.*localHO12[i]/it->second);
00414 localHO12[i]=std::max(0.,localHO12[i]);
00415 }
00416 }
00417 else
00418 {
00419 status_HO_=-1;
00420 status_HO0_=-1;
00421 status_HO12_=-1;
00422 }
00423 if (HFpresent_>0)
00424 {
00425 status_global_+=status_HF_;
00426 it=subdetCells_.find("HF");
00427 totalcells+=it->second;
00428 status_HF_= 1-(status_HF_/it->second);
00429 status_HF_=std::max(0.,status_HF_);
00430 for (unsigned int i=0;i<clients_.size();++i)
00431 {
00432 localHF[i]=1-(1.*localHF[i]/it->second);
00433 localHF[i]=std::max(0.,localHF[i]);
00434 }
00435 it=subdetCells_.find("HFlumi");
00436 status_HFlumi_= 1-(status_HFlumi_/it->second);
00437 status_HFlumi_=std::max(0.,status_HFlumi_);
00438 for (unsigned int i=0;i<clients_.size();++i)
00439 {
00440 localHFlumi[i]=1-(1.*localHFlumi[i]/it->second);
00441 localHFlumi[i]=std::max(0.,localHFlumi[i]);
00442 }
00443 }
00444 else
00445 {
00446 status_HF_=-1;
00447 status_HFlumi_=-1;
00448 }
00449
00450 if (totalcells==0)
00451 status_global_=-1;
00452 else
00453 {
00454 status_global_=1-status_global_/totalcells;
00455 status_global_=std::max(0.,status_global_);
00456 }
00457
00458
00459
00460
00461 dqmStore_->setCurrentFolder(prefixME_+"HcalInfo");
00462 certificationMap_=dqmStore_->get(prefixME_+"HcalInfo/CertificationMap");
00463 if (certificationMap_) dqmStore_->removeElement(certificationMap_->getName());
00464 certificationMap_=dqmStore_->book2D("CertificationMap","Certification Map",7,0,7,
00465 clients_.size()+1,0,clients_.size()+1);
00466
00467 certificationMap_->getTH2F()->GetYaxis()->SetBinLabel(1,"Summary");
00468 (certificationMap_->getTH2F())->SetOption("textcolz");
00469
00470 for (int i=0;i<(int)clients_.size();++i)
00471 {
00472 certificationMap_->getTH2F()->GetYaxis()->SetBinLabel(i+2,(clients_[i]->name()).c_str());
00473 }
00474 certificationMap_->getTH2F()->GetYaxis()->SetLabelSize(0.02);
00475 certificationMap_->getTH2F()->GetXaxis()->SetBinLabel(1,"HB");
00476 certificationMap_->getTH2F()->GetXaxis()->SetBinLabel(2,"HE");
00477 certificationMap_->getTH2F()->GetXaxis()->SetBinLabel(3,"HO");
00478 certificationMap_->getTH2F()->GetXaxis()->SetBinLabel(4,"HF");
00479 certificationMap_->getTH2F()->GetXaxis()->SetBinLabel(5,"HO0");
00480 certificationMap_->getTH2F()->GetXaxis()->SetBinLabel(6,"HO12");
00481 certificationMap_->getTH2F()->GetXaxis()->SetBinLabel(7,"HFlumi");
00482 certificationMap_->getTH2F()->SetMinimum(-1);
00483 certificationMap_->getTH2F()->SetMaximum(1);
00484
00485 for (unsigned int i=0;i<clients_.size();++i)
00486 {
00487 certificationMap_->setBinContent(1,i+2,localHB[i]);
00488 certificationMap_->setBinContent(2,i+2,localHE[i]);
00489 certificationMap_->setBinContent(3,i+2,localHO[i]);
00490 certificationMap_->setBinContent(4,i+2,localHF[i]);
00491 certificationMap_->setBinContent(5,i+2,localHO0[i]);
00492 certificationMap_->setBinContent(6,i+2,localHO12[i]);
00493 certificationMap_->setBinContent(7,i+2,localHF[i]);
00494 }
00495 certificationMap_->setBinContent(1,1,status_HB_);
00496 certificationMap_->setBinContent(2,1,status_HE_);
00497 certificationMap_->setBinContent(3,1,status_HO_);
00498 certificationMap_->setBinContent(4,1,status_HF_);
00499 certificationMap_->setBinContent(5,1,status_HO0_);
00500 certificationMap_->setBinContent(6,1,status_HO12_);
00501 certificationMap_->setBinContent(7,1,status_HF_);
00502 fillReportSummary(LS);
00503 }
00504
00505 void HcalSummaryClient::fillReportSummary(int LS)
00506 {
00507
00508
00509
00510 if (debug_>2) std::cout <<"<HcalSummaryClient::fillReportSummary>"<<std::endl;
00511
00512 if (debug_>3)
00513 {
00514 std::cout <<"STATUS = "<<std::endl;
00515 std::cout <<"HB = "<<status_HB_<<std::endl;
00516 std::cout <<"HE = "<<status_HE_<<std::endl;
00517 std::cout <<"HO = "<<status_HO_<<std::endl;
00518 std::cout <<"HF = "<<status_HF_<<std::endl;
00519 std::cout <<"HO0 = "<<status_HO0_<<std::endl;
00520 std::cout <<"HO12 = "<<status_HO12_<<std::endl;
00521 std::cout <<"HFlumi = "<<status_HFlumi_<<std::endl;
00522 }
00523
00524
00525
00526 if (LS>0)
00527 {
00528 if (StatusVsLS_)
00529 {
00530 StatusVsLS_->setBinContent(LS,1,status_HB_);
00531 StatusVsLS_->setBinContent(LS,2,status_HE_);
00532 StatusVsLS_->setBinContent(LS,3,status_HO_);
00533 StatusVsLS_->setBinContent(LS,4,status_HF_);
00534 StatusVsLS_->setBinContent(LS,5,status_HO0_);
00535 StatusVsLS_->setBinContent(LS,6,status_HO12_);
00536 StatusVsLS_->setBinContent(LS,7,status_HFlumi_);
00537 }
00538 }
00539
00540 MonitorElement* me;
00541 dqmStore_->setCurrentFolder(subdir_);
00542
00543
00544 if (reportMap_)
00545 {
00546 reportMap_->setBinContent(1,1,status_HB_);
00547 reportMap_->setBinContent(2,1,status_HE_);
00548 reportMap_->setBinContent(3,1,status_HO_);
00549 reportMap_->setBinContent(4,1,status_HF_);
00550 reportMap_->setBinContent(5,1,status_HO0_);
00551 reportMap_->setBinContent(6,1,status_HO12_);
00552 reportMap_->setBinContent(7,1,status_HFlumi_);
00553
00554 if (enoughevents_==false)
00555 reportMap_->setBinContent(0,0,-1);
00556 else
00557 reportMap_->setBinContent(0,0,1);
00558 }
00559 else if (debug_>0) std::cout <<"<HcalSummaryClient::fillReportSummary> CANNOT GET REPORT SUMMARY MAP!!!!!"<<std::endl;
00560
00561 if (reportMapShift_)
00562 {
00563 reportMapShift_->setBinContent(1,1,status_HB_);
00564 reportMapShift_->setBinContent(2,1,status_HE_);
00565 reportMapShift_->setBinContent(3,1,status_HO_);
00566 reportMapShift_->setBinContent(4,1,status_HF_);
00567 reportMapShift_->setBinContent(5,1,status_HO0_);
00568 reportMapShift_->setBinContent(6,1,status_HO12_);
00569
00570 if (enoughevents_==false)
00571 reportMapShift_->setBinContent(0,0,-1);
00572 else
00573 reportMapShift_->setBinContent(0,0,1);
00574 }
00575 else if (debug_>0) std::cout <<"<HcalSummaryClient::fillReportSummary> CANNOT GET REPORT SUMMARY MAP!!!!!"<<std::endl;
00576
00577 me=dqmStore_->get(subdir_+"reportSummary");
00578
00579 if (me) me->Fill(status_global_);
00580
00581
00582 std::string subdets[7] = {"HB","HE","HO","HF","HO0","HO12","HFlumi"};
00583 for (unsigned int i=0;i<7;++i)
00584 {
00585
00586 dqmStore_->setCurrentFolder( subdir_+ "reportSummaryContents" );
00587 me=dqmStore_->get(subdir_+"reportSummaryContents/Hcal_"+subdets[i]);
00588 if (me==0)
00589 {
00590 if (debug_>0) std::cout <<"<HcalSummaryClient::analyze()> Could not get Monitor Element named 'Hcal_"<<subdets[i]<<"'"<<std::endl;
00591 continue;
00592 }
00593 if (subdets[i]=="HB") me->Fill(status_HB_);
00594 else if (subdets[i]=="HE") me->Fill(status_HE_);
00595 else if (subdets[i]=="HO") me->Fill(status_HO_);
00596 else if (subdets[i]=="HF") me->Fill(status_HF_);
00597 else if (subdets[i]=="HO0") me->Fill(status_HO0_);
00598 else if (subdets[i]=="HO12") me->Fill(status_HO12_);
00599 else if (subdets[i]=="HFlumi") me->Fill(status_HFlumi_);
00600 }
00601
00602 }
00603
00604
00605 void HcalSummaryClient::fillReportSummaryLSbyLS(int LS)
00606 {
00607
00608 MonitorElement* me;
00609 dqmStore_->setCurrentFolder(prefixME_+"LSbyLS_Hcal/LSvalues");
00610
00611 float status_HB=-1;
00612 float status_HE=-1;
00613 float status_HO=-1;
00614 float status_HF=-1;
00615 float status_HO0=-1;
00616 float status_HO12=-1;
00617 float status_HFlumi=-1;
00618 float status_global=-1;
00619
00620 me=dqmStore_->get(prefixME_+"LSbyLS_Hcal/LSvalues/ProblemsThisLS");
00621 if (me!=0)
00622 {
00623
00624 int events=(int)me->getBinContent(-1);
00625 if (events>0)
00626 {
00627 std::map<std::string, int>::const_iterator it;
00628 int totalcells=0;
00629
00630 status_HB=me->getBinContent(1,1);
00631 status_HE=me->getBinContent(2,1);
00632 status_HO=me->getBinContent(3,1);
00633 status_HF=me->getBinContent(4,1);
00634 status_HO0=me->getBinContent(5,1);
00635 status_HO12=me->getBinContent(6,1);
00636 status_HFlumi=me->getBinContent(7,1);
00637
00638 status_global=status_HB+status_HE+status_HO+status_HF;
00639 if (debug_>1) std::cout <<"<HcalSummaryClient::fillReportsummaryLSbyLS> BAD CHANNELS*EVENTS = HB: "<<status_HB<<" HE: "<<status_HE<<" HO: "<<status_HO<<" HO0: "<<status_HO0<<" HO12: "<<status_HO12<<" HF:"<<status_HF<<" HFlumi: "<<status_HFlumi<<" TOTAL BAD CHANNELS*EVENTS = "<<status_global<<" TOTAL EVENTS = "<<events<<std::endl;
00640
00641 it=subdetCells_.find("HB");
00642 totalcells+=it->second;
00643 if (it->second>0)
00644 status_HB=1-(status_HB)/events/it->second;
00645
00646 it=subdetCells_.find("HE");
00647 totalcells+=it->second;
00648 if (it->second>0)
00649 status_HE=1-(status_HE)/events/it->second;
00650
00651 it=subdetCells_.find("HO");
00652 totalcells+=it->second;
00653 if (it->second>0)
00654 status_HO=1-(status_HO)/events/it->second;
00655
00656 it=subdetCells_.find("HF");
00657 totalcells+=it->second;
00658 if (it->second>0)
00659 status_HF=1-(status_HF)/events/it->second;
00660
00661 it=subdetCells_.find("HO0");
00662 if (it->second>0)
00663 status_HO0=1-(status_HO0)/events/it->second;
00664
00665 it=subdetCells_.find("HO12");
00666 if (it->second>0)
00667 status_HO12=1-(status_HO12)/events/it->second;
00668
00669 it=subdetCells_.find("HFlumi");
00670 if (it->second>0)
00671 status_HFlumi=1-(status_HFlumi)/events/it->second;
00672 if (totalcells>0)
00673 status_global=1-status_global/events/totalcells;
00674 if (debug_>1) std::cout <<"<HcalSummaryClient::fillReportsummaryLSbyLS> STATUS= HB: "<<status_HB<<" HE: "<<status_HE<<" HO: "<<status_HO<<" HO0: "<<status_HO0<<" HO12: "<<status_HO12<<" HF:"<<status_HF<<" HFlumi: "<<status_HFlumi<<" GLOBAL STATUS = "<<status_global<<" TOTAL EVENTS = "<<events<<std::endl;
00675 }
00676 }
00677
00678 dqmStore_->setCurrentFolder(subdir_);
00679 if (reportMap_)
00680 {
00681 reportMap_->setBinContent(1,1,status_HB);
00682 reportMap_->setBinContent(2,1,status_HE);
00683 reportMap_->setBinContent(3,1,status_HO);
00684 reportMap_->setBinContent(4,1,status_HF);
00685 reportMap_->setBinContent(5,1,status_HO0);
00686 reportMap_->setBinContent(6,1,status_HO12);
00687 reportMap_->setBinContent(7,1,status_HFlumi);
00688
00689 if (enoughevents_==false)
00690 reportMap_->setBinContent(0,0,-1);
00691 else
00692 reportMap_->setBinContent(0,0,1);
00693
00694 }
00695 else if (debug_>0) std::cout <<"<HcalSummaryClient::fillReportSummaryLSbyLS> CANNOT GET REPORT SUMMARY MAP!!!!!"<<std::endl;
00696
00697 if (reportMapShift_)
00698 {
00699 reportMapShift_->setBinContent(1,1,status_HB);
00700 reportMapShift_->setBinContent(2,1,status_HE);
00701 reportMapShift_->setBinContent(3,1,status_HO);
00702 reportMapShift_->setBinContent(4,1,status_HF);
00703 reportMapShift_->setBinContent(5,1,status_HO0);
00704 reportMapShift_->setBinContent(6,1,status_HO12);
00705
00706 if (enoughevents_==false)
00707 reportMapShift_->setBinContent(0,0,-1);
00708 else
00709 reportMapShift_->setBinContent(0,0,1);
00710
00711 }
00712 else if (debug_>0) std::cout <<"<HcalSummaryClient::fillReportSummaryLSbyLS> CANNOT GET REPORT SUMMARY MAP!!!!!"<<std::endl;
00713
00714 me=dqmStore_->get(subdir_+"reportSummary");
00715
00716 if (me) me->Fill(status_global);
00717
00718
00719 std::string subdets[7] = {"HB","HE","HO","HF","HO0","HO12","HFlumi"};
00720 for (unsigned int i=0;i<7;++i)
00721 {
00722
00723 dqmStore_->setCurrentFolder( subdir_+ "reportSummaryContents" );
00724 me=dqmStore_->get(subdir_+"reportSummaryContents/Hcal_"+subdets[i]);
00725 if (me==0)
00726 {
00727 if (debug_>0) std::cout <<"<HcalSummaryClient::LSbyLS> Could not get Monitor Element named 'Hcal_"<<subdets[i]<<"'"<<std::endl;
00728 continue;
00729 }
00730 if (subdets[i]=="HB") me->Fill(status_HB);
00731 else if (subdets[i]=="HE") me->Fill(status_HE);
00732 else if (subdets[i]=="HO") me->Fill(status_HO);
00733 else if (subdets[i]=="HF") me->Fill(status_HF);
00734 else if (subdets[i]=="HO0") me->Fill(status_HO0);
00735 else if (subdets[i]=="HO12") me->Fill(status_HO12);
00736 else if (subdets[i]=="HFlumi") me->Fill(status_HFlumi);
00737 }
00738
00739
00740 if (StatusVsLS_)
00741 {
00742 StatusVsLS_->setBinContent(LS,1,status_HB);
00743 StatusVsLS_->setBinContent(LS,2,status_HE);
00744 StatusVsLS_->setBinContent(LS,3,status_HO);
00745 StatusVsLS_->setBinContent(LS,4,status_HF);
00746 StatusVsLS_->setBinContent(LS,5,status_HO0);
00747 StatusVsLS_->setBinContent(LS,6,status_HO12);
00748 StatusVsLS_->setBinContent(LS,7,status_HFlumi);
00749 }
00750
00751 return;
00752
00753
00754 }
00755
00756
00757
00758 void HcalSummaryClient::beginJob()
00759 {
00760 dqmStore_ = edm::Service<DQMStore>().operator->();
00761
00762 subdetCells_.insert(std::make_pair("HB",2592));
00763 subdetCells_.insert(std::make_pair("HE",2592));
00764 subdetCells_.insert(std::make_pair("HO",2160));
00765 subdetCells_.insert(std::make_pair("HF",1728));
00766 subdetCells_.insert(std::make_pair("HO0",576));
00767 subdetCells_.insert(std::make_pair("HO12",1584));
00768 subdetCells_.insert(std::make_pair("HFlumi",288));
00769
00770 HBpresent_=-1;
00771 HEpresent_=-1;
00772 HOpresent_=-1;
00773 HFpresent_=-1;
00774
00775 EnoughEvents_=0;
00776 MinEvents_=0;
00777 MinErrorRate_=0;
00778 }
00779
00780 void HcalSummaryClient::endJob(){}
00781
00782 void HcalSummaryClient::beginRun(void)
00783 {
00784 if (!dqmStore_)
00785 {
00786 if (debug_>0) std::cout <<"<HcalSummaryClient::beginRun> dqmStore does not exist!"<<std::endl;
00787 return;
00788 }
00789 nevts_=0;
00790
00791 dqmStore_->setCurrentFolder(subdir_);
00792
00793 MonitorElement* me;
00794
00795 me=dqmStore_->get(subdir_+"reportSummary");
00796
00797 if (me) dqmStore_->removeElement(me->getName());
00798 me = dqmStore_->bookFloat("reportSummary");
00799 me->Fill(-1);
00800
00801
00802 std::string subdets[7] = {"HB","HE","HO","HF","HO0","HO12","HFlumi"};
00803 for (unsigned int i=0;i<7;++i)
00804 {
00805
00806 dqmStore_->setCurrentFolder( subdir_+ "reportSummaryContents" );
00807 me=dqmStore_->get(subdir_+"reportSummaryContents/Hcal_"+subdets[i]);
00808 if (me) dqmStore_->removeElement(me->getName());
00809 me = dqmStore_->bookFloat("Hcal_"+subdets[i]);
00810 me->Fill(-1);
00811 }
00812
00813 dqmStore_->setCurrentFolder(prefixME_+"HcalInfo/SummaryClientPlots");
00814 me=dqmStore_->get(prefixME_+"HcalInfo/SummaryClientPlots/HB HE HF Depth 1 Problem Summary Map");
00815 if (me) dqmStore_->removeElement(me->getName());
00816 me=dqmStore_->get(prefixME_+"HcalInfo/SummaryClientPlots/HB HE HF Depth 2 Problem Summary Map");
00817 if (me) dqmStore_->removeElement(me->getName());
00818 me=dqmStore_->get(prefixME_+"HcalInfo/SummaryClientPlots/HE Depth 3 Problem Summary Map");
00819 if (me) dqmStore_->removeElement(me->getName());
00820 me=dqmStore_->get(prefixME_+"HcalInfo/SummaryClientPlots/HO Depth 4 Problem Summary Map");
00821 if (me) dqmStore_->removeElement(me->getName());
00822
00823 if (EnoughEvents_==0)
00824 EnoughEvents_=dqmStore_->book1D("EnoughEvents","Enough Events Passed From Each Task To Form Summary",1+(int)clients_.size(),0,1+(int)clients_.size());
00825 for (std::vector<HcalBaseDQClient*>::size_type i=0;i<clients_.size();++i)
00826 EnoughEvents_->setBinLabel(i+1,clients_[i]->name());
00827 EnoughEvents_->setBinLabel(1+(int)clients_.size(),"Summary");
00828
00829 if (MinEvents_==0)
00830 MinEvents_=dqmStore_->book1D("MinEvents","Minimum Events Required From Each Task To Form Summary",
00831 1+(int)clients_.size(),0,1+(int)clients_.size());
00832 int summin=0;
00833 for (std::vector<HcalBaseDQClient*>::size_type i=0;i<clients_.size();++i)
00834 {
00835 MinEvents_->setBinLabel(i+1,clients_[i]->name());
00836 MinEvents_->setBinContent(i+1,clients_[i]->minevents_);
00837 summin=std::max(summin,clients_[i]->minevents_);
00838 }
00839 if (MinErrorRate_==0)
00840 MinErrorRate_=dqmStore_->book1D("MinErrorRate",
00841 "Minimum Error Rate Required For Channel To Be Counted As Problem",
00842 (int)clients_.size(),0,(int)clients_.size());
00843 for (std::vector<HcalBaseDQClient*>::size_type i=0;i<clients_.size();++i)
00844 {
00845 MinErrorRate_->setBinLabel(i+1,clients_[i]->name());
00846 MinErrorRate_->setBinContent(i+1,clients_[i]->minerrorrate_);
00847 }
00848
00849
00850
00851 if (SummaryMapByDepth!=0)
00852 {
00853 delete SummaryMapByDepth;
00854 SummaryMapByDepth=0;
00855 }
00856
00857 if (SummaryMapByDepth==0)
00858 {
00859 SummaryMapByDepth=new EtaPhiHists();
00860 SummaryMapByDepth->setup(dqmStore_,"Problem Summary Map");
00861 }
00862
00863
00864 int etabins=0;
00865 for (unsigned int depth=0;depth<4;++depth)
00866 {
00867 if (SummaryMapByDepth->depth[depth]==0) continue;
00868 SummaryMapByDepth->depth[depth]->Reset();
00869 etabins=(SummaryMapByDepth->depth[depth])->getNbinsX();
00870 for (int ieta=0;ieta<etabins;++ieta)
00871 {
00872 for (int iphi=0;iphi<72;++iphi)
00873 SummaryMapByDepth->depth[depth]->setBinContent(ieta+1,iphi+1,-1);
00874 }
00875 }
00876
00877
00878 StatusVsLS_ = dqmStore_->get(prefixME_+"HcalInfo/SummaryClientPlots/StatusVsLS");
00879 if (StatusVsLS_) dqmStore_->removeElement(StatusVsLS_->getName());
00880 StatusVsLS_ = dqmStore_->book2D("StatusVsLS","Status vs. Luminosity Section",
00881 NLumiBlocks_,0.5,NLumiBlocks_+0.5,
00882 7,0,7);
00883
00884 for (int i=1;i<=NLumiBlocks_;++i)
00885 for (int j=1;j<=7;++j)
00886 StatusVsLS_->setBinContent(i,j,-1);
00887 (StatusVsLS_->getTH2F())->GetYaxis()->SetBinLabel(1,"HB");
00888 (StatusVsLS_->getTH2F())->GetYaxis()->SetBinLabel(2,"HE");
00889 (StatusVsLS_->getTH2F())->GetYaxis()->SetBinLabel(3,"HO");
00890 (StatusVsLS_->getTH2F())->GetYaxis()->SetBinLabel(4,"HF");
00891 (StatusVsLS_->getTH2F())->GetYaxis()->SetBinLabel(5,"HO0");
00892 (StatusVsLS_->getTH2F())->GetYaxis()->SetBinLabel(6,"HO12");
00893 (StatusVsLS_->getTH2F())->GetYaxis()->SetBinLabel(7,"HFlumi");
00894 (StatusVsLS_->getTH2F())->GetXaxis()->SetTitle("Lumi Section");
00895 (StatusVsLS_->getTH2F())->SetMinimum(-1);
00896 (StatusVsLS_->getTH2F())->SetMaximum(1);
00897
00898
00899 dqmStore_->setCurrentFolder(subdir_);
00900
00901 reportMap_=dqmStore_->get(subdir_+"reportSummaryMap");
00902 if (reportMap_)
00903 dqmStore_->removeElement(reportMap_->getName());
00904 reportMap_ = dqmStore_->book2D("reportSummaryMap","reportSummaryMap",
00905 7,0,7,1,0,1);
00906 (reportMap_->getTH2F())->GetXaxis()->SetBinLabel(1,"HB");
00907 (reportMap_->getTH2F())->GetXaxis()->SetBinLabel(2,"HE");
00908 (reportMap_->getTH2F())->GetXaxis()->SetBinLabel(3,"HO");
00909 (reportMap_->getTH2F())->GetXaxis()->SetBinLabel(4,"HF");
00910 (reportMap_->getTH2F())->GetXaxis()->SetBinLabel(5,"HO0");
00911 (reportMap_->getTH2F())->GetXaxis()->SetBinLabel(6,"HO12");
00912 (reportMap_->getTH2F())->GetXaxis()->SetBinLabel(7,"HFlumi");
00913 (reportMap_->getTH2F())->GetYaxis()->SetBinLabel(1,"Status");
00914 (reportMap_->getTH2F())->SetMarkerSize(3);
00915 (reportMap_->getTH2F())->SetOption("text90colz");
00916
00917 (reportMap_->getTH2F())->SetMinimum(-1);
00918 (reportMap_->getTH2F())->SetMaximum(1);
00919
00920 if (reportMapShift_)
00921 dqmStore_->removeElement(reportMapShift_->getName());
00922 reportMapShift_ = dqmStore_->book2D("reportSummaryMapShift","reportSummaryMapShift",
00923 6,0,6,1,0,1);
00924 (reportMapShift_->getTH2F())->GetXaxis()->SetBinLabel(1,"HB");
00925 (reportMapShift_->getTH2F())->GetXaxis()->SetBinLabel(2,"HE");
00926 (reportMapShift_->getTH2F())->GetXaxis()->SetBinLabel(3,"HO");
00927 (reportMapShift_->getTH2F())->GetXaxis()->SetBinLabel(4,"HF");
00928 (reportMapShift_->getTH2F())->GetXaxis()->SetBinLabel(5,"HO0");
00929 (reportMapShift_->getTH2F())->GetXaxis()->SetBinLabel(6,"HO12");
00930 (reportMapShift_->getTH2F())->GetYaxis()->SetBinLabel(1,"Status");
00931 (reportMapShift_->getTH2F())->SetMarkerSize(3);
00932 (reportMapShift_->getTH2F())->SetOption("text90colz");
00933
00934 (reportMapShift_->getTH2F())->SetMinimum(-1);
00935 (reportMapShift_->getTH2F())->SetMaximum(1);
00936
00937
00938 status_global_=-1;
00939 status_HB_=-1;
00940 status_HE_=-1;
00941 status_HO_=-1;
00942 status_HF_=-1;
00943
00944 status_HO0_=-1;
00945 status_HO12_=-1;
00946 status_HFlumi_=-1;
00947 for (int i=1;i<=(reportMap_->getTH2F())->GetNbinsX();++i)
00948 reportMap_->setBinContent(i,1,-1);
00949 for (int i=1;i<=(reportMapShift_->getTH2F())->GetNbinsX();++i)
00950 reportMapShift_->setBinContent(i,1,-1);
00951 }
00952
00953
00954 void HcalSummaryClient::endRun(void){}
00955
00956 void HcalSummaryClient::setup(void){}
00957 void HcalSummaryClient::cleanup(void){}
00958
00959 bool HcalSummaryClient::hasErrors_Temp(void){ return false;}
00960
00961 bool HcalSummaryClient::hasWarnings_Temp(void){return false;}
00962 bool HcalSummaryClient::hasOther_Temp(void){return false;}
00963 bool HcalSummaryClient::test_enabled(void){return true;}
00964
00965 void HcalSummaryClient::updateChannelStatus(std::map<HcalDetId, unsigned int>& myqual){return;}
00966
00967