CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JetTester_HeavyIons.cc
Go to the documentation of this file.
1 // Producer for validation histograms for Calo and PF background subtracted objects
2 // Modified by Raghav Kunnawalkam Elayavalli, Aug 18th 2014
3 // , Oct 22nd 2014 to run in 73X
4 
5 #include "JetTester_HeavyIons.h"
6 
7 using namespace edm;
8 using namespace reco;
9 using namespace std;
10 
12  mInputCollection (iConfig.getParameter<edm::InputTag> ("src")),
13  mInputGenCollection (iConfig.getParameter<edm::InputTag> ("srcGen")),
14  mInputPFCandCollection (iConfig.getParameter<edm::InputTag> ("PFcands")),
15  // mInputCandCollection (iConfig.getParameter<edm::InputTag> ("Cands")),
16  // rhoTag (iConfig.getParameter<edm::InputTag> ("srcRho")),
17  centrality (iConfig.getParameter<edm::InputTag> ("centrality")),
18  mOutputFile (iConfig.getUntrackedParameter<std::string>("OutputFile","")),
19  JetType (iConfig.getUntrackedParameter<std::string>("JetType")),
20  UEAlgo (iConfig.getUntrackedParameter<std::string>("UEAlgo")),
21  Background (iConfig.getParameter<edm::InputTag> ("Background")),
22  mRecoJetPtThreshold (iConfig.getParameter<double> ("recoJetPtThreshold")),
23  mMatchGenPtThreshold (iConfig.getParameter<double> ("matchGenPtThreshold")),
24  mGenEnergyFractionThreshold (iConfig.getParameter<double> ("genEnergyFractionThreshold")),
25  mReverseEnergyFractionThreshold(iConfig.getParameter<double> ("reverseEnergyFractionThreshold")),
26  mRThreshold (iConfig.getParameter<double> ("RThreshold")),
27  JetCorrectionService (iConfig.getParameter<std::string> ("JetCorrections"))
28 {
29  std::string inputCollectionLabel(mInputCollection.label());
30 
31  // std::size_t foundCaloCollection = inputCollectionLabel.find("Calo");
32  // std::size_t foundJPTCollection = inputCollectionLabel.find("JetPlusTrack");
33  // std::size_t foundPFCollection = inputCollectionLabel.find("PF");
34 
35  isCaloJet = (std::string("calo")==JetType);
36  isJPTJet = (std::string("jpt") ==JetType);
37  isPFJet = (std::string("pf") ==JetType);
38 
39  //consumes
40  pvToken_ = consumes<std::vector<reco::Vertex> >(edm::InputTag("offlinePrimaryVertices"));
41  caloTowersToken_ = consumes<CaloTowerCollection>(edm::InputTag("towerMaker"));
42  if (isCaloJet) caloJetsToken_ = consumes<reco::CaloJetCollection>(mInputCollection);
43  if (isJPTJet) jptJetsToken_ = consumes<reco::JPTJetCollection>(mInputCollection);
44  if (isPFJet) {
45  if(std::string("Pu")==UEAlgo) basicJetsToken_ = consumes<reco::BasicJetCollection>(mInputCollection);
46  if(std::string("Vs")==UEAlgo) pfJetsToken_ = consumes<reco::PFJetCollection>(mInputCollection);
47  }
48 
49  genJetsToken_ = consumes<reco::GenJetCollection>(edm::InputTag(mInputGenCollection));
50  evtToken_ = consumes<edm::HepMCProduct>(edm::InputTag("generator"));
51  pfCandToken_ = consumes<reco::PFCandidateCollection>(mInputPFCandCollection);
52  pfCandViewToken_ = consumes<reco::CandidateView>(mInputPFCandCollection);
53  caloCandViewToken_ = consumes<reco::CandidateView>(edm::InputTag("towerMaker"));
54  backgrounds_ = consumes<edm::ValueMap<reco::VoronoiBackground> >(Background);
55  backgrounds_value_ = consumes<std::vector<float> >(Background);
56  centralityToken_ = consumes<reco::Centrality>(centrality);
57  hiVertexToken_ = consumes<std::vector<reco::Vertex> >(edm::InputTag("hiSelectedVertex"));
58 
59  // need to initialize the PF cand histograms : which are also event variables
60  if(isPFJet){
61  mNPFpart = 0;
62  mPFPt = 0;
63  mPFEta = 0;
64  mPFPhi = 0;
65  mPFVsPt = 0;
66  mPFVsPtInitial = 0;
67  mPFArea = 0;
68  mSumPFVsPt = 0;
70  mSumPFPt = 0;
72  mSumPFVsPt_eta = 0;
73  mSumPFPt_eta = 0;
76  mSumSquaredPFPt = 0;
81  mSumPFVsPt_HF = 0;
82  mSumPFPt_HF = 0;
84  mPFVsPt_eta_phi = 0;
85  mPFPt_eta_phi = 0;
86 
102 
118 
134 
135  }
136  if(isCaloJet){
137  mNCalopart = 0;
138  mCaloPt = 0;
139  mCaloEta = 0;
140  mCaloPhi = 0;
141  mCaloVsPt = 0;
142  mCaloVsPtInitial = 0;
143  mCaloArea = 0;
144 
145  mSumCaloVsPt = 0;
147  mSumCaloPt = 0;
149  mSumCaloVsPt_eta = 0;
150  mSumCaloPt_eta = 0;
153  mSumSquaredCaloPt = 0;
158  mSumCaloVsPt_HF = 0;
159  mSumCaloPt_HF = 0;
161  mCaloVsPt_eta_phi = 0;
162  mCaloPt_eta_phi = 0;
163 
179 
195 
211 
212  }
213  mSumpt = 0;
214  mvn = 0;
215  mpsin = 0;
216 
217 
218 
219  // Events variables
220  mNvtx = 0;
221  mHF = 0;
222 
223  // added Jan 12th 2015
224 
225  mDeltapT = 0;
226  //mDeltapT_HF = 0;
227  mDeltapT_eta = 0;
228  //mDeltapT_phiMinusPsi2 = 0;
229  mDeltapT_eta_phi = 0;
230 
231  // Jet parameters
232  mEta = 0;
233  mPhi = 0;
234  mEnergy = 0;
235  mP = 0;
236  mPt = 0;
237  mMass = 0;
238  mConstituents = 0;
239  mJetArea = 0;
240  mjetpileup = 0;
241  mNJets_40 = 0;
242  mNJets = 0;
243 
244  mVs_0_x = 0;
245  mVs_0_y = 0;
246  mVs_1_x = 0;
247  mVs_1_y = 0;
248  mVs_2_x = 0;
249  mVs_2_y = 0;
250  mVs_0_x_versus_HF = 0;
251  mVs_0_y_versus_HF = 0;
252  mVs_1_x_versus_HF = 0;
253  mVs_1_y_versus_HF = 0;
254  mVs_2_x_versus_HF = 0;
255  mVs_2_y_versus_HF = 0;
256 
257 }
258  //DQMStore* dbe = &*edm::Service<DQMStore>();
259 
261  {
262 
263  //if (dbe) {
264  //dbe->setCurrentFolder("JetMET/JetValidation/"+mInputCollection.label());
265 
266  ibooker.setCurrentFolder("JetMET/JetValidation/"+mInputCollection.label());
267 
268  // double log10PtMin = 0.50;
269  // double log10PtMax = 3.75;
270  // int log10PtBins = 26;
271 
272  // double etaRange[91] = {
273  // -6.0, -5.8, -5.6, -5.4, -5.2, -5.0, -4.8, -4.6, -4.4, -4.2,
274  // -4.0, -3.8, -3.6, -3.4, -3.2, -3.0, -2.9, -2.8, -2.7, -2.6,
275  // -2.5, -2.4, -2.3, -2.2, -2.1, -2.0, -1.9, -1.8, -1.7, -1.6,
276  // -1.5, -1.4, -1.3, -1.2, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6,
277  // -0.5, -0.4, -0.3, -0.2, -0.1,
278  // 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9,
279  // 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9,
280  // 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9,
281  // 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8,
282  // 5.0, 5.2, 5.4, 5.6, 5.8, 6.0
283  // };
284 
285 
286  static const size_t ncms_hcal_edge_pseudorapidity = 82 + 1;
287  static const double cms_hcal_edge_pseudorapidity[ncms_hcal_edge_pseudorapidity] = {
288  -5.191, -4.889, -4.716, -4.538, -4.363, -4.191, -4.013,
289  -3.839, -3.664, -3.489, -3.314, -3.139, -2.964, -2.853,
290  -2.650, -2.500, -2.322, -2.172, -2.043, -1.930, -1.830,
291  -1.740, -1.653, -1.566, -1.479, -1.392, -1.305, -1.218,
292  -1.131, -1.044, -0.957, -0.879, -0.783, -0.696, -0.609,
293  -0.522, -0.435, -0.348, -0.261, -0.174, -0.087,
294  0.000,
295  0.087, 0.174, 0.261, 0.348, 0.435, 0.522, 0.609,
296  0.696, 0.783, 0.879, 0.957, 1.044, 1.131, 1.218,
297  1.305, 1.392, 1.479, 1.566, 1.653, 1.740, 1.830,
298  1.930, 2.043, 2.172, 2.322, 2.500, 2.650, 2.853,
299  2.964, 3.139, 3.314, 3.489, 3.664, 3.839, 4.013,
300  4.191, 4.363, 4.538, 4.716, 4.889, 5.191
301  };
302 
303  //cout<<"inside the book histograms function"<<endl;
304 
305  double edge_pseudorapidity[etaBins_ +1] = {-5.191, -2.650, -2.043, -1.740, -1.479, -1.131, -0.783, -0.522, 0.522, 0.783, 1.131, 1.479, 1.740, 2.043, 2.650, 5.191 };
306 
307  TH2F *h2D_etabins_vs_pt2 = new TH2F("h2D_etabins_vs_pt2","etaBins (x axis), sum pt^{2} (y axis)",etaBins_,edge_pseudorapidity,10000,0,10000);
308  TH2F *h2D_etabins_vs_pt = new TH2F("h2D_etabins_vs_pt","etaBins (x axis), sum pt (y axis)",etaBins_,edge_pseudorapidity,10000,-1000,1000);
309  TH2F *h2D_etabins_vs_phi = new TH2F("h2D_etabins_vs_phi","candidate map, eta(x axis), phi (y axis), pt (z axis)",ncms_hcal_edge_pseudorapidity-1,cms_hcal_edge_pseudorapidity,36,-TMath::Pi(),TMath::Pi());
310 
311  if(isPFJet){
312 
313  mNPFpart = ibooker.book1D("NPFpart","No of particle flow candidates",1000,0,10000);
314  mPFPt = ibooker.book1D("PFPt","PF candidate p_{T}",1000,-5000,5000);
315  mPFEta = ibooker.book1D("PFEta","PF candidate #eta",120,-6,6);
316  mPFPhi = ibooker.book1D("PFPhi","PF candidate #phi",70,-3.5,3.5);
317  mPFVsPt = ibooker.book1D("PFVsPt","Vs PF candidate p_{T}",1000,-5000,5000);
318  mPFVsPtInitial = ibooker.book1D("PFVsPtInitial","Vs background subtracted PF candidate p_{T}",1000,-5000,5000);
319  mPFArea = ibooker.book1D("PFArea","VS PF candidate area",100,0,4);
320 
321  mSumPFVsPt = ibooker.book1D("SumPFVsPt","Sum of final PF VS p_{T}",1000,-10000,10000);
322  mSumPFVsPtInitial= ibooker.book1D("SumPFVsPtInitial","Sum PF VS p_{T} after subtraction",1000,-10000,10000);
323  mSumPFPt = ibooker.book1D("SumPFPt","Sum of initial PF p_{T}",1000,-10000,10000);
324  mSumPFVsPt_eta = ibooker.book2D("SumPFVsPt_etaBins",h2D_etabins_vs_pt);
325  mSumPFVsPtInitial_eta = ibooker.book2D("SumPFVsPtInitial_etaBins",h2D_etabins_vs_pt);
326  mSumPFPt_eta = ibooker.book2D("SumPFPt_etaBins",h2D_etabins_vs_pt);
327 
328  mSumSquaredPFVsPt = ibooker.book1D("SumSquaredPFVsPt","Sum PF Vs p_{T} square",10000,0,10000);
329  mSumSquaredPFVsPtInitial= ibooker.book1D("SumSquaredPFVsPtInitial","Sum PF Vs p_{T} square after subtraction ",10000,0,10000);
330  mSumSquaredPFPt = ibooker.book1D("SumSquaredPFPt","Sum of initial PF p_{T} squared",10000,0,10000);
331  mSumSquaredPFVsPt_eta = ibooker.book2D("SumSquaredPFVsPt_etaBins",h2D_etabins_vs_pt2);
332  mSumSquaredPFVsPtInitial_eta = ibooker.book2D("SumSquaredPFVsPtInitial_etaBins",h2D_etabins_vs_pt2);
333  mSumSquaredPFPt_eta = ibooker.book2D("SumSquaredPFPt_etaBins",h2D_etabins_vs_pt2);
334 
335  mSumPFVsPtInitial_HF = ibooker.book2D("SumPFVsPtInitial_HF","HF Energy (y axis) vs Sum PF Vs p_{T} before subtraction (x axis)",1000,-1000,1000,1000,0,10000);
336  mSumPFVsPt_HF = ibooker.book2D("SumPFVsPt_HF","HF energy (y axis) vs Sum PF Vs p_{T} final (x axis)",1000,-1000,1000,1000,0,10000);
337  mSumPFPt_HF = ibooker.book2D("SumPFPt_HF","HF energy (y axis) vs Sum initial PF p_{T} (x axis)",1000,-1000,1000,1000,0,10000);
338  mPFVsPtInitial_eta_phi = ibooker.book2D("PFVsPtInitial_eta_phi",h2D_etabins_vs_phi);
339  mPFVsPt_eta_phi = ibooker.book2D("PFVsPt_eta_phi",h2D_etabins_vs_phi);
340  mPFPt_eta_phi = ibooker.book2D("PFPt_eta_phi",h2D_etabins_vs_phi);
341 
342  mSumPFVsPtInitial_n5p191_n2p650 = ibooker.book1D("mSumPFVsPtInitial_n5p191_n2p650","Sum PFVsPt Initial variable in the eta range -5.191 to -2.650",1000,-5000,5000);
343  mSumPFVsPtInitial_n2p650_n2p043 = ibooker.book1D("mSumPFVsPtInitial_n2p650_n2p043","Sum PFVsPt Initial variable in the eta range -2.650 to -2.043 ",1000,-5000,5000);
344  mSumPFVsPtInitial_n2p043_n1p740 = ibooker.book1D("mSumPFVsPtInitial_n2p043_n1p740","Sum PFVsPt Initial variable in the eta range -2.043 to -1.740",1000,-1000,1000);
345  mSumPFVsPtInitial_n1p740_n1p479 = ibooker.book1D("mSumPFVsPtInitial_n1p740_n1p479","Sum PFVsPt Initial variable in the eta range -1.740 to -1.479",1000,-1000,1000);
346  mSumPFVsPtInitial_n1p479_n1p131 = ibooker.book1D("mSumPFVsPtInitial_n1p479_n1p131","Sum PFVsPt Initial variable in the eta range -1.479 to -1.131",1000,-1000,1000);
347  mSumPFVsPtInitial_n1p131_n0p783 = ibooker.book1D("mSumPFVsPtInitial_n1p131_n0p783","Sum PFVsPt Initial variable in the eta range -1.131 to -0.783",1000,-1000,1000);
348  mSumPFVsPtInitial_n0p783_n0p522 = ibooker.book1D("mSumPFVsPtInitial_n0p783_n0p522","Sum PFVsPt Initial variable in the eta range -0.783 to -0.522",1000,-1000,1000);
349  mSumPFVsPtInitial_n0p522_0p522 = ibooker.book1D("mSumPFVsPtInitial_n0p522_0p522","Sum PFVsPt Initial variable in the eta range -0.522 to 0.522",1000,-1000,1000);
350  mSumPFVsPtInitial_0p522_0p783 = ibooker.book1D("mSumPFVsPtInitial_0p522_0p783","Sum PFVsPt Initial variable in the eta range 0.522 to 0.783",1000,-1000,1000);
351  mSumPFVsPtInitial_0p783_1p131 = ibooker.book1D("mSumPFVsPtInitial_0p783_1p131","Sum PFVsPt Initial variable in the eta range 0.783 to 1.131",1000,-1000,1000);
352  mSumPFVsPtInitial_1p131_1p479 = ibooker.book1D("mSumPFVsPtInitial_1p131_1p479","Sum PFVsPt Initial variable in the eta range 1.131 to 1.479",1000,-1000,1000);
353  mSumPFVsPtInitial_1p479_1p740 = ibooker.book1D("mSumPFVsPtInitial_1p479_1p740","Sum PFVsPt Initial variable in the eta range 1.479 to 1.740",1000,-1000,1000);
354  mSumPFVsPtInitial_1p740_2p043 = ibooker.book1D("mSumPFVsPtInitial_1p740_2p043","Sum PFVsPt Initial variable in the eta range 1.740 to 2.043",1000,-1000,1000);
355  mSumPFVsPtInitial_2p043_2p650 = ibooker.book1D("mSumPFVsPtInitial_2p043_2p650","Sum PFVsPt Initial variable in the eta range 2.043 to 2.650",1000,-5000,5000);
356  mSumPFVsPtInitial_2p650_5p191 = ibooker.book1D("mSumPFVsPtInitial_2p650_5p191","Sum PFVsPt Initial variable in the eta range 2.650 to 5.191",1000,-5000,5000);
357 
358  mSumPFVsPt_n5p191_n2p650 = ibooker.book1D("mSumPFVsPt_n5p191_n2p650","Sum PFVsPt variable in the eta range -5.191 to -2.650",1000,-5000,5000);
359  mSumPFVsPt_n2p650_n2p043 = ibooker.book1D("mSumPFVsPt_n2p650_n2p043","Sum PFVsPt variable in the eta range -2.650 to -2.043 ",1000,-5000,5000);
360  mSumPFVsPt_n2p043_n1p740 = ibooker.book1D("mSumPFVsPt_n2p043_n1p740","Sum PFVsPt variable in the eta range -2.043 to -1.740",1000,-1000,1000);
361  mSumPFVsPt_n1p740_n1p479 = ibooker.book1D("mSumPFVsPt_n1p740_n1p479","Sum PFVsPt variable in the eta range -1.740 to -1.479",1000,-1000,1000);
362  mSumPFVsPt_n1p479_n1p131 = ibooker.book1D("mSumPFVsPt_n1p479_n1p131","Sum PFVsPt variable in the eta range -1.479 to -1.131",1000,-1000,1000);
363  mSumPFVsPt_n1p131_n0p783 = ibooker.book1D("mSumPFVsPt_n1p131_n0p783","Sum PFVsPt variable in the eta range -1.131 to -0.783",1000,-1000,1000);
364  mSumPFVsPt_n0p783_n0p522 = ibooker.book1D("mSumPFVsPt_n0p783_n0p522","Sum PFVsPt variable in the eta range -0.783 to -0.522",1000,-1000,1000);
365  mSumPFVsPt_n0p522_0p522 = ibooker.book1D("mSumPFVsPt_n0p522_0p522","Sum PFVsPt variable in the eta range -0.522 to 0.522",1000,-1000,1000);
366  mSumPFVsPt_0p522_0p783 = ibooker.book1D("mSumPFVsPt_0p522_0p783","Sum PFVsPt variable in the eta range 0.522 to 0.783",1000,-1000,1000);
367  mSumPFVsPt_0p783_1p131 = ibooker.book1D("mSumPFVsPt_0p783_1p131","Sum PFVsPt variable in the eta range 0.783 to 1.131",1000,-1000,1000);
368  mSumPFVsPt_1p131_1p479 = ibooker.book1D("mSumPFVsPt_1p131_1p479","Sum PFVsPt variable in the eta range 1.131 to 1.479",1000,-1000,1000);
369  mSumPFVsPt_1p479_1p740 = ibooker.book1D("mSumPFVsPt_1p479_1p740","Sum PFVsPt variable in the eta range 1.479 to 1.740",1000,-1000,1000);
370  mSumPFVsPt_1p740_2p043 = ibooker.book1D("mSumPFVsPt_1p740_2p043","Sum PFVsPt variable in the eta range 1.740 to 2.043",1000,-1000,1000);
371  mSumPFVsPt_2p043_2p650 = ibooker.book1D("mSumPFVsPt_2p043_2p650","Sum PFVsPt variable in the eta range 2.043 to 2.650",1000,-5000,5000);
372  mSumPFVsPt_2p650_5p191 = ibooker.book1D("mSumPFVsPt_2p650_5p191","Sum PFVsPt variable in the eta range 2.650 to 5.191",1000,-5000,5000);
373 
374  mSumPFPt_n5p191_n2p650 = ibooker.book1D("mSumPFPt_n5p191_n2p650","Sum PFPt in the eta range -5.191 to -2.650",1000,-5000,5000);
375  mSumPFPt_n2p650_n2p043 = ibooker.book1D("mSumPFPt_n2p650_n2p043","Sum PFPt in the eta range -2.650 to -2.043 ",1000,-5000,5000);
376  mSumPFPt_n2p043_n1p740 = ibooker.book1D("mSumPFPt_n2p043_n1p740","Sum PFPt in the eta range -2.043 to -1.740",1000,-1000,1000);
377  mSumPFPt_n1p740_n1p479 = ibooker.book1D("mSumPFPt_n1p740_n1p479","Sum PFPt in the eta range -1.740 to -1.479",1000,-1000,1000);
378  mSumPFPt_n1p479_n1p131 = ibooker.book1D("mSumPFPt_n1p479_n1p131","Sum PFPt in the eta range -1.479 to -1.131",1000,-1000,1000);
379  mSumPFPt_n1p131_n0p783 = ibooker.book1D("mSumPFPt_n1p131_n0p783","Sum PFPt in the eta range -1.131 to -0.783",1000,-1000,1000);
380  mSumPFPt_n0p783_n0p522 = ibooker.book1D("mSumPFPt_n0p783_n0p522","Sum PFPt in the eta range -0.783 to -0.522",1000,-1000,1000);
381  mSumPFPt_n0p522_0p522 = ibooker.book1D("mSumPFPt_n0p522_0p522","Sum PFPt in the eta range -0.522 to 0.522",1000,-1000,1000);
382  mSumPFPt_0p522_0p783 = ibooker.book1D("mSumPFPt_0p522_0p783","Sum PFPt in the eta range 0.522 to 0.783",1000,-1000,1000);
383  mSumPFPt_0p783_1p131 = ibooker.book1D("mSumPFPt_0p783_1p131","Sum PFPt in the eta range 0.783 to 1.131",1000,-1000,1000);
384  mSumPFPt_1p131_1p479 = ibooker.book1D("mSumPFPt_1p131_1p479","Sum PFPt in the eta range 1.131 to 1.479",1000,-1000,1000);
385  mSumPFPt_1p479_1p740 = ibooker.book1D("mSumPFPt_1p479_1p740","Sum PFPt in the eta range 1.479 to 1.740",1000,-1000,1000);
386  mSumPFPt_1p740_2p043 = ibooker.book1D("mSumPFPt_1p740_2p043","Sum PFPt in the eta range 1.740 to 2.043",1000,-1000,1000);
387  mSumPFPt_2p043_2p650 = ibooker.book1D("mSumPFPt_2p043_2p650","Sum PFPt in the eta range 2.043 to 2.650",1000,-5000,5000);
388  mSumPFPt_2p650_5p191 = ibooker.book1D("mSumPFPt_2p650_5p191","Sum PFPt in the eta range 2.650 to 5.191",1000,-5000,5000);
389 
390  }
391 
392  if(isCaloJet){
393 
394  mNCalopart = ibooker.book1D("NCalopart","No of particle flow candidates",1000,0,10000);
395  mCaloPt = ibooker.book1D("CaloPt","Calo candidate p_{T}",1000,-5000,5000);
396  mCaloEta = ibooker.book1D("CaloEta","Calo candidate #eta",120,-6,6);
397  mCaloPhi = ibooker.book1D("CaloPhi","Calo candidate #phi",70,-3.5,3.5);
398  mCaloVsPt = ibooker.book1D("CaloVsPt","Vs Calo candidate p_{T}",1000,-5000,5000);
399  mCaloVsPtInitial = ibooker.book1D("CaloVsPtInitial","Vs background subtracted Calo candidate p_{T}",1000,-5000,5000);
400  mCaloArea = ibooker.book1D("CaloArea","VS Calo candidate area",100,0,4);
401 
402  mSumCaloVsPt = ibooker.book1D("SumCaloVsPt","Sum of final Calo VS p_{T} ",1000,-10000,10000);
403  mSumCaloVsPtInitial= ibooker.book1D("SumCaloVsPtInitial","Sum Calo VS p_{T} after subtraction",1000,-10000,10000);
404  mSumCaloPt = ibooker.book1D("SumCaloPt","Sum Calo p_{T}",1000,-10000,10000);
405  mSumCaloVsPt_eta = ibooker.book2D("SumCaloVsPt_etaBins",h2D_etabins_vs_pt);
406  mSumCaloVsPtInitial_eta = ibooker.book2D("SumCaloVsPtInitial_etaBins",h2D_etabins_vs_pt);
407  mSumCaloPt_eta = ibooker.book2D("SumCaloPt_etaBins",h2D_etabins_vs_pt);
408 
409  mSumSquaredCaloVsPt = ibooker.book1D("SumSquaredCaloVsPt","Sum of final Calo VS p_{T} squared",10000,0,10000);
410  mSumSquaredCaloVsPtInitial= ibooker.book1D("SumSquaredCaloVsPtInitial","Sum of subtracted Calo VS p_{T} squared",10000,0,10000);
411  mSumSquaredCaloPt = ibooker.book1D("SumSquaredCaloPt","Sum of initial Calo tower p_{T} squared",10000,0,10000);
412  mSumSquaredCaloVsPt_eta = ibooker.book2D("SumSquaredCaloVsPt_etaBins",h2D_etabins_vs_pt2);
413  mSumSquaredCaloVsPtInitial_eta = ibooker.book2D("SumSquaredCaloVsPtInitial_etaBins",h2D_etabins_vs_pt2);
414  mSumSquaredCaloPt_eta = ibooker.book2D("SumSquaredCaloPt_etaBins",h2D_etabins_vs_pt2);
415 
416  mSumCaloVsPtInitial_HF = ibooker.book2D("SumCaloVsPtInitial_HF","HF Energy (y axis) vs Sum Calo Vs p_{T} before subtraction (x axis)",1000,-1000,1000,1000,0,10000);
417  mSumCaloVsPt_HF = ibooker.book2D("SumCaloVsPt_HF","HF Energy (y axis) vs Sum Calo Vs p_{T} (x axis)",1000,-1000,1000,1000,0,10000);
418  mSumCaloPt_HF = ibooker.book2D("SumCaloPt_HF","HF Energy (y axis) vs Sum Calo tower p_{T}",1000,-1000,1000,1000,0,10000);
419  mCaloVsPtInitial_eta_phi = ibooker.book2D("CaloVsPtInitial_eta_phi",h2D_etabins_vs_phi);
420  mCaloVsPt_eta_phi = ibooker.book2D("CaloVsPt_eta_phi",h2D_etabins_vs_phi);
421  mCaloPt_eta_phi = ibooker.book2D("CaloPt_eta_phi",h2D_etabins_vs_phi);
422 
423  mSumCaloVsPtInitial_n5p191_n2p650 = ibooker.book1D("mSumCaloVsPtInitial_n5p191_n2p650","Sum CaloVsPt Initial variable in the eta range -5.191 to -2.650",1000,-5000,5000);
424  mSumCaloVsPtInitial_n2p650_n2p043 = ibooker.book1D("mSumCaloVsPtInitial_n2p650_n2p043","Sum CaloVsPt Initial variable in the eta range -2.650 to -2.043 ",1000,-5000,5000);
425  mSumCaloVsPtInitial_n2p043_n1p740 = ibooker.book1D("mSumCaloVsPtInitial_n2p043_n1p740","Sum CaloVsPt Initial variable in the eta range -2.043 to -1.740",1000,-1000,1000);
426  mSumCaloVsPtInitial_n1p740_n1p479 = ibooker.book1D("mSumCaloVsPtInitial_n1p740_n1p479","Sum CaloVsPt Initial variable in the eta range -1.740 to -1.479",1000,-1000,1000);
427  mSumCaloVsPtInitial_n1p479_n1p131 = ibooker.book1D("mSumCaloVsPtInitial_n1p479_n1p131","Sum CaloVsPt Initial variable in the eta range -1.479 to -1.131",1000,-1000,1000);
428  mSumCaloVsPtInitial_n1p131_n0p783 = ibooker.book1D("mSumCaloVsPtInitial_n1p131_n0p783","Sum CaloVsPt Initial variable in the eta range -1.131 to -0.783",1000,-1000,1000);
429  mSumCaloVsPtInitial_n0p783_n0p522 = ibooker.book1D("mSumCaloVsPtInitial_n0p783_n0p522","Sum CaloVsPt Initial variable in the eta range -0.783 to -0.522",1000,-1000,1000);
430  mSumCaloVsPtInitial_n0p522_0p522 = ibooker.book1D("mSumCaloVsPtInitial_n0p522_0p522","Sum CaloVsPt Initial variable in the eta range -0.522 to 0.522",1000,-1000,1000);
431  mSumCaloVsPtInitial_0p522_0p783 = ibooker.book1D("mSumCaloVsPtInitial_0p522_0p783","Sum CaloVsPt Initial variable in the eta range 0.522 to 0.783",1000,-1000,1000);
432  mSumCaloVsPtInitial_0p783_1p131 = ibooker.book1D("mSumCaloVsPtInitial_0p783_1p131","Sum CaloVsPt Initial variable in the eta range 0.783 to 1.131",1000,-1000,1000);
433  mSumCaloVsPtInitial_1p131_1p479 = ibooker.book1D("mSumCaloVsPtInitial_1p131_1p479","Sum CaloVsPt Initial variable in the eta range 1.131 to 1.479",1000,-1000,1000);
434  mSumCaloVsPtInitial_1p479_1p740 = ibooker.book1D("mSumCaloVsPtInitial_1p479_1p740","Sum CaloVsPt Initial variable in the eta range 1.479 to 1.740",1000,-1000,1000);
435  mSumCaloVsPtInitial_1p740_2p043 = ibooker.book1D("mSumCaloVsPtInitial_1p740_2p043","Sum CaloVsPt Initial variable in the eta range 1.740 to 2.043",1000,-1000,1000);
436  mSumCaloVsPtInitial_2p043_2p650 = ibooker.book1D("mSumCaloVsPtInitial_2p043_2p650","Sum CaloVsPt Initial variable in the eta range 2.043 to 2.650",1000,-5000,5000);
437  mSumCaloVsPtInitial_2p650_5p191 = ibooker.book1D("mSumCaloVsPtInitial_2p650_5p191","Sum CaloVsPt Initial variable in the eta range 2.650 to 5.191",1000,-5000,5000);
438 
439  mSumCaloVsPt_n5p191_n2p650 = ibooker.book1D("mSumCaloVsPt_n5p191_n2p650","Sum CaloVsPt variable in the eta range -5.191 to -2.650",1000,-5000,5000);
440  mSumCaloVsPt_n2p650_n2p043 = ibooker.book1D("mSumCaloVsPt_n2p650_n2p043","Sum CaloVsPt variable in the eta range -2.650 to -2.043",1000,-5000,5000);
441  mSumCaloVsPt_n2p043_n1p740 = ibooker.book1D("mSumCaloVsPt_n2p043_n1p740","Sum CaloVsPt variable in the eta range -2.043 to -1.740",1000,-1000,1000);
442  mSumCaloVsPt_n1p740_n1p479 = ibooker.book1D("mSumCaloVsPt_n1p740_n1p479","Sum CaloVsPt variable in the eta range -1.740 to -1.479",1000,-1000,1000);
443  mSumCaloVsPt_n1p479_n1p131 = ibooker.book1D("mSumCaloVsPt_n1p479_n1p131","Sum CaloVsPt variable in the eta range -1.479 to -1.131",1000,-1000,1000);
444  mSumCaloVsPt_n1p131_n0p783 = ibooker.book1D("mSumCaloVsPt_n1p131_n0p783","Sum CaloVsPt variable in the eta range -1.131 to -0.783",1000,-1000,1000);
445  mSumCaloVsPt_n0p783_n0p522 = ibooker.book1D("mSumCaloVsPt_n0p783_n0p522","Sum CaloVsPt variable in the eta range -0.783 to -0.522",1000,-1000,1000);
446  mSumCaloVsPt_n0p522_0p522 = ibooker.book1D("mSumCaloVsPt_n0p522_0p522","Sum CaloVsPt variable in the eta range -0.522 to 0.522",1000,-1000,1000);
447  mSumCaloVsPt_0p522_0p783 = ibooker.book1D("mSumCaloVsPt_0p522_0p783","Sum CaloVsPt variable in the eta range 0.522 to 0.783",1000,-1000,1000);
448  mSumCaloVsPt_0p783_1p131 = ibooker.book1D("mSumCaloVsPt_0p783_1p131","Sum CaloVsPt variable in the eta range 0.783 to 1.131",1000,-1000,1000);
449  mSumCaloVsPt_1p131_1p479 = ibooker.book1D("mSumCaloVsPt_1p131_1p479","Sum CaloVsPt variable in the eta range 1.131 to 1.479",1000,-1000,1000);
450  mSumCaloVsPt_1p479_1p740 = ibooker.book1D("mSumCaloVsPt_1p479_1p740","Sum CaloVsPt variable in the eta range 1.479 to 1.740",1000,-1000,1000);
451  mSumCaloVsPt_1p740_2p043 = ibooker.book1D("mSumCaloVsPt_1p740_2p043","Sum CaloVsPt variable in the eta range 1.740 to 2.043",1000,-1000,1000);
452  mSumCaloVsPt_2p043_2p650 = ibooker.book1D("mSumCaloVsPt_2p043_2p650","Sum CaloVsPt variable in the eta range 2.043 to 2.650",1000,-5000,5000);
453  mSumCaloVsPt_2p650_5p191 = ibooker.book1D("mSumCaloVsPt_2p650_5p191","Sum CaloVsPt variable in the eta range 2.650 to 5.191",1000,-5000,5000);
454 
455  mSumCaloPt_n5p191_n2p650 = ibooker.book1D("mSumCaloPt_n5p191_n2p650","Sum Calo tower pT variable in the eta range -5.191 to -2.650",1000,-5000,5000);
456  mSumCaloPt_n2p650_n2p043 = ibooker.book1D("mSumCaloPt_n2p650_n2p043","Sum Calo tower pT variable in the eta range -2.650 to -2.043",1000,-5000,5000);
457  mSumCaloPt_n2p043_n1p740 = ibooker.book1D("mSumCaloPt_n2p043_n1p740","Sum Calo tower pT variable in the eta range -2.043 to -1.740",1000,-1000,1000);
458  mSumCaloPt_n1p740_n1p479 = ibooker.book1D("mSumCaloPt_n1p740_n1p479","Sum Calo tower pT variable in the eta range -1.740 to -1.479",1000,-1000,1000);
459  mSumCaloPt_n1p479_n1p131 = ibooker.book1D("mSumCaloPt_n1p479_n1p131","Sum Calo tower pT variable in the eta range -1.479 to -1.131",1000,-1000,1000);
460  mSumCaloPt_n1p131_n0p783 = ibooker.book1D("mSumCaloPt_n1p131_n0p783","Sum Calo tower pT variable in the eta range -1.131 to -0.783",1000,-1000,1000);
461  mSumCaloPt_n0p783_n0p522 = ibooker.book1D("mSumCaloPt_n0p783_n0p522","Sum Calo tower pT variable in the eta range -0.783 to -0.522",1000,-1000,1000);
462  mSumCaloPt_n0p522_0p522 = ibooker.book1D("mSumCaloPt_n0p522_0p522","Sum Calo tower pT variable in the eta range -0.522 to 0.522",1000,-1000,1000);
463  mSumCaloPt_0p522_0p783 = ibooker.book1D("mSumCaloPt_0p522_0p783","Sum Calo tower pT variable in the eta range 0.522 to 0.783",1000,-1000,1000);
464  mSumCaloPt_0p783_1p131 = ibooker.book1D("mSumCaloPt_0p783_1p131","Sum Calo tower pT variable in the eta range 0.783 to 1.131",1000,-1000,1000);
465  mSumCaloPt_1p131_1p479 = ibooker.book1D("mSumCaloPt_1p131_1p479","Sum Calo tower pT variable in the eta range 1.131 to 1.479",1000,-1000,1000);
466  mSumCaloPt_1p479_1p740 = ibooker.book1D("mSumCaloPt_1p479_1p740","Sum Calo tower pT variable in the eta range 1.479 to 1.740",1000,-1000,1000);
467  mSumCaloPt_1p740_2p043 = ibooker.book1D("mSumCaloPt_1p740_2p043","Sum Calo tower pT variable in the eta range 1.740 to 2.043",1000,-1000,1000);
468  mSumCaloPt_2p043_2p650 = ibooker.book1D("mSumCaloPt_2p043_2p650","Sum Calo tower pT variable in the eta range 2.043 to 2.650",1000,-5000,5000);
469  mSumCaloPt_2p650_5p191 = ibooker.book1D("mSumCaloPt_2p650_5p191","Sum Calo tower pT variable in the eta range 2.650 to 5.191",1000,-5000,5000);
470 
471  }
472 
473  // particle flow variables histograms
474  mSumpt = ibooker.book1D("SumpT","Sum p_{T} of all the PF candidates per event",1000,0,10000);
475  mvn = ibooker.book1D("vn","vn",100,0,10);
476  mpsin = ibooker.book1D("mpsin","psin",100,0,10);
477 
478  // Event variables
479  mNvtx = ibooker.book1D("Nvtx", "number of vertices", 60, 0, 60);
480  mHF = ibooker.book1D("HF", "HF energy distribution",1000,0,10000);
481 
482  // added Jan 12th 2015
483  mDeltapT = ibooker.book1D("DeltapT","amount subtracted from candidate",400,-200,200);
484  //mDeltapT_HF = ibooker.book2D("DeltapT_HF","",400,-200,200,1000,0,10000);
485  mDeltapT_eta = ibooker.book2D("DeltapT_eta","",60,-6,+6,400,-200,200);
486  //mDeltapT_phiMinusPsi2 = ibooker.book2D("DeltapT_phiMinusPsi2","",400,-200,200,35,-1.75,1.75);
487  mDeltapT_eta_phi = ibooker.book2D("DeltapT_eta_phi",h2D_etabins_vs_phi);
488 
489  // Jet parameters
490  mEta = ibooker.book1D("Eta", "Eta", 120, -6, 6);
491  mPhi = ibooker.book1D("Phi", "Phi", 70, -3.5, 3.5);
492  mPt = ibooker.book1D("Pt", "Pt", 100, 0, 1000);
493  mP = ibooker.book1D("P", "P", 100, 0, 1000);
494  mEnergy = ibooker.book1D("Energy", "Energy", 100, 0, 1000);
495  mMass = ibooker.book1D("Mass", "Mass", 100, 0, 200);
496  mConstituents = ibooker.book1D("Constituents", "Constituents", 100, 0, 100);
497  mJetArea = ibooker.book1D("JetArea", "JetArea", 100, 0, 4);
498  mjetpileup = ibooker.book1D("jetPileUp","jetPileUp",100,0,150);
499  mNJets_40 = ibooker.book1D("NJets_pt_greater_40", "NJets pT > 40 GeV", 50, 0, 100);
500  mNJets = ibooker.book1D("NJets", "NJets", 50, 0, 100);
501 
502  mVs_0_x = ibooker.book1D("Vs_0_x","flow modulated sumpT from both HF (+ and -) with cos, vn = 0",1000,-10000,10000);
503  mVs_0_y = ibooker.book1D("Vs_0_y","flow modulated sumpT from both HF (+ and -) with sin, vn = 0",1000,-10000,10000);
504  mVs_1_x = ibooker.book1D("Vs_1_x","flow modulated sumpT from both HF (+ and -) with cos, vn = 1",1000,-10000,10000);
505  mVs_1_y = ibooker.book1D("Vs_1_y","flow modulated sumpT from both HF (+ and -) with sin, vn = 1",1000,-10000,10000);
506  mVs_2_x = ibooker.book1D("Vs_2_x","flow modulated sumpT from both HF (+ and -) with cos, vn = 2",1000,-10000,10000);
507  mVs_2_y = ibooker.book1D("Vs_2_y","flow modulated sumpT from both HF (+ and -) with sin, vn = 2",1000,-10000,10000);
508 
509  mVs_0_x_versus_HF = ibooker.book2D("Vs_0_x_versus_HF","flow modulated sumpT (y axis) from both HF (+ and -) with cos, vn = 0 versus HF energy (x axis)",1000,0,10000,1000,-10000,10000);
510  mVs_0_y_versus_HF = ibooker.book2D("Vs_0_y_versus_HF","flow modulated sumpT (y axis) from both HF (+ and -) with sin, vn = 0 versus HF energy (x axis)",1000,0,10000,1000,-10000,10000);
511  mVs_1_x_versus_HF = ibooker.book2D("Vs_1_x_versus_HF","flow modulated sumpT (y axis) from both HF (+ and -) with cos, vn = 1 versus HF energy (x axis)",1000,0,10000,1000,-10000,10000);
512  mVs_1_y_versus_HF = ibooker.book2D("Vs_1_y_versus_HF","flow modulated sumpT (y axis) from both HF (+ and -) with sin, vn = 1 versus HF energy (x axis)",1000,0,10000,1000,-10000,10000);
513  mVs_2_x_versus_HF = ibooker.book2D("Vs_2_x_versus_HF","flow modulated sumpT (y axis) from both HF (+ and -) with cos, vn = 2 versus HF energy (x axis)",1000,0,10000,1000,-10000,10000);
514  mVs_2_y_versus_HF = ibooker.book2D("Vs_2_y_versus_HF","flow modulated sumpT (y axis) from both HF (+ and -) with sin, vn = 2 versus HF energy (x axis)",1000,0,10000,1000,-10000,10000);
515 
516  if (mOutputFile.empty ())
517  LogInfo("OutputInfo") << " Histograms will NOT be saved";
518  else
519  LogInfo("OutputInfo") << " Histograms will be saved to file:" << mOutputFile;
520 
521  delete h2D_etabins_vs_pt2;
522  delete h2D_etabins_vs_pt;
523  delete h2D_etabins_vs_phi;
524  }
525 
526 
527 
528 //------------------------------------------------------------------------------
529 // ~JetTester_HeavyIons
530 //------------------------------------------------------------------------------
532 
533 
534 //------------------------------------------------------------------------------
535 // beginJob
536 //------------------------------------------------------------------------------
537 //void JetTester_HeavyIons::beginJob() {
538 // //std::cout<<"inside the begin job function"<<endl;
539 //}
540 
541 
542 //------------------------------------------------------------------------------
543 // endJob
544 //------------------------------------------------------------------------------
545 //void JetTester_HeavyIons::endJob()
546 //{
547 // if (!mOutputFile.empty() && &*edm::Service<DQMStore>())
548 // {
549 // edm::Service<DQMStore>()->save(mOutputFile);
550 // }
551 //}
552 
553 
554 //------------------------------------------------------------------------------
555 // analyze
556 //------------------------------------------------------------------------------
557 void JetTester_HeavyIons::analyze(const edm::Event& mEvent, const edm::EventSetup& mSetup)
558 {
559  // Get the primary vertices
560  //----------------------------------------------------------------------------
562  mEvent.getByToken(pvToken_, pvHandle);
563  reco::Vertex::Point vtx(0,0,0);
565  //vtx = getVtx(mEvent);
566 
567  mEvent.getByToken(hiVertexToken_, vtxs);
568  int greatestvtx = 0;
569  int nVertex = vtxs->size();
570 
571  for (unsigned int i = 0 ; i< vtxs->size(); ++i){
572  unsigned int daughter = (*vtxs)[i].tracksSize();
573  if( daughter > (*vtxs)[greatestvtx].tracksSize()) greatestvtx = i;
574  }
575 
576  if(nVertex<=0){
577  vtx = reco::Vertex::Point(0,0,0);
578  }
579  vtx = (*vtxs)[greatestvtx].position();
580 
581  int nGoodVertices = 0;
582 
583  if (pvHandle.isValid())
584  {
585  for (unsigned i=0; i<pvHandle->size(); i++)
586  {
587  if ((*pvHandle)[i].ndof() > 4 &&
588  (fabs((*pvHandle)[i].z()) <= 24) &&
589  (fabs((*pvHandle)[i].position().rho()) <= 2))
590  nGoodVertices++;
591  }
592  }
593 
594  mNvtx->Fill(nGoodVertices);
595 
596  // Get the Jet collection
597  //----------------------------------------------------------------------------
598  //math::XYZTLorentzVector p4tmp[2];
599 
600  std::vector<Jet> recoJets;
601  recoJets.clear();
602 
607 
608  // Get the Particle flow candidates and the Voronoi variables
610  edm::Handle<CaloTowerCollection> caloCandidates;
611  edm::Handle<reco::CandidateView> pfcandidates_;
612  edm::Handle<reco::CandidateView> calocandidates_;
613 
614  //const reco::PFCandidateCollection *pfCandidateColl = pfcandidates.product();
617 
619 
620  // for example
621  // edm::Handle<PFCandidate /*name of actual handle*/> pfcand;
622  // mEvent.getByToken(PFCandToken_,pfcand);
623 
624  if (isCaloJet) mEvent.getByToken(caloJetsToken_, caloJets);
625  if (isJPTJet) mEvent.getByToken(jptJetsToken_, jptJets);
626  if (isPFJet) {
627  if(std::string("Pu")==UEAlgo) mEvent.getByToken(basicJetsToken_, basicJets);
628  if(std::string("Vs")==UEAlgo) mEvent.getByToken(pfJetsToken_, pfJets);
629  }
630 
631  mEvent.getByToken(pfCandToken_, pfCandidates);
632  mEvent.getByToken(pfCandViewToken_, pfcandidates_);
633 
634  mEvent.getByToken(caloTowersToken_, caloCandidates);
635  mEvent.getByToken(caloCandViewToken_, calocandidates_);
636 
637  mEvent.getByToken(backgrounds_, VsBackgrounds);
638  mEvent.getByToken(backgrounds_value_, vn_);
639 
640  // get the centrality
641  mEvent.getByToken(centralityToken_, cent);
642 
643  mHF->Fill(cent->EtHFtowerSum());
644  Float_t HF_energy = cent->EtHFtowerSum();
645 
646  //std::cout<<"HF energy = "<<HF_energy<<std::endl;
647 
648  const reco::PFCandidateCollection *pfCandidateColl = pfCandidates.product();
649  //const CaloTowerCollection *caloCandidateColl = caloCandidates.product();
650 
651  Float_t vsPt=0;
652  Float_t vsPtInitial = 0;
653  Float_t vsArea = 0;
654  Int_t NPFpart = 0;
655  Int_t NCaloTower = 0;
656  Float_t pfPt = 0;
657  Float_t pfEta = 0;
658  Float_t pfPhi = 0;
659  Float_t caloPt = 0;
660  Float_t caloEta = 0;
661  Float_t caloPhi = 0;
662  Float_t SumPt_value = 0;
663  Float_t vn_value[200];
664  Float_t psin_value[200];
665 
666  Float_t vn[fourierOrder_][etaBins_];
667  Float_t psin[fourierOrder_][etaBins_];
668  Float_t sumpT[etaBins_];
669 
670  double edge_pseudorapidity[etaBins_ +1] = {-5.191, -2.650, -2.043, -1.740, -1.479, -1.131, -0.783, -0.522, 0.522, 0.783, 1.131, 1.479, 1.740, 2.043, 2.650, 5.191 };
671 
673 
674  for(int ieta = 0;ieta<etaBins_;++ieta){
675  sumpT[ieta] = vnUE.get_sum_pt(ieta);
676  for(int ifour = 0;ifour<fourierOrder_; ++ifour){
677  vn[ifour][ieta] = vnUE.get_vn(ifour,ieta);
678  vn_value[ifour * etaBins_ + ieta]= vnUE.get_vn(ifour,ieta);
679  mvn->Fill(vn_value[ifour * etaBins_ + ieta]);
680 
681  psin[ifour][ieta] = vnUE.get_psin(ifour,ieta);
682  psin_value[ifour * etaBins_ + ieta] = vnUE.get_psin(ifour,ieta);
683  mpsin->Fill(psin_value[ifour * etaBins_ + ieta]);
684 
685  }
686  }
687 
688 
689  //lets start making the necessary plots
690  Float_t Vs_0_x_minus = sumpT[0]*vn[0][0]*TMath::Cos(0*psin[0][0]);
691  Float_t Vs_0_x_plus = sumpT[14]*vn[0][14]*TMath::Cos(0*psin[0][14]);
692  Float_t Vs_0_y_minus = sumpT[0]*vn[0][0]*TMath::Sin(0*psin[0][0]);
693  Float_t Vs_0_y_plus = sumpT[14]*vn[0][14]*TMath::Sin(0*psin[0][14]);
694  Float_t Vs_0_x = Vs_0_x_minus + Vs_0_x_plus;
695  Float_t Vs_0_y = Vs_0_y_minus + Vs_0_y_plus;
696 
697  Float_t Vs_1_x_minus = sumpT[0]*vn[1][0]*TMath::Cos(1*psin[1][0]);
698  Float_t Vs_1_x_plus = sumpT[14]*vn[1][14]*TMath::Cos(1*psin[1][14]);
699  Float_t Vs_1_y_minus = sumpT[0]*vn[1][0]*TMath::Sin(1*psin[1][0]);
700  Float_t Vs_1_y_plus = sumpT[14]*vn[1][14]*TMath::Sin(1*psin[1][14]);
701  Float_t Vs_1_x = Vs_1_x_minus + Vs_1_x_plus;
702  Float_t Vs_1_y = Vs_1_y_minus + Vs_1_y_plus;
703 
704  Float_t Vs_2_x_minus = sumpT[0]*vn[2][0]*TMath::Cos(2*psin[2][0]);
705  Float_t Vs_2_x_plus = sumpT[14]*vn[2][14]*TMath::Cos(2*psin[2][14]);
706  Float_t Vs_2_y_minus = sumpT[0]*vn[2][0]*TMath::Sin(2*psin[2][0]);
707  Float_t Vs_2_y_plus = sumpT[14]*vn[2][14]*TMath::Sin(2*psin[2][14]);
708  Float_t Vs_2_x = Vs_2_x_minus + Vs_2_x_plus;
709  Float_t Vs_2_y = Vs_2_y_minus + Vs_2_y_plus;
710 
711  // Float_t Vs_3_x_minus = sumpT[0]*vn[3][0]*TMath::Cos(3*psin[3][0]);
712  // Float_t Vs_3_x_plus = sumpT[14]*vn[3][14]*TMath::Cos(3*psin[3][14]);
713  // Float_t Vs_3_y_minus = sumpT[0]*vn[3][0]*TMath::Sin(3*psin[3][0]);
714  // Float_t Vs_3_y_plus = sumpT[14]*vn[3][14]*TMath::Sin(3*psin[3][14]);
715  // Float_t Vs_3_x = Vs_3_x_minus + Vs_3_x_plus;
716  // Float_t Vs_3_y = Vs_3_y_minus + Vs_3_y_plus;
717 
718  // Float_t Vs_4_x_minus = sumpT[0]*vn[4][0]*TMath::Cos(4*psin[4][0]);
719  // Float_t Vs_4_x_plus = sumpT[14]*vn[4][14]*TMath::Cos(4*psin[4][14]);
720  // Float_t Vs_4_y_minus = sumpT[0]*vn[4][0]*TMath::Sin(4*psin[4][0]);
721  // Float_t Vs_4_y_plus = sumpT[14]*vn[4][14]*TMath::Sin(4*psin[4][14]);
722  // Float_t Vs_4_x = Vs_4_x_minus + Vs_4_x_plus;
723  // Float_t Vs_4_y = Vs_4_y_minus + Vs_4_y_plus;
724 
725  mVs_0_x->Fill(Vs_0_x);
726  mVs_0_y->Fill(Vs_0_y);
727  mVs_1_x->Fill(Vs_1_x);
728  mVs_1_y->Fill(Vs_1_y);
729  mVs_2_x->Fill(Vs_2_x);
730  mVs_2_y->Fill(Vs_2_y);
731 
732  mVs_0_x_versus_HF->Fill(HF_energy,Vs_0_x);
733  mVs_0_y_versus_HF->Fill(HF_energy,Vs_0_y);
734  mVs_1_x_versus_HF->Fill(HF_energy,Vs_1_x);
735  mVs_1_y_versus_HF->Fill(HF_energy,Vs_1_y);
736  mVs_2_x_versus_HF->Fill(HF_energy,Vs_2_x);
737  mVs_2_y_versus_HF->Fill(HF_energy,Vs_2_y);
738 
739  Float_t DeltapT = 0;
740 
741  if(isCaloJet){
742 
743  Float_t SumCaloVsPtInitial[etaBins_];
744  Float_t SumCaloVsPt[etaBins_];
745  Float_t SumCaloPt[etaBins_];
746  Float_t SumSquaredCaloVsPtInitial[etaBins_];
747  Float_t SumSquaredCaloVsPt[etaBins_];
748  Float_t SumSquaredCaloPt[etaBins_];
749 
750  for(int i = 0;i<etaBins_;i++){
751 
752  SumCaloVsPtInitial[i] = 0;
753  SumCaloVsPt[i] = 0;
754  SumCaloPt[i] = 0;
755  SumSquaredCaloVsPtInitial[i] = 0;
756  SumSquaredCaloVsPt[i] = 0;
757  SumSquaredCaloPt[i] = 0;
758 
759  }
760 
761  for(unsigned icand = 0;icand<caloCandidates->size(); icand++){
762  //for(unsigned icand = 0;icand<10; icand++){
763 
764  const CaloTower & tower = (*caloCandidates)[icand];
765  reco::CandidateViewRef ref(calocandidates_,icand);
766  //10 is tower pT min
767  //const GlobalPoint& pos=geo->getPosition(tower.id());
768  //double et = tower.energy()*sin(pos.theta());
769  if(tower.p4(vtx).Et() < 0.1) continue;
770 
771  //std::cout<<"icand = "<<icand<<std::endl;
772 
773  DeltapT = 0;
774  vsPt = 0;
775  vsPtInitial = 0;
776  vsArea = 0;
777 
778  if(std::string("Vs")==UEAlgo) {
779  const reco::VoronoiBackground& voronoi = (*VsBackgrounds)[ref];
780  vsPt = voronoi.pt();
781  vsPtInitial = voronoi.pt_subtracted();
782  vsArea = voronoi.area();
783 
784  }
785 
786  NCaloTower++;
787 
788  caloPt = tower.p4(vtx).Et();
789  caloEta = tower.p4(vtx).Eta();
790  caloPhi = tower.p4(vtx).Phi();
791 
792  //std::cout<<"tower Pt = "<<caloPt<<std::endl;
793  //std::cout<<"vsPtInitial = "<<vsPtInitial<<std::endl;
794  //std::cout<<"vsPt = "<<vsPt<<std::endl;
795  //std::cout<<"tower eta = "<<caloEta<<std::endl;
796 
797  mCaloVsPtInitial_eta_phi->Fill(caloEta,caloPhi,vsPtInitial);
798  mCaloVsPt_eta_phi->Fill(caloEta,caloPhi,vsPt);
799  mCaloPt_eta_phi->Fill(caloEta,caloPhi,caloPt);
800 
801  DeltapT = caloPt - vsPtInitial;
802  //std::cout<<"Delta pT = "<<DeltapT<<std::endl;
803 
804  mDeltapT->Fill(DeltapT);
805  mDeltapT_eta->Fill(caloEta,DeltapT);
806  mDeltapT_eta_phi->Fill(caloEta,caloPhi,DeltapT);
807 
808  for(size_t k = 0;k<nedge_pseudorapidity-1; k++){
809  if(caloEta >= edge_pseudorapidity[k] && caloEta < edge_pseudorapidity[k+1]){
810  SumCaloVsPtInitial[k] = SumCaloVsPtInitial[k] + vsPtInitial;
811  SumCaloVsPt[k] = SumCaloVsPt[k] + vsPt;
812  SumCaloPt[k] = SumCaloPt[k] + caloPt;
813  SumSquaredCaloVsPtInitial[k] = SumSquaredCaloVsPtInitial[k] + vsPtInitial*vsPtInitial;
814  SumSquaredCaloVsPt[k] = SumSquaredCaloVsPt[k] + vsPt*vsPt;
815  SumSquaredCaloPt[k] = SumSquaredCaloPt[k] + caloPt*caloPt;
816  //std::cout<<edge_pseudorapidity[k]<<" to "<<edge_pseudorapidity[k+1]<<std::endl;
817  //std::cout<<" Sum tower Pt["<<k<<"] = "<<SumCaloPt[k]<<std::endl;
818  //std::cout<<" Sum vsPtInitial["<<k<<"] = "<<SumCaloVsPtInitial[k]<<std::endl;
819  //std::cout<<" Sum vsPt["<<k<<"] = "<<SumCaloVsPt[k]<<std::endl;
820  //std::cout<<" SumSquared tower Pt["<<k<<"] = "<<SumSquaredCaloPt[k]<<std::endl;
821  //std::cout<<" SumSquared vsPtInitial["<<k<<"] = "<<SumSquaredCaloVsPtInitial[k]<<std::endl;
822  //std::cout<<" SumSquared vsPt["<<k<<"] = "<<SumSquaredCaloVsPt[k]<<std::endl;
823  break;
824  }// eta selection statement
825 
826  }// eta bin loop
827 
828  SumPt_value = SumPt_value + caloPt;
829 
830  mCaloPt->Fill(caloPt);
831  mCaloEta->Fill(caloEta);
832  mCaloPhi->Fill(caloPhi);
833  mCaloVsPt->Fill(vsPt);
834  mCaloVsPtInitial->Fill(vsPtInitial);
835  //mCaloVsPtEqualized
836  mCaloArea->Fill(vsArea);
837 
838  }// calo tower candidate loop
839 
840  Float_t Evt_SumCaloVsPt = 0;
841  Float_t Evt_SumCaloVsPtInitial = 0;
842  Float_t Evt_SumCaloPt = 0;
843 
844  Float_t Evt_SumSquaredCaloVsPt = 0;
845  Float_t Evt_SumSquaredCaloVsPtInitial = 0;
846  Float_t Evt_SumSquaredCaloPt = 0;
847 
848  mSumCaloVsPtInitial_n5p191_n2p650->Fill(SumCaloVsPtInitial[0]);
849  mSumCaloVsPtInitial_n2p650_n2p043->Fill(SumCaloVsPtInitial[1]);
850  mSumCaloVsPtInitial_n2p043_n1p740->Fill(SumCaloVsPtInitial[2]);
851  mSumCaloVsPtInitial_n1p740_n1p479->Fill(SumCaloVsPtInitial[3]);
852  mSumCaloVsPtInitial_n1p479_n1p131->Fill(SumCaloVsPtInitial[4]);
853  mSumCaloVsPtInitial_n1p131_n0p783->Fill(SumCaloVsPtInitial[5]);
854  mSumCaloVsPtInitial_n0p783_n0p522->Fill(SumCaloVsPtInitial[6]);
855  mSumCaloVsPtInitial_n0p522_0p522->Fill(SumCaloVsPtInitial[7]);
856  mSumCaloVsPtInitial_0p522_0p783->Fill(SumCaloVsPtInitial[8]);
857  mSumCaloVsPtInitial_0p783_1p131->Fill(SumCaloVsPtInitial[9]);
858  mSumCaloVsPtInitial_1p131_1p479->Fill(SumCaloVsPtInitial[10]);
859  mSumCaloVsPtInitial_1p479_1p740->Fill(SumCaloVsPtInitial[11]);
860  mSumCaloVsPtInitial_1p740_2p043->Fill(SumCaloVsPtInitial[12]);
861  mSumCaloVsPtInitial_2p043_2p650->Fill(SumCaloVsPtInitial[13]);
862  mSumCaloVsPtInitial_2p650_5p191->Fill(SumCaloVsPtInitial[14]);
863 
864  mSumCaloVsPt_n5p191_n2p650->Fill(SumCaloVsPt[0]);
865  mSumCaloVsPt_n2p650_n2p043->Fill(SumCaloVsPt[1]);
866  mSumCaloVsPt_n2p043_n1p740->Fill(SumCaloVsPt[2]);
867  mSumCaloVsPt_n1p740_n1p479->Fill(SumCaloVsPt[3]);
868  mSumCaloVsPt_n1p479_n1p131->Fill(SumCaloVsPt[4]);
869  mSumCaloVsPt_n1p131_n0p783->Fill(SumCaloVsPt[5]);
870  mSumCaloVsPt_n0p783_n0p522->Fill(SumCaloVsPt[6]);
871  mSumCaloVsPt_n0p522_0p522->Fill(SumCaloVsPt[7]);
872  mSumCaloVsPt_0p522_0p783->Fill(SumCaloVsPt[8]);
873  mSumCaloVsPt_0p783_1p131->Fill(SumCaloVsPt[9]);
874  mSumCaloVsPt_1p131_1p479->Fill(SumCaloVsPt[10]);
875  mSumCaloVsPt_1p479_1p740->Fill(SumCaloVsPt[11]);
876  mSumCaloVsPt_1p740_2p043->Fill(SumCaloVsPt[12]);
877  mSumCaloVsPt_2p043_2p650->Fill(SumCaloVsPt[13]);
878  mSumCaloVsPt_2p650_5p191->Fill(SumCaloVsPt[14]);
879 
880  mSumCaloPt_n5p191_n2p650->Fill(SumCaloPt[0]);
881  mSumCaloPt_n2p650_n2p043->Fill(SumCaloPt[1]);
882  mSumCaloPt_n2p043_n1p740->Fill(SumCaloPt[2]);
883  mSumCaloPt_n1p740_n1p479->Fill(SumCaloPt[3]);
884  mSumCaloPt_n1p479_n1p131->Fill(SumCaloPt[4]);
885  mSumCaloPt_n1p131_n0p783->Fill(SumCaloPt[5]);
886  mSumCaloPt_n0p783_n0p522->Fill(SumCaloPt[6]);
887  mSumCaloPt_n0p522_0p522->Fill(SumCaloPt[7]);
888  mSumCaloPt_0p522_0p783->Fill(SumCaloPt[8]);
889  mSumCaloPt_0p783_1p131->Fill(SumCaloPt[9]);
890  mSumCaloPt_1p131_1p479->Fill(SumCaloPt[10]);
891  mSumCaloPt_1p479_1p740->Fill(SumCaloPt[11]);
892  mSumCaloPt_1p740_2p043->Fill(SumCaloPt[12]);
893  mSumCaloPt_2p043_2p650->Fill(SumCaloPt[13]);
894  mSumCaloPt_2p650_5p191->Fill(SumCaloPt[14]);
895 
896  for(size_t k = 0;k<nedge_pseudorapidity-1;k++){
897 
898  //mSumCaloVsPtInitial->Fill(SumCaloVsPtInitial[k]);
899  Evt_SumCaloVsPtInitial = Evt_SumCaloVsPtInitial + SumCaloVsPtInitial[k];
900  //mSumCaloVsPt->Fill(SumCaloVsPt[k]);
901  Evt_SumCaloVsPt = Evt_SumCaloVsPt + SumCaloVsPt[k];
902  //mSumCaloPt->Fill(SumCaloPt[k]);
903  Evt_SumCaloPt = Evt_SumCaloPt + SumCaloPt[k];
904 
905  //mSumSquaredCaloVsPtInitial->Fill(SumSquaredCaloVsPtInitial[k]);
906  Evt_SumSquaredCaloVsPtInitial = Evt_SumSquaredCaloVsPtInitial + SumSquaredCaloVsPtInitial[k];
907  //mSumSquaredCaloVsPt->Fill(SumSquaredCaloVsPt[k]);
908  Evt_SumSquaredCaloVsPt = Evt_SumSquaredCaloVsPt + SumSquaredCaloVsPt[k];
909  //mSumSquaredCaloPt->Fill(SumSquaredCaloPt[k]);
910  Evt_SumSquaredCaloPt = Evt_SumSquaredCaloPt + SumSquaredCaloPt[k];
911 
912  mSumCaloVsPtInitial_eta->Fill(edge_pseudorapidity[k],SumCaloVsPtInitial[k]);
913  mSumCaloVsPt_eta->Fill(edge_pseudorapidity[k],SumCaloVsPt[k]);
914  mSumCaloPt_eta->Fill(edge_pseudorapidity[k],SumCaloPt[k]);
915 
916  mSumSquaredCaloVsPtInitial_eta->Fill(edge_pseudorapidity[k],SumSquaredCaloVsPtInitial[k]);
917  mSumSquaredCaloVsPt_eta->Fill(edge_pseudorapidity[k],SumSquaredCaloVsPt[k]);
918  mSumSquaredCaloPt_eta->Fill(edge_pseudorapidity[k],SumSquaredCaloPt[k]);
919 
920  //std::cout<<"eta iteration = "<<edge_pseudorapidity[k]<<std::endl;
921  //std::cout<<"event value of sum tower pT = "<<Evt_SumCaloPt<<std::endl;
922  //std::cout<<"event value of sum Calo Vs pT initial = "<<Evt_SumCaloVsPtInitial<<std::endl;
923  //std::cout<<"event value of sum Calo VS pT = "<<Evt_SumCaloVsPt<<std::endl;
924 
925  }// eta bin loop
926 
927  mSumCaloVsPtInitial->Fill(Evt_SumCaloVsPtInitial);
928  mSumCaloVsPt->Fill(Evt_SumCaloVsPt);
929  mSumCaloPt->Fill(Evt_SumCaloPt);
930 
931  mSumSquaredCaloVsPtInitial->Fill(Evt_SumSquaredCaloVsPtInitial);
932  mSumSquaredCaloVsPt->Fill(Evt_SumSquaredCaloVsPt);
933  mSumSquaredCaloPt->Fill(Evt_SumSquaredCaloPt);
934 
935  mSumCaloVsPtInitial_HF->Fill(Evt_SumCaloVsPtInitial,HF_energy);
936  mSumCaloVsPt_HF->Fill(Evt_SumCaloVsPt,HF_energy);
937  mSumCaloPt_HF->Fill(Evt_SumCaloPt,HF_energy);
938 
939  mNCalopart->Fill(NCaloTower);
940  mSumpt->Fill(SumPt_value);
941 
942  }// is calo jet
943 
944  if(isPFJet){
945 
946  Float_t SumPFVsPtInitial[etaBins_];
947  Float_t SumPFVsPt[etaBins_];
948  Float_t SumPFPt[etaBins_];
949 
950  Float_t SumSquaredPFVsPtInitial[etaBins_];
951  Float_t SumSquaredPFVsPt[etaBins_];
952  Float_t SumSquaredPFPt[etaBins_];
953 
954  for(int i = 0;i<etaBins_;i++){
955 
956  SumPFVsPtInitial[i] = 0;
957  SumPFVsPt[i] = 0;
958  SumPFPt[i] = 0;
959  SumSquaredPFVsPtInitial[i] = 0;
960  SumSquaredPFVsPt[i] = 0;
961  SumSquaredPFPt[i] = 0;
962 
963  }
964 
965  for(unsigned icand=0;icand<pfCandidateColl->size(); icand++){
966 
967  const reco::PFCandidate pfCandidate = pfCandidateColl->at(icand);
968  reco::CandidateViewRef ref(pfcandidates_,icand);
969 
970  if(pfCandidate.pt() < 0.5) continue;
971 
972  if(std::string("Vs")==UEAlgo) {
973 
974  const reco::VoronoiBackground& voronoi = (*VsBackgrounds)[ref];
975  vsPt = voronoi.pt();
976  vsPtInitial = voronoi.pt_subtracted();
977  vsArea = voronoi.area();
978 
979  }
980 
981  NPFpart++;
982  pfPt = pfCandidate.pt();
983  pfEta = pfCandidate.eta();
984  pfPhi = pfCandidate.phi();
985 
986  mPFVsPtInitial_eta_phi->Fill(pfEta,pfPhi,vsPtInitial);
987  mPFVsPt_eta_phi->Fill(pfEta,pfPhi,vsPt);
988  mPFPt_eta_phi->Fill(pfEta,pfPhi,pfPt);
989 
990  DeltapT = pfPt - vsPtInitial;
991  mDeltapT->Fill(DeltapT);
992  mDeltapT_eta->Fill(pfEta,DeltapT);
993  mDeltapT_eta_phi->Fill(pfEta,pfPhi,DeltapT);
994 
995  for(size_t k = 0;k<nedge_pseudorapidity-1; k++){
996  if(pfEta >= edge_pseudorapidity[k] && pfEta < edge_pseudorapidity[k+1]){
997  SumPFVsPtInitial[k] = SumPFVsPtInitial[k] + vsPtInitial;
998  SumPFVsPt[k] = SumPFVsPt[k] + vsPt;
999  SumPFPt[k] = SumPFPt[k] + pfPt;
1000 
1001  SumSquaredPFVsPtInitial[k] = SumSquaredPFVsPtInitial[k] + vsPtInitial*vsPtInitial;
1002  SumSquaredPFVsPt[k] = SumSquaredPFVsPt[k] + vsPt*vsPt;
1003  SumSquaredPFPt[k] = SumSquaredPFPt[k] + pfPt*pfPt;
1004  break;
1005 
1006  }// eta selection statement
1007 
1008  }// eta bin loop
1009 
1010  SumPt_value = SumPt_value + pfPt;
1011 
1012  mPFPt->Fill(pfPt);
1013  mPFEta->Fill(pfEta);
1014  mPFPhi->Fill(pfPhi);
1015  mPFVsPt->Fill(vsPt);
1016  mPFVsPtInitial->Fill(vsPtInitial);
1017  //mPFVsPtEqualized
1018  mPFArea->Fill(vsArea);
1019 
1020  }// pf candidate loop
1021 
1022  Float_t Evt_SumPFVsPt = 0;
1023  Float_t Evt_SumPFVsPtInitial = 0;
1024  Float_t Evt_SumPFPt = 0;
1025 
1026  Float_t Evt_SumSquaredPFVsPt = 0;
1027  Float_t Evt_SumSquaredPFVsPtInitial = 0;
1028  Float_t Evt_SumSquaredPFPt = 0;
1029 
1030  mSumPFVsPtInitial_n5p191_n2p650->Fill(SumPFVsPtInitial[0]);
1031  mSumPFVsPtInitial_n2p650_n2p043->Fill(SumPFVsPtInitial[1]);
1032  mSumPFVsPtInitial_n2p043_n1p740->Fill(SumPFVsPtInitial[2]);
1033  mSumPFVsPtInitial_n1p740_n1p479->Fill(SumPFVsPtInitial[3]);
1034  mSumPFVsPtInitial_n1p479_n1p131->Fill(SumPFVsPtInitial[4]);
1035  mSumPFVsPtInitial_n1p131_n0p783->Fill(SumPFVsPtInitial[5]);
1036  mSumPFVsPtInitial_n0p783_n0p522->Fill(SumPFVsPtInitial[6]);
1037  mSumPFVsPtInitial_n0p522_0p522->Fill(SumPFVsPtInitial[7]);
1038  mSumPFVsPtInitial_0p522_0p783->Fill(SumPFVsPtInitial[8]);
1039  mSumPFVsPtInitial_0p783_1p131->Fill(SumPFVsPtInitial[9]);
1040  mSumPFVsPtInitial_1p131_1p479->Fill(SumPFVsPtInitial[10]);
1041  mSumPFVsPtInitial_1p479_1p740->Fill(SumPFVsPtInitial[11]);
1042  mSumPFVsPtInitial_1p740_2p043->Fill(SumPFVsPtInitial[12]);
1043  mSumPFVsPtInitial_2p043_2p650->Fill(SumPFVsPtInitial[13]);
1044  mSumPFVsPtInitial_2p650_5p191->Fill(SumPFVsPtInitial[14]);
1045 
1046  mSumPFVsPt_n5p191_n2p650->Fill(SumPFVsPt[0]);
1047  mSumPFVsPt_n2p650_n2p043->Fill(SumPFVsPt[1]);
1048  mSumPFVsPt_n2p043_n1p740->Fill(SumPFVsPt[2]);
1049  mSumPFVsPt_n1p740_n1p479->Fill(SumPFVsPt[3]);
1050  mSumPFVsPt_n1p479_n1p131->Fill(SumPFVsPt[4]);
1051  mSumPFVsPt_n1p131_n0p783->Fill(SumPFVsPt[5]);
1052  mSumPFVsPt_n0p783_n0p522->Fill(SumPFVsPt[6]);
1053  mSumPFVsPt_n0p522_0p522->Fill(SumPFVsPt[7]);
1054  mSumPFVsPt_0p522_0p783->Fill(SumPFVsPt[8]);
1055  mSumPFVsPt_0p783_1p131->Fill(SumPFVsPt[9]);
1056  mSumPFVsPt_1p131_1p479->Fill(SumPFVsPt[10]);
1057  mSumPFVsPt_1p479_1p740->Fill(SumPFVsPt[11]);
1058  mSumPFVsPt_1p740_2p043->Fill(SumPFVsPt[12]);
1059  mSumPFVsPt_2p043_2p650->Fill(SumPFVsPt[13]);
1060  mSumPFVsPt_2p650_5p191->Fill(SumPFVsPt[14]);
1061 
1062  mSumPFPt_n5p191_n2p650->Fill(SumPFPt[0]);
1063  mSumPFPt_n2p650_n2p043->Fill(SumPFPt[1]);
1064  mSumPFPt_n2p043_n1p740->Fill(SumPFPt[2]);
1065  mSumPFPt_n1p740_n1p479->Fill(SumPFPt[3]);
1066  mSumPFPt_n1p479_n1p131->Fill(SumPFPt[4]);
1067  mSumPFPt_n1p131_n0p783->Fill(SumPFPt[5]);
1068  mSumPFPt_n0p783_n0p522->Fill(SumPFPt[6]);
1069  mSumPFPt_n0p522_0p522->Fill(SumPFPt[7]);
1070  mSumPFPt_0p522_0p783->Fill(SumPFPt[8]);
1071  mSumPFPt_0p783_1p131->Fill(SumPFPt[9]);
1072  mSumPFPt_1p131_1p479->Fill(SumPFPt[10]);
1073  mSumPFPt_1p479_1p740->Fill(SumPFPt[11]);
1074  mSumPFPt_1p740_2p043->Fill(SumPFPt[12]);
1075  mSumPFPt_2p043_2p650->Fill(SumPFPt[13]);
1076  mSumPFPt_2p650_5p191->Fill(SumPFPt[14]);
1077 
1078  for(size_t k = 0;k<nedge_pseudorapidity-1;k++){
1079 
1080  //mSumPFVsPtInitial->Fill(SumPFVsPtInitial[k]);
1081  Evt_SumPFVsPtInitial = Evt_SumPFVsPtInitial + SumPFVsPtInitial[k];
1082  //mSumPFVsPt->Fill(SumPFVsPt[k]);
1083  Evt_SumPFVsPt = Evt_SumPFVsPt + SumPFVsPt[k];
1084  //mSumPFPt->Fill(SumPFPt[k]);
1085  Evt_SumPFPt = Evt_SumPFPt + SumPFPt[k];
1086 
1087  mSumPFVsPtInitial_eta->Fill(edge_pseudorapidity[k],SumPFVsPtInitial[k]);
1088  mSumPFVsPt_eta->Fill(edge_pseudorapidity[k],SumPFVsPt[k]);
1089  mSumPFPt_eta->Fill(edge_pseudorapidity[k],SumPFPt[k]);
1090 
1091  //mSumSquaredPFVsPtInitial->Fill(SumSquaredPFVsPtInitial[k]);
1092  Evt_SumSquaredPFVsPtInitial = Evt_SumSquaredPFVsPtInitial + SumSquaredPFVsPtInitial[k];
1093  //mSumSquaredPFVsPt->Fill(SumSquaredPFVsPt[k]);
1094  Evt_SumSquaredPFVsPt = Evt_SumSquaredPFVsPt + SumSquaredPFVsPt[k];
1095  //mSumSquaredPFPt->Fill(SumSquaredPFPt[k]);
1096  Evt_SumSquaredPFPt = Evt_SumSquaredPFPt + SumSquaredPFPt[k];
1097 
1098  mSumSquaredPFVsPtInitial_eta->Fill(edge_pseudorapidity[k],SumSquaredPFVsPtInitial[k]);
1099  mSumSquaredPFVsPt_eta->Fill(edge_pseudorapidity[k],SumSquaredPFVsPt[k]);
1100  mSumSquaredPFPt_eta->Fill(edge_pseudorapidity[k],SumSquaredPFPt[k]);
1101 
1102 
1103  }// eta bin loop
1104 
1105  mSumPFVsPtInitial->Fill(Evt_SumPFVsPtInitial);
1106  mSumPFVsPt->Fill(Evt_SumPFVsPt);
1107  mSumPFPt->Fill(Evt_SumPFPt);
1108 
1109  mSumSquaredPFVsPtInitial->Fill(Evt_SumSquaredPFVsPtInitial);
1110  mSumSquaredPFVsPt->Fill(Evt_SumSquaredPFVsPt);
1111  mSumSquaredPFPt->Fill(Evt_SumSquaredPFPt);
1112 
1113  mSumPFVsPtInitial_HF->Fill(Evt_SumPFVsPtInitial,HF_energy);
1114  mSumPFVsPt_HF->Fill(Evt_SumPFVsPt,HF_energy);
1115  mSumPFPt_HF->Fill(Evt_SumPFPt,HF_energy);
1116 
1117  mNPFpart->Fill(NPFpart);
1118  mSumpt->Fill(SumPt_value);
1119 
1120  }
1121 
1122  if (isCaloJet)
1123  {
1124  for (unsigned ijet=0; ijet<caloJets->size(); ijet++) recoJets.push_back((*caloJets)[ijet]);
1125  }
1126 
1127  if (isJPTJet)
1128  {
1129  for (unsigned ijet=0; ijet<jptJets->size(); ijet++) recoJets.push_back((*jptJets)[ijet]);
1130  }
1131 
1132  if (isPFJet) {
1133  if(std::string("Pu")==UEAlgo){
1134  for (unsigned ijet=0; ijet<basicJets->size();ijet++) recoJets.push_back((*basicJets)[ijet]);
1135  }
1136  if(std::string("Vs")==UEAlgo){
1137  for (unsigned ijet=0; ijet<pfJets->size(); ijet++) recoJets.push_back((*pfJets)[ijet]);
1138  }
1139  }
1140 
1141  if (isCaloJet && !caloJets.isValid()) return;
1142  if (isJPTJet && !jptJets.isValid()) return;
1143  if (isPFJet){
1144  if(std::string("Pu")==UEAlgo){if(!basicJets.isValid()) return;}
1145  if(std::string("Vs")==UEAlgo){if(!pfJets.isValid()) return;}
1146  }
1147 
1148  // int nJet_E_20_40 = 0;
1149  // int nJet_B_20_40 = 0;
1150  // int nJet_E_40 = 0;
1151  // int nJet_B_40 = 0;
1152  int nJet_40 = 0;
1153 
1154  mNJets->Fill(recoJets.size());
1155 
1156  for (unsigned ijet=0; ijet<recoJets.size(); ijet++) {
1157 
1158  if (recoJets[ijet].pt() > mRecoJetPtThreshold) {
1159  //counting forward and barrel jets
1160  // get an idea of no of jets with pT>40 GeV
1161  if(recoJets[ijet].pt() > 40)
1162  nJet_40++;
1163 
1164  if (mEta) mEta->Fill(recoJets[ijet].eta());
1165  if (mjetpileup) mjetpileup->Fill(recoJets[ijet].pileup());
1166  if (mJetArea) mJetArea ->Fill(recoJets[ijet].jetArea());
1167  if (mPhi) mPhi ->Fill(recoJets[ijet].phi());
1168  if (mEnergy) mEnergy ->Fill(recoJets[ijet].energy());
1169  if (mP) mP ->Fill(recoJets[ijet].p());
1170  if (mPt) mPt ->Fill(recoJets[ijet].pt());
1171  if (mMass) mMass ->Fill(recoJets[ijet].mass());
1172  if (mConstituents) mConstituents->Fill(recoJets[ijet].nConstituents());
1173 
1174  }
1175  }
1176 
1177  if (mNJets_40) mNJets_40->Fill(nJet_40);
1178 
1179 }
1180 
1181 
1182 //------------------------------------------------------------------------------
1183 // fillMatchHists
1184 //------------------------------------------------------------------------------
1185 void JetTester_HeavyIons::fillMatchHists(const double GenEta,
1186  const double GenPhi,
1187  const double GenPt,
1188  const double RecoEta,
1189  const double RecoPhi,
1190  const double RecoPt)
1191 {
1192  //nothing for now.
1193 }
MonitorElement * mSumCaloVsPt_eta
MonitorElement * mSumPFVsPt_1p131_1p479
MonitorElement * mSumCaloPt_0p522_0p783
MonitorElement * mSumPFVsPt_n1p740_n1p479
MonitorElement * mSumSquaredPFVsPt
const double Pi
MonitorElement * mSumPFVsPt_n0p522_0p522
int i
Definition: DBlmapReader.cc:9
MonitorElement * mVs_0_x_versus_HF
MonitorElement * mSumCaloVsPt_n1p479_n1p131
MonitorElement * mSumPFVsPt_HF
MonitorElement * mSumCaloPt_n5p191_n2p650
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * mSumCaloPt_2p043_2p650
MonitorElement * mSumPFPt_n0p783_n0p522
MonitorElement * mSumPFVsPtInitial_eta
MonitorElement * mSumPFVsPtInitial_HF
edm::InputTag mInputCollection
edm::EDGetTokenT< CaloTowerCollection > caloTowersToken_
edm::EDGetTokenT< reco::PFJetCollection > pfJetsToken_
MonitorElement * mSumCaloVsPt_n0p522_0p522
MonitorElement * mVs_0_x
MonitorElement * mNCalopart
MonitorElement * mCaloArea
MonitorElement * mSumCaloVsPtInitial_0p522_0p783
math::PtEtaPhiMLorentzVector p4(double vtxZ) const
Definition: CaloTower.cc:129
JetTester_HeavyIons(const edm::ParameterSet &)
MonitorElement * mSumCaloPt_1p479_1p740
MonitorElement * mSumSquaredCaloPt_eta
MonitorElement * mSumCaloVsPtInitial_n1p740_n1p479
MonitorElement * mSumCaloPt_n0p522_0p522
MonitorElement * mSumPFVsPtInitial_n1p131_n0p783
MonitorElement * mEnergy
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
static const Int_t etaBins_
MonitorElement * mPFPhi
MonitorElement * mSumCaloPt
MonitorElement * mSumCaloPt_n1p131_n0p783
edm::EDGetTokenT< reco::Centrality > centralityToken_
edm::EDGetTokenT< reco::PFCandidateCollection > pfCandToken_
MonitorElement * mSumSquaredCaloPt
MonitorElement * mCaloPt
MonitorElement * mPFVsPt_eta_phi
MonitorElement * mSumCaloPt_n2p043_n1p740
MonitorElement * mSumPFVsPt_2p650_5p191
MonitorElement * mNJets
MonitorElement * mSumCaloVsPtInitial_n1p479_n1p131
MonitorElement * mSumCaloVsPt_1p740_2p043
MonitorElement * mSumCaloVsPtInitial_n1p131_n0p783
MonitorElement * mDeltapT
MonitorElement * mSumSquaredPFVsPtInitial_eta
edm::EDGetTokenT< std::vector< float > > backgrounds_value_
MonitorElement * mSumCaloVsPt_n0p783_n0p522
edm::InputTag mInputPFCandCollection
static const Int_t fourierOrder_
MonitorElement * mSumCaloVsPtInitial_n0p783_n0p522
MonitorElement * mSumSquaredPFPt_eta
MonitorElement * mSumSquaredPFPt
MonitorElement * mSumPFPt_n2p650_n2p043
MonitorElement * mSumCaloVsPtInitial_eta
MonitorElement * mSumCaloVsPt_1p479_1p740
MonitorElement * mSumCaloPt_n2p650_n2p043
MonitorElement * mpsin
MonitorElement * mSumCaloPt_n1p740_n1p479
MonitorElement * mSumCaloVsPtInitial
MonitorElement * mSumPFVsPtInitial
MonitorElement * mSumCaloVsPtInitial_n2p043_n1p740
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
MonitorElement * mSumCaloVsPt_n2p043_n1p740
edm::EDGetTokenT< reco::CandidateView > caloCandViewToken_
MonitorElement * mSumPFPt_0p783_1p131
MonitorElement * mSumPFPt_1p479_1p740
MonitorElement * mSumSquaredCaloVsPtInitial_eta
void Fill(long long x)
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
MonitorElement * mSumSquaredCaloVsPt
MonitorElement * mSumSquaredCaloVsPt_eta
MonitorElement * mSumPFPt_n1p131_n0p783
MonitorElement * mSumPFVsPtInitial_n2p650_n2p043
MonitorElement * mSumPFVsPt_n2p043_n1p740
MonitorElement * mSumCaloPt_1p131_1p479
MonitorElement * mVs_2_y_versus_HF
void fillMatchHists(const double GenEta, const double GenPhi, const double GenPt, const double RecoEta, const double RecoPhi, const double RecoPt)
MonitorElement * mNJets_40
MonitorElement * mSumCaloVsPtInitial_1p740_2p043
MonitorElement * mSumPFVsPt_2p043_2p650
MonitorElement * mSumCaloVsPt_n1p740_n1p479
MonitorElement * mSumPFVsPt
MonitorElement * mSumCaloVsPt_1p131_1p479
edm::EDGetTokenT< reco::BasicJetCollection > basicJetsToken_
MonitorElement * mSumPFPt_eta
MonitorElement * mSumPFPt_n0p522_0p522
MonitorElement * mSumPFPt_n5p191_n2p650
MonitorElement * mSumPFVsPtInitial_0p783_1p131
MonitorElement * mSumCaloVsPtInitial_n5p191_n2p650
edm::EDGetTokenT< std::vector< reco::Vertex > > hiVertexToken_
MonitorElement * mVs_1_y
MonitorElement * mSumCaloVsPtInitial_0p783_1p131
MonitorElement * mJetArea
MonitorElement * mSumPFVsPtInitial_n0p522_0p522
MonitorElement * mDeltapT_eta_phi
MonitorElement * mSumPFPt_n2p043_n1p740
MonitorElement * mSumCaloPt_2p650_5p191
MonitorElement * mSumPFVsPt_1p740_2p043
MonitorElement * mSumPFPt
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
MonitorElement * mVs_1_x_versus_HF
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
MonitorElement * mNPFpart
MonitorElement * mPFPt
MonitorElement * mSumPFVsPtInitial_1p740_2p043
MonitorElement * mPFPt_eta_phi
edm::EDGetTokenT< reco::JPTJetCollection > jptJetsToken_
MonitorElement * mSumPFVsPtInitial_2p650_5p191
MonitorElement * mSumPFPt_0p522_0p783
bool isValid() const
Definition: HandleBase.h:75
MonitorElement * mSumPFVsPt_n2p650_n2p043
static const size_t nedge_pseudorapidity
MonitorElement * mSumCaloPt_eta
MonitorElement * mSumCaloVsPt_n2p650_n2p043
MonitorElement * mSumPFPt_1p131_1p479
MonitorElement * mSumPFVsPt_eta
MonitorElement * mCaloVsPtInitial_eta_phi
MonitorElement * mSumCaloVsPt_2p043_2p650
MonitorElement * mSumPFVsPtInitial_n1p740_n1p479
MonitorElement * mSumPFVsPt_n5p191_n2p650
MonitorElement * mConstituents
MonitorElement * mPFVsPtInitial
MonitorElement * mSumPFPt_1p740_2p043
edm::EDGetTokenT< reco::CandidateView > pfCandViewToken_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
MonitorElement * mSumCaloVsPt_n5p191_n2p650
MonitorElement * mSumSquaredPFVsPtInitial
MonitorElement * mSumCaloVsPt_n1p131_n0p783
MonitorElement * mPFVsPtInitial_eta_phi
edm::EDGetTokenT< reco::GenJetCollection > genJetsToken_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * mCaloVsPt_eta_phi
MonitorElement * mSumPFVsPt_n1p131_n0p783
edm::EDGetTokenT< std::vector< reco::Vertex > > pvToken_
T const * product() const
Definition: Handle.h:81
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
MonitorElement * mSumPFVsPtInitial_n5p191_n2p650
MonitorElement * mSumPFPt_n1p479_n1p131
MonitorElement * mCaloVsPt
MonitorElement * mSumPFPt_2p043_2p650
MonitorElement * mSumPFVsPtInitial_1p131_1p479
MonitorElement * mCaloVsPtInitial
tuple recoJets
Definition: RecoJets_cff.py:56
MonitorElement * mCaloEta
MonitorElement * mSumCaloVsPtInitial_n0p522_0p522
MonitorElement * mSumCaloVsPt_HF
MonitorElement * mSumCaloPt_n0p783_n0p522
MonitorElement * mPFEta
edm::EDGetTokenT< edm::HepMCProduct > evtToken_
MonitorElement * mSumCaloVsPt_0p783_1p131
MonitorElement * mCaloPhi
MonitorElement * mSumPFVsPtInitial_n2p043_n1p740
std::string const & label() const
Definition: InputTag.h:43
MonitorElement * mSumCaloVsPtInitial_n2p650_n2p043
MonitorElement * mSumCaloPt_0p783_1p131
MonitorElement * mSumCaloVsPtInitial_2p043_2p650
MonitorElement * mVs_0_y_versus_HF
double pt_subtracted() const
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
MonitorElement * mSumpt
MonitorElement * mSumPFPt_HF
static int position[264][3]
Definition: ReadPGInfo.cc:509
MonitorElement * mSumPFVsPtInitial_0p522_0p783
MonitorElement * mSumPFVsPtInitial_1p479_1p740
MonitorElement * mSumPFPt_2p650_5p191
MonitorElement * mSumSquaredPFVsPt_eta
MonitorElement * mSumPFVsPtInitial_2p043_2p650
double get_sum_pt(int eta, int type=-1) const
Definition: UEParameters.cc:24
MonitorElement * mSumCaloPt_HF
MonitorElement * mNvtx
MonitorElement * mSumPFVsPt_n0p783_n0p522
MonitorElement * mVs_1_y_versus_HF
MonitorElement * mDeltapT_eta
MonitorElement * mVs_2_y
MonitorElement * mSumCaloVsPtInitial_HF
MonitorElement * mSumCaloVsPtInitial_1p479_1p740
MonitorElement * mMass
MonitorElement * mSumPFVsPt_n1p479_n1p131
MonitorElement * mVs_2_x
MonitorElement * mCaloPt_eta_phi
edm::InputTag mInputGenCollection
MonitorElement * mSumPFPt_n1p740_n1p479
MonitorElement * mPFArea
MonitorElement * mSumCaloVsPtInitial_1p131_1p479
MonitorElement * mSumCaloVsPt_2p650_5p191
tuple pfJets
Definition: pfJets_cff.py:8
virtual double phi() const
momentum azimuthal angle
MonitorElement * mSumPFVsPt_1p479_1p740
MonitorElement * mSumCaloVsPtInitial_2p650_5p191
MonitorElement * mSumPFVsPt_0p783_1p131
edm::EDGetTokenT< edm::ValueMap< reco::VoronoiBackground > > backgrounds_
MonitorElement * mVs_0_y
MonitorElement * mSumCaloVsPt_0p522_0p783
edm::EDGetTokenT< reco::CaloJetCollection > caloJetsToken_
MonitorElement * mVs_1_x
MonitorElement * mVs_2_x_versus_HF
MonitorElement * mSumSquaredCaloVsPtInitial
MonitorElement * mSumPFVsPt_0p522_0p783
MonitorElement * mSumCaloPt_1p740_2p043
MonitorElement * mSumPFVsPtInitial_n1p479_n1p131
Definition: Run.h:41
MonitorElement * mSumCaloPt_n1p479_n1p131
MonitorElement * mPFVsPt
MonitorElement * mSumPFVsPtInitial_n0p783_n0p522
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * mjetpileup
MonitorElement * mSumCaloVsPt