CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JPTJetTester.cc
Go to the documentation of this file.
1 
2 // Producer for validation histograms for CaloJet objects
3 // F. Ratnikov, Sept. 7, 2006
4 // Modified by J F Novak July 10, 2008
5 // $Id: JPTJetTester.cc,v 1.25 2013/03/19 21:24:16 kovitang Exp $
6 
12 
14 
17 
22 
25 
27 
29 
30 #include "JPTJetTester.h"
31 
32 #include <cmath>
33 
35 
36 using namespace edm;
37 using namespace reco;
38 using namespace std;
39 
40 namespace {
41  bool is_B (const reco::Jet& fJet) {return fabs (fJet.eta()) < 1.3;}
42  bool is_E (const reco::Jet& fJet) {return fabs (fJet.eta()) >= 1.3 && fabs (fJet.eta()) < 3.;}
43  bool is_F (const reco::Jet& fJet) {return fabs (fJet.eta()) >= 3.;}
44 }
45 
47  : mInputCollection (iConfig.getParameter<edm::InputTag>( "src" )),
48  mInputGenCollection (iConfig.getParameter<edm::InputTag>( "srcGen" )),
49  mOutputFile (iConfig.getUntrackedParameter<std::string>("outputFile", "")),
50  mMatchGenPtThreshold (iConfig.getParameter<double>("genPtThreshold")),
51  mGenEnergyFractionThreshold (iConfig.getParameter<double>("genEnergyFractionThreshold")),
52  mReverseEnergyFractionThreshold (iConfig.getParameter<double>("reverseEnergyFractionThreshold")),
53  mRThreshold (iConfig.getParameter<double>("RThreshold")),
54  JetCorrectionService (iConfig.getParameter<std::string> ("JetCorrectionService" )),
55  mTurnOnEverything (iConfig.getUntrackedParameter<std::string>("TurnOnEverything",""))
56 {
59  = mP = mP_80 = mPt = mPt_80
60  = mMass = mMass_80
65  = mDeltaEta = mDeltaPhi
71 
77 
78  //Corr Jet
85  = nvtx_0_30 = nvtx_0_60
98  = 0;
99 
100  DQMStore* dbe = &*edm::Service<DQMStore>();
101  if (dbe) {
102  dbe->setCurrentFolder("JetMET/RecoJetsV/JPTJetTask_" + mInputCollection.label());
103  //
104  numberofevents = dbe->book1D("numberofevents","numberofevents", 3, 0 , 2);
105  //
106  mEta = dbe->book1D("Eta", "Eta", 120, -6, 6);
107  mEtaFineBin = dbe->book1D("EtaFineBin_Pt10", "EtaFineBin_Pt10", 600, -6, 6);
108  //
109  mPhi = dbe->book1D("Phi", "Phi", 70, -3.5, 3.5);
110  mPhiFineBin = dbe->book1D("PhiFineBin_Pt10", "PhiFineBin_Pt10", 350, -3.5, 3.5);
111  //
112  mE = dbe->book1D("E", "E", 100, 0, 500);
113  mE_80 = dbe->book1D("E_80", "E_80", 100, 0, 5000);
114  //
115  mP = dbe->book1D("P", "P", 100, 0, 500);
116  mP_80 = dbe->book1D("P_80", "P_80", 100, 0, 5000);
117  //
118  mPt = dbe->book1D("Pt", "Pt", 100, 0, 150);
119  mPt_80 = dbe->book1D("Pt_80", "Pt_80", 100, 0, 4000);
120  //
121  mMass = dbe->book1D("Mass", "Mass", 100, 0, 200);
122  mMass_80 = dbe->book1D("Mass_80", "Mass_80", 100, 0, 500);
123  mEtaFirst = dbe->book1D("EtaFirst", "EtaFirst", 120, -6, 6);
124  mPhiFirst = dbe->book1D("PhiFirst", "PhiFirst", 70, -3.5, 3.5);
125  mPtFirst = dbe->book1D("PtFirst", "PtFirst", 100, 0, 50);
126  mPtFirst_80 = dbe->book1D("PtFirst_80", "PtFirst_80", 100, 0, 140);
127  mPtFirst_3000 = dbe->book1D("PtFirst_3000", "PtFirst_3000", 100, 0, 4000);
128  //
129  mMjj = dbe->book1D("Mjj", "Mjj", 100, 0, 2000);
130  mMjj_3000 = dbe->book1D("Mjj_3000", "Mjj_3000", 100, 0, 10000);
131  mDelEta = dbe->book1D("DelEta", "DelEta", 100, -.5, .5);
132  mDelPhi = dbe->book1D("DelPhi", "DelPhi", 100, -.5, .5);
133  mDelPt = dbe->book1D("DelPt", "DelPt", 100, -1, 1);
134  //
135 
136  //
137  mGenEta = dbe->book1D("GenEta", "GenEta", 120, -6, 6);
138  mGenPhi = dbe->book1D("GenPhi", "GenPhi", 70, -3.5, 3.5);
139  mGenPt = dbe->book1D("GenPt", "GenPt", 100, 0, 150);
140  mGenPt_80 = dbe->book1D("GenPt_80", "GenPt_80", 100, 0, 1500);
141  //
142  mGenEtaFirst = dbe->book1D("GenEtaFirst", "GenEtaFirst", 100, -5, 5);
143  mGenPhiFirst = dbe->book1D("GenPhiFirst", "GenPhiFirst", 70, -3.5, 3.5);
144  //
145  //
146  mHadTiming = dbe->book1D("HadTiming", "HadTiming", 75, -50, 100);
147  mEmTiming = dbe->book1D("EMTiming", "EMTiming", 75, -50, 100);
148  //
149  mNJetsEtaC = dbe->book1D("NJetsEtaC_Pt10", "NJetsEtaC_Pt10", 15, 0, 15);
150  mNJetsEtaF = dbe->book1D("NJetsEtaF_Pt10", "NJetsEtaF_Pt10", 15, 0, 15);
151  mNJetsEtaF_30 = dbe->book1D("NJetsEtaF_Pt30", "NJetsEtaF_Pt30", 15, 0, 15);
152  //
153  mNJets1 = dbe->bookProfile("NJets1", "NJets1", 100, 0, 200, 100, 0, 50, "s");
154  mNJets2 = dbe->bookProfile("NJets2", "NJets2", 100, 0, 4000, 100, 0, 50, "s");
155  //
156  //
157  mPthat_80 = dbe->book1D("Pthat_80", "Pthat_80", 100, 0.0, 1000.0);
158  mPthat_3000 = dbe->book1D("Pthat_3000", "Pthat_3000", 100, 1000.0, 4000.0);
159 
160  //Corr
161  mCorrJetPt = dbe->book1D("CorrPt", "CorrPt", 100, 0, 150);
162  mCorrJetPt_80 = dbe->book1D("CorrPt_80", "CorrPt_80", 100, 0, 4000);
163  mCorrJetEta = dbe->book1D("CorrEta", "CorrEta", 120, -6, 6);
164  mCorrJetPhi = dbe->book1D("CorrPhi", "CorrPhi", 70, -3.5, 3.5);
165  //mjetArea = dbe->book1D("jetArea","jetArea",25,0,2.5);
166 
167  //nvtx
168  nvtx_0_30 = dbe->book1D("nvtx_0_30","nvtx_0_30",31,-0.5,30.5);
169  nvtx_0_60 = dbe->book1D("nvtx_0_60","nvtx_0_60",61,-0.5,60.5);
170 
171  //pT scale with nvtx
172  mpTScale_a_nvtx_0_5 = dbe->book1D("mpTScale_a_nvtx_0_5", "pTScale_a_nvtx_0_5_0<|eta|<1.3_60_120",100, 0, 2);
173  mpTScale_b_nvtx_0_5 = dbe->book1D("mpTScale_b_nvtx_0_5", "pTScale_b_nvtx_0_5_0<|eta|<1.3_200_300",100, 0, 2);
174  mpTScale_c_nvtx_0_5 = dbe->book1D("mpTScale_c_nvtx_0_5", "pTScale_c_nvtx_0_5_0<|eta|<1.3_600_900",100, 0, 2);
175  mpTScale_a_nvtx_5_10 = dbe->book1D("mpTScale_a_nvtx_5_10", "pTScale_a_nvtx_5_10_0<|eta|<1.3_60_120",100, 0, 2);
176  mpTScale_b_nvtx_5_10 = dbe->book1D("mpTScale_b_nvtx_5_10", "pTScale_b_nvtx_5_10_0<|eta|<1.3_200_300",100, 0, 2);
177  mpTScale_c_nvtx_5_10 = dbe->book1D("mpTScale_c_nvtx_5_10", "pTScale_c_nvtx_5_10_0<|eta|<1.3_600_900",100, 0, 2);
178  mpTScale_a_nvtx_10_15 = dbe->book1D("mpTScale_a_nvtx_10_15", "pTScale_a_nvtx_10_15_0<|eta|<1.3_60_120",100, 0, 2);
179  mpTScale_b_nvtx_10_15 = dbe->book1D("mpTScale_b_nvtx_10_15", "pTScale_b_nvtx_10_15_0<|eta|<1.3_200_300",100, 0, 2);
180  mpTScale_c_nvtx_10_15 = dbe->book1D("mpTScale_c_nvtx_10_15", "pTScale_c_nvtx_10_15_0<|eta|<1.3_600_900",100, 0, 2);
181  mpTScale_a_nvtx_15_20 = dbe->book1D("mpTScale_a_nvtx_15_20", "pTScale_a_nvtx_15_20_0<|eta|<1.3_60_120",100, 0, 2);
182  mpTScale_b_nvtx_15_20 = dbe->book1D("mpTScale_b_nvtx_15_20", "pTScale_b_nvtx_15_20_0<|eta|<1.3_200_300",100, 0, 2);
183  mpTScale_c_nvtx_15_20 = dbe->book1D("mpTScale_c_nvtx_15_20", "pTScale_c_nvtx_15_20_0<|eta|<1.3_600_900",100, 0, 2);
184  mpTScale_a_nvtx_20_30 = dbe->book1D("mpTScale_a_nvtx_20_30", "pTScale_a_nvtx_20_30_0<|eta|<1.3_60_120",100, 0, 2);
185  mpTScale_b_nvtx_20_30 = dbe->book1D("mpTScale_b_nvtx_20_30", "pTScale_b_nvtx_20_30_0<|eta|<1.3_200_300",100, 0, 2);
186  mpTScale_c_nvtx_20_30 = dbe->book1D("mpTScale_c_nvtx_20_30", "pTScale_c_nvtx_20_30_0<|eta|<1.3_600_900",100, 0, 2);
187  mpTScale_a_nvtx_30_inf = dbe->book1D("mpTScale_a_nvtx_30_inf", "pTScale_a_nvtx_30_inf_0<|eta|<1.3_60_120",100, 0, 2);
188  mpTScale_b_nvtx_30_inf = dbe->book1D("mpTScale_b_nvtx_30_inf", "pTScale_b_nvtx_30_inf_0<|eta|<1.3_200_300",100, 0, 2);
189  mpTScale_c_nvtx_30_inf = dbe->book1D("mpTScale_c_nvtx_30_inf", "pTScale_c_nvtx_30_inf_0<|eta|<1.3_600_900",100, 0, 2);
190  mpTScale_a = dbe->book1D("mpTScale_a", "pTScale_a_60_120",100, 0, 2);
191  mpTScale_b = dbe->book1D("mpTScale_b", "pTScale_b_200_300",100, 0, 2);
192  mpTScale_c = dbe->book1D("mpTScale_c", "pTScale_c_600_900",100, 0, 2);
193  //
194  double log10PtMin = 0.5; //=3.1622766
195  double log10PtMax = 3.75; //=5623.41325
196  int log10PtBins = 26;
197  double etaRange[91] = {-6.0,-5.8,-5.6,-5.4,-5.2,-5.0,-4.8,-4.6,-4.4,-4.2,-4.0,-3.8,-3.6,-3.4,-3.2,-3.0,-2.9,-2.8,-2.7,-2.6,-2.5,-2.4,-2.3,-2.2,-2.1,-2.0,-1.9,-1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1,-1.0,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,-0.2,-0.1,0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.2,3.4,3.6,3.8,4.0,4.2,4.4,4.6,4.8,5.0,5.2,5.4,5.6,5.8,6.0};
198 
199 
200  // int log10PtFineBins = 50;
201  //
202  if (mTurnOnEverything.compare("yes")==0) {
203  }
204 
205  //
206  if (mTurnOnEverything.compare("yes")==0) {
207  }
208  mpTScaleB_d = dbe->bookProfile("pTScaleB_d", "pTScale_d_0<|eta|<1.5",
209  log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
210  mpTScaleE_d = dbe->bookProfile("pTScaleE_d", "pTScale_d_1.5<|eta|<3.0",
211  log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
212  mpTScaleF_d = dbe->bookProfile("pTScaleF_d", "pTScale_d_3.0<|eta|<6.0",
213  log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
214  mpTScalePhiB_d = dbe->bookProfile("pTScalePhiB_d", "pTScalePhi_d_0<|eta|<1.5",
215  log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
216  mpTScalePhiE_d = dbe->bookProfile("pTScalePhiE_d", "pTScalePhi_d_1.5<|eta|<3.0",
217  log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
218  mpTScalePhiF_d = dbe->bookProfile("pTScalePhiF_d", "pTScalePhi_d_3.0<|eta|<6.0",
219  log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
220  mpTScale_30_200_d = dbe->bookProfile("pTScale_30_200_d", "pTScale_d_30<pT<200",
221  90,etaRange, 0., 2., " ");
222  mpTScale_200_600_d = dbe->bookProfile("pTScale_200_600_d", "pTScale_d_200<pT<600",
223  90,etaRange, 0., 2., " ");
224  mpTScale_600_1500_d = dbe->bookProfile("pTScale_600_1500_d", "pTScale_d_600<pT<1500",
225  90,etaRange, 0., 2., " ");
226  mpTScale_1500_3500_d = dbe->bookProfile("pTScale_1500_3500_d", "pTScale_d_1500<pt<3500",
227  90,etaRange, 0., 2., " ");
228 
229  mpTScale1DB_30_200 = dbe->book1D("pTScale1DB_30_200", "pTScale_distribution_for_0<|eta|<1.5_30_200",
230  100, 0, 2);
231  mpTScale1DE_30_200 = dbe->book1D("pTScale1DE_30_200", "pTScale_distribution_for_1.5<|eta|<3.0_30_200",
232  50, 0, 2);
233  mpTScale1DF_30_200 = dbe->book1D("pTScale1DF_30_200", "pTScale_distribution_for_3.0<|eta|<6.0_30_200",
234  50, 0, 2);
235 
236  mpTScale1DB_200_600 = dbe->book1D("pTScale1DB_200_600", "pTScale_distribution_for_0<|eta|<1.5_200_600",
237  100, 0, 2);
238  mpTScale1DE_200_600 = dbe->book1D("pTScale1DE_200_600", "pTScale_distribution_for_1.5<|eta|<3.0_200_600",
239  50, 0, 2);
240  mpTScale1DF_200_600 = dbe->book1D("pTScale1DF_200_600", "pTScale_distribution_for_3.0<|eta|<6.0_200_600",
241  50, 0, 2);
242 
243  mpTScale1DB_600_1500 = dbe->book1D("pTScale1DB_600_1500", "pTScale_distribution_for_0<|eta|<1.5_600_1500",
244  100, 0, 2);
245  mpTScale1DE_600_1500 = dbe->book1D("pTScale1DE_600_1500", "pTScale_distribution_for_1.5<|eta|<3.0_600_1500",
246  50, 0, 2);
247  mpTScale1DF_600_1500 = dbe->book1D("pTScale1DF_600_1500", "pTScale_distribution_for_3.0<|eta|<6.0_600_1500",
248  50, 0, 2);
249 
250  mpTScale1DB_1500_3500 = dbe->book1D("pTScale1DB_1500_3500", "pTScale_distribution_for_0<|eta|<1.5_1500_3500",
251  100, 0, 2);
252  mpTScale1DE_1500_3500 = dbe->book1D("pTScale1DE_1500_3500", "pTScale_distribution_for_1.5<|eta|<3.0_1500_3500",
253  50, 0, 2);
254  mpTScale1DF_1500_3500 = dbe->book1D("pTScale1DF_1500_3500", "pTScale_distribution_for_3.0<|eta|<6.0_1500_3500",
255  50, 0, 2);
256 
257  mpTScale_nvtx_0_5 = dbe->bookProfile("pTScale_nvtx_0_5", "pTScale_nvtx_0_5_0<|eta|<1.3",
258  log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
259  mpTScale_nvtx_5_10 = dbe->bookProfile("pTScale_nvtx_5_10", "pTScale_nvtx_5_10_0<|eta|<1.3",
260  log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
261  mpTScale_nvtx_10_15 = dbe->bookProfile("pTScale_nvtx_10_15", "pTScale_nvtx_10_15_0<|eta|<1.3",
262  log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
263  mpTScale_nvtx_15_20 = dbe->bookProfile("pTScale_nvtx_15_20", "pTScale_nvtx_15_20_0<|eta|<1.3",
264  log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
265  mpTScale_nvtx_20_30 = dbe->bookProfile("pTScale_nvtx_20_30", "pTScale_nvtx_20_30_0<|eta|<1.3",
266  log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
267  mpTScale_nvtx_30_inf = dbe->bookProfile("pTScale_nvtx_30_inf", "pTScale_nvtx_30_inf_0<|eta|<1.3",
268  log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
269  mpTScale_pT = dbe->bookProfile("pTScale_pT", "pTScale_vs_pT",
270  log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
272  mpTRatio = dbe->bookProfile("pTRatio", "pTRatio",
273  log10PtBins, log10PtMin, log10PtMax, 100, 0.,5., " ");
274  mpTRatioB_d = dbe->bookProfile("pTRatioB_d", "pTRatio_d_0<|eta|<1.5",
275  log10PtBins, log10PtMin, log10PtMax, 0, 5, " ");
276  mpTRatioE_d = dbe->bookProfile("pTRatioE_d", "pTRatio_d_1.5<|eta|<3.0",
277  log10PtBins, log10PtMin, log10PtMax, 0, 5, " ");
278  mpTRatioF_d = dbe->bookProfile("pTRatioF_d", "pTRatio_d_3.0<|eta|<6.0",
279  log10PtBins, log10PtMin, log10PtMax, 0, 5, " ");
280  mpTRatio_30_200_d = dbe->bookProfile("pTRatio_30_200_d", "pTRatio_d_30<pT<200",
281  90,etaRange, 0., 5., " ");
282  mpTRatio_200_600_d = dbe->bookProfile("pTRatio_200_600_d", "pTRatio_d_200<pT<600",
283  90,etaRange, 0., 5., " ");
284  mpTRatio_600_1500_d = dbe->bookProfile("pTRatio_600_1500_d", "pTRatio_d_600<pT<1500",
285  90,etaRange, 0., 5., " ");
286  mpTRatio_1500_3500_d = dbe->bookProfile("pTRatio_1500_3500_d", "pTRatio_d_1500<pt<3500",
287  90,etaRange, 0., 5., " ");
288  mpTResponse = dbe->bookProfile("pTResponse", "pTResponse",
289  log10PtBins, log10PtMin, log10PtMax, 100, 0.8,1.2, " ");
290  mpTResponseB_d = dbe->bookProfile("pTResponseB_d", "pTResponse_d_0<|eta|<1.5",
291  log10PtBins, log10PtMin, log10PtMax, 0.8, 1.2, " ");
292  mpTResponseE_d = dbe->bookProfile("pTResponseE_d", "pTResponse_d_1.5<|eta|<3.0",
293  log10PtBins, log10PtMin, log10PtMax, 0.8, 1.2, " ");
294  mpTResponseF_d = dbe->bookProfile("pTResponseF_d", "pTResponse_d_3.0<|eta|<6.0",
295  log10PtBins, log10PtMin, log10PtMax, 0.8, 1.2, " ");
296  mpTResponse_30_200_d = dbe->bookProfile("pTResponse_30_200_d", "pTResponse_d_30<pT<200",
297  90,etaRange, 0.8, 1.2, " ");
298  mpTResponse_200_600_d = dbe->bookProfile("pTResponse_200_600_d", "pTResponse_d_200<pT<600",
299  90,etaRange, 0.8, 1.2, " ");
300  mpTResponse_600_1500_d = dbe->bookProfile("pTResponse_600_1500_d", "pTResponse_d_600<pT<1500",
301  90,etaRange, 0.8, 1.2, " ");
302  mpTResponse_1500_3500_d = dbe->bookProfile("pTResponse_1500_3500_d", "pTResponse_d_1500<pt<3500",
303  90,etaRange, 0.8, 1.2, " ");
304  mpTResponse_30_d = dbe->bookProfile("pTResponse_30_d", "pTResponse_d_pt>30",
305  90,etaRange, 0.8, 1.2, " ");
306 
307  mpTResponse_nvtx_0_5 = dbe->bookProfile("pTResponse_nvtx_0_5", "pTResponse_nvtx_0_5", log10PtBins, log10PtMin, log10PtMax, 100, 0.8,1.2, " ");
308  mpTResponse_nvtx_5_10 = dbe->bookProfile("pTResponse_nvtx_5_10", "pTResponse_nvtx_5_10", log10PtBins, log10PtMin, log10PtMax, 100, 0.8,1.2, " ");
309  mpTResponse_nvtx_10_15 = dbe->bookProfile("pTResponse_nvtx_10_15", "pTResponse_nvtx_10_15", log10PtBins, log10PtMin, log10PtMax, 100, 0.8,1.2, " ");
310  mpTResponse_nvtx_15_20 = dbe->bookProfile("pTResponse_nvtx_15_20", "pTResponse_nvtx_15_20", log10PtBins, log10PtMin, log10PtMax, 100, 0.8,1.2, " ");
311  mpTResponse_nvtx_20_30 = dbe->bookProfile("pTResponse_nvtx_20_30", "pTResponse_nvtx_20_30", log10PtBins, log10PtMin, log10PtMax, 100, 0.8,1.2, " ");
312  mpTResponse_nvtx_30_inf = dbe->bookProfile("pTResponse_nvtx_30_inf", "pTResponse_nvtx_30_inf", log10PtBins, log10PtMin, log10PtMax, 100, 0.8,1.2, " ");
313 
314 
315  } // if (dbe)
316 
317  if (mOutputFile.empty ()) {
318  LogInfo("OutputInfo") << " JPTJet histograms will NOT be saved";
319  }
320  else {
321  LogInfo("OutputInfo") << " JPTJethistograms will be saved to file:" << mOutputFile;
322  }
323 }
324 
326 {
327 }
328 
330 }
331 
334 }
335 
336 
337 void JPTJetTester::analyze(const edm::Event& mEvent, const edm::EventSetup& mSetup)
338 {
339  double countsfornumberofevents = 1;
340  numberofevents->Fill(countsfornumberofevents);
341 
342  //get primary vertices
344  try {
345  mEvent.getByLabel( "offlinePrimaryVertices", pvHandle );
346  } catch ( cms::Exception & e ) {
347  //cout <<prefix<<"error: " << e.what() << endl;
348  }
349  vector<reco::Vertex> goodVertices;
350  for (unsigned i = 0; i < pvHandle->size(); i++) {
351  if ( (*pvHandle)[i].ndof() > 4 &&
352  ( fabs((*pvHandle)[i].z()) <= 24. ) &&
353  ( fabs((*pvHandle)[i].position().rho()) <= 2.0 ) )
354  goodVertices.push_back((*pvHandle)[i]);
355  }
356 
357  nvtx_0_30->Fill(goodVertices.size());
358  nvtx_0_60->Fill(goodVertices.size());
359 
360  // *********************************
361  // *** Get pThat
362  // *********************************
363 if (!mEvent.isRealData()){
365  mEvent.getByLabel("generator", evt);
366  if (evt.isValid()) {
367  HepMC::GenEvent * myGenEvent = new HepMC::GenEvent(*(evt->GetEvent()));
368 
369  double pthat = myGenEvent->event_scale();
370 
371  mPthat_80->Fill(pthat);
372  mPthat_3000->Fill(pthat);
373 
374  delete myGenEvent;
375  }
376 }
377  // ***********************************
378  // *** Get CaloMET
379  // ***********************************
380 /*
381  const CaloMET *calomet;
382  edm::Handle<CaloMETCollection> calo;
383  mEvent.getByLabel("met", calo);
384  if (!calo.isValid()) {
385  edm::LogInfo("OutputInfo") << " failed to retrieve data required by MET Task";
386  edm::LogInfo("OutputInfo") << " MET Task cannot continue...!";
387  } else {
388  const CaloMETCollection *calometcol = calo.product();
389  calomet = &(calometcol->front());
390  }
391 */
392  // ***********************************
393  // *** Get the CaloTower collection
394  // ***********************************
396  mEvent.getByLabel( "towerMaker", caloTowers );
397  if (caloTowers.isValid()) {
398  for( CaloTowerCollection::const_iterator cal = caloTowers->begin(); cal != caloTowers->end(); ++ cal ){
399 
400  //To compensate for the index
401  if (mTurnOnEverything.compare("yes")==0) {
402  }
403 
404  mHadTiming->Fill (cal->hcalTime());
405  mEmTiming->Fill (cal->ecalTime());
406  }
407  }
408 
409  // ***********************************
410  // *** Get the RecHits collection
411  // ***********************************
412  try {
413  std::vector<edm::Handle<HBHERecHitCollection> > colls;
414  mEvent.getManyByType(colls);
415  std::vector<edm::Handle<HBHERecHitCollection> >::iterator i;
416  for (i=colls.begin(); i!=colls.end(); i++) {
417  for (HBHERecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
418  // std::cout << *j << std::endl;
419  }
420  }
421  } catch (...) {
422  edm::LogInfo("OutputInfo") << " No HB/HE RecHits.";
423  }
424 
425  try {
426  std::vector<edm::Handle<HFRecHitCollection> > colls;
427  mEvent.getManyByType(colls);
428  std::vector<edm::Handle<HFRecHitCollection> >::iterator i;
429  for (i=colls.begin(); i!=colls.end(); i++) {
430  for (HFRecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
431  // std::cout << *j << std::endl;
432  }
433  }
434  } catch (...) {
435  edm::LogInfo("OutputInfo") << " No HF RecHits.";
436  }
437 
438  try {
439  std::vector<edm::Handle<HORecHitCollection> > colls;
440  mEvent.getManyByType(colls);
441  std::vector<edm::Handle<HORecHitCollection> >::iterator i;
442  for (i=colls.begin(); i!=colls.end(); i++) {
443  for (HORecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
444  }
445  }
446  } catch (...) {
447  edm::LogInfo("OutputInfo") << " No HO RecHits.";
448  }
449  try {
450  std::vector<edm::Handle<EBRecHitCollection> > colls;
451  mEvent.getManyByType(colls);
452  std::vector<edm::Handle<EBRecHitCollection> >::iterator i;
453  for (i=colls.begin(); i!=colls.end(); i++) {
454  for (EBRecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
455  }
456  }
457  } catch (...) {
458  edm::LogInfo("OutputInfo") << " No EB RecHits.";
459  }
460 
461  try {
462  std::vector<edm::Handle<EERecHitCollection> > colls;
463  mEvent.getManyByType(colls);
464  std::vector<edm::Handle<EERecHitCollection> >::iterator i;
465  for (i=colls.begin(); i!=colls.end(); i++) {
466  for (EERecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
467  }
468  }
469  } catch (...) {
470  edm::LogInfo("OutputInfo") << " No EE RecHits.";
471  }
472 
473  //***********************************
474  //*** Get the Jet collection
475  //***********************************
476  math::XYZTLorentzVector p4tmp[2];
477  Handle<JPTJetCollection> jptJets;
478  mEvent.getByLabel(mInputCollection, jptJets);
479  if (!jptJets.isValid()) return;
480  JPTJetCollection::const_iterator jet = jptJets->begin ();
481  int jetIndex = 0;
482  int nJet = 0;
483  int nJetF = 0;
484  int nJetC = 0;
485  int nJetF_30 =0;
486  for (; jet != jptJets->end (); jet++, jetIndex++) {
487  if (jet->pt() > 10.) {
488  if (fabs(jet->eta()) > 1.5)
489  nJetF++;
490  else
491  nJetC++;
492  }
493  if (jet->pt() > 30.) nJetF_30++;
494  if (jet->pt() > 10.) {
495  if (mEta) mEta->Fill (jet->eta());
496  if (mEtaFineBin) mEtaFineBin->Fill (jet->eta());
497  if (mPhiFineBin) mPhiFineBin->Fill (jet->phi());
498  }
499  //if (mjetArea) mjetArea->Fill(jet->jetArea());
500  if (mPhi) mPhi->Fill (jet->phi());
501  if (mE) mE->Fill (jet->energy());
502  if (mE_80) mE_80->Fill (jet->energy());
503  if (mP) mP->Fill (jet->p());
504  if (mP_80) mP_80->Fill (jet->p());
505  if (mPt) mPt->Fill (jet->pt());
506  if (mPt_80) mPt_80->Fill (jet->pt());
507  if (mMass) mMass->Fill (jet->mass());
508  if (mMass_80) mMass_80->Fill (jet->mass());
509  if (jet == jptJets->begin ()) { // first jet
510  if (mEtaFirst) mEtaFirst->Fill (jet->eta());
511  if (mPhiFirst) mPhiFirst->Fill (jet->phi());
512  if (mPtFirst) mPtFirst->Fill (jet->pt());
513  if (mPtFirst_80) mPtFirst_80->Fill (jet->pt());
514  if (mPtFirst_3000) mPtFirst_3000->Fill (jet->pt());
515  }
516  if (jetIndex == 0) {
517  nJet++;
518  p4tmp[0] = jet->p4();
519  }
520  if (jetIndex == 1) {
521  nJet++;
522  p4tmp[1] = jet->p4();
523  }
524 
525  }
526 
527  if (mNJetsEtaC) mNJetsEtaC->Fill( nJetC );
528  if (mNJetsEtaF) mNJetsEtaF->Fill( nJetF );
529  if (mNJetsEtaF_30) mNJetsEtaF_30->Fill( nJetF_30 );
530 
531  if (nJet == 2) {
532  if (mMjj) mMjj->Fill( (p4tmp[0]+p4tmp[1]).mass() );
533  if (mMjj_3000) mMjj_3000->Fill( (p4tmp[0]+p4tmp[1]).mass() );
534  }
535 
536  // Correction jets
538 
539  for (JPTJetCollection::const_iterator jet = jptJets->begin(); jet !=jptJets ->end(); jet++)
540  {
541 
542  JPTJet correctedJet = *jet;
543  //double scale = corrector->correction(jet->p4());
544  //double scale = corrector->correction(*jet);
545  double scale = corrector->correction(*jet,mEvent,mSetup);
546  correctedJet.scaleEnergy(scale);
547  if(correctedJet.pt()>30){
548  mCorrJetPt->Fill(correctedJet.pt());
549  mCorrJetPt_80->Fill(correctedJet.pt());
550  if (correctedJet.pt()>10) mCorrJetEta->Fill(correctedJet.eta());
551  mCorrJetPhi->Fill(correctedJet.phi());
552  mpTRatio->Fill(log10(jet->pt()),correctedJet.pt()/jet->pt());
553 
554  if (fabs(jet->eta())<1.5) {
555  mpTRatioB_d->Fill(log10(jet->pt()), correctedJet.pt()/jet->pt());
556  }
557 
558  if (fabs(jet->eta())>1.5 && fabs(jet->eta())<3.0) {
559  mpTRatioE_d->Fill (log10(jet->pt()), correctedJet.pt()/jet->pt());
560  }
561  if (fabs(jet->eta())>3.0 && fabs(jet->eta())<6.0) {
562  mpTRatioF_d->Fill (log10(jet->pt()), correctedJet.pt()/jet->pt());
563  }
564  if (jet->pt()>30.0 && jet->pt()<200.0) {
565  mpTRatio_30_200_d->Fill (jet->eta(),correctedJet.pt()/jet->pt());
566  }
567  if (jet->pt()>200.0 && jet->pt()<600.0) {
568  mpTRatio_200_600_d->Fill (jet->eta(),correctedJet.pt()/jet->pt());
569  }
570  if (jet->pt()>600.0 && jet->pt()<1500.0) {
571  mpTRatio_600_1500_d->Fill (jet->eta(),correctedJet.pt()/jet->pt());
572  }
573  if (jet->pt()>1500.0 && jet->pt()<3500.0) {
574  mpTRatio_1500_3500_d->Fill (jet->eta(),correctedJet.pt()/jet->pt());
575  }
576 
577  }
578  }
579  // Count Jets above Pt cut
580  for (int istep = 0; istep < 100; ++istep) {
581  int njet = 0;
582  float ptStep = (istep * (200./100.));
583 
584  for ( JPTJetCollection::const_iterator jpt = jptJets->begin(); jpt != jptJets->end(); ++ jpt ) {
585  if ( jpt->pt() > ptStep ) njet++;
586  }
587  mNJets1->Fill( ptStep, njet );
588  }
589 
590  for (int istep = 0; istep < 100; ++istep) {
591  int njet = 0;
592  float ptStep = (istep * (4000./100.));
593  for ( JPTJetCollection::const_iterator jpt = jptJets->begin(); jpt != jptJets->end(); ++ jpt ) {
594  if ( jpt->pt() > ptStep ) njet++;
595  }
596  mNJets2->Fill( ptStep, njet );
597  }
598 
599 if (!mEvent.isRealData()){
600  // Gen jet analysis
601  Handle<GenJetCollection> genJets;
602  mEvent.getByLabel(mInputGenCollection, genJets);
603  if (!genJets.isValid()) return;
604  GenJetCollection::const_iterator gjet = genJets->begin ();
605  int gjetIndex = 0;
606  for (; gjet != genJets->end (); gjet++, gjetIndex++) {
607  if (mGenEta) mGenEta->Fill (gjet->eta());
608  if (mGenPhi) mGenPhi->Fill (gjet->phi());
609  if (mGenPt) mGenPt->Fill (gjet->pt());
610  if (mGenPt_80) mGenPt_80->Fill (gjet->pt());
611  if (gjet == genJets->begin ()) { // first jet
612  if (mGenEtaFirst) mGenEtaFirst->Fill (gjet->eta());
613  if (mGenPhiFirst) mGenPhiFirst->Fill (gjet->phi());
614  }
615  }
616 
617 
618  // now match JPTJets to GenJets
619  JetMatchingTools jetMatching (mEvent);
620  if (!(mInputGenCollection.label().empty())) {
621  // Handle<GenJetCollection> genJets;
622  // mEvent.getByLabel(mInputGenCollection, genJets);
623 
624  std::vector <std::vector <const reco::GenParticle*> > genJetConstituents (genJets->size());
625  std::vector <std::vector <const reco::GenParticle*> > jptJetConstituents (jptJets->size());
626 
627  for (unsigned iGenJet = 0; iGenJet < genJets->size(); ++iGenJet) { //****************************************************************
628  //for (unsigned iGenJet = 0; iGenJet < 1; ++iGenJet) { // only FIRST Jet !!!!
629  const GenJet& genJet = (*genJets) [iGenJet];
630  double genJetPt = genJet.pt();
631 
632  //std::cout << iGenJet <<". Genjet: pT = " << genJetPt << "GeV" << std::endl; // *****************************************************
633 
634  if (fabs(genJet.eta()) > 6.) continue; // out of detector
635  if (genJetPt < mMatchGenPtThreshold) continue; // no low momentum
636  //double logPtGen = log10 (genJetPt);
637  //mAllGenJetsPt->Fill (logPtGen);
638  //mAllGenJetsEta->Fill (logPtGen, genJet.eta());
639  if (jptJets->size() <= 0) continue; // no JPTJets - nothing to match
640  if (mRThreshold > 0) {
641  unsigned iJPTJetBest = 0;
642  double deltaRBest = 999.;
643  for (unsigned iJPTJet = 0; iJPTJet < jptJets->size(); ++iJPTJet) {
644  double dR = deltaR (genJet.eta(), genJet.phi(), (*jptJets) [iJPTJet].eta(), (*jptJets) [iJPTJet].phi());
645  if (deltaRBest < mRThreshold && dR < mRThreshold && genJet.pt() > 5.) {
646  /*
647  std::cout << "Yet another matched jet for GenJet pt=" << genJet.pt()
648  << " previous JPTJet pt/dr: " << (*jptJets) [iJPTJetBest].pt() << '/' << deltaRBest
649  << " new JPTJet pt/dr: " << (*jptJets) [iJPTJet].pt() << '/' << dR
650  << std::endl;
651  */
652  }
653  if (dR < deltaRBest) {
654  iJPTJetBest = iJPTJet;
655  deltaRBest = dR;
656  }
657  }
658  if (mTurnOnEverything.compare("yes")==0) {
659  //mRMatch->Fill (logPtGen, genJet.eta(), deltaRBest);
660  }
661  if (deltaRBest < mRThreshold) { // Matched
662  fillMatchHists (genJet, (*jptJets) [iJPTJetBest],goodVertices);
663  }
664 
666  double CorrdeltaRBest = 999.;
667  double CorrJetPtBest = 0;
668  for (JPTJetCollection::const_iterator jet = jptJets->begin(); jet !=jptJets ->end(); jet++) {
669  JPTJet correctedJet = *jet;
670  //double scale = corrector->correction(jet->p4());
671  //double scale = corrector->correction(*jet);
672  double scale = corrector->correction(*jet,mEvent,mSetup);
673  correctedJet.scaleEnergy(scale);
674  double CorrJetPt = correctedJet.pt();
675  if(CorrJetPt>30){
676  double CorrdR = deltaR (genJet.eta(), genJet.phi(), correctedJet.eta(), correctedJet.phi());
677  if (CorrdR < CorrdeltaRBest) {
678  CorrdeltaRBest = CorrdR;
679  CorrJetPtBest = CorrJetPt;
680  }
681  }
682  }
683  if (deltaRBest < mRThreshold) { // Matched
684  mpTResponse->Fill(log10(genJet.pt()),CorrJetPtBest/genJet.pt());
685 
686  if (fabs(genJet.eta())<1.5) {
687  mpTResponseB_d->Fill(log10(genJet.pt()), CorrJetPtBest/genJet.pt());
688  }
689 
690  if (fabs(genJet.eta())>1.5 && fabs(genJet.eta())<3.0) {
691  mpTResponseE_d->Fill (log10(genJet.pt()), CorrJetPtBest/genJet.pt());
692  }
693 
694  if (fabs(genJet.eta())>3.0 && fabs(genJet.eta())<6.0) {
695  mpTResponseF_d->Fill (log10(genJet.pt()), CorrJetPtBest/genJet.pt());
696  }
697  if (genJet.pt()>30.0 && genJet.pt()<200.0) {
698  mpTResponse_30_200_d->Fill (genJet.eta(),CorrJetPtBest/genJet.pt());
699  }
700  if (genJet.pt()>200.0 && genJet.pt()<600.0) {
701  mpTResponse_200_600_d->Fill (genJet.eta(),CorrJetPtBest/genJet.pt());
702  }
703  if (genJet.pt()>600.0 && genJet.pt()<1500.0) {
704  mpTResponse_600_1500_d->Fill (genJet.eta(),CorrJetPtBest/genJet.pt());
705  }
706  if (genJet.pt()>1500.0 && genJet.pt()<3500.0) {
707  mpTResponse_1500_3500_d->Fill (genJet.eta(),CorrJetPtBest/genJet.pt());
708  }
709  if (genJet.pt()>30.0) {
710  mpTResponse_30_d->Fill (genJet.eta(),CorrJetPtBest/genJet.pt());
711  }
712 
713  if(goodVertices.size()<=5) mpTResponse_nvtx_0_5->Fill(log10(genJet.pt()),CorrJetPtBest/genJet.pt());
714  if(goodVertices.size()>5 && goodVertices.size()<=10) mpTResponse_nvtx_5_10->Fill(log10(genJet.pt()),CorrJetPtBest/genJet.pt());
715  if(goodVertices.size()>10 && goodVertices.size()<=15) mpTResponse_nvtx_10_15->Fill(log10(genJet.pt()),CorrJetPtBest/genJet.pt());
716  if(goodVertices.size()>15 && goodVertices.size()<=20) mpTResponse_nvtx_15_20->Fill(log10(genJet.pt()),CorrJetPtBest/genJet.pt());
717  if(goodVertices.size()>20 && goodVertices.size()<=30) mpTResponse_nvtx_20_30->Fill(log10(genJet.pt()),CorrJetPtBest/genJet.pt());
718  if(goodVertices.size()>30) mpTResponse_nvtx_30_inf->Fill(log10(genJet.pt()),CorrJetPtBest/genJet.pt());
719 
720 
721  }
723  }
724 
725  }
726  }
727 }
728 
729 }
730 
731 void JPTJetTester::fillMatchHists (const reco::GenJet& fGenJet, const reco::JPTJet& fJPTJet,std::vector<reco::Vertex> goodVertices) {
732  double logPtGen = log10 (fGenJet.pt());
733  double PtGen = fGenJet.pt();
734  double PtJpt = fJPTJet.pt();
735 
736  double PtThreshold = 10.;
737 
738  if (mTurnOnEverything.compare("yes")==0) {
739  mDeltaEta->Fill (logPtGen, fGenJet.eta(), fJPTJet.eta()-fGenJet.eta());
740  mDeltaPhi->Fill (logPtGen, fGenJet.eta(), fJPTJet.phi()-fGenJet.phi());
741 
742  mEScaleFineBin->Fill (logPtGen, fGenJet.eta(), fJPTJet.energy()/fGenJet.energy());
743 
744  if (fGenJet.pt()>PtThreshold) {
745  mEScale_pt10->Fill (logPtGen, fGenJet.eta(), fJPTJet.energy()/fGenJet.energy());
746 
747  }
748 
749  }
750  if (fJPTJet.pt() > PtThreshold) {
751  mDelEta->Fill (fGenJet.eta()-fJPTJet.eta());
752  mDelPhi->Fill (fGenJet.phi()-fJPTJet.phi());
753  mDelPt->Fill ((fGenJet.pt()-fJPTJet.pt())/fGenJet.pt());
754  }
755 
756  if (fabs(fGenJet.eta())<1.5) {
757 
758  mpTScaleB_d->Fill (log10(PtGen), PtJpt/PtGen);
759  mpTScalePhiB_d->Fill (fGenJet.phi(), PtJpt/PtGen);
760 
761  if (PtGen>30.0 && PtGen<200.0) {
762  mpTScale1DB_30_200->Fill (fJPTJet.pt()/fGenJet.pt());
763  }
764  if (PtGen>200.0 && PtGen<600.0) {
765  mpTScale1DB_200_600->Fill (fJPTJet.pt()/fGenJet.pt());
766  }
767  if (PtGen>600.0 && PtGen<1500.0) {
768  mpTScale1DB_600_1500->Fill (fJPTJet.pt()/fGenJet.pt());
769  }
770  if (PtGen>1500.0 && PtGen<3500.0) {
771  mpTScale1DB_1500_3500->Fill (fJPTJet.pt()/fGenJet.pt());
772  }
773 
774  }
775 
776  if (fabs(fGenJet.eta())>1.5 && fabs(fGenJet.eta())<3.0) {
777  mpTScaleE_d->Fill (log10(PtGen), PtJpt/PtGen);
778  mpTScalePhiE_d->Fill (fGenJet.phi(), PtJpt/PtGen);
779 
780  if (PtGen>30.0 && PtGen<200.0) {
781  mpTScale1DE_30_200->Fill (fJPTJet.pt()/fGenJet.pt());
782  }
783  if (PtGen>200.0 && PtGen<600.0) {
784  mpTScale1DE_200_600->Fill (fJPTJet.pt()/fGenJet.pt());
785  }
786  if (PtGen>600.0 && PtGen<1500.0) {
787  mpTScale1DE_600_1500->Fill (fJPTJet.pt()/fGenJet.pt());
788  }
789  if (PtGen>1500.0 && PtGen<3500.0) {
790  mpTScale1DE_1500_3500->Fill (fJPTJet.pt()/fGenJet.pt());
791  }
792 
793  }
794 
795  if (fabs(fGenJet.eta())>3.0 && fabs(fGenJet.eta())<6.0) {
796 
797  mpTScaleF_d->Fill (log10(PtGen), PtJpt/PtGen);
798  mpTScalePhiF_d->Fill (fGenJet.phi(), PtJpt/PtGen);
799 
800  if (PtGen>30.0 && PtGen<200.0) {
801  mpTScale1DF_30_200->Fill (fJPTJet.pt()/fGenJet.pt());
802  }
803  if (PtGen>200.0 && PtGen<600.0) {
804  mpTScale1DF_200_600->Fill (fJPTJet.pt()/fGenJet.pt());
805  }
806  if (PtGen>600.0 && PtGen<1500.0) {
807  mpTScale1DF_600_1500->Fill (fJPTJet.pt()/fGenJet.pt());
808  }
809  if (PtGen>1500.0 && PtGen<3500.0) {
810  mpTScale1DF_1500_3500->Fill (fJPTJet.pt()/fGenJet.pt());
811  }
812 
813  }
814 
815  if (fGenJet.pt()>30.0 && fGenJet.pt()<200.0) {
816  //mpTScale_30_200_s->Fill (fGenJet.eta(),fJPTJet.pt()/fGenJet.pt());
817  mpTScale_30_200_d->Fill (fGenJet.eta(),fJPTJet.pt()/fGenJet.pt());
818  //mpTScale1D_30_200->Fill (fJPTJet.pt()/fGenJet.pt());
819  }
820 
821  if (fGenJet.pt()>200.0 && fGenJet.pt()<600.0) {
822  mpTScale_200_600_d->Fill (fGenJet.eta(),fJPTJet.pt()/fGenJet.pt());
823  }
824 
825  if (fGenJet.pt()>600.0 && fGenJet.pt()<1500.0) {
826  mpTScale_600_1500_d->Fill (fGenJet.eta(),fJPTJet.pt()/fGenJet.pt());
827  }
828 
829  if (fGenJet.pt()>1500.0 && fGenJet.pt()<3500.0) {
830  mpTScale_1500_3500_d->Fill (fGenJet.eta(),fJPTJet.pt()/fGenJet.pt());
831  }
832 
833  if (fabs(fGenJet.eta())<1.3) {
834  if(fGenJet.pt()>60.0 && fGenJet.pt()<120.0) {
835  if(goodVertices.size()<=5) mpTScale_a_nvtx_0_5->Fill( PtJpt/PtGen);
836  }
837  if(fGenJet.pt()>200.0 && fGenJet.pt()<300.0) {
838  if(goodVertices.size()<=5) mpTScale_b_nvtx_0_5->Fill( PtJpt/PtGen);
839  }
840  if(fGenJet.pt()>600.0 && fGenJet.pt()<900.0) {
841  if(goodVertices.size()<=5) mpTScale_c_nvtx_0_5->Fill( PtJpt/PtGen);
842  }
843 
844  if(fGenJet.pt()>60.0 && fGenJet.pt()<120.0) {
845  if(goodVertices.size()>5 && goodVertices.size()<=10) mpTScale_a_nvtx_5_10->Fill( PtJpt/PtGen);
846  }
847  if(fGenJet.pt()>200.0 && fGenJet.pt()<300.0) {
848  if(goodVertices.size()>5 && goodVertices.size()<=10) mpTScale_b_nvtx_5_10->Fill( PtJpt/PtGen);
849  }
850  if(fGenJet.pt()>600.0 && fGenJet.pt()<900.0) {
851  if(goodVertices.size()>5 && goodVertices.size()<=10) mpTScale_c_nvtx_5_10->Fill( PtJpt/PtGen);
852  }
853 
854  if(fGenJet.pt()>60.0 && fGenJet.pt()<120.0) {
855  if(goodVertices.size()>10 && goodVertices.size()<=15) mpTScale_a_nvtx_10_15->Fill( PtJpt/PtGen);
856  }
857  if(fGenJet.pt()>200.0 && fGenJet.pt()<300.0) {
858  if(goodVertices.size()>10 && goodVertices.size()<=15) mpTScale_b_nvtx_10_15->Fill( PtJpt/PtGen);
859  }
860  if(fGenJet.pt()>600.0 && fGenJet.pt()<900.0) {
861  if(goodVertices.size()>10 && goodVertices.size()<=15) mpTScale_c_nvtx_10_15->Fill( PtJpt/PtGen);
862  }
863 
864  if(fGenJet.pt()>60.0 && fGenJet.pt()<120.0) {
865  if(goodVertices.size()>15 && goodVertices.size()<=20) mpTScale_a_nvtx_15_20->Fill( PtJpt/PtGen);
866  }
867  if(fGenJet.pt()>200.0 && fGenJet.pt()<300.0) {
868  if(goodVertices.size()>15 && goodVertices.size()<=20) mpTScale_b_nvtx_15_20->Fill( PtJpt/PtGen);
869  }
870  if(fGenJet.pt()>600.0 && fGenJet.pt()<900.0) {
871  if(goodVertices.size()>15 && goodVertices.size()<=20) mpTScale_c_nvtx_15_20->Fill( PtJpt/PtGen);
872  }
873 
874 if(fGenJet.pt()>60.0 && fGenJet.pt()<120.0) {
875  if(goodVertices.size()>20 && goodVertices.size()<=30) mpTScale_a_nvtx_20_30->Fill( PtJpt/PtGen);
876  }
877  if(fGenJet.pt()>200.0 && fGenJet.pt()<300.0) {
878  if(goodVertices.size()>20 && goodVertices.size()<=30) mpTScale_b_nvtx_20_30->Fill( PtJpt/PtGen);
879  }
880  if(fGenJet.pt()>600.0 && fGenJet.pt()<900.0) {
881  if(goodVertices.size()>20 && goodVertices.size()<=30) mpTScale_c_nvtx_20_30->Fill( PtJpt/PtGen);
882  }
883 
884 if(fGenJet.pt()>60.0 && fGenJet.pt()<120.0) {
885  if(goodVertices.size()>30) mpTScale_a_nvtx_30_inf->Fill( PtJpt/PtGen);
886  }
887  if(fGenJet.pt()>200.0 && fGenJet.pt()<300.0) {
888  if(goodVertices.size()>30) mpTScale_b_nvtx_30_inf->Fill( PtJpt/PtGen);
889  }
890  if(fGenJet.pt()>600.0 && fGenJet.pt()<900.0) {
891  if(goodVertices.size()>30) mpTScale_c_nvtx_30_inf->Fill( PtJpt/PtGen);
892  }
893 
894  if(goodVertices.size()<=5) mpTScale_nvtx_0_5->Fill(log10(PtGen),PtJpt/PtGen);
895  if(goodVertices.size()>5 && goodVertices.size()<=10) mpTScale_nvtx_5_10->Fill(log10(PtGen),PtJpt/PtGen);
896  if(goodVertices.size()>10 && goodVertices.size()<=15) mpTScale_nvtx_10_15->Fill(log10(PtGen),PtJpt/PtGen);
897  if(goodVertices.size()>15 && goodVertices.size()<=20) mpTScale_nvtx_15_20->Fill(log10(PtGen), PtJpt/PtGen);
898  if(goodVertices.size()>20 && goodVertices.size()<=30) mpTScale_nvtx_20_30->Fill(log10(PtGen), PtJpt/PtGen);
899  if(goodVertices.size()>30) mpTScale_nvtx_30_inf->Fill(log10(PtGen), PtJpt/PtGen);
900 }
901  if (fabs(fGenJet.eta())<1.3) {
902  if(fGenJet.pt()>60.0 && fGenJet.pt()<120.0) mpTScale_a->Fill(PtJpt/PtGen);
903  if(fGenJet.pt()>200.0 && fGenJet.pt()<300.0) mpTScale_b->Fill(PtJpt/PtGen);
904  if(fGenJet.pt()>600.0 && fGenJet.pt()<900.0) mpTScale_c->Fill(PtJpt/PtGen);
905  }
906  mpTScale_pT->Fill (log10(PtGen), PtJpt/PtGen);
907 
908 }
909 
911 
912  double sumpt = 0.;
913 
914  for (reco::TrackRefVector::const_iterator itrack = tracks.begin(); itrack != tracks.end(); ++itrack){
915  const reco::Track& track = **itrack;
916  sumpt += track.pt();
917  }
918 
919  return sumpt;
920 
921 }
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:408
MonitorElement * mpTScale_a_nvtx_20_30
Definition: JPTJetTester.h:125
MonitorElement * mpTScale_a_nvtx_5_10
Definition: JPTJetTester.h:116
MonitorElement * mPtFirst
Definition: JPTJetTester.h:149
MonitorElement * mMjj
Definition: JPTJetTester.h:160
int i
Definition: DBlmapReader.cc:9
MonitorElement * mpTScale_c
Definition: JPTJetTester.h:140
MonitorElement * mMass_80
Definition: JPTJetTester.h:71
MonitorElement * mpTScale_a
Definition: JPTJetTester.h:138
MonitorElement * mpTResponse_1500_3500_d
Definition: JPTJetTester.h:100
virtual void beginJob()
MonitorElement * mP_80
Definition: JPTJetTester.h:65
MonitorElement * mpTScale_b_nvtx_20_30
Definition: JPTJetTester.h:126
MonitorElement * mpTResponse_nvtx_5_10
Definition: JPTJetTester.h:108
MonitorElement * mpTResponse_nvtx_10_15
Definition: JPTJetTester.h:109
double mMatchGenPtThreshold
Definition: JPTJetTester.h:296
MonitorElement * mpTScaleE_d
Definition: JPTJetTester.h:258
MonitorElement * mpTScale_c_nvtx_0_5
Definition: JPTJetTester.h:115
MonitorElement * mP
Definition: JPTJetTester.h:64
MonitorElement * mpTResponse_nvtx_30_inf
Definition: JPTJetTester.h:112
MonitorElement * mpTScale1DF_600_1500
Definition: JPTJetTester.h:282
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
MonitorElement * mEScaleFineBin
Definition: JPTJetTester.h:252
MonitorElement * mPtFirst_80
Definition: JPTJetTester.h:150
MonitorElement * mpTScale1DE_200_600
Definition: JPTJetTester.h:278
MonitorElement * numberofevents
Definition: JPTJetTester.h:48
MonitorElement * mpTScalePhiB_d
Definition: JPTJetTester.h:260
MonitorElement * mPthat_3000
Definition: JPTJetTester.h:224
MonitorElement * mPhi
Definition: JPTJetTester.h:59
MonitorElement * mpTScale_600_1500_d
Definition: JPTJetTester.h:271
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
MonitorElement * mpTScale1DE_600_1500
Definition: JPTJetTester.h:281
MonitorElement * mGenPt
Definition: JPTJetTester.h:229
MonitorElement * mpTResponseF_d
Definition: JPTJetTester.h:96
Base class for all types of Jets.
Definition: Jet.h:21
MonitorElement * mpTScale_pT
Definition: JPTJetTester.h:141
MonitorElement * mpTScale_200_600_d
Definition: JPTJetTester.h:270
Definition: DDAxes.h:10
MonitorElement * mEta
Definition: JPTJetTester.h:51
MonitorElement * mpTRatio_200_600_d
Definition: JPTJetTester.h:90
MonitorElement * mE
Definition: JPTJetTester.h:61
MonitorElement * mpTResponseB_d
Definition: JPTJetTester.h:94
std::vector< CaloTower >::const_iterator const_iterator
MonitorElement * mpTResponse_nvtx_0_5
Definition: JPTJetTester.h:107
MonitorElement * mpTScale1DF_30_200
Definition: JPTJetTester.h:276
MonitorElement * mHadTiming
Definition: JPTJetTester.h:76
MonitorElement * mpTScalePhiE_d
Definition: JPTJetTester.h:261
MonitorElement * mpTScale_c_nvtx_20_30
Definition: JPTJetTester.h:127
MonitorElement * mpTScalePhiF_d
Definition: JPTJetTester.h:262
MonitorElement * mDeltaEta
Definition: JPTJetTester.h:245
MonitorElement * mpTRatio_30_200_d
Definition: JPTJetTester.h:89
MonitorElement * mpTScale_nvtx_20_30
Definition: JPTJetTester.h:135
virtual void scaleEnergy(double fScale)
scale energy of the jet
Definition: Jet.cc:445
MonitorElement * mpTResponse_nvtx_15_20
Definition: JPTJetTester.h:110
MonitorElement * mpTScale1DF_200_600
Definition: JPTJetTester.h:279
MonitorElement * mCorrJetPt
Definition: JPTJetTester.h:80
MonitorElement * mpTScale1DB_600_1500
Definition: JPTJetTester.h:280
MonitorElement * mpTScale1DF_1500_3500
Definition: JPTJetTester.h:285
MonitorElement * mMass
Definition: JPTJetTester.h:70
MonitorElement * mpTScale1DE_1500_3500
Definition: JPTJetTester.h:284
MonitorElement * mNJets1
Definition: JPTJetTester.h:156
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
MonitorElement * mpTScale1DE_30_200
Definition: JPTJetTester.h:275
std::string mTurnOnEverything
Definition: JPTJetTester.h:304
int njet
Definition: HydjetWrapper.h:91
bool isRealData() const
Definition: EventBase.h:60
MonitorElement * mNJetsEtaC
Definition: JPTJetTester.h:153
virtual double eta() const
momentum pseudorapidity
double double double z
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
MonitorElement * mpTScale_a_nvtx_30_inf
Definition: JPTJetTester.h:128
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
MonitorElement * mpTScale_b
Definition: JPTJetTester.h:139
virtual void endJob()
MonitorElement * mCorrJetPhi
Definition: JPTJetTester.h:84
void Fill(long long x)
MonitorElement * mPhiFirst
Definition: JPTJetTester.h:145
MonitorElement * mpTRatio_1500_3500_d
Definition: JPTJetTester.h:92
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
MonitorElement * mpTScale_c_nvtx_30_inf
Definition: JPTJetTester.h:130
virtual double energy() const
energy
MonitorElement * mpTScale_nvtx_5_10
Definition: JPTJetTester.h:132
MonitorElement * mpTRatioB_d
Definition: JPTJetTester.h:86
MonitorElement * mpTScale1DB_1500_3500
Definition: JPTJetTester.h:283
MonitorElement * mpTScale_a_nvtx_0_5
Definition: JPTJetTester.h:113
MonitorElement * mDelPhi
Definition: JPTJetTester.h:292
MonitorElement * mGenPt_80
Definition: JPTJetTester.h:230
MonitorElement * mDelEta
Definition: JPTJetTester.h:291
MonitorElement * mpTScale_b_nvtx_15_20
Definition: JPTJetTester.h:123
Jets made from CaloJets corrected for ZSP and tracks.
Definition: JPTJet.h:29
double pt() const
track transverse momentum
Definition: TrackBase.h:131
MonitorElement * mNJets2
Definition: JPTJetTester.h:157
MonitorElement * mpTScaleB_d
Definition: JPTJetTester.h:257
MonitorElement * mCorrJetPt_80
Definition: JPTJetTester.h:81
MonitorElement * mPt_80
Definition: JPTJetTester.h:68
int j
Definition: DBlmapReader.cc:9
Jets made from MC generator particles.
Definition: GenJet.h:25
MonitorElement * mpTResponse_30_d
Definition: JPTJetTester.h:101
MonitorElement * mGenPhi
Definition: JPTJetTester.h:228
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1031
MonitorElement * mpTResponse_30_200_d
Definition: JPTJetTester.h:97
MonitorElement * mEScale_pt10
Definition: JPTJetTester.h:251
tuple goodVertices
The Good vertices collection needed by the tracking failure filter ________||.
MonitorElement * mpTRatioE_d
Definition: JPTJetTester.h:87
MonitorElement * mEtaFineBin
Definition: JPTJetTester.h:52
MonitorElement * mpTScale_nvtx_15_20
Definition: JPTJetTester.h:134
bool isValid() const
Definition: HandleBase.h:76
MonitorElement * mpTScale_c_nvtx_5_10
Definition: JPTJetTester.h:118
MonitorElement * nvtx_0_60
Definition: JPTJetTester.h:106
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
MonitorElement * mpTRatioF_d
Definition: JPTJetTester.h:88
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
double mRThreshold
Definition: JPTJetTester.h:299
MonitorElement * mpTScale_nvtx_30_inf
Definition: JPTJetTester.h:136
MonitorElement * mNJetsEtaF_30
Definition: JPTJetTester.h:137
double getSumPt(const reco::TrackRefVector &tracks)
MonitorElement * mJetEnergyProfile
Definition: JPTJetTester.h:309
MonitorElement * mpTResponse
Definition: JPTJetTester.h:93
MonitorElement * mpTScale_b_nvtx_30_inf
Definition: JPTJetTester.h:129
MonitorElement * mpTScale_nvtx_0_5
Definition: JPTJetTester.h:131
MonitorElement * mpTRatio_600_1500_d
Definition: JPTJetTester.h:91
MonitorElement * mPthat_80
Definition: JPTJetTester.h:223
edm::InputTag mInputCollection
Definition: JPTJetTester.h:39
tuple tracks
Definition: testEve_cfg.py:39
virtual double pt() const
transverse momentum
MonitorElement * mNJetsEtaF
Definition: JPTJetTester.h:154
MonitorElement * mPtFirst_3000
Definition: JPTJetTester.h:151
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
Definition: JetCorrector.cc:51
MonitorElement * mpTScale_1500_3500_d
Definition: JPTJetTester.h:272
MonitorElement * mpTScale_a_nvtx_15_20
Definition: JPTJetTester.h:122
MonitorElement * mpTScale_b_nvtx_5_10
Definition: JPTJetTester.h:117
MonitorElement * mpTResponseE_d
Definition: JPTJetTester.h:95
MonitorElement * nvtx_0_30
Definition: JPTJetTester.h:105
std::string mOutputFile
Definition: JPTJetTester.h:41
MonitorElement * mpTScale_b_nvtx_10_15
Definition: JPTJetTester.h:120
std::string const & label() const
Definition: InputTag.h:25
MonitorElement * mpTResponse_nvtx_20_30
Definition: JPTJetTester.h:111
MonitorElement * mpTResponse_600_1500_d
Definition: JPTJetTester.h:99
MonitorElement * mE_80
Definition: JPTJetTester.h:62
MonitorElement * mGenEtaFirst
Definition: JPTJetTester.h:234
MonitorElement * mMjj_3000
Definition: JPTJetTester.h:161
tuple mass
Definition: scaleCards.py:27
MonitorElement * mDelPt
Definition: JPTJetTester.h:293
MonitorElement * mpTScale1DB_30_200
Definition: JPTJetTester.h:274
MonitorElement * mEmEnergyProfile
Definition: JPTJetTester.h:308
MonitorElement * mpTResponse_200_600_d
Definition: JPTJetTester.h:98
edm::InputTag mInputGenCollection
Definition: JPTJetTester.h:40
MonitorElement * mEmTiming
Definition: JPTJetTester.h:77
std::string JetCorrectionService
Definition: JPTJetTester.h:301
MonitorElement * mPhiFineBin
Definition: JPTJetTester.h:60
MonitorElement * mpTScale_nvtx_10_15
Definition: JPTJetTester.h:133
MonitorElement * mpTScale_c_nvtx_10_15
Definition: JPTJetTester.h:121
MonitorElement * mEtaFirst
Definition: JPTJetTester.h:144
MonitorElement * mGenEta
Definition: JPTJetTester.h:227
MonitorElement * mCorrJetEta
Definition: JPTJetTester.h:83
JPTJetTester(const edm::ParameterSet &)
Definition: JPTJetTester.cc:46
MonitorElement * mpTScale1DB_200_600
Definition: JPTJetTester.h:277
MonitorElement * mGenPhiFirst
Definition: JPTJetTester.h:235
virtual double phi() const
momentum azimuthal angle
void fillMatchHists(const reco::GenJet &fGenJet, const reco::JPTJet &fJPTJet, std::vector< reco::Vertex > goodVertices)
MonitorElement * mpTScale_c_nvtx_15_20
Definition: JPTJetTester.h:124
MonitorElement * mpTScale_30_200_d
Definition: JPTJetTester.h:269
MonitorElement * mpTScale_b_nvtx_0_5
Definition: JPTJetTester.h:114
MonitorElement * mpTScale_a_nvtx_10_15
Definition: JPTJetTester.h:119
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
MonitorElement * mpTScaleF_d
Definition: JPTJetTester.h:259
MonitorElement * mPt
Definition: JPTJetTester.h:67
MonitorElement * mHadEnergyProfile
Definition: JPTJetTester.h:307
MonitorElement * mDeltaPhi
Definition: JPTJetTester.h:246
MonitorElement * mpTRatio
Definition: JPTJetTester.h:85
virtual void analyze(const edm::Event &, const edm::EventSetup &)