20 |
|
|
21 |
|
// system include files |
22 |
|
#include <memory> |
23 |
+ |
#include <iostream> |
24 |
|
|
25 |
|
// user include files |
26 |
|
#include "FWCore/Framework/interface/Frameworkfwd.h" |
40 |
|
#include "DataFormats/JetReco/interface/CaloJetCollection.h" |
41 |
|
#include "DataFormats/JetReco/interface/GenJetCollection.h" |
42 |
|
|
43 |
+ |
#include "CommonTools/UtilAlgos/interface/TFileService.h" |
44 |
+ |
#include "FWCore/ServiceRegistry/interface/Service.h" |
45 |
+ |
|
46 |
+ |
|
47 |
|
#include "TTree.h" |
48 |
|
|
49 |
|
using namespace std; |
88 |
|
|
89 |
|
// ----------member data --------------------------- |
90 |
|
|
91 |
+ |
bool usePat_; |
92 |
+ |
bool doMC_; |
93 |
+ |
|
94 |
|
double genJetPtMin_; |
95 |
|
|
96 |
+ |
|
97 |
+ |
edm::InputTag jetTag_; |
98 |
+ |
|
99 |
|
JRA jra_; |
100 |
|
TTree* t; |
101 |
|
|
103 |
|
edm::Handle<reco::Centrality> cent; |
104 |
|
|
105 |
|
edm::Handle<reco::JetView> jets; |
106 |
+ |
// edm::Handle<pat::JetCollection> jets; |
107 |
|
|
108 |
|
|
109 |
< |
|
109 |
> |
edm::Service<TFileService> fs; |
110 |
|
|
111 |
|
}; |
112 |
|
|
126 |
|
{ |
127 |
|
//now do what ever initialization is needed |
128 |
|
genJetPtMin_ = 0; |
129 |
+ |
|
130 |
+ |
usePat_ = false; |
131 |
+ |
doMC_ = false; |
132 |
+ |
|
133 |
+ |
jetTag_ = edm::InputTag("selectedPatJets"); |
134 |
+ |
|
135 |
|
} |
136 |
|
|
137 |
|
|
154 |
|
{ |
155 |
|
using namespace edm; |
156 |
|
|
157 |
+ |
iEvent.getByLabel(jetTag_,jets); |
158 |
|
|
159 |
+ |
jra_.nref = 0; |
160 |
|
for(unsigned int j = 0 ; j < jets->size(); ++j){ |
141 |
– |
|
142 |
– |
const pat::Jet jet = (pat::Jet)((*jets)[j]); |
161 |
|
|
162 |
< |
if(jet.genJet() != 0){ |
163 |
< |
|
164 |
< |
if(jet.genJet()->pt() < genJetPtMin_) continue; |
165 |
< |
jra_.refpt[jra_.nref] = jet.genJet()->pt(); |
166 |
< |
jra_.refeta[jra_.nref] = jet.genJet()->eta(); |
167 |
< |
jra_.refphi[jra_.nref] = jet.genJet()->phi(); |
168 |
< |
|
169 |
< |
jra_.jtpt[jra_.nref] = jet.pt(); |
170 |
< |
jra_.jteta[jra_.nref] = jet.eta(); |
171 |
< |
jra_.jtphi[jra_.nref] = jet.phi(); |
172 |
< |
|
173 |
< |
jra_.nref++; |
174 |
< |
|
162 |
> |
// const pat::Jet& jet = (*jets)[j]; |
163 |
> |
const reco::Jet jet = (*jets)[j]; |
164 |
> |
jra_.jtpt[jra_.nref] = jet.pt(); |
165 |
> |
jra_.jteta[jra_.nref] = jet.eta(); |
166 |
> |
jra_.jtphi[jra_.nref] = jet.phi(); |
167 |
> |
|
168 |
> |
if(usePat_){ |
169 |
> |
const pat::Jet& patjet = (*jets)[j]; |
170 |
> |
|
171 |
> |
if(doMC_ && patjet.genJet() != 0){ |
172 |
> |
// if(jet.genJet()->pt() < genJetPtMin_) continue; |
173 |
> |
jra_.refpt[jra_.nref] = patjet.genJet()->pt(); |
174 |
> |
jra_.refeta[jra_.nref] = patjet.genJet()->eta(); |
175 |
> |
jra_.refphi[jra_.nref] = patjet.genJet()->phi(); |
176 |
> |
|
177 |
> |
}else{ |
178 |
> |
jra_.refpt[jra_.nref] = -99; |
179 |
> |
jra_.refeta[jra_.nref] = -99; |
180 |
> |
jra_.refphi[jra_.nref] = -99; |
181 |
> |
} |
182 |
|
} |
183 |
+ |
|
184 |
+ |
jra_.nref++; |
185 |
+ |
|
186 |
|
} |
187 |
|
|
188 |
|
t->Fill(); |
189 |
|
|
162 |
– |
|
163 |
– |
|
164 |
– |
#ifdef THIS_IS_AN_EVENT_EXAMPLE |
165 |
– |
Handle<ExampleData> pIn; |
166 |
– |
iEvent.getByLabel("example",pIn); |
167 |
– |
#endif |
168 |
– |
|
169 |
– |
#ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE |
170 |
– |
ESHandle<SetupData> pSetup; |
171 |
– |
iSetup.get<SetupRecord>().get(pSetup); |
172 |
– |
#endif |
190 |
|
} |
191 |
|
|
192 |
|
|
194 |
|
void |
195 |
|
HiJetResponseAnalyzer::beginJob() |
196 |
|
{ |
197 |
+ |
|
198 |
+ |
t= fs->make<TTree>("t","Jet Response Analyzer"); |
199 |
+ |
t->Branch("b",&jra_.b,"b/F"); |
200 |
+ |
t->Branch("hf",&jra_.hf,"hf/F"); |
201 |
+ |
t->Branch("nref",&jra_.nref,"nref/I"); |
202 |
+ |
t->Branch("jtpt",jra_.jtpt,"jtpt[nref]/F"); |
203 |
+ |
t->Branch("refpt",jra_.refpt,"refpt[nref]/F"); |
204 |
+ |
t->Branch("jteta",jra_.jteta,"jteta[nref]/F"); |
205 |
+ |
t->Branch("refeta",jra_.refeta,"refeta[nref]/F"); |
206 |
+ |
t->Branch("jtphi",jra_.jtphi,"jtphi[nref]/F"); |
207 |
+ |
t->Branch("refphi",jra_.refphi,"refphi[nref]/F"); |
208 |
+ |
t->Branch("weight",&jra_.weight,"weight/F"); |
209 |
+ |
t->Branch("bin",&jra_.bin,"bin/I"); |
210 |
+ |
|
211 |
+ |
|
212 |
+ |
|
213 |
|
} |
214 |
|
|
215 |
|
// ------------ method called once each job just after ending the event loop ------------ |