CMS 3D CMS Logo

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/ParameterSet/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 reco::MuonCollection::const_iterator MuonIterator;
00059   typedef edm::Handle<reco::IsoDepositMap> MuIsoDepHandle;
00060   typedef const reco::IsoDeposit MuIsoDepRef;
00061   
00062 public:
00063   //---------methods----------------------------
00064   explicit MuIsoValidation(const edm::ParameterSet&);
00065   ~MuIsoValidation();
00066   
00067   
00068 private:
00069   //---------methods----------------------------
00070   virtual void beginJob(const edm::EventSetup&) ;
00071   virtual void analyze(const edm::Event&, const edm::EventSetup&);
00072   virtual void endJob() ;
00073   void InitStatics();
00074   void RecordData(MuonIterator muon, MuIsoDepRef& tkDep,  
00075                   MuIsoDepRef& ecalDep, MuIsoDepRef& hcalDep, 
00076                   MuIsoDepRef& hoDep);//Fills Histograms with info from single muon
00077   void InitHistos();//adds title, bin information to member histograms
00078   void MakeLogBinsForProfile(Double_t* bin_edges, const double min, const double max);
00079   void FillHistos();//Fills histograms with data
00080   void NormalizeHistos(); //Normalize to number of muons
00081   TH1* GetTH1FromMonitorElement(MonitorElement* me);
00082   TH2* GetTH2FromMonitorElement(MonitorElement* me);
00083   TProfile* GetTProfileFromMonitorElement(MonitorElement* me);
00084   
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   
00095   //root file name
00096   std::string rootfilename;
00097   // Directories within the rootfile
00098   std::string dirName;
00099 
00100   //Histogram parameters
00101   static const int NUM_VARS = 11;
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   
00119   //---------------Dynamic Variables---------------------
00120   
00121   //MonitorElement
00122   DQMStore* dbe;
00123   
00124   //The Data
00125   int theMuonData;//[number of muons]
00126   double theData[NUM_VARS];
00127   
00128   //Histograms
00129   MonitorElement* h_nMuons;
00130   std::vector<MonitorElement*> h_1D;//[NUM_VARS]
00131   std::vector<MonitorElement*> cd_plots;//[NUM_VARS]
00132   std::vector< std::vector<MonitorElement*> > h_2D;//[NUM_VARS][NUM_VARS]
00133   std::vector< std::vector<MonitorElement*> > p_2D;//[NUM_VARS][NUM_VARS]
00134   
00135   //Counters
00136   int nEvents;
00137   int nIncMuons;
00138   int nCombinedMuons;
00139   
00140   //enums for monitorElement
00141   enum {NOAXIS,XAXIS,YAXIS,ZAXIS};
00142 };
00143 

Generated on Tue Jun 9 17:49:25 2009 for CMSSW by  doxygen 1.5.4