CMS 3D CMS Logo

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, Mohammed Zakaria (co Author)
5 // Jan 12th 2015
6 // Rutgers University, email: raghav.k.e at CERN dot CH
7 // UIC, email: mzakaria @ CERN dot CH
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  mInputVtxCollection (iConfig.getUntrackedParameter<edm::InputTag>("srcVtx", edm::InputTag("hiSelectedVertex"))),
21  mInputPFCandCollection (iConfig.getParameter<edm::InputTag> ("PFcands")),
22  mInputCsCandCollection (iConfig.exists("CScands") ? iConfig.getParameter<edm::InputTag>("CScands") : edm::InputTag()),
23  mOutputFile (iConfig.getUntrackedParameter<std::string>("OutputFile","")),
24  JetType (iConfig.getUntrackedParameter<std::string>("JetType")),
25  UEAlgo (iConfig.getUntrackedParameter<std::string>("UEAlgo")),
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("Cs")==UEAlgo) pfJetsToken_ = consumes<reco::PFJetCollection>(mInputCollection);
45  }
46 
47  pfCandToken_ = consumes<reco::PFCandidateCollection>(mInputPFCandCollection);
48  csCandToken_ = mayConsume<reco::PFCandidateCollection>(mInputCsCandCollection);
49  pfCandViewToken_ = consumes<reco::CandidateView>(mInputPFCandCollection);
50  caloCandViewToken_ = consumes<reco::CandidateView>(edm::InputTag("towerMaker"));
51 
52  centralityTag_ = iConfig.getParameter<InputTag>("centralitycollection");
53  centralityToken = consumes<reco::Centrality>(centralityTag_);
54 
55  centralityBinToken = mayConsume<int>(iConfig.exists("centralitybincollection") ? iConfig.getParameter<edm::InputTag> ("centralitybincollection"): edm::InputTag());
56 
57  hiVertexToken_ = consumes<std::vector<reco::Vertex> >(mInputVtxCollection);
58 
59  etaToken_ = mayConsume<std::vector<double>>(iConfig.exists("etaMap") ? iConfig.getParameter<edm::InputTag>( "etaMap" ) : edm::InputTag());
60  rhoToken_ = mayConsume<std::vector<double>>(iConfig.exists("rho") ? iConfig.getParameter<edm::InputTag>( "rho" ) : edm::InputTag());
61  rhomToken_ = mayConsume<std::vector<double>>(iConfig.exists("rhom") ? iConfig.getParameter<edm::InputTag>( "rhom" ): edm::InputTag());
62 
63  // need to initialize the PF cand histograms : which are also event variables
64  if(isPFJet){
65  mNPFpart = nullptr;
66  mPFPt = nullptr;
67  mPFEta = nullptr;
68  mPFPhi = nullptr;
69 
70  mSumPFPt = nullptr;
71  mSumPFPt_eta = nullptr;
72  mSumSquaredPFPt = nullptr;
73  mSumSquaredPFPt_eta = nullptr;
74  mSumPFPt_HF = nullptr;
75 
76  mPFDeltaR = nullptr;
77  mPFDeltaR_Scaled_R = nullptr;
78 
79  for(int ieta=0; ieta<etaBins_; ieta++){
80  mSumPFPtEtaDep[ieta] = nullptr;
81  }
82 
83  //cs-specific histograms
84  mRhoDist_vsEta=nullptr;
85  mRhoMDist_vsEta=nullptr;
86  mRhoDist_vsPt=nullptr;
87  mRhoMDist_vsPt=nullptr;
88 
89  rhoEtaRange=nullptr;
90  for(int ieta=0; ieta<etaBins_; ieta++){
91  mCSCandpT_vsPt[ieta]=nullptr;
92  mRhoDist_vsCent[ieta]=nullptr;
93  mRhoMDist_vsCent[ieta]=nullptr;
94  for(int ipt=0; ipt<ptBins_; ipt++){
95  mSubtractedEFrac[ipt][ieta]=nullptr;
96  mSubtractedE[ipt][ieta]=nullptr;
97  }
98  }
99 
100  mPFCandpT_vs_eta_Unknown = nullptr; // pf id 0
101  mPFCandpT_vs_eta_ChargedHadron = nullptr; // pf id - 1
102  mPFCandpT_vs_eta_electron = nullptr; // pf id - 2
103  mPFCandpT_vs_eta_muon = nullptr; // pf id - 3
104  mPFCandpT_vs_eta_photon = nullptr; // pf id - 4
105  mPFCandpT_vs_eta_NeutralHadron = nullptr; // pf id - 5
106  mPFCandpT_vs_eta_HadE_inHF = nullptr; // pf id - 6
107  mPFCandpT_vs_eta_EME_inHF = nullptr; // pf id - 7
108 
109  mPFCandpT_Barrel_Unknown = nullptr; // pf id 0
110  mPFCandpT_Barrel_ChargedHadron = nullptr; // pf id - 1
111  mPFCandpT_Barrel_electron = nullptr; // pf id - 2
112  mPFCandpT_Barrel_muon = nullptr; // pf id - 3
113  mPFCandpT_Barrel_photon = nullptr; // pf id - 4
114  mPFCandpT_Barrel_NeutralHadron = nullptr; // pf id - 5
115  mPFCandpT_Barrel_HadE_inHF = nullptr; // pf id - 6
116  mPFCandpT_Barrel_EME_inHF = nullptr; // pf id - 7
117 
118  mPFCandpT_Endcap_Unknown = nullptr; // pf id 0
119  mPFCandpT_Endcap_ChargedHadron = nullptr; // pf id - 1
120  mPFCandpT_Endcap_electron = nullptr; // pf id - 2
121  mPFCandpT_Endcap_muon = nullptr; // pf id - 3
122  mPFCandpT_Endcap_photon = nullptr; // pf id - 4
123  mPFCandpT_Endcap_NeutralHadron = nullptr; // pf id - 5
124  mPFCandpT_Endcap_HadE_inHF = nullptr; // pf id - 6
125  mPFCandpT_Endcap_EME_inHF = nullptr; // pf id - 7
126 
127  mPFCandpT_Forward_Unknown = nullptr; // pf id 0
128  mPFCandpT_Forward_ChargedHadron = nullptr; // pf id - 1
129  mPFCandpT_Forward_electron = nullptr; // pf id - 2
130  mPFCandpT_Forward_muon = nullptr; // pf id - 3
131  mPFCandpT_Forward_photon = nullptr; // pf id - 4
132  mPFCandpT_Forward_NeutralHadron = nullptr; // pf id - 5
133  mPFCandpT_Forward_HadE_inHF = nullptr; // pf id - 6
134  mPFCandpT_Forward_EME_inHF = nullptr; // pf id - 7
135 
136  }
137  if(isCaloJet){
138  mNCalopart = nullptr;
139  mCaloPt = nullptr;
140  mCaloEta = nullptr;
141  mCaloPhi = nullptr;
142 
143  mSumCaloPt = nullptr;
144  mSumCaloPt_eta = nullptr;
145  mSumSquaredCaloPt = nullptr;
146  mSumSquaredCaloPt_eta = nullptr;
147  mSumCaloPt_HF = nullptr;
148 
149  for(int ieta=0; ieta<etaBins_; ieta++){
150  mSumCaloPtEtaDep[ieta]=nullptr;
151  }
152  }
153 
154  mSumpt = nullptr;
155 
156  // Events variables
157  mNvtx = nullptr;
158  mHF = nullptr;
159 
160  // added Jan 12th 2015
161 
162  // Jet parameters
163  mEta = nullptr;
164  mPhi = nullptr;
165  mEnergy = nullptr;
166  mP = nullptr;
167  mPt = nullptr;
168  mMass = nullptr;
169  mConstituents = nullptr;
170  mJetArea = nullptr;
171  mjetpileup = nullptr;
172  mNJets_40 = nullptr;
173  mNJets = nullptr;
174 
175 
176 }
177 
179 {
180 
181  ibooker.setCurrentFolder("JetMET/HIJetValidation/"+mInputCollection.label());
182 
183  TH2F *h2D_etabins_vs_pt2 = new TH2F("h2D_etabins_vs_pt2",";#eta;sum p_{T}^{2}",etaBins_,edge_pseudorapidity,10000,0,10000);
184  TH2F *h2D_etabins_vs_pt = new TH2F("h2D_etabins_vs_pt",";#eta;sum p_{T}",etaBins_,edge_pseudorapidity,500,0,500);
185  TH2F *h2D_pfcand_etabins_vs_pt = new TH2F("h2D_etabins_vs_pt",";#eta;sum p_{T}",etaBins_,edge_pseudorapidity,300, 0, 300);
186 
187  const int nHihfBins = 100;
188  const double hihfBins[nHihfBins+1] = {0, 11.282305, 11.82962, 12.344717, 13.029054, 13.698554, 14.36821, 15.140326, 15.845786, 16.684441, 17.449186, 18.364939, 19.247023, 20.448898, 21.776642, 22.870239, 24.405788, 26.366919, 28.340206, 30.661842, 33.657627, 36.656773, 40.028049, 44.274784, 48.583706, 52.981358, 56.860199, 61.559853, 66.663689, 72.768196, 78.265915, 84.744431, 92.483459, 100.281021, 108.646576, 117.023911, 125.901093, 135.224899, 147.046875, 159.864258, 171.06015, 184.76535, 197.687103, 212.873535, 229.276413, 245.175369, 262.498322, 280.54599, 299.570801, 317.188446, 336.99881, 357.960144, 374.725922, 400.638367, 426.062103, 453.07251, 483.99704, 517.556396, 549.421143, 578.050781, 608.358643, 640.940979, 680.361755, 719.215027, 757.798645, 793.882385, 839.83728, 887.268127, 931.233276, 980.856689, 1023.191833, 1080.281494, 1138.363892, 1191.303345, 1251.439453, 1305.288818, 1368.290894, 1433.700684, 1501.597412, 1557.918335, 1625.636475, 1695.08374, 1761.771484, 1848.941162, 1938.178345, 2027.55603, 2127.364014, 2226.186523, 2315.188965, 2399.225342, 2501.608643, 2611.077881, 2726.316162, 2848.74707, 2972.975342, 3096.565674, 3219.530762, 3361.178223, 3568.028564, 3765.690186, 50000};
189 
190  TH2F *h2D_etabins_forRho = new TH2F("etabinsForRho","#rho vs. #eta;#eta;#rho",etaBins_, edge_pseudorapidity, 500,0,300);
191  TH2F *h2D_ptBins_forRho = new TH2F("ptBinsForRho","#rho vs. p_{T};p_{T};#rho",300,0,300,500,0,300);
192  TH2F *h2D_centBins_forRho = new TH2F("centBinsForRho","dummy;HIHF;#rho",nHihfBins,hihfBins,500,0,300);
193 
194  TH2F *h2D_etabins_forRhoM = new TH2F("etabinsForRho","#rho_{M} vs. #eta;#eta;#rho_{M}",etaBins_, edge_pseudorapidity, 100,0,1.5);
195  TH2F *h2D_ptBins_forRhoM = new TH2F("ptBinsForRho","#rho_{M} vs. p_{T};p_{T};#rho_{M}",300,0,300,100,0,1.5);
196  TH2F *h2D_centBins_forRhoM = new TH2F("centBinsForRho","dummy;HIHF;#rho_{M}",nHihfBins,hihfBins,100,0,1.5);
197 
198  if(isPFJet){
199 
200  mNPFpart = ibooker.book1D("NPFpart","No of particle flow candidates",1000,0,1000);
201  mPFPt = ibooker.book1D("PFPt","PF candidate p_{T}",10000,-500,500);
202  mPFEta = ibooker.book1D("PFEta","PF candidate #eta",120,-6,6);
203  mPFPhi = ibooker.book1D("PFPhi","PF candidate #phi",70,-3.5,3.5);
204 
205  mPFDeltaR = ibooker.book1D("PFDeltaR","PF candidate DeltaR",100,0,4); //MZ
206  mPFDeltaR_Scaled_R = ibooker.book1D("PFDeltaR_Scaled_R","PF candidate DeltaR Divided by DeltaR square",100,0,4); //MZ
207 
208  mSumPFPt = ibooker.book1D("SumPFPt","Sum of initial PF p_{T}",1000,-10000,10000);
209  mSumPFPt_eta = ibooker.book2D("SumPFPt_etaBins",h2D_etabins_vs_pt);
210 
211  mSumSquaredPFPt = ibooker.book1D("SumSquaredPFPt","Sum of initial PF p_{T} squared",10000,0,10000);
212  mSumSquaredPFPt_eta = ibooker.book2D("SumSquaredPFPt_etaBins",h2D_etabins_vs_pt2);
213 
214  mSumPFPt_HF = ibooker.book2D("SumPFPt_HF","HF energy (y axis) vs Sum initial PF p_{T} (x axis)",1000,-1000,1000,1000,0,10000);
215 
216  for(int ieta=0; ieta<etaBins_; ieta++){
217  int range = 1000;
218  if(ieta<2 || etaBins_-ieta<=2) range = 500;
219  const char* lc = edge_pseudorapidity[ieta]<0 ? "n":"p";
220  const char* rc = edge_pseudorapidity[ieta+1]<0 ? "n":"p";
221  std::string histoName = Form("mSumCaloPt_%s%.3g_%s%.3g",lc,abs(edge_pseudorapidity[ieta]),rc,abs(edge_pseudorapidity[ieta+1]));
222  for(int id=0; id<2; id++){ if(histoName.find(".")!=std::string::npos) { histoName.replace(histoName.find("."), 1, "p"); } }
223  mSumPFPtEtaDep[ieta] = ibooker.book1D(histoName.c_str(),Form("Sum PFPt in the eta range %.3g to %.3g",edge_pseudorapidity[ieta],edge_pseudorapidity[ieta+1]),500,0,range);
224  }
225 
226  if(std::string("Cs")==UEAlgo){
227  mRhoDist_vsEta= ibooker.book2D("rhoDist_vsEta",h2D_etabins_forRho);
228  mRhoMDist_vsEta= ibooker.book2D("rhoMDist_vsEta",h2D_etabins_forRhoM);
229  mRhoDist_vsPt= ibooker.book2D("rhoDist_vsPt",h2D_ptBins_forRho);
230  mRhoMDist_vsPt= ibooker.book2D("rhoMDist_vsPt",h2D_ptBins_forRhoM);
231 
232  //this is kind of a janky way to fill the eta since i can't get it from the edm::Event here... - kjung
233  rhoEtaRange=ibooker.book1D("rhoEtaRange","",500,-5.5,5.5);
234  for(int ieta=0; ieta<etaBins_; ieta++){
235  mCSCandpT_vsPt[ieta]=ibooker.book1D(Form("csCandPt_etaBin%d",ieta),"CS candidate pt, eta-by-eta",150,0,300);
236 
237  const char* lc = edge_pseudorapidity[ieta]<0 ? "n":"p";
238  const char* rc = edge_pseudorapidity[ieta+1]<0 ? "n":"p";
239  std::string histoName = Form("Dist_vsCent_%s%.3g_%s%.3g",lc,abs(edge_pseudorapidity[ieta]),rc,abs(edge_pseudorapidity[ieta+1]));
240  for(int id=0; id<2; id++){ if(histoName.find(".")!=std::string::npos){ histoName.replace(histoName.find("."), 1, "p"); } }
241  std::string rhoName = "rho";
242  rhoName.append(histoName);
243  h2D_centBins_forRho->SetTitle(Form("#rho vs. HIHF in the range %.3g < #eta < %.3g",edge_pseudorapidity[ieta],edge_pseudorapidity[ieta+1]));
244  mRhoDist_vsCent[ieta] = ibooker.book2D(rhoName.c_str(),h2D_centBins_forRho);
245  std::string rhoMName = "rhoM";
246  rhoMName.append(histoName);
247  h2D_centBins_forRhoM->SetTitle(Form("#rho_{M} vs. HIHF in the range %.3g < #eta < %.3g",edge_pseudorapidity[ieta],edge_pseudorapidity[ieta+1]));
248  mRhoMDist_vsCent[ieta] = ibooker.book2D(rhoMName.c_str(),h2D_centBins_forRhoM);
249  for(int ipt=0; ipt<ptBins_; ipt++){
250  mSubtractedEFrac[ipt][ieta]= ibooker.book1D(Form("subtractedEFrac_JetPt%d_to_%d_etaBin%d",ptBin[ipt],ptBin[ipt+1],ieta),"subtracted fraction of CS jet",50,0,1);
251  mSubtractedE[ipt][ieta]= ibooker.book1D(Form("subtractedE_JetPt%d_to_%d_etaBin%d",ptBin[ipt],ptBin[ipt+1],ieta),"subtracted total of CS jet",300,0,300);
252  }
253  mCSCand_corrPFcand[ieta] = ibooker.book2D(Form("csCandCorrPF%d",ieta), "CS to PF candidate correlation, eta-by-eta",300,0,300,300,0,300);
254  }
255  }
256 
257  mPFCandpT_vs_eta_Unknown = ibooker.book2D("PF_cand_X_unknown",h2D_pfcand_etabins_vs_pt); // pf id 0
258  mPFCandpT_vs_eta_ChargedHadron = ibooker.book2D("PF_cand_chargedHad",h2D_pfcand_etabins_vs_pt); // pf id - 1
259  mPFCandpT_vs_eta_electron = ibooker.book2D("PF_cand_electron",h2D_pfcand_etabins_vs_pt); // pf id - 2
260  mPFCandpT_vs_eta_muon = ibooker.book2D("PF_cand_muon",h2D_pfcand_etabins_vs_pt); // pf id - 3
261  mPFCandpT_vs_eta_photon = ibooker.book2D("PF_cand_photon",h2D_pfcand_etabins_vs_pt); // pf id - 4
262  mPFCandpT_vs_eta_NeutralHadron = ibooker.book2D("PF_cand_neutralHad",h2D_pfcand_etabins_vs_pt); // pf id - 5
263  mPFCandpT_vs_eta_HadE_inHF = ibooker.book2D("PF_cand_HadEner_inHF",h2D_pfcand_etabins_vs_pt); // pf id - 6
264  mPFCandpT_vs_eta_EME_inHF = ibooker.book2D("PF_cand_EMEner_inHF",h2D_pfcand_etabins_vs_pt); // pf id - 7
265 
266  mPFCandpT_Barrel_Unknown = ibooker.book1D("mPFCandpT_Barrel_Unknown",Form(";PF candidate p_{T}, |#eta|<%2.2f; counts", BarrelEta),300, 0, 300); // pf id - 0
267  mPFCandpT_Barrel_ChargedHadron = ibooker.book1D("mPFCandpT_Barrel_ChargedHadron",Form(";PF candidate p_{T}, |#eta|<%2.2f; counts", BarrelEta),300, 0, 300); // pf id - 1
268  mPFCandpT_Barrel_electron = ibooker.book1D("mPFCandpT_Barrel_electron",Form(";PF candidate p_{T}, |#eta|<%2.2f; counts", BarrelEta),300, 0, 300); // pf id - 2
269  mPFCandpT_Barrel_muon = ibooker.book1D("mPFCandpT_Barrel_muon",Form(";PF candidate p_{T}, |#eta|<%2.2f; counts", BarrelEta),300, 0, 300); // pf id - 3
270  mPFCandpT_Barrel_photon = ibooker.book1D("mPFCandpT_Barrel_photon",Form(";PF candidate p_{T}, |#eta|<%2.2f; counts", BarrelEta),300, 0, 300); // pf id - 4
271  mPFCandpT_Barrel_NeutralHadron = ibooker.book1D("mPFCandpT_Barrel_NeutralHadron",Form(";PF candidate p_{T}, |#eta|<%2.2f; counts", BarrelEta),300, 0, 300); // pf id - 5
272  mPFCandpT_Barrel_HadE_inHF = ibooker.book1D("mPFCandpT_Barrel_HadE_inHF",Form(";PF candidate p_{T}, |#eta|<%2.2f; counts", BarrelEta),300, 0, 300); // pf id - 6
273  mPFCandpT_Barrel_EME_inHF = ibooker.book1D("mPFCandpT_Barrel_EME_inHF",Form(";PF candidate p_{T}, |#eta|<%2.2f; counts", BarrelEta),300, 0, 300); // pf id - 7
274 
275  mPFCandpT_Endcap_Unknown = ibooker.book1D("mPFCandpT_Endcap_Unknown",Form(";PF candidate p_{T}, %2.2f<|#eta|<%2.2f; counts", BarrelEta, EndcapEta),300, 0, 300); // pf id - 0
276  mPFCandpT_Endcap_ChargedHadron = ibooker.book1D("mPFCandpT_Endcap_ChargedHadron",Form(";PF candidate p_{T}, %2.2f<|#eta|<%2.2f; counts", BarrelEta, EndcapEta),300, 0, 300); // pf id - 1
277  mPFCandpT_Endcap_electron = ibooker.book1D("mPFCandpT_Endcap_electron",Form(";PF candidate p_{T}, %2.2f<|#eta|<%2.2f; counts", BarrelEta, EndcapEta),300, 0, 300); // pf id - 2
278  mPFCandpT_Endcap_muon = ibooker.book1D("mPFCandpT_Endcap_muon",Form(";PF candidate p_{T}, %2.2f<|#eta|<%2.2f; counts", BarrelEta, EndcapEta),300, 0, 300); // pf id - 3
279  mPFCandpT_Endcap_photon = ibooker.book1D("mPFCandpT_Endcap_photon",Form(";PF candidate p_{T}, %2.2f<|#eta|<%2.2f; counts", BarrelEta, EndcapEta),300, 0, 300); // pf id - 4
280  mPFCandpT_Endcap_NeutralHadron = ibooker.book1D("mPFCandpT_Endcap_NeutralHadron",Form(";PF candidate p_{T}, %2.2f<|#eta|<%2.2f; counts", BarrelEta, EndcapEta),300, 0, 300); // pf id - 5
281  mPFCandpT_Endcap_HadE_inHF = ibooker.book1D("mPFCandpT_Endcap_HadE_inHF",Form(";PF candidate p_{T}, %2.2f<|#eta|<%2.2f; counts", BarrelEta, EndcapEta),300, 0, 300); // pf id - 6
282  mPFCandpT_Endcap_EME_inHF = ibooker.book1D("mPFCandpT_Endcap_EME_inHF",Form(";PF candidate p_{T}, %2.2f<|#eta|<%2.2f; counts", BarrelEta, EndcapEta),300, 0, 300); // pf id - 7
283 
284  mPFCandpT_Forward_Unknown = ibooker.book1D("mPFCandpT_Forward_Unknown",Form(";PF candidate p_{T}, %2.2f<|#eta|<%2.2f; counts", EndcapEta, ForwardEta),300, 0, 300); // pf id - 0
285  mPFCandpT_Forward_ChargedHadron = ibooker.book1D("mPFCandpT_Forward_ChargedHadron",Form(";PF candidate p_{T}, %2.2f<|#eta|<%2.2f; counts", EndcapEta, ForwardEta),300, 0, 300); // pf id - 1
286  mPFCandpT_Forward_electron = ibooker.book1D("mPFCandpT_Forward_electron",Form(";PF candidate p_{T}, %2.2f<|#eta|<%2.2f; counts", EndcapEta, ForwardEta),300, 0, 300); // pf id - 2
287  mPFCandpT_Forward_muon = ibooker.book1D("mPFCandpT_Forward_muon",Form(";PF candidate p_{T}, %2.2f<|#eta|<%2.2f; counts", EndcapEta, ForwardEta),300, 0, 300); // pf id - 3
288  mPFCandpT_Forward_photon = ibooker.book1D("mPFCandpT_Forward_photon",Form(";PF candidate p_{T}, %2.2f<|#eta|<%2.2f; counts", EndcapEta, ForwardEta),300, 0, 300); // pf id - 4
289  mPFCandpT_Forward_NeutralHadron = ibooker.book1D("mPFCandpT_Forward_NeutralHadron",Form(";PF candidate p_{T}, %2.2f<|#eta|<%2.2f; counts", EndcapEta, ForwardEta),300, 0, 300); // pf id - 5
290  mPFCandpT_Forward_HadE_inHF = ibooker.book1D("mPFCandpT_Forward_HadE_inHF",Form(";PF candidate p_{T}, %2.2f<|#eta|<%2.2f; counts", EndcapEta, ForwardEta),300, 0, 300); // pf id - 6
291  mPFCandpT_Forward_EME_inHF = ibooker.book1D("mPFCandpT_Forward_EME_inHF",Form(";PF candidate p_{T}, %2.2f<|#eta|<%2.2f; counts", EndcapEta, ForwardEta),300, 0, 300); // pf id - 7
292 
293  }
294 
295  if(isCaloJet){
296 
297  mNCalopart = ibooker.book1D("NCalopart","No of particle flow candidates",1000,0,10000);
298  mCaloPt = ibooker.book1D("CaloPt","Calo candidate p_{T}",1000,-5000,5000);
299  mCaloEta = ibooker.book1D("CaloEta","Calo candidate #eta",120,-6,6);
300  mCaloPhi = ibooker.book1D("CaloPhi","Calo candidate #phi",70,-3.5,3.5);
301 
302  mSumCaloPt = ibooker.book1D("SumCaloPt","Sum Calo p_{T}",1000,-10000,10000);
303  mSumCaloPt_eta = ibooker.book2D("SumCaloPt_etaBins",h2D_etabins_vs_pt);
304 
305  mSumSquaredCaloPt = ibooker.book1D("SumSquaredCaloPt","Sum of initial Calo tower p_{T} squared",10000,0,10000);
306  mSumSquaredCaloPt_eta = ibooker.book2D("SumSquaredCaloPt_etaBins",h2D_etabins_vs_pt2);
307 
308  mSumCaloPt_HF = ibooker.book2D("SumCaloPt_HF","HF Energy (y axis) vs Sum Calo tower p_{T}",1000,-1000,1000,1000,0,10000);
309 
310  for(int ieta=0; ieta<etaBins_; ieta++){
311  int range = 1000;
312  if(ieta<2 || etaBins_-ieta<=2) range = 5000;
313  const char* lc = edge_pseudorapidity[ieta]<0 ? "n":"p";
314  const char* rc = edge_pseudorapidity[ieta+1]<0 ? "n":"p";
315  std::string histoName = Form("mSumCaloPt_%s%.3g_%s%.3g",lc,abs(edge_pseudorapidity[ieta]),rc,abs(edge_pseudorapidity[ieta+1]));
316  for(int id=0; id<2; id++){ if(histoName.find(".")!=std::string::npos){ histoName.replace(histoName.find("."), 1, "p"); } }
317  mSumCaloPtEtaDep[ieta] = ibooker.book1D(histoName.c_str(),Form("Sum Calo tower Pt in the eta range %.3g to %.3g",edge_pseudorapidity[ieta],edge_pseudorapidity[ieta+1]),1000,-1*range,range);
318  }
319  }
320 
321  // particle flow variables histograms
322  mSumpt = ibooker.book1D("SumpT","Sum p_{T} of all the PF candidates per event",1000,0,10000);
323 
324  // Event variables
325  mNvtx = ibooker.book1D("Nvtx", "number of vertices", 60, 0, 60);
326  mHF = ibooker.book1D("HF", "HF energy distribution",1000,0,10000);
327 
328  // Jet parameters
329  mEta = ibooker.book1D("Eta", "Eta", 120, -6, 6);
330  mPhi = ibooker.book1D("Phi", "Phi", 70, -3.5, 3.5);
331  mPt = ibooker.book1D("Pt", "Pt", 1000, 0, 500);
332  mP = ibooker.book1D("P", "P", 100, 0, 1000);
333  mEnergy = ibooker.book1D("Energy", "Energy", 100, 0, 1000);
334  mMass = ibooker.book1D("Mass", "Mass", 100, 0, 200);
335  mConstituents = ibooker.book1D("Constituents", "Constituents", 100, 0, 100);
336  mJetArea = ibooker.book1D("JetArea", "JetArea", 100, 0, 4);
337  mjetpileup = ibooker.book1D("jetPileUp","jetPileUp",100,0,150);
338  mNJets_40 = ibooker.book1D("NJets_pt_greater_40", "NJets pT > 40 GeV", 50, 0, 50);
339  mNJets = ibooker.book1D("NJets", "NJets", 100, 0, 100);
340 
341  if (mOutputFile.empty ())
342  LogInfo("OutputInfo") << " Histograms will NOT be saved";
343  else
344  LogInfo("OutputInfo") << " Histograms will be saved to file:" << mOutputFile;
345 
346  delete h2D_etabins_vs_pt2;
347  delete h2D_etabins_vs_pt;
348  delete h2D_pfcand_etabins_vs_pt;
349  delete h2D_etabins_forRho;
350  delete h2D_ptBins_forRho;
351  delete h2D_centBins_forRho;
352  delete h2D_centBins_forRhoM;
353 
354 }
355 
356 
357 
358 //------------------------------------------------------------------------------
359 // ~JetAnalyzer_HeavyIons
360 //------------------------------------------------------------------------------
362 
363 
364 //------------------------------------------------------------------------------
365 // beginJob
366 //------------------------------------------------------------------------------
367 //void JetAnalyzer_HeavyIons::beginJob() {
368 //}
369 
370 
371 //------------------------------------------------------------------------------
372 // endJob
373 //------------------------------------------------------------------------------
374 //void JetAnalyzer_HeavyIons::endJob()
375 //{
376 // if (!mOutputFile.empty() && &*edm::Service<DQMStore>())
377 // {
378 // edm::Service<DQMStore>()->save(mOutputFile);
379 // }
380 //}
381 
382 
383 //------------------------------------------------------------------------------
384 // analyze
385 //------------------------------------------------------------------------------
387 {
388 
389  // switch(mEvent.id().event() == 15296770)
390  // case 1:
391  // break;
392 
393  // Get the primary vertices
395  mEvent.getByToken(pvToken_, pvHandle);
396  reco::Vertex::Point vtx(0,0,0);
398 
399  mEvent.getByToken(hiVertexToken_, vtxs);
400  int greatestvtx = 0;
401  int nVertex = vtxs->size();
402 
403  for (unsigned int i = 0 ; i< vtxs->size(); ++i){
404  unsigned int daughter = (*vtxs)[i].tracksSize();
405  if( daughter > (*vtxs)[greatestvtx].tracksSize()) greatestvtx = i;
406  }
407 
408  if(nVertex<=0){
409  vtx = reco::Vertex::Point(0,0,0);
410  }
411  vtx = (*vtxs)[greatestvtx].position();
412 
413  int nGoodVertices = 0;
414 
415  if (pvHandle.isValid())
416  {
417  for (unsigned i=0; i<pvHandle->size(); i++)
418  {
419  if ((*pvHandle)[i].ndof() > 4 &&
420  (fabs((*pvHandle)[i].z()) <= 24) &&
421  (fabs((*pvHandle)[i].position().rho()) <= 2))
422  nGoodVertices++;
423  }
424  }
425 
426  mNvtx->Fill(nGoodVertices);
427 
428  // Get the Jet collection
429  //----------------------------------------------------------------------------
430 
431  std::vector<Jet> recoJets;
432  recoJets.clear();
433 
438 
439  // Get the Particle flow candidates and the Voronoi variables
442  edm::Handle<CaloTowerCollection> caloCandidates;
443  edm::Handle<reco::CandidateView> pfcandidates_;
444  edm::Handle<reco::CandidateView> calocandidates_;
445 
446  //Get the new CS stuff
450  if(std::string("Cs")==UEAlgo){
451  mEvent.getByToken(etaToken_, etaRanges);
452  mEvent.getByToken(rhoToken_, rho);
453  mEvent.getByToken(rhomToken_, rhom);
454  const int rhoSize = (int)etaRanges->size();
455  double rhoRange[rhoSize];
456  for(int irho=0; irho<rhoSize; irho++){ rhoRange[irho]=etaRanges->at(irho); }
457  double yaxisLimits[501];
458  for(int ibin=0; ibin<501; ibin++) yaxisLimits[ibin] = ibin*2;
459  if(mRhoDist_vsEta->getNbinsX() != rhoSize-1){
460  mRhoDist_vsEta->getTH2F()->SetBins(rhoSize-1,const_cast<double*>(rhoRange),500,const_cast<double*>(yaxisLimits));
461  mRhoMDist_vsEta->getTH2F()->SetBins(rhoSize-1,const_cast<double*>(rhoRange),500,const_cast<double*>(yaxisLimits));
462  }
463  }
464 
465  if (isCaloJet) mEvent.getByToken(caloJetsToken_, caloJets);
466  if (isJPTJet) mEvent.getByToken(jptJetsToken_, jptJets);
467  if (isPFJet) {
468  if(std::string("Pu")==UEAlgo) mEvent.getByToken(basicJetsToken_, basicJets);
469  if(std::string("Cs")==UEAlgo) mEvent.getByToken(pfJetsToken_, pfJets);
470  if(std::string("Vs")==UEAlgo) return; //avoid running Vs jets
471  }
472 
473  mEvent.getByToken(pfCandToken_, pfCandidates);
474  mEvent.getByToken(pfCandViewToken_, pfcandidates_);
475  if(std::string("Cs")==UEAlgo) mEvent.getByToken(csCandToken_, csCandidates);
476 
477  mEvent.getByToken(caloTowersToken_, caloCandidates);
478  mEvent.getByToken(caloCandViewToken_, calocandidates_);
479 
480  // get the centrality
482  mEvent.getByToken(centralityToken, cent); //_centralitytag comes from the cfg
483 
484  mHF->Fill(cent->EtHFtowerSum());
485  Float_t HF_energy = cent->EtHFtowerSum();
486 
487  //for later when centrality gets added to RelVal
488  //edm::Handle<int> cbin;
489  //mEvent.getByToken(centralityBinToken, cbin);
490 
491  if (!cent.isValid()) return;
492 
493  /*int hibin = -999;
494  if(cbin.isValid()){
495  hibin = *cbin;
496  }*/
497 
498  const reco::PFCandidateCollection *pfCandidateColl = pfCandidates.product();
499 
500  Int_t NPFpart = 0;
501  Int_t NCaloTower = 0;
502  Float_t pfPt = 0;
503  Float_t pfEta = 0;
504  Float_t pfPhi = 0;
505  Int_t pfID = 0;
506  Float_t pfDeltaR = 0;
507  Float_t caloPt = 0;
508  Float_t caloEta = 0;
509  Float_t caloPhi = 0;
510  Float_t SumPt_value = 0;
511 
512  vector < vector <float> > numbers;
513  vector <float> tempVector;
514  numbers.clear();
515  tempVector.clear();
516 
517  if(isCaloJet){
518 
519  Float_t SumCaloPt[etaBins_];
520  Float_t SumSquaredCaloPt[etaBins_];
521 
522  // Need to set up histograms to get the RMS values for each pT bin
523  TH1F *hSumCaloPt[nedge_pseudorapidity-1];
524 
525  for(int i = 0;i<etaBins_;++i)
526  {
527  SumCaloPt[i] = 0;
528  SumSquaredCaloPt[i] = 0;
529  hSumCaloPt[i] = new TH1F(Form("hSumCaloPt_%d",i),"",10000,-10000,10000);
530 
531  }
532 
533  for(unsigned icand = 0;icand<caloCandidates->size(); icand++){
534 
535  const CaloTower & tower = (*caloCandidates)[icand];
536  reco::CandidateViewRef ref(calocandidates_,icand);
537  //10 is tower pT min
538  if(tower.p4(vtx).Et() < 0.1) continue;
539 
540  NCaloTower++;
541 
542  caloPt = tower.p4(vtx).Et();
543  caloEta = tower.p4(vtx).Eta();
544  caloPhi = tower.p4(vtx).Phi();
545 
546 
547  for(size_t k = 0;k<nedge_pseudorapidity-1; k++){
548  if(caloEta >= edge_pseudorapidity[k] && caloEta < edge_pseudorapidity[k+1]){
549  SumCaloPt[k] = SumCaloPt[k] + caloPt;
550  SumSquaredCaloPt[k] = SumSquaredCaloPt[k] + caloPt*caloPt;
551  break;
552  }// eta selection statement
553 
554  }// eta bin loop
555 
556  SumPt_value = SumPt_value + caloPt;
557 
558  mCaloPt->Fill(caloPt);
559  mCaloEta->Fill(caloEta);
560  mCaloPhi->Fill(caloPhi);
561 
562  }// calo tower candidate loop
563 
564  for(int k = 0;k<nedge_pseudorapidity-1;k++){
565 
566  hSumCaloPt[k]->Fill(SumCaloPt[k]);
567 
568  }// eta bin loop
569 
570  Float_t Evt_SumCaloPt = 0;
571  Float_t Evt_SumSquaredCaloPt = 0;
572 
573  for(int ieta=0; ieta<etaBins_; ieta++){
574  mSumCaloPtEtaDep[ieta]->Fill(SumCaloPt[ieta]);
575  }
576 
577  for(size_t k = 0;k<nedge_pseudorapidity-1;k++){
578 
579  Evt_SumCaloPt = Evt_SumCaloPt + SumCaloPt[k];
580  mSumCaloPt_eta->Fill(edge_pseudorapidity[k],SumCaloPt[k]);
581 
582  Evt_SumSquaredCaloPt = Evt_SumSquaredCaloPt + SumSquaredCaloPt[k];
583  mSumSquaredCaloPt_eta->Fill(edge_pseudorapidity[k],hSumCaloPt[k]->GetRMS(1));
584 
585  delete hSumCaloPt[k];
586 
587  }// eta bin loop
588 
589  mSumCaloPt->Fill(Evt_SumCaloPt);
590  mSumCaloPt_HF->Fill(Evt_SumCaloPt,HF_energy);
591 
592  mSumSquaredCaloPt->Fill(Evt_SumSquaredCaloPt);
593 
594  mNCalopart->Fill(NCaloTower);
595  mSumpt->Fill(SumPt_value);
596 
597  }// is calo jet
598 
599  if(isPFJet){
600 
601  Float_t SumPFPt[etaBins_];
602 
603  Float_t SumSquaredPFPt[etaBins_];
604 
605  // Need to set up histograms to get the RMS values for each pT bin
606  TH1F *hSumPFPt[nedge_pseudorapidity-1];
607 
608  for(int i = 0;i<etaBins_;i++){
609 
610  SumPFPt[i] = 0;
611  SumSquaredPFPt[i] = 0;
612 
613  hSumPFPt[i] = new TH1F(Form("hSumPFPt_%d",i),"",10000,-10000,10000);
614 
615  }
616 
617  vector<vector <float> > PF_Space(1,vector<float>(3));
618 
619  if(std::string("Cs")==UEAlgo){
620  const reco::PFCandidateCollection *csCandidateColl = csCandidates.product();
621 
622  for(unsigned iCScand=0; iCScand<csCandidateColl->size(); iCScand++){
623  assert(csCandidateColl->size() <= pfCandidateColl->size());
624  const reco::PFCandidate csCandidate = csCandidateColl->at(iCScand);
625  const reco::PFCandidate pfCandidate = pfCandidateColl->at(iCScand);
626  int ieta=0;
627  while(csCandidate.eta()>edge_pseudorapidity[ieta] && ieta<etaBins_-1) ieta++;
628  mCSCandpT_vsPt[ieta]->Fill(csCandidate.pt());
629  mCSCand_corrPFcand[ieta]->Fill(csCandidate.pt(), pfCandidate.pt());
630  }
631  }
632 
633  for(unsigned icand=0;icand<pfCandidateColl->size(); icand++)
634  {
635  const reco::PFCandidate pfCandidate = pfCandidateColl->at(icand);
636  reco::CandidateViewRef ref(pfcandidates_,icand);
637  if(pfCandidate.pt() < 5) continue;
638 
639  NPFpart++;
640  pfPt = pfCandidate.pt();
641  pfEta = pfCandidate.eta();
642  pfPhi = pfCandidate.phi();
643  pfID = pfCandidate.particleId();
644 
645  bool isBarrel = false;
646  bool isEndcap = false;
647  bool isForward = false;
648 
649  if(fabs(pfEta)<BarrelEta) isBarrel = true;
650  if(fabs(pfEta)>=BarrelEta && fabs(pfEta)<EndcapEta) isEndcap = true;
651  if(fabs(pfEta)>=EndcapEta && fabs(pfEta)<ForwardEta) isForward = true;
652 
653  switch(pfID){
654  case 0 :
655  mPFCandpT_vs_eta_Unknown->Fill(pfPt, pfEta);
656  if(isBarrel) mPFCandpT_Barrel_Unknown->Fill(pfPt);
657  if(isEndcap) mPFCandpT_Endcap_Unknown->Fill(pfPt);
658  if(isForward) mPFCandpT_Forward_Unknown->Fill(pfPt);
659  case 1 :
660  mPFCandpT_vs_eta_ChargedHadron->Fill(pfPt, pfEta);
661  if(isBarrel) mPFCandpT_Barrel_ChargedHadron->Fill(pfPt);
662  if(isEndcap) mPFCandpT_Endcap_ChargedHadron->Fill(pfPt);
663  if(isForward) mPFCandpT_Forward_ChargedHadron->Fill(pfPt);
664  case 2 :
665  mPFCandpT_vs_eta_electron->Fill(pfPt, pfEta);
666  if(isBarrel) mPFCandpT_Barrel_electron->Fill(pfPt);
667  if(isEndcap) mPFCandpT_Endcap_electron->Fill(pfPt);
668  if(isForward) mPFCandpT_Forward_electron->Fill(pfPt);
669  case 3 :
670  mPFCandpT_vs_eta_muon->Fill(pfPt, pfEta);
671  if(isBarrel) mPFCandpT_Barrel_muon->Fill(pfPt);
672  if(isEndcap) mPFCandpT_Endcap_muon->Fill(pfPt);
673  if(isForward) mPFCandpT_Forward_muon->Fill(pfPt);
674  case 4 :
675  mPFCandpT_vs_eta_photon->Fill(pfPt, pfEta);
676  if(isBarrel) mPFCandpT_Barrel_photon->Fill(pfPt);
677  if(isEndcap) mPFCandpT_Endcap_photon->Fill(pfPt);
678  if(isForward) mPFCandpT_Forward_photon->Fill(pfPt);
679  case 5 :
680  mPFCandpT_vs_eta_NeutralHadron->Fill(pfPt, pfEta);
681  if(isBarrel) mPFCandpT_Barrel_NeutralHadron->Fill(pfPt);
682  if(isEndcap) mPFCandpT_Endcap_NeutralHadron->Fill(pfPt);
683  if(isForward) mPFCandpT_Forward_NeutralHadron->Fill(pfPt);
684  case 6 :
685  mPFCandpT_vs_eta_HadE_inHF->Fill(pfPt, pfEta);
686  if(isBarrel) mPFCandpT_Barrel_HadE_inHF->Fill(pfPt);
687  if(isEndcap) mPFCandpT_Endcap_HadE_inHF->Fill(pfPt);
688  if(isForward) mPFCandpT_Forward_HadE_inHF->Fill(pfPt);
689  case 7 :
690  mPFCandpT_vs_eta_EME_inHF->Fill(pfPt, pfEta);
691  if(isBarrel) mPFCandpT_Barrel_EME_inHF->Fill(pfPt);
692  if(isEndcap) mPFCandpT_Endcap_EME_inHF->Fill(pfPt);
693  if(isForward) mPFCandpT_Forward_EME_inHF->Fill(pfPt);
694  }
695 
696 
697  //Fill 2d vector matrix
698  tempVector.push_back(pfPt);
699  tempVector.push_back(pfEta);
700  tempVector.push_back(pfPhi);
701 
702  numbers.push_back(tempVector);
703  tempVector.clear();
704 
705  for(size_t k = 0;k<nedge_pseudorapidity-1; k++)
706  {
707  if(pfEta >= edge_pseudorapidity[k] && pfEta < edge_pseudorapidity[k+1]){
708  SumPFPt[k] = SumPFPt[k] + pfPt;
709  SumSquaredPFPt[k] = SumSquaredPFPt[k] + pfPt*pfPt;
710  break;
711  }// eta selection statement
712 
713  }// eta bin loop
714 
715  SumPt_value = SumPt_value + pfPt;
716 
717  mPFPt->Fill(pfPt);
718  mPFEta->Fill(pfEta);
719  mPFPhi->Fill(pfPhi);
720 
721  }// pf candidate loop
722 
723  for(int k = 0;k<nedge_pseudorapidity-1;k++){
724 
725  hSumPFPt[k]->Fill(SumPFPt[k]);
726 
727  }// eta bin loop
728 
729  Float_t Evt_SumPFPt = 0;
730  Float_t Evt_SumSquaredPFPt = 0;
731 
732  for(int ieta=0; ieta<etaBins_; ieta++){
733  mSumPFPtEtaDep[ieta]->Fill(SumPFPt[ieta]);
734  }
735 
736  for(size_t k = 0;k<nedge_pseudorapidity-1;k++){
737 
738  Evt_SumPFPt = Evt_SumPFPt + SumPFPt[k];
739  mSumPFPt_eta->Fill(edge_pseudorapidity[k],SumPFPt[k]);
740 
741  Evt_SumSquaredPFPt = Evt_SumSquaredPFPt + SumSquaredPFPt[k];
742  mSumSquaredPFPt_eta->Fill(edge_pseudorapidity[k],hSumPFPt[k]->GetRMS(1));
743 
744  delete hSumPFPt[k];
745 
746  }// eta bin loop
747 
748  mSumPFPt->Fill(Evt_SumPFPt);
749  mSumPFPt_HF->Fill(Evt_SumPFPt,HF_energy);
750 
751  mSumSquaredPFPt->Fill(Evt_SumSquaredPFPt);
752 
753  mNPFpart->Fill(NPFpart);
754  mSumpt->Fill(SumPt_value);
755 
756  }
757 
758  if (isCaloJet)
759  {
760  for (unsigned ijet=0; ijet<caloJets->size(); ijet++)
761  {
762  recoJets.push_back((*caloJets)[ijet]);
763  }
764  }
765 
766  if (isJPTJet)
767  {
768  for (unsigned ijet=0; ijet<jptJets->size(); ijet++)
769  recoJets.push_back((*jptJets)[ijet]);
770  }
771 
772  if (isPFJet)
773  {
774  if(std::string("Pu")==UEAlgo)
775  {
776  for (unsigned ijet=0; ijet<basicJets->size();ijet++)
777  {
778  recoJets.push_back((*basicJets)[ijet]);
779  }
780  }
781  if(std::string("Cs")==UEAlgo){
782  for(unsigned ijet=0; ijet<pfJets->size(); ijet++){
783  recoJets.push_back((*pfJets)[ijet]);
784  }
785  }
786  }
787 
788 
789  if (isCaloJet && !caloJets.isValid())
790  {
791  return;
792  }
793  if (isJPTJet && !jptJets.isValid())
794  {
795  return;
796  }
797  if (isPFJet){
798  if(std::string("Pu")==UEAlgo){if(!basicJets.isValid()) return;}
799  if(std::string("Cs")==UEAlgo){if(!pfJets.isValid()) return;}
800  if(std::string("Vs")==UEAlgo){return; }
801  }
802 
803 
804  int nJet_40 = 0;
805 
806  mNJets->Fill(recoJets.size());
807 
808  for (unsigned ijet=0; ijet<recoJets.size(); ijet++) {
809  if (recoJets[ijet].pt() > mRecoJetPtThreshold) {
810  //counting forward and barrel jets
811  // get an idea of no of jets with pT>40 GeV
812  if(recoJets[ijet].pt() > 40)
813  nJet_40++;
814  if (mEta) mEta->Fill(recoJets[ijet].eta());
815  if (mjetpileup) mjetpileup->Fill(recoJets[ijet].pileup());
816  if (mJetArea) mJetArea ->Fill(recoJets[ijet].jetArea());
817  if (mPhi) mPhi ->Fill(recoJets[ijet].phi());
818  if (mEnergy) mEnergy ->Fill(recoJets[ijet].energy());
819  if (mP) mP ->Fill(recoJets[ijet].p());
820  if (mPt) mPt ->Fill(recoJets[ijet].pt());
821  if (mMass) mMass ->Fill(recoJets[ijet].mass());
822  if (mConstituents) mConstituents->Fill(recoJets[ijet].nConstituents());
823 
824  if(std::string("Cs")==UEAlgo){
825  int ipt=0, ieta=0;
826  while(recoJets[ijet].pt()>ptBin[ipt+1] && ipt<ptBins_-1) ipt++;
827  while(recoJets[ijet].eta()>etaRanges->at(ieta+1) && ieta<(int)(rho->size()-1)) ieta++;
828  mSubtractedEFrac[ipt][ieta]->Fill((double)recoJets[ijet].pileup()/(double)recoJets[ijet].energy());
829  mSubtractedE[ipt][ieta]->Fill(recoJets[ijet].pileup());
830 
831  for(unsigned irho=0; irho<rho->size(); irho++){
832  mRhoDist_vsEta->Fill(recoJets[ijet].eta(), rho->at(irho));
833  mRhoMDist_vsEta->Fill(recoJets[ijet].eta(), rhom->at(irho));
834  mRhoDist_vsPt->Fill(recoJets[ijet].pt(), rho->at(irho));
835  mRhoMDist_vsPt->Fill(recoJets[ijet].pt(), rhom->at(irho));
836  mRhoDist_vsCent[ieta]->Fill(HF_energy, rho->at(irho));
837  mRhoMDist_vsCent[ieta]->Fill(HF_energy, rhom->at(irho));
838  }
839  }
840 
841  for(size_t iii = 0 ; iii < numbers.size() ; iii++)
842  {
843  pfDeltaR = sqrt((numbers[iii][2]-recoJets[ijet].phi())*(numbers[iii][2]-recoJets[ijet].phi()) + (numbers[iii][1]-recoJets[ijet].eta())*(numbers[iii][1]-recoJets[ijet].eta())); //MZ
844 
845  mPFDeltaR ->Fill(pfDeltaR); //MZ
846  mPFDeltaR_Scaled_R->Fill(pfDeltaR,1. / pow(pfDeltaR,2)); //MZ
847 
848  }
849 
850  }
851  }
852  if (mNJets_40) mNJets_40->Fill(nJet_40);
853 
854  numbers.clear();
855 
856 }
MonitorElement * mPFCandpT_Forward_photon
edm::EDGetTokenT< reco::CaloJetCollection > caloJetsToken_
edm::EDGetTokenT< reco::PFCandidateCollection > pfCandToken_
T getParameter(std::string const &) const
edm::InputTag mInputCsCandCollection
MonitorElement * mSumSquaredPFPt
MonitorElement * mPFCandpT_vs_eta_electron
edm::EDGetTokenT< reco::CandidateView > caloCandViewToken_
double eta() const final
momentum pseudorapidity
MonitorElement * mPFCandpT_Forward_EME_inHF
const Double_t EndcapEta
edm::EDGetTokenT< reco::JPTJetCollection > jptJetsToken_
math::PtEtaPhiMLorentzVector p4(double vtxZ) const
Definition: CaloTower.cc:129
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
MonitorElement * mPFCandpT_Forward_muon
edm::EDGetTokenT< reco::PFJetCollection > pfJetsToken_
MonitorElement * mCSCandpT_vsPt[etaBins_]
bool isBarrel(GeomDetEnumerators::SubDetector m)
MonitorElement * mPFCandpT_Endcap_NeutralHadron
MonitorElement * mPFCandpT_vs_eta_EME_inHF
MonitorElement * mSumSquaredCaloPt
bool isForward(DetId const &)
bool exists(std::string const &parameterName) const
checks if a parameter exists
MonitorElement * mSubtractedEFrac[ptBins_][etaBins_]
void analyze(const edm::Event &, const edm::EventSetup &) override
double pt() const final
transverse momentum
MonitorElement * mSumPFPtEtaDep[etaBins_]
MonitorElement * mPFCandpT_Forward_electron
MonitorElement * mRhoMDist_vsEta
edm::EDGetTokenT< std::vector< reco::Vertex > > pvToken_
MonitorElement * mSumCaloPt_eta
MonitorElement * mPFCandpT_vs_eta_muon
void Fill(long long x)
MonitorElement * mCSCand_corrPFcand[etaBins_]
MonitorElement * mPFCandpT_Endcap_HadE_inHF
edm::EDGetTokenT< int > centralityBinToken
MonitorElement * mPFCandpT_Endcap_ChargedHadron
MonitorElement * mRhoMDist_vsPt
MonitorElement * mPFCandpT_vs_eta_NeutralHadron
MonitorElement * mSumCaloPtEtaDep[etaBins_]
MonitorElement * mSumCaloPt_HF
MonitorElement * mRhoDist_vsEta
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * mPFCandpT_vs_eta_photon
edm::EDGetTokenT< reco::Centrality > centralityToken
MonitorElement * mPFCandpT_Forward_ChargedHadron
MonitorElement * mSubtractedE[ptBins_][etaBins_]
T sqrt(T t)
Definition: SSEVec.h:18
MonitorElement * mPFCandpT_Endcap_muon
MonitorElement * mPFCandpT_Endcap_photon
MonitorElement * mPFDeltaR_Scaled_R
edm::EDGetTokenT< std::vector< reco::Vertex > > hiVertexToken_
MonitorElement * mRhoDist_vsPt
MonitorElement * mConstituents
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
MonitorElement * mPFCandpT_Barrel_photon
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
MonitorElement * mSumSquaredCaloPt_eta
MonitorElement * mPFCandpT_Barrel_Unknown
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< std::vector< double > > rhoToken_
edm::EDGetTokenT< std::vector< double > > rhomToken_
MonitorElement * mPFCandpT_Barrel_NeutralHadron
bool isEndcap(GeomDetEnumerators::SubDetector m)
MonitorElement * mPFCandpT_Endcap_Unknown
TH2F * getTH2F() const
int k[5][pyjets_maxn]
const Double_t ForwardEta
nConstituents
Definition: jets_cff.py:219
MonitorElement * mPFCandpT_vs_eta_ChargedHadron
MonitorElement * mPFCandpT_Forward_HadE_inHF
edm::EDGetTokenT< reco::BasicJetCollection > basicJetsToken_
MonitorElement * mPFCandpT_Barrel_ChargedHadron
MonitorElement * mPFCandpT_Barrel_HadE_inHF
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
edm::EDGetTokenT< reco::PFCandidateCollection > csCandToken_
const double edge_pseudorapidity[etaBins_+1]
double EtHFtowerSum() const
Definition: Centrality.h:23
edm::InputTag mInputPFCandCollection
T const * product() const
Definition: Handle.h:74
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
MonitorElement * mSumSquaredPFPt_eta
MonitorElement * mPFCandpT_Endcap_EME_inHF
MonitorElement * mPFCandpT_vs_eta_HadE_inHF
edm::EDGetTokenT< reco::CandidateView > pfCandViewToken_
edm::EDGetTokenT< CaloTowerCollection > caloTowersToken_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * mPFCandpT_Forward_Unknown
std::string const & label() const
Definition: InputTag.h:36
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
fixed size matrix
HLT enums.
size_type size() const
MonitorElement * mPFCandpT_Barrel_electron
static int position[264][3]
Definition: ReadPGInfo.cc:509
MonitorElement * mPFCandpT_Endcap_electron
edm::EDGetTokenT< std::vector< double > > etaToken_
const Double_t BarrelEta
MonitorElement * mRhoDist_vsCent[etaBins_]
int getNbinsX() const
get # of bins in X-axis
virtual ParticleType particleId() const
Definition: PFCandidate.h:374
JetAnalyzer_HeavyIons(const edm::ParameterSet &)
const int ptBin[ptBins_+1]
MonitorElement * mPFCandpT_Barrel_EME_inHF
MonitorElement * mRhoMDist_vsCent[etaBins_]
double phi() const final
momentum azimuthal angle
MonitorElement * mPFCandpT_vs_eta_Unknown
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
MonitorElement * mPFCandpT_Forward_NeutralHadron
Definition: Run.h:45
MonitorElement * mPFCandpT_Barrel_muon