CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JetAnalyzer_HeavyIons.cc
Go to the documentation of this file.
1 //
2 // Jet Analyzer class for heavy ion jets. for DQM jet analysis monitoring
3 // For CMSSW_7_4_X, especially reading background subtracted jets
4 // author: Raghav Kunnawalkam Elayavalli,
5 // Jan 12th 2015
6 // Rutgers University, email: raghav.k.e at CERN dot CH
7 //
8 
9 
11 
12 using namespace edm;
13 using namespace reco;
14 using namespace std;
15 
16 // declare the constructors:
17 
19  mInputCollection (iConfig.getParameter<edm::InputTag> ("src")),
20  mInputPFCandCollection (iConfig.getParameter<edm::InputTag> ("PFcands")),
21  centrality (iConfig.getParameter<edm::InputTag> ("centrality")),
22  mOutputFile (iConfig.getUntrackedParameter<std::string>("OutputFile","")),
23  JetType (iConfig.getUntrackedParameter<std::string>("JetType")),
24  UEAlgo (iConfig.getUntrackedParameter<std::string>("UEAlgo")),
25  Background (iConfig.getParameter<edm::InputTag> ("Background")),
26  mRecoJetPtThreshold (iConfig.getParameter<double> ("recoJetPtThreshold")),
27  mReverseEnergyFractionThreshold(iConfig.getParameter<double> ("reverseEnergyFractionThreshold")),
28  mRThreshold (iConfig.getParameter<double> ("RThreshold")),
29  JetCorrectionService (iConfig.getParameter<std::string> ("JetCorrections"))
30 {
31  std::string inputCollectionLabel(mInputCollection.label());
32 
33  isCaloJet = (std::string("calo")==JetType);
34  isJPTJet = (std::string("jpt") ==JetType);
35  isPFJet = (std::string("pf") ==JetType);
36 
37  //consumes
38  pvToken_ = consumes<std::vector<reco::Vertex> >(edm::InputTag("offlinePrimaryVertices"));
39  caloTowersToken_ = consumes<CaloTowerCollection>(edm::InputTag("towerMaker"));
40  if (isCaloJet) caloJetsToken_ = consumes<reco::CaloJetCollection>(mInputCollection);
41  if (isJPTJet) jptJetsToken_ = consumes<reco::JPTJetCollection>(mInputCollection);
42  if (isPFJet) {
43  if(std::string("Pu")==UEAlgo) basicJetsToken_ = consumes<reco::BasicJetCollection>(mInputCollection);
44  if(std::string("Vs")==UEAlgo) pfJetsToken_ = consumes<reco::PFJetCollection>(mInputCollection);
45  }
46 
47  pfCandToken_ = consumes<reco::PFCandidateCollection>(mInputPFCandCollection);
48  pfCandViewToken_ = consumes<reco::CandidateView>(mInputPFCandCollection);
49  caloCandViewToken_ = consumes<reco::CandidateView>(edm::InputTag("towerMaker"));
50  backgrounds_ = consumes<edm::ValueMap<reco::VoronoiBackground> >(Background);
51  backgrounds_value_ = consumes<std::vector<float> >(Background);
52  centralityToken_ = consumes<reco::Centrality>(centrality);
53  hiVertexToken_ = consumes<std::vector<reco::Vertex> >(edm::InputTag("hiSelectedVertex"));
54 
55  // need to initialize the PF cand histograms : which are also event variables
56  if(isPFJet){
57 
58  mNPFpart = 0;
59  mPFPt = 0;
60  mPFEta = 0;
61  mPFPhi = 0;
62  mPFVsPt = 0;
63  mPFVsPtInitial = 0;
64  mPFArea = 0;
65  mSumPFVsPt = 0;
67  mSumPFPt = 0;
69  mSumPFVsPt_eta = 0;
70  mSumPFPt_eta = 0;
73  mSumSquaredPFPt = 0;
78  mSumPFVsPt_HF = 0;
79  mSumPFPt_HF = 0;
80 
96 
112 
128 
129  }
130  if(isCaloJet){
131  mNCalopart = 0;
132  mCaloPt = 0;
133  mCaloEta = 0;
134  mCaloPhi = 0;
135  mCaloVsPt = 0;
136  mCaloVsPtInitial = 0;
137  mCaloArea = 0;
138 
139  mSumCaloVsPt = 0;
141  mSumCaloPt = 0;
143  mSumCaloVsPt_eta = 0;
144  mSumCaloPt_eta = 0;
147  mSumSquaredCaloPt = 0;
152  mSumCaloVsPt_HF = 0;
153  mSumCaloPt_HF = 0;
154 
170 
186 
202 
203  }
204 
205  mSumpt = 0;
206 
207  // Events variables
208  mNvtx = 0;
209  mHF = 0;
210 
211  // added Jan 12th 2015
212 
213 
214  // Jet parameters
215  mEta = 0;
216  mPhi = 0;
217  mEnergy = 0;
218  mP = 0;
219  mPt = 0;
220  mMass = 0;
221  mConstituents = 0;
222  mJetArea = 0;
223  mjetpileup = 0;
224  mNJets_40 = 0;
225  mNJets = 0;
226 
227 
228 }
229 
231  {
232 
233  ibooker.setCurrentFolder("JetMET/HIJetValidation/"+mInputCollection.label());
234 
235  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 };
236 
237  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);
238  TH2F *h2D_etabins_vs_pt = new TH2F("h2D_etabins_vs_pt","etaBins (x axis), sum pt (y axis)",etaBins_,edge_pseudorapidity,10000,-1000,1000);
239 
240  if(isPFJet){
241 
242  mNPFpart = ibooker.book1D("NPFpart","No of particle flow candidates",1000,0,10000);
243  mPFPt = ibooker.book1D("PFPt","PF candidate p_{T}",1000,-5000,5000);
244  mPFEta = ibooker.book1D("PFEta","PF candidate #eta",120,-6,6);
245  mPFPhi = ibooker.book1D("PFPhi","PF candidate #phi",70,-3.5,3.5);
246  mPFVsPt = ibooker.book1D("PFVsPt","Vs PF candidate p_{T}",1000,-5000,5000);
247  mPFVsPtInitial = ibooker.book1D("PFVsPtInitial","Vs background subtracted PF candidate p_{T}",1000,-5000,5000);
248  mPFArea = ibooker.book1D("PFArea","VS PF candidate area",100,0,4);
249 
250  mSumPFVsPt = ibooker.book1D("SumPFVsPt","Sum of final PF VS p_{T}",1000,-10000,10000);
251  mSumPFVsPtInitial= ibooker.book1D("SumPFVsPtInitial","Sum PF VS p_{T} after subtraction",1000,-10000,10000);
252  mSumPFPt = ibooker.book1D("SumPFPt","Sum of initial PF p_{T}",1000,-10000,10000);
253  mSumPFVsPt_eta = ibooker.book2D("SumPFVsPt_etaBins",h2D_etabins_vs_pt);
254  mSumPFVsPtInitial_eta = ibooker.book2D("SumPFVsPtInitial_etaBins",h2D_etabins_vs_pt);
255  mSumPFPt_eta = ibooker.book2D("SumPFPt_etaBins",h2D_etabins_vs_pt);
256 
257  mSumSquaredPFVsPt = ibooker.book1D("SumSquaredPFVsPt","Sum PF Vs p_{T} square",10000,0,10000);
258  mSumSquaredPFVsPtInitial= ibooker.book1D("SumSquaredPFVsPtInitial","Sum PF Vs p_{T} square after subtraction ",10000,0,10000);
259  mSumSquaredPFPt = ibooker.book1D("SumSquaredPFPt","Sum of initial PF p_{T} squared",10000,0,10000);
260  mSumSquaredPFVsPt_eta = ibooker.book2D("SumSquaredPFVsPt_etaBins",h2D_etabins_vs_pt2);
261  mSumSquaredPFVsPtInitial_eta = ibooker.book2D("SumSquaredPFVsPtInitial_etaBins",h2D_etabins_vs_pt2);
262  mSumSquaredPFPt_eta = ibooker.book2D("SumSquaredPFPt_etaBins",h2D_etabins_vs_pt2);
263 
264  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);
265  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);
266  mSumPFPt_HF = ibooker.book2D("SumPFPt_HF","HF energy (y axis) vs Sum initial PF p_{T} (x axis)",1000,-1000,1000,1000,0,10000);
267 
268  mSumPFVsPtInitial_n5p191_n2p650 = ibooker.book1D("mSumPFVsPtInitial_n5p191_n2p650","Sum PFVsPt Initial variable in the eta range -5.191 to -2.650",1000,-5000,5000);
269  mSumPFVsPtInitial_n2p650_n2p043 = ibooker.book1D("mSumPFVsPtInitial_n2p650_n2p043","Sum PFVsPt Initial variable in the eta range -2.650 to -2.043 ",1000,-5000,5000);
270  mSumPFVsPtInitial_n2p043_n1p740 = ibooker.book1D("mSumPFVsPtInitial_n2p043_n1p740","Sum PFVsPt Initial variable in the eta range -2.043 to -1.740",1000,-1000,1000);
271  mSumPFVsPtInitial_n1p740_n1p479 = ibooker.book1D("mSumPFVsPtInitial_n1p740_n1p479","Sum PFVsPt Initial variable in the eta range -1.740 to -1.479",1000,-1000,1000);
272  mSumPFVsPtInitial_n1p479_n1p131 = ibooker.book1D("mSumPFVsPtInitial_n1p479_n1p131","Sum PFVsPt Initial variable in the eta range -1.479 to -1.131",1000,-1000,1000);
273  mSumPFVsPtInitial_n1p131_n0p783 = ibooker.book1D("mSumPFVsPtInitial_n1p131_n0p783","Sum PFVsPt Initial variable in the eta range -1.131 to -0.783",1000,-1000,1000);
274  mSumPFVsPtInitial_n0p783_n0p522 = ibooker.book1D("mSumPFVsPtInitial_n0p783_n0p522","Sum PFVsPt Initial variable in the eta range -0.783 to -0.522",1000,-1000,1000);
275  mSumPFVsPtInitial_n0p522_0p522 = ibooker.book1D("mSumPFVsPtInitial_n0p522_0p522","Sum PFVsPt Initial variable in the eta range -0.522 to 0.522",1000,-1000,1000);
276  mSumPFVsPtInitial_0p522_0p783 = ibooker.book1D("mSumPFVsPtInitial_0p522_0p783","Sum PFVsPt Initial variable in the eta range 0.522 to 0.783",1000,-1000,1000);
277  mSumPFVsPtInitial_0p783_1p131 = ibooker.book1D("mSumPFVsPtInitial_0p783_1p131","Sum PFVsPt Initial variable in the eta range 0.783 to 1.131",1000,-1000,1000);
278  mSumPFVsPtInitial_1p131_1p479 = ibooker.book1D("mSumPFVsPtInitial_1p131_1p479","Sum PFVsPt Initial variable in the eta range 1.131 to 1.479",1000,-1000,1000);
279  mSumPFVsPtInitial_1p479_1p740 = ibooker.book1D("mSumPFVsPtInitial_1p479_1p740","Sum PFVsPt Initial variable in the eta range 1.479 to 1.740",1000,-1000,1000);
280  mSumPFVsPtInitial_1p740_2p043 = ibooker.book1D("mSumPFVsPtInitial_1p740_2p043","Sum PFVsPt Initial variable in the eta range 1.740 to 2.043",1000,-1000,1000);
281  mSumPFVsPtInitial_2p043_2p650 = ibooker.book1D("mSumPFVsPtInitial_2p043_2p650","Sum PFVsPt Initial variable in the eta range 2.043 to 2.650",1000,-5000,5000);
282  mSumPFVsPtInitial_2p650_5p191 = ibooker.book1D("mSumPFVsPtInitial_2p650_5p191","Sum PFVsPt Initial variable in the eta range 2.650 to 5.191",1000,-5000,5000);
283 
284  mSumPFVsPt_n5p191_n2p650 = ibooker.book1D("mSumPFVsPt_n5p191_n2p650","Sum PFVsPt variable in the eta range -5.191 to -2.650",1000,-5000,5000);
285  mSumPFVsPt_n2p650_n2p043 = ibooker.book1D("mSumPFVsPt_n2p650_n2p043","Sum PFVsPt variable in the eta range -2.650 to -2.043 ",1000,-5000,5000);
286  mSumPFVsPt_n2p043_n1p740 = ibooker.book1D("mSumPFVsPt_n2p043_n1p740","Sum PFVsPt variable in the eta range -2.043 to -1.740",1000,-1000,1000);
287  mSumPFVsPt_n1p740_n1p479 = ibooker.book1D("mSumPFVsPt_n1p740_n1p479","Sum PFVsPt variable in the eta range -1.740 to -1.479",1000,-1000,1000);
288  mSumPFVsPt_n1p479_n1p131 = ibooker.book1D("mSumPFVsPt_n1p479_n1p131","Sum PFVsPt variable in the eta range -1.479 to -1.131",1000,-1000,1000);
289  mSumPFVsPt_n1p131_n0p783 = ibooker.book1D("mSumPFVsPt_n1p131_n0p783","Sum PFVsPt variable in the eta range -1.131 to -0.783",1000,-1000,1000);
290  mSumPFVsPt_n0p783_n0p522 = ibooker.book1D("mSumPFVsPt_n0p783_n0p522","Sum PFVsPt variable in the eta range -0.783 to -0.522",1000,-1000,1000);
291  mSumPFVsPt_n0p522_0p522 = ibooker.book1D("mSumPFVsPt_n0p522_0p522","Sum PFVsPt variable in the eta range -0.522 to 0.522",1000,-1000,1000);
292  mSumPFVsPt_0p522_0p783 = ibooker.book1D("mSumPFVsPt_0p522_0p783","Sum PFVsPt variable in the eta range 0.522 to 0.783",1000,-1000,1000);
293  mSumPFVsPt_0p783_1p131 = ibooker.book1D("mSumPFVsPt_0p783_1p131","Sum PFVsPt variable in the eta range 0.783 to 1.131",1000,-1000,1000);
294  mSumPFVsPt_1p131_1p479 = ibooker.book1D("mSumPFVsPt_1p131_1p479","Sum PFVsPt variable in the eta range 1.131 to 1.479",1000,-1000,1000);
295  mSumPFVsPt_1p479_1p740 = ibooker.book1D("mSumPFVsPt_1p479_1p740","Sum PFVsPt variable in the eta range 1.479 to 1.740",1000,-1000,1000);
296  mSumPFVsPt_1p740_2p043 = ibooker.book1D("mSumPFVsPt_1p740_2p043","Sum PFVsPt variable in the eta range 1.740 to 2.043",1000,-1000,1000);
297  mSumPFVsPt_2p043_2p650 = ibooker.book1D("mSumPFVsPt_2p043_2p650","Sum PFVsPt variable in the eta range 2.043 to 2.650",1000,-5000,5000);
298  mSumPFVsPt_2p650_5p191 = ibooker.book1D("mSumPFVsPt_2p650_5p191","Sum PFVsPt variable in the eta range 2.650 to 5.191",1000,-5000,5000);
299 
300  mSumPFPt_n5p191_n2p650 = ibooker.book1D("mSumPFPt_n5p191_n2p650","Sum PFPt in the eta range -5.191 to -2.650",1000,-5000,5000);
301  mSumPFPt_n2p650_n2p043 = ibooker.book1D("mSumPFPt_n2p650_n2p043","Sum PFPt in the eta range -2.650 to -2.043 ",1000,-5000,5000);
302  mSumPFPt_n2p043_n1p740 = ibooker.book1D("mSumPFPt_n2p043_n1p740","Sum PFPt in the eta range -2.043 to -1.740",1000,-1000,1000);
303  mSumPFPt_n1p740_n1p479 = ibooker.book1D("mSumPFPt_n1p740_n1p479","Sum PFPt in the eta range -1.740 to -1.479",1000,-1000,1000);
304  mSumPFPt_n1p479_n1p131 = ibooker.book1D("mSumPFPt_n1p479_n1p131","Sum PFPt in the eta range -1.479 to -1.131",1000,-1000,1000);
305  mSumPFPt_n1p131_n0p783 = ibooker.book1D("mSumPFPt_n1p131_n0p783","Sum PFPt in the eta range -1.131 to -0.783",1000,-1000,1000);
306  mSumPFPt_n0p783_n0p522 = ibooker.book1D("mSumPFPt_n0p783_n0p522","Sum PFPt in the eta range -0.783 to -0.522",1000,-1000,1000);
307  mSumPFPt_n0p522_0p522 = ibooker.book1D("mSumPFPt_n0p522_0p522","Sum PFPt in the eta range -0.522 to 0.522",1000,-1000,1000);
308  mSumPFPt_0p522_0p783 = ibooker.book1D("mSumPFPt_0p522_0p783","Sum PFPt in the eta range 0.522 to 0.783",1000,-1000,1000);
309  mSumPFPt_0p783_1p131 = ibooker.book1D("mSumPFPt_0p783_1p131","Sum PFPt in the eta range 0.783 to 1.131",1000,-1000,1000);
310  mSumPFPt_1p131_1p479 = ibooker.book1D("mSumPFPt_1p131_1p479","Sum PFPt in the eta range 1.131 to 1.479",1000,-1000,1000);
311  mSumPFPt_1p479_1p740 = ibooker.book1D("mSumPFPt_1p479_1p740","Sum PFPt in the eta range 1.479 to 1.740",1000,-1000,1000);
312  mSumPFPt_1p740_2p043 = ibooker.book1D("mSumPFPt_1p740_2p043","Sum PFPt in the eta range 1.740 to 2.043",1000,-1000,1000);
313  mSumPFPt_2p043_2p650 = ibooker.book1D("mSumPFPt_2p043_2p650","Sum PFPt in the eta range 2.043 to 2.650",1000,-5000,5000);
314  mSumPFPt_2p650_5p191 = ibooker.book1D("mSumPFPt_2p650_5p191","Sum PFPt in the eta range 2.650 to 5.191",1000,-5000,5000);
315 
316 
317  }
318 
319  if(isCaloJet){
320 
321  mNCalopart = ibooker.book1D("NCalopart","No of particle flow candidates",1000,0,10000);
322  mCaloPt = ibooker.book1D("CaloPt","Calo candidate p_{T}",1000,-5000,5000);
323  mCaloEta = ibooker.book1D("CaloEta","Calo candidate #eta",120,-6,6);
324  mCaloPhi = ibooker.book1D("CaloPhi","Calo candidate #phi",70,-3.5,3.5);
325  mCaloVsPt = ibooker.book1D("CaloVsPt","Vs Calo candidate p_{T}",1000,-5000,5000);
326  mCaloVsPtInitial = ibooker.book1D("CaloVsPtInitial","Vs background subtracted Calo candidate p_{T}",1000,-5000,5000);
327  mCaloArea = ibooker.book1D("CaloArea","VS Calo candidate area",100,0,4);
328 
329  mSumCaloVsPt = ibooker.book1D("SumCaloVsPt","Sum of final Calo VS p_{T} ",1000,-10000,10000);
330  mSumCaloVsPtInitial= ibooker.book1D("SumCaloVsPtInitial","Sum Calo VS p_{T} after subtraction",1000,-10000,10000);
331  mSumCaloPt = ibooker.book1D("SumCaloPt","Sum Calo p_{T}",1000,-10000,10000);
332  mSumCaloVsPt_eta = ibooker.book2D("SumCaloVsPt_etaBins",h2D_etabins_vs_pt);
333  mSumCaloVsPtInitial_eta = ibooker.book2D("SumCaloVsPtInitial_etaBins",h2D_etabins_vs_pt);
334  mSumCaloPt_eta = ibooker.book2D("SumCaloPt_etaBins",h2D_etabins_vs_pt);
335 
336  mSumSquaredCaloVsPt = ibooker.book1D("SumSquaredCaloVsPt","Sum of final Calo VS p_{T} squared",10000,0,10000);
337  mSumSquaredCaloVsPtInitial= ibooker.book1D("SumSquaredCaloVsPtInitial","Sum of subtracted Calo VS p_{T} squared",10000,0,10000);
338  mSumSquaredCaloPt = ibooker.book1D("SumSquaredCaloPt","Sum of initial Calo tower p_{T} squared",10000,0,10000);
339  mSumSquaredCaloVsPt_eta = ibooker.book2D("SumSquaredCaloVsPt_etaBins",h2D_etabins_vs_pt2);
340  mSumSquaredCaloVsPtInitial_eta = ibooker.book2D("SumSquaredCaloVsPtInitial_etaBins",h2D_etabins_vs_pt2);
341  mSumSquaredCaloPt_eta = ibooker.book2D("SumSquaredCaloPt_etaBins",h2D_etabins_vs_pt2);
342 
343  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);
344  mSumCaloVsPt_HF = ibooker.book2D("SumCaloVsPt_HF","HF Energy (y axis) vs Sum Calo Vs p_{T} (x axis)",1000,-1000,1000,1000,0,10000);
345  mSumCaloPt_HF = ibooker.book2D("SumCaloPt_HF","HF Energy (y axis) vs Sum Calo tower p_{T}",1000,-1000,1000,1000,0,10000);
346 
347  mSumCaloVsPtInitial_n5p191_n2p650 = ibooker.book1D("mSumCaloVsPtInitial_n5p191_n2p650","Sum CaloVsPt Initial variable in the eta range -5.191 to -2.650",1000,-5000,5000);
348  mSumCaloVsPtInitial_n2p650_n2p043 = ibooker.book1D("mSumCaloVsPtInitial_n2p650_n2p043","Sum CaloVsPt Initial variable in the eta range -2.650 to -2.043 ",1000,-5000,5000);
349  mSumCaloVsPtInitial_n2p043_n1p740 = ibooker.book1D("mSumCaloVsPtInitial_n2p043_n1p740","Sum CaloVsPt Initial variable in the eta range -2.043 to -1.740",1000,-1000,1000);
350  mSumCaloVsPtInitial_n1p740_n1p479 = ibooker.book1D("mSumCaloVsPtInitial_n1p740_n1p479","Sum CaloVsPt Initial variable in the eta range -1.740 to -1.479",1000,-1000,1000);
351  mSumCaloVsPtInitial_n1p479_n1p131 = ibooker.book1D("mSumCaloVsPtInitial_n1p479_n1p131","Sum CaloVsPt Initial variable in the eta range -1.479 to -1.131",1000,-1000,1000);
352  mSumCaloVsPtInitial_n1p131_n0p783 = ibooker.book1D("mSumCaloVsPtInitial_n1p131_n0p783","Sum CaloVsPt Initial variable in the eta range -1.131 to -0.783",1000,-1000,1000);
353  mSumCaloVsPtInitial_n0p783_n0p522 = ibooker.book1D("mSumCaloVsPtInitial_n0p783_n0p522","Sum CaloVsPt Initial variable in the eta range -0.783 to -0.522",1000,-1000,1000);
354  mSumCaloVsPtInitial_n0p522_0p522 = ibooker.book1D("mSumCaloVsPtInitial_n0p522_0p522","Sum CaloVsPt Initial variable in the eta range -0.522 to 0.522",1000,-1000,1000);
355  mSumCaloVsPtInitial_0p522_0p783 = ibooker.book1D("mSumCaloVsPtInitial_0p522_0p783","Sum CaloVsPt Initial variable in the eta range 0.522 to 0.783",1000,-1000,1000);
356  mSumCaloVsPtInitial_0p783_1p131 = ibooker.book1D("mSumCaloVsPtInitial_0p783_1p131","Sum CaloVsPt Initial variable in the eta range 0.783 to 1.131",1000,-1000,1000);
357  mSumCaloVsPtInitial_1p131_1p479 = ibooker.book1D("mSumCaloVsPtInitial_1p131_1p479","Sum CaloVsPt Initial variable in the eta range 1.131 to 1.479",1000,-1000,1000);
358  mSumCaloVsPtInitial_1p479_1p740 = ibooker.book1D("mSumCaloVsPtInitial_1p479_1p740","Sum CaloVsPt Initial variable in the eta range 1.479 to 1.740",1000,-1000,1000);
359  mSumCaloVsPtInitial_1p740_2p043 = ibooker.book1D("mSumCaloVsPtInitial_1p740_2p043","Sum CaloVsPt Initial variable in the eta range 1.740 to 2.043",1000,-1000,1000);
360  mSumCaloVsPtInitial_2p043_2p650 = ibooker.book1D("mSumCaloVsPtInitial_2p043_2p650","Sum CaloVsPt Initial variable in the eta range 2.043 to 2.650",1000,-5000,5000);
361  mSumCaloVsPtInitial_2p650_5p191 = ibooker.book1D("mSumCaloVsPtInitial_2p650_5p191","Sum CaloVsPt Initial variable in the eta range 2.650 to 5.191",1000,-5000,5000);
362 
363  mSumCaloVsPt_n5p191_n2p650 = ibooker.book1D("mSumCaloVsPt_n5p191_n2p650","Sum CaloVsPt variable in the eta range -5.191 to -2.650",1000,-5000,5000);
364  mSumCaloVsPt_n2p650_n2p043 = ibooker.book1D("mSumCaloVsPt_n2p650_n2p043","Sum CaloVsPt variable in the eta range -2.650 to -2.043",1000,-5000,5000);
365  mSumCaloVsPt_n2p043_n1p740 = ibooker.book1D("mSumCaloVsPt_n2p043_n1p740","Sum CaloVsPt variable in the eta range -2.043 to -1.740",1000,-1000,1000);
366  mSumCaloVsPt_n1p740_n1p479 = ibooker.book1D("mSumCaloVsPt_n1p740_n1p479","Sum CaloVsPt variable in the eta range -1.740 to -1.479",1000,-1000,1000);
367  mSumCaloVsPt_n1p479_n1p131 = ibooker.book1D("mSumCaloVsPt_n1p479_n1p131","Sum CaloVsPt variable in the eta range -1.479 to -1.131",1000,-1000,1000);
368  mSumCaloVsPt_n1p131_n0p783 = ibooker.book1D("mSumCaloVsPt_n1p131_n0p783","Sum CaloVsPt variable in the eta range -1.131 to -0.783",1000,-1000,1000);
369  mSumCaloVsPt_n0p783_n0p522 = ibooker.book1D("mSumCaloVsPt_n0p783_n0p522","Sum CaloVsPt variable in the eta range -0.783 to -0.522",1000,-1000,1000);
370  mSumCaloVsPt_n0p522_0p522 = ibooker.book1D("mSumCaloVsPt_n0p522_0p522","Sum CaloVsPt variable in the eta range -0.522 to 0.522",1000,-1000,1000);
371  mSumCaloVsPt_0p522_0p783 = ibooker.book1D("mSumCaloVsPt_0p522_0p783","Sum CaloVsPt variable in the eta range 0.522 to 0.783",1000,-1000,1000);
372  mSumCaloVsPt_0p783_1p131 = ibooker.book1D("mSumCaloVsPt_0p783_1p131","Sum CaloVsPt variable in the eta range 0.783 to 1.131",1000,-1000,1000);
373  mSumCaloVsPt_1p131_1p479 = ibooker.book1D("mSumCaloVsPt_1p131_1p479","Sum CaloVsPt variable in the eta range 1.131 to 1.479",1000,-1000,1000);
374  mSumCaloVsPt_1p479_1p740 = ibooker.book1D("mSumCaloVsPt_1p479_1p740","Sum CaloVsPt variable in the eta range 1.479 to 1.740",1000,-1000,1000);
375  mSumCaloVsPt_1p740_2p043 = ibooker.book1D("mSumCaloVsPt_1p740_2p043","Sum CaloVsPt variable in the eta range 1.740 to 2.043",1000,-1000,1000);
376  mSumCaloVsPt_2p043_2p650 = ibooker.book1D("mSumCaloVsPt_2p043_2p650","Sum CaloVsPt variable in the eta range 2.043 to 2.650",1000,-5000,5000);
377  mSumCaloVsPt_2p650_5p191 = ibooker.book1D("mSumCaloVsPt_2p650_5p191","Sum CaloVsPt variable in the eta range 2.650 to 5.191",1000,-5000,5000);
378 
379  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);
380  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);
381  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);
382  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);
383  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);
384  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);
385  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);
386  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);
387  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);
388  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);
389  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);
390  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);
391  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);
392  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);
393  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);
394 
395 
396  }
397 
398  // particle flow variables histograms
399  mSumpt = ibooker.book1D("SumpT","Sum p_{T} of all the PF candidates per event",1000,0,10000);
400 
401  // Event variables
402  mNvtx = ibooker.book1D("Nvtx", "number of vertices", 60, 0, 60);
403  mHF = ibooker.book1D("HF", "HF energy distribution",1000,0,10000);
404 
405  // Jet parameters
406  mEta = ibooker.book1D("Eta", "Eta", 120, -6, 6);
407  mPhi = ibooker.book1D("Phi", "Phi", 70, -3.5, 3.5);
408  mPt = ibooker.book1D("Pt", "Pt", 100, 0, 1000);
409  mP = ibooker.book1D("P", "P", 100, 0, 1000);
410  mEnergy = ibooker.book1D("Energy", "Energy", 100, 0, 1000);
411  mMass = ibooker.book1D("Mass", "Mass", 100, 0, 200);
412  mConstituents = ibooker.book1D("Constituents", "Constituents", 100, 0, 100);
413  mJetArea = ibooker.book1D("JetArea", "JetArea", 100, 0, 4);
414  mjetpileup = ibooker.book1D("jetPileUp","jetPileUp",100,0,150);
415  mNJets_40 = ibooker.book1D("NJets_pt_greater_40", "NJets pT > 40 GeV", 50, 0, 100);
416  mNJets = ibooker.book1D("NJets", "NJets", 50, 0, 100);
417 
418  if (mOutputFile.empty ())
419  LogInfo("OutputInfo") << " Histograms will NOT be saved";
420  else
421  LogInfo("OutputInfo") << " Histograms will be saved to file:" << mOutputFile;
422 
423  delete h2D_etabins_vs_pt2;
424  delete h2D_etabins_vs_pt;
425 
426  }
427 
428 
429 
430 //------------------------------------------------------------------------------
431 // ~JetAnalyzer_HeavyIons
432 //------------------------------------------------------------------------------
434 
435 
436 //------------------------------------------------------------------------------
437 // beginJob
438 //------------------------------------------------------------------------------
439 //void JetAnalyzer_HeavyIons::beginJob() {
440 // std::cout<<"inside the begin job function"<<endl;
441 //}
442 
443 
444 //------------------------------------------------------------------------------
445 // endJob
446 //------------------------------------------------------------------------------
447 //void JetAnalyzer_HeavyIons::endJob()
448 //{
449 // if (!mOutputFile.empty() && &*edm::Service<DQMStore>())
450 // {
451 // edm::Service<DQMStore>()->save(mOutputFile);
452 // }
453 //}
454 
455 
456 //------------------------------------------------------------------------------
457 // analyze
458 //------------------------------------------------------------------------------
460 {
461  // Get the primary vertices
462  //----------------------------------------------------------------------------
464  mEvent.getByToken(pvToken_, pvHandle);
465  reco::Vertex::Point vtx(0,0,0);
467 
468  mEvent.getByToken(hiVertexToken_, vtxs);
469  int greatestvtx = 0;
470  int nVertex = vtxs->size();
471 
472  for (unsigned int i = 0 ; i< vtxs->size(); ++i){
473  unsigned int daughter = (*vtxs)[i].tracksSize();
474  if( daughter > (*vtxs)[greatestvtx].tracksSize()) greatestvtx = i;
475  }
476 
477  if(nVertex<=0){
478  vtx = reco::Vertex::Point(0,0,0);
479  }
480  vtx = (*vtxs)[greatestvtx].position();
481 
482  int nGoodVertices = 0;
483 
484  if (pvHandle.isValid())
485  {
486  for (unsigned i=0; i<pvHandle->size(); i++)
487  {
488  if ((*pvHandle)[i].ndof() > 4 &&
489  (fabs((*pvHandle)[i].z()) <= 24) &&
490  (fabs((*pvHandle)[i].position().rho()) <= 2))
491  nGoodVertices++;
492  }
493  }
494 
495  mNvtx->Fill(nGoodVertices);
496 
497 
498  // Get the Jet collection
499  //----------------------------------------------------------------------------
500 
501  std::vector<Jet> recoJets;
502  recoJets.clear();
503 
508 
509  // Get the Particle flow candidates and the Voronoi variables
511  edm::Handle<CaloTowerCollection> caloCandidates;
512  edm::Handle<reco::CandidateView> pfcandidates_;
513  edm::Handle<reco::CandidateView> calocandidates_;
514 
517 
519 
520  if (isCaloJet) mEvent.getByToken(caloJetsToken_, caloJets);
521  if (isJPTJet) mEvent.getByToken(jptJetsToken_, jptJets);
522  if (isPFJet) {
523  if(std::string("Pu")==UEAlgo) mEvent.getByToken(basicJetsToken_, basicJets);
524  if(std::string("Vs")==UEAlgo) mEvent.getByToken(pfJetsToken_, pfJets);
525  }
526 
527  mEvent.getByToken(pfCandToken_, pfCandidates);
528  mEvent.getByToken(pfCandViewToken_, pfcandidates_);
529 
530  mEvent.getByToken(caloTowersToken_, caloCandidates);
531  mEvent.getByToken(caloCandViewToken_, calocandidates_);
532 
533  mEvent.getByToken(backgrounds_, VsBackgrounds);
534  mEvent.getByToken(backgrounds_value_, vn_);
535 
536  // get the centrality
537  mEvent.getByToken(centralityToken_, cent);
538 
539  mHF->Fill(cent->EtHFtowerSum());
540  Float_t HF_energy = cent->EtHFtowerSum();
541 
542  const reco::PFCandidateCollection *pfCandidateColl = pfCandidates.product();
543 
544  Float_t vsPt=0;
545  Float_t vsPtInitial = 0;
546  Float_t vsArea = 0;
547  Int_t NPFpart = 0;
548  Int_t NCaloTower = 0;
549  Float_t pfPt = 0;
550  Float_t pfEta = 0;
551  Float_t pfPhi = 0;
552  Float_t caloPt = 0;
553  Float_t caloEta = 0;
554  Float_t caloPhi = 0;
555  Float_t SumPt_value = 0;
556 
557  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 };
558 
559 
560  if(isCaloJet){
561 
562  Float_t SumCaloVsPtInitial[etaBins_];
563  Float_t SumCaloVsPt[etaBins_];
564  Float_t SumCaloPt[etaBins_];
565 
566  Float_t SumSquaredCaloVsPtInitial[etaBins_];
567  Float_t SumSquaredCaloVsPt[etaBins_];
568  Float_t SumSquaredCaloPt[etaBins_];
569 
570  // Need to set up histograms to get the RMS values for each pT bin
571  TH1F *hSumCaloVsPtInitial[nedge_pseudorapidity-1], *hSumCaloVsPt[nedge_pseudorapidity-1], *hSumCaloPt[nedge_pseudorapidity-1];
572 
573  for(int i = 0;i<etaBins_;++i){
574 
575  SumCaloVsPtInitial[i] = 0;
576  SumCaloVsPt[i] = 0;
577  SumCaloPt[i] = 0;
578  SumSquaredCaloVsPtInitial[i] = 0;
579  SumSquaredCaloVsPt[i] = 0;
580  SumSquaredCaloPt[i] = 0;
581 
582  hSumCaloVsPtInitial[i] = new TH1F(Form("hSumCaloVsPtInitial_%d",i),"",10000,-10000,10000);
583  hSumCaloVsPt[i] = new TH1F(Form("hSumCaloVsPt_%d",i),"",10000,-10000,10000);
584  hSumCaloPt[i] = new TH1F(Form("hSumCaloPt_%d",i),"",10000,-10000,10000);
585 
586  }
587 
588  for(unsigned icand = 0;icand<caloCandidates->size(); icand++){
589 
590  const CaloTower & tower = (*caloCandidates)[icand];
591  reco::CandidateViewRef ref(calocandidates_,icand);
592  //10 is tower pT min
593  if(tower.p4(vtx).Et() < 0.1) continue;
594 
595  vsPt = 0;
596  vsPtInitial = 0;
597  vsArea = 0;
598 
599  if(std::string("Vs")==UEAlgo) {
600  const reco::VoronoiBackground& voronoi = (*VsBackgrounds)[ref];
601  vsPt = voronoi.pt();
602  vsPtInitial = voronoi.pt_subtracted();
603  vsArea = voronoi.area();
604  }
605 
606  NCaloTower++;
607 
608  caloPt = tower.p4(vtx).Et();
609  caloEta = tower.p4(vtx).Eta();
610  caloPhi = tower.p4(vtx).Phi();
611 
612 
613  for(size_t k = 0;k<nedge_pseudorapidity-1; k++){
614  if(caloEta >= edge_pseudorapidity[k] && caloEta < edge_pseudorapidity[k+1]){
615  SumCaloVsPtInitial[k] = SumCaloVsPtInitial[k] + vsPtInitial;
616  SumCaloVsPt[k] = SumCaloVsPt[k] + vsPt;
617  SumCaloPt[k] = SumCaloPt[k] + caloPt;
618  SumSquaredCaloVsPtInitial[k] = SumSquaredCaloVsPtInitial[k] + vsPtInitial*vsPtInitial;
619  SumSquaredCaloVsPt[k] = SumSquaredCaloVsPt[k] + vsPt*vsPt;
620  SumSquaredCaloPt[k] = SumSquaredCaloPt[k] + caloPt*caloPt;
621  break;
622  }// eta selection statement
623 
624  }// eta bin loop
625 
626  SumPt_value = SumPt_value + caloPt;
627 
628  mCaloPt->Fill(caloPt);
629  mCaloEta->Fill(caloEta);
630  mCaloPhi->Fill(caloPhi);
631  mCaloVsPt->Fill(vsPt);
632  mCaloVsPtInitial->Fill(vsPtInitial);
633  mCaloArea->Fill(vsArea);
634 
635  }// calo tower candidate loop
636 
637  for(int k = 0;k<nedge_pseudorapidity-1;k++){
638 
639  hSumCaloVsPtInitial[k]->Fill(SumCaloVsPtInitial[k]);
640  hSumCaloVsPt[k]->Fill(SumCaloVsPt[k]);
641  hSumCaloPt[k]->Fill(SumCaloPt[k]);
642 
643  }// eta bin loop
644 
645  Float_t Evt_SumCaloVsPt = 0;
646  Float_t Evt_SumCaloVsPtInitial = 0;
647  Float_t Evt_SumCaloPt = 0;
648 
649  Float_t Evt_SumSquaredCaloVsPt = 0;
650  Float_t Evt_SumSquaredCaloVsPtInitial = 0;
651  Float_t Evt_SumSquaredCaloPt = 0;
652 
653 
654  mSumCaloVsPtInitial_n5p191_n2p650->Fill(SumCaloVsPtInitial[0]);
655  mSumCaloVsPtInitial_n2p650_n2p043->Fill(SumCaloVsPtInitial[1]);
656  mSumCaloVsPtInitial_n2p043_n1p740->Fill(SumCaloVsPtInitial[2]);
657  mSumCaloVsPtInitial_n1p740_n1p479->Fill(SumCaloVsPtInitial[3]);
658  mSumCaloVsPtInitial_n1p479_n1p131->Fill(SumCaloVsPtInitial[4]);
659  mSumCaloVsPtInitial_n1p131_n0p783->Fill(SumCaloVsPtInitial[5]);
660  mSumCaloVsPtInitial_n0p783_n0p522->Fill(SumCaloVsPtInitial[6]);
661  mSumCaloVsPtInitial_n0p522_0p522->Fill(SumCaloVsPtInitial[7]);
662  mSumCaloVsPtInitial_0p522_0p783->Fill(SumCaloVsPtInitial[8]);
663  mSumCaloVsPtInitial_0p783_1p131->Fill(SumCaloVsPtInitial[9]);
664  mSumCaloVsPtInitial_1p131_1p479->Fill(SumCaloVsPtInitial[10]);
665  mSumCaloVsPtInitial_1p479_1p740->Fill(SumCaloVsPtInitial[11]);
666  mSumCaloVsPtInitial_1p740_2p043->Fill(SumCaloVsPtInitial[12]);
667  mSumCaloVsPtInitial_2p043_2p650->Fill(SumCaloVsPtInitial[13]);
668  mSumCaloVsPtInitial_2p650_5p191->Fill(SumCaloVsPtInitial[14]);
669 
670  mSumCaloVsPt_n5p191_n2p650->Fill(SumCaloVsPt[0]);
671  mSumCaloVsPt_n2p650_n2p043->Fill(SumCaloVsPt[1]);
672  mSumCaloVsPt_n2p043_n1p740->Fill(SumCaloVsPt[2]);
673  mSumCaloVsPt_n1p740_n1p479->Fill(SumCaloVsPt[3]);
674  mSumCaloVsPt_n1p479_n1p131->Fill(SumCaloVsPt[4]);
675  mSumCaloVsPt_n1p131_n0p783->Fill(SumCaloVsPt[5]);
676  mSumCaloVsPt_n0p783_n0p522->Fill(SumCaloVsPt[6]);
677  mSumCaloVsPt_n0p522_0p522->Fill(SumCaloVsPt[7]);
678  mSumCaloVsPt_0p522_0p783->Fill(SumCaloVsPt[8]);
679  mSumCaloVsPt_0p783_1p131->Fill(SumCaloVsPt[9]);
680  mSumCaloVsPt_1p131_1p479->Fill(SumCaloVsPt[10]);
681  mSumCaloVsPt_1p479_1p740->Fill(SumCaloVsPt[11]);
682  mSumCaloVsPt_1p740_2p043->Fill(SumCaloVsPt[12]);
683  mSumCaloVsPt_2p043_2p650->Fill(SumCaloVsPt[13]);
684  mSumCaloVsPt_2p650_5p191->Fill(SumCaloVsPt[14]);
685 
686  mSumCaloPt_n5p191_n2p650->Fill(SumCaloPt[0]);
687  mSumCaloPt_n2p650_n2p043->Fill(SumCaloPt[1]);
688  mSumCaloPt_n2p043_n1p740->Fill(SumCaloPt[2]);
689  mSumCaloPt_n1p740_n1p479->Fill(SumCaloPt[3]);
690  mSumCaloPt_n1p479_n1p131->Fill(SumCaloPt[4]);
691  mSumCaloPt_n1p131_n0p783->Fill(SumCaloPt[5]);
692  mSumCaloPt_n0p783_n0p522->Fill(SumCaloPt[6]);
693  mSumCaloPt_n0p522_0p522->Fill(SumCaloPt[7]);
694  mSumCaloPt_0p522_0p783->Fill(SumCaloPt[8]);
695  mSumCaloPt_0p783_1p131->Fill(SumCaloPt[9]);
696  mSumCaloPt_1p131_1p479->Fill(SumCaloPt[10]);
697  mSumCaloPt_1p479_1p740->Fill(SumCaloPt[11]);
698  mSumCaloPt_1p740_2p043->Fill(SumCaloPt[12]);
699  mSumCaloPt_2p043_2p650->Fill(SumCaloPt[13]);
700  mSumCaloPt_2p650_5p191->Fill(SumCaloPt[14]);
701 
702 
703  for(size_t k = 0;k<nedge_pseudorapidity-1;k++){
704 
705  Evt_SumCaloVsPtInitial = Evt_SumCaloVsPtInitial + SumCaloVsPtInitial[k];
706  Evt_SumCaloVsPt = Evt_SumCaloVsPt + SumCaloVsPt[k];
707  Evt_SumCaloPt = Evt_SumCaloPt + SumCaloPt[k];
708 
709  mSumCaloVsPtInitial_eta->Fill(edge_pseudorapidity[k],SumCaloVsPtInitial[k]);
710  mSumCaloVsPt_eta->Fill(edge_pseudorapidity[k],SumCaloVsPt[k]);
711  mSumCaloPt_eta->Fill(edge_pseudorapidity[k],SumCaloPt[k]);
712 
713  Evt_SumSquaredCaloVsPtInitial = Evt_SumSquaredCaloVsPtInitial + SumSquaredCaloVsPtInitial[k];
714  Evt_SumSquaredCaloVsPt = Evt_SumSquaredCaloVsPt + SumSquaredCaloVsPt[k];
715  Evt_SumSquaredCaloPt = Evt_SumSquaredCaloPt + SumSquaredCaloPt[k];
716 
717  mSumSquaredCaloVsPtInitial_eta->Fill(edge_pseudorapidity[k],hSumCaloVsPtInitial[k]->GetRMS(1));
718  mSumSquaredCaloVsPt_eta->Fill(edge_pseudorapidity[k],hSumCaloVsPt[k]->GetRMS(1));
719  mSumSquaredCaloPt_eta->Fill(edge_pseudorapidity[k],hSumCaloPt[k]->GetRMS(1));
720 
721  delete hSumCaloVsPtInitial[k];
722  delete hSumCaloVsPt[k];
723  delete hSumCaloPt[k];
724 
725  }// eta bin loop
726 
727  mSumCaloVsPtInitial->Fill(Evt_SumCaloVsPtInitial);
728  mSumCaloVsPt->Fill(Evt_SumCaloVsPt);
729  mSumCaloPt->Fill(Evt_SumCaloPt);
730  mSumCaloVsPtInitial_HF->Fill(Evt_SumCaloVsPtInitial,HF_energy);
731  mSumCaloVsPt_HF->Fill(Evt_SumCaloVsPt,HF_energy);
732  mSumCaloPt_HF->Fill(Evt_SumCaloPt,HF_energy);
733 
734  mSumSquaredCaloVsPtInitial->Fill(Evt_SumSquaredCaloVsPtInitial);
735  mSumSquaredCaloVsPt->Fill(Evt_SumSquaredCaloVsPt);
736  mSumSquaredCaloPt->Fill(Evt_SumSquaredCaloPt);
737 
738  mNCalopart->Fill(NCaloTower);
739  mSumpt->Fill(SumPt_value);
740 
741  }// is calo jet
742 
743  if(isPFJet){
744 
745  Float_t SumPFVsPtInitial[etaBins_];
746  Float_t SumPFVsPt[etaBins_];
747  Float_t SumPFPt[etaBins_];
748 
749  Float_t SumSquaredPFVsPtInitial[etaBins_];
750  Float_t SumSquaredPFVsPt[etaBins_];
751  Float_t SumSquaredPFPt[etaBins_];
752 
753  // Need to set up histograms to get the RMS values for each pT bin
754  TH1F *hSumPFVsPtInitial[nedge_pseudorapidity-1], *hSumPFVsPt[nedge_pseudorapidity-1], *hSumPFPt[nedge_pseudorapidity-1];
755 
756  for(int i = 0;i<etaBins_;i++){
757 
758  SumPFVsPtInitial[i] = 0;
759  SumPFVsPt[i] = 0;
760  SumPFPt[i] = 0;
761  SumSquaredPFVsPtInitial[i] = 0;
762  SumSquaredPFVsPt[i] = 0;
763  SumSquaredPFPt[i] = 0;
764 
765  hSumPFVsPtInitial[i] = new TH1F(Form("hSumPFVsPtInitial_%d",i),"",10000,-10000,10000);
766  hSumPFVsPt[i] = new TH1F(Form("hSumPFVsPt_%d",i),"",10000,-10000,10000);
767  hSumPFPt[i] = new TH1F(Form("hSumPFPt_%d",i),"",10000,-10000,10000);
768 
769  }
770 
771  for(unsigned icand=0;icand<pfCandidateColl->size(); icand++){
772 
773  const reco::PFCandidate pfCandidate = pfCandidateColl->at(icand);
774  reco::CandidateViewRef ref(pfcandidates_,icand);
775 
776  if(pfCandidate.pt() < 5) continue;
777 
778  if(std::string("Vs")==UEAlgo) {
779 
780  const reco::VoronoiBackground& voronoi = (*VsBackgrounds)[ref];
781  vsPt = voronoi.pt();
782  vsPtInitial = voronoi.pt_subtracted();
783  vsArea = voronoi.area();
784 
785  }
786 
787  NPFpart++;
788  pfPt = pfCandidate.pt();
789  pfEta = pfCandidate.eta();
790  pfPhi = pfCandidate.phi();
791 
792 
793  for(size_t k = 0;k<nedge_pseudorapidity-1; k++){
794  if(pfEta >= edge_pseudorapidity[k] && pfEta < edge_pseudorapidity[k+1]){
795  SumPFVsPtInitial[k] = SumPFVsPtInitial[k] + vsPtInitial;
796  SumPFVsPt[k] = SumPFVsPt[k] + vsPt;
797  SumPFPt[k] = SumPFPt[k] + pfPt;
798 
799  SumSquaredPFVsPtInitial[k] = SumSquaredPFVsPtInitial[k] + vsPtInitial*vsPtInitial;
800  SumSquaredPFVsPt[k] = SumSquaredPFVsPt[k] + vsPt*vsPt;
801  SumSquaredPFPt[k] = SumSquaredPFPt[k] + pfPt*pfPt;
802  break;
803  }// eta selection statement
804 
805  }// eta bin loop
806 
807  SumPt_value = SumPt_value + pfPt;
808 
809  mPFPt->Fill(pfPt);
810  mPFEta->Fill(pfEta);
811  mPFPhi->Fill(pfPhi);
812  mPFVsPt->Fill(vsPt);
813  mPFVsPtInitial->Fill(vsPtInitial);
814  mPFArea->Fill(vsArea);
815 
816  }// pf candidate loop
817 
818  for(int k = 0;k<nedge_pseudorapidity-1;k++){
819 
820  hSumPFVsPtInitial[k]->Fill(SumPFVsPtInitial[k]);
821  hSumPFVsPt[k]->Fill(SumPFVsPt[k]);
822  hSumPFPt[k]->Fill(SumPFPt[k]);
823 
824  }// eta bin loop
825 
826  Float_t Evt_SumPFVsPt = 0;
827  Float_t Evt_SumPFVsPtInitial = 0;
828  Float_t Evt_SumPFPt = 0;
829  Float_t Evt_SumSquaredPFVsPt = 0;
830  Float_t Evt_SumSquaredPFVsPtInitial = 0;
831  Float_t Evt_SumSquaredPFPt = 0;
832 
833  mSumPFVsPtInitial_n5p191_n2p650->Fill(SumPFVsPtInitial[0]);
834  mSumPFVsPtInitial_n2p650_n2p043->Fill(SumPFVsPtInitial[1]);
835  mSumPFVsPtInitial_n2p043_n1p740->Fill(SumPFVsPtInitial[2]);
836  mSumPFVsPtInitial_n1p740_n1p479->Fill(SumPFVsPtInitial[3]);
837  mSumPFVsPtInitial_n1p479_n1p131->Fill(SumPFVsPtInitial[4]);
838  mSumPFVsPtInitial_n1p131_n0p783->Fill(SumPFVsPtInitial[5]);
839  mSumPFVsPtInitial_n0p783_n0p522->Fill(SumPFVsPtInitial[6]);
840  mSumPFVsPtInitial_n0p522_0p522->Fill(SumPFVsPtInitial[7]);
841  mSumPFVsPtInitial_0p522_0p783->Fill(SumPFVsPtInitial[8]);
842  mSumPFVsPtInitial_0p783_1p131->Fill(SumPFVsPtInitial[9]);
843  mSumPFVsPtInitial_1p131_1p479->Fill(SumPFVsPtInitial[10]);
844  mSumPFVsPtInitial_1p479_1p740->Fill(SumPFVsPtInitial[11]);
845  mSumPFVsPtInitial_1p740_2p043->Fill(SumPFVsPtInitial[12]);
846  mSumPFVsPtInitial_2p043_2p650->Fill(SumPFVsPtInitial[13]);
847  mSumPFVsPtInitial_2p650_5p191->Fill(SumPFVsPtInitial[14]);
848 
849  mSumPFVsPt_n5p191_n2p650->Fill(SumPFVsPt[0]);
850  mSumPFVsPt_n2p650_n2p043->Fill(SumPFVsPt[1]);
851  mSumPFVsPt_n2p043_n1p740->Fill(SumPFVsPt[2]);
852  mSumPFVsPt_n1p740_n1p479->Fill(SumPFVsPt[3]);
853  mSumPFVsPt_n1p479_n1p131->Fill(SumPFVsPt[4]);
854  mSumPFVsPt_n1p131_n0p783->Fill(SumPFVsPt[5]);
855  mSumPFVsPt_n0p783_n0p522->Fill(SumPFVsPt[6]);
856  mSumPFVsPt_n0p522_0p522->Fill(SumPFVsPt[7]);
857  mSumPFVsPt_0p522_0p783->Fill(SumPFVsPt[8]);
858  mSumPFVsPt_0p783_1p131->Fill(SumPFVsPt[9]);
859  mSumPFVsPt_1p131_1p479->Fill(SumPFVsPt[10]);
860  mSumPFVsPt_1p479_1p740->Fill(SumPFVsPt[11]);
861  mSumPFVsPt_1p740_2p043->Fill(SumPFVsPt[12]);
862  mSumPFVsPt_2p043_2p650->Fill(SumPFVsPt[13]);
863  mSumPFVsPt_2p650_5p191->Fill(SumPFVsPt[14]);
864 
865  mSumPFPt_n5p191_n2p650->Fill(SumPFPt[0]);
866  mSumPFPt_n2p650_n2p043->Fill(SumPFPt[1]);
867  mSumPFPt_n2p043_n1p740->Fill(SumPFPt[2]);
868  mSumPFPt_n1p740_n1p479->Fill(SumPFPt[3]);
869  mSumPFPt_n1p479_n1p131->Fill(SumPFPt[4]);
870  mSumPFPt_n1p131_n0p783->Fill(SumPFPt[5]);
871  mSumPFPt_n0p783_n0p522->Fill(SumPFPt[6]);
872  mSumPFPt_n0p522_0p522->Fill(SumPFPt[7]);
873  mSumPFPt_0p522_0p783->Fill(SumPFPt[8]);
874  mSumPFPt_0p783_1p131->Fill(SumPFPt[9]);
875  mSumPFPt_1p131_1p479->Fill(SumPFPt[10]);
876  mSumPFPt_1p479_1p740->Fill(SumPFPt[11]);
877  mSumPFPt_1p740_2p043->Fill(SumPFPt[12]);
878  mSumPFPt_2p043_2p650->Fill(SumPFPt[13]);
879  mSumPFPt_2p650_5p191->Fill(SumPFPt[14]);
880 
881  for(size_t k = 0;k<nedge_pseudorapidity-1;k++){
882 
883  Evt_SumPFVsPtInitial = Evt_SumPFVsPtInitial + SumPFVsPtInitial[k];
884  Evt_SumPFVsPt = Evt_SumPFVsPt + SumPFVsPt[k];
885  Evt_SumPFPt = Evt_SumPFPt + SumPFPt[k];
886 
887  mSumPFVsPtInitial_eta->Fill(edge_pseudorapidity[k],SumPFVsPtInitial[k]);
888  mSumPFVsPt_eta->Fill(edge_pseudorapidity[k],SumPFVsPt[k]);
889  mSumPFPt_eta->Fill(edge_pseudorapidity[k],SumPFPt[k]);
890 
891  Evt_SumSquaredPFVsPtInitial = Evt_SumSquaredPFVsPtInitial + SumSquaredPFVsPtInitial[k];
892  Evt_SumSquaredPFVsPt = Evt_SumSquaredPFVsPt + SumSquaredPFVsPt[k];
893  Evt_SumSquaredPFPt = Evt_SumSquaredPFPt + SumSquaredPFPt[k];
894 
895  mSumSquaredPFVsPtInitial_eta->Fill(edge_pseudorapidity[k],hSumPFVsPtInitial[k]->GetRMS(1));
896  mSumSquaredPFVsPt_eta->Fill(edge_pseudorapidity[k],hSumPFVsPt[k]->GetRMS(1));
897  mSumSquaredPFPt_eta->Fill(edge_pseudorapidity[k],hSumPFPt[k]->GetRMS(1));
898 
899  delete hSumPFVsPtInitial[k];
900  delete hSumPFVsPt[k];
901  delete hSumPFPt[k];
902 
903  }// eta bin loop
904 
905  mSumPFVsPtInitial->Fill(Evt_SumPFVsPtInitial);
906  mSumPFVsPt->Fill(Evt_SumPFVsPt);
907  mSumPFPt->Fill(Evt_SumPFPt);
908  mSumPFVsPtInitial_HF->Fill(Evt_SumPFVsPtInitial,HF_energy);
909  mSumPFVsPt_HF->Fill(Evt_SumPFVsPt,HF_energy);
910  mSumPFPt_HF->Fill(Evt_SumPFPt,HF_energy);
911 
912  mSumSquaredPFVsPtInitial->Fill(Evt_SumSquaredPFVsPtInitial);
913  mSumSquaredPFVsPt->Fill(Evt_SumSquaredPFVsPt);
914  mSumSquaredPFPt->Fill(Evt_SumSquaredPFPt);
915 
916  mNPFpart->Fill(NPFpart);
917  mSumpt->Fill(SumPt_value);
918 
919  }
920 
921 
922  if (isCaloJet)
923  {
924  for (unsigned ijet=0; ijet<caloJets->size(); ijet++) recoJets.push_back((*caloJets)[ijet]);
925  }
926 
927  if (isJPTJet)
928  {
929  for (unsigned ijet=0; ijet<jptJets->size(); ijet++) recoJets.push_back((*jptJets)[ijet]);
930  }
931 
932  if (isPFJet) {
933  if(std::string("Pu")==UEAlgo){
934  for (unsigned ijet=0; ijet<basicJets->size();ijet++) recoJets.push_back((*basicJets)[ijet]);
935  }
936  if(std::string("Vs")==UEAlgo){
937  for (unsigned ijet=0; ijet<pfJets->size(); ijet++) recoJets.push_back((*pfJets)[ijet]);
938  }
939  }
940 
941 
942 
943  if (isCaloJet && !caloJets.isValid()) return;
944  if (isJPTJet && !jptJets.isValid()) return;
945  if (isPFJet){
946  if(std::string("Pu")==UEAlgo){if(!basicJets.isValid()) return;}
947  if(std::string("Vs")==UEAlgo){if(!pfJets.isValid()) return;}
948  }
949 
950 
951  int nJet_40 = 0;
952 
953  mNJets->Fill(recoJets.size());
954 
955  for (unsigned ijet=0; ijet<recoJets.size(); ijet++) {
956 
957 
958  if (recoJets[ijet].pt() > mRecoJetPtThreshold) {
959  //counting forward and barrel jets
960 
961  // get an idea of no of jets with pT>40 GeV
962  if(recoJets[ijet].pt() > 40)
963  nJet_40++;
964 
965  if (mEta) mEta->Fill(recoJets[ijet].eta());
966  if (mjetpileup) mjetpileup->Fill(recoJets[ijet].pileup());
967  if (mJetArea) mJetArea ->Fill(recoJets[ijet].jetArea());
968  if (mPhi) mPhi ->Fill(recoJets[ijet].phi());
969  if (mEnergy) mEnergy ->Fill(recoJets[ijet].energy());
970  if (mP) mP ->Fill(recoJets[ijet].p());
971  if (mPt) mPt ->Fill(recoJets[ijet].pt());
972  if (mMass) mMass ->Fill(recoJets[ijet].mass());
973  if (mConstituents) mConstituents->Fill(recoJets[ijet].nConstituents());
974 
975  }
976  }
977 
978  if (mNJets_40) mNJets_40->Fill(nJet_40);
979 
980 }
981 
static const Int_t etaBins_
edm::EDGetTokenT< reco::CaloJetCollection > caloJetsToken_
edm::EDGetTokenT< reco::PFCandidateCollection > pfCandToken_
MonitorElement * mSumPFVsPt_2p650_5p191
int i
Definition: DBlmapReader.cc:9
MonitorElement * mSumCaloVsPt_HF
MonitorElement * mSumCaloVsPtInitial_n2p043_n1p740
MonitorElement * mSumCaloVsPt_n5p191_n2p650
MonitorElement * mSumCaloVsPt_n1p131_n0p783
MonitorElement * mSumSquaredPFPt
MonitorElement * mSumPFVsPtInitial
edm::EDGetTokenT< reco::CandidateView > caloCandViewToken_
MonitorElement * mSumCaloPt_n2p043_n1p740
edm::EDGetTokenT< reco::JPTJetCollection > jptJetsToken_
MonitorElement * mSumCaloVsPtInitial_HF
MonitorElement * mSumPFVsPtInitial_1p131_1p479
MonitorElement * mSumSquaredCaloVsPt_eta
MonitorElement * mSumPFVsPt_n5p191_n2p650
MonitorElement * mSumCaloVsPtInitial_n2p650_n2p043
MonitorElement * mCaloVsPtInitial
math::PtEtaPhiMLorentzVector p4(double vtxZ) const
Definition: CaloTower.cc:129
MonitorElement * mSumCaloVsPt_1p479_1p740
MonitorElement * mSumCaloVsPt_n2p650_n2p043
MonitorElement * mSumCaloVsPt_n0p783_n0p522
MonitorElement * mSumSquaredCaloVsPtInitial_eta
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
MonitorElement * mSumCaloVsPtInitial_1p479_1p740
MonitorElement * mSumPFVsPt_n2p043_n1p740
edm::EDGetTokenT< reco::PFJetCollection > pfJetsToken_
MonitorElement * mSumCaloVsPtInitial_1p131_1p479
MonitorElement * mSumCaloPt_0p783_1p131
edm::EDGetTokenT< std::vector< float > > backgrounds_value_
MonitorElement * mSumCaloVsPtInitial_n1p479_n1p131
MonitorElement * mSumPFPt_n0p522_0p522
MonitorElement * mSumSquaredCaloPt
MonitorElement * mSumPFPt_2p043_2p650
MonitorElement * mSumPFVsPt_0p522_0p783
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * mSumSquaredCaloVsPtInitial
MonitorElement * mSumCaloPt_1p131_1p479
MonitorElement * mSumSquaredPFVsPt_eta
MonitorElement * mSumPFVsPt_eta
MonitorElement * mSumPFVsPtInitial_2p650_5p191
MonitorElement * mSumCaloVsPt_1p131_1p479
MonitorElement * mSumPFPt_n1p740_n1p479
MonitorElement * mSumPFVsPtInitial_n2p650_n2p043
MonitorElement * mSumPFPt_2p650_5p191
MonitorElement * mSumPFVsPtInitial_0p783_1p131
edm::EDGetTokenT< std::vector< reco::Vertex > > pvToken_
MonitorElement * mSumPFVsPtInitial_n0p783_n0p522
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
MonitorElement * mSumCaloPt_eta
MonitorElement * mSumPFPt_0p522_0p783
MonitorElement * mSumPFPt_n2p650_n2p043
MonitorElement * mSumCaloPt_n1p740_n1p479
void Fill(long long x)
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
MonitorElement * mSumPFVsPt_1p740_2p043
MonitorElement * mSumCaloPt_0p522_0p783
MonitorElement * mSumCaloVsPt_n1p479_n1p131
MonitorElement * mSumCaloPt_n2p650_n2p043
MonitorElement * mSumPFPt_0p783_1p131
MonitorElement * mSumCaloPt_1p479_1p740
MonitorElement * mSumPFVsPt_1p479_1p740
MonitorElement * mSumPFVsPt_HF
MonitorElement * mSumCaloVsPtInitial_0p522_0p783
MonitorElement * mSumCaloPt_HF
MonitorElement * mPFVsPtInitial
MonitorElement * mSumCaloVsPtInitial_n0p522_0p522
MonitorElement * mSumPFVsPtInitial_n1p479_n1p131
MonitorElement * mSumPFVsPt_n2p650_n2p043
MonitorElement * mSumPFVsPt_n0p522_0p522
MonitorElement * mSumSquaredPFVsPtInitial
MonitorElement * mSumCaloVsPtInitial_n1p131_n0p783
MonitorElement * mSumSquaredCaloVsPt
MonitorElement * mSumPFVsPt_1p131_1p479
MonitorElement * mSumPFPt_1p131_1p479
MonitorElement * mSumPFVsPtInitial_1p479_1p740
MonitorElement * mSumPFVsPt_n0p783_n0p522
MonitorElement * mSumPFPt_n1p479_n1p131
edm::EDGetTokenT< std::vector< reco::Vertex > > hiVertexToken_
MonitorElement * mConstituents
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
MonitorElement * mSumPFVsPt_n1p479_n1p131
MonitorElement * mSumSquaredPFVsPt
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
MonitorElement * mSumCaloVsPt_n1p740_n1p479
MonitorElement * mSumCaloVsPtInitial_1p740_2p043
MonitorElement * mSumCaloPt_n0p783_n0p522
MonitorElement * mSumSquaredCaloPt_eta
edm::EDGetTokenT< reco::Centrality > centralityToken_
MonitorElement * mSumCaloVsPtInitial_2p043_2p650
bool isValid() const
Definition: HandleBase.h:75
MonitorElement * mSumCaloPt_n0p522_0p522
MonitorElement * mSumPFVsPtInitial_n2p043_n1p740
MonitorElement * mSumCaloVsPt_n2p043_n1p740
MonitorElement * mSumPFPt_n5p191_n2p650
MonitorElement * mSumPFVsPt_2p043_2p650
MonitorElement * mSumCaloVsPt_1p740_2p043
MonitorElement * mSumCaloVsPt_n0p522_0p522
MonitorElement * mSumCaloVsPt_2p650_5p191
MonitorElement * mSumPFVsPtInitial_n5p191_n2p650
edm::EDGetTokenT< reco::BasicJetCollection > basicJetsToken_
MonitorElement * mSumPFVsPtInitial_HF
MonitorElement * mSumCaloVsPtInitial_n1p740_n1p479
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
MonitorElement * mSumPFPt_1p479_1p740
MonitorElement * mSumCaloPt_2p650_5p191
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
edm::InputTag mInputPFCandCollection
MonitorElement * mSumPFVsPtInitial_n1p131_n0p783
T const * product() const
Definition: Handle.h:81
edm::EDGetTokenT< edm::ValueMap< reco::VoronoiBackground > > backgrounds_
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
MonitorElement * mSumSquaredPFPt_eta
MonitorElement * mSumPFPt_n1p131_n0p783
MonitorElement * mSumCaloVsPtInitial_n5p191_n2p650
tuple recoJets
Definition: RecoJets_cff.py:56
MonitorElement * mSumCaloVsPtInitial
edm::EDGetTokenT< reco::CandidateView > pfCandViewToken_
MonitorElement * mSumCaloVsPtInitial_eta
edm::EDGetTokenT< CaloTowerCollection > caloTowersToken_
MonitorElement * mSumCaloVsPtInitial_0p783_1p131
MonitorElement * mSumPFPt_1p740_2p043
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * mSumCaloPt_n5p191_n2p650
MonitorElement * mSumPFPt_n0p783_n0p522
MonitorElement * mSumCaloPt_2p043_2p650
std::string const & label() const
Definition: InputTag.h:43
MonitorElement * mSumCaloPt_n1p131_n0p783
MonitorElement * mSumPFPt_n2p043_n1p740
double pt_subtracted() const
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
static int position[264][3]
Definition: ReadPGInfo.cc:509
MonitorElement * mSumCaloVsPtInitial_n0p783_n0p522
static const Int_t nedge_pseudorapidity
MonitorElement * mSumCaloVsPtInitial_2p650_5p191
MonitorElement * mSumPFVsPtInitial_0p522_0p783
MonitorElement * mSumPFVsPt_0p783_1p131
MonitorElement * mSumCaloPt_n1p479_n1p131
MonitorElement * mSumPFVsPtInitial_n1p740_n1p479
JetAnalyzer_HeavyIons(const edm::ParameterSet &)
MonitorElement * mSumPFVsPtInitial_1p740_2p043
tuple pfJets
Definition: pfJets_cff.py:8
virtual double phi() const
momentum azimuthal angle
MonitorElement * mSumPFVsPt_n1p740_n1p479
MonitorElement * mSumSquaredPFVsPtInitial_eta
MonitorElement * mSumPFVsPt_n1p131_n0p783
MonitorElement * mSumPFVsPtInitial_2p043_2p650
MonitorElement * mSumCaloVsPt_eta
MonitorElement * mSumCaloVsPt_0p522_0p783
MonitorElement * mSumPFVsPtInitial_eta
Definition: Run.h:43
MonitorElement * mSumCaloVsPt_0p783_1p131
MonitorElement * mSumCaloPt_1p740_2p043
MonitorElement * mSumPFVsPtInitial_n0p522_0p522
MonitorElement * mSumCaloVsPt_2p043_2p650