64 miniaodfilterdec = -1;
72 isMiniAOD_ = (
std::string(
"Packed") == candidateType_);
77 pflowPackedToken_ = consumes<std::vector<pat::PackedCandidate> >(mInputCollection_);
79 pflowToken_ = consumes<std::vector<reco::PFCandidate> >(mInputCollection_);
82 miniaodfilterdec = -1;
90 diagnosticsParameters_ = pSet.
getParameter<std::vector<edm::ParameterSet> >(
"METDiagonisticsParameters");
97 METFilterMiniAODToken_ = consumes<edm::TriggerResults>(METFilterMiniAODLabel_);
100 METFilterMiniAODToken2_ = consumes<edm::TriggerResults>(METFilterMiniAODLabel2_);
107 hbheNoiseFilterResultToken_ = consumes<bool>(hbheNoiseFilterResultTag_);
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_));
124 LogTrace(
"DQMPFCandidateAnalyzer") <<
"[DQMPFCandidateAnalyzer] Saving the histos";
129 ibooker.
setCurrentFolder(
"JetMET/PFCandidates/" + mInputCollection_.label());
130 std::string DirName =
"JetMET/PFCandidates/" + mInputCollection_.label();
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();
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(
175 multiplicityPFCand_nameRECO_.push_back(
177 map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
178 DirName +
"/" + multiplicityPFCand_nameRECO_[multiplicityPFCand_nameRECO_.size() - 1],
179 multiplicityPFCandRECO_[multiplicityPFCandRECO_.size() - 1]));
188 if (etaMinPFCand * etaMaxPFCand < 0) {
189 occupancyPFCandRECO_.push_back(
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;
213 eta_limits_endcap[
i] =
214 -etaMaxPFCand + (
i - (etaNBinsPFCand + 1)) * (etaMaxPFCand - etaMinPFCand) / (
double)etaNBinsPFCand;
217 TH2F* hist_temp_occup =
new TH2F((occupancyPFCand_nameRECO_[occupancyPFCand_nameRECO_.size() - 1]).c_str(),
219 nbins_eta_endcap - 1,
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(),
228 nbins_eta_endcap - 1,
233 ptPFCandRECO_.push_back(ibooker.
book2D(ptPFCand_nameRECO_[ptPFCand_nameRECO_.size() - 1], hist_temp_pt));
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]));
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);
250 std::pair<std::string, MonitorElement*>(DirName +
"/" +
"IsoPfChHad_TrackPt", mProfileIsoPFChHad_TrackPt));
252 mProfileIsoPFChHad_EcalOccupancyCentral = ibooker.
book2D(
"IsoPfChHad_ECAL_profile_central",
253 "IsolatedPFChHa ECAL occupancy (Barrel)",
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));
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));
276 const int nbins_eta = 16;
278 double eta_limits[nbins_eta] = {-2.650,
295 TH2F* hist_temp_HCAL =
new TH2F(
"IsoPfChHad_HCAL_profile_endcap",
296 "IsolatedPFChHa HCAL occupancy (outer endcap)",
302 TH2F* hist_tempPt_HCAL = (TH2F*)hist_temp_HCAL->Clone(
"Isolated PFCHHadron HadPt (outer endcap)");
304 mProfileIsoPFChHad_HcalOccupancyCentral = ibooker.
book2D(
"IsoPfChHad_HCAL_profile_central",
305 "IsolatedPFChHa HCAL occupancy (Central Part)",
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));
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));
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);
348 for (
int i = 0;
i < nbins_eta_hcal_total;
i++) {
349 eta_limits_hcal_total_f[
i] = (float)eta_limits_hcal_total[
i];
351 m_HOverTrackP_trackPtVsEta = ibooker.
book2D(
"HOverTrackP_trackPtVsEta",
352 "HOverTrackP_trackPtVsEta",
353 nbins_pt_total_hcal - 1,
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,
368 m_HOverTrackPVsTrackPt_EndCap = ibooker.
bookProfile(
"HOverTrackPVsTrackPt_EndCap",
369 "HOverTrackPVsTrackPt_EndCap",
370 nbins_pt_total_hcal - 1,
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,
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,
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,
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,
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);
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);
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));
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));
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())
470 if (!countsPFCand_.empty())
471 countsPFCand_.clear();
472 if (!ptPFCand_.empty())
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();
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");
498 etaMinPFCand_.push_back(etaMinPFCand);
499 etaMaxPFCand_.push_back(etaMaxPFCand);
500 typePFCand_.push_back(
v->getParameter<
int>(
"type"));
501 countsPFCand_.push_back(0);
503 multiplicityPFCand_.push_back(
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]));
514 occupancyPFCand_name_.push_back(
518 occupancyPFCand_name_puppiNolepWeight_.push_back(
520 ptPFCand_name_puppiNolepWeight_.push_back(
525 if (etaMinPFCand * etaMaxPFCand < 0) {
526 occupancyPFCand_.push_back(
544 occupancyPFCand_puppiNolepWeight_.push_back(ibooker.
book2D(
553 ptPFCand_puppiNolepWeight_.push_back(
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;
569 eta_limits_endcap[
i] =
570 -etaMaxPFCand + (
i - (etaNBinsPFCand + 1)) * (etaMaxPFCand - etaMinPFCand) / (
double)etaNBinsPFCand;
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,
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,
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,
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,
609 ptPFCand_puppiNolepWeight_.push_back(
610 ibooker.
book2D(ptPFCand_name_puppiNolepWeight_[ptPFCand_name_puppiNolepWeight_.size() - 1],
611 hist_temp_pt_puppiNolepWeight));
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]));
630 miniaodfilterindex = -1;
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++) {
640 HBHENoiseStringMiniAOD;
641 std::size_t
found = search2.find(search);
642 if (found != std::string::npos) {
643 miniaodfilterindex =
i;
646 }
else if (FilterhltConfig_.init(iRun, iSetup, METFilterMiniAODLabel2_.process(), changed_filter)) {
647 miniaodfilterdec = 1;
648 for (
unsigned int i = 0;
i < FilterhltConfig_.size();
i++) {
652 HBHENoiseStringMiniAOD;
653 std::size_t
found = search2.find(search);
654 if (found != std::string::npos) {
655 miniaodfilterindex =
i;
660 <<
"nothing found with both RECO and reRECO label" << std::endl;
669 iEvent.
getByToken(vertexToken_, vertexHandle);
672 LogDebug(
"") <<
"CaloMETAnalyzer: Could not find vertex collection" << std::endl;
674 std::cout <<
"CaloMETAnalyzer: Could not find vertex collection" << std::endl;
679 numPV_ = vertexCollection.size();
681 bool bPrimaryVertex = (bypassAllPVChecks_ || (numPV_ > 0));
683 int myLuminosityBlock;
686 if (myLuminosityBlock < LSBegin_)
688 if (myLuminosityBlock > LSEnd_ && LSEnd_ > 0)
692 std::cout <<
"METAnalyzer analyze" << std::endl;
694 std::string DirName =
"JetMET/PFCandidates/" + mInputCollection_.label();
696 bool hbhenoifilterdecision =
true;
699 iEvent.
getByToken(hbheNoiseFilterResultToken_, HBHENoiseFilterResultHandle);
700 if (!HBHENoiseFilterResultHandle.
isValid()) {
701 LogDebug(
"") <<
"METAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
703 std::cout <<
"METAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
705 hbhenoifilterdecision = *HBHENoiseFilterResultHandle;
708 iEvent.
getByToken(METFilterMiniAODToken_, metFilterResults);
709 if (metFilterResults.
isValid()) {
710 if (miniaodfilterindex != -1) {
711 hbhenoifilterdecision = metFilterResults->accept(miniaodfilterindex);
714 iEvent.
getByToken(METFilterMiniAODToken2_, metFilterResults);
715 if (metFilterResults.
isValid()) {
716 if (miniaodfilterindex != -1) {
717 hbhenoifilterdecision = metFilterResults->accept(miniaodfilterindex);
724 bool bDCSFilter = (bypassAllDCSChecks_ || DCSFilter_->filter(iEvent, iSetup));
726 for (
unsigned int i = 0;
i < countsPFCand_.size();
i++) {
727 countsPFCand_[
i] = 0;
729 if (bDCSFilter && hbhenoifilterdecision && bPrimaryVertex) {
732 iEvent.
getByToken(pflowPackedToken_, packedParticleFlow);
734 for (
unsigned int i = 0;
i < packedParticleFlow->size();
i++) {
736 for (
unsigned int j = 0;
j < typePFCand_.size();
j++) {
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())
745 occupancyPFCand_[
j] = map_of_MEs[DirName +
"/" + occupancyPFCand_name_[
j]];
746 if (occupancyPFCand_[j] && occupancyPFCand_[j]->getRootObject())
748 ptPFCand_puppiNolepWeight_[
j] = map_of_MEs[DirName +
"/" + ptPFCand_name_puppiNolepWeight_[
j]];
749 if (ptPFCand_puppiNolepWeight_[j] && ptPFCand_puppiNolepWeight_[j]->getRootObject())
751 occupancyPFCand_puppiNolepWeight_[
j] =
752 map_of_MEs[DirName +
"/" + occupancyPFCand_name_puppiNolepWeight_[
j]];
753 if (occupancyPFCand_puppiNolepWeight_[j] && occupancyPFCand_puppiNolepWeight_[j]->getRootObject()) {
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]);
769 for (
unsigned int i = 0;
i < particleFlow->size();
i++) {
771 for (
unsigned int j = 0;
j < typePFCandRECO_.size();
j++) {
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())
780 occupancyPFCandRECO_[
j] = map_of_MEs[DirName +
"/" + occupancyPFCand_nameRECO_[
j]];
781 if (occupancyPFCandRECO_[
j] && occupancyPFCandRECO_[
j]->getRootObject())
790 if ((ecalRaw + hcalRaw) > hcalMin_) {
792 if (theElements.empty())
794 unsigned int iTrack = -999;
795 std::vector<unsigned int> iECAL;
796 std::vector<unsigned int> iHCAL;
801 for (
unsigned int iEle = 0; iEle < elements.
size(); iEle++) {
805 case PFBlockElement::TRACK:
810 iECAL.push_back(iEle);
813 iHCAL.push_back(iEle);
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())
831 m_HOverTrackP_trackPtVsEta = map_of_MEs[DirName +
"/" +
"HOverTrackP_trackPtVsEta"];
832 if (m_HOverTrackP_trackPtVsEta && m_HOverTrackP_trackPtVsEta->getRootObject())
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())
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())
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())
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())
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())
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())
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())
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())
869 m_HOverTrackPVsTrackP_Barrel = map_of_MEs[DirName +
"/" +
"HOverTrackPVsTrackP_Barrel"];
870 if (m_HOverTrackPVsTrackP_Barrel && m_HOverTrackPVsTrackP_Barrel->getRootObject())
872 m_HOverTrackPVsTrackPt_Barrel = map_of_MEs[DirName +
"/" +
"HOverTrackPVsTrackPt_Barrel"];
873 if (m_HOverTrackPVsTrackPt_Barrel && m_HOverTrackPVsTrackPt_Barrel->getRootObject())
876 m_HOverTrackPVsTrackP_EndCap = map_of_MEs[DirName +
"/" +
"HOverTrackPVsTrackP_EndCap"];
877 if (m_HOverTrackPVsTrackP_EndCap && m_HOverTrackPVsTrackP_EndCap->getRootObject())
879 m_HOverTrackPVsTrackPt_EndCap = map_of_MEs[DirName +
"/" +
"HOverTrackPVsTrackPt_EndCap"];
880 if (m_HOverTrackPVsTrackPt_EndCap && m_HOverTrackPVsTrackPt_EndCap->getRootObject())
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())
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())
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())
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())
902 for (
unsigned int ii = 0;
ii < iECAL.size();
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(),
912 mProfileIsoPFChHad_EMPtCentral = map_of_MEs[DirName +
"/" +
"IsoPfChHad_EMPt_central"];
913 if (mProfileIsoPFChHad_EMPtCentral && mProfileIsoPFChHad_EMPtCentral->getRootObject())
914 mProfileIsoPFChHad_EMPtCentral->Fill(
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(),
923 mProfileIsoPFChHad_EMPtEndcap = map_of_MEs[DirName +
"/" +
"IsoPfChHad_EMPt_endcap"];
924 if (mProfileIsoPFChHad_EMPtEndcap && mProfileIsoPFChHad_EMPtEndcap->getRootObject())
925 mProfileIsoPFChHad_EMPtEndcap->Fill(
930 for (
unsigned int ii = 0;
ii < iHCAL.size();
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(),
940 mProfileIsoPFChHad_HadPtCentral = map_of_MEs[DirName +
"/" +
"IsoPfChHad_HadPt_central"];
941 if (mProfileIsoPFChHad_HadPtCentral && mProfileIsoPFChHad_HadPtCentral->getRootObject())
942 mProfileIsoPFChHad_HadPtCentral->Fill(
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(),
951 mProfileIsoPFChHad_HadPtEndcap = map_of_MEs[DirName +
"/" +
"IsoPfChHad_HadPt_endcap"];
952 if (mProfileIsoPFChHad_HadPtEndcap && mProfileIsoPFChHad_HadPtEndcap->getRootObject())
953 mProfileIsoPFChHad_HadPtEndcap->Fill(
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]);
float puppiWeight() const
T getUntrackedParameter(std::string const &, T const &) const
void analyze(const edm::Event &, const edm::EventSetup &) override
Get the analysis.
static std::vector< std::string > checklist log
const edm::EventSetup & c
double rawEcalEnergy() const
return corrected Ecal energy
double pt() const final
transverse momentum
float puppiWeightNoLep() const
Weight from full PUPPI.
virtual void setCurrentFolder(std::string const &fullpath)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< T >::const_iterator search(const cond::Time_t &val, const std::vector< T > &container)
DQMPFCandidateAnalyzer(const edm::ParameterSet &)
Constructor.
edm::LuminosityBlockNumber_t luminosityBlock() const
std::vector< Vertex > VertexCollection
collection of Vertex objects
Exp< T >::type exp(const T &t)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Inizialize parameters for histo binning.
int pdgId() const override
PDG identifier.
std::vector< ElementInBlock > ElementsInBlocks
double eta() const override
momentum pseudorapidity
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())
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
~DQMPFCandidateAnalyzer() override
Destructor.
Abs< T >::type abs(const T &t)
const PFClusterRef & clusterRef() const override
double pt() const override
transverse momentum
T const * product() const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
T getParameter(std::string const &) const
const reco::TrackRef & trackRef() const override
Particle reconstructed by the particle flow algorithm.
double hcalEnergy() const
return corrected Hcal energy
Log< level::Warning, false > LogWarning
virtual ParticleType particleId() const
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Initialize run-based parameters.
const ElementsInBlocks & elementsInBlocks() const
double phi() const final
momentum azimuthal angle
double phi() const override
momentum azimuthal angle
double rawHcalEnergy() const
return raw Hcal energy
double eta() const final
momentum pseudorapidity