CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_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 declarations *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 muo
00076   //  void doPFIsoPlots(MuonIterator muon); //Fills Histograms with PF info from single muo (only for GLB)
00077   void InitHistos();//adds title, bin information to member histograms
00078   void FillHistos(int);//Fills histograms with data
00079   void FillNVtxHistos(int);
00080   void NormalizeHistos(); //Normalize to number of muons
00081 
00082   //----- helper methods
00083   int  GetNVtxBin(int); 
00084   TH1* GetTH1FromMonitorElement(MonitorElement* me);
00085 
00086   //----------Static Variables---------------
00087   
00088   //Collection labels
00089   edm::InputTag Muon_Tag;
00090   edm::InputTag tkIsoDeposit_Tag;
00091   edm::InputTag hcalIsoDeposit_Tag;
00092   edm::InputTag ecalIsoDeposit_Tag;
00093   edm::InputTag hoIsoDeposit_Tag;
00094   edm::InputTag theVertexCollectionLabel;
00095 
00096   //root file name
00097   std::string rootfilename;
00098   // Directories within the rootfile
00099   std::string dirName;
00100   //  std::string subDirName;
00101 
00102   //Histogram parameters
00103   static const int NUM_VARS      = 48; // looking at R03 and R05.  Total of 54 histos.
00104   static const int NUM_VARS_2D   = 10; // looking only at R03.  Total of 8 TH2F. 
00105   static const int NUM_VARS_NVTX = 6 ;
00106   
00107   double L_BIN_WIDTH;//large bins
00108   double S_BIN_WIDTH;//small bins
00109   int LOG_BINNING_ENABLED;//pseudo log binning for profile plots
00110   int NUM_LOG_BINS;
00111   double LOG_BINNING_RATIO;
00112   bool requireGLBMuon;
00113   bool requireSTAMuon;
00114   bool requireTRKMuon;
00115 
00116   std::string title_sam;
00117   std::string title_cone;
00118   //  std::string title_cd;
00119   
00120   std::vector<std::string> main_titles;//[NUM_VARS]
00121   std::vector<std::string> axis_titles;//[NUM_VARS]
00122   std::vector<std::string> names;//[NUM_VARS]
00123   std::vector< std::vector<double> > param;//[NUM_VARS][3]
00124   std::vector<int> isContinuous;//[NUM_VARS]
00125   
00126   std::vector<std::string> titles_2D;     //[NUM_VARS]
00127   std::vector<std::string> names_2D;      //[NUM_VARS]
00128 
00129   std::vector<std::string> main_titles_NVtxs;
00130   std::vector<std::string> names_NVtxs;
00131   std::vector<std::string> axis_titles_NVtxs;
00132   //---------------Dynamic Variables---------------------
00133   
00134   //MonitorElement
00135   DQMStore* dbe;
00136   
00137   //The Data
00138   int theMuonData;//[number of muons]
00139   double theData[NUM_VARS];
00140   double theData2D[NUM_VARS_2D];
00141   double theDataNVtx[NUM_VARS_NVTX];
00142 
00143   //Histograms
00144   MonitorElement* h_nMuons;
00145   std::vector<MonitorElement*> h_1D;     //[NUM_VARS]
00146   std::vector<MonitorElement*> h_2D;     //[NUM_VARS_2D]
00147   std::vector<MonitorElement*> h_1D_NVTX;//[NUM_VARS_NVTX]
00148   
00149   //  std::vector<MonitorElement*> cd_plots;//[NUM_VARS]
00150   
00151   //Counters
00152   int nEvents;
00153   int nSTAMuons;
00154   int nGLBMuons;
00155   int nTRKMuons;
00156   
00157   //enums for monitorElement
00158   enum {NOAXIS,XAXIS,YAXIS,ZAXIS};
00159 };
00160