CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/DQMOffline/Muon/interface/MuonIsolationDQM.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // MuonIsolationDQM.h
00003 // Package:    Muon Isolation DQM
00004 // Class:      MuonIsolationDQM
00005 // 
00006 /*
00007 
00008  Description: Muon Isolation DQM class
00009 
00010  NOTE: The static member variable declerations *should* include the key word "static", but 
00011          I haven't found an elegant way to initalize the vectors.  Static primatives (e.g. int, 
00012          float, ...) and simple static objects are easy to initialze.  Outside of the class 
00013          decleration, you would write
00014         
00015                 int MuonIsolationDQM::CONST_INT = 5;
00016                 FooType MuonIsolationDQM::CONST_FOOT = Foo(constructor_argument);
00017         
00018          but you can't do this if you want to, say, initalize a std::vector with a bunch of 
00019          different values.  So, you can't make them static and you have to initialize them using 
00020          a member method.  To keep it consistent, I've just initialized them all in the same 
00021          method, even the simple types.
00022  
00023 */
00024 //
00025 // Original Author:  "C. Jess Riedel", UC Santa Barbara
00026 //         Created:  Tue Jul 17 15:58:24 CDT 2007
00027 //
00028 
00029 //Base class
00030 #include "FWCore/Framework/interface/EDAnalyzer.h"
00031 
00032 //Member types
00033 #include "FWCore/Utilities/interface/InputTag.h"
00034 #include "DQMServices/Core/interface/DQMStore.h"
00035 #include "DQMServices/Core/interface/MonitorElement.h"
00036 #include "FWCore/ServiceRegistry/interface/Service.h"
00037 
00038 //Other include files
00039 #include "DataFormats/MuonReco/interface/Muon.h"
00040 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00041 #include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
00042 #include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h"
00043 
00044 //----------------------------------------
00045 
00046 //Forward declarations
00047 class TH1;
00048 class TH1I;
00049 class TH1D;
00050 class TH2;
00051 class TProfile;
00052 
00053 //------------------------------------------
00054 //  Class Declaration: MuonIsolationDQM
00055 //--------------------------------------
00056 class MuonIsolationDQM : public edm::EDAnalyzer {
00057   //---------namespace and typedefs--------------
00058   typedef edm::View<reco::Muon>::const_iterator MuonIterator;
00059   typedef edm::RefToBase<reco::Muon> MuonBaseRef;
00060   typedef edm::Handle<reco::IsoDepositMap> MuIsoDepHandle;
00061   typedef const reco::IsoDeposit MuIsoDepRef;
00062   
00063 public:
00064   //---------methods----------------------------
00065   explicit MuonIsolationDQM(const edm::ParameterSet&);
00066   ~MuonIsolationDQM();
00067   
00068   
00069 private:
00070   //---------methods----------------------------
00071   virtual void beginJob(void) ;
00072   virtual void analyze(const edm::Event&, const edm::EventSetup&);
00073   virtual void endJob() ;
00074   void InitStatics();
00075   void RecordData(MuonIterator muon);//Fills Histograms with info from single muon
00076   void InitHistos();//adds title, bin information to member histograms
00077   void FillHistos();//Fills histograms with data
00078   void NormalizeHistos(); //Normalize to number of muons
00079   TH1* GetTH1FromMonitorElement(MonitorElement* me);
00080   
00081   //----------Static Variables---------------
00082   
00083   //Collection labels
00084   edm::InputTag Muon_Tag;
00085   edm::InputTag tkIsoDeposit_Tag;
00086   edm::InputTag hcalIsoDeposit_Tag;
00087   edm::InputTag ecalIsoDeposit_Tag;
00088   edm::InputTag hoIsoDeposit_Tag;
00089   
00090   //root file name
00091   std::string rootfilename;
00092   // Directories within the rootfile
00093   std::string dirName;
00094   //  std::string subDirName;
00095 
00096   //Histogram parameters
00097   static const int NUM_VARS = 24; // looking at R03 and R05.  Total of 48 histos.
00098   double L_BIN_WIDTH;//large bins
00099   double S_BIN_WIDTH;//small bins
00100   int LOG_BINNING_ENABLED;//pseudo log binning for profile plots
00101   int NUM_LOG_BINS;
00102   double LOG_BINNING_RATIO;
00103   bool requireGLBMuon;
00104   bool requireSTAMuon;
00105   bool requireTRKMuon;
00106 
00107   std::string title_sam;
00108   std::string title_cone;
00109   //  std::string title_cd;
00110   
00111   std::vector<std::string> main_titles;//[NUM_VARS]
00112   std::vector<std::string> axis_titles;//[NUM_VARS]
00113   std::vector<std::string> names;//[NUM_VARS]
00114   std::vector< std::vector<double> > param;//[NUM_VARS][3]
00115   std::vector<int> isContinuous;//[NUM_VARS]
00116   
00117   //---------------Dynamic Variables---------------------
00118   
00119   //MonitorElement
00120   DQMStore* dbe;
00121   
00122   //The Data
00123   int theMuonData;//[number of muons]
00124   double theData[NUM_VARS];
00125   
00126   //Histograms
00127   MonitorElement* h_nMuons;
00128   std::vector<MonitorElement*> h_1D;//[NUM_VARS]
00129   //  std::vector<MonitorElement*> cd_plots;//[NUM_VARS]
00130   
00131   //Counters
00132   int nEvents;
00133   int nSTAMuons;
00134   int nGLBMuons;
00135   int nTRKMuons;
00136   
00137   //enums for monitorElement
00138   enum {NOAXIS,XAXIS,YAXIS,ZAXIS};
00139 };
00140