CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/DQM/HcalMonitorClient/src/HcalRecHitClient.cc

Go to the documentation of this file.
00001 #include "DQM/HcalMonitorClient/interface/HcalRecHitClient.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 <iostream>
00010 
00011 /*
00012  * \file HcalRecHitClient.cc
00013  * 
00014  * $Date: 2011/07/04 23:22:27 $
00015  * $Revision: 1.53 $
00016  * \author J. Temple
00017  * \brief Dead Cell Client class
00018  */
00019 
00020 HcalRecHitClient::HcalRecHitClient(std::string myname)
00021 {
00022   name_=myname;
00023 }
00024 
00025 HcalRecHitClient::HcalRecHitClient(std::string myname, const edm::ParameterSet& ps)
00026 {
00027   name_=myname;
00028   enableCleanup_         = ps.getUntrackedParameter<bool>("enableCleanup",false);
00029   debug_                 = ps.getUntrackedParameter<int>("debug",0);
00030   prefixME_              = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
00031   if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
00032     prefixME_.append("/");
00033   subdir_                = ps.getUntrackedParameter<std::string>("RecHitFolder","RecHitMonitor_Hcal/"); // RecHitMonitor_Hcal  
00034   if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
00035     subdir_.append("/");
00036   subdir_=prefixME_+subdir_;
00037 
00038   validHtmlOutput_       = ps.getUntrackedParameter<bool>("RecHit_validHtmlOutput",true);
00039   cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00040   badChannelStatusMask_   = ps.getUntrackedParameter<int>("RecHit_BadChannelStatusMask",
00041                                                           ps.getUntrackedParameter<int>("BadChannelStatusMask",
00042                                                                                         0)); // identify channel status values to mask
00043 
00044   minerrorrate_ = ps.getUntrackedParameter<double>("RecHit_minerrorrate",
00045                                                    ps.getUntrackedParameter<double>("minerrorrate",0.01));
00046   minevents_    = ps.getUntrackedParameter<int>("RecHit_minevents",
00047                                                 ps.getUntrackedParameter<int>("minevents",1));
00048   enoughevents_=false;
00049   Online_                = ps.getUntrackedParameter<bool>("online",false);
00050 
00051   ProblemCells=0;
00052   ProblemCellsByDepth=0;
00053 }
00054 
00055 void HcalRecHitClient::analyze()
00056 {
00057   if (debug_>2) std::cout <<"\tHcalRecHitClient::analyze()"<<std::endl;
00058  
00059   TH2F* OccupancyByDepth[4];
00060   TH2F* SumEnergyByDepth[4];
00061   TH2F* SumTimeByDepth[4];
00062   TH2F* SqrtSumEnergy2ByDepth[4];
00063 
00064   TH2F* OccupancyThreshByDepth[4];
00065   TH2F* SumEnergyThreshByDepth[4];
00066   TH2F* SumTimeThreshByDepth[4];
00067   TH2F* SqrtSumEnergy2ThreshByDepth[4];
00068 
00069   std::vector<std::string> name = HcalEtaPhiHistNames();
00070 
00071   MonitorElement* me;
00072   bool gotHistos=true;
00073 
00074   for (int i=0;i<4;++i)
00075     {
00076       std::string s=subdir_+"Distributions_AllRecHits/"+name[i]+"RecHit Occupancy";
00077       me=dqmStore_->get(s.c_str());
00078       if (me==0) {if (debug_>0) std::cout <<"Could not get histogram "<<s<<std::endl; gotHistos=false; break;}
00079       OccupancyByDepth[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, OccupancyByDepth[i], debug_);
00080       s=subdir_+"Distributions_AllRecHits/sumplots/"+name[i]+"RecHit Summed Energy GeV";
00081       me=dqmStore_->get(s.c_str());
00082       if (me==0) {if (debug_>0) std::cout <<"Could not get histogram "<<s<<std::endl; gotHistos=false; break;}
00083       SumEnergyByDepth[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, SumEnergyByDepth[i], debug_);
00084       s=subdir_+"Distributions_AllRecHits/sumplots/"+name[i]+"RecHit Summed Time nS";
00085       me=dqmStore_->get(s.c_str());
00086       if (me==0) {if (debug_>0) std::cout <<"Could not get histogram "<<s<<std::endl; gotHistos=false; break;}
00087       SumTimeByDepth[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, SumTimeByDepth[i], debug_);
00088       s=subdir_+"Distributions_AllRecHits/sumplots/"+name[i]+"RecHit Sqrt Summed Energy2 GeV";
00089       me=dqmStore_->get(s.c_str());
00090       if (me==0) {if (debug_>0) std::cout <<"Could not get histogram "<<s<<std::endl; gotHistos=false; break;}
00091       SqrtSumEnergy2ByDepth[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, SqrtSumEnergy2ByDepth[i], debug_);
00092 
00093       // Threshold histograms
00094       s=subdir_+"Distributions_PassedMinBias/"+name[i]+"Above Threshold RecHit Occupancy";
00095       me=dqmStore_->get(s.c_str());
00096       if (me==0) {if (debug_>0) std::cout <<"Could not get histogram "<<s<<std::endl; gotHistos=false; break;}
00097       OccupancyThreshByDepth[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, OccupancyThreshByDepth[i], debug_);
00098       s=subdir_+"Distributions_PassedMinBias/sumplots/"+name[i]+"Above Threshold RecHit Summed Energy GeV";
00099       me=dqmStore_->get(s.c_str());
00100       if (me==0) {if (debug_>0) std::cout <<"Could not get histogram "<<s<<std::endl; gotHistos=false; break;}
00101       SumEnergyThreshByDepth[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, SumEnergyThreshByDepth[i], debug_);
00102       s=subdir_+"Distributions_PassedMinBias/sumplots/"+name[i]+"Above Threshold RecHit Summed Time nS";
00103       me=dqmStore_->get(s.c_str());
00104       if (me==0) {if (debug_>0) std::cout <<"Could not get histogram "<<s<<std::endl; gotHistos=false; break;}
00105       SumTimeThreshByDepth[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, SumTimeThreshByDepth[i], debug_);
00106       s=subdir_+"Distributions_PassedMinBias/sumplots/"+name[i]+"Above Threshold RecHit Sqrt Summed Energy2 GeV";
00107       me=dqmStore_->get(s.c_str());
00108       if (me==0) {if (debug_>0) std::cout <<"Could not get histogram "<<s<<std::endl; gotHistos=false; break;}
00109       SqrtSumEnergy2ThreshByDepth[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, SqrtSumEnergy2ThreshByDepth[i], debug_);
00110     }
00111   if (gotHistos==false)
00112     {
00113       if (debug_>0) std::cout <<"<HcalRecHitClient::calculateProblems()> Not all histograms could be found; skipping normalization"<<std::endl;
00114       return;
00115     }
00116 
00117   // Clear histograms before re-filling
00118   meHBEnergy_1D->Reset();
00119   meHBEnergyRMS_1D->Reset();
00120   meHEEnergy_1D->Reset();
00121   meHEEnergyRMS_1D->Reset();
00122   meHOEnergy_1D->Reset();
00123   meHOEnergyRMS_1D->Reset();
00124   meHFEnergy_1D->Reset();
00125   meHFEnergyRMS_1D->Reset();
00126   meHBEnergyThresh_1D->Reset();
00127   meHBEnergyRMSThresh_1D->Reset();
00128   meHEEnergyThresh_1D->Reset();
00129   meHEEnergyRMSThresh_1D->Reset();
00130   meHOEnergyThresh_1D->Reset();
00131   meHOEnergyRMSThresh_1D->Reset();
00132   meHFEnergyThresh_1D->Reset();
00133   meHFEnergyRMSThresh_1D->Reset();
00134 
00135   for (int mydepth=0;mydepth<4;++mydepth)
00136     {
00137       for (int eta=0;eta<OccupancyByDepth[mydepth]->GetNbinsX();++eta)
00138         {
00139           // eta+1=1:  ieta = -42
00140           // eta+1=13: ieta = -29
00141 
00142           for (int phi=0;phi<72;++phi)
00143             {
00144               if (OccupancyByDepth[mydepth]->GetBinContent(eta+1, phi+1)>0)
00145                 {
00146                   // fill 1D plots
00147                   if (isHB(eta,mydepth+1)) 
00148                     {
00149                       if (validDetId(HcalBarrel, CalcIeta(HcalBarrel, eta, mydepth+1), phi+1, mydepth+1))
00150                         {
00151                           meHBEnergy_1D->Fill(SumEnergyByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyByDepth[mydepth]->GetBinContent(eta+1, phi+1));
00152                           meHBEnergyRMS_1D->Fill(sqrt(pow(SqrtSumEnergy2ByDepth[mydepth]->GetBinContent(eta+1, phi+1),2)/OccupancyByDepth[mydepth]->GetBinContent(eta+1, phi+1)-pow(SumEnergyByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyByDepth[mydepth]->GetBinContent(eta+1, phi+1),2)));
00153                         }
00154                     } 
00155                   else if (isHE(eta,mydepth+1)) 
00156                     {
00157                       if (validDetId(HcalEndcap, CalcIeta(HcalEndcap, eta, mydepth+1), phi+1, mydepth+1)) 
00158                         {
00159                           
00160                           meHEEnergy_1D->Fill(SumEnergyByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyByDepth[mydepth]->GetBinContent(eta+1, phi+1));
00161                           meHEEnergyRMS_1D->Fill(sqrt(pow(SqrtSumEnergy2ByDepth[mydepth]->GetBinContent(eta+1, phi+1),2)/OccupancyByDepth[mydepth]->GetBinContent(eta+1, phi+1)-pow(SumEnergyByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyByDepth[mydepth]->GetBinContent(eta+1, phi+1),2)));
00162                         }
00163                     }
00164                   else if (isHO(eta,mydepth+1)) 
00165                     {
00166                       if (validDetId(HcalOuter, CalcIeta(HcalOuter, eta, mydepth+1), phi+1, mydepth+1)) 
00167                         {
00168                           meHOEnergy_1D->Fill(SumEnergyByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyByDepth[mydepth]->GetBinContent(eta+1, phi+1));
00169                           meHOEnergyRMS_1D->Fill(sqrt(pow(SqrtSumEnergy2ByDepth[mydepth]->GetBinContent(eta+1, phi+1),2)/OccupancyByDepth[mydepth]->GetBinContent(eta+1, phi+1)-pow(SumEnergyByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyByDepth[mydepth]->GetBinContent(eta+1, phi+1),2)));
00170                         }
00171                     } 
00172                   else if (isHF(eta,mydepth+1)) 
00173                     {
00174                       if (validDetId(HcalForward, CalcIeta(HcalForward, eta, mydepth+1), phi+1, mydepth+1)) 
00175                         {
00176                           meHFEnergy_1D->Fill(SumEnergyByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyByDepth[mydepth]->GetBinContent(eta+1, phi+1));
00177                           meHFEnergyRMS_1D->Fill(sqrt(pow(SqrtSumEnergy2ByDepth[mydepth]->GetBinContent(eta+1, phi+1),2)/OccupancyByDepth[mydepth]->GetBinContent(eta+1, phi+1)-pow(SumEnergyByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyByDepth[mydepth]->GetBinContent(eta+1, phi+1),2)));
00178                         }
00179                     }
00180                   // normalize 2D plots by number of events
00181                  
00182                   meEnergyByDepth->depth[mydepth]->setBinContent(eta+1, phi+1, SumEnergyByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyByDepth[mydepth]->GetBinContent(eta+1, phi+1));
00183                   meTimeByDepth->depth[mydepth]->setBinContent(eta+1, phi+1, SumTimeByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyByDepth[mydepth]->GetBinContent(eta+1, phi+1));
00184                 } // (OccupancyByDepth[mydepth]->GetBinContent(eta+1,phi+1)>0)
00185                 
00186               if (OccupancyThreshByDepth[mydepth]==0) continue;
00187               if (OccupancyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1)>0)
00188                 {
00189                   // fill 1D plots
00190                   if (isHB(eta,mydepth+1)) 
00191                     {
00192                       if (validDetId(HcalBarrel, CalcIeta(HcalBarrel, eta, mydepth+1), phi+1, mydepth+1))
00193                         {
00194                           meHBEnergyThresh_1D->Fill(SumEnergyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1));
00195                           double RMS=pow(SqrtSumEnergy2ThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1),2)/OccupancyThreshByDepth[mydepth]->GetBinContent(eta+1,phi+1)-pow(SumEnergyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1),2);
00196                           RMS=pow(fabs(RMS),0.5);
00197                           meHBEnergyRMSThresh_1D->Fill(RMS);
00198                         }
00199                     } 
00200                   else if (isHE(eta,mydepth+1)) 
00201                     {
00202                       if (validDetId(HcalEndcap, CalcIeta(HcalEndcap, eta, mydepth+1), phi+1, mydepth+1)) 
00203                         {
00204                           
00205                           meHEEnergyThresh_1D->Fill(SumEnergyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1));
00206                           double RMS=pow(SqrtSumEnergy2ThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1),2)/OccupancyThreshByDepth[mydepth]->GetBinContent(eta+1,phi+1)-pow(SumEnergyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1),2);
00207                           RMS=pow(fabs(RMS),0.5);
00208                           meHEEnergyRMSThresh_1D->Fill(RMS);
00209                         }
00210                     }
00211                   else if (isHO(eta,mydepth+1)) 
00212                     {
00213                       if (validDetId(HcalOuter, CalcIeta(HcalOuter, eta, mydepth+1), phi+1, mydepth+1)) 
00214                         {
00215                           meHOEnergyThresh_1D->Fill(SumEnergyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1));
00216                           double RMS=pow(SqrtSumEnergy2ThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1),2)/OccupancyThreshByDepth[mydepth]->GetBinContent(eta+1,phi+1)-pow(SumEnergyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1),2);
00217                           RMS=pow(fabs(RMS),0.5);
00218                           meHOEnergyRMSThresh_1D->Fill(RMS);
00219                         }
00220                     } 
00221                   else if (isHF(eta,mydepth+1)) 
00222                     {
00223                       if (validDetId(HcalForward, CalcIeta(HcalForward, eta, mydepth+1), phi+1, mydepth+1)) 
00224                         {
00225                           meHFEnergyThresh_1D->Fill(SumEnergyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1));
00226                           double RMS=pow(SqrtSumEnergy2ThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1),2)/OccupancyThreshByDepth[mydepth]->GetBinContent(eta+1,phi+1)-pow(SumEnergyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1),2);
00227                           RMS=pow(fabs(RMS),0.5);
00228                           meHFEnergyRMSThresh_1D->Fill(RMS);              
00229                         }
00230                     }
00231                   // fill 2D plots
00232                   meEnergyThreshByDepth->depth[mydepth]->setBinContent(eta+1, phi+1, SumEnergyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1));
00233                   meTimeThreshByDepth->depth[mydepth]->setBinContent(eta+1, phi+1, SumTimeThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1)/OccupancyThreshByDepth[mydepth]->GetBinContent(eta+1, phi+1));
00234                 }
00235             } // for (int phi=0;phi<72;++phi)
00236         } // for (int eta=0;eta<OccupancyByDepth->..;++eta)
00237     } // for (int mydepth=0;...)
00238 
00239   FillUnphysicalHEHFBins(*meEnergyByDepth);
00240   FillUnphysicalHEHFBins(*meTimeByDepth);
00241   FillUnphysicalHEHFBins(*meEnergyThreshByDepth);
00242   FillUnphysicalHEHFBins(*meTimeThreshByDepth);
00243 
00244   calculateProblems();
00245 }
00246 
00247 void HcalRecHitClient::calculateProblems()
00248 {
00249  if (debug_>2) std::cout <<"\t\tHcalRecHitClient::calculateProblems()"<<std::endl;
00250   if(!dqmStore_) return;
00251   double totalevents=0;
00252   int etabins=0, phibins=0, zside=0;
00253   double problemvalue=0;
00254   std::vector<std::string> name = HcalEtaPhiHistNames(); // use this to get EtaPhiHistograms that feed problem calculation, once they exist (see analyze function for example usage of HcalEtaPhiHistNames())
00255 
00256   // Get histograms used in determining rechit problem rate, 
00257   // and get totalevents from their underflow bins.
00258   // No such problem histograms are defined so far.
00259   
00260   enoughevents_=true;
00261 
00262   if (totalevents==0)
00263     return;
00264 
00265   // Clear away old problems
00266   if (ProblemCells!=0)
00267     {
00268       ProblemCells->Reset();
00269       (ProblemCells->getTH2F())->SetMaximum(1.05);
00270       (ProblemCells->getTH2F())->SetMinimum(0.);
00271     }
00272   for  (unsigned int d=0;d<ProblemCellsByDepth->depth.size();++d)
00273     {
00274       if (ProblemCellsByDepth->depth[d]!=0) 
00275         {
00276           ProblemCellsByDepth->depth[d]->Reset();
00277           (ProblemCellsByDepth->depth[d]->getTH2F())->SetMaximum(1.05);
00278           (ProblemCellsByDepth->depth[d]->getTH2F())->SetMinimum(0.);
00279         }
00280     }
00281   
00282   for (unsigned int d=0;d<ProblemCellsByDepth->depth.size();++d)
00283     {
00284       if (ProblemCellsByDepth->depth[d]==0) continue;
00285 
00286       // Get total events from some future histogram
00287       //totalevents=DigiPresentByDepth[d]->GetBinContent(0); // get totalevents from each depth, in case they differ
00288       if (totalevents==0 || totalevents<minevents_) continue;
00289       etabins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsX();
00290       phibins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsY();
00291       problemvalue=0;
00292       for (int eta=0;eta<etabins;++eta)
00293         {
00294           int ieta=CalcIeta(eta,d+1);
00295           if (ieta==-9999) continue;
00296           for (int phi=0;phi<phibins;++phi)
00297             {
00298               problemvalue=0;
00299               // Add histograms here when rechit testing decided upon
00300               /*if (DigiPresentByDepth[d]!=0 && DigiPresentByDepth[d]->GetBinContent(eta+1,phi+1)>0) 
00301                 problemvalue=totalevents; */
00302               
00303               if (problemvalue==0) continue;
00304               problemvalue/=totalevents; // problem value is a rate; should be between 0 and 1
00305               problemvalue = std::min(1.,problemvalue);
00306               
00307               zside=0;
00308               if (isHF(eta,d+1)) // shift ieta by 1 for HF
00309                 ieta<0 ? zside = -1 : zside = 1;
00310               
00311               // For problem cells that exceed our allowed rate,
00312               // set the values to 999 if the cells are already marked in the status database
00313               if (problemvalue>minerrorrate_)
00314                 {
00315                   HcalSubdetector subdet=HcalEmpty;
00316                   if (isHB(eta,d+1))subdet=HcalBarrel;
00317                   else if (isHE(eta,d+1)) subdet=HcalEndcap;
00318                   else if (isHF(eta,d+1)) subdet=HcalForward;
00319                   else if (isHO(eta,d+1)) subdet=HcalOuter;
00320                   HcalDetId hcalid(subdet, ieta, phi+1, (int)(d+1));
00321                   if (badstatusmap.find(hcalid)!=badstatusmap.end())
00322                     problemvalue=999;
00323                 }
00324               
00325               
00326               ProblemCellsByDepth->depth[d]->setBinContent(eta+1,phi+1,problemvalue);
00327               if (ProblemCells!=0) ProblemCells->Fill(ieta+zside,phi+1,problemvalue);
00328             } // loop on phi
00329         } // loop on eta
00330     } // loop on depth
00331 
00332   if (ProblemCells==0)
00333     {
00334       if (debug_>0) std::cout <<"<HcalRecHitClient::analyze> ProblemCells histogram does not exist!"<<std::endl;
00335       return;
00336     }
00337 
00338   // Normalization of ProblemCell plot, in the case where there are errors in multiple depths
00339   etabins=(ProblemCells->getTH2F())->GetNbinsX();
00340   phibins=(ProblemCells->getTH2F())->GetNbinsY();
00341   for (int eta=0;eta<etabins;++eta)
00342     {
00343       for (int phi=0;phi<phibins;++phi)
00344         {
00345           if (ProblemCells->getBinContent(eta+1,phi+1)>1. && ProblemCells->getBinContent(eta+1,phi+1)<999)
00346             ProblemCells->setBinContent(eta+1,phi+1,1.);
00347         }
00348     }
00349   FillUnphysicalHEHFBins(*ProblemCellsByDepth);
00350   FillUnphysicalHEHFBins(ProblemCells);
00351   return;
00352 
00353 }
00354 
00355 void HcalRecHitClient::beginJob()
00356 {
00357   dqmStore_ = edm::Service<DQMStore>().operator->();
00358   if (debug_>0) 
00359     {
00360       std::cout <<"<HcalRecHitClient::beginJob()>  Displaying dqmStore directory structure:"<<std::endl;
00361       dqmStore_->showDirStructure();
00362     }
00363 }
00364 void HcalRecHitClient::endJob(){}
00365 
00366 void HcalRecHitClient::beginRun(void)
00367 {
00368   if (debug_>1)  std::cout <<"<HcalRecHitClient::endRun>"<<std::endl;
00369 
00370   if (!dqmStore_) 
00371     {
00372       if (debug_>0) std::cout <<"<HcalRecHitClient::beginRun> dqmStore does not exist!"<<std::endl;
00373       return;
00374     }
00375   dqmStore_->setCurrentFolder(subdir_);
00376   problemnames_.clear();
00377   ProblemCells=dqmStore_->book2D(" ProblemRecHits",
00378                                  "Problem RecHit Rate for all HCAL;ieta;iphi",
00379                                  85,-42.5,42.5,
00380                                  72,0.5,72.5);
00381   problemnames_.push_back(ProblemCells->getName());
00382   if (debug_>1)
00383     std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<"  \t  Failed?  "<<(ProblemCells==0)<<std::endl;
00384   dqmStore_->setCurrentFolder(subdir_+"problem_rechits");
00385   ProblemCellsByDepth=new EtaPhiHists();
00386   ProblemCellsByDepth->setup(dqmStore_," Problem RecHit Rate");
00387   for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
00388     problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
00389 
00390   nevts_=0;
00391 
00392   dqmStore_->setCurrentFolder(subdir_+"Distributions_AllRecHits");
00393   meEnergyByDepth = new EtaPhiHists();
00394   meEnergyByDepth->setup(dqmStore_,"RecHit Average Energy","GeV");
00395   meTimeByDepth = new EtaPhiHists();
00396   meTimeByDepth->setup(dqmStore_,"RecHit Average Time","nS");
00397   // set all average times to -1000 by default (so that they don't show up on plots
00398   for (unsigned int i=0;i<meTimeByDepth->depth.size();++i)
00399     {
00400       (meTimeByDepth->depth[i]->getTH2F())->SetMinimum(-150);
00401       (meTimeByDepth->depth[i]->getTH2F())->SetMaximum(150);
00402       int etabins=(meTimeByDepth->depth[i]->getTH2F())->GetNbinsX();
00403       int phibins=(meTimeByDepth->depth[i]->getTH2F())->GetNbinsY();
00404       for (int x=1;x<=etabins;++x)
00405         for (int y=1;y<=phibins;++y)
00406           meTimeByDepth->depth[i]->setBinContent(x,y,-1000);
00407     }
00408 
00409   dqmStore_->setCurrentFolder(subdir_+"Distributions_PassedMinBias");
00410   meEnergyThreshByDepth = new EtaPhiHists();
00411   meEnergyThreshByDepth->setup(dqmStore_,"Above Threshold RecHit Average Energy","GeV");
00412   meTimeThreshByDepth = new EtaPhiHists();
00413   meTimeThreshByDepth->setup(dqmStore_,"Above Threshold RecHit Average Time","nS");
00414  // set all average times to -1000 by default (so that they don't show up on plots
00415   for (unsigned int i=0;i<meTimeThreshByDepth->depth.size();++i)
00416     {
00417       (meTimeThreshByDepth->depth[i]->getTH2F())->SetMinimum(-150);
00418       (meTimeThreshByDepth->depth[i]->getTH2F())->SetMaximum(150);
00419       int etabins=(meTimeThreshByDepth->depth[i]->getTH2F())->GetNbinsX();
00420       int phibins=(meTimeThreshByDepth->depth[i]->getTH2F())->GetNbinsY();
00421       for (int x=1;x<=etabins;++x)
00422         for (int y=1;y<=phibins;++y)
00423           meTimeThreshByDepth->depth[i]->setBinContent(x,y,-1000);
00424     }
00425 
00426   dqmStore_->setCurrentFolder(subdir_+"Distributions_AllRecHits/rechit_1D_plots/");
00427   meHBEnergy_1D=dqmStore_->book1D("HB_energy_1D","HB Average Energy Per RecHit;Energy (GeV)",200,-5,15);
00428   meHEEnergy_1D=dqmStore_->book1D("HE_energy_1D","HE Average Energy Per RecHit;Energy (GeV)",200,-5,15);
00429   meHOEnergy_1D=dqmStore_->book1D("HO_energy_1D","HO Average Energy Per RecHit;Energy (GeV)",200,-10,20);
00430   meHFEnergy_1D=dqmStore_->book1D("HF_energy_1D","HF Average Energy Per RecHit;Energy (GeV)",200,-5,15);
00431 
00432   meHBEnergyRMS_1D=dqmStore_->book1D("HB_energy_RMS_1D","HB Energy RMS Per RecHit;Energy (GeV)",250,0,5);
00433   meHEEnergyRMS_1D=dqmStore_->book1D("HE_energy_RMS_1D","HE Energy RMS Per RecHit;Energy (GeV)",250,0,5);
00434   meHOEnergyRMS_1D=dqmStore_->book1D("HO_energy_RMS_1D","HO Energy RMS Per RecHit;Energy (GeV)",250,0,5);
00435   meHFEnergyRMS_1D=dqmStore_->book1D("HF_energy_RMS_1D","HF Energy RMS Per RecHit;Energy (GeV)",250,0,5);
00436 
00437   dqmStore_->setCurrentFolder(subdir_+"Distributions_PassedMinBias/rechit_1D_plots/");
00438   meHBEnergyThresh_1D=dqmStore_->book1D("HB_energyThresh_1D","HB Average Energy Per RecHit Above Threshold;Energy (GeV)",200,-5,35);
00439   meHEEnergyThresh_1D=dqmStore_->book1D("HE_energyThresh_1D","HE Average Energy Per RecHit Above Threshold;Energy (GeV)",200,-5,35);
00440   meHOEnergyThresh_1D=dqmStore_->book1D("HO_energyThresh_1D","HO Average Energy Per RecHit Above Threshold;Energy (GeV)",300,-10,50);
00441   meHFEnergyThresh_1D=dqmStore_->book1D("HF_energyThresh_1D","HF Average Energy Per RecHit Above Threshold;Energy (GeV)",200,-5,95);
00442 
00443   meHBEnergyRMSThresh_1D=dqmStore_->book1D("HB_energy_RMSThresh_1D","HB Energy RMS Per RecHit Above Threshold;Energy (GeV)",200,0,10);
00444   meHEEnergyRMSThresh_1D=dqmStore_->book1D("HE_energy_RMSThresh_1D","HE Energy RMS Per RecHit Above Threshold;Energy (GeV)",200,0,10);
00445   meHOEnergyRMSThresh_1D=dqmStore_->book1D("HO_energy_RMSThresh_1D","HO Energy RMS Per RecHit Above Threshold;Energy (GeV)",200,0,10);
00446   meHFEnergyRMSThresh_1D=dqmStore_->book1D("HF_energy_RMSThresh_1D","HF Energy RMS Per RecHit Above Threshold;Energy (GeV)",200,0,20);
00447 }
00448 
00449 void HcalRecHitClient::endRun(void)
00450 {
00451   if (debug_>1)  std::cout <<"<HcalRecHitClient::endRun>"<<std::endl;
00452   analyze();
00453 }
00454 
00455 void HcalRecHitClient::setup(void){}
00456 void HcalRecHitClient::cleanup(void){}
00457 
00458 bool HcalRecHitClient::hasErrors_Temp(void)
00459 {
00460   if (!ProblemCells)
00461     {
00462       if (debug_>1) std::cout <<"<HcalRecHitClient::hasErrors_Temp>  ProblemCells histogram does not exist!"<<std::endl;
00463       return false;
00464     }
00465   int problemcount=0;
00466   int ieta=-9999;
00467 
00468   for (int depth=0;depth<4; ++depth)
00469     {
00470       int etabins  = (ProblemCells->getTH2F())->GetNbinsX();
00471       int phibins  = (ProblemCells->getTH2F())->GetNbinsY();
00472       for (int hist_eta=0;hist_eta<etabins;++hist_eta)
00473         {
00474           for (int hist_phi=0; hist_phi<phibins;++hist_phi)
00475             {
00476               ieta=CalcIeta(hist_eta,depth+1);
00477               if (ieta==-9999) continue;
00478               if (ProblemCellsByDepth->depth[depth]==0)
00479                 continue;
00480               if (ProblemCellsByDepth->depth[depth]->getBinContent(hist_eta,hist_phi)>minerrorrate_)
00481                 ++problemcount;
00482             } // for (int hist_phi=1;...)
00483         } // for (int hist_eta=1;...)
00484     } // for (int depth=0;...)
00485 
00486   if (problemcount>0) return true;
00487   return false;
00488 }
00489 
00490 bool HcalRecHitClient::hasWarnings_Temp(void){return false;}
00491 bool HcalRecHitClient::hasOther_Temp(void){return false;}
00492 bool HcalRecHitClient::test_enabled(void){return true;}
00493 
00494 
00495 
00496 void HcalRecHitClient::updateChannelStatus(std::map<HcalDetId, unsigned int>& myqual)
00497 {
00498   // rechit quality not used to update channel status yet; see dead cell client for example
00499 
00500 
00501 
00502 } //void HcalRecHitClient::updateChannelStatus
00503 
00504