24 #include "CLHEP/Units/GlobalPhysicalConstants.h"
33 : outputFileName_(iConfig.getParameter<std::
string>(
"outputFileName")),
34 photonToken_(consumes<edm::
View<pat::
Photon> >(
35 iConfig.getUntrackedParameter<edm::
InputTag>(
"PhotonTag", edm::
InputTag(
"slimmedPhotons")))),
37 iConfig.getUntrackedParameter<edm::
InputTag>(
"genpartTag", edm::
InputTag(
"prunedGenParticles"))))
72 h_scEta_[0] = iBooker.
book1D(
"scEta_miniAOD",
" SC Eta ", etaBin, etaMin, etaMax);
73 h_scPhi_[0] = iBooker.
book1D(
"scPhi_miniAOD",
" SC Phi ", phiBin, phiMin, phiMax);
78 h_phoE_[0][0] = iBooker.
book1D(histname +
"All_miniAOD",
" Photon Energy: All ecal ", eBin, eMin, eMax);
79 h_phoE_[0][1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
" Photon Energy: barrel ", eBin, eMin, eMax);
80 h_phoE_[0][2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
" Photon Energy: Endcap ", eBin, eMin, eMax);
84 iBooker.
book1D(histname +
"All_miniAOD",
" Photon Transverse Energy: All ecal ", etBin, etMin, etMax);
86 iBooker.
book1D(histname +
"Barrel_miniAOD",
" Photon Transverse Energy: Barrel ", etBin, etMin, etMax);
88 iBooker.
book1D(histname +
"Endcap_miniAOD",
" Photon Transverse Energy: Endcap ", etBin, etMin, etMax);
92 histname +
"All_miniAOD",
" Photon E/E_{true}: All ecal; E/E_{true} (GeV)", resBin, resMin, resMax);
94 histname +
"Barrel_miniAOD",
"Photon E/E_{true}: Barrel; E/E_{true} (GeV)", resBin, resMin, resMax);
96 histname +
"Endcap_miniAOD",
" Photon E/E_{true}: Endcap; E/E_{true} (GeV)", resBin, resMin, resMax);
98 histname =
"sigmaEoE";
100 iBooker.
book1D(histname +
"All_miniAOD",
"#sigma_{E}/E: All ecal; #sigma_{E}/E", 100, 0., 0.08);
102 iBooker.
book1D(histname +
"Barrel_miniAOD",
"#sigma_{E}/E: Barrel; #sigma_{E}/E", 100, 0., 0.08);
104 iBooker.
book1D(histname +
"Endcap_miniAOD",
"#sigma_{E}/E: Endcap, #sigma_{E}/E", 100, 0., 0.08);
107 h_r9_[0][0] = iBooker.
book1D(histname +
"All_miniAOD",
" r9: All Ecal", r9Bin, r9Min, r9Max);
108 h_r9_[0][1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
" r9: Barrel ", r9Bin, r9Min, r9Max);
109 h_r9_[0][2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
" r9: Endcap ", r9Bin, r9Min, r9Max);
110 histname =
"full5x5_r9";
111 h_full5x5_r9_[0][0] = iBooker.
book1D(histname +
"All_miniAOD",
" r9: All Ecal", r9Bin, r9Min, r9Max);
112 h_full5x5_r9_[0][1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
" r9: Barrel ", r9Bin, r9Min, r9Max);
113 h_full5x5_r9_[0][2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
" r9: Endcap ", r9Bin, r9Min, r9Max);
115 h_r1_[0][0] = iBooker.
book1D(histname +
"All_miniAOD",
" e1x5/e5x5: All Ecal", r9Bin, r9Min, r9Max);
116 h_r1_[0][1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
" e1x5/e5x5: Barrel ", r9Bin, r9Min, r9Max);
117 h_r1_[0][2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
" e1x5/e5x5: Endcap ", r9Bin, r9Min, r9Max);
119 h_r2_[0][0] = iBooker.
book1D(histname +
"All_miniAOD",
" e2x5/e5x5: All Ecal", r9Bin, r9Min, r9Max);
120 h_r2_[0][1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
" e2x5/e5x5: Barrel ", r9Bin, r9Min, r9Max);
121 h_r2_[0][2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
" e2x5/e5x5: Endcap ", r9Bin, r9Min, r9Max);
123 h_hOverE_[0][0] = iBooker.
book1D(histname +
"All_miniAOD",
"H/E: All Ecal", 100, 0., 0.2);
124 h_hOverE_[0][1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
"H/E: Barrel ", 100, 0., 0.2);
125 h_hOverE_[0][2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
"H/E: Endcap ", 100, 0., 0.2);
127 histname =
"newhOverE";
128 h_newhOverE_[0][0] = iBooker.
book1D(histname +
"All_miniAOD",
"new H/E: All Ecal", 100, 0., 0.2);
129 h_newhOverE_[0][1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
"new H/E: Barrel ", 100, 0., 0.2);
130 h_newhOverE_[0][2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
"new H/E: Endcap ", 100, 0., 0.2);
132 histname =
"sigmaIetaIeta";
133 h_sigmaIetaIeta_[0][0] = iBooker.
book1D(histname +
"All_miniAOD",
"sigmaIetaIeta: All Ecal", 100, 0., 0.1);
134 h_sigmaIetaIeta_[0][1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
"sigmaIetaIeta: Barrel ", 100, 0., 0.05);
135 h_sigmaIetaIeta_[0][2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
"sigmaIetaIeta: Endcap ", 100, 0., 0.1);
136 histname =
"full5x5_sigmaIetaIeta";
138 iBooker.
book1D(histname +
"All_miniAOD",
"Full5x5 sigmaIetaIeta: All Ecal", 100, 0., 0.1);
140 iBooker.
book1D(histname +
"Barrel_miniAOD",
"Full5x5 sigmaIetaIeta: Barrel ", 100, 0., 0.05);
142 iBooker.
book1D(histname +
"Endcap_miniAOD",
"Full5x5 sigmaIetaIeta: Endcap ", 100, 0., 0.1);
144 histname =
"ecalRecHitSumEtConeDR04";
146 iBooker.
book1D(histname +
"All_miniAOD",
"ecalRecHitSumEtDR04: All Ecal", etBin, etMin, 20.);
148 iBooker.
book1D(histname +
"Barrel_miniAOD",
"ecalRecHitSumEtDR04: Barrel ", etBin, etMin, 20.);
150 iBooker.
book1D(histname +
"Endcap_miniAOD",
"ecalRecHitSumEtDR04: Endcap ", etBin, etMin, 20.);
151 histname =
"hcalTowerSumEtConeDR04";
153 iBooker.
book1D(histname +
"All_miniAOD",
"hcalTowerSumEtConeDR04: All Ecal", etBin, etMin, 20.);
155 iBooker.
book1D(histname +
"Barrel_miniAOD",
"hcalTowerSumEtConeDR04: Barrel ", etBin, etMin, 20.);
157 iBooker.
book1D(histname +
"Endcap_miniAOD",
"hcalTowerSumEtConeDR04: Endcap ", etBin, etMin, 20.);
159 histname =
"hcalTowerBcSumEtConeDR04";
161 iBooker.
book1D(histname +
"All_miniAOD",
"hcalTowerBcSumEtConeDR04: All Ecal", etBin, etMin, 20.);
163 iBooker.
book1D(histname +
"Barrel_miniAOD",
"hcalTowerBcSumEtConeDR04: Barrel ", etBin, etMin, 20.);
165 iBooker.
book1D(histname +
"Endcap_miniAOD",
"hcalTowerBcSumEtConeDR04: Endcap ", etBin, etMin, 20.);
166 histname =
"isoTrkSolidConeDR04";
168 iBooker.
book1D(histname +
"All_miniAOD",
"isoTrkSolidConeDR04: All Ecal", etBin, etMin, etMax * 0.1);
170 iBooker.
book1D(histname +
"Barrel_miniAOD",
"isoTrkSolidConeDR04: Barrel ", etBin, etMin, etMax * 0.1);
172 iBooker.
book1D(histname +
"Endcap_miniAOD",
"isoTrkSolidConeDR04: Endcap ", etBin, etMin, etMax * 0.1);
173 histname =
"nTrkSolidConeDR04";
179 histname =
"chargedHadIso";
180 h_chHadIso_[0] = iBooker.
book1D(histname +
"All_miniAOD",
"PF chargedHadIso: All Ecal", etBin, etMin, 20.);
181 h_chHadIso_[1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
"PF chargedHadIso: Barrel", etBin, etMin, 20.);
182 h_chHadIso_[2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
"PF chargedHadIso: Endcap", etBin, etMin, 20.);
183 histname =
"neutralHadIso";
184 h_nHadIso_[0] = iBooker.
book1D(histname +
"All_miniAOD",
"PF neutralHadIso: All Ecal", etBin, etMin, 20.);
185 h_nHadIso_[1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
"PF neutralHadIso: Barrel", etBin, etMin, 20.);
186 h_nHadIso_[2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
"PF neutralHadIso: Endcap", etBin, etMin, 20.);
187 histname =
"photonIso";
188 h_phoIso_[0] = iBooker.
book1D(histname +
"All_miniAOD",
"PF photonIso: All Ecal", etBin, etMin, 20.);
189 h_phoIso_[1] = iBooker.
book1D(histname +
"Barrel_miniAOD",
"PF photonIso: Barrel", etBin, etMin, 20.);
190 h_phoIso_[2] = iBooker.
book1D(histname +
"Endcap_miniAOD",
"PF photonIso: Endcap", etBin, etMin, 20.);
200 const auto &
photons = *photonsHandle;
207 if (!(mcIter->pdgId() == 22))
209 if (mcIter->mother() !=
nullptr && !(mcIter->mother()->pdgId() == 25))
211 if (fabs(mcIter->eta()) > 2.5)
216 float mcPhi = mcIter->phi();
217 float mcEta = mcIter->eta();
219 float mcEnergy = mcIter->energy();
221 double dR = 9999999.;
222 float minDr = 10000.;
224 bool matched =
false;
225 for (
size_t ipho = 0; ipho <
photons.size(); ipho++) {
228 double dphi = pho->phi() - mcPhi;
230 dphi = dphi < 0 ? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi;
232 double deta = pho->superCluster()->position().eta() - mcEta;
235 if (dR < 0.1 && dR < minDr) {
248 bool phoIsInBarrel =
false;
249 bool phoIsInEndcap =
false;
251 float phoEta = matchingPho->superCluster()->position().eta();
252 if (fabs(phoEta) < 1.479) {
253 phoIsInBarrel =
true;
255 phoIsInEndcap =
true;
258 float photonE = matchingPho->energy();
259 float sigmaEoE = matchingPho->getCorrectedEnergyError(matchingPho->getCandidateP4type()) / matchingPho->energy();
260 float photonEt = matchingPho->energy() / cosh(matchingPho->eta());
263 float r9 = matchingPho->r9();
264 float full5x5_r9 = matchingPho->full5x5_r9();
265 float r1 = matchingPho->r1x5();
266 float r2 = matchingPho->r2x5();
267 float sieie = matchingPho->sigmaIetaIeta();
268 float full5x5_sieie = matchingPho->full5x5_sigmaIetaIeta();
269 float hOverE = matchingPho->hadronicOverEm();
270 float newhOverE = matchingPho->hadTowOverEm();
271 float ecalIso = matchingPho->ecalRecHitSumEtConeDR04();
272 float hcalIso = matchingPho->hcalTowerSumEtConeDR04();
273 float newhcalIso = matchingPho->hcalTowerSumEtBcConeDR04();
274 float trkIso = matchingPho->trkSumPtSolidConeDR04();
275 float nIsoTrk = matchingPho->nTrkSolidConeDR04();
277 float chargedHadIso = matchingPho->chargedHadronIso();
278 float neutralHadIso = matchingPho->neutralHadronIso();
279 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)