CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/Validation/MuonIsolation/interface/MuIsoValidation.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // MuIsoValidation.h
00003 // Package:    Muon Isolation Validation
00004 // Class:      MuIsoValidation
00005 // 
00006 /*
00007 
00008  Description: Muon Isolation Validation 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 MuIsoValidation::CONST_INT = 5;
00016                 FooType MuIsoValidation::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: MuIsoValidation
00055 //--------------------------------------
00056 class MuIsoValidation : 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 MuIsoValidation(const edm::ParameterSet&);
00066   ~MuIsoValidation();
00067   
00068   
00069 private:
00070   //---------methods----------------------------
00071   virtual void beginJob() ;
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 MakeLogBinsForProfile(Double_t* bin_edges, const double min, const double max);
00078   void FillHistos();//Fills histograms with data
00079   void NormalizeHistos(); //Normalize to number of muons
00080   TH1* GetTH1FromMonitorElement(MonitorElement* me);
00081   TH2* GetTH2FromMonitorElement(MonitorElement* me);
00082   TProfile* GetTProfileFromMonitorElement(MonitorElement* me);
00083   
00084   
00085   //----------Static Variables---------------
00086   
00087   //Collection labels
00088   edm::InputTag Muon_Tag;
00089   edm::InputTag tkIsoDeposit_Tag;
00090   edm::InputTag hcalIsoDeposit_Tag;
00091   edm::InputTag ecalIsoDeposit_Tag;
00092   edm::InputTag hoIsoDeposit_Tag;
00093   
00094   //root file name
00095   std::string rootfilename;
00096   // Directories within the rootfile
00097   std::string dirName;
00098   std::string subDirName;
00099 
00100   //Histogram parameters
00101   static const int NUM_VARS = 21;
00102   double L_BIN_WIDTH;//large bins
00103   double S_BIN_WIDTH;//small bins
00104   int LOG_BINNING_ENABLED;//pseudo log binning for profile plots
00105   int NUM_LOG_BINS;
00106   double LOG_BINNING_RATIO;
00107   bool requireCombinedMuon;
00108   
00109   std::string title_sam;
00110   std::string title_cone;
00111   std::string title_cd;
00112   
00113   std::vector<std::string> main_titles;//[NUM_VARS]
00114   std::vector<std::string> axis_titles;//[NUM_VARS]
00115   std::vector<std::string> names;//[NUM_VARS]
00116   std::vector< std::vector<double> > param;//[NUM_VARS][3]
00117   std::vector<int> isContinuous;//[NUM_VARS]
00118   std::vector<int> cdCompNeeded;//[NUM_VARS]
00119   
00120   //---------------Dynamic Variables---------------------
00121   
00122   //MonitorElement
00123   DQMStore* dbe;
00124   
00125   //The Data
00126   int theMuonData;//[number of muons]
00127   double theData[NUM_VARS];
00128   
00129   //Histograms
00130   MonitorElement* h_nMuons;
00131   std::vector<MonitorElement*> h_1D;//[NUM_VARS]
00132   std::vector<MonitorElement*> cd_plots;//[NUM_VARS]
00133   //  std::vector< std::vector<MonitorElement*> > h_2D;//[NUM_VARS][NUM_VARS]
00134   std::vector< std::vector<MonitorElement*> > p_2D;//[NUM_VARS][NUM_VARS]
00135   
00136   //Counters
00137   int nEvents;
00138   int nIncMuons;
00139   //  int nCombinedMuons;
00140   
00141   //enums for monitorElement
00142   enum {NOAXIS,XAXIS,YAXIS,ZAXIS};
00143 };
00144