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 <stdio.h>
15 #include <string>
16 #include <sstream>
17 #include <math.h>
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  photonEfficiencyThresholds_(ps.getParameter < std::vector<double> > ("photonEfficiencyThresholds")),
41  photonEfficiencyBins_(ps.getParameter < std::vector<double> > ("photonEfficiencyBins")),
42  tagElectron_(),
43  probeElectron_(),
44  tagAndProbleInvariantMass_(-1.)
45 {
46  edm::LogInfo("L1TEGammaOffline") << "Constructor " << "L1TEGammaOffline::L1TEGammaOffline " << std::endl;
47 }
48 
49 //
50 // -- Destructor
51 //
53 {
54  edm::LogInfo("L1TEGammaOffline") << "Destructor L1TEGammaOffline::~L1TEGammaOffline " << std::endl;
55 }
56 
57 //
58 // -------------------------------------- beginRun --------------------------------------------
59 //
61 {
62  edm::LogInfo("L1TEGammaOffline") << "L1TEGammaOffline::beginRun" << std::endl;
63 }
64 
65 //
66 // -------------------------------------- bookHistos --------------------------------------------
67 //
69 {
70  edm::LogInfo("L1TEGammaOffline") << "L1TEGammaOffline::bookHistograms" << std::endl;
71 
72  //book at beginRun
73  bookElectronHistos(ibooker);
74  bookPhotonHistos(ibooker);
75 }
76 //
77 // -------------------------------------- beginLuminosityBlock --------------------------------------------
78 //
80 {
81  edm::LogInfo("L1TEGammaOffline") << "L1TEGammaOffline::beginLuminosityBlock" << std::endl;
82 }
83 
84 //
85 // -------------------------------------- Analyze --------------------------------------------
86 //
88 {
89  edm::LogInfo("L1TEGammaOffline") << "L1TEGammaOffline::analyze" << std::endl;
90 
92  e.getByToken(thePVCollection_, vertexHandle);
93  if (!vertexHandle.isValid()) {
94  edm::LogError("L1TEGammaOffline") << "invalid collection: vertex " << std::endl;
95  return;
96  }
97 
98  unsigned int nVertex = vertexHandle->size();
100 
101  // L1T
102  fillElectrons(e, nVertex);
103  fillPhotons(e, nVertex);
104 }
105 
106 void L1TEGammaOffline::fillElectrons(edm::Event const& e, const unsigned int nVertex)
107 {
110 
112  e.getByToken(theGsfElectronCollection_, gsfElectrons);
113 
114  if (!gsfElectrons.isValid()) {
115  edm::LogError("L1TEGammaOffline") << "invalid collection: GSF electrons " << std::endl;
116  return;
117  }
118  if (gsfElectrons->size() == 0) {
119  LogDebug("L1TEGammaOffline") << "empty collection: GSF electrons " << std::endl;
120  return;
121  }
122  if (!l1EGamma.isValid()) {
123  edm::LogError("L1TEGammaOffline") << "invalid collection: L1 EGamma " << std::endl;
124  return;
125  }
126  if (!findTagAndProbePair(gsfElectrons)) {
127  LogDebug("L1TEGammaOffline") << "Could not find a tag & probe pair" << std::endl;
128  return; //continue to next event
129  }
130 
131  auto probeElectron = probeElectron_;
132 
133  // find corresponding L1 EG
134  double minDeltaR = 0.3;
135  l1t::EGamma closestL1EGamma;
136  bool foundMatch = false;
137 
138  int bunchCrossing = 0;
139  for (auto egamma = l1EGamma->begin(bunchCrossing); egamma != l1EGamma->end(bunchCrossing); ++egamma) {
140  double currentDeltaR = deltaR(egamma->eta(), egamma->phi(), probeElectron.eta(), probeElectron.phi());
141  if (currentDeltaR > minDeltaR) {
142  continue;
143  } else {
144  minDeltaR = currentDeltaR;
145  closestL1EGamma = *egamma;
146  foundMatch = true;
147  }
148 
149  }
150 
151  if (!foundMatch) {
152  LogDebug("L1TEGammaOffline") << "Could not find a matching L1 EGamma " << std::endl;
153  return;
154  }
155 
156  double recoEt = probeElectron.et();
157  double recoEta = probeElectron.eta();
158  double recoPhi = probeElectron.phi();
159 
160  double l1Et = closestL1EGamma.et();
161  double l1Eta = closestL1EGamma.eta();
162  double l1Phi = closestL1EGamma.phi();
163 
164  // if no reco value, relative resolution does not make sense -> sort to overflow
165  double outOfBounds = 9999;
166  double resolutionEt = recoEt > 0 ? (l1Et - recoEt) / recoEt : outOfBounds;
167  double resolutionEta = std::abs(recoEta) > 0 ? (l1Eta - recoEta) / recoEta : outOfBounds;
168  double resolutionPhi = std::abs(recoPhi) > 0 ? (l1Phi - recoPhi) / recoPhi : outOfBounds;
169 
170  using namespace dqmoffline::l1t;
171  // eta
174 
175  if (std::abs(recoEta) <= 1.479) { // barrel
176  // et
179  //resolution
182  // phi
185  // resolution
188 
189  // turn-ons
193  if (l1Et > threshold) {
196  }
197  }
198  } else { // end-cap
199  // et
202  //resolution
205  // phi
208  // resolution
211 
212  // turn-ons
216  if (l1Et > threshold) {
219  }
220  }
221  }
222 }
223 
243 {
244  bool foundBoth(false);
245  auto nElectrons = electrons->size();
246  if (nElectrons < 2)
247  return false;
248 
249  for (auto tagElectron : *electrons) {
250  for (auto probeElectron : *electrons) {
251  if (tagElectron.p4() == probeElectron.p4())
252  continue;
253 
254  auto combined(tagElectron.p4() + probeElectron.p4());
255  auto tagAbsEta = std::abs(tagElectron.eta());
256  auto probeAbsEta = std::abs(probeElectron.eta());
257 
258  // EB-EE transition region
259  bool isEBEEGap = tagElectron.isEBEEGap() || probeElectron.isEBEEGap();
260  bool passesEta = !isEBEEGap && tagAbsEta < 2.5 && probeAbsEta < 2.5;
261  bool passesCharge = tagElectron.charge() == -probeElectron.charge();
262 
263  // https://github.com/ikrav/cmssw/blob/egm_id_80X_v1/RecoEgamma/ElectronIdentification/plugins/cuts/GsfEleFull5x5SigmaIEtaIEtaCut.cc#L45
264  bool tagPassesMediumID = passesMediumEleId(tagElectron) && tagElectron.et() > 30.;
265  bool probePassesLooseID = passesLooseEleId(probeElectron);
266  bool passesInvariantMass = combined.M() > 60 && combined.M() < 120;
267 
268  if (passesEta && passesInvariantMass && passesCharge && tagPassesMediumID && probePassesLooseID) {
269  foundBoth = true;
270  tagElectron_ = tagElectron;
271  probeElectron_ = probeElectron;
272  // plot tag & probe invariant mass
274  break;
275  }
276  }
277 
278  }
279  return foundBoth;
280 }
281 
289 {
290  const float ecal_energy_inverse = 1.0 / electron.ecalEnergy();
291  const float eSCoverP = electron.eSuperClusterOverP();
292  const float eOverP = std::abs(1.0 - eSCoverP) * ecal_energy_inverse;
293 
294  if (electron.isEB() && eOverP > 0.241)
295  return false;
296  if (electron.isEE() && eOverP > 0.14)
297  return false;
298  if (electron.isEB() && std::abs(electron.deltaEtaSuperClusterTrackAtVtx()) > 0.00477)
299  return false;
300  if (electron.isEE() && std::abs(electron.deltaEtaSuperClusterTrackAtVtx()) > 0.00868)
301  return false;
302  if (electron.isEB() && std::abs(electron.deltaPhiSuperClusterTrackAtVtx()) > 0.222)
303  return false;
304  if (electron.isEE() && std::abs(electron.deltaPhiSuperClusterTrackAtVtx()) > 0.213)
305  return false;
306  if (electron.isEB() && electron.scSigmaIEtaIEta() > 0.011)
307  return false;
308  if (electron.isEE() && electron.scSigmaIEtaIEta() > 0.0314)
309  return false;
310  if (electron.isEB() && electron.hadronicOverEm() > 0.298)
311  return false;
312  if (electron.isEE() && electron.hadronicOverEm() > 0.101)
313  return false;
314  return true;
315 }
316 
317 /*
318  * Structure from
319  * https://github.com/cms-sw/cmssw/blob/CMSSW_9_0_X/DQMOffline/EGamma/plugins/ElectronAnalyzer.cc
320  * Values from
321  * https://twiki.cern.ch/twiki/bin/view/CMS/CutBasedElectronIdentificationRun2
322  */
324 {
325  const float ecal_energy_inverse = 1.0 / electron.ecalEnergy();
326  const float eSCoverP = electron.eSuperClusterOverP();
327  const float eOverP = std::abs(1.0 - eSCoverP) * ecal_energy_inverse;
328 
329  if (electron.isEB() && eOverP < 0.134)
330  return false;
331  if (electron.isEE() && eOverP > 0.13)
332  return false;
333  if (electron.isEB() && std::abs(electron.deltaEtaSuperClusterTrackAtVtx()) > 0.00311)
334  return false;
335  if (electron.isEE() && std::abs(electron.deltaEtaSuperClusterTrackAtVtx()) > 0.00609)
336  return false;
337  if (electron.isEB() && std::abs(electron.deltaPhiSuperClusterTrackAtVtx()) > 0.103)
338  return false;
339  if (electron.isEE() && std::abs(electron.deltaPhiSuperClusterTrackAtVtx()) > 0.045)
340  return false;
341  if (electron.isEB() && electron.scSigmaIEtaIEta() > 0.00998)
342  return false;
343  if (electron.isEE() && electron.scSigmaIEtaIEta() > 0.0298)
344  return false;
345  if (electron.isEB() && electron.hadronicOverEm() > 0.253)
346  return false;
347  if (electron.isEE() && electron.hadronicOverEm() > 0.0878)
348  return false;
349  return true;
350 }
351 
352 void L1TEGammaOffline::fillPhotons(edm::Event const& e, const unsigned int nVertex)
353 {
354  // TODO - just an example here
357 
359  e.getByToken(thePhotonCollection_, photons);
360 
361  if (!photons.isValid()) {
362  edm::LogError("L1TEGammaOffline") << "invalid collection: reco::Photons " << std::endl;
363  return;
364  }
365  if (!l1EGamma.isValid()) {
366  edm::LogError("L1TEGammaOffline") << "invalid collection: L1 EGamma " << std::endl;
367  return;
368  }
369 
370  if(photons->size() ==0){
371  LogDebug("L1TEGammaOffline") << "No photons found in event." << std::endl;
372  return;
373  }
374 
375  auto probePhoton = photons->at(0);
376 
377  double minDeltaR = 0.3;
378  l1t::EGamma closestL1EGamma;
379  bool foundMatch = false;
380 
381  int bunchCrossing = 0;
382  for (auto egamma = l1EGamma->begin(bunchCrossing); egamma != l1EGamma->end(bunchCrossing); ++egamma) {
383  double currentDeltaR = deltaR(egamma->eta(), egamma->phi(), probePhoton.eta(), probePhoton.phi());
384  if (currentDeltaR > minDeltaR) {
385  continue;
386  } else {
387  minDeltaR = currentDeltaR;
388  closestL1EGamma = *egamma;
389  foundMatch = true;
390  }
391 
392  }
393 
394  if (!foundMatch) {
395  LogDebug("L1TEGammaOffline") << "Could not find a matching L1 EGamma " << std::endl;
396  return;
397  }
398 
399  double recoEt = probePhoton.et();
400  double recoEta = probePhoton.eta();
401  double recoPhi = probePhoton.phi();
402 
403  double l1Et = closestL1EGamma.et();
404  double l1Eta = closestL1EGamma.eta();
405  double l1Phi = closestL1EGamma.phi();
406 
407  // if no reco value, relative resolution does not make sense -> sort to overflow
408  double outOfBounds = 9999;
409  double resolutionEt = recoEt > 0 ? (l1Et - recoEt) / recoEt : outOfBounds;
410  double resolutionEta = std::abs(recoEta) > 0 ? (l1Eta - recoEta) / recoEta : outOfBounds;
411  double resolutionPhi = std::abs(recoPhi) > 0 ? (l1Phi - recoPhi) / recoPhi : outOfBounds;
412 
413  using namespace dqmoffline::l1t;
414  // eta
417 
418  if (std::abs(recoEta) <= 1.479) { // barrel
419  // et
422  //resolution
425  // phi
428  // resolution
431 
432  // turn-ons
436  if (l1Et > threshold) {
439  }
440  }
441  } else { // end-cap
442  // et
445  //resolution
448  // phi
451  // resolution
454 
455  // turn-ons
459  if (l1Et > threshold) {
462  }
463  }
464  }
465 }
466 
467 //
468 // -------------------------------------- endLuminosityBlock --------------------------------------------
469 //
471 {
472  edm::LogInfo("L1TEGammaOffline") << "L1TEGammaOffline::endLuminosityBlock" << std::endl;
473 }
474 
475 //
476 // -------------------------------------- endRun --------------------------------------------
477 //
479 {
480  edm::LogInfo("L1TEGammaOffline") << "L1TEGammaOffline::endRun" << std::endl;
481 }
482 
483 //
484 // -------------------------------------- book histograms --------------------------------------------
485 //
487 {
488  ibooker.cd();
489  ibooker.setCurrentFolder(histFolder_.c_str());
490  h_nVertex_ = ibooker.book1D("nVertex", "Number of event vertices in collection", 40, -0.5, 39.5);
491  h_tagAndProbeMass_ = ibooker.book1D("tagAndProbeMass", "Invariant mass of tag & probe pair", 100, 40, 140);
492  // electron reco vs L1
493  h_L1EGammaETvsElectronET_EB_ = ibooker.book2D("L1EGammaETvsElectronET_EB",
494  "L1 EGamma E_{T} vs GSF Electron E_{T} (EB); GSF Electron E_{T} (GeV); L1 EGamma E_{T} (GeV)", 300, 0, 300, 300,
495  0, 300);
496  h_L1EGammaETvsElectronET_EE_ = ibooker.book2D("L1EGammaETvsElectronET_EE",
497  "L1 EGamma E_{T} vs GSF Electron E_{T} (EE); GSF Electron E_{T} (GeV); L1 EGamma E_{T} (GeV)", 300, 0, 300, 300,
498  0, 300);
499  h_L1EGammaETvsElectronET_EB_EE_ = ibooker.book2D("L1EGammaETvsElectronET_EB_EE",
500  "L1 EGamma E_{T} vs GSF Electron E_{T} (EB+EE); GSF Electron E_{T} (GeV); L1 EGamma E_{T} (GeV)", 300, 0, 300,
501  300, 0, 300);
502 
503  h_L1EGammaPhivsElectronPhi_EB_ = ibooker.book2D("L1EGammaPhivsElectronPhi_EB",
504  "#phi_{electron}^{L1} vs #phi_{electron}^{offline} (EB); #phi_{electron}^{offline}; #phi_{electron}^{L1}", 100,
505  -4, 4, 100, -4, 4);
506  h_L1EGammaPhivsElectronPhi_EE_ = ibooker.book2D("L1EGammaPhivsElectronPhi_EE",
507  "#phi_{electron}^{L1} vs #phi_{electron}^{offline} (EE); #phi_{electron}^{offline}; #phi_{electron}^{L1}", 100,
508  -4, 4, 100, -4, 4);
509  h_L1EGammaPhivsElectronPhi_EB_EE_ = ibooker.book2D("L1EGammaPhivsElectronPhi_EB_EE",
510  "#phi_{electron}^{L1} vs #phi_{electron}^{offline} (EB+EE); #phi_{electron}^{offline}; #phi_{electron}^{L1}", 100,
511  -4, 4, 100, -4, 4);
512 
513  h_L1EGammaEtavsElectronEta_ = ibooker.book2D("L1EGammaEtavsElectronEta",
514  "L1 EGamma #eta vs GSF Electron #eta; GSF Electron #eta; L1 EGamma #eta", 100, -3, 3, 100, -3, 3);
515 
516  // electron resolutions
517  h_resolutionElectronET_EB_ = ibooker.book1D("resolutionElectronET_EB",
518  "electron ET resolution (EB); (L1 EGamma E_{T} - GSF Electron E_{T})/GSF Electron E_{T}; events", 50, -1, 1.5);
519  h_resolutionElectronET_EE_ = ibooker.book1D("resolutionElectronET_EE",
520  "electron ET resolution (EE); (L1 EGamma E_{T} - GSF Electron E_{T})/GSF Electron E_{T}; events", 50, -1, 1.5);
521  h_resolutionElectronET_EB_EE_ = ibooker.book1D("resolutionElectronET_EB_EE",
522  "electron ET resolution (EB+EE); (L1 EGamma E_{T} - GSF Electron E_{T})/GSF Electron E_{T}; events", 50, -1, 1.5);
523 
525  ibooker.book1D("resolutionElectronPhi_EB",
526  "#phi_{electron} resolution (EB); (#phi_{electron}^{L1} - #phi_{electron}^{offline})/#phi_{electron}^{offline}; events",
527  120, -0.3, 0.3);
529  ibooker.book1D("resolutionElectronPhi_EE",
530  "electron #phi resolution (EE); (#phi_{electron}^{L1} - #phi_{electron}^{offline})/#phi_{electron}^{offline}; events",
531  120, -0.3, 0.3);
533  ibooker.book1D("resolutionElectronPhi_EB_EE",
534  "electron #phi resolution (EB+EE); (#phi_{electron}^{L1} - #phi_{electron}^{offline})/#phi_{electron}^{offline}; events",
535  120, -0.3, 0.3);
536 
537  h_resolutionElectronEta_ = ibooker.book1D("resolutionElectronEta",
538  "electron #eta resolution (EB); (L1 EGamma #eta - GSF Electron #eta)/GSF Electron #eta; events", 120, -0.3, 0.3);
539 
540  // electron turn-ons
541  ibooker.setCurrentFolder(efficiencyFolder_.c_str());
542  std::vector<float> electronBins(electronEfficiencyBins_.begin(), electronEfficiencyBins_.end());
543  int nBins = electronBins.size() - 1;
544  float* electronBinArray = &(electronBins[0]);
545 
547  std::string str_threshold = std::to_string(int(threshold));
549  "efficiencyElectronET_EB_threshold_" + str_threshold + "_Num",
550  "electron efficiency (EB); GSF Electron E_{T} (GeV); events", nBins, electronBinArray);
552  "efficiencyElectronET_EE_threshold_" + str_threshold + "_Num",
553  "electron efficiency (EE); GSF Electron E_{T} (GeV); events", nBins, electronBinArray);
555  "efficiencyElectronET_EB_EE_threshold_" + str_threshold + "_Num",
556  "electron efficiency (EB+EE); GSF Electron E_{T} (GeV); events", nBins, electronBinArray);
557 
559  "efficiencyElectronET_EB_threshold_" + str_threshold + "_Den",
560  "electron efficiency (EB); GSF Electron E_{T} (GeV); events", nBins, electronBinArray);
562  "efficiencyElectronET_EE_threshold_" + str_threshold + "_Den",
563  "electron efficiency (EE); GSF Electron E_{T} (GeV); events", nBins, electronBinArray);
565  "efficiencyElectronET_EB_EE_threshold_" + str_threshold + "_Den",
566  "electron efficiency (EB+EE); GSF Electron E_{T} (GeV); events", nBins, electronBinArray);
567  }
568 
569  ibooker.cd();
570 }
571 
573 {
574  ibooker.cd();
575  ibooker.setCurrentFolder(histFolder_.c_str());
576  h_L1EGammaETvsPhotonET_EB_ = ibooker.book2D("L1EGammaETvsPhotonET_EB",
577  "L1 EGamma E_{T} vs Photon E_{T} (EB); Photon E_{T} (GeV); L1 EGamma E_{T} (GeV)", 300, 0, 300, 300, 0, 300);
578  h_L1EGammaETvsPhotonET_EE_ = ibooker.book2D("L1EGammaETvsPhotonET_EE",
579  "L1 EGamma E_{T} vs Photon E_{T} (EE); Photon E_{T} (GeV); L1 EGamma E_{T} (GeV)", 300, 0, 300, 300, 0, 300);
580  h_L1EGammaETvsPhotonET_EB_EE_ = ibooker.book2D("L1EGammaETvsPhotonET_EB_EE",
581  "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);
582 
583  h_L1EGammaPhivsPhotonPhi_EB_ = ibooker.book2D("L1EGammaPhivsPhotonPhi_EB",
584  "#phi_{photon}^{L1} vs #phi_{photon}^{offline} (EB); #phi_{photon}^{offline}; #phi_{photon}^{L1}", 100, -4, 4,
585  100, -4, 4);
586  h_L1EGammaPhivsPhotonPhi_EE_ = ibooker.book2D("L1EGammaPhivsPhotonPhi_EE",
587  "#phi_{photon}^{L1} vs #phi_{photon}^{offline} (EE); #phi_{photon}^{offline}; #phi_{photon}^{L1}", 100, -4, 4,
588  100, -4, 4);
589  h_L1EGammaPhivsPhotonPhi_EB_EE_ = ibooker.book2D("L1EGammaPhivsPhotonPhi_EB_EE",
590  "#phi_{photon}^{L1} vs #phi_{photon}^{offline} (EB+EE); #phi_{photon}^{offline}; #phi_{photon}^{L1}", 100, -4, 4,
591  100, -4, 4);
592 
593  h_L1EGammaEtavsPhotonEta_ = ibooker.book2D("L1EGammaEtavsPhotonEta",
594  "L1 EGamma #eta vs Photon #eta; Photon #eta; L1 EGamma #eta", 100, -3, 3, 100, -3, 3);
595 
596  // photon resolutions
597  h_resolutionPhotonET_EB_ = ibooker.book1D("resolutionPhotonET_EB",
598  "photon ET resolution (EB); (L1 EGamma E_{T} - Photon E_{T})/ Photon E_{T}; events", 50, -1, 1.5);
599  h_resolutionPhotonET_EE_ = ibooker.book1D("resolutionPhotonET_EE",
600  "photon ET resolution (EE); (L1 EGamma E_{T} - Photon E_{T})/ Photon E_{T}; events", 50, -1, 1.5);
601  h_resolutionPhotonET_EB_EE_ = ibooker.book1D("resolutionPhotonET_EB_EE",
602  "photon ET resolution (EB+EE); (L1 EGamma E_{T} - Photon E_{T})/ Photon E_{T}; events", 50, -1, 1.5);
603 
604  h_resolutionPhotonPhi_EB_ = ibooker.book1D("resolutionPhotonPhi_EB",
605  "#phi_{photon} resolution (EB); (#phi_{photon}^{L1} - #phi_{photon}^{offline})/#phi_{photon}^{offline}; events",
606  120, -0.3, 0.3);
607  h_resolutionPhotonPhi_EE_ = ibooker.book1D("resolutionPhotonPhi_EE",
608  "photon #phi resolution (EE); (#phi_{photon}^{L1} - #phi_{photon}^{offline})/#phi_{photon}^{offline}; events",
609  120, -0.3, 0.3);
610  h_resolutionPhotonPhi_EB_EE_ = ibooker.book1D("resolutionPhotonPhi_EB_EE",
611  "photon #phi resolution (EB+EE); (#phi_{photon}^{L1} - #phi_{photon}^{offline})/#phi_{photon}^{offline}; events",
612  120, -0.3, 0.3);
613 
614  h_resolutionPhotonEta_ = ibooker.book1D("resolutionPhotonEta",
615  "photon #eta resolution (EB); (L1 EGamma #eta - Photon #eta)/ Photon #eta; events", 120, -0.3, 0.3);
616 
617  // photon turn-ons
618  ibooker.setCurrentFolder(efficiencyFolder_.c_str());
619  std::vector<float> photonBins(photonEfficiencyBins_.begin(), photonEfficiencyBins_.end());
620  int nBins = photonBins.size() - 1;
621  float* photonBinArray = &(photonBins[0]);
622 
624  std::string str_threshold = std::to_string(int(threshold));
626  "efficiencyPhotonET_EB_threshold_" + str_threshold + "_Num",
627  "photon efficiency (EB); Photon E_{T} (GeV); events", nBins, photonBinArray);
629  "efficiencyPhotonET_EE_threshold_" + str_threshold + "_Num",
630  "photon efficiency (EE); Photon E_{T} (GeV); events", nBins, photonBinArray);
632  "efficiencyPhotonET_EB_EE_threshold_" + str_threshold + "_Num",
633  "photon efficiency (EB+EE); Photon E_{T} (GeV); events", nBins, photonBinArray);
634 
636  "efficiencyPhotonET_EB_threshold_" + str_threshold + "_Den",
637  "photon efficiency (EB); Photon E_{T} (GeV); events", nBins, photonBinArray);
639  "efficiencyPhotonET_EE_threshold_" + str_threshold + "_Den",
640  "photon efficiency (EE); Photon E_{T} (GeV); events", nBins, photonBinArray);
642  "efficiencyPhotonET_EB_EE_threshold_" + str_threshold + "_Den",
643  "photon efficiency (EB+EE); Photon E_{T} (GeV); events", nBins, photonBinArray);
644  }
645 
646  ibooker.cd();
647 }
648 
649 //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 &)
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
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:457
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_efficiencyPhotonET_EB_EE_total_
MonitorElement * h_resolutionPhotonET_EE_
void analyze(edm::Event const &e, edm::EventSetup const &eSetup)
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(const edm::ParameterSet &ps)
MonitorElement * h_L1EGammaETvsElectronET_EB_
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
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_
virtual ~L1TEGammaOffline()
void endRun(edm::Run const &run, edm::EventSetup const &eSetup)
void endLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup)
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:252
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
reco::GsfElectron tagElectron_
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_
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.)
MonitorElement * h_resolutionElectronET_EB_EE_
float ecalEnergy() const
Definition: GsfElectron.h:837
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
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup)