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 {
26 
27  //get name of output file with histograms
28  fOutputFileName = iConfig.getUntrackedParameter<std::string>("HistoFileName",
29  "DijetRatio.root");
30 
31  // get names of modules, producing object collections
32  m_Mid5CorRecJetsSrc = iConfig.getParameter<std::string>("CorrectedJets");
33  m_Mid5CaloJetsSrc = iConfig.getParameter<std::string>("UnCorrectedJets");
34 
35  // eta limit for numerator and denominator
36  m_eta3 = iConfig.getUntrackedParameter<double>("etaInner", 0.7);
37  m_eta4 = iConfig.getUntrackedParameter<double>("etaOuter", 1.3);
38 
39 }
40 
41 
42 
43 template<class Jet>
45 {
46 
47  // do anything here that needs to be done at desctruction time
48  // (e.g. close files, deallocate resources etc.)
49 
50 }
51 
52 
53 //
54 // member functions
55 //
56 
57 // ------------ method called to for each event ------------
58 
59 template<class Jet>
61 {
62  using namespace edm;
63 
64  // get calo jet collection
65  Handle<JetCollection> Mid5CorRecJets;
66  iEvent.getByLabel(m_Mid5CorRecJetsSrc, Mid5CorRecJets);
67 
68  Handle<JetCollection> Mid5CaloJets;
69  iEvent.getByLabel(m_Mid5CaloJetsSrc, Mid5CaloJets);
70 
71  histoFill(hCalo, Mid5CaloJets, m_eta3, m_eta4);
72  histoFill(hCor, Mid5CorRecJets, m_eta3, m_eta4);
73 }
74 
75 
76 
77 // ------------ method called once each job just before starting event loop ------------
78 template <class Jet>
80 {
81  hOutputFile = new TFile( fOutputFileName.c_str(), "RECREATE" ) ;
82 
83  // Histo Initializations for Jets
84  hInit(hCalo, "DijetRatio_UnCorrectedJets");
85  hInit(hCor, "DijetRatio_CorrectedJets");
86 
87  return;
88 }
89 
90 // ------------ method called once each job just after ending the event loop ------------
91 
92 template<class Jet>
94 
95  hOutputFile->cd();
96  for(int i=0; i<histoSize; ++i) {
97  hCalo[i]->Write() ;
98  hCor[i]->Write() ;
99  }
100  hOutputFile->Close() ;
101 
102 return ;
103 }
104 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
DijetRatio< reco::PFJet > DijetRatioPFJets
Definition: DijetRatio.cc:113
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
~DijetRatio() override
Definition: DijetRatio.cc:44
DijetRatio(const edm::ParameterSet &)
Definition: DijetRatio.cc:24
void endJob() override
Definition: DijetRatio.cc:93
return((rh^lh)&mask)
int iEvent
Definition: GenABIO.cc:230
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:535
DijetRatio< reco::CaloJet > DijetRatioCaloJets
Definition: DijetRatio.cc:107
DijetRatio< reco::GenJet > DijetRatioGenJets
Definition: DijetRatio.cc:110
const int histoSize
Definition: DijetRatio.h:54
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: DijetRatio.cc:60
void beginJob() override
Definition: DijetRatio.cc:79
void histoFill(TH1F *jetHisto[], edm::Handle< R > jetsRec, double eta1, double eta2)
Definition: DijetRatio.h:89
HLT enums.
void hInit(TH1F *hJet[], const char *name)
Definition: DijetRatio.h:57