CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JetTester.cc
Go to the documentation of this file.
1 // Producer for validation histograms for Calo, JPT and PF jet objects
2 // F. Ratnikov, Sept. 7, 2006
3 // Modified by Chiyoung Jeong, Feb. 2, 2010
4 // Modified by J. Piedra, Sept. 11, 2013
5 
6 #include "JetTester.h"
7 
8 using namespace edm;
9 using namespace reco;
10 using namespace std;
11 
13  mInputCollection (iConfig.getParameter<edm::InputTag> ("src")),
14 // rhoTag (iConfig.getParameter<edm::InputTag> ("srcRho")),
15  JetType (iConfig.getUntrackedParameter<std::string>("JetType")),
16  mRecoJetPtThreshold (iConfig.getParameter<double> ("recoJetPtThreshold")),
17  mMatchGenPtThreshold (iConfig.getParameter<double> ("matchGenPtThreshold")),
18  mRThreshold (iConfig.getParameter<double> ("RThreshold"))
19 {
20  std::string inputCollectionLabel(mInputCollection.label());
21 
22  isCaloJet = (std::string("calo")==JetType);
23  isPFJet = (std::string("pf") ==JetType);
24  isMiniAODJet = (std::string("miniaod") ==JetType);
25  if(!isMiniAODJet){
26  mJetCorrector =iConfig.getParameter<edm::InputTag>("JetCorrections");
27  }
28 
29  //consumes
30  pvToken_ = consumes<std::vector<reco::Vertex> >(iConfig.getParameter<edm::InputTag>("primVertex"));
31  if (isCaloJet) caloJetsToken_ = consumes<reco::CaloJetCollection>(mInputCollection);
32  if (isPFJet) pfJetsToken_ = consumes<reco::PFJetCollection>(mInputCollection);
33  if(isMiniAODJet)patJetsToken_ = consumes<pat::JetCollection>(mInputCollection);
35  genJetsToken_ = consumes<reco::GenJetCollection>(edm::InputTag(mInputGenCollection));
36  evtToken_ = consumes<GenEventInfoProduct>(edm::InputTag("generator"));
37  if(!isMiniAODJet && !mJetCorrector.label().empty()){
38  jetCorrectorToken_ = consumes<reco::JetCorrector>(mJetCorrector);
39  }
40 
41  // Events variables
42  mNvtx = 0;
43 
44  // Jet parameters
45  mEta = 0;
46  mPhi = 0;
47  mEnergy = 0;
48  mP = 0;
49  mPt = 0;
50  mMass = 0;
51  mConstituents = 0;
52  mJetArea = 0;
53 // mRho = 0;
54 
55  // Corrected jets
56  mCorrJetPt = 0;
57  mCorrJetEta = 0;
58  mCorrJetPhi = 0;
59  mCorrJetEta_Pt40 = 0;
60  mCorrJetPhi_Pt40 = 0;
61 
62  // Corrected jets profiles
79 
80  // Generation
81  mGenEta = 0;
82  mGenPhi = 0;
83  mGenPt = 0;
84  mGenEtaFirst = 0;
85  mGenPhiFirst = 0;
86  mPtHat = 0;
87  mDeltaEta = 0;
88  mDeltaPhi = 0;
89  mDeltaPt = 0;
90 
106 
107  // Generation profiles
119 
120  // Some jet algebra
121  mEtaFirst = 0;
122  mPhiFirst = 0;
123  mPtFirst = 0;
124  mMjj = 0;
125  mNJetsEta_B_20_40 = 0;
126  mNJetsEta_E_20_40 = 0;
127  mNJetsEta_B_40 = 0;
128  mNJetsEta_E_40 = 0;
129  mNJets1 = 0;
130  mNJets2 = 0;
131 
132 // // PFJet specific
133 // mHadEnergyInHF = 0;
134 // mEmEnergyInHF = 0;
135 // mChargedEmEnergy = 0;
136 // mChargedHadronEnergy = 0;
137 // mNeutralEmEnergy = 0;
138 // mNeutralHadronEnergy = 0;
139 
140  // ---- Calo Jet specific information ----
142  maxEInEmTowers = 0;
144  maxEInHadTowers = 0;
148  emEnergyFraction = 0;
150  hadEnergyInHB = 0;
152  hadEnergyInHO = 0;
154  hadEnergyInHE = 0;
156  hadEnergyInHF = 0;
158  emEnergyInEB = 0;
160  emEnergyInEE = 0;
162  emEnergyInHF = 0;
164  towersArea = 0;
166  n90 = 0;
168  n60 = 0;
169 
170  // ---- JPT Jet specific information ----
172 // elecMultiplicity = 0;
173 
174  // ---- JPT or PF Jet specific information ----
176  muonMultiplicity = 0;
180  chargedEmEnergy = 0;
182  neutralEmEnergy = 0;
195 
196  // ---- PF Jet specific information ----
198  photonEnergy = 0;
202  electronEnergy = 0;
206  muonEnergy = 0;
208  muonEnergyFraction = 0;
210  HFHadronEnergy = 0;
214  HFEMEnergy = 0;
216  HFEMEnergyFraction = 0;
222  photonMultiplicity = 0;
228  HFEMMultiplicity = 0;
230  chargedMuEnergy = 0;
235 
237  HOEnergy = 0;
239  HOEnergyFraction = 0;
240 }
241 
243  edm::Run const & iRun,
244  edm::EventSetup const & ) {
245 
246  ibooker.setCurrentFolder("JetMET/JetValidation/"+mInputCollection.label());
247 
248  double log10PtMin = 0.50;
249  double log10PtMax = 3.75;
250  int log10PtBins = 26;
251 
252  double etaRange[91] = {-6.0, -5.8, -5.6, -5.4, -5.2, -5.0, -4.8, -4.6, -4.4, -4.2,
253  -4.0, -3.8, -3.6, -3.4, -3.2, -3.0, -2.9, -2.8, -2.7, -2.6,
254  -2.5, -2.4, -2.3, -2.2, -2.1, -2.0, -1.9, -1.8, -1.7, -1.6,
255  -1.5, -1.4, -1.3, -1.2, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6,
256  -0.5, -0.4, -0.3, -0.2, -0.1,
257  0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9,
258  1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9,
259  2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9,
260  3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8,
261  5.0, 5.2, 5.4, 5.6, 5.8, 6.0};
262 
263  // Event variables
264  mNvtx = ibooker.book1D("Nvtx", "number of vertices", 60, 0, 60);
265 
266  // Jet parameters
267  mEta = ibooker.book1D("Eta", "Eta", 120, -6, 6);
268  mPhi = ibooker.book1D("Phi", "Phi", 70, -3.5, 3.5);
269  mPt = ibooker.book1D("Pt", "Pt", 100, 0, 1000);
270  mP = ibooker.book1D("P", "P", 100, 0, 1000);
271  mEnergy = ibooker.book1D("Energy", "Energy", 100, 0, 1000);
272  mMass = ibooker.book1D("Mass", "Mass", 100, 0, 200);
273  mConstituents = ibooker.book1D("Constituents", "Constituents", 100, 0, 100);
274  mJetArea = ibooker.book1D("JetArea", "JetArea", 100, 0, 4);
275 
276  // Corrected jets
277  if (isMiniAODJet || !mJetCorrector.label().empty()) {//if correction label is filled, but fill also for MiniAOD though
278  mCorrJetPt = ibooker.book1D("CorrJetPt", "CorrJetPt", 150, 0, 1500);
279  mCorrJetEta = ibooker.book1D("CorrJetEta", "CorrJetEta Pt>20", 60, -6, 6);
280  mCorrJetPhi = ibooker.book1D("CorrJetPhi", "CorrJetPhi Pt>20", 70, -3.5, 3.5);
281  mCorrJetEta_Pt40 = ibooker.book1D("CorrJetEta_Pt40", "CorrJetEta Pt>40", 60, -6, 6);
282  mCorrJetPhi_Pt40 = ibooker.book1D("CorrJetPhi_Pt40", "CorrJetPhi Pt>40", 70, -3.5, 3.5);
283 
284  // Corrected jets profiles
285  mPtCorrOverReco_Pt_B = ibooker.bookProfile("PtCorrOverReco_Pt_B", "0<|eta|<1.5", log10PtBins, log10PtMin, log10PtMax, 0, 5, " ");
286  mPtCorrOverReco_Pt_E = ibooker.bookProfile("PtCorrOverReco_Pt_E", "1.5<|eta|<3", log10PtBins, log10PtMin, log10PtMax, 0, 5, " ");
287  mPtCorrOverReco_Pt_F = ibooker.bookProfile("PtCorrOverReco_Pt_F", "3<|eta|<6", log10PtBins, log10PtMin, log10PtMax, 0, 5, " ");
288 
289  mPtCorrOverReco_Eta_20_40 = ibooker.bookProfile("PtCorrOverReco_Eta_20_40", "20<genPt<40", 90, etaRange, 0, 5, " ");
290  mPtCorrOverReco_Eta_40_200 = ibooker.bookProfile("PtCorrOverReco_Eta_40_200", "40<genPt<200", 90, etaRange, 0, 5, " ");
291  mPtCorrOverReco_Eta_200_600 = ibooker.bookProfile("PtCorrOverReco_Eta_200_600", "200<genPt<600", 90, etaRange, 0, 5, " ");
292  mPtCorrOverReco_Eta_600_1500 = ibooker.bookProfile("PtCorrOverReco_Eta_600_1500", "600<genPt<1500", 90, etaRange, 0, 5, " ");
293  mPtCorrOverReco_Eta_1500_3500 = ibooker.bookProfile("PtCorrOverReco_Eta_1500_3500", "1500<genPt<3500", 90, etaRange, 0, 5, " ");
294 
295  mPtCorrOverGen_GenPt_B = ibooker.bookProfile("PtCorrOverGen_GenPt_B", "0<|eta|<1.5", log10PtBins, log10PtMin, log10PtMax, 0.8, 1.2, " ");
296  mPtCorrOverGen_GenPt_E = ibooker.bookProfile("PtCorrOverGen_GenPt_E", "1.5<|eta|<3", log10PtBins, log10PtMin, log10PtMax, 0.8, 1.2, " ");
297  mPtCorrOverGen_GenPt_F = ibooker.bookProfile("PtCorrOverGen_GenPt_F", "3<|eta|<6", log10PtBins, log10PtMin, log10PtMax, 0.8, 1.2, " ");
298 
299  mPtCorrOverGen_GenEta_20_40 = ibooker.bookProfile("PtCorrOverGen_GenEta_20_40", "20<genPt<40;#eta", 90, etaRange, 0.8, 1.2, " ");
300  mPtCorrOverGen_GenEta_40_200 = ibooker.bookProfile("PtCorrOverGen_GenEta_40_200", "40<genPt<200;#eta", 90, etaRange, 0.8, 1.2, " ");
301  mPtCorrOverGen_GenEta_200_600 = ibooker.bookProfile("PtCorrOverGen_GenEta_200_600", "200<genPt<600;#eta", 90, etaRange, 0.8, 1.2, " ");
302  mPtCorrOverGen_GenEta_600_1500 = ibooker.bookProfile("PtCorrOverGen_GenEta_600_1500", "600<genPt<1500;#eta", 90, etaRange, 0.8, 1.2, " ");
303  mPtCorrOverGen_GenEta_1500_3500 = ibooker.bookProfile("PtCorrOverGen_GenEta_1500_3500", "1500<genPt<3500;#eta", 90, etaRange, 0.8, 1.2, " ");
304  }
305 
306  mGenEta = ibooker.book1D("GenEta", "GenEta", 120, -6, 6);
307  mGenPhi = ibooker.book1D("GenPhi", "GenPhi", 70, -3.5, 3.5);
308  mGenPt = ibooker.book1D("GenPt", "GenPt", 100, 0, 1000);
309  mGenEtaFirst = ibooker.book1D("GenEtaFirst", "GenEtaFirst", 120, -6, 6);
310  mGenPhiFirst = ibooker.book1D("GenPhiFirst", "GenPhiFirst", 70, -3.5, 3.5);
311  mPtHat = ibooker.book1D("PtHat", "PtHat", 100, 0, 1000);
312  mDeltaEta = ibooker.book1D("DeltaEta", "DeltaEta", 100, -0.5, 0.5);
313  mDeltaPhi = ibooker.book1D("DeltaPhi", "DeltaPhi", 100, -0.5, 0.5);
314  mDeltaPt = ibooker.book1D("DeltaPt", "DeltaPt", 100, -1.0, 1.0);
315 
316  mPtRecoOverGen_B_20_40 = ibooker.book1D("PtRecoOverGen_B_20_40", "20<genpt<40", 90, 0, 2);
317  mPtRecoOverGen_E_20_40 = ibooker.book1D("PtRecoOverGen_E_20_40", "20<genpt<40", 90, 0, 2);
318  mPtRecoOverGen_F_20_40 = ibooker.book1D("PtRecoOverGen_F_20_40", "20<genpt<40", 90, 0, 2);
319  mPtRecoOverGen_B_40_200 = ibooker.book1D("PtRecoOverGen_B_40_200", "40<genpt<200", 90, 0, 2);
320  mPtRecoOverGen_E_40_200 = ibooker.book1D("PtRecoOverGen_E_40_200", "40<genpt<200", 90, 0, 2);
321  mPtRecoOverGen_F_40_200 = ibooker.book1D("PtRecoOverGen_F_40_200", "40<genpt<200", 90, 0, 2);
322  mPtRecoOverGen_B_200_600 = ibooker.book1D("PtRecoOverGen_B_200_600", "200<genpt<600", 90, 0, 2);
323  mPtRecoOverGen_E_200_600 = ibooker.book1D("PtRecoOverGen_E_200_600", "200<genpt<600", 90, 0, 2);
324  mPtRecoOverGen_F_200_600 = ibooker.book1D("PtRecoOverGen_F_200_600", "200<genpt<600", 90, 0, 2);
325  mPtRecoOverGen_B_600_1500 = ibooker.book1D("PtRecoOverGen_B_600_1500", "600<genpt<1500", 90, 0, 2);
326  mPtRecoOverGen_E_600_1500 = ibooker.book1D("PtRecoOverGen_E_600_1500", "600<genpt<1500", 90, 0, 2);
327  mPtRecoOverGen_F_600_1500 = ibooker.book1D("PtRecoOverGen_F_600_1500", "600<genpt<1500", 90, 0, 2);
328  mPtRecoOverGen_B_1500_3500 = ibooker.book1D("PtRecoOverGen_B_1500_3500", "1500<genpt<3500", 90, 0, 2);
329  mPtRecoOverGen_E_1500_3500 = ibooker.book1D("PtRecoOverGen_E_1500_3500", "1500<genpt<3500", 90, 0, 2);
330  mPtRecoOverGen_F_1500_3500 = ibooker.book1D("PtRecoOverGen_F_1500_3500", "1500<genpt<3500", 90, 0, 2);
331 
332  // Generation profiles
333  mPtRecoOverGen_GenPt_B = ibooker.bookProfile("PtRecoOverGen_GenPt_B", "0<|eta|<1.5", log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
334  mPtRecoOverGen_GenPt_E = ibooker.bookProfile("PtRecoOverGen_GenPt_E", "1.5<|eta|<3", log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
335  mPtRecoOverGen_GenPt_F = ibooker.bookProfile("PtRecoOverGen_GenPt_F", "3<|eta|<6", log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
336  mPtRecoOverGen_GenPhi_B = ibooker.bookProfile("PtRecoOverGen_GenPhi_B", "0<|eta|<1.5", 70, -3.5, 3.5, 0, 2, " ");
337  mPtRecoOverGen_GenPhi_E = ibooker.bookProfile("PtRecoOverGen_GenPhi_E", "1.5<|eta|<3", 70, -3.5, 3.5, 0, 2, " ");
338  mPtRecoOverGen_GenPhi_F = ibooker.bookProfile("PtRecoOverGen_GenPhi_F", "3<|eta|<6", 70, -3.5, 3.5, 0, 2, " ");
339  mPtRecoOverGen_GenEta_20_40 = ibooker.bookProfile("PtRecoOverGen_GenEta_20_40", "20<genpt<40", 90, etaRange, 0, 2, " ");
340  mPtRecoOverGen_GenEta_40_200 = ibooker.bookProfile("PtRecoOverGen_GenEta_40_200", "40<genpt<200", 90, etaRange, 0, 2, " ");
341  mPtRecoOverGen_GenEta_200_600 = ibooker.bookProfile("PtRecoOverGen_GenEta_200_600", "200<genpt<600", 90, etaRange, 0, 2, " ");
342  mPtRecoOverGen_GenEta_600_1500 = ibooker.bookProfile("PtRecoOverGen_GenEta_600_1500", "600<genpt<1500", 90, etaRange, 0, 2, " ");
343  mPtRecoOverGen_GenEta_1500_3500 = ibooker.bookProfile("PtRecoOverGen_GenEta_1500_3500", "1500<genpt<3500", 90, etaRange, 0, 2, " ");
344 
345  // Some jet algebra
346  //------------------------------------------------------------------------
347  mEtaFirst = ibooker.book1D("EtaFirst", "EtaFirst", 120, -6, 6);
348  mPhiFirst = ibooker.book1D("PhiFirst", "PhiFirst", 70, -3.5, 3.5);
349  mPtFirst = ibooker.book1D("PtFirst", "PtFirst", 50, 0, 1000);
350  mMjj = ibooker.book1D("Mjj", "Mjj", 100, 0, 2000);
351  mNJetsEta_B_20_40 = ibooker.book1D("NJetsEta_B_20_40", "NJetsEta_B 20<Pt<40", 15, 0, 15);
352  mNJetsEta_E_20_40 = ibooker.book1D("NJetsEta_E_20_40", "NJetsEta_E 20<Pt<40", 15, 0, 15);
353  mNJetsEta_B_40 = ibooker.book1D("NJetsEta_B", "NJetsEta_B 40<Pt", 15, 0, 15);
354  mNJetsEta_E_40 = ibooker.book1D("NJetsEta_E", "NJetsEta_E 40<Pt", 15, 0, 15);
355  mNJets_40 = ibooker.book1D("NJets", "NJets 40>Pt", 15, 0, 15);
356  mNJets1 = ibooker.bookProfile("NJets1", "Number of jets above Pt threshold", 100, 0, 200, 100, 0, 50, "s");
357  mNJets2 = ibooker.bookProfile("NJets2", "Number of jets above Pt threshold", 100, 0, 4000, 100, 0, 50, "s");
358 
359 
360  if (isCaloJet) {
361  maxEInEmTowers = ibooker.book1D("maxEInEmTowers", "maxEInEmTowers", 50,0,500);
362  maxEInHadTowers = ibooker.book1D("maxEInHadTowers", "maxEInHadTowers", 50,0,500);
363  energyFractionHadronic = ibooker.book1D("energyFractionHadronic", "energyFractionHadronic", 50,0,1);
364  emEnergyFraction = ibooker.book1D("emEnergyFraction", "emEnergyFraction", 50,0,1);
365  hadEnergyInHB = ibooker.book1D("hadEnergyInHB", "hadEnergyInHB", 50,0,500);
366  hadEnergyInHO = ibooker.book1D("hadEnergyInHO", "hadEnergyInHO", 50,0,500);
367  hadEnergyInHE = ibooker.book1D("hadEnergyInHE", "hadEnergyInHE", 50,0,500);
368  hadEnergyInHF = ibooker.book1D("hadEnergyInHF", "hadEnergyInHF", 50,0,500);
369  emEnergyInEB = ibooker.book1D("emEnergyInEB", "emEnergyInEB", 50,0,500);
370  emEnergyInEE = ibooker.book1D("emEnergyInEE", "emEnergyInEE", 50,0,500);
371  emEnergyInHF = ibooker.book1D("emEnergyInHF", "emEnergyInHF", 50,0,500);
372  towersArea = ibooker.book1D("towersArea", "towersArea", 50,0,1);
373  n90 = ibooker.book1D("n90", "n90", 30,0,30);
374  n60 = ibooker.book1D("n60", "n60", 30,0,30);
375  }
376 
377  if (isPFJet || isMiniAODJet) {
378  muonMultiplicity = ibooker.book1D("muonMultiplicity", "muonMultiplicity", 10,0,10);
379  chargedMultiplicity = ibooker.book1D("chargedMultiplicity", "chargedMultiplicity", 100,0,100);
380  chargedEmEnergy = ibooker.book1D("chargedEmEnergy", "chargedEmEnergy", 100,0,500);
381  neutralEmEnergy = ibooker.book1D("neutralEmEnergy", "neutralEmEnergy", 100,0,500);
382  chargedHadronEnergy = ibooker.book1D("chargedHadronEnergy", "chargedHadronEnergy", 100,0,500);
383  neutralHadronEnergy = ibooker.book1D("neutralHadronEnergy", "neutralHadronEnergy", 100,0,500);
384  chargedHadronEnergyFraction = ibooker.book1D("chargedHadronEnergyFraction", "chargedHadronEnergyFraction", 50,0,1);
385  neutralHadronEnergyFraction = ibooker.book1D("neutralHadronEnergyFraction", "neutralHadronEnergyFraction", 50,0,1);
386  chargedEmEnergyFraction = ibooker.book1D("chargedEmEnergyFraction", "chargedEmEnergyFraction", 50,0,1);
387  neutralEmEnergyFraction = ibooker.book1D("neutralEmEnergyFraction", "neutralEmEnergyFraction", 50,0,1);
388  photonEnergy = ibooker.book1D("photonEnergy", "photonEnergy", 50,0,500);
389  photonEnergyFraction = ibooker.book1D("photonEnergyFraction", "photonEnergyFraction", 50,0,1);
390  electronEnergy = ibooker.book1D("electronEnergy", "electronEnergy", 50,0,500);
391  electronEnergyFraction = ibooker.book1D("electronEnergyFraction", "electronEnergyFraction", 50,0,1);
392  muonEnergy = ibooker.book1D("muonEnergy", "muonEnergy", 50,0,500);
393  muonEnergyFraction = ibooker.book1D("muonEnergyFraction", "muonEnergyFraction", 50,0,1);
394  HFHadronEnergy = ibooker.book1D("HFHadronEnergy", "HFHadronEnergy", 50,0,500);
395  HFHadronEnergyFraction = ibooker.book1D("HFHadronEnergyFraction", "HFHadronEnergyFraction", 50,0,1);
396  HFEMEnergy = ibooker.book1D("HFEMEnergy", "HFEMEnergy", 50,0,500);
397  HFEMEnergyFraction = ibooker.book1D("HFEMEnergyFraction", "HFEMEnergyFraction", 50,0,1);
398  chargedHadronMultiplicity = ibooker.book1D("chargedHadronMultiplicity", "chargedHadronMultiplicity", 50,0,50);
399  neutralHadronMultiplicity = ibooker.book1D("neutralHadronMultiplicity", "neutralHadronMultiplicity", 50,0,50);
400  photonMultiplicity = ibooker.book1D("photonMultiplicity", "photonMultiplicity", 10,0,10);
401  electronMultiplicity = ibooker.book1D("electronMultiplicity", "electronMultiplicity", 10,0,10);
402  HFHadronMultiplicity = ibooker.book1D("HFHadronMultiplicity", "HFHadronMultiplicity", 50,0,50);
403  HFEMMultiplicity = ibooker.book1D("HFEMMultiplicity", "HFEMMultiplicity", 50,0,50);
404  chargedMuEnergy = ibooker.book1D("chargedMuEnergy", "chargedMuEnergy", 50,0,500);
405  chargedMuEnergyFraction = ibooker.book1D("chargedMuEnergyFraction", "chargedMuEnergyFraction", 50,0,1);
406  neutralMultiplicity = ibooker.book1D("neutralMultiplicity", "neutralMultiplicity", 50,0,50);
407  HOEnergy = ibooker.book1D("HOEnergy", "HOEnergy", 50,0,500);
408  HOEnergyFraction = ibooker.book1D("HOEnergyFraction", "HOEnergyFraction", 50,0,1);
409  }
410 }
411 
412 
413 //------------------------------------------------------------------------------
414 // ~JetTester
415 //------------------------------------------------------------------------------
417 
418 
419 //------------------------------------------------------------------------------
420 // analyze
421 //------------------------------------------------------------------------------
422 void JetTester::analyze(const edm::Event& mEvent, const edm::EventSetup& mSetup)
423 {
424  // Get the primary vertices
425  //----------------------------------------------------------------------------
427  mEvent.getByToken(pvToken_, pvHandle);
428 
429  int nGoodVertices = 0;
430 
431  if (pvHandle.isValid())
432  {
433  for (unsigned i=0; i<pvHandle->size(); i++)
434  {
435  if ((*pvHandle)[i].ndof() > 4 &&
436  (fabs((*pvHandle)[i].z()) <= 24) &&
437  (fabs((*pvHandle)[i].position().rho()) <= 2))
438  nGoodVertices++;
439  }
440  }
441 
442  mNvtx->Fill(nGoodVertices);
443 
444 // // Get the jet rho
445 // //----------------------------------------------------------------------------
446 // edm::Handle<double> pRho;
447 // mEvent.getByToken(rhoTag, pRho);
448 //
449 // if (pRho.isValid())
450 // {
451 // double jetRho = *pRho;
452 //
453 // if (mRho) mRho->Fill(jetRho);
454 // }
455 
456 
457  // Get the Jet collection
458  //----------------------------------------------------------------------------
459  math::XYZTLorentzVector p4tmp[2];
460 
461  std::vector<Jet> recoJets;
462  recoJets.clear();
463 
466 // edm::Handle<JPTJetCollection> jptJets;
468 
469  if (isCaloJet) mEvent.getByToken(caloJetsToken_, caloJets);
470  if (isPFJet) mEvent.getByToken(pfJetsToken_, pfJets);
471 // if (isJPTJet) mEvent.getByToken(jptJetsToken_, jptJets);
472  if (isMiniAODJet) mEvent.getByToken(patJetsToken_, patJets);
473 
474  if (isCaloJet && !caloJets.isValid()) return;
475  if (isPFJet && !pfJets.isValid()) return;
476 // if (isJPTJet && !jptJets.isValid()) return;
477  if (isMiniAODJet && !patJets.isValid()) return;
478 
479 
480  if (isCaloJet)
481  {
482  for (unsigned ijet=0; ijet<caloJets->size(); ijet++)
483  recoJets.push_back((*caloJets)[ijet]);
484  }
485 
486 /* if (isJPTJet)
487  {
488  for (unsigned ijet=0; ijet<jptJets->size(); ijet++)
489  recoJets.push_back((*jptJets)[ijet]);
490  }*/
491 
492  if (isPFJet) {
493  for (unsigned ijet=0; ijet<pfJets->size(); ijet++)
494  recoJets.push_back((*pfJets)[ijet]);
495  }
496  if (isMiniAODJet) {
497  for (unsigned ijet=0; ijet<patJets->size(); ijet++)
498  recoJets.push_back((*patJets)[ijet]);
499  }
500 
501  int nJet = 0;
502  int nJet_E_20_40 = 0;
503  int nJet_B_20_40 = 0;
504  int nJet_E_40 = 0;
505  int nJet_B_40 = 0;
506  int nJet_40 = 0;
507 
508  int index_first_jet=-1;
509  double pt_first=-1;
510 
511  int index_second_jet=-1;
512  double pt_second=-1;
513 
514  for (unsigned ijet=0; ijet<recoJets.size(); ijet++) {
515  bool pass_lowjet=false;
516  bool pass_mediumjet = false;
517  if(!isMiniAODJet){
518  if ( (recoJets[ijet].pt() > 20.) && (recoJets[ijet].pt() < mRecoJetPtThreshold)) {
519  pass_lowjet=true;
520  }
521  }
522  if(isMiniAODJet){
523  if((recoJets[ijet].pt()*(*patJets)[ijet].jecFactor("Uncorrected"))>20. && ((recoJets[ijet].pt()*(*patJets)[ijet].jecFactor("Uncorrected")) < mRecoJetPtThreshold)){
524  pass_lowjet=true;
525  }
526  }
527  if (pass_lowjet) {
528  if (fabs(recoJets[ijet].eta()) > 1.5)
529  nJet_E_20_40++;
530  else
531  nJet_B_20_40++;
532  }
533  if(!isMiniAODJet){
534  if (recoJets[ijet].pt() > mRecoJetPtThreshold) {
535  pass_mediumjet = true;
536  }
537  }
538  if(isMiniAODJet){
539  if((recoJets[ijet].pt()*(*patJets)[ijet].jecFactor("Uncorrected")) > mRecoJetPtThreshold){
540  pass_mediumjet=true;
541  }
542  }
543  if (pass_mediumjet) {
544  if(isMiniAODJet){
545  if( (recoJets[ijet].pt()*(*patJets)[ijet].jecFactor("Uncorrected"))>pt_first){
546  pt_second=pt_first;
547  pt_first=recoJets[ijet].pt()*(*patJets)[ijet].jecFactor("Uncorrected");
548  index_second_jet=index_first_jet;
549  index_first_jet=ijet;
550  }else if( (recoJets[ijet].pt()*(*patJets)[ijet].jecFactor("Uncorrected"))>pt_second){
551  index_second_jet=ijet;
552  pt_second=recoJets[ijet].pt()*(*patJets)[ijet].jecFactor("Uncorrected");
553  }
554  }
555  //counting forward and barrel jets
556  if (fabs(recoJets[ijet].eta()) > 1.5)
557  nJet_E_40++;
558  else
559  nJet_B_40++;
560  nJet_40++;
561 
562  if (mEta) mEta->Fill(recoJets[ijet].eta());
563 
564  if (mJetArea) mJetArea ->Fill(recoJets[ijet].jetArea());
565  if (mPhi) mPhi ->Fill(recoJets[ijet].phi());
566  if(!isMiniAODJet){
567  if (mEnergy) mEnergy ->Fill(recoJets[ijet].energy());
568  if (mP) mP ->Fill(recoJets[ijet].p());
569  if (mPt) mPt ->Fill(recoJets[ijet].pt());
570  if (mMass) mMass ->Fill(recoJets[ijet].mass());
571  }else{
572  if (mEnergy) mEnergy ->Fill(recoJets[ijet].energy()*(*patJets)[ijet].jecFactor("Uncorrected"));
573  if (mP) mP ->Fill(recoJets[ijet].p()*(*patJets)[ijet].jecFactor("Uncorrected"));
574  if (mPt) mPt ->Fill(recoJets[ijet].pt()*(*patJets)[ijet].jecFactor("Uncorrected"));
575  if (mMass) mMass ->Fill(recoJets[ijet].mass()*(*patJets)[ijet].jecFactor("Uncorrected"));
576  }
577  if (mConstituents) mConstituents->Fill(recoJets[ijet].nConstituents());
578  if(!isMiniAODJet){
579  if (ijet == 0) {
580  if (mEtaFirst) mEtaFirst->Fill(recoJets[ijet].eta());
581  if (mPhiFirst) mPhiFirst->Fill(recoJets[ijet].phi());
582  if (mPtFirst) mPtFirst ->Fill(recoJets[ijet].pt());
583  }
584 
585  if (ijet == 0) {nJet++; p4tmp[0] = recoJets[ijet].p4();}
586  if (ijet == 1) {nJet++; p4tmp[1] = recoJets[ijet].p4();}
587  }
588  // if (isPFJet || isCaloJet) {
589  // if (mHadEnergyInHF) mHadEnergyInHF ->Fill((*pfJets)[ijet].HFHadronEnergy());
590  // if (mEmEnergyInHF) mEmEnergyInHF ->Fill((*pfJets)[ijet].HFEMEnergy());
591  // if (mChargedEmEnergy) mChargedEmEnergy ->Fill((*pfJets)[ijet].chargedEmEnergy());
592  // if (mChargedHadronEnergy) mChargedHadronEnergy->Fill((*pfJets)[ijet].chargedHadronEnergy());
593  // if (mNeutralEmEnergy) mNeutralEmEnergy ->Fill((*pfJets)[ijet].neutralEmEnergy());
594  // if (mNeutralHadronEnergy) mNeutralHadronEnergy->Fill((*pfJets)[ijet].neutralHadronEnergy());
595  // }
596 
597 
598  // ---- Calo Jet specific information ----
599  if (isCaloJet) {
600  maxEInEmTowers ->Fill((*caloJets)[ijet].maxEInEmTowers());
601  maxEInHadTowers ->Fill((*caloJets)[ijet].maxEInHadTowers());
602  energyFractionHadronic ->Fill((*caloJets)[ijet].energyFractionHadronic());
603  emEnergyFraction ->Fill((*caloJets)[ijet].emEnergyFraction());
604  hadEnergyInHB ->Fill((*caloJets)[ijet].hadEnergyInHB());
605  hadEnergyInHO ->Fill((*caloJets)[ijet].hadEnergyInHO());
606  hadEnergyInHE ->Fill((*caloJets)[ijet].hadEnergyInHE());
607  hadEnergyInHF ->Fill((*caloJets)[ijet].hadEnergyInHF());
608  emEnergyInEB ->Fill((*caloJets)[ijet].emEnergyInEB());
609  emEnergyInEE ->Fill((*caloJets)[ijet].emEnergyInEE());
610  emEnergyInHF ->Fill((*caloJets)[ijet].emEnergyInHF());
611  towersArea ->Fill((*caloJets)[ijet].towersArea());
612  n90 ->Fill((*caloJets)[ijet].n90());
613  n60 ->Fill((*caloJets)[ijet].n60());
614  }
615  // ---- PF Jet specific information ----
616  if (isPFJet) {
617  muonMultiplicity ->Fill((*pfJets)[ijet].muonMultiplicity());
618  chargedMultiplicity ->Fill((*pfJets)[ijet].chargedMultiplicity());
619  chargedEmEnergy ->Fill((*pfJets)[ijet].chargedEmEnergy());
620  neutralEmEnergy ->Fill((*pfJets)[ijet].neutralEmEnergy());
621  chargedHadronEnergy ->Fill((*pfJets)[ijet].chargedHadronEnergy());
622  neutralHadronEnergy ->Fill((*pfJets)[ijet].neutralHadronEnergy());
627  photonEnergy ->Fill((*pfJets)[ijet].photonEnergy());
628  photonEnergyFraction ->Fill((*pfJets)[ijet].photonEnergyFraction());
629  electronEnergy ->Fill((*pfJets)[ijet].electronEnergy());
631  muonEnergy ->Fill((*pfJets)[ijet].muonEnergy());
632  muonEnergyFraction ->Fill((*pfJets)[ijet].muonEnergyFraction());
633  HFHadronEnergy ->Fill((*pfJets)[ijet].HFHadronEnergy());
635  HFEMEnergy ->Fill((*pfJets)[ijet].HFEMEnergy());
636  HFEMEnergyFraction ->Fill((*pfJets)[ijet].HFEMEnergyFraction());
639  photonMultiplicity ->Fill((*pfJets)[ijet].photonMultiplicity());
640  electronMultiplicity ->Fill((*pfJets)[ijet].electronMultiplicity());
641  HFHadronMultiplicity ->Fill((*pfJets)[ijet].HFHadronMultiplicity());
642  HFEMMultiplicity ->Fill((*pfJets)[ijet].HFEMMultiplicity());
643  chargedMuEnergy ->Fill((*pfJets)[ijet].chargedMuEnergy());
645  neutralMultiplicity ->Fill((*pfJets)[ijet].neutralMultiplicity());
646  HOEnergy ->Fill((*pfJets)[ijet].hoEnergy());
647  HOEnergyFraction ->Fill((*pfJets)[ijet].hoEnergyFraction());
648  }
649  if (isMiniAODJet && (*patJets)[ijet].isPFJet()) {
650  muonMultiplicity ->Fill((*patJets)[ijet].muonMultiplicity());
651  chargedMultiplicity ->Fill((*patJets)[ijet].chargedMultiplicity());
652  chargedEmEnergy ->Fill((*patJets)[ijet].chargedEmEnergy());
653  neutralEmEnergy ->Fill((*patJets)[ijet].neutralEmEnergy());
654  chargedHadronEnergy ->Fill((*patJets)[ijet].chargedHadronEnergy());
655  neutralHadronEnergy ->Fill((*patJets)[ijet].neutralHadronEnergy());
660  photonEnergy ->Fill((*patJets)[ijet].photonEnergy());
661  photonEnergyFraction ->Fill((*patJets)[ijet].photonEnergyFraction());
662  electronEnergy ->Fill((*patJets)[ijet].electronEnergy());
663  electronEnergyFraction ->Fill((*patJets)[ijet].electronEnergyFraction());
664  muonEnergy ->Fill((*patJets)[ijet].muonEnergy());
665  muonEnergyFraction ->Fill((*patJets)[ijet].muonEnergyFraction());
666  HFHadronEnergy ->Fill((*patJets)[ijet].HFHadronEnergy());
667  HFHadronEnergyFraction ->Fill((*patJets)[ijet].HFHadronEnergyFraction());
668  HFEMEnergy ->Fill((*patJets)[ijet].HFEMEnergy());
669  HFEMEnergyFraction ->Fill((*patJets)[ijet].HFEMEnergyFraction());
672  photonMultiplicity ->Fill((*patJets)[ijet].photonMultiplicity());
673  electronMultiplicity ->Fill((*patJets)[ijet].electronMultiplicity());
674  HFHadronMultiplicity ->Fill((*patJets)[ijet].HFHadronMultiplicity());
675  HFEMMultiplicity ->Fill((*patJets)[ijet].HFEMMultiplicity());
676  chargedMuEnergy ->Fill((*patJets)[ijet].chargedMuEnergy());
678  neutralMultiplicity ->Fill((*patJets)[ijet].neutralMultiplicity());
679  HOEnergy ->Fill((*patJets)[ijet].hoEnergy());
680  HOEnergyFraction ->Fill((*patJets)[ijet].hoEnergyFraction());
681  }
682  }//fill quantities for medium jets
683  }
684 
685  if (mNJetsEta_B_20_40) mNJetsEta_B_20_40->Fill(nJet_B_20_40);
686  if (mNJetsEta_E_20_40) mNJetsEta_E_20_40->Fill(nJet_E_20_40);
687  if (mNJetsEta_B_40) mNJetsEta_B_40->Fill(nJet_B_40);
688  if (mNJetsEta_E_40) mNJetsEta_E_40->Fill(nJet_E_40);
689  if (mNJets_40) mNJets_40->Fill(nJet_40);
690  if(!isMiniAODJet){
691  if (nJet >= 2)
692  {
693  if (mMjj) mMjj->Fill((p4tmp[0]+p4tmp[1]).mass());
694  }
695  }else{
696  if(index_first_jet>-1){
697  if (mEtaFirst) mEtaFirst->Fill(recoJets[index_first_jet].eta());
698  if (mPhiFirst) mPhiFirst->Fill(recoJets[index_first_jet].phi());
699  if (mPtFirst) mPtFirst ->Fill(recoJets[index_first_jet].pt()*(*patJets)[index_first_jet].jecFactor("Uncorrected"));
700  nJet++; p4tmp[0] = recoJets[index_first_jet].p4()*(*patJets)[index_first_jet].jecFactor("Uncorrected");
701  }
702  if(index_second_jet>-1){
703  nJet++; p4tmp[1] = recoJets[index_second_jet].p4()*(*patJets)[index_second_jet].jecFactor("Uncorrected");
704  }
705  if (nJet >= 2)
706  {
707  if (mMjj) mMjj->Fill((p4tmp[0]+p4tmp[1]).mass());
708  }
709  }
710 
711  // Count jets above pt cut
712  //----------------------------------------------------------------------------
713  for (int istep=0; istep<100; ++istep)
714  {
715  int njets1 = 0;
716  int njets2 = 0;
717 
718  float ptStep1 = (istep * ( 200. / 100.));
719  float ptStep2 = (istep * (4000. / 100.));
720 
721  for (unsigned ijet=0; ijet<recoJets.size(); ijet++) {
722  if(!isMiniAODJet){
723  if (recoJets[ijet].pt() > ptStep1) njets1++;
724  if (recoJets[ijet].pt() > ptStep2) njets2++;
725  }else{
726  if ((recoJets[ijet].pt()*(*patJets)[ijet].jecFactor("Uncorrected")) > ptStep1) njets1++;
727  if ((recoJets[ijet].pt()*(*patJets)[ijet].jecFactor("Uncorrected")) > ptStep2) njets2++;
728  }
729  mNJets1->Fill(ptStep1, njets1);
730  mNJets2->Fill(ptStep2, njets2);
731  }
732  }
733 
734 
735  // Corrected jets
736  //----------------------------------------------------------------------------
737  double scale = -999;
739  bool pass_correction_flag =false;
740  if(!isMiniAODJet && !mJetCorrector.label().empty()){
741  mEvent.getByToken(jetCorrectorToken_, jetCorr);
742  if (jetCorr.isValid()){
743  pass_correction_flag=true;
744  }
745  }
746  if(isMiniAODJet){
747  pass_correction_flag =true;
748  }
749  for (unsigned ijet=0; ijet<recoJets.size(); ijet++) {
750  Jet correctedJet = recoJets[ijet];
751  if(pass_correction_flag){
752  if (isCaloJet) scale = jetCorr->correction((*caloJets)[ijet]);
753  if (isPFJet) scale = jetCorr->correction((*pfJets)[ijet]);
754  //if (isJPTJet) scale = jetCorr->correction((*jptJets)[ijet]);
755  if(!isMiniAODJet){
756  correctedJet.scaleEnergy(scale);
757  }
758 
759  if (correctedJet.pt() < 20) continue;
760 
761  mCorrJetEta->Fill(correctedJet.eta());
762  mCorrJetPhi->Fill(correctedJet.phi());
763  mCorrJetPt ->Fill(correctedJet.pt());
764  if (correctedJet.pt() >= 40) {
765  mCorrJetEta_Pt40->Fill(correctedJet.eta());
766  mCorrJetPhi_Pt40->Fill(correctedJet.phi());
767  }
768 
769  double ijetEta = recoJets[ijet].eta();
770  double ijetPt = recoJets[ijet].pt();
771  if(isMiniAODJet){
772  ijetPt=recoJets[ijet].pt()*(*patJets)[ijet].jecFactor("Uncorrected");
773  }
774  double ratio = correctedJet.pt() / ijetPt;
775  if(isMiniAODJet){
776  ratio =1./(*patJets)[ijet].jecFactor("Uncorrected");
777  }
778 
779  if (fabs(ijetEta) < 1.5) mPtCorrOverReco_Pt_B->Fill(log10(ijetPt), ratio);
780  else if (fabs(ijetEta) < 3.0) mPtCorrOverReco_Pt_E->Fill(log10(ijetPt), ratio);
781  else if (fabs(ijetEta) < 6.0) mPtCorrOverReco_Pt_F->Fill(log10(ijetPt), ratio);
782 
783  if (ijetPt < 40) mPtCorrOverReco_Eta_20_40 ->Fill(ijetEta, ratio);
784  else if (ijetPt < 200) mPtCorrOverReco_Eta_40_200 ->Fill(ijetEta, ratio);
785  else if (ijetPt < 600) mPtCorrOverReco_Eta_200_600 ->Fill(ijetEta, ratio);
786  else if (ijetPt < 1500) mPtCorrOverReco_Eta_600_1500 ->Fill(ijetEta, ratio);
787  else if (ijetPt < 3500) mPtCorrOverReco_Eta_1500_3500->Fill(ijetEta, ratio);
788  }
789  }
790 
791  //----------------------------------------------------------------------------
792  //
793  // Generation
794  //
795  //----------------------------------------------------------------------------
796  if (!mEvent.isRealData())
797  {
798  // Get ptHat
799  //------------------------------------------------------------------------
801  mEvent.getByToken(evtToken_, myGenEvt);
802 
803  if (myGenEvt.isValid()) {
804  if(myGenEvt->hasBinningValues()){
805  double ptHat = myGenEvt->binningValues()[0];
806  if (mPtHat) mPtHat->Fill(ptHat);
807  }
808  }
809  // Gen jets
810  //------------------------------------------------------------------------
812  mEvent.getByToken(genJetsToken_, genJets);
813 
814  if (!genJets.isValid()) return;
815 
816  for (GenJetCollection::const_iterator gjet=genJets->begin(); gjet!=genJets->end(); gjet++) {
817  //for MiniAOD we have here intrinsic thresholds, introduce also threshold for RECO
818  if(gjet->pt() > mMatchGenPtThreshold){
819  if (mGenEta) mGenEta->Fill(gjet->eta());
820  if (mGenPhi) mGenPhi->Fill(gjet->phi());
821  if (mGenPt) mGenPt ->Fill(gjet->pt());
822  if (gjet == genJets->begin()) {
823  if (mGenEtaFirst) mGenEtaFirst->Fill(gjet->eta());
824  if (mGenPhiFirst) mGenPhiFirst->Fill(gjet->phi());
825  }
826  }
827  }
828 
829  if (!(mInputGenCollection.label().empty())) {
830  for (GenJetCollection::const_iterator gjet=genJets->begin(); gjet!=genJets->end(); gjet++) {
831  if (fabs(gjet->eta()) > 6.) continue; // Out of the detector
832  if (gjet->pt() < mMatchGenPtThreshold) continue;
833  if (recoJets.size() <= 0) continue;
834  // pt response
835  //------------------------------------------------------------
836  int iMatch = -1;
837  double CorrdeltaRBest = 999;
838  double CorrJetPtBest = 0;
839  for (unsigned ijet=0; ijet<recoJets.size(); ++ijet) {
840  Jet correctedJet = recoJets[ijet];
841  if(pass_correction_flag && !isMiniAODJet){
842  if (isCaloJet) scale = jetCorr->correction((*caloJets)[ijet]);
843  if (isPFJet) scale = jetCorr->correction((*pfJets)[ijet]);
844  correctedJet.scaleEnergy(scale);
845  }
846  double CorrJetPt = correctedJet.pt();
847  if (CorrJetPt > 10) {
848  double CorrdR = deltaR(gjet->eta(), gjet->phi(), correctedJet.eta(), correctedJet.phi());
849  if (CorrdR < CorrdeltaRBest) {
850  CorrdeltaRBest = CorrdR;
851  CorrJetPtBest = CorrJetPt;
852  iMatch = ijet;
853  }
854  }
855  }
856  if (iMatch<0) continue;
857  if(!isMiniAODJet){
858  fillMatchHists(gjet->eta(), gjet->phi(), gjet->pt(), recoJets[iMatch].eta(), recoJets[iMatch].phi(), recoJets[iMatch].pt());
859  }else{
860  fillMatchHists(gjet->eta(), gjet->phi(), gjet->pt(), (*patJets)[iMatch].eta(), (*patJets)[iMatch].phi(),(*patJets)[iMatch].pt()*(*patJets)[iMatch].jecFactor("Uncorrected"));
861  }
862  if (pass_correction_flag) {//fill only for corrected jets
863  if (CorrdeltaRBest < mRThreshold) {
864  double response = CorrJetPtBest / gjet->pt();
865 
866  if (fabs(gjet->eta()) < 1.5) mPtCorrOverGen_GenPt_B->Fill(log10(gjet->pt()), response);
867  else if (fabs(gjet->eta()) < 3.0) mPtCorrOverGen_GenPt_E->Fill(log10(gjet->pt()), response);
868  else if (fabs(gjet->eta()) < 6.0) mPtCorrOverGen_GenPt_F->Fill(log10(gjet->pt()), response);
869 
870  if (gjet->pt() > 20) {
871  if (gjet->pt() < 40) mPtCorrOverGen_GenEta_20_40 ->Fill(gjet->eta(), response);
872  else if (gjet->pt() < 200) mPtCorrOverGen_GenEta_40_200 ->Fill(gjet->eta(), response);
873  else if (gjet->pt() < 600) mPtCorrOverGen_GenEta_200_600 ->Fill(gjet->eta(), response);
874  else if (gjet->pt() < 1500) mPtCorrOverGen_GenEta_600_1500 ->Fill(gjet->eta(), response);
875  else if (gjet->pt() < 3500) mPtCorrOverGen_GenEta_1500_3500->Fill(gjet->eta(), response);
876  }
877  }
878  }
879  }
880  }
881  }
882 }
883 
884 
885 //------------------------------------------------------------------------------
886 // fillMatchHists
887 //------------------------------------------------------------------------------
888 void JetTester::fillMatchHists(const double GenEta,
889  const double GenPhi,
890  const double GenPt,
891  const double RecoEta,
892  const double RecoPhi,
893  const double RecoPt)
894 {
895  if (GenPt > mMatchGenPtThreshold) {
896  mDeltaEta->Fill(GenEta - RecoEta);
897  mDeltaPhi->Fill(GenPhi - RecoPhi);
898  mDeltaPt ->Fill((GenPt - RecoPt) / GenPt);
899  }
900 
901  if (fabs(GenEta) < 1.5)
902  {
903  mPtRecoOverGen_GenPt_B ->Fill(log10(GenPt), RecoPt / GenPt);
904  mPtRecoOverGen_GenPhi_B->Fill(GenPhi, RecoPt / GenPt);
905 
906  if (GenPt > 20 && GenPt < 40) mPtRecoOverGen_B_20_40 ->Fill(RecoPt / GenPt);
907  else if (GenPt < 200) mPtRecoOverGen_B_40_200 ->Fill(RecoPt / GenPt);
908  else if (GenPt < 600) mPtRecoOverGen_B_200_600 ->Fill(RecoPt / GenPt);
909  else if (GenPt < 1500) mPtRecoOverGen_B_600_1500 ->Fill(RecoPt / GenPt);
910  else if (GenPt < 3500) mPtRecoOverGen_B_1500_3500->Fill(RecoPt / GenPt);
911  }
912  else if (fabs(GenEta) < 3.0)
913  {
914  mPtRecoOverGen_GenPt_E ->Fill(log10(GenPt), RecoPt / GenPt);
915  mPtRecoOverGen_GenPhi_E->Fill(GenPhi, RecoPt / GenPt);
916 
917  if (GenPt > 20 && GenPt < 40) mPtRecoOverGen_E_20_40 ->Fill(RecoPt / GenPt);
918  else if (GenPt < 200) mPtRecoOverGen_E_40_200 ->Fill(RecoPt / GenPt);
919  else if (GenPt < 600) mPtRecoOverGen_E_200_600 ->Fill(RecoPt / GenPt);
920  else if (GenPt < 1500) mPtRecoOverGen_E_600_1500 ->Fill(RecoPt / GenPt);
921  else if (GenPt < 3500) mPtRecoOverGen_E_1500_3500->Fill(RecoPt / GenPt);
922  }
923  else if (fabs(GenEta) < 6.0)
924  {
925  mPtRecoOverGen_GenPt_F ->Fill (log10(GenPt), RecoPt / GenPt);
926  mPtRecoOverGen_GenPhi_F->Fill (GenPhi, RecoPt / GenPt);
927 
928  if (GenPt > 20 && GenPt < 40) mPtRecoOverGen_F_20_40 ->Fill(RecoPt / GenPt);
929  else if (GenPt < 200) mPtRecoOverGen_F_40_200 ->Fill(RecoPt / GenPt);
930  else if (GenPt < 600) mPtRecoOverGen_F_200_600 ->Fill(RecoPt / GenPt);
931  else if (GenPt < 1500) mPtRecoOverGen_F_600_1500 ->Fill(RecoPt / GenPt);
932  else if (GenPt < 3500) mPtRecoOverGen_F_1500_3500->Fill(RecoPt / GenPt);
933  }
934 
935  if (GenPt > 20 && GenPt < 40) mPtRecoOverGen_GenEta_20_40 ->Fill(GenEta, RecoPt / GenPt);
936  else if (GenPt < 200) mPtRecoOverGen_GenEta_40_200 ->Fill(GenEta, RecoPt / GenPt);
937  else if (GenPt < 600) mPtRecoOverGen_GenEta_200_600 ->Fill(GenEta, RecoPt / GenPt);
938  else if (GenPt < 1500) mPtRecoOverGen_GenEta_600_1500 ->Fill(GenEta, RecoPt / GenPt);
939  else if (GenPt < 3500) mPtRecoOverGen_GenEta_1500_3500->Fill(GenEta, RecoPt / GenPt);
940 }
T getParameter(std::string const &) const
MonitorElement * mNJetsEta_B_40
Definition: JetTester.h:156
MonitorElement * mPtRecoOverGen_E_20_40
Definition: JetTester.h:121
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< std::vector< reco::Vertex > > pvToken_
Definition: JetTester.h:63
MonitorElement * mPtCorrOverGen_GenEta_40_200
Definition: JetTester.h:104
MonitorElement * mPtCorrOverReco_Pt_E
Definition: JetTester.h:93
MonitorElement * hadEnergyInHE
Definition: JetTester.h:169
MonitorElement * mNvtx
Definition: JetTester.h:72
MonitorElement * HFHadronEnergyFraction
Definition: JetTester.h:198
MonitorElement * mPtRecoOverGen_B_20_40
Definition: JetTester.h:120
MonitorElement * mPtCorrOverGen_GenPt_F
Definition: JetTester.h:102
MonitorElement * mPtRecoOverGen_F_40_200
Definition: JetTester.h:125
edm::EDGetTokenT< reco::GenJetCollection > genJetsToken_
Definition: JetTester.h:66
bool isMiniAODJet
Definition: JetTester.h:219
MonitorElement * HOEnergy
Definition: JetTester.h:210
virtual void scaleEnergy(double fScale)
scale energy of the jet
MonitorElement * neutralHadronEnergy
Definition: JetTester.h:184
MonitorElement * electronEnergyFraction
Definition: JetTester.h:194
MonitorElement * mPtRecoOverGen_B_200_600
Definition: JetTester.h:126
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: JetTester.cc:242
MonitorElement * HFEMEnergyFraction
Definition: JetTester.h:200
bool isPFJet
Definition: JetTester.h:218
MonitorElement * mPtRecoOverGen_GenPt_F
Definition: JetTester.h:139
MonitorElement * mMjj
Definition: JetTester.h:153
edm::InputTag mInputGenCollection
Definition: JetTester.h:58
MonitorElement * mPtFirst
Definition: JetTester.h:152
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
edm::EDGetTokenT< reco::CaloJetCollection > caloJetsToken_
Definition: JetTester.h:64
MonitorElement * photonEnergyFraction
Definition: JetTester.h:192
edm::EDGetTokenT< pat::JetCollection > patJetsToken_
Definition: JetTester.h:68
MonitorElement * neutralMultiplicity
Definition: JetTester.h:209
MonitorElement * mDeltaPhi
Definition: JetTester.h:117
Base class for all types of Jets.
Definition: Jet.h:20
bool isCaloJet
Definition: JetTester.h:217
edm::InputTag mJetCorrector
Definition: JetTester.h:59
Definition: DDAxes.h:10
MonitorElement * mPtRecoOverGen_GenPhi_E
Definition: JetTester.h:141
MonitorElement * mPtRecoOverGen_GenEta_20_40
Definition: JetTester.h:143
MonitorElement * hadEnergyInHB
Definition: JetTester.h:167
MonitorElement * mPtCorrOverReco_Eta_40_200
Definition: JetTester.h:96
MonitorElement * photonMultiplicity
Definition: JetTester.h:203
MonitorElement * mCorrJetPhi
Definition: JetTester.h:88
MonitorElement * energyFractionHadronic
Definition: JetTester.h:165
double mMatchGenPtThreshold
Definition: JetTester.h:215
MonitorElement * mPtRecoOverGen_E_40_200
Definition: JetTester.h:124
edm::EDGetTokenT< reco::JetCorrector > jetCorrectorToken_
Definition: JetTester.h:69
MonitorElement * mNJets2
Definition: JetTester.h:160
MonitorElement * mPtCorrOverReco_Eta_200_600
Definition: JetTester.h:97
MonitorElement * muonEnergyFraction
Definition: JetTester.h:196
MonitorElement * n90
Definition: JetTester.h:175
MonitorElement * mPtRecoOverGen_GenPhi_B
Definition: JetTester.h:140
T eta() const
MonitorElement * mEtaFirst
Definition: JetTester.h:150
bool isRealData() const
Definition: EventBase.h:64
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
float float float z
MonitorElement * emEnergyFraction
Definition: JetTester.h:166
MonitorElement * mCorrJetEta
Definition: JetTester.h:87
MonitorElement * photonEnergy
Definition: JetTester.h:191
MonitorElement * towersArea
Definition: JetTester.h:174
void Fill(long long x)
MonitorElement * hadEnergyInHF
Definition: JetTester.h:170
MonitorElement * HFHadronMultiplicity
Definition: JetTester.h:205
MonitorElement * mGenPt
Definition: JetTester.h:112
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
MonitorElement * muonEnergy
Definition: JetTester.h:195
MonitorElement * electronMultiplicity
Definition: JetTester.h:204
MonitorElement * mPtRecoOverGen_B_600_1500
Definition: JetTester.h:129
MonitorElement * mEnergy
Definition: JetTester.h:79
MonitorElement * mPtRecoOverGen_GenPt_E
Definition: JetTester.h:138
MonitorElement * mNJetsEta_E_40
Definition: JetTester.h:157
MonitorElement * mEta
Definition: JetTester.h:75
MonitorElement * mGenEtaFirst
Definition: JetTester.h:113
MonitorElement * mNJetsEta_B_20_40
Definition: JetTester.h:154
MonitorElement * chargedMuEnergy
Definition: JetTester.h:207
MonitorElement * mPtRecoOverGen_F_1500_3500
Definition: JetTester.h:134
MonitorElement * mDeltaEta
Definition: JetTester.h:116
MonitorElement * mNJets_40
Definition: JetTester.h:158
MonitorElement * HFHadronEnergy
Definition: JetTester.h:197
MonitorElement * mNJetsEta_E_20_40
Definition: JetTester.h:155
MonitorElement * mDeltaPt
Definition: JetTester.h:118
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * mPtRecoOverGen_B_40_200
Definition: JetTester.h:123
MonitorElement * mPtRecoOverGen_B_1500_3500
Definition: JetTester.h:132
MonitorElement * mPtRecoOverGen_F_200_600
Definition: JetTester.h:128
MonitorElement * mPhiFirst
Definition: JetTester.h:151
MonitorElement * mP
Definition: JetTester.h:78
void fillMatchHists(const double GenEta, const double GenPhi, const double GenPt, const double RecoEta, const double RecoPhi, const double RecoPt)
Definition: JetTester.cc:888
edm::EDGetTokenT< GenEventInfoProduct > evtToken_
Definition: JetTester.h:67
MonitorElement * mPtCorrOverGen_GenPt_B
Definition: JetTester.h:100
MonitorElement * mPtCorrOverReco_Eta_600_1500
Definition: JetTester.h:98
MonitorElement * n60
Definition: JetTester.h:176
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
MonitorElement * HOEnergyFraction
Definition: JetTester.h:211
MonitorElement * mGenEta
Definition: JetTester.h:110
MonitorElement * hadEnergyInHO
Definition: JetTester.h:168
MonitorElement * mPhi
Definition: JetTester.h:76
MonitorElement * mPtCorrOverGen_GenEta_200_600
Definition: JetTester.h:105
MonitorElement * mPt
Definition: JetTester.h:77
edm::InputTag mInputCollection
Definition: JetTester.h:57
MonitorElement * emEnergyInHF
Definition: JetTester.h:173
MonitorElement * mPtRecoOverGen_E_200_600
Definition: JetTester.h:127
JetTester(const edm::ParameterSet &)
Definition: JetTester.cc:12
MonitorElement * mPtRecoOverGen_GenPhi_F
Definition: JetTester.h:142
MonitorElement * chargedHadronEnergyFraction
Definition: JetTester.h:185
MonitorElement * mPtRecoOverGen_E_600_1500
Definition: JetTester.h:130
bool isValid() const
Definition: HandleBase.h:75
MonitorElement * mPtHat
Definition: JetTester.h:115
MonitorElement * chargedHadronEnergy
Definition: JetTester.h:183
MonitorElement * mPtCorrOverReco_Pt_B
Definition: JetTester.h:92
MonitorElement * mPtRecoOverGen_GenPt_B
Definition: JetTester.h:137
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
MonitorElement * mPtCorrOverReco_Eta_1500_3500
Definition: JetTester.h:99
MonitorElement * mJetArea
Definition: JetTester.h:82
MonitorElement * mMass
Definition: JetTester.h:80
MonitorElement * HFEMMultiplicity
Definition: JetTester.h:206
MonitorElement * chargedEmEnergy
Definition: JetTester.h:181
MonitorElement * mPtRecoOverGen_GenEta_40_200
Definition: JetTester.h:144
MonitorElement * mPtRecoOverGen_E_1500_3500
Definition: JetTester.h:133
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * mPtRecoOverGen_F_600_1500
Definition: JetTester.h:131
MonitorElement * chargedMuEnergyFraction
Definition: JetTester.h:208
MonitorElement * electronEnergy
Definition: JetTester.h:193
MonitorElement * emEnergyInEE
Definition: JetTester.h:172
tuple recoJets
Definition: RecoJets_cff.py:56
MonitorElement * mPtCorrOverGen_GenEta_20_40
Definition: JetTester.h:103
double mRecoJetPtThreshold
Definition: JetTester.h:214
MonitorElement * mPtCorrOverGen_GenEta_1500_3500
Definition: JetTester.h:107
MonitorElement * mGenPhi
Definition: JetTester.h:111
MonitorElement * maxEInHadTowers
Definition: JetTester.h:164
MonitorElement * mCorrJetEta_Pt40
Definition: JetTester.h:89
std::string const & label() const
Definition: InputTag.h:42
MonitorElement * emEnergyInEB
Definition: JetTester.h:171
edm::EDGetTokenT< reco::PFJetCollection > pfJetsToken_
Definition: JetTester.h:65
MonitorElement * mConstituents
Definition: JetTester.h:81
MonitorElement * maxEInEmTowers
Definition: JetTester.h:163
MonitorElement * mPtRecoOverGen_F_20_40
Definition: JetTester.h:122
MonitorElement * mGenPhiFirst
Definition: JetTester.h:114
MonitorElement * mCorrJetPt
Definition: JetTester.h:86
MonitorElement * mPtCorrOverGen_GenPt_E
Definition: JetTester.h:101
MonitorElement * mPtRecoOverGen_GenEta_600_1500
Definition: JetTester.h:146
static int position[264][3]
Definition: ReadPGInfo.cc:509
MonitorElement * mPtRecoOverGen_GenEta_200_600
Definition: JetTester.h:145
MonitorElement * mPtCorrOverReco_Eta_20_40
Definition: JetTester.h:95
MonitorElement * chargedEmEnergyFraction
Definition: JetTester.h:187
MonitorElement * mPtCorrOverReco_Pt_F
Definition: JetTester.h:94
MonitorElement * muonMultiplicity
Definition: JetTester.h:179
MonitorElement * neutralHadronEnergyFraction
Definition: JetTester.h:186
double mRThreshold
Definition: JetTester.h:216
MonitorElement * neutralEmEnergy
Definition: JetTester.h:182
MonitorElement * chargedHadronMultiplicity
Definition: JetTester.h:201
std::string JetType
Definition: JetTester.h:60
MonitorElement * mPtRecoOverGen_GenEta_1500_3500
Definition: JetTester.h:147
MonitorElement * mNJets1
Definition: JetTester.h:159
MonitorElement * mPtCorrOverGen_GenEta_600_1500
Definition: JetTester.h:106
MonitorElement * chargedMultiplicity
Definition: JetTester.h:180
tuple pfJets
Definition: pfJets_cff.py:8
virtual double phi() const
momentum azimuthal angle
virtual void analyze(const edm::Event &, const edm::EventSetup &)
Definition: JetTester.cc:422
MonitorElement * HFEMEnergy
Definition: JetTester.h:199
MonitorElement * mCorrJetPhi_Pt40
Definition: JetTester.h:90
MonitorElement * neutralHadronMultiplicity
Definition: JetTester.h:202
Definition: Run.h:41
MonitorElement * neutralEmEnergyFraction
Definition: JetTester.h:188
Definition: DDAxes.h:10