CMS 3D CMS Logo

DijetRatio.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: DijetRatio
4 // Class: DijetRatio
5 //
13 //
14 // Original Author: Manoj Jha
15 // Created: Thu Apr 12 15:04:37 CDT 2007
16 // Kalanand Mishra (November 22, 2009):
17 // Modified and cleaned up to work in 3.3.X
18 //
19 //
20 
22 
23 template <class Jet>
25  //get name of output file with histograms
26  fOutputFileName = iConfig.getUntrackedParameter<std::string>("HistoFileName", "DijetRatio.root");
27 
28  // get names of modules, producing object collections
29  m_Mid5CorRecJetsSrc = iConfig.getParameter<std::string>("CorrectedJets");
30  m_Mid5CaloJetsSrc = iConfig.getParameter<std::string>("UnCorrectedJets");
31 
32  // eta limit for numerator and denominator
33  m_eta3 = iConfig.getUntrackedParameter<double>("etaInner", 0.7);
34  m_eta4 = iConfig.getUntrackedParameter<double>("etaOuter", 1.3);
35 }
36 
37 template <class Jet>
39  // do anything here that needs to be done at desctruction time
40  // (e.g. close files, deallocate resources etc.)
41 }
42 
43 //
44 // member functions
45 //
46 
47 // ------------ method called to for each event ------------
48 
49 template <class Jet>
51  using namespace edm;
52 
53  // get calo jet collection
54  Handle<JetCollection> Mid5CorRecJets;
55  iEvent.getByLabel(m_Mid5CorRecJetsSrc, Mid5CorRecJets);
56 
57  Handle<JetCollection> Mid5CaloJets;
58  iEvent.getByLabel(m_Mid5CaloJetsSrc, Mid5CaloJets);
59 
60  histoFill(hCalo, Mid5CaloJets, m_eta3, m_eta4);
61  histoFill(hCor, Mid5CorRecJets, m_eta3, m_eta4);
62 }
63 
64 // ------------ method called once each job just before starting event loop ------------
65 template <class Jet>
67  hOutputFile = new TFile(fOutputFileName.c_str(), "RECREATE");
68 
69  // Histo Initializations for Jets
70  hInit(hCalo, "DijetRatio_UnCorrectedJets");
71  hInit(hCor, "DijetRatio_CorrectedJets");
72 
73  return;
74 }
75 
76 // ------------ method called once each job just after ending the event loop ------------
77 
78 template <class Jet>
80  hOutputFile->cd();
81  for (int i = 0; i < histoSize; ++i) {
82  hCalo[i]->Write();
83  hCor[i]->Write();
84  }
85  hOutputFile->Close();
86 
87  return;
88 }
89 
DijetRatio< reco::PFJet > DijetRatioPFJets
Definition: DijetRatio.cc:98
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
~DijetRatio() override
Definition: DijetRatio.cc:38
DijetRatio(const edm::ParameterSet &)
Definition: DijetRatio.cc:24
void endJob() override
Definition: DijetRatio.cc:79
T getUntrackedParameter(std::string const &, T const &) const
int iEvent
Definition: GenABIO.cc:224
DijetRatio< reco::CaloJet > DijetRatioCaloJets
Definition: DijetRatio.cc:92
DijetRatio< reco::GenJet > DijetRatioGenJets
Definition: DijetRatio.cc:95
const int histoSize
Definition: DijetRatio.h:54
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: DijetRatio.cc:50
void beginJob() override
Definition: DijetRatio.cc:66
void histoFill(TH1F *jetHisto[], edm::Handle< R > jetsRec, double eta1, double eta2)
Definition: DijetRatio.h:82
HLT enums.
void hInit(TH1F *hJet[], const char *name)
Definition: DijetRatio.h:57