CMS 3D CMS Logo

DijetRatio.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    DijetRatio
00004 // Class:      DijetRatio
00005 // 
00013 //
00014 // Original Author:  Manoj Jha
00015 //         Created:  Thu Apr 12 15:04:37 CDT 2007
00016 // $Id: DijetRatio.cc,v 1.2 2007/07/23 21:58:56 apana Exp $
00017 //
00018 //
00019 
00020 #include "RecoJets/JetAnalyzers/interface/DijetRatio.h"
00021 
00022 DijetRatio::DijetRatio(const edm::ParameterSet& iConfig)
00023 {
00024    
00025    //get name of output file with histograms
00026   fOutputFileName = iConfig.getUntrackedParameter<string>("HistOutFile"); 
00027   
00028   // get names of modules, producing object collections
00029   m_Mid5CorRecJetsSrc   = iConfig.getParameter<string>("Mid5CorRecJets");
00030   m_Mid5GenJetsSrc   = iConfig.getParameter<string>("Mid5GenJets");
00031   m_Mid5CaloJetsSrc   = iConfig.getParameter<string>("Mid5CaloJets");
00032   
00033   // eta limit for numerator and denominator
00034   m_eta3   = iConfig.getParameter<double>("v_etaInner");
00035   m_eta4   = iConfig.getParameter<double>("v_etaOuter");
00036 
00037 }
00038 
00039 
00040 DijetRatio::~DijetRatio()
00041 {
00042  
00043    // do anything here that needs to be done at desctruction time
00044    // (e.g. close files, deallocate resources etc.)
00045 
00046 }
00047 
00048 
00049 //
00050 // member functions
00051 //
00052 
00053 // ------------ method called to for each event  ------------
00054 void
00055 DijetRatio::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00056 {
00057    using namespace edm;
00058   
00059    // get calo jet collection
00060    Handle<CaloJetCollection> Mid5CorRecJets;
00061    iEvent.getByLabel(m_Mid5CorRecJetsSrc, Mid5CorRecJets);
00062    
00063    Handle<CaloJetCollection> Mid5CaloJets;
00064    iEvent.getByLabel(m_Mid5CaloJetsSrc, Mid5CaloJets);
00065 
00066    Handle<GenJetCollection> Mid5GenJets;
00067    iEvent.getByLabel(m_Mid5GenJetsSrc, Mid5GenJets);
00068    
00069    //etaRange
00070    /*
00071    float eta1 = -1.0;
00072    float eta2 = -0.5;
00073    float eta3 = 0.5;
00074    float eta4 = 1.0;
00075    */
00076 
00077    
00078    double eta3 = m_eta3;
00079    double eta4 = m_eta4;
00080    double eta1 = -eta4;
00081    double eta2 = -eta3;
00082 
00083    histoFill(hGen, Mid5GenJets, eta1, eta2, eta3, eta4);
00084    histoFill(hCalo, Mid5CaloJets, eta1, eta2, eta3, eta4);
00085    histoFill(hCor, Mid5CorRecJets, eta1, eta2, eta3, eta4);
00086 }
00087 
00088 
00089 // ------------ method called once each job just before starting event loop  ------------
00090 void 
00091 DijetRatio::beginJob(const edm::EventSetup&)
00092 {
00093    hOutputFile   = new TFile( fOutputFileName.c_str(), "RECREATE" ) ;
00094 
00095    //Histo title
00096    char m_hCor[20] = "hCor";
00097    char m_hCalo[20] = "hCalo";
00098    char m_hGen[20] = "hGen";
00099    
00100    // Histo Initializations for  Jets
00101    hInit(hGen, m_hGen);
00102    hInit(hCalo, m_hCalo);
00103    hInit(hCor, m_hCor);
00104 
00105    return;
00106 }
00107 
00108 // ------------ method called once each job just after ending the event loop  ------------
00109 void 
00110 DijetRatio::endJob() {
00111 hOutputFile->Write() ;
00112 hOutputFile->Close() ;
00113 return ;
00114 }
00115 
00116 #include "FWCore/Framework/interface/MakerMacros.h"
00117 DEFINE_FWK_MODULE(DijetRatio);

Generated on Tue Jun 9 17:43:40 2009 for CMSSW by  doxygen 1.5.4