Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:34:55

0001 // -*- C++ -*-
0002 //
0003 // Package:    DijetRatio
0004 // Class:      DijetRatio
0005 //
0006 /**\class DijetRatio DijetRatio.cc RecoJets/DijetRatio/src/DijetRatio.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Manoj Jha
0015 //         Created:  Thu Apr 12 15:04:37 CDT 2007
0016 // Kalanand Mishra (November 22, 2009):
0017 //    Modified and cleaned up to work in 3.3.X
0018 //
0019 //
0020 
0021 #include "RecoJets/JetAnalyzers/interface/DijetRatio.h"
0022 
0023 template <class Jet>
0024 DijetRatio<Jet>::DijetRatio(const edm::ParameterSet& iConfig) {
0025   //get name of output file with histograms
0026   fOutputFileName = iConfig.getUntrackedParameter<std::string>("HistoFileName", "DijetRatio.root");
0027 
0028   // get names of modules, producing object collections
0029   m_Mid5CorRecJetsSrc = iConfig.getParameter<std::string>("CorrectedJets");
0030   m_Mid5CaloJetsSrc = iConfig.getParameter<std::string>("UnCorrectedJets");
0031 
0032   // eta limit for numerator and denominator
0033   m_eta3 = iConfig.getUntrackedParameter<double>("etaInner", 0.7);
0034   m_eta4 = iConfig.getUntrackedParameter<double>("etaOuter", 1.3);
0035 }
0036 
0037 template <class Jet>
0038 DijetRatio<Jet>::~DijetRatio() {
0039   // do anything here that needs to be done at desctruction time
0040   // (e.g. close files, deallocate resources etc.)
0041 }
0042 
0043 //
0044 // member functions
0045 //
0046 
0047 // ------------ method called to for each event  ------------
0048 
0049 template <class Jet>
0050 void DijetRatio<Jet>::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0051   using namespace edm;
0052 
0053   // get calo jet collection
0054   Handle<JetCollection> Mid5CorRecJets;
0055   iEvent.getByLabel(m_Mid5CorRecJetsSrc, Mid5CorRecJets);
0056 
0057   Handle<JetCollection> Mid5CaloJets;
0058   iEvent.getByLabel(m_Mid5CaloJetsSrc, Mid5CaloJets);
0059 
0060   histoFill(hCalo, Mid5CaloJets, m_eta3, m_eta4);
0061   histoFill(hCor, Mid5CorRecJets, m_eta3, m_eta4);
0062 }
0063 
0064 // ------------ method called once each job just before starting event loop  ------------
0065 template <class Jet>
0066 void DijetRatio<Jet>::beginJob() {
0067   hOutputFile = new TFile(fOutputFileName.c_str(), "RECREATE");
0068 
0069   // Histo Initializations for  Jets
0070   hInit(hCalo, "DijetRatio_UnCorrectedJets");
0071   hInit(hCor, "DijetRatio_CorrectedJets");
0072 
0073   return;
0074 }
0075 
0076 // ------------ method called once each job just after ending the event loop  ------------
0077 
0078 template <class Jet>
0079 void DijetRatio<Jet>::endJob() {
0080   hOutputFile->cd();
0081   for (int i = 0; i < histoSize; ++i) {
0082     hCalo[i]->Write();
0083     hCor[i]->Write();
0084   }
0085   hOutputFile->Close();
0086 
0087   return;
0088 }
0089 
0090 #include "FWCore/Framework/interface/MakerMacros.h"
0091 /////////// Calo Jet Instance ////////
0092 typedef DijetRatio<reco::CaloJet> DijetRatioCaloJets;
0093 DEFINE_FWK_MODULE(DijetRatioCaloJets);
0094 /////////// Gen Jet Instance ////////
0095 typedef DijetRatio<reco::GenJet> DijetRatioGenJets;
0096 DEFINE_FWK_MODULE(DijetRatioGenJets);
0097 /////////// PF Jet Instance ////////
0098 typedef DijetRatio<reco::PFJet> DijetRatioPFJets;
0099 DEFINE_FWK_MODULE(DijetRatioPFJets);