CMS 3D CMS Logo

SimJetResponseAnalysis.h

Go to the documentation of this file.
00001 #ifndef SIMJETCORRECTIONSANALYSIS_H
00002 #define SIMJETCORRECTIONSANALYSIS_H
00003 //---------------------------------------------------------------------------------   
00004 //  The code to make Jet correction plots from the Simulated jets
00005 //  
00006 //  November 21, 2006   Anwar A Bhatti  The Rockefeller University, New York NY
00007 //  
00008 //----------------------------------------------------------
00009 
00010 #include "TGraph.h"
00011 #include "TGraphErrors.h"
00012 #include "TH1.h"
00013 #include "TH2.h"
00014 #include "TF1.h"
00015 #include "TFile.h"
00016 #include "TNamed.h"
00017 
00018 #include <vector>
00019 #include <map>
00020 
00021 #include "FWCore/Framework/interface/EDAnalyzer.h"
00022 #include "DataFormats/Common/interface/EDProductfwd.h"
00023 #include "DataFormats/JetReco/interface/CaloJetfwd.h"
00024 #include "DataFormats/JetReco/interface/GenJetfwd.h"
00025 #include "DataFormats/METReco/interface/GenMET.h"
00026 #include "DataFormats/METReco/interface/GenMETCollection.h"
00027 #include "DataFormats/METReco/interface/CaloMET.h"
00028 #include "DataFormats/METReco/interface/CaloMETCollection.h"
00029 
00030 
00031 
00032 class SimJetResponseAnalysis : public edm::EDAnalyzer {
00033 
00034  public:
00035 
00036   explicit SimJetResponseAnalysis(edm::ParameterSet const& cfg);
00037   virtual void analyze(edm::Event const& e, edm::EventSetup const& iSetup);
00038   virtual void endJob();
00039 
00040   SimJetResponseAnalysis();
00041   void analyze(const reco::GenJetCollection& genjets,const reco::CaloJetCollection& recjets,
00042                const reco::GenMETCollection& genmet, const reco::CaloMETCollection& recmet);
00043   void done();
00044 
00045 
00046   void fillHist1D(const TString& histName, const Double_t& x, const Double_t& wt=1.0);
00047   void fillHist2D(const TString& histName, const Double_t& x, const Double_t& y,  const Double_t& wt=1.0);
00048 
00049 
00050   void bookHistograms();
00051   void bookGeneralHistograms();
00052 
00053   void bookMetHists(const TString& prefix);
00054   template <typename T> void fillMetHists(const T& mets, const TString& prefx);
00055 
00056   void bookJetHistograms(const TString& prefix);
00057   template <typename T> void fillJetHists(const T& jets, const TString& prefx);
00058 
00059   int GetPtBin(double GenPtJet);
00060   int TowerNumber(double eta);
00061   int GetEtaBin(double eta);
00062   void GetSimJetResponse();
00063   void bookSimJetResponse();
00064 
00065   void SimulatedJetResponse(const reco::GenJetCollection& genjets,const reco::CaloJetCollection& calojets);
00066 
00067 private:
00068 
00069   // input variables
00070 
00071   std::string histogramFile_;
00072 
00073   int NJetMax_;
00074   double MatchRadius_;
00075   double RecJetPtMin_;
00076   std::vector<double> GenJetPtBins_;
00077   std::vector<double> RecJetEtaBins_;
00078   int  NPtBins;
00079   int  NEtaBins;
00080 
00081   TFile* hist_file_; // pointer to Histogram file
00082 
00083   // use the map function to store the histograms
00084 
00085   std::map<TString, TH1*> m_HistNames1D;
00086   std::map<TString, TH2*> m_HistNames2D;
00087   std::map<TString, TProfile*> m_HistNamesProf;
00088   std::map<TString, TGraph*> m_HistNamesGraph;
00089 
00090   std::string genjets_,recjets_,genmet_,recmet_;
00091   TString gjetpfx, rjetpfx,gmetpfx, rmetpfx,calopfx;
00092 
00093 };
00094 
00095 #endif

Generated on Tue Jun 9 17:39:35 2009 for CMSSW by  doxygen 1.5.4