CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DQM/HcalMonitorTasks/src/HcalBaseMonitor.cc

Go to the documentation of this file.
00001 #include "DQM/HcalMonitorTasks/interface/HcalBaseMonitor.h"
00002 #include "DQMServices/Core/interface/DQMStore.h"
00003 
00004 #define ETAMAX 44.5
00005 #define ETAMIN -44.5
00006 #define PHIMAX 73.5
00007 #define PHIMIN -0.5
00008 
00009 
00010 HcalBaseMonitor::HcalBaseMonitor() {
00011   fVerbosity = 0;
00012   badCells_.clear();
00013   rootFolder_ = "Hcal";
00014   baseFolder_ = "BaseMonitor";
00015 }
00016 
00017 HcalBaseMonitor::~HcalBaseMonitor() {}
00018 
00019 void HcalBaseMonitor::beginRun(){ievt_=0;levt_=0;LBprocessed_=false;}
00020 
00021 void HcalBaseMonitor::setup(const edm::ParameterSet& ps, DQMStore* dbe){
00022   m_dbe = NULL;
00023   if(dbe != NULL) m_dbe = dbe;
00024 
00025   std::vector<std::string> dummy;
00026   dummy.clear();
00027   Online_   =  ps.getUntrackedParameter<bool>("Online",false);
00028   badCells_ =  ps.getUntrackedParameter<std::vector<std::string> >( "BadCells" , dummy);
00029   AllowedCalibTypes_ = ps.getUntrackedParameter<std::vector<int> > ("AllowedCalibTypes");
00030   
00031 
00032   // Base folder for the contents of this job
00033   std::string subsystemname = ps.getUntrackedParameter<std::string>("subSystemFolder", "Hcal") ;
00034   rootFolder_ = subsystemname + "/";
00035 
00036   // Global cfgs
00037   
00038   fVerbosity      = ps.getUntrackedParameter<int>("debug",0); 
00039   makeDiagnostics = ps.getUntrackedParameter<bool>("makeDiagnosticPlots",false);
00040   showTiming      = ps.getUntrackedParameter<bool>("showTiming",false);
00041   dump2database   = ps.getUntrackedParameter<bool>("dump2database",false); // dumps output to database file 
00042 
00043   checkHB_ = ps.getUntrackedParameter<bool>("checkHB",true);
00044   checkHE_ = ps.getUntrackedParameter<bool>("checkHE",true);
00045   checkHO_ = ps.getUntrackedParameter<bool>("checkHO",true);
00046   checkHF_ = ps.getUntrackedParameter<bool>("checkHF",true);
00047  
00048   checkNevents_ = ps.getUntrackedParameter<int>("checkNevents",1000); // specify how often to run checks
00049   Nlumiblocks_ = ps.getUntrackedParameter<int>("Nlumiblocks",1000); //  number of luminosity blocks to include in time plots 
00050   if (Nlumiblocks_<=0) Nlumiblocks_=1000;
00051   resetNevents_ = ps.getUntrackedParameter<int>("resetNevents",-1); // how often to reset histograms
00052 
00053   // Minimum error rate that will caused the problem histogram to be filled
00054   minErrorFlag_ = ps.getUntrackedParameter<double>("minErrorFlag",0.05);
00055   
00056   // Set eta, phi boundaries
00057   // We can remove these variables once we move completely to EtaPhiHists from the old 2D SJ6hists
00058   etaMax_ = ps.getUntrackedParameter<double>("MaxEta", ETAMAX);
00059   etaMin_ = ps.getUntrackedParameter<double>("MinEta", ETAMIN);
00060     
00061   if (etaMax_ > 44.5)
00062     {
00063       std::cout <<"<HcalBaseMonitor> WARNING:  etaMax_ value of "<<etaMax_<<" exceeds maximum allowed value of 44.5"<<std::endl;
00064       std::cout <<"                      Value being set back to 44.5."<<std::endl;
00065       std::cout <<"                      Additional code changes are necessary to allow value of "<<etaMax_<<std::endl;
00066       etaMax_ = 44.5;
00067     }
00068 
00069   if (etaMin_ < ETAMIN)
00070     {
00071       std::cout <<"<HcalBaseMonitor> WARNING:  etaMin_ value of "<<etaMin_<<" exceeds minimum allowed value of 44.5"<<std::endl;
00072       std::cout <<"                      Value being set back to -44.5."<<std::endl;
00073       std::cout <<"                      Additional code changes are necessary to allow value of "<<etaMin_<<std::endl;
00074       etaMin_ = -44.5;
00075     }
00076 
00077   etaBins_ = (int)(etaMax_ - etaMin_);
00078 
00079   phiMax_ = ps.getUntrackedParameter<double>("MaxPhi", PHIMAX);
00080   phiMin_ = ps.getUntrackedParameter<double>("MinPhi", PHIMIN);
00081   phiBins_ = (int)(phiMax_ - phiMin_);
00082 
00083   ProblemsVsLB=0;
00084   ProblemsVsLB_HB=0;
00085   ProblemsVsLB_HE=0;
00086   ProblemsVsLB_HO=0;
00087   ProblemsVsLB_HF=0;
00088   ProblemsVsLB_HBHEHF=0;
00089   
00090   meEVT_=0;
00091   meTOTALEVT_=0;
00092   ievt_=0;
00093   levt_=0;
00094   tevt_=0;
00095   lumiblock=0;
00096   oldlumiblock=0;
00097   NumBadHB=0;
00098   NumBadHE=0;
00099   NumBadHO=0;
00100   NumBadHF=0;
00101 
00102   return;
00103 } //void HcalBaseMonitor::setup()
00104 
00105 void HcalBaseMonitor::processEvent()
00106 {
00107   // increment event counters
00108   ++ievt_;
00109   ++levt_;
00110   ++tevt_;
00111   // Fill MonitorElements
00112   if (m_dbe)
00113     {
00114       if (meEVT_) meEVT_->Fill(ievt_);
00115       if (meTOTALEVT_) meTOTALEVT_->Fill(tevt_);
00116     }
00117   return;
00118 }
00119 
00120 void HcalBaseMonitor::LumiBlockUpdate(int lb)
00121 {
00122 
00123   //if (Online_ && lb<=lumiblock) // protect against mis-ordered LBs.  Handle differently in the future?
00124   //  return;
00125 
00126   lumiblock=lb;
00127   if (lumiblock==0) // initial lumiblock call; don't fill histograms, because nothing has been determined yet
00128       return;
00129 
00130   if (lb>Nlumiblocks_) // don't fill plots if lumiblock is beyond range
00131       return;
00132 
00133   // The following function would let us 'fill in' missing lumiblock sections.  
00134   // I think we only want this for Online running, since offline should fill each lumi block
00135   // independently.  
00136   // Should probably just do this in the individual tasks?
00137   /*
00138   if (Online_ && lumiblock<lb)
00139     {
00140       for (int i=lumiblock+1;i<lb;++i)
00141         {
00142           if (ProblemsVsLB)
00143             ProblemsVsLB->Fill(i,NumBadHB+NumBadHE+NumBadHO+NumBadHF);
00144           if (ProblemsVsLB_HB)
00145             ProblemsVsLB_HB->Fill(i,NumBadHB);
00146           if (ProblemsVsLB_HE)
00147             ProblemsVsLB_HE->Fill(i,NumBadHE);
00148           if (ProblemsVsLB_HO)
00149             ProblemsVsLB_HO->Fill(i,NumBadHO);
00150           if (ProblemsVsLB_HF)
00151             ProblemsVsLB_HF->Fill(i,NumBadHF);
00152           if (ProblemsVsLB_HBHEHF)
00153             ProblemsVsLB_HBHEHF->Fill(i,NumBadHB+NumBadHE+NumBadHF);
00154         }
00155     }
00156   */
00157   return;
00158 }
00159 
00160 void HcalBaseMonitor::beginLuminosityBlock(int lumisec)
00161 {
00162   // Protect against online mis-ordering of events.  
00163   // Do we want this enabled here? 
00164   //if (Online_ && lumisec<lumiblock)
00165   //  return;
00166   LumiBlockUpdate(lumisec);
00167   levt_=0;
00168   LBprocessed_=false;
00169 } // beginLuminosityBlock
00170 
00171 void HcalBaseMonitor::endLuminosityBlock()
00172 {
00173   LBprocessed_=true;
00174   return;
00175 } // endLuminosityBlock;
00176 
00177 void HcalBaseMonitor::done(){}
00178 
00179 void HcalBaseMonitor::clearME(){
00180 
00181   if(m_dbe){
00182     m_dbe->setCurrentFolder(baseFolder_);
00183     m_dbe->removeContents();    
00184     /*
00185     m_dbe->setCurrentFolder(baseFolder_+"/HB");
00186     m_dbe->removeContents();
00187     
00188     m_dbe->setCurrentFolder(baseFolder_+"/HE");
00189     m_dbe->removeContents();
00190 
00191     m_dbe->setCurrentFolder(baseFolder_+"/HO");
00192     m_dbe->removeContents();
00193 
00194     m_dbe->setCurrentFolder(baseFolder_+"/HF");
00195     m_dbe->removeContents();
00196     */
00197   }
00198   return;
00199 } // void HcalBaseMonitor::clearME();
00200 
00201 // ***************************************************************** //
00202 
00203 
00204 bool HcalBaseMonitor::vetoCell(HcalDetId& id)
00205 {
00206   /*
00207     Function identifies whether cell with HcalDetId 'id' should be vetoed, 
00208     based on elements stored in  badCells_ array.
00209   */
00210 
00211   if(badCells_.size()==0) return false;
00212   for(unsigned int i = 0; i< badCells_.size(); ++i)
00213     {
00214       
00215       unsigned int badc = atoi(badCells_[i].c_str());
00216       if(id.rawId() == badc) return true;
00217     }
00218   return false;
00219 } // bool HcalBaseMonitor::vetoCell(HcalDetId id)
00220 
00221 void HcalBaseMonitor::hideKnownBadCells()
00222 {
00223   /* This prevents known bad cells from being displayed in overall problem maps and 
00224      depth histograms.  Is this what we want?  Or do we want some problems to be
00225      displayed in the depth plots but not the overall map?  (Or vice versa?)
00226   */
00227   
00228   for (unsigned int i=0;i<badCells_.size();++i)
00229     {
00230       unsigned int badc = atoi(badCells_[i].c_str());
00231       HcalDetId id(badc);
00232       int etabin=CalcEtaBin(id.subdet(),id.ieta(),id.depth());
00233       if (ProblemCells!=0) ProblemCells->setBinContent(etabin+1,id.iphi(),0);
00234       if (ProblemCellsByDepth.depth[id.depth()-1]!=0)
00235         ProblemCellsByDepth.depth[id.depth()-1]->setBinContent(etabin+1,id.iphi(),0);
00236     } // for (unsigned int i=0;...)
00237   return;
00238 } // void HcalBaseMonitor::hideKnownBadCells()
00239 
00240 
00241 // ************************************************************************************************************ //
00242 
00243 
00244 // Create vectors of MonitorElements for individual depths
00245 
00246 // *********************************************************** //
00247 
00248 void HcalBaseMonitor::SetupEtaPhiHists(MonitorElement* &h, EtaPhiHists & hh, std::string Name, std::string Units)
00249 {
00250   std::stringstream name;
00251   name<<Name;
00252   std::stringstream unitname;
00253   std::stringstream unittitle;
00254   if (Units.empty())
00255     {
00256       unitname<<Units;
00257       unittitle<<"No Units";
00258     }
00259   else
00260     {
00261       unitname<<" "<<Units;
00262       unittitle<<Units;
00263     }
00264 
00265   h=m_dbe->book2D(("All "+name.str()+unitname.str()).c_str(),
00266                   (name.str() + " for all HCAL ("+unittitle.str().c_str()+")"),
00267                   85,-42.5,42.5,
00268                   72,0.5,72.5);
00269 
00270   h->setAxisTitle("i#eta",1);
00271   h->setAxisTitle("i#phi",2);
00272   
00273   SetupEtaPhiHists(hh, Name, Units);
00274   return;
00275 }
00276 
00277 void HcalBaseMonitor::SetupEtaPhiHists(EtaPhiHists & hh, std::string Name, std::string Units)
00278 {
00279   hh.setup(m_dbe, Name, Units);
00280   return;
00281 }
00282 
00283 void HcalBaseMonitor::setupDepthHists2D(MonitorElement* &h, std::vector<MonitorElement*> &hh, std::string Name, std::string Units)
00284 {
00285   /* Code makes overall 2D MonitorElement histogram,
00286      and the vector of 2D MonitorElements for each individual depth.
00287      Eta, Phi bins are set automatically from the etaMax_, etaMin_, etc.
00288      values in HcalBaseMonitor.h
00289   */
00290 
00291   /*
00292   if (showTiming)
00293     {
00294       cpu_timer.reset(); cpu_timer.start();
00295     }
00296   */
00297   std::stringstream name;
00298   name<<Name;
00299   std::stringstream unitname;
00300   std::stringstream unittitle;
00301   if (Units.empty())
00302     {
00303       unitname<<Units;
00304       unittitle<<"No Units";
00305     }
00306   else
00307     {
00308       unitname<<" "<<Units;
00309       unittitle<<Units;
00310     }
00311 
00312   h=m_dbe->book2D(("All "+name.str()+unitname.str()).c_str(),
00313                   (name.str() + " for all HCAL ("+unittitle.str().c_str()+")"),
00314                   etaBins_, etaMin_, etaMax_,
00315                   phiBins_, phiMin_, phiMax_);
00316   h->setAxisTitle("i#eta",1);
00317   h->setAxisTitle("i#phi",2);
00318   
00319   setupDepthHists2D(hh, Name, Units);
00320   /*
00321   if (showTiming)
00322     {
00323       cpu_timer.stop();  std::cout <<"TIMER:: HcalBaseMonitor SETUPDEPTHHISTS2D_OVERALL "<<name.str().c_str()<<" -> "<<cpu_timer.cpuTime()<<std::endl;
00324     }
00325   */
00326   return;
00327 } // void HcalBaseMonitor::setupDepthHists2D(MonitorElement* &h, std::vector<MonitorElement*> &hh, std::string Name, std::string Units)
00328 
00329 
00330 // *************************************** //
00331 
00332 void HcalBaseMonitor::setupDepthHists2D(std::vector<MonitorElement*> &hh, std::string Name, std::string Units)
00333 {
00334   /* Code makes vector of 2D MonitorElements for all 6 depths
00335      (4 depths, + 2 for separate HE histograms).
00336      Bins are automatically set for eta/phi indices
00337      DEPRECATE THIS ONCE ALL OLD-STYLE 2D HISTOGRAMS HAVE BEEN REMOVED!
00338   */
00339   
00340   /*
00341   if (showTiming)
00342     {
00343       cpu_timer.reset(); cpu_timer.start();
00344     }
00345   */
00346   std::stringstream name;
00347   name<<Name;
00348 
00349   std::stringstream unitname;
00350   std::stringstream unittitle;
00351   if (Units.empty())
00352     {
00353       unitname<<Units;
00354       unittitle<<"No Units";
00355     }
00356   else
00357     {
00358       unitname<<" "<<Units;
00359       unittitle<<Units;
00360     }
00361 
00362   // Push back depth plots -- remove ZDC names at some point?
00363   hh.push_back(m_dbe->book2D(("HB HF Depth 1 "+name.str()+unitname.str()).c_str(),
00364                              (name.str()+" Depth 1 -- HB & HF only ("+unittitle.str().c_str()+")"),
00365                              etaBins_,etaMin_,etaMax_,
00366                              phiBins_,phiMin_,phiMax_));
00367   hh.push_back( m_dbe->book2D(("HB HF Depth 2 "+name.str()+unitname.str()).c_str(),
00368                               (name.str()+" Depth 2 -- HB & HF only ("+unittitle.str().c_str()+")"),
00369                               etaBins_,etaMin_,etaMax_,
00370                               phiBins_,phiMin_,phiMax_));
00371   hh.push_back( m_dbe->book2D(("HE Depth 3 "+name.str()+unitname.str()).c_str(),
00372                               (name.str()+" Depth 3 -- HE ("+unittitle.str().c_str()+")"),
00373                               etaBins_,etaMin_,etaMax_,
00374                               phiBins_,phiMin_,phiMax_));
00375   hh.push_back( m_dbe->book2D(("HO ZDC "+name.str()+unitname.str()).c_str(),
00376                               (name.str()+" -- HO & ZDC ("+unittitle.str().c_str()+")"),
00377                               etaBins_,etaMin_,etaMax_,
00378                               phiBins_,phiMin_,phiMax_));
00379   hh.push_back(m_dbe->book2D(("HE Depth 1 "+name.str()+unitname.str()).c_str(),
00380                              (name.str()+" Depth 1 -- HE only ("+unittitle.str().c_str()+")"),
00381                              etaBins_,etaMin_,etaMax_,
00382                              phiBins_,phiMin_,phiMax_));
00383   hh.push_back(m_dbe->book2D(("HE Depth 2 "+name.str()+unitname.str()).c_str(),
00384                              (name.str()+" Depth 2 -- HE only ("+unittitle.str().c_str()+")"),
00385                              etaBins_,etaMin_,etaMax_,
00386                              phiBins_,phiMin_,phiMax_));
00387   for (unsigned int i=0;i<hh.size();++i)
00388     {
00389       hh[i]->setAxisTitle("i#eta",1);
00390       hh[i]->setAxisTitle("i#phi",2);
00391     }
00392   /* 
00393   if (showTiming)
00394     {
00395      cpu_timer.stop();  std::cout <<"TIMER:: HcalBaseMonitor SETUPDEPTHHISTS2D "<<name.str().c_str()<<" -> "<<cpu_timer.cpuTime()<<std::endl;
00396     }
00397   */
00398   return;
00399 } // void HcalBaseMonitor::setupDepthHists2D(std::vector<MonitorElement*> &hh, std::string Name, std::string Units)
00400 
00401 
00402 // *************************************************************** //
00403 
00404 void HcalBaseMonitor::setupDepthHists2D(MonitorElement* &h, std::vector<MonitorElement*> &hh, std::string Name, std::string Units, 
00405                                         int nbinsx, int lowboundx, int highboundx, 
00406                                         int nbinsy, int lowboundy, int highboundy)
00407 {
00408   /* Code makes overall 2D MonitorElement histogram,
00409      and the vector of 2D MonitorElements for each individual depth.
00410      Bin ranges, sizes are specified by user
00411      DEPRECATE THIS ONCE ALL OLD-STYLE 2D HISTOGRAMS HAVE BEEN REMOVED!
00412   */
00413 
00414   if (showTiming)
00415     {
00416       cpu_timer.reset(); cpu_timer.start();
00417     }
00418 
00419   std::stringstream name;
00420   name<<Name;
00421   std::stringstream unitname;
00422   std::stringstream unittitle;
00423   if (Units.empty())
00424     {
00425       unitname<<Units;
00426       unittitle<<"No Units";
00427     }
00428   else
00429     {
00430       unitname<<" "<<Units;
00431       unittitle<<Units;
00432     }
00433 
00434   h=m_dbe->book2D(("All "+name.str()+unitname.str()).c_str(),
00435                   (name.str() + " for all HCAL ("+unittitle.str().c_str()+")"),
00436                   nbinsx, lowboundx, highboundx,
00437                   nbinsy, lowboundy, highboundy);
00438 
00439   setupDepthHists2D(hh, Name, Units, 
00440                     nbinsx, lowboundx, highboundx,
00441                     nbinsy, lowboundy, highboundy);
00442 
00443 
00444   if (showTiming)
00445     {
00446       cpu_timer.stop();  std::cout <<"TIMER:: HcalBaseMonitor SETUPDEPTHHISTS2D_OVERALL "<<name.str().c_str()<<" -> "<<cpu_timer.cpuTime()<<std::endl;
00447     }
00448   return;
00449 } // void HcalBaseMonitor::setupDepthHists2D(MonitorElement* &h, std::vector<MonitorElement*> &hh, std::string Name, std::string Units, int nbinsx...)
00450 
00451 // *************************************************************** //
00452 
00453 
00454 void HcalBaseMonitor::setupDepthHists2D(std::vector<MonitorElement*> &hh, std::string Name, std::string Units,
00455                                         int nbinsx, int lowboundx, int highboundx,
00456                                         int nbinsy, int lowboundy, int highboundy)
00457 {
00458   /* Code makes vector of 2D MonitorElements for all 6 depths
00459      (4 depths, + 2 for separate HE histograms).
00460      Bins are automatically set for eta/phi indices
00461      DEPRECATE THIS ONCE ALL OLD-STYLE 2D HISTOGRAMS HAVE BEEN REMOVED!
00462      
00463      
00464   */
00465 
00466   if (showTiming)
00467     {
00468       cpu_timer.reset(); cpu_timer.start();
00469     }
00470 
00471   std::stringstream name;
00472   name<<Name;
00473 
00474   std::stringstream unitname;
00475   std::stringstream unittitle;
00476   if (Units.empty())
00477     {
00478       unitname<<Units;
00479       unittitle<<"No Units";
00480     }
00481   else
00482     {
00483       unitname<<" "<<Units;
00484       unittitle<<Units;
00485     }
00486 
00487   // Push back depth plots
00488   hh.push_back(m_dbe->book2D(("HB HF Depth 1 "+name.str()+unitname.str()).c_str(),
00489                              (name.str()+" Depth 1 -- HB & HF only ("+unittitle.str().c_str()+")"),
00490                              nbinsx, lowboundx, highboundx,
00491                              nbinsy, lowboundy, highboundy));
00492   hh.push_back( m_dbe->book2D(("HB HF Depth 2 "+name.str()+unitname.str()).c_str(),
00493                               (name.str()+" Depth 2 -- HB & HF only ("+unittitle.str().c_str()+")"),
00494                               nbinsx, lowboundx, highboundx,
00495                               nbinsy, lowboundy, highboundy));
00496   hh.push_back( m_dbe->book2D(("HE Depth 3 "+name.str()+unitname.str()).c_str(),
00497                               (name.str()+" Depth 3 -- HE ("+unittitle.str().c_str()+")"),
00498                               nbinsx, lowboundx, highboundx,
00499                               nbinsy, lowboundy, highboundy));
00500   hh.push_back( m_dbe->book2D(("HO ZDC "+name.str()+unitname.str()).c_str(),
00501                               (name.str()+" -- HO & ZDC ("+unittitle.str().c_str()+")"),
00502                               nbinsx, lowboundx, highboundx,
00503                               nbinsy, lowboundy, highboundy));
00504   hh.push_back(m_dbe->book2D(("HE Depth 1 "+name.str()+unitname.str()).c_str(),
00505                              (name.str()+" Depth 1 -- HE only ("+unittitle.str().c_str()+")"),
00506                              nbinsx, lowboundx, highboundx,
00507                              nbinsy, lowboundy, highboundy));
00508   hh.push_back(m_dbe->book2D(("HE Depth 2 "+name.str()+unitname.str()).c_str(),
00509                              (name.str()+" Depth 2 -- HE only ("+unittitle.str().c_str()+")"),
00510                              nbinsx, lowboundx, highboundx,
00511                              nbinsy, lowboundy, highboundy));
00512  
00513   if (showTiming)
00514     {
00515       cpu_timer.stop();  std::cout <<"TIMER:: HcalBaseMonitor SETUPDEPTHHISTS2D "<<name.str().c_str()<<" -> "<<cpu_timer.cpuTime()<<std::endl;
00516     }
00517 
00518   return;
00519 } // void HcalBaseMonitor::setupDepthHists2D(std::vector<MonitorElement*> &hh, std::string Name, std::string Units)
00520 
00521 // ****************************************** //
00522 
00523 void HcalBaseMonitor::setupDepthHists1D(MonitorElement* &h, std::vector<MonitorElement*> &hh, std::string Name, std::string Units, int lowbound, int highbound, int Nbins)
00524 {
00525   // Makes an overall 1D Monitor Element (for summing over depths) for h, and creates individual depth Monitor Elements for hh
00526   if (showTiming)
00527     {
00528       cpu_timer.reset(); cpu_timer.start();
00529     }
00530 
00531   std::stringstream name;
00532   name<<Name;
00533 
00534   std::stringstream unitname;
00535   std::stringstream unittitle;
00536   if (Units.empty())
00537     {
00538       unitname<<Units;
00539       unittitle<<"No Units";
00540     }
00541   else
00542     {
00543       unitname<<" "<<Units;
00544       unittitle<<Units;
00545     }
00546   
00547   // Create overall 1D Monitor Element
00548   h=m_dbe->book1D(("All "+name.str()+unitname.str()).c_str(),
00549                   (name.str() + " for all HCAL ("+unittitle.str().c_str()+")"),
00550                   Nbins,lowbound,highbound);
00551   h->setAxisTitle(unitname.str().c_str(),1);
00552   
00553   // Create vector of Monitor Elements for individual depths
00554   setupDepthHists1D(hh, Name, Units, lowbound, highbound, Nbins);
00555 
00556    if (showTiming)
00557     {
00558       cpu_timer.stop();  std::cout <<"TIMER:: HcalBaseMonitor SETUPDEPTHHISTS1D_OVERALL "<<name.str().c_str()<<" -> "<<cpu_timer.cpuTime()<<std::endl;
00559     }
00560    return;
00561 
00562 } //void HcalBaseMonitor::setupDepthHists1D(MonitorElement* &h, std::vector<MonitorElement*> &hh, std::string Name, std::string Units)
00563 
00564 
00565 
00566 void HcalBaseMonitor::setupDepthHists1D(std::vector<MonitorElement*> &hh, std::string Name, std::string Units, int lowbound, int highbound, int Nbins)
00567 {
00568   // Makes histograms just for the vector of Monitor Elements
00569   if (showTiming)
00570     {
00571       cpu_timer.reset(); cpu_timer.start();
00572     }
00573   
00574   std::stringstream name;
00575   name<<Name;
00576   std::stringstream unitname;
00577   std::stringstream unittitle;
00578   if (Units.empty())
00579     {
00580       unitname<<Units;
00581       unittitle<<"No Units";
00582     }
00583   else
00584     {
00585       unitname<<" "<<Units;
00586       unittitle<<Units;
00587     }
00588 
00589   // Push back depth plots
00590   hh.push_back(m_dbe->book1D(("HB "+name.str()+unitname.str()).c_str(),
00591                              (name.str()+" HB ("+unittitle.str().c_str()+")"),
00592                              Nbins,lowbound,highbound));
00593   hh.push_back( m_dbe->book1D(("HE "+name.str()+unitname.str()).c_str(),
00594                               (name.str()+" HE ("+unittitle.str().c_str()+")"),
00595                               Nbins,lowbound,highbound));
00596   hh.push_back( m_dbe->book1D(("HO "+name.str()+unitname.str()).c_str(),
00597                               (name.str()+" HO ("+unittitle.str().c_str()+")"),
00598                               Nbins,lowbound,highbound));
00599   hh.push_back( m_dbe->book1D(("HF "+name.str()+unitname.str()).c_str(),
00600                               (name.str()+" HF ("+unittitle.str().c_str()+")"),
00601                               Nbins,lowbound,highbound));
00602 
00603   for (unsigned int i=0;i<hh.size();++i)
00604     {
00605       hh[i]->setAxisTitle(unitname.str().c_str(),1);
00606     }
00607  
00608   if (showTiming)
00609     {
00610       cpu_timer.stop();  std::cout <<"TIMER:: HcalBaseMonitor SETUPDEPTHHISTS1D "<<name.str().c_str()<<" -> "<<cpu_timer.cpuTime()<<std::endl;
00611     }
00612 
00613   return;
00614 } // void HcalBaseMonitor::setupDepthHists1D(std::vector<MonitorElement*> &hh, std::string Name, std::string Units, int lowbound, int highbound, int Nbins)
00615 
00616 
00617 void HcalBaseMonitor::setMinMaxHists2D(std::vector<MonitorElement*> &hh, double min, double max)
00618 {
00619   for (unsigned int i=0; i<hh.size();++i)
00620     {
00621       TH2F* histo=hh[i]->getTH2F();
00622       histo->SetMinimum(min);
00623       histo->SetMaximum(max);
00624     }
00625   return;
00626 }
00627 
00628 void HcalBaseMonitor::setMinMaxHists1D(std::vector<MonitorElement*> &hh, double min, double max)
00629 {
00630   for (unsigned int i=0; i<hh.size();++i)
00631     {
00632       TH1F* histo=hh[i]->getTH1F();
00633       histo->SetMinimum(min);
00634       histo->SetMaximum(max);
00635     }
00636   return;
00637 }
00638 
00639 void HcalBaseMonitor::periodicReset()
00640 {
00641   // when called, reset all counters, and all histograms
00642   if (ProblemCells!=0) ProblemCells->Reset();
00643   for (unsigned int i=0;i<ProblemCellsByDepth.depth.size();++i)
00644     {
00645       if (ProblemCellsByDepth.depth[i]!=0) 
00646         ProblemCellsByDepth.depth[i]->Reset();
00647     }
00648   return;
00649 }