167 minPhotonAbsEta_ = ps.
getParameter<
double>(
"minPhotonAbsEta");
168 maxPhotonAbsEta_ = ps.
getParameter<
double>(
"maxPhotonAbsEta");
170 maxPhotonHoverE_ = ps.
getParameter<
double>(
"maxPhotonHoverE");
174 createPhotonTTree_ = ps.
getParameter<
bool>(
"createPhotonTTree");
177 rootFile_ = TFile::Open(outputFile_.c_str(),
"RECREATE");
199 h_isoEcalRecHit_ =
new TH1F(
"photonEcalIso",
"Ecal Rec Hit Isolation", 300, 0, 300);
200 h_isoHcalRecHit_ =
new TH1F(
"photonHcalIso",
"Hcal Rec Hit Isolation", 300, 0, 300);
201 h_trk_pt_solid_ =
new TH1F(
"photonTrackSolidIso",
"Sum of track pT in a cone of #DeltaR", 300, 0, 300);
202 h_trk_pt_hollow_ =
new TH1F(
"photonTrackHollowIso",
"Sum of track pT in a hollow cone", 300, 0, 300);
203 h_ntrk_solid_ =
new TH1F(
"photonTrackCountSolid",
"Number of tracks in a cone of #DeltaR", 100, 0, 100);
204 h_ntrk_hollow_ =
new TH1F(
"photonTrackCountHollow",
"Number of tracks in a hollow cone", 100, 0, 100);
205 h_ebetagap_ =
new TH1F(
"photonInEBEtagap",
"Ecal Barrel eta gap flag", 2, -0.5, 1.5);
206 h_ebphigap_ =
new TH1F(
"photonInEBEtagap",
"Ecal Barrel phi gap flag", 2, -0.5, 1.5);
207 h_eeringGap_ =
new TH1F(
"photonInEERinggap",
"Ecal Endcap ring gap flag", 2, -0.5, 1.5);
208 h_eedeeGap_ =
new TH1F(
"photonInEEDeegap",
"Ecal Endcap dee gap flag", 2, -0.5, 1.5);
209 h_ebeeGap_ =
new TH1F(
"photonInEEgap",
"Ecal Barrel/Endcap gap flag", 2, -0.5, 1.5);
210 h_r9_ =
new TH1F(
"photonR9",
"R9 = E(3x3) / E(SuperCluster)", 300, 0, 3);
213 h_photonEt_ =
new TH1F(
"photonEt",
"Photon E_{T}", 200, 0, 200);
214 h_photonEta_ =
new TH1F(
"photonEta",
"Photon #eta", 800, -4, 4);
215 h_photonPhi_ =
new TH1F(
"photonPhi",
"Photon #phi", 628, -1. *
M_PI,
M_PI);
216 h_hadoverem_ =
new TH1F(
"photonHoverE",
"Hadronic over EM", 200, 0, 1);
219 h_photonScEt_ =
new TH1F(
"photonScEt",
"Photon SuperCluster E_{T}", 200, 0, 200);
220 h_photonScEta_ =
new TH1F(
"photonScEta",
"Photon #eta", 800, -4, 4);
221 h_photonScPhi_ =
new TH1F(
"photonScPhi",
"Photon #phi", 628, -1. *
M_PI,
M_PI);
222 h_photonScEtaWidth_ =
new TH1F(
"photonScEtaWidth",
"#eta-width", 100, 0, .1);
225 h_photonInAnyGap_ =
new TH1F(
"photonInAnyGap",
"Photon in any gap flag", 2, -0.5, 1.5);
226 h_nPassingPho_ =
new TH1F(
"photonLoosePhoton",
"Total number photons (0=NotPassing, 1=Passing)", 2, -0.5, 1.5);
227 h_nPassEM_ =
new TH1F(
"photonLooseEM",
"Total number photons (0=NotPassing, 1=Passing)", 2, -0.5, 1.5);
228 h_nPho_ =
new TH1F(
"photonCount",
"Number of photons passing cuts in event", 10, 0, 10);
231 if (createPhotonTTree_) {
232 tree_PhotonAll_ =
new TTree(
"TreePhotonAll",
"Reconstructed Photon");
233 tree_PhotonAll_->Branch(
"recPhoton",
234 &recPhoton.isolationEcalRecHit,
235 "isolationEcalRecHit/" 236 "F:isolationHcalRecHit:isolationSolidTrkCone:isolationHollowTrkCone:nTrkSolidCone:" 237 "nTrkHollowCone:isEBGap:isEEGap:isEBEEGap:r9:et:eta:phi:hadronicOverEm");
253 evt.
getByLabel(
"PhotonIDProd",
"PhotonCutBasedIDLoose", loosePhotonQual);
255 evt.
getByLabel(
"PhotonIDProd",
"PhotonCutBasedIDLooseEM", looseEMQual);
264 int photonCounter = 0;
266 reco::PhotonCollection::const_iterator pho;
267 for (pho = (*photons).begin(); pho != (*photons).end(); pho++) {
273 float photonEt = pho->et();
274 float superClusterEt = (pho->superCluster()->energy()) / (cosh(pho->superCluster()->position().eta()));
275 bool LoosePhotonQu = (*phoMap)[photonref];
276 h_nPassingPho_->Fill(LoosePhotonQu);
277 bool LooseEMQu = (*lEMMap)[photonref];
278 h_nPassEM_->Fill(LooseEMQu);
280 bool passCuts = (photonEt > minPhotonEt_) && (fabs(pho->eta()) > minPhotonAbsEta_) &&
281 (fabs(pho->eta()) < maxPhotonAbsEta_) && (pho->r9() > minPhotonR9_) &&
282 (pho->hadronicOverEm() < maxPhotonHoverE_);
289 h_isoEcalRecHit_->Fill(pho->ecalRecHitSumEtConeDR04());
290 h_isoHcalRecHit_->Fill(pho->hcalTowerSumEtConeDR04());
291 h_trk_pt_solid_->Fill(pho->trkSumPtSolidConeDR04());
292 h_trk_pt_hollow_->Fill(pho->trkSumPtHollowConeDR04());
293 h_ntrk_solid_->Fill(pho->nTrkSolidConeDR04());
294 h_ntrk_hollow_->Fill(pho->nTrkHollowConeDR04());
295 h_ebetagap_->Fill(pho->isEBEtaGap());
296 h_ebphigap_->Fill(pho->isEBPhiGap());
297 h_eeringGap_->Fill(pho->isEERingGap());
298 h_eedeeGap_->Fill(pho->isEEDeeGap());
299 h_ebeeGap_->Fill(pho->isEBEEGap());
300 h_r9_->Fill(pho->r9());
303 h_photonEt_->Fill(photonEt);
304 h_photonEta_->Fill(pho->eta());
305 h_photonPhi_->Fill(pho->phi());
306 h_hadoverem_->Fill(pho->hadronicOverEm());
311 h_photonScEt_->Fill(superClusterEt);
312 h_photonScEta_->Fill(pho->superCluster()->position().eta());
313 h_photonScPhi_->Fill(pho->superCluster()->position().phi());
314 h_photonScEtaWidth_->Fill(pho->superCluster()->etaWidth());
321 if (createPhotonTTree_) {
322 recPhoton.isolationEcalRecHit = pho->ecalRecHitSumEtConeDR04();
323 recPhoton.isolationHcalRecHit = pho->hcalTowerSumEtConeDR04();
324 recPhoton.isolationSolidTrkCone = pho->trkSumPtSolidConeDR04();
325 recPhoton.isolationHollowTrkCone = pho->trkSumPtHollowConeDR04();
326 recPhoton.nTrkSolidCone = pho->nTrkSolidConeDR04();
327 recPhoton.nTrkHollowCone = pho->nTrkHollowConeDR04();
328 recPhoton.isEBEtaGap = pho->isEBEtaGap();
329 recPhoton.isEBPhiGap = pho->isEBPhiGap();
330 recPhoton.isEERingGap = pho->isEERingGap();
331 recPhoton.isEEDeeGap = pho->isEEDeeGap();
332 recPhoton.isEBEEGap = pho->isEBEEGap();
333 recPhoton.r9 = pho->r9();
334 recPhoton.et = pho->et();
335 recPhoton.eta = pho->eta();
336 recPhoton.phi = pho->phi();
337 recPhoton.hadronicOverEm = pho->hadronicOverEm();
341 tree_PhotonAll_->Fill();
346 bool inAnyGap = pho->isEBEEGap() || (pho->isEB() && pho->isEBEtaGap()) || (pho->isEB() && pho->isEBPhiGap()) ||
347 (pho->isEE() && pho->isEERingGap()) || (pho->isEE() && pho->isEEDeeGap());
349 h_photonInAnyGap_->Fill(1.0);
351 h_photonInAnyGap_->Fill(0.0);
360 h_nPho_->Fill(photonCounter);
371 h_isoEcalRecHit_->Write();
372 h_isoHcalRecHit_->Write();
373 h_trk_pt_solid_->Write();
374 h_trk_pt_hollow_->Write();
375 h_ntrk_solid_->Write();
376 h_ntrk_hollow_->Write();
377 h_ebetagap_->Write();
378 h_ebphigap_->Write();
379 h_eeringGap_->Write();
380 h_eedeeGap_->Write();
385 h_photonEt_->Write();
386 h_photonEta_->Write();
387 h_photonPhi_->Write();
388 h_hadoverem_->Write();
391 h_photonScEt_->Write();
392 h_photonScEta_->Write();
393 h_photonScPhi_->Write();
394 h_photonScEtaWidth_->Write();
397 h_photonInAnyGap_->Write();
398 h_nPassingPho_->Write();
T getParameter(std::string const &) const
T const * product() const
~PhotonIDSimpleAnalyzer() override
PhotonIDSimpleAnalyzer(const edm::ParameterSet &)
TH1F * h_photonScEtaWidth_
#define DEFINE_FWK_MODULE(type)
void analyze(const edm::Event &, const edm::EventSetup &) override
float isolationHollowTrkCone
std::vector< Photon > PhotonCollection
collectin of Photon objects
float isolationEcalRecHit
struct_recPhoton recPhoton
float isolationSolidTrkCone
float isolationHcalRecHit
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const