25 #include "CLHEP/Units/GlobalPhysicalConstants.h"
35 outputFileName_( iConfig.getParameter<std::
string>(
"outputFileName" ) ),
36 photonToken_( consumes<edm::
View<pat::
Photon> >( iConfig.getUntrackedParameter<edm::
InputTag> (
"PhotonTag", edm::
InputTag(
"slimmedPhotons" ) ) ) ),
80 h_scEta_[0] = iBooker.
book1D(
"scEta_miniAOD",
" SC Eta ",etaBin,etaMin, etaMax);
81 h_scPhi_[0] = iBooker.
book1D(
"scPhi_miniAOD",
" SC Phi ",phiBin,phiMin,phiMax);
86 h_phoE_[0][0]=iBooker.
book1D(histname+
"All_miniAOD",
" Photon Energy: All ecal ", eBin,eMin, eMax);
87 h_phoE_[0][1]=iBooker.
book1D(histname+
"Barrel_miniAOD",
" Photon Energy: barrel ",eBin,eMin, eMax);
88 h_phoE_[0][2]=iBooker.
book1D(histname+
"Endcap_miniAOD",
" Photon Energy: Endcap ",eBin,eMin, eMax);
91 h_phoEt_[0][0] = iBooker.
book1D(histname+
"All_miniAOD",
" Photon Transverse Energy: All ecal ", etBin,etMin, etMax);
92 h_phoEt_[0][1] = iBooker.
book1D(histname+
"Barrel_miniAOD",
" Photon Transverse Energy: Barrel ",etBin,etMin, etMax);
93 h_phoEt_[0][2] = iBooker.
book1D(histname+
"Endcap_miniAOD",
" Photon Transverse Energy: Endcap ",etBin,etMin, etMax);
97 h_phoERes_[0][0] = iBooker.
book1D(histname+
"All_miniAOD",
" Photon E/E_{true}: All ecal; E/E_{true} (GeV)", resBin,resMin, resMax);
98 h_phoERes_[0][1] = iBooker.
book1D(histname+
"Barrel_miniAOD",
"Photon E/E_{true}: Barrel; E/E_{true} (GeV)",resBin,resMin, resMax);
99 h_phoERes_[0][2] = iBooker.
book1D(histname+
"Endcap_miniAOD",
" Photon E/E_{true}: Endcap; E/E_{true} (GeV)",resBin,resMin, resMax);
101 histname =
"sigmaEoE";
102 h_phoSigmaEoE_[0][0] = iBooker.
book1D(histname+
"All_miniAOD",
"#sigma_{E}/E: All ecal; #sigma_{E}/E", 100,0., 0.08);
103 h_phoSigmaEoE_[0][1] = iBooker.
book1D(histname+
"Barrel_miniAOD",
"#sigma_{E}/E: Barrel; #sigma_{E}/E",100,0., 0.08);
104 h_phoSigmaEoE_[0][2] = 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";
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";
142 histname =
"ecalRecHitSumEtConeDR04";
146 histname =
"hcalTowerSumEtConeDR04";
151 histname =
"hcalTowerBcSumEtConeDR04";
155 histname =
"isoTrkSolidConeDR04";
159 histname =
"nTrkSolidConeDR04";
166 histname =
"chargedHadIso";
167 h_chHadIso_[0]= iBooker.
book1D(histname+
"All_miniAOD",
"PF chargedHadIso: All Ecal",etBin,etMin,20.);
168 h_chHadIso_[1]= iBooker.
book1D(histname+
"Barrel_miniAOD",
"PF chargedHadIso: Barrel",etBin,etMin,20.);
169 h_chHadIso_[2]= iBooker.
book1D(histname+
"Endcap_miniAOD",
"PF chargedHadIso: Endcap",etBin,etMin,20.);
170 histname =
"neutralHadIso";
171 h_nHadIso_[0]= iBooker.
book1D(histname+
"All_miniAOD",
"PF neutralHadIso: All Ecal",etBin,etMin,20.);
172 h_nHadIso_[1]= iBooker.
book1D(histname+
"Barrel_miniAOD",
"PF neutralHadIso: Barrel",etBin,etMin,20.);
173 h_nHadIso_[2]= iBooker.
book1D(histname+
"Endcap_miniAOD",
"PF neutralHadIso: Endcap",etBin,etMin,20.);
174 histname =
"photonIso";
175 h_phoIso_[0]= iBooker.
book1D(histname+
"All_miniAOD",
"PF photonIso: All Ecal",etBin,etMin,20.);
176 h_phoIso_[1]= iBooker.
book1D(histname+
"Barrel_miniAOD",
"PF photonIso: Barrel",etBin,etMin,20.);
177 h_phoIso_[2]= iBooker.
book1D(histname+
"Endcap_miniAOD",
"PF photonIso: Endcap",etBin,etMin,20.);
196 const auto &
photons = *photonsHandle;
203 for ( reco::GenParticleCollection::const_iterator mcIter=
genParticles->begin() ; mcIter!=
genParticles->end() ; mcIter++ ) {
204 if ( !(mcIter->pdgId() == 22 ) )
continue;
205 if ( mcIter->mother() !=
nullptr && !(mcIter->mother()->pdgId()==25) )
continue;
206 if ( fabs(mcIter->eta()) > 2.5 )
continue;
211 float mcPhi= mcIter->phi();
212 float mcEta= mcIter->eta();
214 float mcEnergy=mcIter->energy();
219 double dR = 9999999.;
223 for(
size_t ipho = 0; ipho <
photons.size(); ipho++ ) {
227 double dphi = pho->phi()-mcPhi;
229 { dphi = dphi < 0? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi ; }
230 double deta = pho->superCluster()->position().eta()-mcEta;
233 if ( dR<0.1 && dR< minDr ) {
240 if ( iMatch >-1) matched=
true;
241 if ( ! matched)
continue;
245 bool phoIsInBarrel=
false;
246 bool phoIsInEndcap=
false;
248 float phoEta = matchingPho->superCluster()->position().eta();
249 if ( fabs(phoEta) < 1.479) {
257 float photonE = matchingPho->energy();
258 float sigmaEoE = matchingPho->getCorrectedEnergyError(matchingPho->getCandidateP4type())/matchingPho->energy();
259 float photonEt= matchingPho->energy()/cosh( matchingPho->eta()) ;
262 float r9 = matchingPho->r9();
263 float full5x5_r9 = matchingPho->full5x5_r9();
264 float r1 = matchingPho->r1x5();
265 float r2 = matchingPho->r2x5();
266 float sieie = matchingPho->sigmaIetaIeta();
267 float full5x5_sieie = matchingPho->full5x5_sigmaIetaIeta();
268 float hOverE = matchingPho->hadronicOverEm();
269 float newhOverE = matchingPho->hadTowOverEm();
270 float ecalIso = matchingPho->ecalRecHitSumEtConeDR04();
271 float hcalIso = matchingPho->hcalTowerSumEtConeDR04();
272 float newhcalIso = matchingPho->hcalTowerSumEtBcConeDR04();
273 float trkIso = matchingPho->trkSumPtSolidConeDR04();
274 float nIsoTrk = matchingPho->nTrkSolidConeDR04();
276 float chargedHadIso = matchingPho->chargedHadronIso();
277 float neutralHadIso = matchingPho->neutralHadronIso();
278 float photonIso = matchingPho->photonIso();
284 h_scEta_[0]->
Fill( matchingPho->superCluster()->eta() );
285 h_scPhi_[0]->
Fill( matchingPho->superCluster()->phi() );
316 if ( phoIsInBarrel ) {
340 if ( phoIsInEndcap ) {
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::GenParticleCollection > genpartToken_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * h_full5x5_sigmaIetaIeta_[3][3]
virtual 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]
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * h_isoTrkSolidConeDR04_[3][3]
MonitorElement * h_phoIso_[3]
MonitorElement * book1D(Args &&...args)
MonitorElement * h_nTrkSolidConeDR04_[3][3]
MonitorElement * h_hOverE_[3][3]
MonitorElement * h_scPhi_[2]
MonitorElement * h_phoERes_[3][3]
MonitorElement * h_phoE_[2][3]
MonitorElement * h_r9_[3][3]
void setCurrentFolder(const std::string &fullpath)
virtual void dqmBeginRun(edm::Run const &r, edm::EventSetup const &theEventSetup) override
edm::EDGetTokenT< edm::View< pat::Photon > > photonToken_
virtual void endRun(edm::Run const &r, edm::EventSetup const &es) override
MonitorElement * h_phoEt_[2][3]
MonitorElement * h_hcalTowerSumEtConeDR04_[3][3]
MonitorElement * h_r2_[3][3]
MonitorElement * h_scEta_[2]
PhotonValidatorMiniAOD(const edm::ParameterSet &)
Power< A, B >::type pow(const A &a, const B &b)
virtual ~PhotonValidatorMiniAOD()