70 outputFile_ = ps.
getParameter<std::string>(
"outputFile");
74 minPhotonAbsEta_ = ps.
getParameter<
double>(
"minPhotonAbsEta");
75 maxPhotonAbsEta_ = ps.
getParameter<
double>(
"maxPhotonAbsEta");
77 maxPhotonHoverE_ = ps.
getParameter<
double>(
"maxPhotonHoverE");
81 createPhotonTTree_ = ps.
getParameter<
bool>(
"createPhotonTTree");
84 rootFile_ = TFile::Open(outputFile_.c_str(),
"RECREATE");
112 h_isoEcalRecHit_ =
new TH1F(
"photonEcalIso",
"Ecal Rec Hit Isolation", 300, 0, 300);
113 h_isoHcalRecHit_ =
new TH1F(
"photonHcalIso",
"Hcal Rec Hit Isolation", 300, 0, 300);
114 h_trk_pt_solid_ =
new TH1F(
"photonTrackSolidIso",
"Sum of track pT in a cone of #DeltaR" , 300, 0, 300);
115 h_trk_pt_hollow_ =
new TH1F(
"photonTrackHollowIso",
"Sum of track pT in a hollow cone" , 300, 0, 300);
116 h_ntrk_solid_ =
new TH1F(
"photonTrackCountSolid",
"Number of tracks in a cone of #DeltaR", 100, 0, 100);
117 h_ntrk_hollow_ =
new TH1F(
"photonTrackCountHollow",
"Number of tracks in a hollow cone", 100, 0, 100);
118 h_ebetagap_ =
new TH1F(
"photonInEBEtagap",
"Ecal Barrel eta gap flag", 2, -0.5, 1.5);
119 h_ebphigap_ =
new TH1F(
"photonInEBEtagap",
"Ecal Barrel phi gap flag", 2, -0.5, 1.5);
120 h_eeringGap_ =
new TH1F(
"photonInEERinggap",
"Ecal Endcap ring gap flag", 2, -0.5, 1.5);
121 h_eedeeGap_ =
new TH1F(
"photonInEEDeegap",
"Ecal Endcap dee gap flag", 2, -0.5, 1.5);
122 h_ebeeGap_ =
new TH1F(
"photonInEEgap",
"Ecal Barrel/Endcap gap flag", 2, -0.5, 1.5);
123 h_r9_ =
new TH1F(
"photonR9",
"R9 = E(3x3) / E(SuperCluster)", 300, 0, 3);
126 h_photonEt_ =
new TH1F(
"photonEt",
"Photon E_{T}", 200, 0, 200);
127 h_photonEta_ =
new TH1F(
"photonEta",
"Photon #eta", 800, -4, 4);
128 h_photonPhi_ =
new TH1F(
"photonPhi",
"Photon #phi", 628, -1.*
TMath::Pi(),
TMath::Pi());
129 h_hadoverem_ =
new TH1F(
"photonHoverE",
"Hadronic over EM", 200, 0, 1);
132 h_photonScEt_ =
new TH1F(
"photonScEt",
"Photon SuperCluster E_{T}", 200, 0, 200);
133 h_photonScEta_ =
new TH1F(
"photonScEta",
"Photon #eta", 800, -4, 4);
134 h_photonScPhi_ =
new TH1F(
"photonScPhi",
"Photon #phi",628, -1.*
TMath::Pi(),
TMath::Pi());
135 h_photonScEtaWidth_ =
new TH1F(
"photonScEtaWidth",
"#eta-width", 100, 0, .1);
138 h_photonInAnyGap_ =
new TH1F(
"photonInAnyGap",
"Photon in any gap flag", 2, -0.5, 1.5);
139 h_nPassingPho_ =
new TH1F(
"photonLoosePhoton",
"Total number photons (0=NotPassing, 1=Passing)", 2, -0.5, 1.5);
140 h_nPassEM_ =
new TH1F(
"photonLooseEM",
"Total number photons (0=NotPassing, 1=Passing)", 2, -0.5, 1.5);
141 h_nPho_ =
new TH1F(
"photonCount",
"Number of photons passing cuts in event", 10, 0, 10);
144 if ( createPhotonTTree_ ) {
145 tree_PhotonAll_ =
new TTree(
"TreePhotonAll",
"Reconstructed Photon");
146 tree_PhotonAll_->Branch(
"recPhoton", &recPhoton.isolationEcalRecHit,
"isolationEcalRecHit/F:isolationHcalRecHit:isolationSolidTrkCone:isolationHollowTrkCone:nTrkSolidCone:nTrkHollowCone:isEBGap:isEEGap:isEBEEGap:r9:et:eta:phi:hadronicOverEm");
165 evt.
getByLabel(
"PhotonIDProd",
"PhotonCutBasedIDLoose", loosePhotonQual);
167 evt.
getByLabel(
"PhotonIDProd",
"PhotonCutBasedIDLooseEM",looseEMQual);
176 int photonCounter = 0;
178 reco::PhotonCollection::const_iterator pho;
179 for (pho = (*photons).begin(); pho!= (*photons).end(); pho++){
186 float photonEt = pho->et();
187 float superClusterEt = (pho->superCluster()->energy())/(cosh(pho->superCluster()->position().eta()));
188 Bool_t LoosePhotonQu = (*phoMap)[photonref];
189 h_nPassingPho_->Fill(LoosePhotonQu);
190 Bool_t LooseEMQu = (*lEMMap)[photonref];
191 h_nPassEM_->Fill(LooseEMQu);
193 bool passCuts = ( photonEt > minPhotonEt_ ) &&
194 ( fabs(pho->eta()) > minPhotonAbsEta_ ) &&
195 ( fabs(pho->eta()) < maxPhotonAbsEta_ ) &&
196 ( pho->r9() > minPhotonR9_ ) &&
197 ( pho->hadronicOverEm() < maxPhotonHoverE_ ) ;
205 h_isoEcalRecHit_->Fill(pho->ecalRecHitSumEtConeDR04());
206 h_isoHcalRecHit_->Fill(pho->hcalTowerSumEtConeDR04());
207 h_trk_pt_solid_ ->Fill(pho->trkSumPtSolidConeDR04());
208 h_trk_pt_hollow_->Fill(pho->trkSumPtHollowConeDR04());
209 h_ntrk_solid_->
Fill(pho->nTrkSolidConeDR04());
210 h_ntrk_hollow_->
Fill(pho->nTrkHollowConeDR04());
211 h_ebetagap_->
Fill(pho->isEBEtaGap());
212 h_ebphigap_->
Fill(pho->isEBPhiGap());
213 h_eeringGap_->
Fill(pho->isEERingGap());
214 h_eedeeGap_->
Fill(pho->isEEDeeGap());
215 h_ebeeGap_->
Fill(pho->isEBEEGap());
216 h_r9_->
Fill(pho->r9());
219 h_photonEt_->
Fill(photonEt);
220 h_photonEta_->
Fill(pho->eta());
221 h_photonPhi_->
Fill(pho->phi());
222 h_hadoverem_->
Fill(pho->hadronicOverEm());
227 h_photonScEt_->
Fill(superClusterEt);
228 h_photonScEta_->
Fill(pho->superCluster()->position().eta());
229 h_photonScPhi_->
Fill(pho->superCluster()->position().phi());
230 h_photonScEtaWidth_->Fill(pho->superCluster()->etaWidth());
237 if ( createPhotonTTree_ ) {
238 recPhoton.isolationEcalRecHit = pho->ecalRecHitSumEtConeDR04();
239 recPhoton.isolationHcalRecHit = pho->hcalTowerSumEtConeDR04();
240 recPhoton.isolationSolidTrkCone = pho->trkSumPtSolidConeDR04();
241 recPhoton.isolationHollowTrkCone = pho->trkSumPtHollowConeDR04();
242 recPhoton.nTrkSolidCone = pho->nTrkSolidConeDR04();
243 recPhoton.nTrkHollowCone = pho->nTrkHollowConeDR04();
244 recPhoton.isEBEtaGap = pho->isEBEtaGap();
245 recPhoton.isEBPhiGap = pho->isEBPhiGap();
246 recPhoton.isEERingGap = pho->isEERingGap();
247 recPhoton.isEEDeeGap = pho->isEEDeeGap();
248 recPhoton.isEBEEGap = pho->isEBEEGap();
249 recPhoton.r9 = pho->r9();
250 recPhoton.et = pho->et();
251 recPhoton.eta = pho->eta();
252 recPhoton.phi = pho->phi();
253 recPhoton.hadronicOverEm = pho->hadronicOverEm();
257 tree_PhotonAll_->Fill();
262 bool inAnyGap = pho->isEBEEGap() || (pho->isEB()&&pho->isEBEtaGap()) ||(pho->isEB()&&pho->isEBPhiGap()) || (pho->isEE()&&pho->isEERingGap()) || (pho->isEE()&&pho->isEEDeeGap()) ;
264 h_photonInAnyGap_->Fill(1.0);
266 h_photonInAnyGap_->Fill(0.0);
278 h_nPho_->Fill(photonCounter);
293 h_isoEcalRecHit_->Write();
294 h_isoHcalRecHit_->Write();
295 h_trk_pt_solid_-> Write();
296 h_trk_pt_hollow_->Write();
297 h_ntrk_solid_-> Write();
298 h_ntrk_hollow_-> Write();
299 h_ebetagap_-> Write();
300 h_ebphigap_-> Write();
301 h_eeringGap_-> Write();
302 h_eedeeGap_-> Write();
303 h_ebeeGap_-> Write();
307 h_photonEt_-> Write();
308 h_photonEta_-> Write();
309 h_photonPhi_-> Write();
310 h_hadoverem_-> Write();
313 h_photonScEt_-> Write();
314 h_photonScEta_-> Write();
315 h_photonScPhi_-> Write();
316 h_photonScEtaWidth_->Write();
319 h_photonInAnyGap_->Write();
320 h_nPassingPho_-> Write();
321 h_nPassEM_-> Write();
T getParameter(std::string const &) const
~PhotonIDSimpleAnalyzer()
PhotonIDSimpleAnalyzer(const edm::ParameterSet &)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::vector< Photon > PhotonCollection
collectin of Photon objects