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