19 |
|
|
20 |
|
#include "DataFormats/HeavyIonEvent/interface/CentralityBins.h" |
21 |
|
#include "DataFormats/HeavyIonEvent/interface/Centrality.h" |
22 |
+ |
#include "Geometry/Records/interface/CaloGeometryRecord.h" |
23 |
|
|
24 |
|
#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" |
24 |
– |
#include "DataFormats/PatCandidates/interface/Jet.h" |
25 |
|
#include "DataFormats/JetReco/interface/CaloJetCollection.h" |
26 |
|
#include "SimDataFormats/HiGenData/interface/GenHIEvent.h" |
27 |
|
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" |
28 |
+ |
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" |
29 |
|
#include "DataFormats/JetReco/interface/GenJetCollection.h" |
30 |
|
#include "DataFormats/VertexReco/interface/Vertex.h" |
31 |
|
#include "DataFormats/Math/interface/deltaPhi.h" |
39 |
|
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h" |
40 |
|
#include "L1Trigger/GlobalTrigger/interface/L1GlobalTrigger.h" |
41 |
|
|
42 |
+ |
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" |
43 |
+ |
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" |
44 |
+ |
|
45 |
|
using namespace std; |
46 |
|
using namespace edm; |
47 |
|
using namespace reco; |
48 |
|
|
49 |
< |
HiInclusiveJetAnalyzer::HiInclusiveJetAnalyzer(const edm::ParameterSet& iConfig) { |
50 |
< |
|
49 |
> |
HiInclusiveJetAnalyzer::HiInclusiveJetAnalyzer(const edm::ParameterSet& iConfig) : |
50 |
> |
geo(0) |
51 |
> |
{ |
52 |
|
|
53 |
|
jetTag_ = iConfig.getParameter<InputTag>("jetTag"); |
54 |
< |
vtxTag_ = iConfig.getUntrackedParameter<edm::InputTag>("vtxTag",edm::InputTag("hiSelectedVertex")); |
54 |
> |
matchTag_ = iConfig.getUntrackedParameter<InputTag>("matchTag",jetTag_); |
55 |
> |
|
56 |
> |
vtxTag_ = iConfig.getUntrackedParameter<edm::InputTag>("vtxTag",edm::InputTag("hiSelectedVertex")); |
57 |
> |
trackTag_ = iConfig.getParameter<InputTag>("trackTag"); |
58 |
> |
useQuality_ = iConfig.getUntrackedParameter<bool>("useQuality",1); |
59 |
> |
trackQuality_ = iConfig.getUntrackedParameter<string>("trackQuality","highPurity"); |
60 |
|
|
61 |
|
isMC_ = iConfig.getUntrackedParameter<bool>("isMC",false); |
62 |
+ |
fillGenJets_ = iConfig.getUntrackedParameter<bool>("fillGenJets",false); |
63 |
+ |
|
64 |
+ |
doTrigger_ = iConfig.getUntrackedParameter<bool>("doTrigger",false); |
65 |
+ |
|
66 |
+ |
rParam = iConfig.getParameter<double>("rParam"); |
67 |
+ |
hardPtMin_ = iConfig.getUntrackedParameter<double>("hardPtMin",4); |
68 |
|
|
69 |
|
if(isMC_){ |
70 |
|
genjetTag_ = iConfig.getParameter<InputTag>("genjetTag"); |
77 |
|
useJEC_ = iConfig.getUntrackedParameter<bool>("useJEC",true); |
78 |
|
usePat_ = iConfig.getUntrackedParameter<bool>("usePAT",true); |
79 |
|
|
80 |
< |
if(!isMC_){ |
80 |
> |
doLifeTimeTagging_ = iConfig.getUntrackedParameter<bool>("doLifeTimeTagging",false); |
81 |
> |
doLifeTimeTaggingExtras_ = iConfig.getUntrackedParameter<bool>("doLifeTimeTaggingExtras",true); |
82 |
> |
saveBfragments_ = iConfig.getUntrackedParameter<bool>("saveBfragments",false); |
83 |
> |
|
84 |
> |
pfCandidateLabel_ = iConfig.getUntrackedParameter<edm::InputTag>("pfCandidateLabel",edm::InputTag("particleFlowTmp")); |
85 |
> |
|
86 |
> |
EBSrc_ = iConfig.getUntrackedParameter<edm::InputTag>("EBRecHitSrc",edm::InputTag("ecalRecHit","EcalRecHitsEB")); |
87 |
> |
EESrc_ = iConfig.getUntrackedParameter<edm::InputTag>("EERecHitSrc",edm::InputTag("ecalRecHit","EcalRecHitsEE")); |
88 |
> |
HcalRecHitHFSrc_ = iConfig.getUntrackedParameter<edm::InputTag>("hcalHFRecHitSrc",edm::InputTag("hfreco")); |
89 |
> |
HcalRecHitHBHESrc_ = iConfig.getUntrackedParameter<edm::InputTag>("hcalHBHERecHitSrc",edm::InputTag("hbhereco")); |
90 |
> |
|
91 |
> |
genParticleSrc_ = iConfig.getUntrackedParameter<edm::InputTag>("genParticles",edm::InputTag("hiGenParticles")); |
92 |
> |
|
93 |
> |
if(doTrigger_){ |
94 |
|
L1gtReadout_ = iConfig.getParameter<edm::InputTag>("L1gtReadout"); |
95 |
|
hltResName_ = iConfig.getUntrackedParameter<string>("hltTrgResults","TriggerResults::HLT"); |
96 |
|
|
107 |
|
} |
108 |
|
|
109 |
|
cout<<" jet collection : "<<jetTag_<<endl; |
110 |
< |
if(isMC_)cout<<" genjet collection : "<<genjetTag_<<endl; |
110 |
> |
doSubEvent_ = 0; |
111 |
|
|
112 |
+ |
if(isMC_){ |
113 |
+ |
cout<<" genjet collection : "<<genjetTag_<<endl; |
114 |
+ |
genPtMin_ = iConfig.getUntrackedParameter<double>("genPtMin",0); |
115 |
+ |
doSubEvent_ = iConfig.getUntrackedParameter<bool>("doSubEvent",1); |
116 |
+ |
} |
117 |
|
|
118 |
|
|
119 |
|
} |
149 |
|
} |
150 |
|
if (useCentrality_) { |
151 |
|
t->Branch("hf",&jets_.hf,"hf/F"); |
118 |
– |
t->Branch("nref",&jets_.nref,"nref/I"); |
152 |
|
t->Branch("bin",&jets_.bin,"bin/I"); |
153 |
|
} |
154 |
+ |
|
155 |
+ |
t->Branch("nref",&jets_.nref,"nref/I"); |
156 |
|
t->Branch("rawpt",jets_.rawpt,"rawpt[nref]/F"); |
157 |
|
t->Branch("jtpt",jets_.jtpt,"jtpt[nref]/F"); |
158 |
|
t->Branch("jteta",jets_.jteta,"jteta[nref]/F"); |
159 |
|
t->Branch("jty",jets_.jty,"jty[nref]/F"); |
160 |
|
t->Branch("jtphi",jets_.jtphi,"jtphi[nref]/F"); |
161 |
|
t->Branch("jtpu",jets_.jtpu,"jtpu[nref]/F"); |
162 |
+ |
t->Branch("jtm",jets_.jtm,"jtm[nref]/F"); |
163 |
+ |
|
164 |
+ |
// jet ID information, jet composition |
165 |
+ |
t->Branch("discr_fr01", jets_.discr_fr01,"discr_fr01[nref]/F"); |
166 |
+ |
|
167 |
+ |
t->Branch("trackMax", jets_.trackMax,"trackMax[nref]/F"); |
168 |
+ |
t->Branch("trackSum", jets_.trackSum,"trackSum[nref]/F"); |
169 |
+ |
t->Branch("trackN", jets_.trackN,"trackN[nref]/I"); |
170 |
+ |
t->Branch("trackHardSum", jets_.trackHardSum,"trackHardSum[nref]/F"); |
171 |
+ |
t->Branch("trackHardN", jets_.trackHardN,"trackHardN[nref]/I"); |
172 |
+ |
|
173 |
+ |
t->Branch("chargedMax", jets_.chargedMax,"chargedMax[nref]/F"); |
174 |
+ |
t->Branch("chargedSum", jets_.chargedSum,"chargedSum[nref]/F"); |
175 |
+ |
t->Branch("chargedN", jets_.chargedN,"chargedN[nref]/I"); |
176 |
+ |
t->Branch("chargedHardSum", jets_.chargedHardSum,"chargedHardSum[nref]/F"); |
177 |
+ |
t->Branch("chargedHardN", jets_.chargedHardN,"chargedHardN[nref]/I"); |
178 |
+ |
|
179 |
+ |
t->Branch("photonMax", jets_.photonMax,"photonMax[nref]/F"); |
180 |
+ |
t->Branch("photonSum", jets_.photonSum,"photonSum[nref]/F"); |
181 |
+ |
t->Branch("photonN", jets_.photonN,"photonN[nref]/I"); |
182 |
+ |
t->Branch("photonHardSum", jets_.photonHardSum,"photonHardSum[nref]/F"); |
183 |
+ |
t->Branch("photonHardN", jets_.photonHardN,"photonHardN[nref]/I"); |
184 |
+ |
|
185 |
+ |
t->Branch("neutralMax", jets_.neutralMax,"neutralMax[nref]/F"); |
186 |
+ |
t->Branch("neutralSum", jets_.neutralSum,"neutralSum[nref]/F"); |
187 |
+ |
t->Branch("neutralN", jets_.neutralN,"neutralN[nref]/I"); |
188 |
+ |
|
189 |
+ |
t->Branch("hcalSum", jets_.hcalSum,"hcalSum[nref]/F"); |
190 |
+ |
t->Branch("ecalSum", jets_.ecalSum,"ecalSum[nref]/F"); |
191 |
+ |
|
192 |
+ |
t->Branch("eMax", jets_.eMax,"eMax[nref]/F"); |
193 |
+ |
t->Branch("eSum", jets_.eSum,"eSum[nref]/F"); |
194 |
+ |
t->Branch("eN", jets_.eN,"eN[nref]/I"); |
195 |
+ |
|
196 |
+ |
t->Branch("muMax", jets_.muMax,"muMax[nref]/F"); |
197 |
+ |
t->Branch("muSum", jets_.muSum,"muSum[nref]/F"); |
198 |
+ |
t->Branch("muN", jets_.muN,"muN[nref]/I"); |
199 |
+ |
|
200 |
+ |
t->Branch("matchedPt", jets_.matchedPt,"matchedPt[nref]/F"); |
201 |
+ |
t->Branch("matchedR", jets_.matchedR,"matchedR[nref]/F"); |
202 |
+ |
|
203 |
+ |
// b-jet discriminators |
204 |
+ |
if (doLifeTimeTagging_) { |
205 |
+ |
|
206 |
+ |
t->Branch("discr_csvMva",jets_.discr_csvMva,"discr_csvMva[nref]/F"); |
207 |
+ |
t->Branch("discr_csvSimple",jets_.discr_csvSimple,"discr_csvSimple[nref]/F"); |
208 |
+ |
t->Branch("discr_muByIp3",jets_.discr_muByIp3,"discr_muByIp3[nref]/F"); |
209 |
+ |
t->Branch("discr_muByPt",jets_.discr_muByPt,"discr_muByPt[nref]/F"); |
210 |
+ |
t->Branch("discr_prob",jets_.discr_prob,"discr_prob[nref]/F"); |
211 |
+ |
t->Branch("discr_probb",jets_.discr_probb,"discr_probb[nref]/F"); |
212 |
+ |
t->Branch("discr_tcHighEff",jets_.discr_tcHighEff,"discr_tcHighEff[nref]/F"); |
213 |
+ |
t->Branch("discr_tcHighPur",jets_.discr_tcHighPur,"discr_tcHighPur[nref]/F"); |
214 |
+ |
|
215 |
+ |
t->Branch("nsvtx", jets_.nsvtx, "nsvtx[nref]/I"); |
216 |
+ |
t->Branch("svtxntrk", jets_.svtxntrk, "svtxntrk[nref]/I"); |
217 |
+ |
t->Branch("svtxdl", jets_.svtxdl, "svtxdl[nref]/F"); |
218 |
+ |
t->Branch("svtxdls", jets_.svtxdls, "svtxdls[nref]/F"); |
219 |
+ |
t->Branch("svtxm", jets_.svtxm, "svtxm[nref]/F"); |
220 |
+ |
t->Branch("svtxpt", jets_.svtxpt, "svtxpt[nref]/F"); |
221 |
+ |
|
222 |
+ |
t->Branch("nIPtrk",jets_.nIPtrk,"nIPtrk[nref]/I"); |
223 |
+ |
t->Branch("nselIPtrk",jets_.nselIPtrk,"nselIPtrk[nref]/I"); |
224 |
|
|
225 |
+ |
if (doLifeTimeTaggingExtras_) { |
226 |
+ |
t->Branch("nIP",&jets_.nIP,"nIP/I"); |
227 |
+ |
t->Branch("ipJetIndex",jets_.ipJetIndex,"ipJetIndex[nIP]/I"); |
228 |
+ |
t->Branch("ipPt",jets_.ipPt,"ipPt[nIP]/F"); |
229 |
+ |
t->Branch("ipProb0",jets_.ipProb0,"ipProb0[nIP]/F"); |
230 |
+ |
t->Branch("ipProb1",jets_.ipProb1,"ipProb1[nIP]/F"); |
231 |
+ |
t->Branch("ip2d",jets_.ip2d,"ip2d[nIP]/F"); |
232 |
+ |
t->Branch("ip2dSig",jets_.ip2dSig,"ip2dSig[nIP]/F"); |
233 |
+ |
t->Branch("ip3d",jets_.ip3d,"ip3d[nIP]/F"); |
234 |
+ |
t->Branch("ip3dSig",jets_.ip3dSig,"ip3dSig[nIP]/F"); |
235 |
+ |
t->Branch("ipDist2Jet",jets_.ipDist2Jet,"ipDist2Jet[nIP]/F"); |
236 |
+ |
t->Branch("ipDist2JetSig",jets_.ipDist2JetSig,"ipDist2JetSig[nIP]/F"); |
237 |
+ |
t->Branch("ipClosest2Jet",jets_.ipClosest2Jet,"ipClosest2Jet[nIP]/F"); |
238 |
+ |
|
239 |
+ |
} |
240 |
+ |
|
241 |
+ |
t->Branch("mue", jets_.mue, "mue[nref]/F"); |
242 |
+ |
t->Branch("mupt", jets_.mupt, "mupt[nref]/F"); |
243 |
+ |
t->Branch("mueta", jets_.mueta, "mueta[nref]/F"); |
244 |
+ |
t->Branch("muphi", jets_.muphi, "muphi[nref]/F"); |
245 |
+ |
t->Branch("mudr", jets_.mudr, "mudr[nref]/F"); |
246 |
+ |
t->Branch("muptrel", jets_.muptrel, "muptrel[nref]/F"); |
247 |
+ |
t->Branch("muchg", jets_.muchg, "muchg[nref]/I"); |
248 |
+ |
} |
249 |
+ |
|
250 |
+ |
|
251 |
|
if(isMC_){ |
252 |
+ |
t->Branch("beamId1",&jets_.beamId1,"beamId1/I"); |
253 |
+ |
t->Branch("beamId2",&jets_.beamId2,"beamId2/I"); |
254 |
+ |
|
255 |
|
t->Branch("pthat",&jets_.pthat,"pthat/F"); |
256 |
|
|
257 |
|
// Only matched gen jets |
263 |
|
t->Branch("refdrjt",jets_.refdrjt,"refdrjt[nref]/F"); |
264 |
|
// matched parton |
265 |
|
t->Branch("refparton_pt",jets_.refparton_pt,"refparton_pt[nref]/F"); |
266 |
< |
t->Branch("refparton_flavor",jets_.refparton_flavor,"refparton_flavor[nref]/F"); |
266 |
> |
t->Branch("refparton_flavor",jets_.refparton_flavor,"refparton_flavor[nref]/I"); |
267 |
> |
t->Branch("refparton_flavorForB",jets_.refparton_flavorForB,"refparton_flavorForB[nref]/I"); |
268 |
> |
|
269 |
> |
t->Branch("genChargedSum", jets_.genChargedSum,"genChargedSum[nref]/F"); |
270 |
> |
t->Branch("genHardSum", jets_.genHardSum,"genHardSum[nref]/F"); |
271 |
> |
t->Branch("signalChargedSum", jets_.signalChargedSum,"signalChargedSum[nref]/F"); |
272 |
> |
t->Branch("signalHardSum", jets_.signalHardSum,"signalHardSum[nref]/F"); |
273 |
> |
|
274 |
> |
if(doSubEvent_){ |
275 |
> |
t->Branch("subid",jets_.subid,"subid[nref]/I"); |
276 |
> |
} |
277 |
> |
|
278 |
> |
if(fillGenJets_){ |
279 |
> |
// For all gen jets, matched or unmatched |
280 |
> |
t->Branch("ngen",&jets_.ngen,"ngen/I"); |
281 |
> |
t->Branch("genmatchindex",jets_.genmatchindex,"genmatchindex[ngen]/I"); |
282 |
> |
t->Branch("genpt",jets_.genpt,"genpt[ngen]/F"); |
283 |
> |
t->Branch("geneta",jets_.geneta,"geneta[ngen]/F"); |
284 |
> |
t->Branch("geny",jets_.geny,"geny[ngen]/F"); |
285 |
> |
t->Branch("genphi",jets_.genphi,"genphi[ngen]/F"); |
286 |
> |
t->Branch("gendphijt",jets_.gendphijt,"gendphijt[ngen]/F"); |
287 |
> |
t->Branch("gendrjt",jets_.gendrjt,"gendrjt[ngen]/F"); |
288 |
> |
|
289 |
> |
if(doSubEvent_){ |
290 |
> |
t->Branch("gensubid",jets_.gensubid,"gensubid[ngen]/I"); |
291 |
> |
} |
292 |
> |
} |
293 |
> |
|
294 |
> |
if(saveBfragments_ ) { |
295 |
> |
t->Branch("bMult",&jets_.bMult,"bMult/I"); |
296 |
> |
t->Branch("bJetIndex",jets_.bJetIndex,"bJetIndex[bMult]/I"); |
297 |
> |
t->Branch("bStatus",jets_.bStatus,"bStatus[bMult]/I"); |
298 |
> |
t->Branch("bVx",jets_.bVx,"bVx[bMult]/F"); |
299 |
> |
t->Branch("bVy",jets_.bVy,"bVy[bMult]/F"); |
300 |
> |
t->Branch("bVz",jets_.bVz,"bVz[bMult]/F"); |
301 |
> |
t->Branch("bPt",jets_.bPt,"bPt[bMult]/F"); |
302 |
> |
t->Branch("bEta",jets_.bEta,"bEta[bMult]/F"); |
303 |
> |
t->Branch("bPhi",jets_.bPhi,"bPhi[bMult]/F"); |
304 |
> |
t->Branch("bPdg",jets_.bPdg,"bPdg[bMult]/I"); |
305 |
> |
t->Branch("bChg",jets_.bChg,"bChg[bMult]/I"); |
306 |
> |
} |
307 |
|
|
142 |
– |
// For all gen jets, matched or unmatched |
143 |
– |
t->Branch("ngen",&jets_.ngen,"ngen/I"); |
144 |
– |
t->Branch("genmatchindex",jets_.genmatchindex,"genmatchindex[ngen]/I"); |
145 |
– |
t->Branch("genpt",jets_.genpt,"genpt[ngen]/F"); |
146 |
– |
t->Branch("geneta",jets_.geneta,"geneta[ngen]/F"); |
147 |
– |
t->Branch("geny",jets_.geny,"geny[ngen]/F"); |
148 |
– |
t->Branch("genphi",jets_.genphi,"genphi[ngen]/F"); |
149 |
– |
t->Branch("gendphijt",jets_.gendphijt,"gendphijt[ngen]/F"); |
150 |
– |
t->Branch("gendrjt",jets_.gendrjt,"gendrjt[ngen]/F"); |
308 |
|
} |
309 |
< |
|
309 |
> |
/* |
310 |
|
if(!isMC_){ |
311 |
|
t->Branch("nL1TBit",&jets_.nL1TBit,"nL1TBit/I"); |
312 |
|
t->Branch("l1TBit",jets_.l1TBit,"l1TBit[nL1TBit]/O"); |
318 |
|
t->Branch("hltBit",jets_.hltBit,"hltBit[nHLTBit]/O"); |
319 |
|
|
320 |
|
} |
321 |
< |
|
321 |
> |
*/ |
322 |
|
TH1D::SetDefaultSumw2(); |
323 |
|
|
324 |
|
|
343 |
|
double hf = 0.; |
344 |
|
double b = 999.; |
345 |
|
|
346 |
+ |
if(!geo){ |
347 |
+ |
edm::ESHandle<CaloGeometry> pGeo; |
348 |
+ |
iSetup.get<CaloGeometryRecord>().get(pGeo); |
349 |
+ |
geo = pGeo.product(); |
350 |
+ |
} |
351 |
|
if(useCentrality_){ |
352 |
|
if(!centrality_) centrality_ = new CentralityProvider(iSetup); |
353 |
|
centrality_->newEvent(iEvent,iSetup); // make sure you do this first in every event |
360 |
|
b = centrality_->bMean(); |
361 |
|
} |
362 |
|
|
201 |
– |
|
202 |
– |
|
203 |
– |
|
204 |
– |
//double jetPtMin = 35.; |
205 |
– |
|
206 |
– |
|
363 |
|
// loop the events |
364 |
|
|
365 |
|
jets_.bin = bin; |
366 |
|
jets_.hf = hf; |
367 |
|
|
368 |
< |
|
369 |
< |
if (useVtx_) { |
370 |
< |
edm::Handle<vector<reco::Vertex> >vertex; |
371 |
< |
iEvent.getByLabel(vtxTag_, vertex); |
372 |
< |
|
373 |
< |
if(vertex->size()>0) { |
374 |
< |
jets_.vx=vertex->begin()->x(); |
375 |
< |
jets_.vy=vertex->begin()->y(); |
376 |
< |
jets_.vz=vertex->begin()->z(); |
377 |
< |
} |
378 |
< |
} |
368 |
> |
reco::Vertex::Point vtx(0,0,0); |
369 |
> |
if (useVtx_) { |
370 |
> |
edm::Handle<vector<reco::Vertex> >vertex; |
371 |
> |
iEvent.getByLabel(vtxTag_, vertex); |
372 |
> |
|
373 |
> |
if(vertex->size()>0) { |
374 |
> |
jets_.vx=vertex->begin()->x(); |
375 |
> |
jets_.vy=vertex->begin()->y(); |
376 |
> |
jets_.vz=vertex->begin()->z(); |
377 |
> |
vtx = vertex->begin()->position(); |
378 |
> |
} |
379 |
> |
} |
380 |
|
|
381 |
|
edm::Handle<pat::JetCollection> patjets; |
382 |
|
if(usePat_)iEvent.getByLabel(jetTag_, patjets); |
383 |
+ |
|
384 |
+ |
edm::Handle<pat::JetCollection> matchedjets; |
385 |
+ |
iEvent.getByLabel(matchTag_, matchedjets); |
386 |
|
|
387 |
|
edm::Handle<reco::JetView> jets; |
388 |
|
iEvent.getByLabel(jetTag_, jets); |
389 |
|
|
390 |
< |
// FILL JRA TREE |
390 |
> |
edm::Handle<reco::PFCandidateCollection> pfCandidates; |
391 |
> |
iEvent.getByLabel(pfCandidateLabel_,pfCandidates); |
392 |
> |
|
393 |
> |
edm::Handle<reco::TrackCollection> tracks; |
394 |
> |
iEvent.getByLabel(trackTag_,tracks); |
395 |
> |
|
396 |
> |
edm::Handle<edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > > ebHits; |
397 |
> |
edm::Handle<edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > > eeHits; |
398 |
> |
|
399 |
> |
edm::Handle<HFRecHitCollection> hfHits; |
400 |
> |
edm::Handle<HBHERecHitCollection> hbheHits; |
401 |
> |
|
402 |
> |
iEvent.getByLabel(HcalRecHitHBHESrc_,hbheHits); |
403 |
> |
iEvent.getByLabel(HcalRecHitHFSrc_,hfHits); |
404 |
> |
iEvent.getByLabel(EBSrc_,ebHits); |
405 |
> |
iEvent.getByLabel(EESrc_,eeHits); |
406 |
> |
|
407 |
> |
edm::Handle<reco::GenParticleCollection> genparts; |
408 |
> |
iEvent.getByLabel(genParticleSrc_,genparts); |
409 |
|
|
410 |
+ |
|
411 |
+ |
// FILL JRA TREE |
412 |
|
jets_.b = b; |
413 |
|
jets_.nref = 0; |
414 |
+ |
|
415 |
|
|
416 |
< |
if(!isMC_){ |
416 |
> |
if(doTrigger_){ |
417 |
|
fillL1Bits(iEvent); |
418 |
|
fillHLTBits(iEvent); |
419 |
|
} |
420 |
|
|
421 |
< |
for(unsigned int j = 0 ; j < jets->size(); ++j){ |
422 |
< |
const reco::Jet& jet = (*jets)[j]; |
242 |
< |
|
243 |
< |
//cout<<" jet pt "<<jet.pt()<<endl; |
244 |
< |
//if(jet.pt() < jetPtMin) continue; |
421 |
> |
for(unsigned int j = 0; j < jets->size(); ++j){ |
422 |
> |
const reco::Jet& jet = (*jets)[j]; |
423 |
|
if (useJEC_ && usePat_){ |
424 |
|
jets_.rawpt[jets_.nref]=(*patjets)[j].correctedJet("Uncorrected").pt(); |
425 |
|
} |
426 |
+ |
|
427 |
+ |
if(doLifeTimeTagging_){ |
428 |
+ |
|
429 |
+ |
if(jetTag_.label()=="icPu5patJets"){ |
430 |
+ |
jets_.discr_csvMva[jets_.nref] = (*patjets)[j].bDiscriminator("icPu5CombinedSecondaryVertexMVABJetTags"); |
431 |
+ |
jets_.discr_csvSimple[jets_.nref] = (*patjets)[j].bDiscriminator("icPu5CombinedSecondaryVertexBJetTags"); |
432 |
+ |
jets_.discr_muByIp3[jets_.nref] = (*patjets)[j].bDiscriminator("icPu5SoftMuonByIP3dBJetTags"); |
433 |
+ |
jets_.discr_muByPt[jets_.nref] = (*patjets)[j].bDiscriminator("icPu5SoftMuonByPtBJetTags"); |
434 |
+ |
jets_.discr_prob[jets_.nref] = (*patjets)[j].bDiscriminator("icPu5JetBProbabilityBJetTags"); |
435 |
+ |
jets_.discr_probb[jets_.nref] = (*patjets)[j].bDiscriminator("icPu5JetProbabilityBJetTags"); |
436 |
+ |
jets_.discr_tcHighEff[jets_.nref] = (*patjets)[j].bDiscriminator("icPu5TrackCountingHighEffBJetTags"); |
437 |
+ |
jets_.discr_tcHighPur[jets_.nref] = (*patjets)[j].bDiscriminator("icPu5TrackCountingHighPurBJetTags"); |
438 |
+ |
} |
439 |
+ |
else if(jetTag_.label()=="akPu3PFpatJets"){ |
440 |
+ |
jets_.discr_csvMva[jets_.nref] = (*patjets)[j].bDiscriminator("akPu3PFCombinedSecondaryVertexMVABJetTags"); |
441 |
+ |
jets_.discr_csvSimple[jets_.nref] = (*patjets)[j].bDiscriminator("akPu3PFCombinedSecondaryVertexBJetTags"); |
442 |
+ |
jets_.discr_muByIp3[jets_.nref] = (*patjets)[j].bDiscriminator("akPu3PFSoftMuonByIP3dBJetTags"); |
443 |
+ |
jets_.discr_muByPt[jets_.nref] = (*patjets)[j].bDiscriminator("akPu3PFSoftMuonByPtBJetTags"); |
444 |
+ |
jets_.discr_prob[jets_.nref] = (*patjets)[j].bDiscriminator("akPu3PFJetBProbabilityBJetTags"); |
445 |
+ |
jets_.discr_probb[jets_.nref] = (*patjets)[j].bDiscriminator("akPu3PFJetProbabilityBJetTags"); |
446 |
+ |
jets_.discr_tcHighEff[jets_.nref] = (*patjets)[j].bDiscriminator("akPu3PFTrackCountingHighEffBJetTags"); |
447 |
+ |
jets_.discr_tcHighPur[jets_.nref] = (*patjets)[j].bDiscriminator("akPu3PFTrackCountingHighPurBJetTags"); |
448 |
+ |
} |
449 |
+ |
else{ |
450 |
+ |
cout<<" b-tagging variables not filled for this collection, turn of doLifeTimeTagging "<<endl; |
451 |
+ |
} |
452 |
+ |
|
453 |
+ |
const reco::SecondaryVertexTagInfo& tagInfoSV=*(*patjets)[j].tagInfoSecondaryVertex(); |
454 |
+ |
|
455 |
+ |
jets_.nsvtx[jets_.nref] = tagInfoSV.nVertices(); |
456 |
+ |
|
457 |
+ |
if (tagInfoSV.nVertices()>0) { |
458 |
+ |
jets_.svtxntrk[jets_.nref] = tagInfoSV.nVertexTracks(0); |
459 |
+ |
// this is the 3d flight distance, for 2-D use (0,true) |
460 |
+ |
Measurement1D m1D = tagInfoSV.flightDistance(0); |
461 |
+ |
jets_.svtxdl[jets_.nref] = m1D.value(); |
462 |
+ |
jets_.svtxdls[jets_.nref] = m1D.significance(); |
463 |
+ |
|
464 |
+ |
const reco::Vertex& svtx = tagInfoSV.secondaryVertex(0); |
465 |
+ |
//cout<<" SV: vx: "<<svtx.x()<<" vy "<<svtx.y()<<" vz "<<svtx.z()<<endl; |
466 |
+ |
//cout<<" PV: vx: "<<jet.vx()<<" vy "<<jet.vy()<<" vz "<<jet.vz()<<endl; |
467 |
+ |
jets_.svtxm[jets_.nref] = svtx.p4().mass(); |
468 |
+ |
jets_.svtxpt[jets_.nref] = svtx.p4().pt(); |
469 |
+ |
//cout<<" chi2 "<<svtx.chi2()<<" ndof "<<svtx.ndof()<<endl; |
470 |
+ |
} |
471 |
+ |
|
472 |
+ |
const reco::TrackIPTagInfo& tagInfoIP=*(*patjets)[j].tagInfoTrackIP(); |
473 |
+ |
|
474 |
+ |
jets_.nIPtrk[jets_.nref] = tagInfoIP.tracks().size(); |
475 |
+ |
jets_.nselIPtrk[jets_.nref] = tagInfoIP.selectedTracks().size(); |
476 |
+ |
|
477 |
+ |
if (doLifeTimeTaggingExtras_) { |
478 |
+ |
|
479 |
+ |
TrackRefVector selTracks=tagInfoIP.selectedTracks(); |
480 |
+ |
|
481 |
+ |
GlobalPoint pv(tagInfoIP.primaryVertex()->position().x(),tagInfoIP.primaryVertex()->position().y(),tagInfoIP.primaryVertex()->position().z()); |
482 |
+ |
|
483 |
+ |
for(int it=0;it<jets_.nselIPtrk[jets_.nref] ;it++) |
484 |
+ |
{ |
485 |
+ |
jets_.ipJetIndex[jets_.nIP + it]= jets_.nref; |
486 |
+ |
TrackIPTagInfo::TrackIPData data = tagInfoIP.impactParameterData()[it]; |
487 |
+ |
jets_.ipPt[jets_.nIP + it] = selTracks[it]->pt(); |
488 |
+ |
jets_.ipProb0[jets_.nIP + it] = tagInfoIP.probabilities(0)[it]; |
489 |
+ |
jets_.ipProb1[jets_.nIP + it] = tagInfoIP.probabilities(1)[it]; |
490 |
+ |
jets_.ip2d[jets_.nIP + it] = data.ip2d.value(); |
491 |
+ |
jets_.ip2dSig[jets_.nIP + it] = data.ip2d.significance(); |
492 |
+ |
jets_.ip3d[jets_.nIP + it] = data.ip3d.value(); |
493 |
+ |
jets_.ip3dSig[jets_.nIP + it] = data.ip3d.significance(); |
494 |
+ |
jets_.ipDist2Jet[jets_.nIP + it] = data.distanceToJetAxis.value(); |
495 |
+ |
jets_.ipDist2JetSig[jets_.nIP + it] = data.distanceToJetAxis.significance(); |
496 |
+ |
jets_.ipClosest2Jet[jets_.nIP + it] = (data.closestToJetAxis - pv).mag(); //decay length |
497 |
+ |
} |
498 |
+ |
|
499 |
+ |
jets_.nIP += jets_.nselIPtrk[jets_.nref]; |
500 |
+ |
|
501 |
+ |
} |
502 |
+ |
|
503 |
+ |
const reco::PFCandidateCollection *pfCandidateColl = &(*pfCandidates); |
504 |
+ |
int pfMuonIndex = getPFJetMuon(jet, pfCandidateColl); |
505 |
+ |
if(pfMuonIndex >=0){ |
506 |
+ |
const reco::PFCandidate muon = pfCandidateColl->at(pfMuonIndex); |
507 |
+ |
jets_.mupt[jets_.nref] = muon.pt(); |
508 |
+ |
jets_.mueta[jets_.nref] = muon.eta(); |
509 |
+ |
jets_.muphi[jets_.nref] = muon.phi(); |
510 |
+ |
jets_.mue[jets_.nref] = muon.energy(); |
511 |
+ |
jets_.mudr[jets_.nref] = reco::deltaR(jet,muon); |
512 |
+ |
jets_.muptrel[jets_.nref] = getPtRel(muon, jet); |
513 |
+ |
jets_.muchg[jets_.nref] = muon.charge(); |
514 |
+ |
}else{ |
515 |
+ |
jets_.mupt[jets_.nref] = 0.0; |
516 |
+ |
jets_.mueta[jets_.nref] = 0.0; |
517 |
+ |
jets_.muphi[jets_.nref] = 0.0; |
518 |
+ |
jets_.mue[jets_.nref] = 0.0; |
519 |
+ |
jets_.mudr[jets_.nref] = 9.9; |
520 |
+ |
jets_.muptrel[jets_.nref] = 0.0; |
521 |
+ |
jets_.muchg[jets_.nref] = 0; |
522 |
+ |
} |
523 |
+ |
|
524 |
+ |
} |
525 |
+ |
|
526 |
+ |
// Jet ID variables |
527 |
+ |
|
528 |
+ |
jets_.muMax[jets_.nref] = 0; |
529 |
+ |
jets_.muSum[jets_.nref] = 0; |
530 |
+ |
jets_.muN[jets_.nref] = 0; |
531 |
+ |
|
532 |
+ |
jets_.eMax[jets_.nref] = 0; |
533 |
+ |
jets_.eSum[jets_.nref] = 0; |
534 |
+ |
jets_.eN[jets_.nref] = 0; |
535 |
+ |
|
536 |
+ |
jets_.neutralMax[jets_.nref] = 0; |
537 |
+ |
jets_.neutralSum[jets_.nref] = 0; |
538 |
+ |
jets_.neutralN[jets_.nref] = 0; |
539 |
+ |
|
540 |
+ |
jets_.photonMax[jets_.nref] = 0; |
541 |
+ |
jets_.photonSum[jets_.nref] = 0; |
542 |
+ |
jets_.photonN[jets_.nref] = 0; |
543 |
+ |
jets_.photonHardSum[jets_.nref] = 0; |
544 |
+ |
jets_.photonHardN[jets_.nref] = 0; |
545 |
+ |
|
546 |
+ |
jets_.chargedMax[jets_.nref] = 0; |
547 |
+ |
jets_.chargedSum[jets_.nref] = 0; |
548 |
+ |
jets_.chargedN[jets_.nref] = 0; |
549 |
+ |
jets_.chargedHardSum[jets_.nref] = 0; |
550 |
+ |
jets_.chargedHardN[jets_.nref] = 0; |
551 |
+ |
|
552 |
+ |
jets_.trackMax[jets_.nref] = 0; |
553 |
+ |
jets_.trackSum[jets_.nref] = 0; |
554 |
+ |
jets_.trackN[jets_.nref] = 0; |
555 |
+ |
jets_.trackHardSum[jets_.nref] = 0; |
556 |
+ |
jets_.trackHardN[jets_.nref] = 0; |
557 |
+ |
|
558 |
+ |
jets_.hcalSum[jets_.nref] = 0; |
559 |
+ |
jets_.ecalSum[jets_.nref] = 0; |
560 |
+ |
|
561 |
+ |
jets_.genChargedSum[jets_.nref] = 0; |
562 |
+ |
jets_.genHardSum[jets_.nref] = 0; |
563 |
+ |
|
564 |
+ |
jets_.signalChargedSum[jets_.nref] = 0; |
565 |
+ |
jets_.signalHardSum[jets_.nref] = 0; |
566 |
+ |
|
567 |
+ |
jets_.subid[jets_.nref] = -1; |
568 |
+ |
|
569 |
+ |
for(unsigned int icand = 0; icand < tracks->size(); ++icand){ |
570 |
+ |
const reco::Track& track = (*tracks)[icand]; |
571 |
+ |
if(useQuality_ ){ |
572 |
+ |
bool goodtrack = track.quality(reco::TrackBase::qualityByName(trackQuality_)); |
573 |
+ |
if(!goodtrack) continue; |
574 |
+ |
} |
575 |
+ |
|
576 |
+ |
double dr = deltaR(jet,track); |
577 |
+ |
if(dr < rParam){ |
578 |
+ |
double ptcand = track.pt(); |
579 |
+ |
jets_.trackSum[jets_.nref] += ptcand; |
580 |
+ |
jets_.trackN[jets_.nref] += 1; |
581 |
+ |
|
582 |
+ |
if(ptcand > hardPtMin_){ |
583 |
+ |
jets_.trackHardSum[jets_.nref] += ptcand; |
584 |
+ |
jets_.trackHardN[jets_.nref] += 1; |
585 |
+ |
|
586 |
+ |
} |
587 |
+ |
if(ptcand > jets_.trackMax[jets_.nref]) jets_.trackMax[jets_.nref] = ptcand; |
588 |
+ |
|
589 |
+ |
} |
590 |
+ |
} |
591 |
+ |
|
592 |
+ |
for(unsigned int icand = 0; icand < pfCandidates->size(); ++icand){ |
593 |
+ |
const reco::PFCandidate& track = (*pfCandidates)[icand]; |
594 |
+ |
double dr = deltaR(jet,track); |
595 |
+ |
if(dr < rParam){ |
596 |
+ |
double ptcand = track.pt(); |
597 |
+ |
int pfid = track.particleId(); |
598 |
+ |
|
599 |
+ |
switch(pfid){ |
600 |
+ |
|
601 |
+ |
case 1: |
602 |
+ |
jets_.chargedSum[jets_.nref] += ptcand; |
603 |
+ |
jets_.chargedN[jets_.nref] += 1; |
604 |
+ |
if(ptcand > hardPtMin_){ |
605 |
+ |
jets_.chargedHardSum[jets_.nref] += ptcand; |
606 |
+ |
jets_.chargedHardN[jets_.nref] += 1; |
607 |
+ |
} |
608 |
+ |
if(ptcand > jets_.chargedMax[jets_.nref]) jets_.chargedMax[jets_.nref] = ptcand; |
609 |
+ |
break; |
610 |
+ |
|
611 |
+ |
case 2: |
612 |
+ |
jets_.eSum[jets_.nref] += ptcand; |
613 |
+ |
jets_.eN[jets_.nref] += 1; |
614 |
+ |
if(ptcand > jets_.eMax[jets_.nref]) jets_.eMax[jets_.nref] = ptcand; |
615 |
+ |
break; |
616 |
+ |
|
617 |
+ |
case 3: |
618 |
+ |
jets_.muSum[jets_.nref] += ptcand; |
619 |
+ |
jets_.muN[jets_.nref] += 1; |
620 |
+ |
if(ptcand > jets_.muMax[jets_.nref]) jets_.muMax[jets_.nref] = ptcand; |
621 |
+ |
break; |
622 |
+ |
|
623 |
+ |
case 4: |
624 |
+ |
jets_.photonSum[jets_.nref] += ptcand; |
625 |
+ |
jets_.photonN[jets_.nref] += 1; |
626 |
+ |
if(ptcand > hardPtMin_){ |
627 |
+ |
jets_.photonHardSum[jets_.nref] += ptcand; |
628 |
+ |
jets_.photonHardN[jets_.nref] += 1; |
629 |
+ |
} |
630 |
+ |
if(ptcand > jets_.photonMax[jets_.nref]) jets_.photonMax[jets_.nref] = ptcand; |
631 |
+ |
break; |
632 |
+ |
|
633 |
+ |
case 5: |
634 |
+ |
jets_.neutralSum[jets_.nref] += ptcand; |
635 |
+ |
jets_.neutralN[jets_.nref] += 1; |
636 |
+ |
if(ptcand > jets_.neutralMax[jets_.nref]) jets_.neutralMax[jets_.nref] = ptcand; |
637 |
+ |
break; |
638 |
+ |
|
639 |
+ |
default: |
640 |
+ |
break; |
641 |
+ |
|
642 |
+ |
} |
643 |
+ |
} |
644 |
+ |
} |
645 |
+ |
|
646 |
+ |
// Calorimeter fractions |
647 |
+ |
|
648 |
+ |
for(unsigned int i = 0; i < hbheHits->size(); ++i){ |
649 |
+ |
const HBHERecHit & hit= (*hbheHits)[i]; |
650 |
+ |
math::XYZPoint pos = getPosition(hit.id(),vtx); |
651 |
+ |
double dr = deltaR(jet.eta(),jet.phi(),pos.eta(),pos.phi()); |
652 |
+ |
if(dr < rParam){ |
653 |
+ |
jets_.hcalSum[jets_.nref] += getEt(pos,hit.energy()); |
654 |
+ |
} |
655 |
+ |
} |
656 |
+ |
|
657 |
+ |
for(unsigned int i = 0; i < hfHits->size(); ++i){ |
658 |
+ |
const HFRecHit & hit= (*hfHits)[i]; |
659 |
+ |
math::XYZPoint pos = getPosition(hit.id(),vtx); |
660 |
+ |
double dr = deltaR(jet.eta(),jet.phi(),pos.eta(),pos.phi()); |
661 |
+ |
if(dr < rParam){ |
662 |
+ |
jets_.hcalSum[jets_.nref] += getEt(pos,hit.energy()); |
663 |
+ |
} |
664 |
+ |
} |
665 |
+ |
|
666 |
+ |
|
667 |
+ |
for(unsigned int i = 0; i < ebHits->size(); ++i){ |
668 |
+ |
const EcalRecHit & hit= (*ebHits)[i]; |
669 |
+ |
math::XYZPoint pos = getPosition(hit.id(),vtx); |
670 |
+ |
double dr = deltaR(jet.eta(),jet.phi(),pos.eta(),pos.phi()); |
671 |
+ |
if(dr < rParam){ |
672 |
+ |
jets_.ecalSum[jets_.nref] += getEt(pos,hit.energy()); |
673 |
+ |
} |
674 |
+ |
} |
675 |
+ |
|
676 |
+ |
for(unsigned int i = 0; i < eeHits->size(); ++i){ |
677 |
+ |
const EcalRecHit & hit= (*eeHits)[i]; |
678 |
+ |
math::XYZPoint pos = getPosition(hit.id(),vtx); |
679 |
+ |
double dr = deltaR(jet.eta(),jet.phi(),pos.eta(),pos.phi()); |
680 |
+ |
if(dr < rParam){ |
681 |
+ |
jets_.ecalSum[jets_.nref] += getEt(pos,hit.energy()); |
682 |
+ |
} |
683 |
+ |
} |
684 |
+ |
|
685 |
+ |
// Alternative reconstruction matching (PF for calo, calo for PF) |
686 |
+ |
|
687 |
+ |
double drMin = 100; |
688 |
+ |
for(unsigned int imatch = 0 ; imatch < matchedjets->size(); ++imatch){ |
689 |
+ |
const reco::Jet& mjet = (*matchedjets)[imatch]; |
690 |
+ |
|
691 |
+ |
double dr = deltaR(jet,mjet); |
692 |
+ |
if(dr < drMin){ |
693 |
+ |
jets_.matchedPt[jets_.nref] = mjet.pt(); |
694 |
+ |
jets_.matchedR[jets_.nref] = dr; |
695 |
+ |
drMin = dr; |
696 |
+ |
} |
697 |
+ |
} |
698 |
+ |
|
699 |
+ |
// if(etrk.quality(reco::TrackBase::qualityByName(qualityString_))) pev_.trkQual[pev_.nTrk]=1; |
700 |
+ |
|
701 |
+ |
///////////////////////////////////////////////////////////////// |
702 |
+ |
// Jet core pt^2 discriminant for fake jets |
703 |
+ |
// Edited by Yue Shi Lai <ylai@mit.edu> |
704 |
+ |
|
705 |
+ |
// Initial value is 0 |
706 |
+ |
jets_.discr_fr01[jets_.nref] = 0; |
707 |
+ |
// Start with no directional adaption, i.e. the fake rejection |
708 |
+ |
// axis is the jet axis |
709 |
+ |
float pseudorapidity_adapt = jets_.jteta[jets_.nref]; |
710 |
+ |
float azimuth_adapt = jets_.jtphi[jets_.nref]; |
711 |
+ |
|
712 |
+ |
// Unadapted discriminant with adaption search |
713 |
+ |
for (size_t iteration = 0; iteration < 2; iteration++) { |
714 |
+ |
float pseudorapidity_adapt_new = pseudorapidity_adapt; |
715 |
+ |
float azimuth_adapt_new = azimuth_adapt; |
716 |
+ |
float max_weighted_perp = 0; |
717 |
+ |
float perp_square_sum = 0; |
718 |
+ |
|
719 |
+ |
for (size_t index_pf_candidate = 0; |
720 |
+ |
index_pf_candidate < pfCandidates->size(); |
721 |
+ |
index_pf_candidate++) { |
722 |
+ |
const reco::PFCandidate &p = |
723 |
+ |
(*pfCandidates)[index_pf_candidate]; |
724 |
+ |
|
725 |
+ |
switch (p.particleId()) { |
726 |
+ |
//case 1: // Charged hadron |
727 |
+ |
//case 3: // Muon |
728 |
+ |
case 4: // Photon |
729 |
+ |
{ |
730 |
+ |
const float dpseudorapidity = |
731 |
+ |
p.eta() - pseudorapidity_adapt; |
732 |
+ |
const float dazimuth = |
733 |
+ |
reco::deltaPhi(p.phi(), azimuth_adapt); |
734 |
+ |
// The Gaussian scale factor is 0.5 / (0.1 * 0.1) |
735 |
+ |
// = 50 |
736 |
+ |
const float angular_weight = |
737 |
+ |
exp(-50.0F * (dpseudorapidity * dpseudorapidity + |
738 |
+ |
dazimuth * dazimuth)); |
739 |
+ |
const float weighted_perp = |
740 |
+ |
angular_weight * p.pt() * p.pt(); |
741 |
+ |
const float weighted_perp_square = |
742 |
+ |
weighted_perp * p.pt(); |
743 |
+ |
|
744 |
+ |
perp_square_sum += weighted_perp_square; |
745 |
+ |
if (weighted_perp >= max_weighted_perp) { |
746 |
+ |
pseudorapidity_adapt_new = p.eta(); |
747 |
+ |
azimuth_adapt_new = p.phi(); |
748 |
+ |
max_weighted_perp = weighted_perp; |
749 |
+ |
} |
750 |
+ |
} |
751 |
+ |
default: |
752 |
+ |
break; |
753 |
+ |
} |
754 |
+ |
} |
755 |
+ |
// Update the fake rejection value |
756 |
+ |
jets_.discr_fr01[jets_.nref] = std::max( |
757 |
+ |
jets_.discr_fr01[jets_.nref], perp_square_sum); |
758 |
+ |
// Update the directional adaption |
759 |
+ |
pseudorapidity_adapt = pseudorapidity_adapt_new; |
760 |
+ |
azimuth_adapt = azimuth_adapt_new; |
761 |
+ |
} |
762 |
+ |
|
763 |
|
jets_.jtpt[jets_.nref] = jet.pt(); |
764 |
|
jets_.jteta[jets_.nref] = jet.eta(); |
765 |
|
jets_.jtphi[jets_.nref] = jet.phi(); |
766 |
|
jets_.jty[jets_.nref] = jet.eta(); |
767 |
|
jets_.jtpu[jets_.nref] = jet.pileup(); |
768 |
+ |
jets_.jtm[jets_.nref] = jet.mass(); |
769 |
|
|
770 |
|
if(isMC_ && usePat_){ |
771 |
< |
const reco::GenJet* genjet = (*patjets)[j].genJet(); |
771 |
> |
|
772 |
> |
for(UInt_t i = 0; i < genparts->size(); ++i){ |
773 |
> |
const reco::GenParticle& p = (*genparts)[i]; |
774 |
> |
if (p.status()!=1) continue; |
775 |
> |
if (p.charge()==0) continue; |
776 |
> |
double dr = deltaR(jet,p); |
777 |
> |
if(dr < rParam){ |
778 |
> |
double ppt = p.pt(); |
779 |
> |
jets_.genChargedSum[jets_.nref] += ppt; |
780 |
> |
if(ppt > hardPtMin_) jets_.genHardSum[jets_.nref] += ppt; |
781 |
> |
if(p.collisionId() == 0){ |
782 |
> |
jets_.signalChargedSum[jets_.nref] += ppt; |
783 |
> |
if(ppt > hardPtMin_) jets_.signalHardSum[jets_.nref] += ppt; |
784 |
> |
} |
785 |
> |
|
786 |
> |
} |
787 |
> |
} |
788 |
> |
|
789 |
> |
const reco::GenJet * genjet = (*patjets)[j].genJet(); |
790 |
> |
|
791 |
|
if(genjet){ |
792 |
|
jets_.refpt[jets_.nref] = genjet->pt(); |
793 |
|
jets_.refeta[jets_.nref] = genjet->eta(); |
795 |
|
jets_.refy[jets_.nref] = genjet->eta(); |
796 |
|
jets_.refdphijt[jets_.nref] = reco::deltaPhi(jet.phi(), genjet->phi()); |
797 |
|
jets_.refdrjt[jets_.nref] = reco::deltaR(jet.eta(),jet.phi(),genjet->eta(),genjet->phi()); |
798 |
+ |
|
799 |
+ |
if(doSubEvent_){ |
800 |
+ |
const GenParticle* gencon = genjet->getGenConstituent(0); |
801 |
+ |
jets_.subid[jets_.nref] = gencon->collisionId(); |
802 |
+ |
} |
803 |
+ |
|
804 |
|
}else{ |
805 |
|
jets_.refpt[jets_.nref] = -999.; |
806 |
|
jets_.refeta[jets_.nref] = -999.; |
810 |
|
jets_.refdrjt[jets_.nref] = -999.; |
811 |
|
} |
812 |
|
|
813 |
< |
// matched partons |
814 |
< |
const reco::GenParticle * parton = (*patjets)[j].genParton(); |
815 |
< |
if(parton){ |
816 |
< |
jets_.refparton_pt[jets_.nref] = parton->pt(); |
817 |
< |
jets_.refparton_flavor[jets_.nref] = parton->pdgId(); |
818 |
< |
} else { |
819 |
< |
jets_.refparton_pt[jets_.nref] = -999; |
820 |
< |
jets_.refparton_flavor[jets_.nref] = -999; |
821 |
< |
} |
813 |
> |
jets_.refparton_flavorForB[jets_.nref] = (*patjets)[j].partonFlavour(); |
814 |
> |
|
815 |
> |
// matched partons |
816 |
> |
const reco::GenParticle & parton = *(*patjets)[j].genParton(); |
817 |
> |
|
818 |
> |
if((*patjets)[j].genParton()){ |
819 |
> |
jets_.refparton_pt[jets_.nref] = parton.pt(); |
820 |
> |
jets_.refparton_flavor[jets_.nref] = parton.pdgId(); |
821 |
> |
|
822 |
> |
if(saveBfragments_ && abs(jets_.refparton_flavorForB[jets_.nref])==5){ |
823 |
> |
|
824 |
> |
usedStringPts.clear(); |
825 |
> |
|
826 |
> |
// uncomment this if you want to know the ugly truth about parton matching -matt |
827 |
> |
//if(jet.pt() > 50 &&abs(parton.pdgId())!=5 && parton.pdgId()!=21) |
828 |
> |
// cout<<" Identified as a b, but doesn't match b or gluon, id = "<<parton.pdgId()<<endl; |
829 |
> |
|
830 |
> |
jets_.bJetIndex[jets_.bMult] = jets_.nref; |
831 |
> |
jets_.bStatus[jets_.bMult] = parton.status(); |
832 |
> |
jets_.bVx[jets_.bMult] = parton.vx(); |
833 |
> |
jets_.bVy[jets_.bMult] = parton.vy(); |
834 |
> |
jets_.bVz[jets_.bMult] = parton.vz(); |
835 |
> |
jets_.bPt[jets_.bMult] = parton.pt(); |
836 |
> |
jets_.bEta[jets_.bMult] = parton.eta(); |
837 |
> |
jets_.bPhi[jets_.bMult] = parton.phi(); |
838 |
> |
jets_.bPdg[jets_.bMult] = parton.pdgId(); |
839 |
> |
jets_.bChg[jets_.bMult] = parton.charge(); |
840 |
> |
jets_.bMult++; |
841 |
> |
saveDaughters(parton); |
842 |
> |
} |
843 |
> |
|
844 |
> |
|
845 |
> |
} else { |
846 |
> |
jets_.refparton_pt[jets_.nref] = -999; |
847 |
> |
jets_.refparton_flavor[jets_.nref] = -999; |
848 |
> |
} |
849 |
> |
|
850 |
> |
|
851 |
|
} |
852 |
|
|
853 |
|
jets_.nref++; |
858 |
|
|
859 |
|
if(isMC_){ |
860 |
|
|
861 |
+ |
edm::Handle<HepMCProduct> hepMCProduct; |
862 |
+ |
iEvent.getByLabel(eventInfoTag_,hepMCProduct); |
863 |
+ |
const HepMC::GenEvent* MCEvt = hepMCProduct->GetEvent(); |
864 |
+ |
|
865 |
+ |
std::pair<HepMC::GenParticle*,HepMC::GenParticle*> beamParticles = MCEvt->beam_particles(); |
866 |
+ |
if(beamParticles.first != 0)jets_.beamId1 = beamParticles.first->pdg_id(); |
867 |
+ |
if(beamParticles.second != 0)jets_.beamId2 = beamParticles.second->pdg_id(); |
868 |
+ |
|
869 |
|
edm::Handle<GenEventInfoProduct> hEventInfo; |
870 |
|
iEvent.getByLabel(eventInfoTag_,hEventInfo); |
871 |
|
//jets_.pthat = hEventInfo->binningValues()[0]; |
883 |
|
float genjet_pt = genjet.pt(); |
884 |
|
|
885 |
|
// threshold to reduce size of output in minbias PbPb |
886 |
< |
if(genjet_pt>20.){ |
886 |
> |
if(genjet_pt>genPtMin_){ |
887 |
|
|
888 |
|
jets_.genpt[jets_.ngen] = genjet_pt; |
889 |
|
jets_.geneta[jets_.ngen] = genjet.eta(); |
890 |
|
jets_.genphi[jets_.ngen] = genjet.phi(); |
891 |
|
jets_.geny[jets_.ngen] = genjet.eta(); |
892 |
|
|
893 |
+ |
if(doSubEvent_){ |
894 |
+ |
const GenParticle* gencon = genjet.getGenConstituent(0); |
895 |
+ |
jets_.gensubid[jets_.ngen] = gencon->collisionId(); |
896 |
+ |
} |
897 |
|
|
898 |
|
// find matching patJet if there is one |
899 |
|
|
900 |
|
jets_.gendrjt[jets_.ngen] = -1.0; |
901 |
|
jets_.genmatchindex[jets_.ngen] = -1; |
902 |
|
|
321 |
– |
|
903 |
|
for(unsigned int ijet = 0 ; ijet < jets->size(); ++ijet){ |
904 |
|
const pat::Jet& jet = (*jets)[ijet]; |
905 |
< |
|
906 |
< |
if(jet.genJet()){ |
907 |
< |
if(fabs(genjet.pt()-jet.genJet()->pt())<0.0001 && |
908 |
< |
fabs(genjet.eta()-jet.genJet()->eta())<0.0001 && |
909 |
< |
(fabs(genjet.phi()-jet.genJet()->phi())<0.0001 || fabs(genjet.phi()-jet.genJet()->phi() - 2.0*TMath::Pi()) < 0.0001 )){ |
905 |
> |
const reco::GenJet* matchedGenJet = (*patjets)[ijet].genJet(); |
906 |
> |
if(matchedGenJet){ |
907 |
> |
// poor man's matching, someone fix please |
908 |
> |
if(fabs(genjet.pt()-matchedGenJet->pt())<0.0001 && |
909 |
> |
fabs(genjet.eta()-matchedGenJet->eta())<0.0001 && |
910 |
> |
(fabs(genjet.phi()-matchedGenJet->phi())<0.0001 || fabs(genjet.phi()-matchedGenJet->phi() - 2.0*TMath::Pi()) < 0.0001 )){ |
911 |
|
|
912 |
|
jets_.genmatchindex[jets_.ngen] = (int)ijet; |
913 |
|
jets_.gendphijt[jets_.ngen] = reco::deltaPhi(jet.phi(),genjet.phi()); |
923 |
|
} |
924 |
|
|
925 |
|
} |
926 |
+ |
|
927 |
|
t->Fill(); |
928 |
+ |
memset(&jets_,0,sizeof jets_); |
929 |
+ |
|
930 |
|
} |
931 |
|
|
932 |
|
|
1026 |
|
} |
1027 |
|
|
1028 |
|
|
1029 |
+ |
int |
1030 |
+ |
HiInclusiveJetAnalyzer::getPFJetMuon(const pat::Jet& pfJet, const reco::PFCandidateCollection *pfCandidateColl) |
1031 |
+ |
{ |
1032 |
+ |
|
1033 |
+ |
int pfMuonIndex = -1; |
1034 |
+ |
float ptMax = 0.; |
1035 |
+ |
|
1036 |
+ |
|
1037 |
+ |
for(unsigned icand=0;icand<pfCandidateColl->size(); icand++) { |
1038 |
+ |
const reco::PFCandidate pfCandidate = pfCandidateColl->at(icand); |
1039 |
+ |
|
1040 |
+ |
int id = pfCandidate.particleId(); |
1041 |
+ |
if(abs(id) != 3) continue; |
1042 |
+ |
|
1043 |
+ |
if(reco::deltaR(pfJet,pfCandidate)>0.5) continue; |
1044 |
+ |
|
1045 |
+ |
double pt = pfCandidate.pt(); |
1046 |
+ |
if(pt>ptMax){ |
1047 |
+ |
ptMax = pt; |
1048 |
+ |
pfMuonIndex = (int) icand; |
1049 |
+ |
} |
1050 |
+ |
} |
1051 |
+ |
|
1052 |
+ |
return pfMuonIndex; |
1053 |
+ |
|
1054 |
+ |
} |
1055 |
+ |
|
1056 |
+ |
|
1057 |
+ |
double |
1058 |
+ |
HiInclusiveJetAnalyzer::getPtRel(const reco::PFCandidate lep, const pat::Jet& jet ) |
1059 |
+ |
{ |
1060 |
+ |
|
1061 |
+ |
float lj_x = jet.p4().px(); |
1062 |
+ |
float lj_y = jet.p4().py(); |
1063 |
+ |
float lj_z = jet.p4().pz(); |
1064 |
+ |
|
1065 |
+ |
// absolute values squared |
1066 |
+ |
float lj2 = lj_x*lj_x+lj_y*lj_y+lj_z*lj_z; |
1067 |
+ |
float lep2 = lep.px()*lep.px()+lep.py()*lep.py()+lep.pz()*lep.pz(); |
1068 |
+ |
|
1069 |
+ |
// projection vec(mu) to lepjet axis |
1070 |
+ |
float lepXlj = lep.px()*lj_x+lep.py()*lj_y+lep.pz()*lj_z; |
1071 |
+ |
|
1072 |
+ |
// absolute value squared and normalized |
1073 |
+ |
float pLrel2 = lepXlj*lepXlj/lj2; |
1074 |
+ |
|
1075 |
+ |
// lep2 = pTrel2 + pLrel2 |
1076 |
+ |
float pTrel2 = lep2-pLrel2; |
1077 |
+ |
|
1078 |
+ |
return (pTrel2 > 0) ? std::sqrt(pTrel2) : 0.0; |
1079 |
+ |
} |
1080 |
+ |
|
1081 |
+ |
// Recursive function, but this version gets called only the first time |
1082 |
+ |
void |
1083 |
+ |
HiInclusiveJetAnalyzer::saveDaughters(const reco::GenParticle &gen){ |
1084 |
+ |
|
1085 |
+ |
for(unsigned i=0;i<gen.numberOfDaughters();i++){ |
1086 |
+ |
const reco::Candidate & daughter = *gen.daughter(i); |
1087 |
+ |
double daughterPt = daughter.pt(); |
1088 |
+ |
if(daughterPt<1.) continue; |
1089 |
+ |
double daughterEta = daughter.eta(); |
1090 |
+ |
if(fabs(daughterEta)>3.) continue; |
1091 |
+ |
int daughterPdgId = daughter.pdgId(); |
1092 |
+ |
int daughterStatus = daughter.status(); |
1093 |
+ |
// Special case when b->b+string, both b and string contain all daughters, so only take the string |
1094 |
+ |
if(gen.pdgId()==daughterPdgId && gen.status()==3 && daughterStatus==2) continue; |
1095 |
+ |
|
1096 |
+ |
// cheesy way of finding strings which were already used |
1097 |
+ |
if(daughter.pdgId()==92){ |
1098 |
+ |
for(unsigned ist=0;ist<usedStringPts.size();ist++){ |
1099 |
+ |
if(fabs(daughter.pt() - usedStringPts[ist]) < 0.0001) return; |
1100 |
+ |
} |
1101 |
+ |
usedStringPts.push_back(daughter.pt()); |
1102 |
+ |
} |
1103 |
+ |
jets_.bJetIndex[jets_.bMult] = jets_.nref; |
1104 |
+ |
jets_.bStatus[jets_.bMult] = daughterStatus; |
1105 |
+ |
jets_.bVx[jets_.bMult] = daughter.vx(); |
1106 |
+ |
jets_.bVy[jets_.bMult] = daughter.vy(); |
1107 |
+ |
jets_.bVz[jets_.bMult] = daughter.vz(); |
1108 |
+ |
jets_.bPt[jets_.bMult] = daughterPt; |
1109 |
+ |
jets_.bEta[jets_.bMult] = daughterEta; |
1110 |
+ |
jets_.bPhi[jets_.bMult] = daughter.phi(); |
1111 |
+ |
jets_.bPdg[jets_.bMult] = daughterPdgId; |
1112 |
+ |
jets_.bChg[jets_.bMult] = daughter.charge(); |
1113 |
+ |
jets_.bMult++; |
1114 |
+ |
saveDaughters(daughter); |
1115 |
+ |
} |
1116 |
+ |
} |
1117 |
+ |
|
1118 |
+ |
// This version called for all subsequent calls |
1119 |
+ |
void |
1120 |
+ |
HiInclusiveJetAnalyzer::saveDaughters(const reco::Candidate &gen){ |
1121 |
+ |
|
1122 |
+ |
for(unsigned i=0;i<gen.numberOfDaughters();i++){ |
1123 |
+ |
const reco::Candidate & daughter = *gen.daughter(i); |
1124 |
+ |
double daughterPt = daughter.pt(); |
1125 |
+ |
if(daughterPt<1.) continue; |
1126 |
+ |
double daughterEta = daughter.eta(); |
1127 |
+ |
if(fabs(daughterEta)>3.) continue; |
1128 |
+ |
int daughterPdgId = daughter.pdgId(); |
1129 |
+ |
int daughterStatus = daughter.status(); |
1130 |
+ |
// Special case when b->b+string, both b and string contain all daughters, so only take the string |
1131 |
+ |
if(gen.pdgId()==daughterPdgId && gen.status()==3 && daughterStatus==2) continue; |
1132 |
+ |
|
1133 |
+ |
// cheesy way of finding strings which were already used |
1134 |
+ |
if(daughter.pdgId()==92){ |
1135 |
+ |
for(unsigned ist=0;ist<usedStringPts.size();ist++){ |
1136 |
+ |
if(fabs(daughter.pt() - usedStringPts[ist]) < 0.0001) return; |
1137 |
+ |
} |
1138 |
+ |
usedStringPts.push_back(daughter.pt()); |
1139 |
+ |
} |
1140 |
+ |
|
1141 |
+ |
jets_.bJetIndex[jets_.bMult] = jets_.nref; |
1142 |
+ |
jets_.bStatus[jets_.bMult] = daughterStatus; |
1143 |
+ |
jets_.bVx[jets_.bMult] = daughter.vx(); |
1144 |
+ |
jets_.bVy[jets_.bMult] = daughter.vy(); |
1145 |
+ |
jets_.bVz[jets_.bMult] = daughter.vz(); |
1146 |
+ |
jets_.bPt[jets_.bMult] = daughterPt; |
1147 |
+ |
jets_.bEta[jets_.bMult] = daughterEta; |
1148 |
+ |
jets_.bPhi[jets_.bMult] = daughter.phi(); |
1149 |
+ |
jets_.bPdg[jets_.bMult] = daughterPdgId; |
1150 |
+ |
jets_.bChg[jets_.bMult] = daughter.charge(); |
1151 |
+ |
jets_.bMult++; |
1152 |
+ |
saveDaughters(daughter); |
1153 |
+ |
} |
1154 |
+ |
} |
1155 |
+ |
|
1156 |
+ |
double HiInclusiveJetAnalyzer::getEt(math::XYZPoint pos, double energy){ |
1157 |
+ |
double et = energy*sin(pos.theta()); |
1158 |
+ |
return et; |
1159 |
+ |
} |
1160 |
+ |
|
1161 |
+ |
math::XYZPoint HiInclusiveJetAnalyzer::getPosition(const DetId &id, reco::Vertex::Point vtx){ |
1162 |
+ |
const GlobalPoint& pos=geo->getPosition(id); |
1163 |
+ |
math::XYZPoint posV(pos.x() - vtx.x(),pos.y() - vtx.y(),pos.z() - vtx.z()); |
1164 |
+ |
return posV; |
1165 |
+ |
} |
1166 |
+ |
|
1167 |
|
|
1168 |
|
|
1169 |
|
DEFINE_FWK_MODULE(HiInclusiveJetAnalyzer); |