CMS 3D CMS Logo

L1TEGammaOffline.cc
Go to the documentation of this file.
3 
6 // Geometry
10 #include "TLorentzVector.h"
11 
12 #include <iostream>
13 #include <iomanip>
14 #include <cstdio>
15 #include <string>
16 #include <sstream>
17 #include <cmath>
18 #include <algorithm>
19 
20 //
21 // -------------------------------------- Constructor --------------------------------------------
22 //
24  theGsfElectronCollection_(
25  consumes < reco::GsfElectronCollection > (ps.getParameter < edm::InputTag > ("electronCollection"))),
26  thePhotonCollection_(
27  consumes < std::vector<reco::Photon> > (ps.getParameter < edm::InputTag > ("photonCollection"))),
28  thePVCollection_(consumes < reco::VertexCollection > (ps.getParameter < edm::InputTag > ("PVCollection"))),
29  theBSCollection_(consumes < reco::BeamSpot > (ps.getParameter < edm::InputTag > ("beamSpotCollection"))),
30  triggerEvent_(consumes < trigger::TriggerEvent > (ps.getParameter < edm::InputTag > ("TriggerEvent"))),
31  triggerResults_(consumes < edm::TriggerResults > (ps.getParameter < edm::InputTag > ("TriggerResults"))),
32  triggerFilter_(ps.getParameter < edm::InputTag > ("TriggerFilter")),
33  triggerPath_(ps.getParameter < std::string > ("TriggerPath")),
34  histFolder_(ps.getParameter < std::string > ("histFolder")),
35  efficiencyFolder_(histFolder_ + "/efficiency_raw"),
36  stage2CaloLayer2EGammaToken_(
37  consumes < l1t::EGammaBxCollection > (ps.getParameter < edm::InputTag > ("stage2CaloLayer2EGammaSource"))),
38  electronEfficiencyThresholds_(ps.getParameter < std::vector<double> > ("electronEfficiencyThresholds")),
39  electronEfficiencyBins_(ps.getParameter < std::vector<double> > ("electronEfficiencyBins")),
40  probeToL1Offset_(ps.getParameter <double> ("probeToL1Offset")),
41  deepInspectionElectronThresholds_(ps.getParameter < std::vector<double> > ("deepInspectionElectronThresholds")),
42  photonEfficiencyThresholds_(ps.getParameter < std::vector<double> > ("photonEfficiencyThresholds")),
43  photonEfficiencyBins_(ps.getParameter < std::vector<double> > ("photonEfficiencyBins")),
44  tagElectron_(),
45  probeElectron_(),
46  tagAndProbleInvariantMass_(-1.)
47 {
48  edm::LogInfo("L1TEGammaOffline") << "Constructor " << "L1TEGammaOffline::L1TEGammaOffline " << std::endl;
49 }
50 
51 //
52 // -- Destructor
53 //
55 {
56  edm::LogInfo("L1TEGammaOffline") << "Destructor L1TEGammaOffline::~L1TEGammaOffline " << std::endl;
57 }
58 
59 //
60 // -------------------------------------- beginRun --------------------------------------------
61 //
63 {
64  edm::LogInfo("L1TEGammaOffline") << "L1TEGammaOffline::beginRun" << std::endl;
65 }
66 
67 //
68 // -------------------------------------- bookHistos --------------------------------------------
69 //
71 {
72  edm::LogInfo("L1TEGammaOffline") << "L1TEGammaOffline::bookHistograms" << std::endl;
73 
74  //book at beginRun
75  bookElectronHistos(ibooker);
76  bookPhotonHistos(ibooker);
77 }
78 //
79 // -------------------------------------- beginLuminosityBlock --------------------------------------------
80 //
82 {
83  edm::LogInfo("L1TEGammaOffline") << "L1TEGammaOffline::beginLuminosityBlock" << std::endl;
84 }
85 
86 //
87 // -------------------------------------- Analyze --------------------------------------------
88 //
90 {
91  edm::LogInfo("L1TEGammaOffline") << "L1TEGammaOffline::analyze" << std::endl;
92 
94  e.getByToken(thePVCollection_, vertexHandle);
95  if (!vertexHandle.isValid()) {
96  edm::LogError("L1TEGammaOffline") << "invalid collection: vertex " << std::endl;
97  return;
98  }
99 
100  unsigned int nVertex = vertexHandle->size();
102 
103  // L1T
104  fillElectrons(e, nVertex);
105  fillPhotons(e, nVertex);
106 }
107 
108 void L1TEGammaOffline::fillElectrons(edm::Event const& e, const unsigned int nVertex)
109 {
112 
114  e.getByToken(theGsfElectronCollection_, gsfElectrons);
115 
116  if (!gsfElectrons.isValid()) {
117  edm::LogError("L1TEGammaOffline") << "invalid collection: GSF electrons " << std::endl;
118  return;
119  }
120  if (gsfElectrons->empty()) {
121  LogDebug("L1TEGammaOffline") << "empty collection: GSF electrons " << std::endl;
122  return;
123  }
124  if (!l1EGamma.isValid()) {
125  edm::LogError("L1TEGammaOffline") << "invalid collection: L1 EGamma " << std::endl;
126  return;
127  }
128  if (!findTagAndProbePair(gsfElectrons)) {
129  LogDebug("L1TEGammaOffline") << "Could not find a tag & probe pair" << std::endl;
130  return; //continue to next event
131  }
132 
133  auto probeElectron = probeElectron_;
134 
135  // find corresponding L1 EG
136  double minDeltaR = 0.3;
137  l1t::EGamma closestL1EGamma;
138  bool foundMatch = false;
139 
140  int bunchCrossing = 0;
141  for (auto egamma = l1EGamma->begin(bunchCrossing); egamma != l1EGamma->end(bunchCrossing); ++egamma) {
142  double currentDeltaR = deltaR(egamma->eta(), egamma->phi(), probeElectron.eta(), probeElectron.phi());
143  if (currentDeltaR > minDeltaR) {
144  continue;
145  } else {
146  minDeltaR = currentDeltaR;
147  closestL1EGamma = *egamma;
148  foundMatch = true;
149  }
150 
151  }
152 
153  if (!foundMatch) {
154  LogDebug("L1TEGammaOffline") << "Could not find a matching L1 EGamma " << std::endl;
155  return;
156  }
157 
158  double recoEt = probeElectron.et();
159  double recoEta = probeElectron.eta();
160  double recoPhi = probeElectron.phi();
161 
162  double l1Et = closestL1EGamma.et();
163  double l1Eta = closestL1EGamma.eta();
164  double l1Phi = closestL1EGamma.phi();
165 
166  // if no reco value, relative resolution does not make sense -> sort to overflow
167  double outOfBounds = 9999;
168  double resolutionEt = recoEt > 0 ? (l1Et - recoEt) / recoEt : outOfBounds;
169  double resolutionEta = std::abs(recoEta) > 0 ? (l1Eta - recoEta) / recoEta : outOfBounds;
170  double resolutionPhi = std::abs(recoPhi) > 0 ? (l1Phi - recoPhi) / recoPhi : outOfBounds;
171 
172  using namespace dqmoffline::l1t;
173  // eta
176 
177  // plots for deeper inspection
182  if(recoEt > threshold){
183  fillWithinLimits(h_efficiencyElectronEta_pass_[threshold], recoEta);
184  fillWithinLimits(h_efficiencyElectronPhi_pass_[threshold], recoPhi);
186  }
187  }
188 
191  recoEta, recoPhi);
192  if(l1Et > threshold + probeToL1Offset_){
194  recoEta, recoPhi);
195  }
196  }
197 
198  if (std::abs(recoEta) <= 1.479) { // barrel
199  // et
202  //resolution
205  // phi
208  // resolution
211 
212  // turn-ons
213  for (auto threshold : electronEfficiencyThresholds_) {
216  if (l1Et > threshold) {
219  }
220  }
221  } else { // end-cap
222  // et
225  //resolution
228  // phi
231  // resolution
234 
235  // turn-ons
236  for (auto threshold : electronEfficiencyThresholds_) {
239  if (l1Et > threshold) {
242  }
243  }
244  }
245 }
246 
266 {
267  bool foundBoth(false);
268  auto nElectrons = electrons->size();
269  if (nElectrons < 2)
270  return false;
271 
272  for (auto tagElectron : *electrons) {
273  for (auto probeElectron : *electrons) {
274  if (tagElectron.p4() == probeElectron.p4())
275  continue;
276 
277  auto combined(tagElectron.p4() + probeElectron.p4());
278  auto tagAbsEta = std::abs(tagElectron.eta());
279  auto probeAbsEta = std::abs(probeElectron.eta());
280 
281  // EB-EE transition region
282  bool isEBEEGap = tagElectron.isEBEEGap() || probeElectron.isEBEEGap();
283  bool passesEta = !isEBEEGap && tagAbsEta < 2.5 && probeAbsEta < 2.5;
284  bool passesCharge = tagElectron.charge() == -probeElectron.charge();
285 
286  // https://github.com/ikrav/cmssw/blob/egm_id_80X_v1/RecoEgamma/ElectronIdentification/plugins/cuts/GsfEleFull5x5SigmaIEtaIEtaCut.cc#L45
287  bool tagPassesMediumID = passesMediumEleId(tagElectron) && tagElectron.et() > 30.;
288  bool probePassesLooseID = passesLooseEleId(probeElectron);
289  bool passesInvariantMass = combined.M() > 60 && combined.M() < 120;
290 
291  if (passesEta && passesInvariantMass && passesCharge && tagPassesMediumID && probePassesLooseID) {
292  foundBoth = true;
293  tagElectron_ = tagElectron;
294  probeElectron_ = probeElectron;
295  // plot tag & probe invariant mass
297  break;
298  }
299  }
300 
301  }
302  return foundBoth;
303 }
304 
312 {
313  const float ecal_energy_inverse = 1.0 / electron.ecalEnergy();
314  const float eSCoverP = electron.eSuperClusterOverP();
315  const float eOverP = std::abs(1.0 - eSCoverP) * ecal_energy_inverse;
316 
317  if (electron.isEB() && eOverP > 0.241)
318  return false;
319  if (electron.isEE() && eOverP > 0.14)
320  return false;
321  if (electron.isEB() && std::abs(electron.deltaEtaSuperClusterTrackAtVtx()) > 0.00477)
322  return false;
323  if (electron.isEE() && std::abs(electron.deltaEtaSuperClusterTrackAtVtx()) > 0.00868)
324  return false;
325  if (electron.isEB() && std::abs(electron.deltaPhiSuperClusterTrackAtVtx()) > 0.222)
326  return false;
327  if (electron.isEE() && std::abs(electron.deltaPhiSuperClusterTrackAtVtx()) > 0.213)
328  return false;
329  if (electron.isEB() && electron.scSigmaIEtaIEta() > 0.011)
330  return false;
331  if (electron.isEE() && electron.scSigmaIEtaIEta() > 0.0314)
332  return false;
333  if (electron.isEB() && electron.hadronicOverEm() > 0.298)
334  return false;
335  if (electron.isEE() && electron.hadronicOverEm() > 0.101)
336  return false;
337  return true;
338 }
339 
340 /*
341  * Structure from
342  * https://github.com/cms-sw/cmssw/blob/CMSSW_9_0_X/DQMOffline/EGamma/plugins/ElectronAnalyzer.cc
343  * Values from
344  * https://twiki.cern.ch/twiki/bin/view/CMS/CutBasedElectronIdentificationRun2
345  */
347 {
348  const float ecal_energy_inverse = 1.0 / electron.ecalEnergy();
349  const float eSCoverP = electron.eSuperClusterOverP();
350  const float eOverP = std::abs(1.0 - eSCoverP) * ecal_energy_inverse;
351 
352  if (electron.isEB() && eOverP < 0.134)
353  return false;
354  if (electron.isEE() && eOverP > 0.13)
355  return false;
356  if (electron.isEB() && std::abs(electron.deltaEtaSuperClusterTrackAtVtx()) > 0.00311)
357  return false;
358  if (electron.isEE() && std::abs(electron.deltaEtaSuperClusterTrackAtVtx()) > 0.00609)
359  return false;
360  if (electron.isEB() && std::abs(electron.deltaPhiSuperClusterTrackAtVtx()) > 0.103)
361  return false;
362  if (electron.isEE() && std::abs(electron.deltaPhiSuperClusterTrackAtVtx()) > 0.045)
363  return false;
364  if (electron.isEB() && electron.scSigmaIEtaIEta() > 0.00998)
365  return false;
366  if (electron.isEE() && electron.scSigmaIEtaIEta() > 0.0298)
367  return false;
368  if (electron.isEB() && electron.hadronicOverEm() > 0.253)
369  return false;
370  if (electron.isEE() && electron.hadronicOverEm() > 0.0878)
371  return false;
372  return true;
373 }
374 
375 void L1TEGammaOffline::fillPhotons(edm::Event const& e, const unsigned int nVertex)
376 {
377  // TODO - just an example here
380 
382  e.getByToken(thePhotonCollection_, photons);
383 
384  if (!photons.isValid()) {
385  edm::LogError("L1TEGammaOffline") << "invalid collection: reco::Photons " << std::endl;
386  return;
387  }
388  if (!l1EGamma.isValid()) {
389  // edm::LogError("L1TEGammaOffline") << "invalid collection: L1 EGamma " << std::endl;
390  return;
391  }
392 
393  if(photons->empty()){
394  LogDebug("L1TEGammaOffline") << "No photons found in event." << std::endl;
395  return;
396  }
397 
398  auto probePhoton = photons->at(0);
399 
400  double minDeltaR = 0.3;
401  l1t::EGamma closestL1EGamma;
402  bool foundMatch = false;
403 
404  int bunchCrossing = 0;
405  for (auto egamma = l1EGamma->begin(bunchCrossing); egamma != l1EGamma->end(bunchCrossing); ++egamma) {
406  double currentDeltaR = deltaR(egamma->eta(), egamma->phi(), probePhoton.eta(), probePhoton.phi());
407  if (currentDeltaR > minDeltaR) {
408  continue;
409  } else {
410  minDeltaR = currentDeltaR;
411  closestL1EGamma = *egamma;
412  foundMatch = true;
413  }
414 
415  }
416 
417  if (!foundMatch) {
418  LogDebug("L1TEGammaOffline") << "Could not find a matching L1 EGamma " << std::endl;
419  return;
420  }
421 
422  double recoEt = probePhoton.et();
423  double recoEta = probePhoton.eta();
424  double recoPhi = probePhoton.phi();
425 
426  double l1Et = closestL1EGamma.et();
427  double l1Eta = closestL1EGamma.eta();
428  double l1Phi = closestL1EGamma.phi();
429 
430  // if no reco value, relative resolution does not make sense -> sort to overflow
431  double outOfBounds = 9999;
432  double resolutionEt = recoEt > 0 ? (l1Et - recoEt) / recoEt : outOfBounds;
433  double resolutionEta = std::abs(recoEta) > 0 ? (l1Eta - recoEta) / recoEta : outOfBounds;
434  double resolutionPhi = std::abs(recoPhi) > 0 ? (l1Phi - recoPhi) / recoPhi : outOfBounds;
435 
436  using namespace dqmoffline::l1t;
437  // eta
440 
441  if (std::abs(recoEta) <= 1.479) { // barrel
442  // et
445  //resolution
448  // phi
451  // resolution
454 
455  // turn-ons
459  if (l1Et > threshold) {
462  }
463  }
464  } else { // end-cap
465  // et
468  //resolution
471  // phi
474  // resolution
477 
478  // turn-ons
482  if (l1Et > threshold) {
485  }
486  }
487  }
488 }
489 
490 //
491 // -------------------------------------- endLuminosityBlock --------------------------------------------
492 //
494 {
495  edm::LogInfo("L1TEGammaOffline") << "L1TEGammaOffline::endLuminosityBlock" << std::endl;
496 }
497 
498 //
499 // -------------------------------------- endRun --------------------------------------------
500 //
502 {
503  edm::LogInfo("L1TEGammaOffline") << "L1TEGammaOffline::endRun" << std::endl;
504 }
505 
506 //
507 // -------------------------------------- book histograms --------------------------------------------
508 //
510 {
511  ibooker.cd();
512  ibooker.setCurrentFolder(histFolder_);
513  h_nVertex_ = ibooker.book1D("nVertex", "Number of event vertices in collection", 40, -0.5, 39.5);
514  h_tagAndProbeMass_ = ibooker.book1D("tagAndProbeMass", "Invariant mass of tag & probe pair", 100, 40, 140);
515  // electron reco vs L1
516  h_L1EGammaETvsElectronET_EB_ = ibooker.book2D("L1EGammaETvsElectronET_EB",
517  "L1 EGamma E_{T} vs GSF Electron E_{T} (EB); GSF Electron E_{T} (GeV); L1 EGamma E_{T} (GeV)", 300, 0, 300, 300,
518  0, 300);
519  h_L1EGammaETvsElectronET_EE_ = ibooker.book2D("L1EGammaETvsElectronET_EE",
520  "L1 EGamma E_{T} vs GSF Electron E_{T} (EE); GSF Electron E_{T} (GeV); L1 EGamma E_{T} (GeV)", 300, 0, 300, 300,
521  0, 300);
522  h_L1EGammaETvsElectronET_EB_EE_ = ibooker.book2D("L1EGammaETvsElectronET_EB_EE",
523  "L1 EGamma E_{T} vs GSF Electron E_{T} (EB+EE); GSF Electron E_{T} (GeV); L1 EGamma E_{T} (GeV)", 300, 0, 300,
524  300, 0, 300);
525 
526  h_L1EGammaPhivsElectronPhi_EB_ = ibooker.book2D("L1EGammaPhivsElectronPhi_EB",
527  "#phi_{electron}^{L1} vs #phi_{electron}^{offline} (EB); #phi_{electron}^{offline}; #phi_{electron}^{L1}", 100,
528  -4, 4, 100, -4, 4);
529  h_L1EGammaPhivsElectronPhi_EE_ = ibooker.book2D("L1EGammaPhivsElectronPhi_EE",
530  "#phi_{electron}^{L1} vs #phi_{electron}^{offline} (EE); #phi_{electron}^{offline}; #phi_{electron}^{L1}", 100,
531  -4, 4, 100, -4, 4);
532  h_L1EGammaPhivsElectronPhi_EB_EE_ = ibooker.book2D("L1EGammaPhivsElectronPhi_EB_EE",
533  "#phi_{electron}^{L1} vs #phi_{electron}^{offline} (EB+EE); #phi_{electron}^{offline}; #phi_{electron}^{L1}", 100,
534  -4, 4, 100, -4, 4);
535 
536  h_L1EGammaEtavsElectronEta_ = ibooker.book2D("L1EGammaEtavsElectronEta",
537  "L1 EGamma #eta vs GSF Electron #eta; GSF Electron #eta; L1 EGamma #eta", 100, -3, 3, 100, -3, 3);
538 
539  // electron resolutions
540  h_resolutionElectronET_EB_ = ibooker.book1D("resolutionElectronET_EB",
541  "electron ET resolution (EB); (L1 EGamma E_{T} - GSF Electron E_{T})/GSF Electron E_{T}; events", 50, -1, 1.5);
542  h_resolutionElectronET_EE_ = ibooker.book1D("resolutionElectronET_EE",
543  "electron ET resolution (EE); (L1 EGamma E_{T} - GSF Electron E_{T})/GSF Electron E_{T}; events", 50, -1, 1.5);
544  h_resolutionElectronET_EB_EE_ = ibooker.book1D("resolutionElectronET_EB_EE",
545  "electron ET resolution (EB+EE); (L1 EGamma E_{T} - GSF Electron E_{T})/GSF Electron E_{T}; events", 50, -1, 1.5);
546 
548  ibooker.book1D("resolutionElectronPhi_EB",
549  "#phi_{electron} resolution (EB); (#phi_{electron}^{L1} - #phi_{electron}^{offline})/#phi_{electron}^{offline}; events",
550  120, -0.3, 0.3);
552  ibooker.book1D("resolutionElectronPhi_EE",
553  "electron #phi resolution (EE); (#phi_{electron}^{L1} - #phi_{electron}^{offline})/#phi_{electron}^{offline}; events",
554  120, -0.3, 0.3);
556  ibooker.book1D("resolutionElectronPhi_EB_EE",
557  "electron #phi resolution (EB+EE); (#phi_{electron}^{L1} - #phi_{electron}^{offline})/#phi_{electron}^{offline}; events",
558  120, -0.3, 0.3);
559 
560  h_resolutionElectronEta_ = ibooker.book1D("resolutionElectronEta",
561  "electron #eta resolution (EB); (L1 EGamma #eta - GSF Electron #eta)/GSF Electron #eta; events", 120, -0.3, 0.3);
562 
563  // electron turn-ons
565  std::vector<float> electronBins(electronEfficiencyBins_.begin(), electronEfficiencyBins_.end());
566  int nBins = electronBins.size() - 1;
567  float* electronBinArray = &(electronBins[0]);
568 
570  std::string str_threshold = std::to_string(int(threshold));
572  "efficiencyElectronET_EB_threshold_" + str_threshold + "_Num",
573  "electron efficiency (EB) (numerator); GSF Electron E_{T} (GeV); events", nBins, electronBinArray);
575  "efficiencyElectronET_EE_threshold_" + str_threshold + "_Num",
576  "electron efficiency (EE) (numerator); GSF Electron E_{T} (GeV); events", nBins, electronBinArray);
578  "efficiencyElectronET_EB_EE_threshold_" + str_threshold + "_Num",
579  "electron efficiency (EB+EE) (numerator); GSF Electron E_{T} (GeV); events", nBins, electronBinArray);
581  "efficiencyElectronPhi_vs_Eta_threshold_" + str_threshold + "_Num",
582  "electron efficiency (numerator); GSF Electron #eta; GSF Electron #phi",
583  50, -2.5, 2.5, 32, -3.2, 3.2);
584 
586  "efficiencyElectronET_EB_threshold_" + str_threshold + "_Den",
587  "electron efficiency (EB) (denominator); GSF Electron E_{T} (GeV); events", nBins, electronBinArray);
589  "efficiencyElectronET_EE_threshold_" + str_threshold + "_Den",
590  "electron efficiency (EE) (denominator); GSF Electron E_{T} (GeV); events", nBins, electronBinArray);
592  "efficiencyElectronET_EB_EE_threshold_" + str_threshold + "_Den",
593  "electron efficiency (EB+EE) (denominator); GSF Electron E_{T} (GeV); events", nBins, electronBinArray);
595  "efficiencyElectronPhi_vs_Eta_threshold_" + str_threshold + "_Den",
596  "electron efficiency (denominator); GSF Electron #eta; GSF Electron #phi",
597  50, -2.5, 2.5, 32, -3.2, 3.2);
598  }
599 
601  std::string str_threshold = std::to_string(int(threshold));
603  "efficiencyElectronEta_threshold_" + str_threshold + "_Num",
604  "electron efficiency (numerator); GSF Electron #eta; events", 50, -2.5, 2.5);
606  "efficiencyElectronPhi_threshold_" + str_threshold + "_Num",
607  "electron efficiency (numerator); GSF Electron #phi; events", 32, -3.2, 3.2);
609  "efficiencyElectronNVertex_threshold_" + str_threshold + "_Num",
610  "electron efficiency (numerator); Nvtx; events", 30, 0, 60);
611 
613  "efficiencyElectronEta_threshold_" + str_threshold + "_Den",
614  "electron efficiency (denominator); GSF Electron #eta; events", 50, -2.5, 2.5);
616  "efficiencyElectronPhi_threshold_" + str_threshold + "_Den",
617  "electron efficiency (denominator); GSF Electron #phi; events", 32, -3.2, 3.2);
619  "efficiencyElectronNVertex_threshold_" + str_threshold + "_Den",
620  "electron efficiency (denominator); Nvtx; events", 30, 0, 60);
621  }
622 
623 
624  ibooker.cd();
625 }
626 
628 {
629  ibooker.cd();
630  ibooker.setCurrentFolder(histFolder_);
631  h_L1EGammaETvsPhotonET_EB_ = ibooker.book2D("L1EGammaETvsPhotonET_EB",
632  "L1 EGamma E_{T} vs Photon E_{T} (EB); Photon E_{T} (GeV); L1 EGamma E_{T} (GeV)", 300, 0, 300, 300, 0, 300);
633  h_L1EGammaETvsPhotonET_EE_ = ibooker.book2D("L1EGammaETvsPhotonET_EE",
634  "L1 EGamma E_{T} vs Photon E_{T} (EE); Photon E_{T} (GeV); L1 EGamma E_{T} (GeV)", 300, 0, 300, 300, 0, 300);
635  h_L1EGammaETvsPhotonET_EB_EE_ = ibooker.book2D("L1EGammaETvsPhotonET_EB_EE",
636  "L1 EGamma E_{T} vs Photon E_{T} (EB+EE); Photon E_{T} (GeV); L1 EGamma E_{T} (GeV)", 300, 0, 300, 300, 0, 300);
637 
638  h_L1EGammaPhivsPhotonPhi_EB_ = ibooker.book2D("L1EGammaPhivsPhotonPhi_EB",
639  "#phi_{photon}^{L1} vs #phi_{photon}^{offline} (EB); #phi_{photon}^{offline}; #phi_{photon}^{L1}", 100, -4, 4,
640  100, -4, 4);
641  h_L1EGammaPhivsPhotonPhi_EE_ = ibooker.book2D("L1EGammaPhivsPhotonPhi_EE",
642  "#phi_{photon}^{L1} vs #phi_{photon}^{offline} (EE); #phi_{photon}^{offline}; #phi_{photon}^{L1}", 100, -4, 4,
643  100, -4, 4);
644  h_L1EGammaPhivsPhotonPhi_EB_EE_ = ibooker.book2D("L1EGammaPhivsPhotonPhi_EB_EE",
645  "#phi_{photon}^{L1} vs #phi_{photon}^{offline} (EB+EE); #phi_{photon}^{offline}; #phi_{photon}^{L1}", 100, -4, 4,
646  100, -4, 4);
647 
648  h_L1EGammaEtavsPhotonEta_ = ibooker.book2D("L1EGammaEtavsPhotonEta",
649  "L1 EGamma #eta vs Photon #eta; Photon #eta; L1 EGamma #eta", 100, -3, 3, 100, -3, 3);
650 
651  // photon resolutions
652  h_resolutionPhotonET_EB_ = ibooker.book1D("resolutionPhotonET_EB",
653  "photon ET resolution (EB); (L1 EGamma E_{T} - Photon E_{T})/ Photon E_{T}; events", 50, -1, 1.5);
654  h_resolutionPhotonET_EE_ = ibooker.book1D("resolutionPhotonET_EE",
655  "photon ET resolution (EE); (L1 EGamma E_{T} - Photon E_{T})/ Photon E_{T}; events", 50, -1, 1.5);
656  h_resolutionPhotonET_EB_EE_ = ibooker.book1D("resolutionPhotonET_EB_EE",
657  "photon ET resolution (EB+EE); (L1 EGamma E_{T} - Photon E_{T})/ Photon E_{T}; events", 50, -1, 1.5);
658 
659  h_resolutionPhotonPhi_EB_ = ibooker.book1D("resolutionPhotonPhi_EB",
660  "#phi_{photon} resolution (EB); (#phi_{photon}^{L1} - #phi_{photon}^{offline})/#phi_{photon}^{offline}; events",
661  120, -0.3, 0.3);
662  h_resolutionPhotonPhi_EE_ = ibooker.book1D("resolutionPhotonPhi_EE",
663  "photon #phi resolution (EE); (#phi_{photon}^{L1} - #phi_{photon}^{offline})/#phi_{photon}^{offline}; events",
664  120, -0.3, 0.3);
665  h_resolutionPhotonPhi_EB_EE_ = ibooker.book1D("resolutionPhotonPhi_EB_EE",
666  "photon #phi resolution (EB+EE); (#phi_{photon}^{L1} - #phi_{photon}^{offline})/#phi_{photon}^{offline}; events",
667  120, -0.3, 0.3);
668 
669  h_resolutionPhotonEta_ = ibooker.book1D("resolutionPhotonEta",
670  "photon #eta resolution (EB); (L1 EGamma #eta - Photon #eta)/ Photon #eta; events", 120, -0.3, 0.3);
671 
672  // photon turn-ons
674  std::vector<float> photonBins(photonEfficiencyBins_.begin(), photonEfficiencyBins_.end());
675  int nBins = photonBins.size() - 1;
676  float* photonBinArray = &(photonBins[0]);
677 
679  std::string str_threshold = std::to_string(int(threshold));
681  "efficiencyPhotonET_EB_threshold_" + str_threshold + "_Num",
682  "photon efficiency (EB) (numerator); Photon E_{T} (GeV); events", nBins, photonBinArray);
684  "efficiencyPhotonET_EE_threshold_" + str_threshold + "_Num",
685  "photon efficiency (EE) (numerator); Photon E_{T} (GeV); events", nBins, photonBinArray);
687  "efficiencyPhotonET_EB_EE_threshold_" + str_threshold + "_Num",
688  "photon efficiency (EB+EE) (numerator); Photon E_{T} (GeV); events", nBins, photonBinArray);
689 
691  "efficiencyPhotonET_EB_threshold_" + str_threshold + "_Den",
692  "photon efficiency (EB) (denominator); Photon E_{T} (GeV); events", nBins, photonBinArray);
694  "efficiencyPhotonET_EE_threshold_" + str_threshold + "_Den",
695  "photon efficiency (EE) (denominator); Photon E_{T} (GeV); events", nBins, photonBinArray);
697  "efficiencyPhotonET_EB_EE_threshold_" + str_threshold + "_Den",
698  "photon efficiency (EB+EE) (denominator); Photon E_{T} (GeV); events", nBins, photonBinArray);
699  }
700 
701  ibooker.cd();
702 }
703 
704 //define this as a plug-in
#define LogDebug(id)
BXVector< EGamma > EGammaBxCollection
Definition: EGamma.h:11
const_iterator end(int bx) const
void bookElectronHistos(DQMStore::IBooker &)
std::map< double, MonitorElement * > h_efficiencyElectronNVertex_pass_
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
void fillPhotons(edm::Event const &e, const unsigned int nVertex)
std::vector< double > electronEfficiencyBins_
MonitorElement * h_resolutionElectronPhi_EB_EE_
MonitorElement * h_L1EGammaPhivsElectronPhi_EE_
edm::EDGetTokenT< reco::GsfElectronCollection > theGsfElectronCollection_
MonitorElement * h_tagAndProbeMass_
Definition: Photon.py:1
std::map< double, MonitorElement * > h_efficiencyPhotonET_EE_total_
MonitorElement * h_L1EGammaETvsElectronET_EB_EE_
float eSuperClusterOverP() const
Definition: GsfElectron.h:245
void endLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) override
std::map< double, MonitorElement * > h_efficiencyPhotonET_EB_pass_
MonitorElement * h_L1EGammaPhivsPhotonPhi_EB_
bool passesMediumEleId(reco::GsfElectron const &electron) const
virtual double eta() const final
momentum pseudorapidity
MonitorElement * h_L1EGammaETvsPhotonET_EB_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
void cd(void)
Definition: DQMStore.cc:269
edm::EDGetTokenT< std::vector< reco::Photon > > thePhotonCollection_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::map< double, MonitorElement * > h_efficiencyElectronET_EB_EE_pass_
std::string histFolder_
MonitorElement * h_L1EGammaETvsPhotonET_EE_
void fillElectrons(edm::Event const &e, const unsigned int nVertex)
std::map< double, MonitorElement * > h_efficiencyElectronPhi_pass_
std::map< double, MonitorElement * > h_efficiencyPhotonET_EB_EE_total_
MonitorElement * h_resolutionPhotonET_EE_
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
MonitorElement * h_resolutionElectronET_EB_
std::map< double, MonitorElement * > h_efficiencyElectronET_EB_total_
delete x;
Definition: CaloConfig.h:22
bool passesLooseEleId(reco::GsfElectron const &electron) const
void bookPhotonHistos(DQMStore::IBooker &)
~L1TEGammaOffline() override
std::map< double, MonitorElement * > h_efficiencyElectronPhi_vs_Eta_total_
L1TEGammaOffline(const edm::ParameterSet &ps)
MonitorElement * h_L1EGammaETvsElectronET_EB_
std::map< double, MonitorElement * > h_efficiencyElectronPhi_vs_Eta_pass_
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) override
MonitorElement * h_L1EGammaPhivsElectronPhi_EB_EE_
std::map< double, MonitorElement * > h_efficiencyPhotonET_EB_EE_pass_
bool isEE() const
Definition: GsfElectron.h:353
bool isEB() const
Definition: GsfElectron.h:352
MonitorElement * h_resolutionElectronET_EE_
virtual double phi() const final
momentum azimuthal angle
virtual double et() const final
transverse energy
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:249
float hadronicOverEm() const
Definition: GsfElectron.h:487
std::vector< double > electronEfficiencyThresholds_
MonitorElement * h_L1EGammaPhivsPhotonPhi_EB_EE_
std::map< double, MonitorElement * > h_efficiencyElectronEta_pass_
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:252
std::map< double, MonitorElement * > h_efficiencyElectronNVertex_total_
MonitorElement * h_L1EGammaEtavsElectronEta_
MonitorElement * h_resolutionPhotonET_EB_
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
edm::EDGetTokenT< l1t::EGammaBxCollection > stage2CaloLayer2EGammaToken_
MonitorElement * h_resolutionElectronEta_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void endRun(edm::Run const &run, edm::EventSetup const &eSetup) override
reco::GsfElectron tagElectron_
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
bool isValid() const
Definition: HandleBase.h:74
MonitorElement * h_resolutionPhotonEta_
float scSigmaIEtaIEta() const
Definition: GsfElectron.h:483
MonitorElement * h_L1EGammaPhivsPhotonPhi_EE_
std::map< double, MonitorElement * > h_efficiencyElectronET_EE_total_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
bool findTagAndProbePair(edm::Handle< reco::GsfElectronCollection > const &electrons)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
std::map< double, MonitorElement * > h_efficiencyPhotonET_EB_total_
std::string efficiencyFolder_
std::map< double, MonitorElement * > h_efficiencyElectronET_EE_pass_
std::vector< double > deepInspectionElectronThresholds_
reco::GsfElectron probeElectron_
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
MonitorElement * h_resolutionPhotonPhi_EB_EE_
void fill2DWithinLimits(MonitorElement *mon, double valueX, double valueY, double weight=1.)
std::map< double, MonitorElement * > h_efficiencyElectronPhi_total_
MonitorElement * h_resolutionElectronET_EB_EE_
float ecalEnergy() const
Definition: GsfElectron.h:837
std::map< double, MonitorElement * > h_efficiencyElectronEta_total_
std::map< double, MonitorElement * > h_efficiencyElectronET_EB_EE_total_
MonitorElement * h_resolutionElectronPhi_EB_
MonitorElement * h_nVertex_
void fillWithinLimits(MonitorElement *mon, double value, double weight=1.)
MonitorElement * h_resolutionPhotonPhi_EB_
fixed size matrix
std::vector< double > photonEfficiencyBins_
HLT enums.
MonitorElement * h_L1EGammaETvsPhotonET_EB_EE_
MonitorElement * h_L1EGammaETvsElectronET_EE_
MonitorElement * h_resolutionElectronPhi_EE_
MonitorElement * h_L1EGammaEtavsPhotonEta_
MonitorElement * h_resolutionPhotonPhi_EE_
edm::EDGetTokenT< reco::VertexCollection > thePVCollection_
std::vector< double > photonEfficiencyThresholds_
std::map< double, MonitorElement * > h_efficiencyElectronET_EB_pass_
const_iterator begin(int bx) const
MonitorElement * h_L1EGammaPhivsElectronPhi_EB_
std::map< double, MonitorElement * > h_efficiencyPhotonET_EE_pass_
MonitorElement * h_resolutionPhotonET_EB_EE_
Definition: Run.h:42