00001
00002
00003
00004
00005
00006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00007 #include "FWCore/Framework/interface/Event.h"
00008 #include "DataFormats/Common/interface/Handle.h"
00009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00010 #include "FWCore/ServiceRegistry/interface/Service.h"
00011
00012 #include "DataFormats/Math/interface/deltaR.h"
00013
00014 #include "DQMServices/Core/interface/DQMStore.h"
00015 #include "DQMServices/Core/interface/MonitorElement.h"
00016
00017 #include "DataFormats/JetReco/interface/PFJet.h"
00018 #include "DataFormats/JetReco/interface/GenJet.h"
00019 #include "DataFormats/JetReco/interface/GenJetCollection.h"
00020
00021
00022 #include "DataFormats/METReco/interface/CaloMET.h"
00023 #include "DataFormats/METReco/interface/CaloMETCollection.h"
00024 #include "DataFormats/METReco/interface/GenMET.h"
00025 #include "DataFormats/METReco/interface/GenMETCollection.h"
00026 #include "DataFormats/METReco/interface/MET.h"
00027 #include "DataFormats/METReco/interface/METCollection.h"
00028
00029 #include "RecoJets/JetProducers/interface/JetMatchingTools.h"
00030
00031 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
00032
00033 #include "PFJetTester.h"
00034
00035 #include <cmath>
00036
00037 #include "JetMETCorrections/Objects/interface/JetCorrector.h"
00038
00039 using namespace edm;
00040 using namespace reco;
00041 using namespace std;
00042
00043 namespace {
00044 bool is_B (const reco::Jet& fJet) {return fabs (fJet.eta()) < 1.3;}
00045 bool is_E (const reco::Jet& fJet) {return fabs (fJet.eta()) >= 1.3 && fabs (fJet.eta()) < 3.;}
00046 bool is_F (const reco::Jet& fJet) {return fabs (fJet.eta()) >= 3.;}
00047 }
00048
00049 PFJetTester::PFJetTester(const edm::ParameterSet& iConfig)
00050 : mInputCollection (iConfig.getParameter<edm::InputTag>( "src" )),
00051 mInputGenCollection (iConfig.getParameter<edm::InputTag>( "srcGen" )),
00052 mOutputFile (iConfig.getUntrackedParameter<std::string>("outputFile", "")),
00053 mMatchGenPtThreshold (iConfig.getParameter<double>("genPtThreshold")),
00054 mGenEnergyFractionThreshold (iConfig.getParameter<double>("genEnergyFractionThreshold")),
00055 mReverseEnergyFractionThreshold (iConfig.getParameter<double>("reverseEnergyFractionThreshold")),
00056 mRThreshold (iConfig.getParameter<double>("RThreshold")),
00057 JetCorrectionService (iConfig.getParameter<std::string> ("JetCorrectionService" )),
00058 mTurnOnEverything (iConfig.getUntrackedParameter<std::string>("TurnOnEverything",""))
00059 {
00060 numberofevents
00061 = mEta = mEtaFineBin = mPhi = mPhiFineBin = mE = mE_80
00062 = mP = mP_80 = mPt = mPt_80
00063 = mMass = mMass_80 = mConstituents = mConstituents_80
00064 = mEtaFirst = mPhiFirst = mPtFirst = mPtFirst_80 = mPtFirst_3000
00065 = mMjj = mMjj_3000 = mDelEta = mDelPhi = mDelPt
00066
00067
00068 = mHadEnergyInHF = mHadEnergyInHF_80 = mHadEnergyInHF_3000
00069
00070
00071
00072 = mEmEnergyInHF = mEmEnergyInHF_80 = mEmEnergyInHF_3000
00073
00074
00075
00076
00077
00078 = mChargedEmEnergy_80 = mChargedHadronEnergy_80 = mNeutralEmEnergy_80 = mNeutralHadronEnergy_80
00079 = mChargedEmEnergy_3000 = mChargedHadronEnergy_3000 = mNeutralEmEnergy_3000 = mNeutralHadronEnergy_3000
00080 = mChargedEmEnergyFraction_B = mChargedEmEnergyFraction_E = mChargedEmEnergyFraction_F
00081 = mChargedHadronEnergyFraction_B = mChargedHadronEnergyFraction_E = mChargedHadronEnergyFraction_F
00082 = mNeutralEmEnergyFraction_B = mNeutralEmEnergyFraction_E = mNeutralEmEnergyFraction_F
00083 = mNeutralHadronEnergyFraction_B = mNeutralHadronEnergyFraction_E = mNeutralHadronEnergyFraction_F
00084
00085
00086 = mHadTiming = mEmTiming
00087 = mNJetsEtaC = mNJetsEtaF = mNJets1 = mNJets2
00088
00089
00090 = mDeltaEta = mDeltaPhi
00091
00092
00093 = mEScale_pt10 = mEScaleFineBin
00094
00095 = mpTScaleB_d = mpTScaleE_d = mpTScaleF_d
00096 = mpTScalePhiB_d = mpTScalePhiE_d = mpTScalePhiF_d
00097
00098 = mpTScale_30_200_d = mpTScale_200_600_d = mpTScale_600_1500_d = mpTScale_1500_3500_d
00099
00100 = mpTScale1DB_30_200 = mpTScale1DE_30_200 = mpTScale1DF_30_200
00101 = mpTScale1DB_200_600 = mpTScale1DE_200_600 = mpTScale1DF_200_600
00102 = mpTScale1DB_600_1500 = mpTScale1DE_600_1500 = mpTScale1DF_600_1500
00103 = mpTScale1DB_1500_3500 = mpTScale1DE_1500_3500 = mpTScale1DF_1500_3500
00104
00105
00106
00107
00108
00109 = mPthat_80 = mPthat_3000
00110
00111
00112 = mCorrJetPt =mCorrJetPt_80 =mCorrJetEta =mCorrJetPhi =mpTRatio =mpTResponse
00113 = mpTRatioB_d = mpTRatioE_d = mpTRatioF_d
00114 = mpTRatio_30_200_d = mpTRatio_200_600_d = mpTRatio_600_1500_d = mpTRatio_1500_3500_d
00115 = mpTResponseB_d = mpTResponseE_d = mpTResponseF_d
00116 = mpTResponse_30_200_d = mpTResponse_200_600_d = mpTResponse_600_1500_d = mpTResponse_1500_3500_d
00117 = mpTResponse_30_d =mjetArea
00118 = nvtx_0_30 = nvtx_0_60
00119 = mpTResponse_nvtx_0_5 = mpTResponse_nvtx_5_10 =mpTResponse_nvtx_10_15
00120 = mpTResponse_nvtx_15_20 = mpTResponse_nvtx_20_30 = mpTResponse_nvtx_30_inf
00121 = mpTScale_a_nvtx_0_5 = mpTScale_b_nvtx_0_5 = mpTScale_c_nvtx_0_5
00122 = mpTScale_a_nvtx_5_10 = mpTScale_b_nvtx_5_10 = mpTScale_c_nvtx_5_10
00123 = mpTScale_a_nvtx_10_15 = mpTScale_b_nvtx_10_15 = mpTScale_c_nvtx_10_15
00124 = mpTScale_a_nvtx_15_20 = mpTScale_b_nvtx_15_20 = mpTScale_c_nvtx_15_20
00125 = mpTScale_a_nvtx_20_30 = mpTScale_b_nvtx_20_30 = mpTScale_c_nvtx_20_30
00126 = mpTScale_a_nvtx_30_inf = mpTScale_b_nvtx_30_inf = mpTScale_c_nvtx_30_inf
00127 = mpTScale_nvtx_0_5 = mpTScale_nvtx_5_10 = mpTScale_nvtx_10_15
00128 = mpTScale_nvtx_15_20 = mpTScale_nvtx_20_30 = mpTScale_nvtx_30_inf
00129 = mNJetsEtaF_30
00130 = mpTScale_a = mpTScale_b = mpTScale_c = mpTScale_pT
00131 = 0;
00132
00133 DQMStore* dbe = &*edm::Service<DQMStore>();
00134 if (dbe) {
00135 dbe->setCurrentFolder("JetMET/RecoJetsV/PFJetTask_" + mInputCollection.label());
00136
00137 numberofevents = dbe->book1D("numberofevents","numberofevents", 3, 0 , 2);
00138
00139 mEta = dbe->book1D("Eta", "Eta", 120, -6, 6);
00140 mEtaFineBin = dbe->book1D("EtaFineBin_Pt10", "EtaFineBin_Pt10", 600, -6, 6);
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150 mPhi = dbe->book1D("Phi", "Phi", 70, -3.5, 3.5);
00151 mPhiFineBin = dbe->book1D("PhiFineBin_Pt10", "PhiFineBin_Pt10", 350, -3.5, 3.5);
00152
00153 mE = dbe->book1D("E", "E", 100, 0, 500);
00154 mE_80 = dbe->book1D("E_80", "E_80", 100, 0, 4000);
00155
00156 mP = dbe->book1D("P", "P", 100, 0, 500);
00157 mP_80 = dbe->book1D("P_80", "P_80", 100, 0, 4000);
00158
00159 mPt = dbe->book1D("Pt", "Pt", 100, 0, 150);
00160 mPt_80 = dbe->book1D("Pt_80", "Pt_80", 100, 0, 4000);
00161
00162 mMass = dbe->book1D("Mass", "Mass", 100, 0, 200);
00163 mMass_80 = dbe->book1D("Mass_80", "Mass_80", 100, 0, 500);
00164
00165 mConstituents = dbe->book1D("Constituents", "# of Constituents", 100, 0, 100);
00166 mConstituents_80 = dbe->book1D("Constituents_80", "# of Constituents_80", 40, 0, 40);
00167
00168 mEtaFirst = dbe->book1D("EtaFirst", "EtaFirst", 120, -6, 6);
00169 mPhiFirst = dbe->book1D("PhiFirst", "PhiFirst", 70, -3.5, 3.5);
00170 mPtFirst = dbe->book1D("PtFirst", "PtFirst", 100, 0, 50);
00171 mPtFirst_80 = dbe->book1D("PtFirst_80", "PtFirst_80", 100, 0, 140);
00172 mPtFirst_3000 = dbe->book1D("PtFirst_3000", "PtFirst_3000", 100, 0, 4000);
00173
00174 mMjj = dbe->book1D("Mjj", "Mjj", 100, 0, 2000);
00175 mMjj_3000 = dbe->book1D("Mjj_3000", "Mjj_3000", 100, 0, 10000);
00176 mDelEta = dbe->book1D("DelEta", "DelEta", 100, -.5, .5);
00177 mDelPhi = dbe->book1D("DelPhi", "DelPhi", 100, -.5, .5);
00178 mDelPt = dbe->book1D("DelPt", "DelPt", 100, -1, 1);
00179
00180
00181
00182
00183
00184 mHadEnergyInHF = dbe->book1D("HadEnergyInHF", "HadEnergyInHF", 100, 0, 2500);
00185 mHadEnergyInHF_80 = dbe->book1D("HadEnergyInHF_80", "HadEnergyInHF_80", 100, 0, 3000);
00186 mHadEnergyInHF_3000 = dbe->book1D("HadEnergyInHF_3000", "HadEnergyInHF_3000", 100, 0, 1800);
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198 mEmEnergyInHF = dbe->book1D("EmEnergyInHF", "EmEnergyInHF", 100, -20, 450);
00199 mEmEnergyInHF_80 = dbe->book1D("EmEnergyInHF_80", "EmEnergyInHF_80", 100, -20, 440);
00200 mEmEnergyInHF_3000 = dbe->book1D("EmEnergyInHF_3000", "EmEnergyInHF_3000", 100, -20, 190);
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221 mChargedEmEnergy_80 = dbe->book1D("ChargedEmEnergy_80","ChargedEmEnergy_80",100,0.,500.);
00222 mChargedHadronEnergy_80 = dbe->book1D("ChargedHadronEnergy_80","ChargedHadronEnergy_80",100,0.,500.);
00223 mNeutralEmEnergy_80 = dbe->book1D("NeutralEmEnergy_80","NeutralEmEnergy_80",100,0.,500.);
00224 mNeutralHadronEnergy_80 = dbe->book1D("NeutralHadronEnergy_80","NeutralHadronEnergy_80",100,0.,500.);
00225
00226 mChargedEmEnergy_3000 = dbe->book1D("ChargedEmEnergy_3000","ChargedEmEnergy_3000",100,0.,2000.);
00227 mChargedHadronEnergy_3000 = dbe->book1D("ChargedHadronEnergy_3000","ChargedHadronEnergy_3000",100,0.,2000.);
00228 mNeutralEmEnergy_3000 = dbe->book1D("NeutralEmEnergy_3000","NeutralEmEnergy_3000",100,0.,2000.);
00229 mNeutralHadronEnergy_3000 = dbe->book1D("NeutralHadronEnergy_3000","NeutralHadronEnergy_3000",100,0.,2000.);
00230
00231 mChargedEmEnergyFraction_B = dbe->book1D("ChargedEmEnergyFraction_B","ChargedEmEnergyFraction_B",120,-0.1,1.1);
00232 mChargedEmEnergyFraction_E = dbe->book1D("ChargedEmEnergyFraction_E","ChargedEmEnergyFraction_E",120,-0.1,1.1);
00233 mChargedEmEnergyFraction_F = dbe->book1D("ChargedEmEnergyFraction_F","ChargedEmEnergyFraction_F",120,-0.1,1.1);
00234 mChargedHadronEnergyFraction_B = dbe->book1D("ChargedHadronEnergyFraction_B","ChargedHadronEnergyFraction_B",120,-0.1,1.1);
00235 mChargedHadronEnergyFraction_E = dbe->book1D("ChargedHadronEnergyFraction_E","ChargedHadronEnergyFraction_E",120,-0.1,1.1);
00236 mChargedHadronEnergyFraction_F = dbe->book1D("ChargedHadronEnergyFraction_F","ChargedHadronEnergyFraction_F",120,-0.1,1.1);
00237 mNeutralEmEnergyFraction_B = dbe->book1D("NeutralEmEnergyFraction_B","NeutralEmEnergyFraction_B",120,-0.1,1.1);
00238 mNeutralEmEnergyFraction_E = dbe->book1D("NeutralEmEnergyFraction_E","NeutralEmEnergyFraction_E",120,-0.1,1.1);
00239 mNeutralEmEnergyFraction_F = dbe->book1D("NeutralEmEnergyFraction_F","NeutralEmEnergyFraction_F",120,-0.1,1.1);
00240 mNeutralHadronEnergyFraction_B = dbe->book1D("NeutralHadronEnergyFraction_B","NeutralHadronEnergyFraction_B",120,-0.1,1.1);
00241 mNeutralHadronEnergyFraction_E = dbe->book1D("NeutralHadronEnergyFraction_E","NeutralHadronEnergyFraction_E",120,-0.1,1.1);
00242 mNeutralHadronEnergyFraction_F = dbe->book1D("NeutralHadronEnergyFraction_F","NeutralHadronEnergyFraction_F",120,-0.1,1.1);
00243
00244 mGenEta = dbe->book1D("GenEta", "GenEta", 120, -6, 6);
00245 mGenPhi = dbe->book1D("GenPhi", "GenPhi", 70, -3.5, 3.5);
00246 mGenPt = dbe->book1D("GenPt", "GenPt", 100, 0, 150);
00247 mGenPt_80 = dbe->book1D("GenPt_80", "GenPt_80", 100, 0, 1500);
00248
00249 mGenEtaFirst = dbe->book1D("GenEtaFirst", "GenEtaFirst", 100, -5, 5);
00250 mGenPhiFirst = dbe->book1D("GenPhiFirst", "GenPhiFirst", 70, -3.5, 3.5);
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266 mHadTiming = dbe->book1D("HadTiming", "HadTiming", 75, -50, 100);
00267 mEmTiming = dbe->book1D("EMTiming", "EMTiming", 75, -50, 100);
00268
00269 mNJetsEtaC = dbe->book1D("NJetsEtaC_Pt10", "NJetsEtaC_Pt10", 15, 0, 15);
00270 mNJetsEtaF = dbe->book1D("NJetsEtaF_Pt10", "NJetsEtaF_Pt10", 15, 0, 15);
00271 mNJetsEtaF_30 = dbe->book1D("NJetsEtaF_Pt30", "NJetsEtaF_Pt30", 15, 0, 15);
00272
00273 mNJets1 = dbe->bookProfile("NJets1", "NJets1", 100, 0, 200, 100, 0, 50, "s");
00274 mNJets2 = dbe->bookProfile("NJets2", "NJets2", 100, 0, 4000, 100, 0, 50, "s");
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291 mPthat_80 = dbe->book1D("Pthat_80", "Pthat_80", 100, 0.0, 1000.0);
00292 mPthat_3000 = dbe->book1D("Pthat_3000", "Pthat_3000", 100, 1000.0, 4000.0);
00293
00294
00295 mCorrJetPt = dbe->book1D("CorrPt", "CorrPt", 100, 0, 150);
00296 mCorrJetPt_80 = dbe->book1D("CorrPt_80", "CorrPt_80", 100, 0, 4000);
00297 mCorrJetEta = dbe->book1D("CorrEta", "CorrEta", 120, -6, 6);
00298 mCorrJetPhi = dbe->book1D("CorrPhi", "CorrPhi", 70, -3.5, 3.5);
00299
00300 mjetArea = dbe->book1D("jetArea","jetArea",26,-0.5,12.5);
00301
00302
00303 nvtx_0_30 = dbe->book1D("nvtx_0_30","nvtx_0_30",31,-0.5,30.5);
00304 nvtx_0_60 = dbe->book1D("nvtx_0_60","nvtx_0_60",61,-0.5,60.5);
00305
00306
00307 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);
00308 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);
00309 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);
00310 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);
00311 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);
00312 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);
00313 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);
00314 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);
00315 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);
00316 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);
00317 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);
00318 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);
00319 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);
00320 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);
00321 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);
00322 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);
00323 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);
00324 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);
00325 mpTScale_a = dbe->book1D("mpTScale_a", "pTScale_a_60_120",100, 0, 2);
00326 mpTScale_b = dbe->book1D("mpTScale_b", "pTScale_b_200_300",100, 0, 2);
00327 mpTScale_c = dbe->book1D("mpTScale_c", "pTScale_c_600_900",100, 0, 2);
00328
00329 double log10PtMin = 0.5;
00330 double log10PtMax = 3.75;
00331 int log10PtBins = 26;
00332
00333
00334
00335 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};
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353 if (mTurnOnEverything.compare("yes")==0) {
00354
00355
00356
00357
00358 }
00359
00360
00361
00362
00363 if (mTurnOnEverything.compare("yes")==0) {
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392 }
00393
00394
00395
00396
00397
00398
00399
00400
00401 mpTScaleB_d = dbe->bookProfile("pTScaleB_d", "pTScale_d_0<|eta|<1.5",
00402 log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
00403 mpTScaleE_d = dbe->bookProfile("pTScaleE_d", "pTScale_d_1.5<|eta|<3.0",
00404 log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
00405 mpTScaleF_d = dbe->bookProfile("pTScaleF_d", "pTScale_d_3.0<|eta|<6.0",
00406 log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
00407 mpTScalePhiB_d = dbe->bookProfile("pTScalePhiB_d", "pTScalePhi_d_0<|eta|<1.5",
00408 70, -3.5, 3.5, 0, 2, " ");
00409 mpTScalePhiE_d = dbe->bookProfile("pTScalePhiE_d", "pTScalePhi_d_1.5<|eta|<3.0",
00410 70, -3.5, 3.5, 0, 2, " ");
00411 mpTScalePhiF_d = dbe->bookProfile("pTScalePhiF_d", "pTScalePhi_d_3.0<|eta|<6.0",
00412 70, -3.5, 3.5, 0, 2, " ");
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423 mpTScale_30_200_d = dbe->bookProfile("pTScale_30_200_d", "pTScale_d_30<pT<200",
00424 90,etaRange, 0., 2., " ");
00425 mpTScale_200_600_d = dbe->bookProfile("pTScale_200_600_d", "pTScale_d_200<pT<600",
00426 90,etaRange, 0., 2., " ");
00427 mpTScale_600_1500_d = dbe->bookProfile("pTScale_600_1500_d", "pTScale_d_600<pT<1500",
00428 90,etaRange, 0., 2., " ");
00429 mpTScale_1500_3500_d = dbe->bookProfile("pTScale_1500_3500_d", "pTScale_d_1500<pt<3500",
00430 90,etaRange, 0., 2., " ");
00431
00432 mpTScale1DB_30_200 = dbe->book1D("pTScale1DB_30_200", "pTScale_distribution_for_0<|eta|<1.5_30_200",
00433 100, 0, 2);
00434 mpTScale1DE_30_200 = dbe->book1D("pTScale1DE_30_200", "pTScale_distribution_for_1.5<|eta|<3.0_30_200",
00435 50, 0, 2);
00436 mpTScale1DF_30_200 = dbe->book1D("pTScale1DF_30_200", "pTScale_distribution_for_3.0<|eta|<6.0_30_200",
00437 50, 0, 2);
00438
00439 mpTScale1DB_200_600 = dbe->book1D("pTScale1DB_200_600", "pTScale_distribution_for_0<|eta|<1.5_200_600",
00440 100, 0, 2);
00441 mpTScale1DE_200_600 = dbe->book1D("pTScale1DE_200_600", "pTScale_distribution_for_1.5<|eta|<3.0_200_600",
00442 50, 0, 2);
00443 mpTScale1DF_200_600 = dbe->book1D("pTScale1DF_200_600", "pTScale_distribution_for_3.0<|eta|<6.0_200_600",
00444 50, 0, 2);
00445
00446 mpTScale1DB_600_1500 = dbe->book1D("pTScale1DB_600_1500", "pTScale_distribution_for_0<|eta|<1.5_600_1500",
00447 100, 0, 2);
00448 mpTScale1DE_600_1500 = dbe->book1D("pTScale1DE_600_1500", "pTScale_distribution_for_1.5<|eta|<3.0_600_1500",
00449 50, 0, 2);
00450 mpTScale1DF_600_1500 = dbe->book1D("pTScale1DF_600_1500", "pTScale_distribution_for_3.0<|eta|<6.0_600_1500",
00451 50, 0, 2);
00452
00453 mpTScale1DB_1500_3500 = dbe->book1D("pTScale1DB_1500_3500", "pTScale_distribution_for_0<|eta|<1.5_1500_3500",
00454 100, 0, 2);
00455 mpTScale1DE_1500_3500 = dbe->book1D("pTScale1DE_1500_3500", "pTScale_distribution_for_1.5<|eta|<3.0_1500_3500",
00456 50, 0, 2);
00457 mpTScale1DF_1500_3500 = dbe->book1D("pTScale1DF_1500_3500", "pTScale_distribution_for_3.0<|eta|<6.0_1500_3500",
00458 50, 0, 2);
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470 mpTScale_nvtx_0_5 = dbe->bookProfile("pTScale_nvtx_0_5", "pTScale_nvtx_0_5_0<|eta|<1.3",
00471 log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
00472 mpTScale_nvtx_5_10 = dbe->bookProfile("pTScale_nvtx_5_10", "pTScale_nvtx_5_10_0<|eta|<1.3",
00473 log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
00474 mpTScale_nvtx_10_15 = dbe->bookProfile("pTScale_nvtx_10_15", "pTScale_nvtx_10_15_0<|eta|<1.3",
00475 log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
00476 mpTScale_nvtx_15_20 = dbe->bookProfile("pTScale_nvtx_15_20", "pTScale_nvtx_15_20_0<|eta|<1.3",
00477 log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
00478 mpTScale_nvtx_20_30 = dbe->bookProfile("pTScale_nvtx_20_30", "pTScale_nvtx_20_30_0<|eta|<1.3",
00479 log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
00480 mpTScale_nvtx_30_inf = dbe->bookProfile("pTScale_nvtx_30_inf", "pTScale_nvtx_30_inf_0<|eta|<1.3",
00481 log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
00482 mpTScale_pT = dbe->bookProfile("pTScale_pT", "pTScale_vs_pT",
00483 log10PtBins, log10PtMin, log10PtMax, 0, 2, " ");
00485 mpTRatio = dbe->bookProfile("pTRatio", "pTRatio",
00486 log10PtBins, log10PtMin, log10PtMax, 100, 0.,5., " ");
00487 mpTRatioB_d = dbe->bookProfile("pTRatioB_d", "pTRatio_d_0<|eta|<1.5",
00488 log10PtBins, log10PtMin, log10PtMax, 0, 5, " ");
00489 mpTRatioE_d = dbe->bookProfile("pTRatioE_d", "pTRatio_d_1.5<|eta|<3.0",
00490 log10PtBins, log10PtMin, log10PtMax, 0, 5, " ");
00491 mpTRatioF_d = dbe->bookProfile("pTRatioF_d", "pTRatio_d_3.0<|eta|<6.0",
00492 log10PtBins, log10PtMin, log10PtMax, 0, 5, " ");
00493 mpTRatio_30_200_d = dbe->bookProfile("pTRatio_30_200_d", "pTRatio_d_30<pT<200",
00494 90,etaRange, 0., 5., " ");
00495 mpTRatio_200_600_d = dbe->bookProfile("pTRatio_200_600_d", "pTRatio_d_200<pT<600",
00496 90,etaRange, 0., 5., " ");
00497 mpTRatio_600_1500_d = dbe->bookProfile("pTRatio_600_1500_d", "pTRatio_d_600<pT<1500",
00498 90,etaRange, 0., 5., " "); mpTRatio_1500_3500_d = dbe->bookProfile("pTRatio_1500_3500_d", "pTRatio_d_1500<pt<3500",
00499 90,etaRange, 0., 5., " ");
00500 mpTResponse = dbe->bookProfile("pTResponse", "pTResponse",
00501 log10PtBins, log10PtMin, log10PtMax, 100, 0.8,1.2, " ");
00502 mpTResponseB_d = dbe->bookProfile("pTResponseB_d", "pTResponse_d_0<|eta|<1.5",
00503 log10PtBins, log10PtMin, log10PtMax, 0.8, 1.2, " ");
00504 mpTResponseE_d = dbe->bookProfile("pTResponseE_d", "pTResponse_d_1.5<|eta|<3.0",
00505 log10PtBins, log10PtMin, log10PtMax, 0.8, 1.2, " ");
00506 mpTResponseF_d = dbe->bookProfile("pTResponseF_d", "pTResponse_d_3.0<|eta|<6.0",
00507 log10PtBins, log10PtMin, log10PtMax, 0.8, 1.2, " ");
00508 mpTResponse_30_200_d = dbe->bookProfile("pTResponse_30_200_d", "pTResponse_d_30<pT<200",
00509 90,etaRange, 0.8, 1.2, " ");
00510 mpTResponse_200_600_d = dbe->bookProfile("pTResponse_200_600_d", "pTResponse_d_200<pT<600",
00511 90,etaRange, 0.8, 1.2, " ");
00512 mpTResponse_600_1500_d = dbe->bookProfile("pTResponse_600_1500_d", "pTResponse_d_600<pT<1500",
00513 90,etaRange, 0.8, 1.2, " ");
00514 mpTResponse_1500_3500_d = dbe->bookProfile("pTResponse_1500_3500_d", "pTResponse_d_1500<pt<3500",
00515 90,etaRange, 0.8, 1.2, " ");
00516 mpTResponse_30_d = dbe->bookProfile("pTResponse_30_d", "pTResponse_d_pt>30",
00517 90,etaRange, 0.8, 1.2, " ");
00518 mpTResponse_nvtx_0_5 = dbe->bookProfile("pTResponse_nvtx_0_5", "pTResponse_nvtx_0_5", log10PtBins, log10PtMin, log10PtMax, 100, 0.8,1.2, " ");
00519 mpTResponse_nvtx_5_10 = dbe->bookProfile("pTResponse_nvtx_5_10", "pTResponse_nvtx_5_10", log10PtBins, log10PtMin, log10PtMax, 100, 0.8,1.2, " ");
00520 mpTResponse_nvtx_10_15 = dbe->bookProfile("pTResponse_nvtx_10_15", "pTResponse_nvtx_10_15", log10PtBins, log10PtMin, log10PtMax, 100, 0.8,1.2, " ");
00521 mpTResponse_nvtx_15_20 = dbe->bookProfile("pTResponse_nvtx_15_20", "pTResponse_nvtx_15_20", log10PtBins, log10PtMin, log10PtMax, 100, 0.8,1.2, " ");
00522 mpTResponse_nvtx_20_30 = dbe->bookProfile("pTResponse_nvtx_20_30", "pTResponse_nvtx_20_30", log10PtBins, log10PtMin, log10PtMax, 100, 0.8,1.2, " ");
00523 mpTResponse_nvtx_30_inf = dbe->bookProfile("pTResponse_nvtx_30_inf", "pTResponse_nvtx_30_inf", log10PtBins, log10PtMin, log10PtMax, 100, 0.8,1.2, " ");
00524 }
00525
00526 if (mOutputFile.empty ()) {
00527 LogInfo("OutputInfo") << " PFJet histograms will NOT be saved";
00528 }
00529 else {
00530 LogInfo("OutputInfo") << " PFJethistograms will be saved to file:" << mOutputFile;
00531 }
00532 }
00533
00534 PFJetTester::~PFJetTester()
00535 {
00536 }
00537
00538 void PFJetTester::beginJob(){
00539 }
00540
00541 void PFJetTester::endJob() {
00542 if (!mOutputFile.empty() && &*edm::Service<DQMStore>()) edm::Service<DQMStore>()->save (mOutputFile);
00543 }
00544
00545
00546 void PFJetTester::analyze(const edm::Event& mEvent, const edm::EventSetup& mSetup)
00547 {
00548 double countsfornumberofevents = 1;
00549 numberofevents->Fill(countsfornumberofevents);
00550
00551
00552 edm::Handle<vector<reco::Vertex> >pvHandle;
00553 try {
00554 mEvent.getByLabel( "offlinePrimaryVertices", pvHandle );
00555 } catch ( cms::Exception & e ) {
00556
00557 }
00558 vector<reco::Vertex> goodVertices;
00559 for (unsigned i = 0; i < pvHandle->size(); i++) {
00560 if ( (*pvHandle)[i].ndof() > 4 &&
00561 ( fabs((*pvHandle)[i].z()) <= 24. ) &&
00562 ( fabs((*pvHandle)[i].position().rho()) <= 2.0 ) )
00563 goodVertices.push_back((*pvHandle)[i]);
00564 }
00565
00566 nvtx_0_30->Fill(goodVertices.size());
00567 nvtx_0_60->Fill(goodVertices.size());
00568
00569
00570
00571
00572 if (!mEvent.isRealData()){
00573 edm::Handle<HepMCProduct> evt;
00574 mEvent.getByLabel("generator", evt);
00575 if (evt.isValid()) {
00576 HepMC::GenEvent * myGenEvent = new HepMC::GenEvent(*(evt->GetEvent()));
00577
00578 double pthat = myGenEvent->event_scale();
00579
00580 mPthat_80->Fill(pthat);
00581 mPthat_3000->Fill(pthat);
00582
00583 delete myGenEvent;
00584 }
00585 }
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624 Handle<CaloTowerCollection> caloTowers;
00625 mEvent.getByLabel( "towerMaker", caloTowers );
00626 if (caloTowers.isValid()) {
00627 for( CaloTowerCollection::const_iterator cal = caloTowers->begin(); cal != caloTowers->end(); ++ cal ){
00628
00629
00630 if (mTurnOnEverything.compare("yes")==0) {
00631
00632
00633
00634
00635
00636
00637 }
00638
00639 mHadTiming->Fill (cal->hcalTime());
00640 mEmTiming->Fill (cal->ecalTime());
00641 }
00642 }
00643
00644
00645
00646
00647 try {
00648 std::vector<edm::Handle<HBHERecHitCollection> > colls;
00649 mEvent.getManyByType(colls);
00650 std::vector<edm::Handle<HBHERecHitCollection> >::iterator i;
00651 for (i=colls.begin(); i!=colls.end(); i++) {
00652 for (HBHERecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664 }
00665 }
00666 } catch (...) {
00667 edm::LogInfo("OutputInfo") << " No HB/HE RecHits.";
00668 }
00669
00670 try {
00671 std::vector<edm::Handle<HFRecHitCollection> > colls;
00672 mEvent.getManyByType(colls);
00673 std::vector<edm::Handle<HFRecHitCollection> >::iterator i;
00674 for (i=colls.begin(); i!=colls.end(); i++) {
00675 for (HFRecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
00676
00677
00678
00679
00680
00681
00682
00683 }
00684 }
00685 } catch (...) {
00686 edm::LogInfo("OutputInfo") << " No HF RecHits.";
00687 }
00688
00689 try {
00690 std::vector<edm::Handle<HORecHitCollection> > colls;
00691 mEvent.getManyByType(colls);
00692 std::vector<edm::Handle<HORecHitCollection> >::iterator i;
00693 for (i=colls.begin(); i!=colls.end(); i++) {
00694 for (HORecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
00695
00696
00697
00698
00699
00700
00701 }
00702 }
00703 } catch (...) {
00704 edm::LogInfo("OutputInfo") << " No HO RecHits.";
00705 }
00706 try {
00707 std::vector<edm::Handle<EBRecHitCollection> > colls;
00708 mEvent.getManyByType(colls);
00709 std::vector<edm::Handle<EBRecHitCollection> >::iterator i;
00710 for (i=colls.begin(); i!=colls.end(); i++) {
00711 for (EBRecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
00712
00713
00714
00715
00716
00717
00718 }
00719 }
00720 } catch (...) {
00721 edm::LogInfo("OutputInfo") << " No EB RecHits.";
00722 }
00723
00724 try {
00725 std::vector<edm::Handle<EERecHitCollection> > colls;
00726 mEvent.getManyByType(colls);
00727 std::vector<edm::Handle<EERecHitCollection> >::iterator i;
00728 for (i=colls.begin(); i!=colls.end(); i++) {
00729 for (EERecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
00730
00731
00732
00733
00734
00735 }
00736 }
00737 } catch (...) {
00738 edm::LogInfo("OutputInfo") << " No EE RecHits.";
00739 }
00740
00741
00742
00743
00744
00745 math::XYZTLorentzVector p4tmp[2];
00746 Handle<PFJetCollection> pfJets;
00747 mEvent.getByLabel(mInputCollection, pfJets);
00748 if (!pfJets.isValid()) return;
00749 PFJetCollection::const_iterator jet = pfJets->begin ();
00750 int jetIndex = 0;
00751 int nJet = 0;
00752 int nJetF = 0;
00753 int nJetC = 0;
00754 int nJetF_30 =0;
00755 for (; jet != pfJets->end (); jet++, jetIndex++) {
00756
00757 if (jet->pt() > 10.) {
00758 if (fabs(jet->eta()) > 1.5)
00759 nJetF++;
00760 else
00761 nJetC++;
00762 }
00763 if (jet->pt() > 30.) nJetF_30++;
00764 if (jet->pt() > 10.) {
00765 if (mEta) mEta->Fill (jet->eta());
00766 if (mEtaFineBin) mEtaFineBin->Fill (jet->eta());
00767
00768
00769
00770
00771
00772
00773 if (mPhiFineBin) mPhiFineBin->Fill (jet->phi());
00774 }
00775 if (mjetArea) mjetArea->Fill(jet->jetArea());
00776 if (mPhi) mPhi->Fill (jet->phi());
00777 if (mE) mE->Fill (jet->energy());
00778 if (mE_80) mE_80->Fill (jet->energy());
00779 if (mP) mP->Fill (jet->p());
00780 if (mP_80) mP_80->Fill (jet->p());
00781 if (mPt) mPt->Fill (jet->pt());
00782 if (mPt_80) mPt_80->Fill (jet->pt());
00783 if (mMass) mMass->Fill (jet->mass());
00784 if (mMass_80) mMass_80->Fill (jet->mass());
00785 if (mConstituents) mConstituents->Fill (jet->nConstituents());
00786 if (mConstituents_80) mConstituents_80->Fill (jet->nConstituents());
00787 if (jet == pfJets->begin ()) {
00788 if (mEtaFirst) mEtaFirst->Fill (jet->eta());
00789 if (mPhiFirst) mPhiFirst->Fill (jet->phi());
00790 if (mPtFirst) mPtFirst->Fill (jet->pt());
00791 if (mPtFirst_80) mPtFirst_80->Fill (jet->pt());
00792 if (mPtFirst_3000) mPtFirst_3000->Fill (jet->pt());
00793 }
00794 if (jetIndex == 0) {
00795 nJet++;
00796 p4tmp[0] = jet->p4();
00797 }
00798 if (jetIndex == 1) {
00799 nJet++;
00800 p4tmp[1] = jet->p4();
00801 }
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811 if (mHadEnergyInHF) mHadEnergyInHF->Fill (jet->HFHadronEnergy());
00812 if (mHadEnergyInHF_80) mHadEnergyInHF_80->Fill (jet->HFHadronEnergy());
00813 if (mHadEnergyInHF_3000) mHadEnergyInHF_3000->Fill (jet->HFHadronEnergy());
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823 if (mEmEnergyInHF) mEmEnergyInHF->Fill (jet->HFEMEnergy());
00824 if (mEmEnergyInHF_80) mEmEnergyInHF_80->Fill (jet->HFEMEnergy());
00825 if (mEmEnergyInHF_3000) mEmEnergyInHF_3000->Fill (jet->HFEMEnergy());
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839 if (mChargedEmEnergy_80) mChargedEmEnergy_80->Fill (jet->chargedEmEnergy());
00840 if (mChargedHadronEnergy_80) mChargedHadronEnergy_80->Fill (jet->chargedHadronEnergy());
00841 if (mNeutralEmEnergy_80) mNeutralEmEnergy_80->Fill (jet->neutralEmEnergy());
00842 if (mNeutralHadronEnergy_80) mNeutralHadronEnergy_80->Fill (jet->neutralHadronEnergy());
00843
00844 if (mChargedEmEnergy_3000) mChargedEmEnergy_3000->Fill (jet->chargedEmEnergy());
00845 if (mChargedHadronEnergy_3000) mChargedHadronEnergy_3000->Fill (jet->chargedHadronEnergy());
00846 if (mNeutralEmEnergy_3000) mNeutralEmEnergy_3000->Fill (jet->neutralEmEnergy());
00847 if (mNeutralHadronEnergy_3000) mNeutralHadronEnergy_3000->Fill (jet->neutralHadronEnergy());
00848
00849 if (fabs(jet->eta())<1.5) mChargedEmEnergyFraction_B->Fill (jet->chargedEmEnergyFraction());
00850 if (fabs(jet->eta())>1.5 && fabs(jet->eta())<3.0) mChargedEmEnergyFraction_E->Fill (jet->chargedEmEnergyFraction());
00851 if (fabs(jet->eta())>3.0 && fabs(jet->eta())<6.0) mChargedEmEnergyFraction_F->Fill (jet->chargedEmEnergyFraction());
00852 if (fabs(jet->eta())<1.5) mChargedHadronEnergyFraction_B->Fill (jet->chargedHadronEnergyFraction());
00853 if (fabs(jet->eta())>1.5 && fabs(jet->eta())<3.0) mChargedHadronEnergyFraction_E->Fill (jet->chargedHadronEnergyFraction());
00854 if (fabs(jet->eta())>3.0 && fabs(jet->eta())<6.0) mChargedHadronEnergyFraction_F->Fill (jet->chargedHadronEnergyFraction());
00855 if (fabs(jet->eta())<1.5) mNeutralEmEnergyFraction_B->Fill (jet->neutralEmEnergyFraction());
00856 if (fabs(jet->eta())>1.5 && fabs(jet->eta())<3.0) mNeutralEmEnergyFraction_E->Fill (jet->neutralEmEnergyFraction());
00857 if (fabs(jet->eta())>3.0 && fabs(jet->eta())<6.0) mNeutralEmEnergyFraction_F->Fill (jet->neutralEmEnergyFraction());
00858 if (fabs(jet->eta())<1.5) mNeutralHadronEnergyFraction_B->Fill (jet->neutralHadronEnergyFraction());
00859 if (fabs(jet->eta())>1.5 && fabs(jet->eta())<3.0) mNeutralHadronEnergyFraction_E->Fill (jet->neutralHadronEnergyFraction());
00860 if (fabs(jet->eta())>3.0 && fabs(jet->eta())<6.0) mNeutralHadronEnergyFraction_F->Fill (jet->neutralHadronEnergyFraction());
00861
00862
00863
00864
00865
00866 }
00867
00868 if (mNJetsEtaC) mNJetsEtaC->Fill( nJetC );
00869 if (mNJetsEtaF) mNJetsEtaF->Fill( nJetF );
00870 if (mNJetsEtaF_30) mNJetsEtaF_30->Fill( nJetF_30 );
00871
00872 if (nJet == 2) {
00873 if (mMjj) mMjj->Fill( (p4tmp[0]+p4tmp[1]).mass() );
00874 if (mMjj_3000) mMjj_3000->Fill( (p4tmp[0]+p4tmp[1]).mass() );
00875 }
00876
00877
00878 for (int istep = 0; istep < 100; ++istep) {
00879 int njet = 0;
00880 float ptStep = (istep * (200./100.));
00881
00882 for ( PFJetCollection::const_iterator cal = pfJets->begin(); cal != pfJets->end(); ++ cal ) {
00883 if ( cal->pt() > ptStep ) njet++;
00884 }
00885 mNJets1->Fill( ptStep, njet );
00886 }
00887
00888 for (int istep = 0; istep < 100; ++istep) {
00889 int njet = 0;
00890 float ptStep = (istep * (4000./100.));
00891 for ( PFJetCollection::const_iterator cal = pfJets->begin(); cal != pfJets->end(); ++ cal ) {
00892 if ( cal->pt() > ptStep ) njet++;
00893 }
00894 mNJets2->Fill( ptStep, njet );
00895 }
00896
00897
00898 const JetCorrector* corrector = JetCorrector::getJetCorrector (JetCorrectionService,mSetup);
00899
00900 for (PFJetCollection::const_iterator jet = pfJets->begin(); jet !=pfJets ->end(); jet++)
00901 {
00902
00903 PFJet correctedJet = *jet;
00904
00905 double scale = corrector->correction(*jet,mEvent,mSetup);
00906 correctedJet.scaleEnergy(scale);
00907 if(correctedJet.pt()>30){
00908 mCorrJetPt->Fill(correctedJet.pt());
00909 mCorrJetPt_80->Fill(correctedJet.pt());
00910 if(correctedJet.pt()>10) mCorrJetEta->Fill(correctedJet.eta());
00911 mCorrJetPhi->Fill(correctedJet.phi());
00912 mpTRatio->Fill(log10(jet->pt()),correctedJet.pt()/jet->pt());
00913
00914 if (fabs(jet->eta())<1.5) {
00915 mpTRatioB_d->Fill(log10(jet->pt()), correctedJet.pt()/jet->pt());
00916 }
00917
00918 if (fabs(jet->eta())>1.5 && fabs(jet->eta())<3.0) {
00919 mpTRatioE_d->Fill (log10(jet->pt()), correctedJet.pt()/jet->pt());
00920 }
00921 if (fabs(jet->eta())>3.0 && fabs(jet->eta())<6.0) {
00922 mpTRatioF_d->Fill (log10(jet->pt()), correctedJet.pt()/jet->pt());
00923 }
00924 if (jet->pt()>30.0 && jet->pt()<200.0) {
00925 mpTRatio_30_200_d->Fill (jet->eta(),correctedJet.pt()/jet->pt());
00926 }
00927 if (jet->pt()>200.0 && jet->pt()<600.0) {
00928 mpTRatio_200_600_d->Fill (jet->eta(),correctedJet.pt()/jet->pt());
00929 }
00930 if (jet->pt()>600.0 && jet->pt()<1500.0) {
00931 mpTRatio_600_1500_d->Fill (jet->eta(),correctedJet.pt()/jet->pt());
00932 }
00933 if (jet->pt()>1500.0 && jet->pt()<3500.0) {
00934 mpTRatio_1500_3500_d->Fill (jet->eta(),correctedJet.pt()/jet->pt());
00935 }
00936 }
00937
00938
00939
00940 }
00941
00942 if (!mEvent.isRealData()){
00943
00944 Handle<GenJetCollection> genJets;
00945 mEvent.getByLabel(mInputGenCollection, genJets);
00946 if (!genJets.isValid()) return;
00947 GenJetCollection::const_iterator gjet = genJets->begin ();
00948 int gjetIndex = 0;
00949 for (; gjet != genJets->end (); gjet++, gjetIndex++) {
00950 if (mGenEta) mGenEta->Fill (gjet->eta());
00951 if (mGenPhi) mGenPhi->Fill (gjet->phi());
00952 if (mGenPt) mGenPt->Fill (gjet->pt());
00953 if (mGenPt_80) mGenPt_80->Fill (gjet->pt());
00954 if (gjet == genJets->begin ()) {
00955 if (mGenEtaFirst) mGenEtaFirst->Fill (gjet->eta());
00956 if (mGenPhiFirst) mGenPhiFirst->Fill (gjet->phi());
00957 }
00958 }
00959
00960
00961
00962 JetMatchingTools jetMatching (mEvent);
00963 if (!(mInputGenCollection.label().empty())) {
00964
00965
00966
00967 std::vector <std::vector <const reco::GenParticle*> > genJetConstituents (genJets->size());
00968 std::vector <std::vector <const reco::GenParticle*> > pfJetConstituents (pfJets->size());
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983 for (unsigned iGenJet = 0; iGenJet < genJets->size(); ++iGenJet) {
00984
00985 const GenJet& genJet = (*genJets) [iGenJet];
00986 double genJetPt = genJet.pt();
00987
00988
00989
00990 if (fabs(genJet.eta()) > 6.) continue;
00991 if (genJetPt < mMatchGenPtThreshold) continue;
00992
00993
00994
00995 if (pfJets->size() <= 0) continue;
00996 if (mRThreshold > 0) {
00997 unsigned iPFJetBest = 0;
00998 double deltaRBest = 999.;
00999 for (unsigned iPFJet = 0; iPFJet < pfJets->size(); ++iPFJet) {
01000 double dR = deltaR (genJet.eta(), genJet.phi(), (*pfJets) [iPFJet].eta(), (*pfJets) [iPFJet].phi());
01001 if (deltaRBest < mRThreshold && dR < mRThreshold && genJet.pt() > 5.) {
01002
01003
01004
01005
01006
01007
01008 }
01009 if (dR < deltaRBest) {
01010 iPFJetBest = iPFJet;
01011 deltaRBest = dR;
01012 }
01013 }
01014 if (mTurnOnEverything.compare("yes")==0) {
01015
01016 }
01017 if (deltaRBest < mRThreshold) {
01018 fillMatchHists (genJet, (*pfJets) [iPFJetBest],goodVertices);
01019 }
01020
01022 double CorrdeltaRBest = 999.;
01023 double CorrJetPtBest = 0;
01024 for (PFJetCollection::const_iterator jet = pfJets->begin(); jet !=pfJets ->end(); jet++) {
01025 PFJet correctedJet = *jet;
01026
01027 double scale = corrector->correction(*jet,mEvent,mSetup);
01028 correctedJet.scaleEnergy(scale);
01029 double CorrJetPt = correctedJet.pt();
01030 if(CorrJetPt>30){
01031 double CorrdR = deltaR (genJet.eta(), genJet.phi(), correctedJet.eta(), correctedJet.phi());
01032 if (CorrdR < CorrdeltaRBest) {
01033 CorrdeltaRBest = CorrdR;
01034 CorrJetPtBest = CorrJetPt;
01035 }
01036 }
01037 }
01038 if (deltaRBest < mRThreshold) {
01039 mpTResponse->Fill(log10(genJet.pt()),CorrJetPtBest/genJet.pt());
01040
01041 if (fabs(genJet.eta())<1.5) {
01042 mpTResponseB_d->Fill(log10(genJet.pt()), CorrJetPtBest/genJet.pt());
01043 }
01044
01045 if (fabs(genJet.eta())>1.5 && fabs(genJet.eta())<3.0) {
01046 mpTResponseE_d->Fill (log10(genJet.pt()), CorrJetPtBest/genJet.pt());
01047 }
01048 if (fabs(genJet.eta())>3.0 && fabs(genJet.eta())<6.0) {
01049 mpTResponseF_d->Fill (log10(genJet.pt()), CorrJetPtBest/genJet.pt());
01050 }
01051 if (genJet.pt()>30.0 && genJet.pt()<200.0) {
01052 mpTResponse_30_200_d->Fill (genJet.eta(),CorrJetPtBest/genJet.pt());
01053 }
01054 if (genJet.pt()>200.0 && genJet.pt()<600.0) {
01055 mpTResponse_200_600_d->Fill (genJet.eta(),CorrJetPtBest/genJet.pt());
01056 }
01057 if (genJet.pt()>600.0 && genJet.pt()<1500.0) {
01058 mpTResponse_600_1500_d->Fill (genJet.eta(),CorrJetPtBest/genJet.pt());
01059 }
01060 if (genJet.pt()>1500.0 && genJet.pt()<3500.0) {
01061 mpTResponse_1500_3500_d->Fill (genJet.eta(),CorrJetPtBest/genJet.pt());
01062 }
01063 if (genJet.pt()>30.0) {
01064 mpTResponse_30_d->Fill (genJet.eta(),CorrJetPtBest/genJet.pt());
01065 }
01066 if(goodVertices.size()<=5) mpTResponse_nvtx_0_5->Fill(log10(genJet.pt()),CorrJetPtBest/genJet.pt());
01067 if(goodVertices.size()>5 && goodVertices.size()<=10) mpTResponse_nvtx_5_10->Fill(log10(genJet.pt()),CorrJetPtBest/genJet.pt());
01068 if(goodVertices.size()>10 && goodVertices.size()<=15) mpTResponse_nvtx_10_15->Fill(log10(genJet.pt()),CorrJetPtBest/genJet.pt());
01069 if(goodVertices.size()>15 && goodVertices.size()<=20) mpTResponse_nvtx_15_20->Fill(log10(genJet.pt()),CorrJetPtBest/genJet.pt());
01070 if(goodVertices.size()>20 && goodVertices.size()<=30) mpTResponse_nvtx_20_30->Fill(log10(genJet.pt()),CorrJetPtBest/genJet.pt());
01071 if(goodVertices.size()>30) mpTResponse_nvtx_30_inf->Fill(log10(genJet.pt()),CorrJetPtBest/genJet.pt());
01072 }
01074
01075 }
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103 }
01104 }
01105 }
01106
01107 }
01108
01109 void PFJetTester::fillMatchHists (const reco::GenJet& fGenJet, const reco::PFJet& fPFJet,std::vector<reco::Vertex> goodVertices) {
01110 double logPtGen = log10 (fGenJet.pt());
01111 double PtGen = fGenJet.pt();
01112 double PtPF = fPFJet.pt();
01113
01114
01115
01116 double PtThreshold = 10.;
01117
01118 if (mTurnOnEverything.compare("yes")==0) {
01119 mDeltaEta->Fill (logPtGen, fGenJet.eta(), fPFJet.eta()-fGenJet.eta());
01120 mDeltaPhi->Fill (logPtGen, fGenJet.eta(), fPFJet.phi()-fGenJet.phi());
01121
01122
01123
01124
01125 mEScaleFineBin->Fill (logPtGen, fGenJet.eta(), fPFJet.energy()/fGenJet.energy());
01126
01127 if (fGenJet.pt()>PtThreshold) {
01128 mEScale_pt10->Fill (logPtGen, fGenJet.eta(), fPFJet.energy()/fGenJet.energy());
01129
01130 }
01131
01132 }
01133 if (fPFJet.pt() > PtThreshold) {
01134 mDelEta->Fill (fGenJet.eta()-fPFJet.eta());
01135 mDelPhi->Fill (fGenJet.phi()-fPFJet.phi());
01136 mDelPt->Fill ((fGenJet.pt()-fPFJet.pt())/fGenJet.pt());
01137 }
01138
01139 if (fabs(fGenJet.eta())<1.5) {
01140
01141
01142 mpTScaleB_d->Fill (log10(PtGen), PtPF/PtGen);
01143 mpTScalePhiB_d->Fill (fGenJet.phi(), PtPF/PtGen);
01144
01145 if (PtGen>30.0 && PtGen<200.0) {
01146 mpTScale1DB_30_200->Fill (fPFJet.pt()/fGenJet.pt());
01147 }
01148 if (PtGen>200.0 && PtGen<600.0) {
01149 mpTScale1DB_200_600->Fill (fPFJet.pt()/fGenJet.pt());
01150 }
01151 if (PtGen>600.0 && PtGen<1500.0) {
01152 mpTScale1DB_600_1500->Fill (fPFJet.pt()/fGenJet.pt());
01153 }
01154 if (PtGen>1500.0 && PtGen<3500.0) {
01155 mpTScale1DB_1500_3500->Fill (fPFJet.pt()/fGenJet.pt());
01156 }
01157
01158 }
01159
01160 if (fabs(fGenJet.eta())>1.5 && fabs(fGenJet.eta())<3.0) {
01161
01162
01163 mpTScaleE_d->Fill (log10(PtGen), PtPF/PtGen);
01164 mpTScalePhiE_d->Fill (fGenJet.phi(), PtPF/PtGen);
01165
01166 if (PtGen>30.0 && PtGen<200.0) {
01167 mpTScale1DE_30_200->Fill (fPFJet.pt()/fGenJet.pt());
01168 }
01169 if (PtGen>200.0 && PtGen<600.0) {
01170 mpTScale1DE_200_600->Fill (fPFJet.pt()/fGenJet.pt());
01171 }
01172 if (PtGen>600.0 && PtGen<1500.0) {
01173 mpTScale1DE_600_1500->Fill (fPFJet.pt()/fGenJet.pt());
01174 }
01175 if (PtGen>1500.0 && PtGen<3500.0) {
01176 mpTScale1DE_1500_3500->Fill (fPFJet.pt()/fGenJet.pt());
01177 }
01178
01179 }
01180
01181 if (fabs(fGenJet.eta())>3.0 && fabs(fGenJet.eta())<6.0) {
01182
01183
01184 mpTScaleF_d->Fill (log10(PtGen), PtPF/PtGen);
01185 mpTScalePhiF_d->Fill (fGenJet.phi(), PtPF/PtGen);
01186
01187 if (PtGen>30.0 && PtGen<200.0) {
01188 mpTScale1DF_30_200->Fill (fPFJet.pt()/fGenJet.pt());
01189 }
01190 if (PtGen>200.0 && PtGen<600.0) {
01191 mpTScale1DF_200_600->Fill (fPFJet.pt()/fGenJet.pt());
01192 }
01193 if (PtGen>600.0 && PtGen<1500.0) {
01194 mpTScale1DF_600_1500->Fill (fPFJet.pt()/fGenJet.pt());
01195 }
01196 if (PtGen>1500.0 && PtGen<3500.0) {
01197 mpTScale1DF_1500_3500->Fill (fPFJet.pt()/fGenJet.pt());
01198 }
01199
01200 }
01201
01202 if (fGenJet.pt()>30.0 && fGenJet.pt()<200.0) {
01203
01204 mpTScale_30_200_d->Fill (fGenJet.eta(),fPFJet.pt()/fGenJet.pt());
01205
01206 }
01207
01208 if (fGenJet.pt()>200.0 && fGenJet.pt()<600.0) {
01209
01210 mpTScale_200_600_d->Fill (fGenJet.eta(),fPFJet.pt()/fGenJet.pt());
01211
01212 }
01213
01214 if (fGenJet.pt()>600.0 && fGenJet.pt()<1500.0) {
01215
01216 mpTScale_600_1500_d->Fill (fGenJet.eta(),fPFJet.pt()/fGenJet.pt());
01217
01218 }
01219
01220 if (fGenJet.pt()>1500.0 && fGenJet.pt()<3500.0) {
01221
01222 mpTScale_1500_3500_d->Fill (fGenJet.eta(),fPFJet.pt()/fGenJet.pt());
01223
01224 }
01225 if (fabs(fGenJet.eta())<1.3) {
01226 if(fGenJet.pt()>60.0 && fGenJet.pt()<120.0) {
01227 if(goodVertices.size()<=5) mpTScale_a_nvtx_0_5->Fill( PtPF/PtGen);
01228 }
01229 if(fGenJet.pt()>200.0 && fGenJet.pt()<300.0) {
01230 if(goodVertices.size()<=5) mpTScale_b_nvtx_0_5->Fill( PtPF/PtGen);
01231 }
01232 if(fGenJet.pt()>600.0 && fGenJet.pt()<900.0) {
01233 if(goodVertices.size()<=5) mpTScale_c_nvtx_0_5->Fill( PtPF/PtGen);
01234 }
01235
01236 if(fGenJet.pt()>60.0 && fGenJet.pt()<120.0) {
01237 if(goodVertices.size()>5 && goodVertices.size()<=10) mpTScale_a_nvtx_5_10->Fill( PtPF/PtGen);
01238 }
01239 if(fGenJet.pt()>200.0 && fGenJet.pt()<300.0) {
01240 if(goodVertices.size()>5 && goodVertices.size()<=10) mpTScale_b_nvtx_5_10->Fill( PtPF/PtGen);
01241 }
01242 if(fGenJet.pt()>600.0 && fGenJet.pt()<900.0) {
01243 if(goodVertices.size()>5 && goodVertices.size()<=10) mpTScale_c_nvtx_5_10->Fill( PtPF/PtGen);
01244 }
01245
01246 if(fGenJet.pt()>60.0 && fGenJet.pt()<120.0) {
01247 if(goodVertices.size()>10 && goodVertices.size()<=15) mpTScale_a_nvtx_10_15->Fill( PtPF/PtGen);
01248 }
01249 if(fGenJet.pt()>200.0 && fGenJet.pt()<300.0) {
01250 if(goodVertices.size()>10 && goodVertices.size()<=15) mpTScale_b_nvtx_10_15->Fill( PtPF/PtGen);
01251 }
01252 if(fGenJet.pt()>600.0 && fGenJet.pt()<900.0) {
01253 if(goodVertices.size()>10 && goodVertices.size()<=15) mpTScale_c_nvtx_10_15->Fill( PtPF/PtGen);
01254 }
01255
01256 if(fGenJet.pt()>60.0 && fGenJet.pt()<120.0) {
01257 if(goodVertices.size()>15 && goodVertices.size()<=20) mpTScale_a_nvtx_15_20->Fill( PtPF/PtGen);
01258 }
01259 if(fGenJet.pt()>200.0 && fGenJet.pt()<300.0) {
01260 if(goodVertices.size()>15 && goodVertices.size()<=20) mpTScale_b_nvtx_15_20->Fill( PtPF/PtGen);
01261 }
01262 if(fGenJet.pt()>600.0 && fGenJet.pt()<900.0) {
01263 if(goodVertices.size()>15 && goodVertices.size()<=20) mpTScale_c_nvtx_15_20->Fill( PtPF/PtGen);
01264 }
01265
01266 if(fGenJet.pt()>60.0 && fGenJet.pt()<120.0) {
01267 if(goodVertices.size()>20 && goodVertices.size()<=30) mpTScale_a_nvtx_20_30->Fill( PtPF/PtGen);
01268 }
01269 if(fGenJet.pt()>200.0 && fGenJet.pt()<300.0) {
01270 if(goodVertices.size()>20 && goodVertices.size()<=30) mpTScale_b_nvtx_20_30->Fill( PtPF/PtGen);
01271 }
01272 if(fGenJet.pt()>600.0 && fGenJet.pt()<900.0) {
01273 if(goodVertices.size()>20 && goodVertices.size()<=30) mpTScale_c_nvtx_20_30->Fill( PtPF/PtGen);
01274 }
01275
01276 if(fGenJet.pt()>60.0 && fGenJet.pt()<120.0) {
01277 if(goodVertices.size()>30) mpTScale_a_nvtx_30_inf->Fill( PtPF/PtGen);
01278 }
01279 if(fGenJet.pt()>200.0 && fGenJet.pt()<300.0) {
01280 if(goodVertices.size()>30) mpTScale_b_nvtx_30_inf->Fill( PtPF/PtGen);
01281 }
01282 if(fGenJet.pt()>600.0 && fGenJet.pt()<900.0) {
01283 if(goodVertices.size()>30) mpTScale_c_nvtx_30_inf->Fill( PtPF/PtGen);
01284 }
01285
01286 if(goodVertices.size()<=5) mpTScale_nvtx_0_5->Fill(log10(PtGen),PtPF/PtGen);
01287 if(goodVertices.size()>5 && goodVertices.size()<=10) mpTScale_nvtx_5_10->Fill(log10(PtGen),PtPF/PtGen);
01288 if(goodVertices.size()>10 && goodVertices.size()<=15) mpTScale_nvtx_10_15->Fill(log10(PtGen),PtPF/PtGen);
01289 if(goodVertices.size()>15 && goodVertices.size()<=20) mpTScale_nvtx_15_20->Fill(log10(PtGen), PtPF/PtGen);
01290 if(goodVertices.size()>20 && goodVertices.size()<=30) mpTScale_nvtx_20_30->Fill(log10(PtGen), PtPF/PtGen);
01291 if(goodVertices.size()>30) mpTScale_nvtx_30_inf->Fill(log10(PtGen), PtPF/PtGen);
01292 }
01293 if (fabs(fGenJet.eta())<1.3) {
01294 if(fGenJet.pt()>60.0 && fGenJet.pt()<120.0) mpTScale_a->Fill(PtPF/PtGen);
01295 if(fGenJet.pt()>200.0 && fGenJet.pt()<300.0) mpTScale_b->Fill(PtPF/PtGen);
01296 if(fGenJet.pt()>600.0 && fGenJet.pt()<900.0) mpTScale_c->Fill(PtPF/PtGen);
01297 }
01298 mpTScale_pT->Fill (log10(PtGen), PtPF/PtGen);
01299 }