CMS 3D CMS Logo

DQMPFCandidateAnalyzer.cc
Go to the documentation of this file.
1 
12 
25 
29 
50 
51 #include <string>
52 
53 #include <cmath>
54 
55 using namespace edm;
56 using namespace reco;
57 using namespace std;
58 
59 // ***********************************************************
61 //: trackPropagator_(new jetAnalysis::TrackPropagatorToCalo)//,
62 //sOverNCalculator_(new jetAnalysis::StripSignalOverNoiseCalculator)
63 {
64  miniaodfilterdec = -1;
65 
66  candidateType_ = pSet.getUntrackedParameter<std::string>("CandType");
67  //here only choice between miniaod or reco
68 
69  LSBegin_ = pSet.getParameter<int>("LSBegin");
70  LSEnd_ = pSet.getParameter<int>("LSEnd");
71 
72  isMiniAOD_ = (std::string("Packed") == candidateType_);
73 
74  mInputCollection_ = pSet.getParameter<edm::InputTag>("PFCandidateLabel");
75 
76  if (isMiniAOD_) {
77  pflowPackedToken_ = consumes<std::vector<pat::PackedCandidate> >(mInputCollection_);
78  } else {
79  pflowToken_ = consumes<std::vector<reco::PFCandidate> >(mInputCollection_);
80  }
81 
82  miniaodfilterdec = -1;
83 
84  // Smallest track pt
85  ptMinCand_ = pSet.getParameter<double>("ptMinCand");
86 
87  // Smallest raw HCAL energy linked to the track
88  hcalMin_ = pSet.getParameter<double>("hcalMin");
89 
90  diagnosticsParameters_ = pSet.getParameter<std::vector<edm::ParameterSet> >("METDiagonisticsParameters");
91 
92  edm::ConsumesCollector iC = consumesCollector();
93  //DCS
94  DCSFilter_ = new JetMETDQMDCSFilter(pSet.getParameter<ParameterSet>("DCSFilter"), iC);
95  if (isMiniAOD_) {
96  METFilterMiniAODLabel_ = pSet.getParameter<edm::InputTag>("FilterResultsLabelMiniAOD");
97  METFilterMiniAODToken_ = consumes<edm::TriggerResults>(METFilterMiniAODLabel_);
98 
99  METFilterMiniAODLabel2_ = pSet.getParameter<edm::InputTag>("FilterResultsLabelMiniAOD2");
100  METFilterMiniAODToken2_ = consumes<edm::TriggerResults>(METFilterMiniAODLabel2_);
101 
102  HBHENoiseStringMiniAOD = pSet.getParameter<std::string>("HBHENoiseLabelMiniAOD");
103  }
104 
105  if (!isMiniAOD_) {
106  hbheNoiseFilterResultTag_ = pSet.getParameter<edm::InputTag>("HBHENoiseFilterResultLabel");
107  hbheNoiseFilterResultToken_ = consumes<bool>(hbheNoiseFilterResultTag_);
108  }
109  //jet cleanup parameters
110  cleaningParameters_ = pSet.getParameter<ParameterSet>("CleaningParameters");
111 
112  //Vertex requirements
113  bypassAllPVChecks_ = cleaningParameters_.getParameter<bool>("bypassAllPVChecks");
114  bypassAllDCSChecks_ = cleaningParameters_.getParameter<bool>("bypassAllDCSChecks");
115  vertexTag_ = cleaningParameters_.getParameter<edm::InputTag>("vertexCollection");
116  vertexToken_ = consumes<std::vector<reco::Vertex> >(edm::InputTag(vertexTag_));
117 
118  verbose_ = pSet.getParameter<int>("verbose");
119 }
120 
121 // ***********************************************************
123  delete DCSFilter_;
124  LogTrace("DQMPFCandidateAnalyzer") << "[DQMPFCandidateAnalyzer] Saving the histos";
125 }
126 
127 // ***********************************************************
129  ibooker.setCurrentFolder("JetMET/PFCandidates/" + mInputCollection_.label());
130  std::string DirName = "JetMET/PFCandidates/" + mInputCollection_.label();
131 
132  if (!isMiniAOD_) {
133  if (!occupancyPFCandRECO_.empty())
134  occupancyPFCandRECO_.clear();
135  if (!occupancyPFCand_nameRECO_.empty())
136  occupancyPFCand_nameRECO_.clear();
137  if (!etaMinPFCandRECO_.empty())
138  etaMinPFCandRECO_.clear();
139  if (!etaMaxPFCandRECO_.empty())
140  etaMaxPFCandRECO_.clear();
141  if (!typePFCandRECO_.empty())
142  typePFCandRECO_.clear();
143  if (!countsPFCandRECO_.empty())
144  countsPFCandRECO_.clear();
145  if (!ptPFCandRECO_.empty())
146  ptPFCandRECO_.clear();
147  if (!ptPFCand_nameRECO_.empty())
148  ptPFCand_nameRECO_.clear();
149  if (!multiplicityPFCandRECO_.empty())
150  multiplicityPFCandRECO_.clear();
151  if (!multiplicityPFCand_nameRECO_.empty())
152  multiplicityPFCand_nameRECO_.clear();
153  for (std::vector<edm::ParameterSet>::const_iterator v = diagnosticsParameters_.begin();
154  v != diagnosticsParameters_.end();
155  v++) {
156  int etaNBinsPFCand = v->getParameter<int>("etaNBins");
157  double etaMinPFCand = v->getParameter<double>("etaMin");
158  double etaMaxPFCand = v->getParameter<double>("etaMax");
159  int phiNBinsPFCand = v->getParameter<int>("phiNBins");
160  double phiMinPFCand = v->getParameter<double>("phiMin");
161  double phiMaxPFCand = v->getParameter<double>("phiMax");
162  int nMinPFCand = v->getParameter<int>("nMin");
163  int nMaxPFCand = v->getParameter<int>("nMax");
164  int nbinsPFCand = v->getParameter<double>("nbins");
165  etaMinPFCandRECO_.push_back(etaMinPFCand);
166  etaMaxPFCandRECO_.push_back(etaMaxPFCand);
167  typePFCandRECO_.push_back(v->getParameter<int>("type"));
168  countsPFCandRECO_.push_back(0);
169  multiplicityPFCandRECO_.push_back(
170  ibooker.book1D(std::string(v->getParameter<std::string>("name")).append("_multiplicity_").c_str(),
171  std::string(v->getParameter<std::string>("name")) + "multiplicity",
172  nbinsPFCand,
173  nMinPFCand,
174  nMaxPFCand));
175  multiplicityPFCand_nameRECO_.push_back(
176  std::string(v->getParameter<std::string>("name")).append("_multiplicity_"));
177  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
178  DirName + "/" + multiplicityPFCand_nameRECO_[multiplicityPFCand_nameRECO_.size() - 1],
179  multiplicityPFCandRECO_[multiplicityPFCandRECO_.size() - 1]));
180 
181  //push back names first, we need to create histograms with the name and fill it for endcap plots later
182  occupancyPFCand_nameRECO_.push_back(std::string(v->getParameter<std::string>("name")).append("_occupancy_"));
183 
184  ptPFCand_nameRECO_.push_back(std::string(v->getParameter<std::string>("name")).append("_pt_"));
185  //special booking for endcap plots, merge plots for eminus and eplus into one plot, using variable binning
186  //barrel plots have eta-boundaries on minus and plus side
187  //parameters start on minus side
188  if (etaMinPFCand * etaMaxPFCand < 0) { //barrel plots, plot only in barrel region
189  occupancyPFCandRECO_.push_back(
190  ibooker.book2D(std::string(v->getParameter<std::string>("name")).append("_occupancy_").c_str(),
191  std::string(v->getParameter<std::string>("name")) + "occupancy",
192  etaNBinsPFCand,
193  etaMinPFCand,
194  etaMaxPFCand,
195  phiNBinsPFCand,
196  phiMinPFCand,
197  phiMaxPFCand));
198  ptPFCandRECO_.push_back(ibooker.book2D(std::string(v->getParameter<std::string>("name")).append("_pt_").c_str(),
199  std::string(v->getParameter<std::string>("name")) + "pt",
200  etaNBinsPFCand,
201  etaMinPFCand,
202  etaMaxPFCand,
203  phiNBinsPFCand,
204  phiMinPFCand,
205  phiMaxPFCand));
206  } else { //endcap or forward plots,
207  const int nbins_eta_endcap = 2 * (etaNBinsPFCand + 1);
208  double eta_limits_endcap[nbins_eta_endcap];
209  for (int i = 0; i < nbins_eta_endcap; i++) {
210  if (i < (etaNBinsPFCand + 1)) {
211  eta_limits_endcap[i] = etaMinPFCand + i * (etaMaxPFCand - etaMinPFCand) / (double)etaNBinsPFCand;
212  } else {
213  eta_limits_endcap[i] =
214  -etaMaxPFCand + (i - (etaNBinsPFCand + 1)) * (etaMaxPFCand - etaMinPFCand) / (double)etaNBinsPFCand;
215  }
216  }
217  TH2F* hist_temp_occup = new TH2F((occupancyPFCand_nameRECO_[occupancyPFCand_nameRECO_.size() - 1]).c_str(),
218  "occupancy",
219  nbins_eta_endcap - 1,
220  eta_limits_endcap,
221  phiNBinsPFCand,
222  phiMinPFCand,
223  phiMaxPFCand);
224  occupancyPFCandRECO_.push_back(
225  ibooker.book2D(occupancyPFCand_nameRECO_[occupancyPFCand_nameRECO_.size() - 1], hist_temp_occup));
226  TH2F* hist_temp_pt = new TH2F((ptPFCand_nameRECO_[ptPFCand_nameRECO_.size() - 1]).c_str(),
227  "pt",
228  nbins_eta_endcap - 1,
229  eta_limits_endcap,
230  phiNBinsPFCand,
231  phiMinPFCand,
232  phiMaxPFCand);
233  ptPFCandRECO_.push_back(ibooker.book2D(ptPFCand_nameRECO_[ptPFCand_nameRECO_.size() - 1], hist_temp_pt));
234  }
235 
236  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
237  DirName + "/" + occupancyPFCand_nameRECO_[occupancyPFCand_nameRECO_.size() - 1],
238  occupancyPFCandRECO_[occupancyPFCandRECO_.size() - 1]));
239  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
240  DirName + "/" + ptPFCand_nameRECO_[ptPFCand_nameRECO_.size() - 1], ptPFCandRECO_[ptPFCandRECO_.size() - 1]));
241  }
242 
243  mProfileIsoPFChHad_TrackOccupancy = ibooker.book2D(
244  "IsoPfChHad_Track_profile", "Isolated PFChHadron Tracker_occupancy", 108, -2.7, 2.7, 160, -M_PI, M_PI);
245  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "IsoPfChHad_Track_profile",
246  mProfileIsoPFChHad_TrackOccupancy));
247  mProfileIsoPFChHad_TrackPt =
248  ibooker.book2D("IsoPfChHad_TrackPt", "Isolated PFChHadron TrackPt", 108, -2.7, 2.7, 160, -M_PI, M_PI);
249  map_of_MEs.insert(
250  std::pair<std::string, MonitorElement*>(DirName + "/" + "IsoPfChHad_TrackPt", mProfileIsoPFChHad_TrackPt));
251 
252  mProfileIsoPFChHad_EcalOccupancyCentral = ibooker.book2D("IsoPfChHad_ECAL_profile_central",
253  "IsolatedPFChHa ECAL occupancy (Barrel)",
254  180,
255  -1.479,
256  1.479,
257  125,
258  -M_PI,
259  M_PI);
260  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "IsoPfChHad_ECAL_profile_central",
261  mProfileIsoPFChHad_EcalOccupancyCentral));
262  mProfileIsoPFChHad_EMPtCentral = ibooker.book2D(
263  "IsoPfChHad_EMPt_central", "Isolated PFChHadron HadPt_central", 180, -1.479, 1.479, 360, -M_PI, M_PI);
264  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "IsoPfChHad_EMPt_central",
265  mProfileIsoPFChHad_EMPtCentral));
266 
267  mProfileIsoPFChHad_EcalOccupancyEndcap = ibooker.book2D(
268  "IsoPfChHad_ECAL_profile_endcap", "IsolatedPFChHa ECAL occupancy (Endcap)", 110, -2.75, 2.75, 125, -M_PI, M_PI);
269  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "IsoPfChHad_ECAL_profile_endcap",
270  mProfileIsoPFChHad_EcalOccupancyEndcap));
271  mProfileIsoPFChHad_EMPtEndcap =
272  ibooker.book2D("IsoPfChHad_EMPt_endcap", "Isolated PFChHadron EMPt_endcap", 110, -2.75, 2.75, 125, -M_PI, M_PI);
273  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "IsoPfChHad_EMPt_endcap",
274  mProfileIsoPFChHad_EMPtEndcap));
275 
276  const int nbins_eta = 16;
277 
278  double eta_limits[nbins_eta] = {-2.650,
279  -2.500,
280  -2.322,
281  -2.172,
282  -2.043,
283  -1.930,
284  -1.830,
285  -1.740,
286  1.740,
287  1.830,
288  1.930,
289  2.043,
290  2.172,
291  2.3122,
292  2.500,
293  2.650};
294 
295  TH2F* hist_temp_HCAL = new TH2F("IsoPfChHad_HCAL_profile_endcap",
296  "IsolatedPFChHa HCAL occupancy (outer endcap)",
297  nbins_eta - 1,
298  eta_limits,
299  36,
300  -M_PI,
301  M_PI);
302  TH2F* hist_tempPt_HCAL = (TH2F*)hist_temp_HCAL->Clone("Isolated PFCHHadron HadPt (outer endcap)");
303 
304  mProfileIsoPFChHad_HcalOccupancyCentral = ibooker.book2D("IsoPfChHad_HCAL_profile_central",
305  "IsolatedPFChHa HCAL occupancy (Central Part)",
306  40,
307  -1.740,
308  1.740,
309  72,
310  -M_PI,
311  M_PI);
312  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "IsoPfChHad_HCAL_profile_central",
313  mProfileIsoPFChHad_HcalOccupancyCentral));
314  mProfileIsoPFChHad_HadPtCentral = ibooker.book2D(
315  "IsoPfChHad_HadPt_central", "Isolated PFChHadron HadPt_central", 40, -1.740, 1.740, 72, -M_PI, M_PI);
316  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "IsoPfChHad_HadPt_central",
317  mProfileIsoPFChHad_HadPtCentral));
318 
319  mProfileIsoPFChHad_HcalOccupancyEndcap = ibooker.book2D("IsoPfChHad_HCAL_profile_endcap", hist_temp_HCAL);
320  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "IsoPfChHad_HCAL_profile_endcap",
321  mProfileIsoPFChHad_HcalOccupancyEndcap));
322  mProfileIsoPFChHad_HadPtEndcap = ibooker.book2D("IsoPfChHad_HadPt_endcap", hist_tempPt_HCAL);
323  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "IsoPfChHad_HadPt_endcap",
324  mProfileIsoPFChHad_HadPtEndcap));
325 
326  //actual HCAL segmentation in pseudorapidity -> reduce by a factor of two
327  //const int nbins_eta_hcal_total=54;
328  //double eta_limits_hcal_total[nbins_eta_hcal_total]=
329  // {-2.650,-2.500,-2.322,-2.172,-2.043,-1.930,-1.830,-1.740,-1.653,-1.566,-1.479,-1.392,-1.305,
330  // -1.218,-1.131,-1.044,-0.957,-0.870,-0.783,-0.696,-0.609,-0.522,-0.435,-0.348,-0.261,-0.174,-0.087,0.0,
331  // 0.087, 0.174, 0.261, 0.348, 0.435, 0.522, 0.609, 0.783, 0.870, 0.957, 1.044, 1.131, 1.218
332  // 1.305, 1.392, 1.479, 1.566, 1.653, 1.740, 1.830, 1.930, 2.043, 2.172, 2.322, 2.500, 2.650}
333  //
334 
335  const int nbins_eta_hcal_total = 28;
336  double eta_limits_hcal_total[nbins_eta_hcal_total] = {
337  -2.650, -2.322, -2.043, -1.830, -1.653, -1.479, -1.305, -1.131, -0.957, -0.783, -0.609, -0.435, -0.261, -0.087,
338  0.087, 0.261, 0.435, 0.609, 0.783, 0.957, 1.131, 1.305, 1.479, 1.653, 1.830, 2.043, 2.322, 2.650};
339  float eta_limits_hcal_total_f[nbins_eta_hcal_total];
340  float log_bin_spacing = log(200.) / 40.;
341  const int nbins_pt_total_hcal = 41;
342  double pt_limits_hcal[nbins_pt_total_hcal];
343  float pt_limits_hcal_f[nbins_pt_total_hcal];
344  for (int i = 0; i < nbins_pt_total_hcal; i++) {
345  pt_limits_hcal[i] = exp(i * log_bin_spacing);
346  pt_limits_hcal_f[i] = exp(i * log_bin_spacing);
347  }
348  for (int i = 0; i < nbins_eta_hcal_total; i++) {
349  eta_limits_hcal_total_f[i] = (float)eta_limits_hcal_total[i];
350  }
351  m_HOverTrackP_trackPtVsEta = ibooker.book2D("HOverTrackP_trackPtVsEta",
352  "HOverTrackP_trackPtVsEta",
353  nbins_pt_total_hcal - 1,
354  pt_limits_hcal_f,
355  nbins_eta_hcal_total - 1,
356  eta_limits_hcal_total_f);
357  m_HOverTrackPVsTrackP_Barrel = ibooker.bookProfile(
358  "HOverTrackPVsTrackP_Barrel", "HOverTrackPVsTrackP_Barrel", nbins_pt_total_hcal - 1, pt_limits_hcal, 0, 4, " ");
359  m_HOverTrackPVsTrackP_EndCap = ibooker.bookProfile(
360  "HOverTrackPVsTrackP_EndCap", "HOverTrackPVsTrackP_EndCap", nbins_pt_total_hcal - 1, pt_limits_hcal, 0, 4, " ");
361  m_HOverTrackPVsTrackPt_Barrel = ibooker.bookProfile("HOverTrackPVsTrackPt_Barrel",
362  "HOverTrackPVsTrackPt_Barrel",
363  nbins_pt_total_hcal - 1,
364  pt_limits_hcal,
365  0,
366  4,
367  " ");
368  m_HOverTrackPVsTrackPt_EndCap = ibooker.bookProfile("HOverTrackPVsTrackPt_EndCap",
369  "HOverTrackPVsTrackPt_EndCap",
370  nbins_pt_total_hcal - 1,
371  pt_limits_hcal,
372  0,
373  4,
374  " ");
375 
376  m_HOverTrackPVsEta_hPt_1_10 = ibooker.bookProfile("HOverTrackPVsEta_hPt_1_10",
377  "HOverTrackPVsEta, 1<hPt<10 GeV",
378  nbins_eta_hcal_total - 1,
379  eta_limits_hcal_total,
380  0,
381  4,
382  " ");
383  m_HOverTrackPVsEta_hPt_10_20 = ibooker.bookProfile("HOverTrackPVsEta_hPt_10_20",
384  "HOverTrackPVsEta, 10<hPt<20 GeV",
385  nbins_eta_hcal_total - 1,
386  eta_limits_hcal_total,
387  0,
388  4,
389  " ");
390  m_HOverTrackPVsEta_hPt_20_50 = ibooker.bookProfile("HOverTrackPVsEta_hPt_20_50",
391  "HOverTrackPVsEta, 20<hPt<50 GeV",
392  nbins_eta_hcal_total - 1,
393  eta_limits_hcal_total,
394  0,
395  4,
396  " ");
397  m_HOverTrackPVsEta_hPt_50 = ibooker.bookProfile("HOverTrackPVsEta_hPt_50",
398  "HOverTrackPVsEta, hPt>50 GeV",
399  nbins_eta_hcal_total - 1,
400  eta_limits_hcal_total,
401  0,
402  4,
403  " ");
404 
405  m_HOverTrackP_Barrel_hPt_1_10 =
406  ibooker.book1D("HOverTrackP_Barrel_hPt_1_10", "HOverTrackP_B, 1<hPt<10 GeV", 50, 0, 4);
407  m_HOverTrackP_Barrel_hPt_10_20 =
408  ibooker.book1D("HOverTrackP_Barrel_hPt_10_20", "HOverTrackP_B, 10<hPt<20 GeV", 50, 0, 4);
409  m_HOverTrackP_Barrel_hPt_20_50 =
410  ibooker.book1D("HOverTrackP_Barrel_hPt_20_50", "HOverTrackP_B, 20<hPt<50 GeV", 50, 0, 4);
411  m_HOverTrackP_Barrel_hPt_50 = ibooker.book1D("HOverTrackP_Barrel_hPt_50", "HOverTrackP_B, hPt>50 GeV", 50, 0, 4);
412 
413  m_HOverTrackP_EndCap_hPt_1_10 =
414  ibooker.book1D("HOverTrackP_EndCap_hPt_1_10", "HOverTrackP_E, 1<hPt<10 GeV", 50, 0, 4);
415  m_HOverTrackP_EndCap_hPt_10_20 =
416  ibooker.book1D("HOverTrackP_EndCap_hPt_10_20", "HOverTrackP_E, 10<hPt<20 GeV", 50, 0, 4);
417  m_HOverTrackP_EndCap_hPt_20_50 =
418  ibooker.book1D("HOverTrackP_EndCap_hPt_20_50", "HOverTrackP_E, 20<hPt<50 GeV", 50, 0, 4);
419  m_HOverTrackP_EndCap_hPt_50 = ibooker.book1D("HOverTrackP_EndCap_hPt_50", "HOverTrackP_E, hPt>50 GeV", 50, 0, 4);
420 
421  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackP_trackPtVsEta",
422  m_HOverTrackP_trackPtVsEta));
423  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackPVsTrackP_Barrel",
424  m_HOverTrackPVsTrackP_Barrel));
425  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackPVsTrackP_EndCap",
426  m_HOverTrackPVsTrackP_EndCap));
427  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackPVsTrackPt_Barrel",
428  m_HOverTrackPVsTrackPt_Barrel));
429  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackPVsTrackPt_EndCap",
430  m_HOverTrackPVsTrackPt_EndCap));
431  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackPVsEta_hPt_1_10",
432  m_HOverTrackPVsEta_hPt_1_10));
433  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackPVsEta_hPt_10_20",
434  m_HOverTrackPVsEta_hPt_10_20));
435  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackPVsEta_hPt_20_50",
436  m_HOverTrackPVsEta_hPt_20_50));
437  map_of_MEs.insert(
438  std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackPVsEta_hPt_50", m_HOverTrackPVsEta_hPt_50));
439  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackP_Barrel_hPt_1_10",
440  m_HOverTrackP_Barrel_hPt_1_10));
441  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackP_Barrel_hPt_10_20",
442  m_HOverTrackP_Barrel_hPt_10_20));
443  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackP_Barrel_hPt_20_50",
444  m_HOverTrackP_Barrel_hPt_20_50));
445  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackP_Barrel_hPt_50",
446  m_HOverTrackP_Barrel_hPt_50));
447  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackP_EndCap_hPt_1_10",
448  m_HOverTrackP_EndCap_hPt_1_10));
449  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackP_EndCap_hPt_10_20",
450  m_HOverTrackP_EndCap_hPt_10_20));
451  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackP_EndCap_hPt_20_50",
452  m_HOverTrackP_EndCap_hPt_20_50));
453  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "HOverTrackP_EndCap_hPt_50",
454  m_HOverTrackP_EndCap_hPt_50));
455  } else { //MiniAOD workflow
456  if (!occupancyPFCand_.empty())
457  occupancyPFCand_.clear();
458  if (!occupancyPFCand_name_.empty())
459  occupancyPFCand_name_.clear();
460  if (!occupancyPFCand_puppiNolepWeight_.empty())
461  occupancyPFCand_puppiNolepWeight_.clear();
462  if (!occupancyPFCand_name_puppiNolepWeight_.empty())
463  occupancyPFCand_name_puppiNolepWeight_.clear();
464  if (!etaMinPFCand_.empty())
465  etaMinPFCand_.clear();
466  if (!etaMaxPFCand_.empty())
467  etaMaxPFCand_.clear();
468  if (!typePFCand_.empty())
469  typePFCand_.clear();
470  if (!countsPFCand_.empty())
471  countsPFCand_.clear();
472  if (!ptPFCand_.empty())
473  ptPFCand_.clear();
474  if (!ptPFCand_name_.empty())
475  ptPFCand_name_.clear();
476  if (!ptPFCand_puppiNolepWeight_.empty())
477  ptPFCand_puppiNolepWeight_.clear();
478  if (!ptPFCand_name_puppiNolepWeight_.empty())
479  ptPFCand_name_puppiNolepWeight_.clear();
480  if (!multiplicityPFCand_.empty())
481  multiplicityPFCand_.clear();
482  if (!multiplicityPFCand_name_.empty())
483  multiplicityPFCand_name_.clear();
484  for (std::vector<edm::ParameterSet>::const_iterator v = diagnosticsParameters_.begin();
485  v != diagnosticsParameters_.end();
486  v++) {
487  int etaNBinsPFCand = v->getParameter<int>("etaNBins");
488  double etaMinPFCand = v->getParameter<double>("etaMin");
489  double etaMaxPFCand = v->getParameter<double>("etaMax");
490  int phiNBinsPFCand = v->getParameter<int>("phiNBins");
491  double phiMinPFCand = v->getParameter<double>("phiMin");
492  double phiMaxPFCand = v->getParameter<double>("phiMax");
493  int nMinPFCand = v->getParameter<int>("nMin");
494  int nMaxPFCand = v->getParameter<int>("nMax");
495  int nbinsPFCand = v->getParameter<double>("nbins");
496 
497  // etaNBins_.push_back(etaNBins);
498  etaMinPFCand_.push_back(etaMinPFCand);
499  etaMaxPFCand_.push_back(etaMaxPFCand);
500  typePFCand_.push_back(v->getParameter<int>("type"));
501  countsPFCand_.push_back(0);
502 
503  multiplicityPFCand_.push_back(
504  ibooker.book1D(std::string(v->getParameter<std::string>("name")).append("_multiplicity_").c_str(),
505  std::string(v->getParameter<std::string>("name")) + "multiplicity",
506  nbinsPFCand,
507  nMinPFCand,
508  nMaxPFCand));
509  multiplicityPFCand_name_.push_back(std::string(v->getParameter<std::string>("name")).append("_multiplicity_"));
510  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
511  DirName + "/" + multiplicityPFCand_name_[multiplicityPFCand_name_.size() - 1],
512  multiplicityPFCand_[multiplicityPFCand_.size() - 1]));
513  //push back names first, we need to create histograms with the name and fill it for endcap plots later
514  occupancyPFCand_name_.push_back(
515  std::string(v->getParameter<std::string>("name")).append("_occupancy_puppiWeight_"));
516  ptPFCand_name_.push_back(std::string(v->getParameter<std::string>("name")).append("_pt_puppiWeight_"));
517  //push back names first, we need to create histograms with the name and fill it for endcap plots later
518  occupancyPFCand_name_puppiNolepWeight_.push_back(
519  std::string(v->getParameter<std::string>("name")).append("_occupancy_puppiNolepWeight_"));
520  ptPFCand_name_puppiNolepWeight_.push_back(
521  std::string(v->getParameter<std::string>("name")).append("_pt_puppiNolepWeight_"));
522  //special booking for endcap plots, merge plots for eminus and eplus into one plot, using variable binning
523  //barrel plots have eta-boundaries on minus and plus side
524  //parameters start on minus side
525  if (etaMinPFCand * etaMaxPFCand < 0) { //barrel plots, plot only in barrel region
526  occupancyPFCand_.push_back(
527  ibooker.book2D(std::string(v->getParameter<std::string>("name")).append("_occupancy_puppiWeight_").c_str(),
528  std::string(v->getParameter<std::string>("name")) + "occupancy_puppiWeight_",
529  etaNBinsPFCand,
530  etaMinPFCand,
531  etaMaxPFCand,
532  phiNBinsPFCand,
533  phiMinPFCand,
534  phiMaxPFCand));
535  ptPFCand_.push_back(
536  ibooker.book2D(std::string(v->getParameter<std::string>("name")).append("_pt_puppiWeight_").c_str(),
537  std::string(v->getParameter<std::string>("name")) + "pt_puppiWeight_",
538  etaNBinsPFCand,
539  etaMinPFCand,
540  etaMaxPFCand,
541  phiNBinsPFCand,
542  phiMinPFCand,
543  phiMaxPFCand));
544  occupancyPFCand_puppiNolepWeight_.push_back(ibooker.book2D(
545  std::string(v->getParameter<std::string>("name")).append("_occupancy_puppiNolepWeight_").c_str(),
546  std::string(v->getParameter<std::string>("name")) + "occupancy_puppiNolepWeight",
547  etaNBinsPFCand,
548  etaMinPFCand,
549  etaMaxPFCand,
550  phiNBinsPFCand,
551  phiMinPFCand,
552  phiMaxPFCand));
553  ptPFCand_puppiNolepWeight_.push_back(
554  ibooker.book2D(std::string(v->getParameter<std::string>("name")).append("_pt_puppiNolepWeight_").c_str(),
555  std::string(v->getParameter<std::string>("name")) + "pt_puppiNolepWeight",
556  etaNBinsPFCand,
557  etaMinPFCand,
558  etaMaxPFCand,
559  phiNBinsPFCand,
560  phiMinPFCand,
561  phiMaxPFCand));
562  } else { //endcap or forward plots,
563  const int nbins_eta_endcap = 2 * (etaNBinsPFCand + 1);
564  double eta_limits_endcap[nbins_eta_endcap];
565  for (int i = 0; i < nbins_eta_endcap; i++) {
566  if (i < (etaNBinsPFCand + 1)) {
567  eta_limits_endcap[i] = etaMinPFCand + i * (etaMaxPFCand - etaMinPFCand) / (double)etaNBinsPFCand;
568  } else {
569  eta_limits_endcap[i] =
570  -etaMaxPFCand + (i - (etaNBinsPFCand + 1)) * (etaMaxPFCand - etaMinPFCand) / (double)etaNBinsPFCand;
571  }
572  }
573  TH2F* hist_temp_occup = new TH2F((occupancyPFCand_name_[occupancyPFCand_name_.size() - 1]).c_str(),
574  (occupancyPFCand_name_[occupancyPFCand_name_.size() - 1]).c_str(),
575  nbins_eta_endcap - 1,
576  eta_limits_endcap,
577  phiNBinsPFCand,
578  phiMinPFCand,
579  phiMaxPFCand);
580  occupancyPFCand_.push_back(
581  ibooker.book2D(occupancyPFCand_name_[occupancyPFCand_name_.size() - 1], hist_temp_occup));
582  TH2F* hist_temp_pt = new TH2F((ptPFCand_name_[ptPFCand_name_.size() - 1]).c_str(),
583  (ptPFCand_name_[ptPFCand_name_.size() - 1]).c_str(),
584  nbins_eta_endcap - 1,
585  eta_limits_endcap,
586  phiNBinsPFCand,
587  phiMinPFCand,
588  phiMaxPFCand);
589  ptPFCand_.push_back(ibooker.book2D(ptPFCand_name_[ptPFCand_name_.size() - 1], hist_temp_pt));
590  TH2F* hist_temp_occup_puppiNolepWeight = new TH2F(
591  (occupancyPFCand_name_puppiNolepWeight_[occupancyPFCand_name_puppiNolepWeight_.size() - 1]).c_str(),
592  (occupancyPFCand_name_puppiNolepWeight_[occupancyPFCand_name_puppiNolepWeight_.size() - 1]).c_str(),
593  nbins_eta_endcap - 1,
594  eta_limits_endcap,
595  phiNBinsPFCand,
596  phiMinPFCand,
597  phiMaxPFCand);
598  occupancyPFCand_puppiNolepWeight_.push_back(
599  ibooker.book2D(occupancyPFCand_name_puppiNolepWeight_[occupancyPFCand_name_puppiNolepWeight_.size() - 1],
600  hist_temp_occup_puppiNolepWeight));
601  TH2F* hist_temp_pt_puppiNolepWeight =
602  new TH2F((ptPFCand_name_puppiNolepWeight_[ptPFCand_name_puppiNolepWeight_.size() - 1]).c_str(),
603  (ptPFCand_name_puppiNolepWeight_[ptPFCand_name_puppiNolepWeight_.size() - 1]).c_str(),
604  nbins_eta_endcap - 1,
605  eta_limits_endcap,
606  phiNBinsPFCand,
607  phiMinPFCand,
608  phiMaxPFCand);
609  ptPFCand_puppiNolepWeight_.push_back(
610  ibooker.book2D(ptPFCand_name_puppiNolepWeight_[ptPFCand_name_puppiNolepWeight_.size() - 1],
611  hist_temp_pt_puppiNolepWeight));
612  }
613  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
614  DirName + "/" + occupancyPFCand_name_puppiNolepWeight_[occupancyPFCand_name_puppiNolepWeight_.size() - 1],
615  occupancyPFCand_puppiNolepWeight_[occupancyPFCand_puppiNolepWeight_.size() - 1]));
616  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
617  DirName + "/" + ptPFCand_name_puppiNolepWeight_[ptPFCand_name_puppiNolepWeight_.size() - 1],
618  ptPFCand_puppiNolepWeight_[ptPFCand_puppiNolepWeight_.size() - 1]));
619  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
620  DirName + "/" + occupancyPFCand_name_[occupancyPFCand_name_.size() - 1],
621  occupancyPFCand_[occupancyPFCand_.size() - 1]));
622  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
623  DirName + "/" + ptPFCand_name_[ptPFCand_name_.size() - 1], ptPFCand_[ptPFCand_.size() - 1]));
624  }
625  }
626 }
627 
628 // ***********************************************************
630  miniaodfilterindex = -1;
631 
632  if (isMiniAOD_) {
633  bool changed_filter = true;
634  if (FilterhltConfig_.init(iRun, iSetup, METFilterMiniAODLabel_.process(), changed_filter)) {
635  miniaodfilterdec = 0;
636  for (unsigned int i = 0; i < FilterhltConfig_.size(); i++) {
637  std::string search = FilterhltConfig_.triggerName(i).substr(
638  5); //actual label of filter, the first 5 items are Flag_, so stripped off
640  HBHENoiseStringMiniAOD; //all filters end with DQM, which is not in the flag --> ONLY not for HBHEFilters
641  std::size_t found = search2.find(search);
642  if (found != std::string::npos) {
643  miniaodfilterindex = i;
644  }
645  }
646  } else if (FilterhltConfig_.init(iRun, iSetup, METFilterMiniAODLabel2_.process(), changed_filter)) {
647  miniaodfilterdec = 1;
648  for (unsigned int i = 0; i < FilterhltConfig_.size(); i++) {
649  std::string search = FilterhltConfig_.triggerName(i).substr(
650  5); //actual label of filter, the first 5 items are Flag_, so stripped off
652  HBHENoiseStringMiniAOD; //all filters end with DQM, which is not in the flag --> ONLY not for HBHEFilters
653  std::size_t found = search2.find(search);
654  if (found != std::string::npos) {
655  miniaodfilterindex = i;
656  }
657  }
658  } else {
659  edm::LogWarning("MiniAOD MET Filter HLT OBject version")
660  << "nothing found with both RECO and reRECO label" << std::endl;
661  }
662  }
663 }
664 
665 // ***********************************************************
667  //Vertex information
668  Handle<VertexCollection> vertexHandle;
669  iEvent.getByToken(vertexToken_, vertexHandle);
670 
671  if (!vertexHandle.isValid()) {
672  LogDebug("") << "CaloMETAnalyzer: Could not find vertex collection" << std::endl;
673  if (verbose_)
674  std::cout << "CaloMETAnalyzer: Could not find vertex collection" << std::endl;
675  }
676  numPV_ = 0;
677  if (vertexHandle.isValid()) {
678  VertexCollection vertexCollection = *(vertexHandle.product());
679  numPV_ = vertexCollection.size();
680  }
681  bool bPrimaryVertex = (bypassAllPVChecks_ || (numPV_ > 0));
682 
683  int myLuminosityBlock;
684  myLuminosityBlock = iEvent.luminosityBlock();
685 
686  if (myLuminosityBlock < LSBegin_)
687  return;
688  if (myLuminosityBlock > LSEnd_ && LSEnd_ > 0)
689  return;
690 
691  if (verbose_)
692  std::cout << "METAnalyzer analyze" << std::endl;
693 
694  std::string DirName = "JetMET/PFCandidates/" + mInputCollection_.label();
695 
696  bool hbhenoifilterdecision = true;
697  if (!isMiniAOD_) { //not checked for MiniAOD -> for miniaod decision filled as "triggerResults" bool
698  edm::Handle<bool> HBHENoiseFilterResultHandle;
699  iEvent.getByToken(hbheNoiseFilterResultToken_, HBHENoiseFilterResultHandle);
700  if (!HBHENoiseFilterResultHandle.isValid()) {
701  LogDebug("") << "METAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
702  if (verbose_)
703  std::cout << "METAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
704  }
705  hbhenoifilterdecision = *HBHENoiseFilterResultHandle;
706  } else { //need to check if we go for version 1 or version 2
707  edm::Handle<edm::TriggerResults> metFilterResults;
708  iEvent.getByToken(METFilterMiniAODToken_, metFilterResults);
709  if (metFilterResults.isValid()) {
710  if (miniaodfilterindex != -1) {
711  hbhenoifilterdecision = metFilterResults->accept(miniaodfilterindex);
712  }
713  } else {
714  iEvent.getByToken(METFilterMiniAODToken2_, metFilterResults);
715  if (metFilterResults.isValid()) {
716  if (miniaodfilterindex != -1) {
717  hbhenoifilterdecision = metFilterResults->accept(miniaodfilterindex);
718  }
719  }
720  }
721  }
722 
723  //DCS Filter
724  bool bDCSFilter = (bypassAllDCSChecks_ || DCSFilter_->filter(iEvent, iSetup));
725 
726  for (unsigned int i = 0; i < countsPFCand_.size(); i++) {
727  countsPFCand_[i] = 0;
728  }
729  if (bDCSFilter && hbhenoifilterdecision && bPrimaryVertex) {
730  if (isMiniAOD_) {
732  iEvent.getByToken(pflowPackedToken_, packedParticleFlow);
733  //11, 13, 22 for el/mu/gamma, 211 chargedHadron, 130 neutralHadrons, 1 and 2 hadHF and EGammaHF
734  for (unsigned int i = 0; i < packedParticleFlow->size(); i++) {
735  const pat::PackedCandidate& c = packedParticleFlow->at(i);
736  for (unsigned int j = 0; j < typePFCand_.size(); j++) {
737  if (abs(c.pdgId()) == typePFCand_[j]) {
738  //second check for endcap, if inside barrel Max and Min symmetric around 0
739  if (((c.eta() > etaMinPFCand_[j]) && (c.eta() < etaMaxPFCand_[j])) ||
740  ((c.eta() > (-etaMaxPFCand_[j])) && (c.eta() < (-etaMinPFCand_[j])))) {
741  countsPFCand_[j] += 1;
742  ptPFCand_[j] = map_of_MEs[DirName + "/" + ptPFCand_name_[j]];
743  if (ptPFCand_[j] && ptPFCand_[j]->getRootObject())
744  ptPFCand_[j]->Fill(c.eta(), c.phi(), c.pt() * c.puppiWeight());
745  occupancyPFCand_[j] = map_of_MEs[DirName + "/" + occupancyPFCand_name_[j]];
746  if (occupancyPFCand_[j] && occupancyPFCand_[j]->getRootObject())
747  occupancyPFCand_[j]->Fill(c.eta(), c.phi(), c.puppiWeight());
748  ptPFCand_puppiNolepWeight_[j] = map_of_MEs[DirName + "/" + ptPFCand_name_puppiNolepWeight_[j]];
749  if (ptPFCand_puppiNolepWeight_[j] && ptPFCand_puppiNolepWeight_[j]->getRootObject())
750  ptPFCand_puppiNolepWeight_[j]->Fill(c.eta(), c.phi(), c.pt() * c.puppiWeightNoLep());
751  occupancyPFCand_puppiNolepWeight_[j] =
752  map_of_MEs[DirName + "/" + occupancyPFCand_name_puppiNolepWeight_[j]];
753  if (occupancyPFCand_puppiNolepWeight_[j] && occupancyPFCand_puppiNolepWeight_[j]->getRootObject()) {
754  occupancyPFCand_puppiNolepWeight_[j]->Fill(c.eta(), c.phi(), c.puppiWeightNoLep());
755  }
756  }
757  }
758  }
759  }
760  for (unsigned int j = 0; j < countsPFCand_.size(); j++) {
761  multiplicityPFCand_[j] = map_of_MEs[DirName + "/" + multiplicityPFCand_name_[j]];
762  if (multiplicityPFCand_[j] && multiplicityPFCand_[j]->getRootObject()) {
763  multiplicityPFCand_[j]->Fill(countsPFCand_[j]);
764  }
765  }
766  } else {
768  iEvent.getByToken(pflowToken_, particleFlow);
769  for (unsigned int i = 0; i < particleFlow->size(); i++) {
770  const reco::PFCandidate& c = particleFlow->at(i);
771  for (unsigned int j = 0; j < typePFCandRECO_.size(); j++) {
772  if (c.particleId() == typePFCandRECO_[j]) {
773  //second check for endcap, if inside barrel Max and Min symmetric around 0
774  if (((c.eta() > etaMinPFCandRECO_[j]) && (c.eta() < etaMaxPFCandRECO_[j])) ||
775  ((c.eta() > (-etaMaxPFCandRECO_[j])) && (c.eta() < (-etaMinPFCandRECO_[j])))) {
776  countsPFCandRECO_[j] += 1;
777  ptPFCandRECO_[j] = map_of_MEs[DirName + "/" + ptPFCand_nameRECO_[j]];
778  if (ptPFCandRECO_[j] && ptPFCandRECO_[j]->getRootObject())
779  ptPFCandRECO_[j]->Fill(c.eta(), c.phi(), c.pt());
780  occupancyPFCandRECO_[j] = map_of_MEs[DirName + "/" + occupancyPFCand_nameRECO_[j]];
781  if (occupancyPFCandRECO_[j] && occupancyPFCandRECO_[j]->getRootObject())
782  occupancyPFCandRECO_[j]->Fill(c.eta(), c.phi());
783  }
784  //fill quantities for isolated charged hadron quantities
785  //only for charged hadrons
786  if (c.particleId() == 1 && c.pt() > ptMinCand_) {
787  // At least 1 GeV in HCAL
788  double ecalRaw = c.rawEcalEnergy();
789  double hcalRaw = c.rawHcalEnergy();
790  if ((ecalRaw + hcalRaw) > hcalMin_) {
791  const PFCandidate::ElementsInBlocks& theElements = c.elementsInBlocks();
792  if (theElements.empty())
793  continue;
794  unsigned int iTrack = -999;
795  std::vector<unsigned int> iECAL; // =999;
796  std::vector<unsigned int> iHCAL; // =999;
797  const reco::PFBlockRef blockRef = theElements[0].first;
798  const edm::OwnVector<reco::PFBlockElement>& elements = blockRef->elements();
799  // Check that there is only one track in the block.
800  unsigned int nTracks = 0;
801  for (unsigned int iEle = 0; iEle < elements.size(); iEle++) {
802  // Find the tracks in the block
803  PFBlockElement::Type type = elements[iEle].type();
804  switch (type) {
805  case PFBlockElement::TRACK:
806  iTrack = iEle;
807  nTracks++;
808  break;
810  iECAL.push_back(iEle);
811  break;
813  iHCAL.push_back(iEle);
814  break;
815  default:
816  continue;
817  }
818  }
819  if (nTracks == 1) {
820  // Characteristics of the track
822  dynamic_cast<const reco::PFBlockElementTrack&>(elements[iTrack]);
823  mProfileIsoPFChHad_TrackOccupancy = map_of_MEs[DirName + "/" + "IsoPfChHad_Track_profile"];
824  if (mProfileIsoPFChHad_TrackOccupancy && mProfileIsoPFChHad_TrackOccupancy->getRootObject())
825  mProfileIsoPFChHad_TrackOccupancy->Fill(et.trackRef()->eta(), et.trackRef()->phi());
826  mProfileIsoPFChHad_TrackPt = map_of_MEs[DirName + "/" + "IsoPfChHad_TrackPt"];
827  if (mProfileIsoPFChHad_TrackPt && mProfileIsoPFChHad_TrackPt->getRootObject())
828  mProfileIsoPFChHad_TrackPt->Fill(et.trackRef()->eta(), et.trackRef()->phi(), et.trackRef()->pt());
829  if (c.rawEcalEnergy() == 0) { //isolated hadron, nothing in ECAL
830  //right now take corrected hcalEnergy, do we want the rawHcalEnergy instead
831  m_HOverTrackP_trackPtVsEta = map_of_MEs[DirName + "/" + "HOverTrackP_trackPtVsEta"];
832  if (m_HOverTrackP_trackPtVsEta && m_HOverTrackP_trackPtVsEta->getRootObject())
833  m_HOverTrackP_trackPtVsEta->Fill(c.pt(), c.eta(), c.hcalEnergy() / et.trackRef()->p());
834  if (c.pt() > 1 && c.pt() < 10) {
835  m_HOverTrackPVsEta_hPt_1_10 = map_of_MEs[DirName + "/" + "HOverTrackPVsEta_hPt_1_10"];
836  if (m_HOverTrackPVsEta_hPt_1_10 && m_HOverTrackPVsEta_hPt_1_10->getRootObject())
837  m_HOverTrackPVsEta_hPt_1_10->Fill(c.eta(), c.hcalEnergy() / et.trackRef()->p());
838  } else if (c.pt() > 10 && c.pt() < 20) {
839  m_HOverTrackPVsEta_hPt_10_20 = map_of_MEs[DirName + "/" + "HOverTrackPVsEta_hPt_10_20"];
840  if (m_HOverTrackPVsEta_hPt_10_20 && m_HOverTrackPVsEta_hPt_10_20->getRootObject())
841  m_HOverTrackPVsEta_hPt_10_20->Fill(c.eta(), c.hcalEnergy() / et.trackRef()->p());
842  } else if (c.pt() > 20 && c.pt() < 50) {
843  m_HOverTrackPVsEta_hPt_20_50 = map_of_MEs[DirName + "/" + "HOverTrackPVsEta_hPt_20_50"];
844  if (m_HOverTrackPVsEta_hPt_20_50 && m_HOverTrackPVsEta_hPt_20_50->getRootObject())
845  m_HOverTrackPVsEta_hPt_20_50->Fill(c.eta(), c.hcalEnergy() / et.trackRef()->p());
846  } else if (c.pt() > 50) {
847  m_HOverTrackPVsEta_hPt_50 = map_of_MEs[DirName + "/" + "HOverTrackPVsEta_hPt_50"];
848  if (m_HOverTrackPVsEta_hPt_50 && m_HOverTrackPVsEta_hPt_50->getRootObject())
849  m_HOverTrackPVsEta_hPt_50->Fill(c.eta(), c.hcalEnergy() / et.trackRef()->p());
850  }
851  if (fabs(c.eta() < 1.392)) {
852  if (c.pt() > 1 && c.pt() < 10) {
853  m_HOverTrackP_Barrel_hPt_1_10 = map_of_MEs[DirName + "/" + "HOverTrackP_Barrel_hPt_1_10"];
854  if (m_HOverTrackP_Barrel_hPt_1_10 && m_HOverTrackP_Barrel_hPt_1_10->getRootObject())
855  m_HOverTrackP_Barrel_hPt_1_10->Fill(c.hcalEnergy() / et.trackRef()->p());
856  } else if (c.pt() > 10 && c.pt() < 20) {
857  m_HOverTrackP_Barrel_hPt_10_20 = map_of_MEs[DirName + "/" + "HOverTrackP_Barrel_hPt_10_20"];
858  if (m_HOverTrackP_Barrel_hPt_10_20 && m_HOverTrackP_Barrel_hPt_10_20->getRootObject())
859  m_HOverTrackP_Barrel_hPt_10_20->Fill(c.hcalEnergy() / et.trackRef()->p());
860  } else if (c.pt() > 20 && c.pt() < 50) {
861  m_HOverTrackP_Barrel_hPt_20_50 = map_of_MEs[DirName + "/" + "HOverTrackP_Barrel_hPt_20_50"];
862  if (m_HOverTrackP_Barrel_hPt_20_50 && m_HOverTrackP_Barrel_hPt_20_50->getRootObject())
863  m_HOverTrackP_Barrel_hPt_20_50->Fill(c.hcalEnergy() / et.trackRef()->p());
864  } else if (c.pt() > 50) {
865  m_HOverTrackP_Barrel_hPt_50 = map_of_MEs[DirName + "/" + "HOverTrackP_Barrel_hPt_50"];
866  if (m_HOverTrackP_Barrel_hPt_50 && m_HOverTrackP_Barrel_hPt_50->getRootObject())
867  m_HOverTrackP_Barrel_hPt_50->Fill(c.hcalEnergy() / et.trackRef()->p());
868  }
869  m_HOverTrackPVsTrackP_Barrel = map_of_MEs[DirName + "/" + "HOverTrackPVsTrackP_Barrel"];
870  if (m_HOverTrackPVsTrackP_Barrel && m_HOverTrackPVsTrackP_Barrel->getRootObject())
871  m_HOverTrackPVsTrackP_Barrel->Fill(et.trackRef()->p(), c.hcalEnergy() / et.trackRef()->p());
872  m_HOverTrackPVsTrackPt_Barrel = map_of_MEs[DirName + "/" + "HOverTrackPVsTrackPt_Barrel"];
873  if (m_HOverTrackPVsTrackPt_Barrel && m_HOverTrackPVsTrackPt_Barrel->getRootObject())
874  m_HOverTrackPVsTrackPt_Barrel->Fill(et.trackRef()->pt(), c.hcalEnergy() / et.trackRef()->p());
875  } else {
876  m_HOverTrackPVsTrackP_EndCap = map_of_MEs[DirName + "/" + "HOverTrackPVsTrackP_EndCap"];
877  if (m_HOverTrackPVsTrackP_EndCap && m_HOverTrackPVsTrackP_EndCap->getRootObject())
878  m_HOverTrackPVsTrackP_EndCap->Fill(et.trackRef()->p(), c.hcalEnergy() / et.trackRef()->p());
879  m_HOverTrackPVsTrackPt_EndCap = map_of_MEs[DirName + "/" + "HOverTrackPVsTrackPt_EndCap"];
880  if (m_HOverTrackPVsTrackPt_EndCap && m_HOverTrackPVsTrackPt_EndCap->getRootObject())
881  m_HOverTrackPVsTrackPt_EndCap->Fill(et.trackRef()->pt(), c.hcalEnergy() / et.trackRef()->p());
882  if (c.pt() > 1 && c.pt() < 10) {
883  m_HOverTrackP_EndCap_hPt_1_10 = map_of_MEs[DirName + "/" + "HOverTrackP_EndCap_hPt_1_10"];
884  if (m_HOverTrackP_EndCap_hPt_1_10 && m_HOverTrackP_EndCap_hPt_1_10->getRootObject())
885  m_HOverTrackP_EndCap_hPt_1_10->Fill(c.hcalEnergy() / et.trackRef()->p());
886  } else if (c.pt() > 10 && c.pt() < 20) {
887  m_HOverTrackP_EndCap_hPt_10_20 = map_of_MEs[DirName + "/" + "HOverTrackP_EndCap_hPt_10_20"];
888  if (m_HOverTrackP_EndCap_hPt_10_20 && m_HOverTrackP_EndCap_hPt_10_20->getRootObject())
889  m_HOverTrackP_EndCap_hPt_10_20->Fill(c.hcalEnergy() / et.trackRef()->p());
890  } else if (c.pt() > 20 && c.pt() < 50) {
891  m_HOverTrackP_EndCap_hPt_20_50 = map_of_MEs[DirName + "/" + "HOverTrackP_EndCap_hPt_20_50"];
892  if (m_HOverTrackP_EndCap_hPt_20_50 && m_HOverTrackP_EndCap_hPt_20_50->getRootObject())
893  m_HOverTrackP_EndCap_hPt_20_50->Fill(c.hcalEnergy() / et.trackRef()->p());
894  } else if (c.pt() > 50) {
895  m_HOverTrackP_EndCap_hPt_50 = map_of_MEs[DirName + "/" + "HOverTrackP_EndCap_hPt_50"];
896  if (m_HOverTrackP_EndCap_hPt_50 && m_HOverTrackP_EndCap_hPt_50->getRootObject())
897  m_HOverTrackP_EndCap_hPt_50->Fill(c.hcalEnergy() / et.trackRef()->p());
898  }
899  }
900  }
901  //ECAL element
902  for (unsigned int ii = 0; ii < iECAL.size(); ii++) {
903  const reco::PFBlockElementCluster& eecal =
904  dynamic_cast<const reco::PFBlockElementCluster&>(elements[iECAL[ii]]);
905  if (fabs(eecal.clusterRef()->eta()) < 1.479) {
906  mProfileIsoPFChHad_EcalOccupancyCentral =
907  map_of_MEs[DirName + "/" + "IsoPfChHad_ECAL_profile_central"];
908  if (mProfileIsoPFChHad_EcalOccupancyCentral &&
909  mProfileIsoPFChHad_EcalOccupancyCentral->getRootObject())
910  mProfileIsoPFChHad_EcalOccupancyCentral->Fill(eecal.clusterRef()->eta(),
911  eecal.clusterRef()->phi());
912  mProfileIsoPFChHad_EMPtCentral = map_of_MEs[DirName + "/" + "IsoPfChHad_EMPt_central"];
913  if (mProfileIsoPFChHad_EMPtCentral && mProfileIsoPFChHad_EMPtCentral->getRootObject())
914  mProfileIsoPFChHad_EMPtCentral->Fill(
915  eecal.clusterRef()->eta(), eecal.clusterRef()->phi(), eecal.clusterRef()->pt());
916  } else {
917  mProfileIsoPFChHad_EcalOccupancyEndcap =
918  map_of_MEs[DirName + "/" + "IsoPfChHad_ECAL_profile_endcap"];
919  if (mProfileIsoPFChHad_EcalOccupancyEndcap &&
920  mProfileIsoPFChHad_EcalOccupancyEndcap->getRootObject())
921  mProfileIsoPFChHad_EcalOccupancyEndcap->Fill(eecal.clusterRef()->eta(),
922  eecal.clusterRef()->phi());
923  mProfileIsoPFChHad_EMPtEndcap = map_of_MEs[DirName + "/" + "IsoPfChHad_EMPt_endcap"];
924  if (mProfileIsoPFChHad_EMPtEndcap && mProfileIsoPFChHad_EMPtEndcap->getRootObject())
925  mProfileIsoPFChHad_EMPtEndcap->Fill(
926  eecal.clusterRef()->eta(), eecal.clusterRef()->phi(), eecal.clusterRef()->pt());
927  }
928  }
929  //HCAL element
930  for (unsigned int ii = 0; ii < iHCAL.size(); ii++) {
931  const reco::PFBlockElementCluster& ehcal =
932  dynamic_cast<const reco::PFBlockElementCluster&>(elements[iHCAL[ii]]);
933  if (fabs(ehcal.clusterRef()->eta()) < 1.740) {
934  mProfileIsoPFChHad_HcalOccupancyCentral =
935  map_of_MEs[DirName + "/" + "IsoPfChHad_HCAL_profile_central"];
936  if (mProfileIsoPFChHad_HcalOccupancyCentral &&
937  mProfileIsoPFChHad_HcalOccupancyCentral->getRootObject())
938  mProfileIsoPFChHad_HcalOccupancyCentral->Fill(ehcal.clusterRef()->eta(),
939  ehcal.clusterRef()->phi());
940  mProfileIsoPFChHad_HadPtCentral = map_of_MEs[DirName + "/" + "IsoPfChHad_HadPt_central"];
941  if (mProfileIsoPFChHad_HadPtCentral && mProfileIsoPFChHad_HadPtCentral->getRootObject())
942  mProfileIsoPFChHad_HadPtCentral->Fill(
943  ehcal.clusterRef()->eta(), ehcal.clusterRef()->phi(), ehcal.clusterRef()->pt());
944  } else {
945  mProfileIsoPFChHad_HcalOccupancyEndcap =
946  map_of_MEs[DirName + "/" + "IsoPfChHad_HCAL_profile_endcap"];
947  if (mProfileIsoPFChHad_HcalOccupancyEndcap &&
948  mProfileIsoPFChHad_HcalOccupancyEndcap->getRootObject())
949  mProfileIsoPFChHad_HcalOccupancyEndcap->Fill(ehcal.clusterRef()->eta(),
950  ehcal.clusterRef()->phi());
951  mProfileIsoPFChHad_HadPtEndcap = map_of_MEs[DirName + "/" + "IsoPfChHad_HadPt_endcap"];
952  if (mProfileIsoPFChHad_HadPtEndcap && mProfileIsoPFChHad_HadPtEndcap->getRootObject())
953  mProfileIsoPFChHad_HadPtEndcap->Fill(
954  ehcal.clusterRef()->eta(), ehcal.clusterRef()->phi(), ehcal.clusterRef()->pt());
955  }
956  }
957  }
958  }
959  }
960  }
961  }
962  }
963  for (unsigned int j = 0; j < countsPFCandRECO_.size(); j++) {
964  multiplicityPFCandRECO_[j] = map_of_MEs[DirName + "/" + multiplicityPFCand_nameRECO_[j]];
965  if (multiplicityPFCandRECO_[j] && multiplicityPFCandRECO_[j]->getRootObject()) {
966  multiplicityPFCandRECO_[j]->Fill(countsPFCandRECO_[j]);
967  }
968  }
969  } //candidate loop for both miniaod and reco
970  }
971 }
JetMETDQMDCSFilter
Definition: JetMETDQMDCSFilter.h:24
CaloJetCollection.h
Handle.h
CaloJet.h
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ESHandle.h
SiStripGain.h
L1GlobalTriggerReadoutSetupFwd.h
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
gather_cfg.cout
cout
Definition: gather_cfg.py:144
PFJet.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
PFJetCollection.h
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
SiStripGainRcd.h
SiStripDetId.h
DQMPFCandidateAnalyzer::~DQMPFCandidateAnalyzer
~DQMPFCandidateAnalyzer() override
Destructor.
Definition: DQMPFCandidateAnalyzer.cc:122
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
SiStripNoises.h
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
findQualityFiles.v
v
Definition: findQualityFiles.py:179
DQMPFCandidateAnalyzer::dqmBeginRun
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Initialize run-based parameters.
Definition: DQMPFCandidateAnalyzer.cc:629
BeamSpotPI::nTracks
Definition: BeamSpotPayloadInspectorHelper.h:42
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::Handle< VertexCollection >
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
edm::Ref< PFBlockCollection >
reco::PFBlockElement::Type
Type
Definition: PFBlockElement.h:30
DQMPFCandidateAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Get the analysis.
Definition: DQMPFCandidateAnalyzer.cc:666
ECAL
Definition: HCALResponse.h:21
TrackingRecHit.h
IdealMagneticFieldRecord.h
dqm::implementation::IBooker::bookProfile
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
pfLinker_cff.particleFlow
particleFlow
Definition: pfLinker_cff.py:5
cond::persistency::search
std::vector< T >::const_iterator search(const cond::Time_t &val, const std::vector< T > &container)
Definition: IOVProxy.cc:21
HCAL
Definition: HCALResponse.h:21
JPTJetCollection.h
DQMPFCandidateAnalyzer::DQMPFCandidateAnalyzer
DQMPFCandidateAnalyzer(const edm::ParameterSet &)
Constructor.
Definition: DQMPFCandidateAnalyzer.cc:60
reco::PFCandidate::ElementsInBlocks
std::vector< ElementInBlock > ElementsInBlocks
Definition: PFCandidate.h:379
electronDataDiscovery.search2
def search2()
Definition: electronDataDiscovery.py:269
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LepHTMonitor_cff.nbins_eta
nbins_eta
Definition: LepHTMonitor_cff.py:41
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripCluster.h
Event.h
L1GlobalTriggerReadoutSetup.h
deltaR.h
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
pat::PackedCandidate
Definition: PackedCandidate.h:22
TriggerNames.h
iEvent
int iEvent
Definition: GenABIO.cc:224
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
ProjectedSiStripRecHit2D.h
edm::EventSetup
Definition: EventSetup.h:58
Jet.h
HcalObjRepresent::Fill
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: HcalObjRepresent.h:1053
bookConverter.elements
elements
Definition: bookConverter.py:147
std
Definition: JetResolutionObject.h:76
JetTracksAssociationDRCalo.h
DetId.h
spclusmultinvestigator_cfi.vertexCollection
vertexCollection
Definition: spclusmultinvestigator_cfi.py:4
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
TrackingComponentsRecord.h
reco::PFBlockElementCluster
Cluster Element.
Definition: PFBlockElementCluster.h:16
SiStripQuality.h
reco::PFBlockElementTrack
Track Element.
Definition: PFBlockElementTrack.h:17
SiStripQualityRcd.h
Point3D.h
fed_dqm_sourceclient-live_cfg.DirName
DirName
Definition: fed_dqm_sourceclient-live_cfg.py:57
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
reco::PFBlockElementCluster::clusterRef
const PFClusterRef & clusterRef() const override
Definition: PFBlockElementCluster.h:29
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
edm::HLTGlobalStatus::accept
bool accept() const
Has at least one path accepted the event?
Definition: HLTGlobalStatus.h:49
dqm::implementation::IBooker
Definition: DQMStore.h:43
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
SiStripNoisesRcd.h
Candidate.h
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DQMPFCandidateAnalyzer::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Inizialize parameters for histo binning.
Definition: DQMPFCandidateAnalyzer.cc:128
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
SiStripMatchedRecHit2D.h
InvalidTrackingRecHit.h
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
SiStripRecHit2D.h
cuy.ii
ii
Definition: cuy.py:590
edm::InputTag
Definition: InputTag.h:15
L1GlobalTriggerReadoutRecord.h
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
edm::OwnVector< reco::PFBlockElement >
DQMPFCandidateAnalyzer.h