CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/DQM/HcalMonitorTasks/interface/HcalBaseMonitor.h

Go to the documentation of this file.
00001 #ifndef DQM_HCALMONITORTASKS_HCALBASEMONITOR_H
00002 #define DQM_HCALMONITORTASKS_HCALBASEMONITOR_H
00003 
00004 // Define number of eta, phi bins for histogram objects
00005 #define ETABINS 87
00006 #define PHIBINS 72
00007 
00008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00009 #include "FWCore/Framework/interface/Event.h"
00010 
00011 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00012 #include "CalibFormats/HcalObjects/interface/HcalCoderDb.h"
00013 #include "CalibFormats/HcalObjects/interface/HcalCalibrations.h"
00014 #include "CalibFormats/HcalObjects/interface/HcalDbService.h"
00015 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
00016 #include "CondFormats/HcalObjects/interface/HcalQIECoder.h"
00017 #include "CalibFormats/HcalObjects/interface/HcalCoder.h"
00018 
00019 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00020 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
00021 #include "EventFilter/HcalRawToDigi/interface/HcalDCCHeader.h"
00022 #include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h"
00023 #include "FWCore/Utilities/interface/CPUTimer.h"
00024 
00025 #include "DQMServices/Core/interface/DQMStore.h"
00026 #include "DQMServices/Core/interface/MonitorElement.h"
00027 
00028 #include "DQM/HcalMonitorTasks/interface/HcalEtaPhiHists.h"
00029 
00030 #include "TH1F.h"
00031 #include "TH2F.h"
00032 #include <map>
00033 
00034 #include <iostream>
00035 
00036 // Temporary fix:  Add this into base class until I figure why multiple inclusions are a problem -- Jeff, 23 May 2008
00037 #include "CalibFormats/HcalObjects/interface/HcalCalibrationWidths.h"
00038 
00045 class HcalBaseMonitor {
00046 public:
00047   HcalBaseMonitor(); 
00048   virtual ~HcalBaseMonitor(); 
00049 
00050   virtual void setup(const edm::ParameterSet& ps, DQMStore* dbe);
00051   virtual void beginRun();
00052   virtual void done();
00053   virtual void clearME();
00054   virtual void periodicReset();
00055   
00056 
00057   void setVerbosity(int verb) { fVerbosity = verb; }
00058   int getVerbosity() const { return fVerbosity; }
00059   
00060   void setDiagnostics(bool myval) { makeDiagnostics=myval;}
00061   bool getDiagnostics() const { return makeDiagnostics;}
00062 
00063   bool vetoCell(HcalDetId& id);
00064   void hideKnownBadCells();
00065   
00066   // Set up vectors of Monitors for individual depths
00067   // 2-D histograms with eta-phi binning assumed
00068   void setupDepthHists2D(MonitorElement* &h, std::vector<MonitorElement*> &hh, std::string Name, std::string Units);
00069   void setupDepthHists2D(std::vector<MonitorElement*> &hh, std::string Name, std::string Units);
00070   void SetupEtaPhiHists(MonitorElement* &h, EtaPhiHists& hh, std::string Name, std::string Units);
00071   void SetupEtaPhiHists(EtaPhiHists &hh, std::string Name, std::string Units);
00072 
00073 
00074   // Generic 2-D histograms
00075   void setupDepthHists2D(MonitorElement* &h, std::vector<MonitorElement*> &hh, std::string Name, std::string Units,
00076                          int nbinsx, int lowboundx, int highboundx,
00077                          int nbinsy, int lowboundy, int highboundy);
00078   
00079   void setupDepthHists2D(std::vector<MonitorElement*> &hh, std::string Name, std::string Units,
00080                          int nbinsx, int lowboundx, int highboundx,
00081                          int nbinsy, int lowboundy, int highboundy);
00082 
00083   void setMinMaxHists2D(std::vector<MonitorElement*> &hh, double min, double max);
00084 
00085   // 1-D histograms
00086   void setupDepthHists1D(MonitorElement* &h, std::vector<MonitorElement*> &hh, std::string Name, std::string Units, int lowbound, int highbound, int Nbins);
00087   void setupDepthHists1D(std::vector<MonitorElement*> &hh, std::string Name, std::string Units, int lowbound, int highbound, int Nbins);
00088   void setMinMaxHists1D(std::vector<MonitorElement*> &hh, double min, double max);
00089 
00090   void processEvent();
00091   void beginLuminosityBlock(int lb);
00092   void endLuminosityBlock();
00093 
00094 protected:
00095   void LumiBlockUpdate(int lb);
00096   int fVerbosity;
00097   bool showTiming; // controls whether to show timing diagnostic info
00098   bool dump2database; // controls whether output written to file for database (will eventually write db directly)
00099   int checkNevents_; // controls when histograms should be updated
00100 
00101   double etaMax_, etaMin_;
00102   double phiMax_, phiMin_;
00103   int etaBins_, phiBins_;
00104   double minErrorFlag_;
00105 
00106   bool checkHB_, checkHE_, checkHO_, checkHF_;
00107   int resetNevents_;
00108   int Nlumiblocks_;
00109 
00110   edm::CPUTimer cpu_timer; // 
00111     
00112   bool makeDiagnostics; // controls whether to make diagnostic plots
00113   
00114   DQMStore* m_dbe;
00115   bool Online_; // tracks whether code is run online or offline 
00116   std::vector<std::string> badCells_; // keeps list of bad cells that should be ignored
00117   std::string rootFolder_;
00118   std::string baseFolder_;
00119 
00120   std::vector<int> AllowedCalibTypes_;
00121   // Eventually, remove these -- problem cells get processed in client
00122   MonitorElement* ProblemCells;
00123   EtaPhiHists ProblemCellsByDepth;
00124 
00125   int ievt_; // number of events processed (can be reset periodically)
00126   int levt_; // number of events in current luminosity block
00127   int tevt_; // total # of events
00128   bool LBprocessed_; // indicates that histograms have been filled for current LB
00129   MonitorElement* meEVT_;
00130   MonitorElement* meTOTALEVT_;
00131   int lumiblock;
00132   int oldlumiblock;
00133   int NumBadHB, NumBadHE, NumBadHO, NumBadHF;
00134   MonitorElement* ProblemsVsLB;
00135   MonitorElement *ProblemsVsLB_HB, *ProblemsVsLB_HE, *ProblemsVsLB_HO, *ProblemsVsLB_HF, *ProblemsVsLB_HBHEHF;
00136 
00137 };
00138 
00139 #endif