57 |
|
verbose_ = iConfig.getUntrackedParameter<bool>("verbose",false); |
58 |
|
|
59 |
|
useCentrality_ = iConfig.getUntrackedParameter<bool>("useCentrality",false); |
60 |
< |
useVtx_ = iConfig.getUntrackedParameter<bool>("useVtx",true); |
60 |
> |
useVtx_ = iConfig.getUntrackedParameter<bool>("useVtx",false); |
61 |
|
useJEC_ = iConfig.getUntrackedParameter<bool>("useJEC",true); |
62 |
+ |
usePat_ = iConfig.getUntrackedParameter<bool>("usePAT",true); |
63 |
|
|
64 |
|
if(!isMC_){ |
65 |
|
L1gtReadout_ = iConfig.getParameter<edm::InputTag>("L1gtReadout"); |
103 |
|
string jetTagTitle = jetTag_.label()+" Jet Analysis Tree"; |
104 |
|
t = fs1->make<TTree>("t",jetTagTitle.c_str()); |
105 |
|
|
105 |
– |
|
106 |
|
// TTree* t= new TTree("t","Jet Response Analyzer"); |
107 |
< |
t->Branch("run",&jets_.run,"run/I"); |
107 |
> |
//t->Branch("run",&jets_.run,"run/I"); |
108 |
|
t->Branch("evt",&jets_.evt,"evt/I"); |
109 |
< |
t->Branch("lumi",&jets_.lumi,"lumi/I"); |
109 |
> |
//t->Branch("lumi",&jets_.lumi,"lumi/I"); |
110 |
|
t->Branch("b",&jets_.b,"b/F"); |
111 |
< |
t->Branch("vx",&jets_.vx,"vx/F"); |
112 |
< |
t->Branch("vy",&jets_.vy,"vy/F"); |
113 |
< |
t->Branch("vz",&jets_.vz,"vz/F"); |
114 |
< |
t->Branch("hf",&jets_.hf,"hf/F"); |
115 |
< |
t->Branch("nref",&jets_.nref,"nref/I"); |
116 |
< |
t->Branch("bin",&jets_.bin,"bin/I"); |
111 |
> |
if (useVtx_) { |
112 |
> |
t->Branch("vx",&jets_.vx,"vx/F"); |
113 |
> |
t->Branch("vy",&jets_.vy,"vy/F"); |
114 |
> |
t->Branch("vz",&jets_.vz,"vz/F"); |
115 |
> |
} |
116 |
> |
if (useCentrality_) { |
117 |
> |
t->Branch("hf",&jets_.hf,"hf/F"); |
118 |
> |
t->Branch("nref",&jets_.nref,"nref/I"); |
119 |
> |
t->Branch("bin",&jets_.bin,"bin/I"); |
120 |
> |
} |
121 |
|
t->Branch("rawpt",jets_.rawpt,"rawpt[nref]/F"); |
122 |
|
t->Branch("jtpt",jets_.jtpt,"jtpt[nref]/F"); |
123 |
|
t->Branch("jteta",jets_.jteta,"jteta[nref]/F"); |
124 |
|
t->Branch("jty",jets_.jty,"jty[nref]/F"); |
125 |
|
t->Branch("jtphi",jets_.jtphi,"jtphi[nref]/F"); |
126 |
+ |
t->Branch("jtpu",jets_.jtpu,"jtpu[nref]/F"); |
127 |
|
|
128 |
|
if(isMC_){ |
129 |
|
t->Branch("pthat",&jets_.pthat,"pthat/F"); |
182 |
|
|
183 |
|
LogDebug("HiInclusiveJetAnalyzer")<<"START event: "<<event<<" in run "<<run<<endl; |
184 |
|
|
180 |
– |
|
185 |
|
int bin = -1; |
186 |
|
double hf = 0.; |
187 |
|
double b = 999.; |
188 |
|
|
189 |
|
if(useCentrality_){ |
186 |
– |
//if(!isMC_){ |
190 |
|
if(!centrality_) centrality_ = new CentralityProvider(iSetup); |
191 |
|
centrality_->newEvent(iEvent,iSetup); // make sure you do this first in every event |
192 |
|
//double c = centrality_->centralityValue(); |
196 |
|
|
197 |
|
bin = centrality_->getBin(); |
198 |
|
b = centrality_->bMean(); |
196 |
– |
//} |
197 |
– |
/* |
198 |
– |
else{ |
199 |
– |
|
200 |
– |
TFile * centFile = new TFile("/net/hidsk0001/d00/scratch/mnguyen/CMSSW_3_9_1_patch1/src/macros/Hydjet_CentTable.root"); |
201 |
– |
|
202 |
– |
edm::Handle<reco::Centrality> cent; |
203 |
– |
iEvent.getByLabel(edm::InputTag("hiCentrality"),cent); |
204 |
– |
//cout<<" grabbed centrality "<<endl; |
205 |
– |
CentralityBins::RunMap cmap = getCentralityFromFile(centFile, "makeCentralityTableTFile", "HFhitsHydjet_2760GeV", 1, 1); |
206 |
– |
|
207 |
– |
// Still getting cent from hits. When tower tables become available, we need to switch |
208 |
– |
hf = cent->EtHFhitSum(); |
209 |
– |
//cout<<" hf "<<hf<<endl; |
210 |
– |
bin = cmap[run]->getBin(hf); |
211 |
– |
b = cmap[run]->bMeanOfBin(bin); |
212 |
– |
} |
213 |
– |
*/ |
199 |
|
} |
200 |
|
|
201 |
|
|
221 |
|
} |
222 |
|
} |
223 |
|
|
224 |
< |
|
225 |
< |
|
226 |
< |
edm::Handle<pat::JetCollection> jets; |
224 |
> |
edm::Handle<pat::JetCollection> patjets; |
225 |
> |
if(usePat_)iEvent.getByLabel(jetTag_, patjets); |
226 |
> |
|
227 |
> |
edm::Handle<reco::JetView> jets; |
228 |
|
iEvent.getByLabel(jetTag_, jets); |
229 |
|
|
244 |
– |
|
230 |
|
// FILL JRA TREE |
231 |
|
|
232 |
|
jets_.b = b; |
238 |
|
} |
239 |
|
|
240 |
|
for(unsigned int j = 0 ; j < jets->size(); ++j){ |
241 |
< |
const pat::Jet& jet = (*jets)[j]; |
241 |
> |
const reco::Jet& jet = (*jets)[j]; |
242 |
|
|
243 |
|
//cout<<" jet pt "<<jet.pt()<<endl; |
244 |
|
//if(jet.pt() < jetPtMin) continue; |
245 |
< |
if (useJEC_) jets_.rawpt[jets_.nref]=jet.correctedJet("Uncorrected").pt(); |
245 |
> |
if (useJEC_ && usePat_){ |
246 |
> |
jets_.rawpt[jets_.nref]=(*patjets)[j].correctedJet("Uncorrected").pt(); |
247 |
> |
} |
248 |
|
jets_.jtpt[jets_.nref] = jet.pt(); |
249 |
|
jets_.jteta[jets_.nref] = jet.eta(); |
250 |
|
jets_.jtphi[jets_.nref] = jet.phi(); |
251 |
|
jets_.jty[jets_.nref] = jet.eta(); |
252 |
< |
|
252 |
> |
jets_.jtpu[jets_.nref] = jet.pileup(); |
253 |
|
|
254 |
< |
if(jet.genJet()){ |
255 |
< |
jets_.refpt[jets_.nref] = jet.genJet()->pt(); |
256 |
< |
jets_.refeta[jets_.nref] = jet.genJet()->eta(); |
257 |
< |
jets_.refphi[jets_.nref] = jet.genJet()->phi(); |
258 |
< |
jets_.refy[jets_.nref] = jet.genJet()->eta(); |
259 |
< |
jets_.refdphijt[jets_.nref] = reco::deltaPhi(jet.phi(),jet.genJet()->phi()); |
260 |
< |
jets_.refdrjt[jets_.nref] = reco::deltaR(jet.eta(),jet.phi(),jet.genJet()->eta(),jet.genJet()->phi()); |
261 |
< |
} |
262 |
< |
else{ |
263 |
< |
jets_.refpt[jets_.nref] = -999.; |
264 |
< |
jets_.refeta[jets_.nref] = -999.; |
265 |
< |
jets_.refphi[jets_.nref] = -999.; |
266 |
< |
jets_.refy[jets_.nref] = -999.; |
267 |
< |
jets_.refdphijt[jets_.nref] = -999.; |
268 |
< |
jets_.refdrjt[jets_.nref] = -999.; |
269 |
< |
} |
270 |
< |
|
271 |
< |
// matched partons |
272 |
< |
if (jet.genParton()) { |
273 |
< |
jets_.refparton_pt[jets_.nref] = jet.genParton()->pt(); |
274 |
< |
jets_.refparton_flavor[jets_.nref] = jet.genParton()->pdgId(); |
254 |
> |
if(isMC_ && usePat_){ |
255 |
> |
const reco::GenJet* genjet = (*patjets)[j].genJet(); |
256 |
> |
if(genjet){ |
257 |
> |
jets_.refpt[jets_.nref] = genjet->pt(); |
258 |
> |
jets_.refeta[jets_.nref] = genjet->eta(); |
259 |
> |
jets_.refphi[jets_.nref] = genjet->phi(); |
260 |
> |
jets_.refy[jets_.nref] = genjet->eta(); |
261 |
> |
jets_.refdphijt[jets_.nref] = reco::deltaPhi(jet.phi(), genjet->phi()); |
262 |
> |
jets_.refdrjt[jets_.nref] = reco::deltaR(jet.eta(),jet.phi(),genjet->eta(),genjet->phi()); |
263 |
> |
}else{ |
264 |
> |
jets_.refpt[jets_.nref] = -999.; |
265 |
> |
jets_.refeta[jets_.nref] = -999.; |
266 |
> |
jets_.refphi[jets_.nref] = -999.; |
267 |
> |
jets_.refy[jets_.nref] = -999.; |
268 |
> |
jets_.refdphijt[jets_.nref] = -999.; |
269 |
> |
jets_.refdrjt[jets_.nref] = -999.; |
270 |
> |
} |
271 |
> |
|
272 |
> |
// matched partons |
273 |
> |
const reco::GenParticle * parton = (*patjets)[j].genParton(); |
274 |
> |
if(parton){ |
275 |
> |
jets_.refparton_pt[jets_.nref] = parton->pt(); |
276 |
> |
jets_.refparton_flavor[jets_.nref] = parton->pdgId(); |
277 |
|
} else { |
278 |
|
jets_.refparton_pt[jets_.nref] = -999; |
279 |
|
jets_.refparton_flavor[jets_.nref] = -999; |
280 |
|
} |
281 |
< |
|
281 |
> |
} |
282 |
|
|
283 |
|
jets_.nref++; |
284 |
|
|