25 #include "CLHEP/Units/GlobalPhysicalConstants.h"
34 : outputFileName_(iConfig.getParameter<std::
string>(
"outputFileName")),
35 photonToken_(consumes<edm::
View<pat::
Photon> >(
36 iConfig.getUntrackedParameter<edm::
InputTag>(
"PhotonTag", edm::
InputTag(
"slimmedPhotons")))),
38 iConfig.getUntrackedParameter<edm::
InputTag>(
"genpartTag", edm::
InputTag(
"prunedGenParticles"))))
73 h_scEta_[0] = iBooker.
book1D(
"scEta_miniAOD",
" SC Eta ", etaBin, etaMin, etaMax);
74 h_scPhi_[0] = iBooker.
book1D(
"scPhi_miniAOD",
" SC Phi ", phiBin, phiMin, phiMax);
79 h_phoE_[0][0] = iBooker.
book1D(histname +
"All_miniAOD",
" Photon Energy: All ecal ", eBin, eMin, eMax);
80 h_phoE_[0][1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
" Photon Energy: barrel ", eBin, eMin, eMax);
81 h_phoE_[0][2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
" Photon Energy: Endcap ", eBin, eMin, eMax);
85 iBooker.
book1D(histname +
"All_miniAOD",
" Photon Transverse Energy: All ecal ", etBin, etMin, etMax);
87 iBooker.
book1D(histname +
"Barrel_miniAOD",
" Photon Transverse Energy: Barrel ", etBin, etMin, etMax);
89 iBooker.
book1D(histname +
"Endcap_miniAOD",
" Photon Transverse Energy: Endcap ", etBin, etMin, etMax);
93 histname +
"All_miniAOD",
" Photon E/E_{true}: All ecal; E/E_{true} (GeV)", resBin, resMin, resMax);
95 histname +
"Barrel_miniAOD",
"Photon E/E_{true}: Barrel; E/E_{true} (GeV)", resBin, resMin, resMax);
97 histname +
"Endcap_miniAOD",
" Photon E/E_{true}: Endcap; E/E_{true} (GeV)", resBin, resMin, resMax);
99 histname =
"sigmaEoE";
101 iBooker.
book1D(histname +
"All_miniAOD",
"#sigma_{E}/E: All ecal; #sigma_{E}/E", 100, 0., 0.08);
103 iBooker.
book1D(histname +
"Barrel_miniAOD",
"#sigma_{E}/E: Barrel; #sigma_{E}/E", 100, 0., 0.08);
105 iBooker.
book1D(histname +
"Endcap_miniAOD",
"#sigma_{E}/E: Endcap, #sigma_{E}/E", 100, 0., 0.08);
108 h_r9_[0][0] = iBooker.
book1D(histname +
"All_miniAOD",
" r9: All Ecal", r9Bin, r9Min, r9Max);
109 h_r9_[0][1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
" r9: Barrel ", r9Bin, r9Min, r9Max);
110 h_r9_[0][2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
" r9: Endcap ", r9Bin, r9Min, r9Max);
111 histname =
"full5x5_r9";
112 h_full5x5_r9_[0][0] = iBooker.
book1D(histname +
"All_miniAOD",
" r9: All Ecal", r9Bin, r9Min, r9Max);
113 h_full5x5_r9_[0][1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
" r9: Barrel ", r9Bin, r9Min, r9Max);
114 h_full5x5_r9_[0][2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
" r9: Endcap ", r9Bin, r9Min, r9Max);
116 h_r1_[0][0] = iBooker.
book1D(histname +
"All_miniAOD",
" e1x5/e5x5: All Ecal", r9Bin, r9Min, r9Max);
117 h_r1_[0][1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
" e1x5/e5x5: Barrel ", r9Bin, r9Min, r9Max);
118 h_r1_[0][2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
" e1x5/e5x5: Endcap ", r9Bin, r9Min, r9Max);
120 h_r2_[0][0] = iBooker.
book1D(histname +
"All_miniAOD",
" e2x5/e5x5: All Ecal", r9Bin, r9Min, r9Max);
121 h_r2_[0][1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
" e2x5/e5x5: Barrel ", r9Bin, r9Min, r9Max);
122 h_r2_[0][2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
" e2x5/e5x5: Endcap ", r9Bin, r9Min, r9Max);
124 h_hOverE_[0][0] = iBooker.
book1D(histname +
"All_miniAOD",
"H/E: All Ecal", 100, 0., 0.2);
125 h_hOverE_[0][1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
"H/E: Barrel ", 100, 0., 0.2);
126 h_hOverE_[0][2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
"H/E: Endcap ", 100, 0., 0.2);
128 histname =
"newhOverE";
129 h_newhOverE_[0][0] = iBooker.
book1D(histname +
"All_miniAOD",
"new H/E: All Ecal", 100, 0., 0.2);
130 h_newhOverE_[0][1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
"new H/E: Barrel ", 100, 0., 0.2);
131 h_newhOverE_[0][2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
"new H/E: Endcap ", 100, 0., 0.2);
133 histname =
"sigmaIetaIeta";
134 h_sigmaIetaIeta_[0][0] = iBooker.
book1D(histname +
"All_miniAOD",
"sigmaIetaIeta: All Ecal", 100, 0., 0.1);
135 h_sigmaIetaIeta_[0][1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
"sigmaIetaIeta: Barrel ", 100, 0., 0.05);
136 h_sigmaIetaIeta_[0][2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
"sigmaIetaIeta: Endcap ", 100, 0., 0.1);
137 histname =
"full5x5_sigmaIetaIeta";
139 iBooker.
book1D(histname +
"All_miniAOD",
"Full5x5 sigmaIetaIeta: All Ecal", 100, 0., 0.1);
141 iBooker.
book1D(histname +
"Barrel_miniAOD",
"Full5x5 sigmaIetaIeta: Barrel ", 100, 0., 0.05);
143 iBooker.
book1D(histname +
"Endcap_miniAOD",
"Full5x5 sigmaIetaIeta: Endcap ", 100, 0., 0.1);
145 histname =
"ecalRecHitSumEtConeDR04";
147 iBooker.
book1D(histname +
"All_miniAOD",
"ecalRecHitSumEtDR04: All Ecal", etBin, etMin, 20.);
149 iBooker.
book1D(histname +
"Barrel_miniAOD",
"ecalRecHitSumEtDR04: Barrel ", etBin, etMin, 20.);
151 iBooker.
book1D(histname +
"Endcap_miniAOD",
"ecalRecHitSumEtDR04: Endcap ", etBin, etMin, 20.);
152 histname =
"hcalTowerSumEtConeDR04";
154 iBooker.
book1D(histname +
"All_miniAOD",
"hcalTowerSumEtConeDR04: All Ecal", etBin, etMin, 20.);
156 iBooker.
book1D(histname +
"Barrel_miniAOD",
"hcalTowerSumEtConeDR04: Barrel ", etBin, etMin, 20.);
158 iBooker.
book1D(histname +
"Endcap_miniAOD",
"hcalTowerSumEtConeDR04: Endcap ", etBin, etMin, 20.);
160 histname =
"hcalTowerBcSumEtConeDR04";
162 iBooker.
book1D(histname +
"All_miniAOD",
"hcalTowerBcSumEtConeDR04: All Ecal", etBin, etMin, 20.);
164 iBooker.
book1D(histname +
"Barrel_miniAOD",
"hcalTowerBcSumEtConeDR04: Barrel ", etBin, etMin, 20.);
166 iBooker.
book1D(histname +
"Endcap_miniAOD",
"hcalTowerBcSumEtConeDR04: Endcap ", etBin, etMin, 20.);
167 histname =
"isoTrkSolidConeDR04";
169 iBooker.
book1D(histname +
"All_miniAOD",
"isoTrkSolidConeDR04: All Ecal", etBin, etMin, etMax * 0.1);
171 iBooker.
book1D(histname +
"Barrel_miniAOD",
"isoTrkSolidConeDR04: Barrel ", etBin, etMin, etMax * 0.1);
173 iBooker.
book1D(histname +
"Endcap_miniAOD",
"isoTrkSolidConeDR04: Endcap ", etBin, etMin, etMax * 0.1);
174 histname =
"nTrkSolidConeDR04";
180 histname =
"chargedHadIso";
181 h_chHadIso_[0] = iBooker.
book1D(histname +
"All_miniAOD",
"PF chargedHadIso: All Ecal", etBin, etMin, 20.);
182 h_chHadIso_[1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
"PF chargedHadIso: Barrel", etBin, etMin, 20.);
183 h_chHadIso_[2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
"PF chargedHadIso: Endcap", etBin, etMin, 20.);
184 histname =
"neutralHadIso";
185 h_nHadIso_[0] = iBooker.
book1D(histname +
"All_miniAOD",
"PF neutralHadIso: All Ecal", etBin, etMin, 20.);
186 h_nHadIso_[1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
"PF neutralHadIso: Barrel", etBin, etMin, 20.);
187 h_nHadIso_[2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
"PF neutralHadIso: Endcap", etBin, etMin, 20.);
188 histname =
"photonIso";
189 h_phoIso_[0] = iBooker.
book1D(histname +
"All_miniAOD",
"PF photonIso: All Ecal", etBin, etMin, 20.);
190 h_phoIso_[1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
"PF photonIso: Barrel", etBin, etMin, 20.);
191 h_phoIso_[2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
"PF photonIso: Endcap", etBin, etMin, 20.);
201 const auto &
photons = *photonsHandle;
208 if (!(mcIter->pdgId() == 22))
210 if (mcIter->mother() !=
nullptr && !(mcIter->mother()->pdgId() == 25))
212 if (fabs(mcIter->eta()) > 2.5)
217 float mcPhi = mcIter->phi();
218 float mcEta = mcIter->eta();
220 float mcEnergy = mcIter->energy();
222 double dR = 9999999.;
223 float minDr = 10000.;
225 bool matched =
false;
226 for (
size_t ipho = 0; ipho <
photons.size(); ipho++) {
229 double dphi = pho->phi() - mcPhi;
231 dphi = dphi < 0 ? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi;
233 double deta = pho->superCluster()->position().eta() - mcEta;
236 if (dR < 0.1 && dR < minDr) {
249 bool phoIsInBarrel =
false;
250 bool phoIsInEndcap =
false;
252 float phoEta = matchingPho->superCluster()->position().eta();
253 if (fabs(phoEta) < 1.479) {
254 phoIsInBarrel =
true;
256 phoIsInEndcap =
true;
259 float photonE = matchingPho->energy();
260 float sigmaEoE = matchingPho->getCorrectedEnergyError(matchingPho->getCandidateP4type()) / matchingPho->energy();
261 float photonEt = matchingPho->energy() / cosh(matchingPho->eta());
264 float r9 = matchingPho->r9();
265 float full5x5_r9 = matchingPho->full5x5_r9();
266 float r1 = matchingPho->r1x5();
267 float r2 = matchingPho->r2x5();
268 float sieie = matchingPho->sigmaIetaIeta();
269 float full5x5_sieie = matchingPho->full5x5_sigmaIetaIeta();
270 float hOverE = matchingPho->hadronicOverEm();
271 float newhOverE = matchingPho->hadTowOverEm();
272 float ecalIso = matchingPho->ecalRecHitSumEtConeDR04();
273 float hcalIso = matchingPho->hcalTowerSumEtConeDR04();
274 float newhcalIso = matchingPho->hcalTowerSumEtBcConeDR04();
275 float trkIso = matchingPho->trkSumPtSolidConeDR04();
276 float nIsoTrk = matchingPho->nTrkSolidConeDR04();
278 float chargedHadIso = matchingPho->chargedHadronIso();
279 float neutralHadIso = matchingPho->neutralHadronIso();
280 float photonIso = matchingPho->photonIso();
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
edm::EDGetTokenT< reco::GenParticleCollection > genpartToken_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
virtual void setCurrentFolder(std::string const &fullpath)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * h_full5x5_sigmaIetaIeta_[3][3]
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * h_r1_[3][3]
MonitorElement * h_full5x5_r9_[3][3]
edm::ParameterSet parameters_
MonitorElement * h_phoSigmaEoE_[3][3]
MonitorElement * h_nHadIso_[3]
MonitorElement * h_ecalRecHitSumEtConeDR04_[3][3]
MonitorElement * h_sigmaIetaIeta_[3][3]
MonitorElement * h_chHadIso_[3]
MonitorElement * h_hcalTowerBcSumEtConeDR04_[3][3]
MonitorElement * h_newhOverE_[3][3]
MonitorElement * h_isoTrkSolidConeDR04_[3][3]
MonitorElement * h_phoIso_[3]
MonitorElement * h_nTrkSolidConeDR04_[3][3]
~PhotonValidatorMiniAOD() override
MonitorElement * h_hOverE_[3][3]
MonitorElement * h_scPhi_[2]
MonitorElement * h_phoERes_[3][3]
MonitorElement * h_phoE_[2][3]
MonitorElement * h_r9_[3][3]
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< pat::Photon > > photonToken_
MonitorElement * h_phoEt_[2][3]
MonitorElement * h_hcalTowerSumEtConeDR04_[3][3]
MonitorElement * h_r2_[3][3]
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * h_scEta_[2]
PhotonValidatorMiniAOD(const edm::ParameterSet &)
int etaBin(const l1t::HGCalMulticluster *cl)
Power< A, B >::type pow(const A &a, const B &b)