59 theTriggerPathToPass_ =
parameters.getParameter<
string>(
"triggerPathToPass");
60 thePlotTheseTriggersToo_ =
parameters.getParameter<vector<string> >(
"plotTheseTriggersToo");
63 thePhotonCollectionToken_ = consumes<reco::PhotonCollection>(
parameters.getParameter<
InputTag>(
"photonCollection"));
64 theJetCollectionToken_ = consumes<edm::View<reco::Jet> >(
parameters.getParameter<
InputTag>(
"jetCollection"));
65 theVertexCollectionToken_ = consumes<reco::VertexCollection>(
parameters.getParameter<
InputTag>(
"vertexCollection"));
66 theMinJetPt_ =
parameters.getParameter<
double>(
"minJetPt");
67 theMinPhotonEt_ =
parameters.getParameter<
double>(
"minPhotonEt");
68 theRequirePhotonFound_ =
parameters.getParameter<
bool>(
"requirePhotonFound");
69 thePlotPhotonMaxEt_ =
parameters.getParameter<
double>(
"plotPhotonMaxEt");
70 thePlotPhotonMaxEta_ =
parameters.getParameter<
double>(
"plotPhotonMaxEta");
71 thePlotJetMaxEta_ =
parameters.getParameter<
double>(
"plotJetMaxEta");
74 theBarrelRecHitToken_ = consumes<EcalRecHitCollection>(
parameters.getParameter<
InputTag>(
"barrelRecHitTag"));
75 theEndcapRecHitToken_ = consumes<EcalRecHitCollection>(
parameters.getParameter<
InputTag>(
"endcapRecHitTag"));
78 h_deltaEt_photon_jet =
nullptr;
79 h_deltaPhi_jet_jet2 =
nullptr;
80 h_deltaPhi_photon_jet =
nullptr;
81 h_deltaPhi_photon_jet2 =
nullptr;
82 h_deltaR_jet_jet2 =
nullptr;
83 h_deltaR_photon_jet2 =
nullptr;
86 h_jet2_ptOverPhotonEt =
nullptr;
87 h_jet_count =
nullptr;
90 h_photon_count_bar =
nullptr;
91 h_photon_count_end =
nullptr;
92 h_photon_et =
nullptr;
93 h_photon_et_beforeCuts =
nullptr;
94 h_photon_et_jetco =
nullptr;
95 h_photon_et_jetcs =
nullptr;
96 h_photon_et_jetfo =
nullptr;
97 h_photon_et_jetfs =
nullptr;
98 h_photon_eta =
nullptr;
99 h_triggers_passed =
nullptr;
105 logTraceName =
"QcdPhotonAnalyzer";
107 LogTrace(logTraceName) <<
"Parameters initialization";
111 std::stringstream aStringStream;
113 aStringStream << theMinJetPt_;
114 aString = aStringStream.str();
117 int numOfTriggersToMonitor = thePlotTheseTriggersToo_.size();
118 h_triggers_passed = ibooker.
book1D(
119 "triggers_passed",
"Events passing these trigger paths", numOfTriggersToMonitor, 0, numOfTriggersToMonitor);
120 for (
int i = 0;
i < numOfTriggersToMonitor;
i++) {
121 h_triggers_passed->
setBinLabel(
i + 1, thePlotTheseTriggersToo_[
i]);
125 h_photon_et_beforeCuts = ibooker.
book1D(
126 "photon_et_beforeCuts",
"#gamma with highest E_{T};E_{T}(#gamma) (GeV)", 20, 0., thePlotPhotonMaxEt_);
128 ibooker.
book1D(
"photon_et",
"#gamma with highest E_{T};E_{T}(#gamma) (GeV)", 20, 0., thePlotPhotonMaxEt_);
129 h_photon_eta = ibooker.
book1D(
130 "photon_eta",
"#gamma with highest E_{T};#eta(#gamma)", 40, -thePlotPhotonMaxEta_, thePlotPhotonMaxEta_);
131 h_photon_count_bar = ibooker.
book1D(
132 "photon_count_bar",
"Number of #gamma's passing selection (Barrel);Number of #gamma's", 8, -0.5, 7.5);
133 h_photon_count_end = ibooker.
book1D(
134 "photon_count_end",
"Number of #gamma's passing selection (Endcap);Number of #gamma's", 8, -0.5, 7.5);
137 "Jet with highest p_{T} (from " + theJetCollectionLabel_.label() +
");p_{T}(1^{st} jet) (GeV)",
140 thePlotPhotonMaxEt_);
141 h_jet_eta = ibooker.
book1D(
"jet_eta",
142 "Jet with highest p_{T} (from " + theJetCollectionLabel_.label() +
");#eta(1^{st} jet)",
146 h_deltaPhi_photon_jet =
147 ibooker.
book1D(
"deltaPhi_photon_jet",
148 "#Delta#phi between Highest E_{T} #gamma and jet;#Delta#phi(#gamma,1^{st} jet)",
152 h_deltaPhi_jet_jet2 = ibooker.
book1D(
"deltaPhi_jet_jet2",
153 "#Delta#phi between Highest E_{T} jet and 2^{nd} "
154 "jet;#Delta#phi(1^{st} jet,2^{nd} jet)",
158 h_deltaEt_photon_jet = ibooker.
book1D(
"deltaEt_photon_jet",
159 "(E_{T}(#gamma)-p_{T}(jet))/E_{T}(#gamma) when #Delta#phi(#gamma,1^{st} "
160 "jet) > 2.8;#DeltaE_{T}(#gamma,1^{st} jet)/E_{T}(#gamma)",
165 ibooker.
book1D(
"jet_count",
166 "Number of " + theJetCollectionLabel_.label() +
" (p_{T} > " + aString +
" GeV);Number of Jets",
170 h_jet2_pt = ibooker.
book1D(
172 "Jet with 2^{nd} highest p_{T} (from " + theJetCollectionLabel_.label() +
");p_{T}(2^{nd} jet) (GeV)",
175 thePlotPhotonMaxEt_);
177 ibooker.
book1D(
"jet2_eta",
178 "Jet with 2^{nd} highest p_{T} (from " + theJetCollectionLabel_.label() +
");#eta(2^{nd} jet)",
182 h_jet2_ptOverPhotonEt = ibooker.
book1D(
183 "jet2_ptOverPhotonEt",
"p_{T}(2^{nd} highest jet) / E_{T}(#gamma);p_{T}(2^{nd} Jet)/E_{T}(#gamma)", 20, 0.0, 4.0);
184 h_deltaPhi_photon_jet2 = ibooker.
book1D(
"deltaPhi_photon_jet2",
185 "#Delta#phi between Highest E_{T} #gamma and 2^{nd} "
186 "highest jet;#Delta#phi(#gamma,2^{nd} jet)",
190 h_deltaR_jet_jet2 = ibooker.
book1D(
191 "deltaR_jet_jet2",
"#DeltaR between Highest Jet and 2^{nd} Highest;#DeltaR(1^{st} jet,2^{nd} jet)", 30, 0, 6.0);
192 h_deltaR_photon_jet2 = ibooker.
book1D(
"deltaR_photon_jet2",
193 "#DeltaR between Highest E_{T} #gamma and 2^{nd} "
194 "jet;#DeltaR(#gamma, 2^{nd} jet)",
200 Float_t bins_et[] = {15, 20, 30, 50, 80};
202 h_photon_et_jetcs = ibooker.
book1D(
"photon_et_jetcs",
203 "#gamma with highest E_{T} (#eta(jet)<1.45, "
204 "#eta(#gamma)#eta(jet)>0);E_{T}(#gamma) (GeV)",
207 h_photon_et_jetco = ibooker.
book1D(
"photon_et_jetco",
208 "#gamma with highest E_{T} (#eta(jet)<1.45, "
209 "#eta(#gamma)#eta(jet)<0);E_{T}(#gamma) (GeV)",
212 h_photon_et_jetfs = ibooker.
book1D(
"photon_et_jetfs",
213 "#gamma with highest E_{T} (1.55<#eta(jet)<2.5, "
214 "#eta(#gamma)#eta(jet)>0);E_{T}(#gamma) (GeV)",
217 h_photon_et_jetfo = ibooker.
book1D(
"photon_et_jetfo",
218 "#gamma with highest E_{T} (1.55<#eta(jet)<2.5, "
219 "#eta(#gamma)#eta(jet)<0);E_{T}(#gamma) (GeV)",
224 if (
me->getTH1F()->GetSumw2N() == 0) {
229 setSumw2(h_photon_et_jetcs);
230 setSumw2(h_photon_et_jetco);
231 setSumw2(h_photon_et_jetfs);
232 setSumw2(h_photon_et_jetfo);
236 LogTrace(logTraceName) <<
"Analysis of event # ";
241 iEvent.getByToken(trigTagToken_, HLTresults);
248 bool passed_HLT =
false;
252 for (
unsigned int i = 0;
i < thePlotTheseTriggersToo_.size();
i++) {
254 for (
unsigned int ti = 0; (ti <
trigNames.size()) && !passed_HLT; ++ti) {
255 size_t pos =
trigNames.triggerName(ti).find(thePlotTheseTriggersToo_[
i]);
257 passed_HLT = HLTresults->
accept(ti);
260 h_triggers_passed->Fill(
i);
275 for (
unsigned int ti = 0; ti <
trigNames.size(); ++ti) {
276 size_t pos =
trigNames.triggerName(ti).find(theTriggerPathToPass_);
278 passed_HLT = HLTresults->
accept(ti);
288 if (recoPhoton->et() < theMinPhotonEt_)
291 h_photon_et_beforeCuts->Fill(recoPhoton->et());
309 iEvent.getByToken(theVertexCollectionToken_, vertexHandle);
341 iEvent.getByToken(theBarrelRecHitToken_, EBReducedRecHits);
343 iEvent.getByToken(theEndcapRecHitToken_, EEReducedRecHits);
347 float photon_et = -9.0;
348 float photon_eta = -9.0;
349 float photon_phi = -9.0;
350 bool photon_passPhotonID =
false;
351 bool found_lead_pho =
false;
352 int photon_count_bar = 0;
353 int photon_count_end = 0;
356 auto pho_maxet = std::max_element(
360 if (pho_maxet !=
photonCollection->end() && pho_maxet->et() >= theMinPhotonEt_) {
386 bool pho_current_passPhotonID =
false;
387 bool pho_current_isEB = pho_maxet->isEB();
388 bool pho_current_isEE = pho_maxet->isEE();
390 if (pho_current_isEB && (pho_maxet->sigmaIetaIeta() < 0.01 || pho_maxet->hadronicOverEm() < 0.05)) {
392 pho_current_passPhotonID =
true;
394 }
else if (pho_current_isEE && (pho_maxet->hadronicOverEm() < 0.05)) {
396 pho_current_passPhotonID =
true;
400 if (!found_lead_pho) {
401 found_lead_pho =
true;
402 photon_passPhotonID = pho_current_passPhotonID;
403 photon_et = pho_maxet->et();
404 photon_eta = pho_maxet->eta();
405 photon_phi = pho_maxet->phi();
412 if (theRequirePhotonFound_ && (!photon_passPhotonID || photon_et < theMinPhotonEt_))
423 float jet_eta = -8.0;
424 float jet_phi = -8.0;
426 float jet2_pt = -9.0;
427 float jet2_eta = -9.0;
428 float jet2_phi = -9.0;
430 for (
unsigned int i_jet = 0; i_jet <
jetCollection->size(); i_jet++) {
433 float jet_current_pt =
jet->pt();
436 if (
deltaR(
jet->eta(),
jet->phi(), photon_eta, photon_phi) < 0.5)
439 if (jet_current_pt < theMinJetPt_)
443 if (jet_current_pt > jet_pt) {
447 jet_pt = jet_current_pt;
448 jet_eta =
jet->eta();
449 jet_phi =
jet->phi();
450 }
else if (jet_current_pt > jet2_pt) {
451 jet2_pt = jet_current_pt;
452 jet2_eta =
jet->eta();
453 jet2_phi =
jet->phi();
464 h_photon_et->Fill(photon_et);
465 h_photon_eta->Fill(photon_eta);
466 h_photon_count_bar->Fill(photon_count_bar);
467 h_photon_count_end->Fill(photon_count_end);
470 if (fabs(photon_eta) < 1.45 && photon_passPhotonID) {
471 if (fabs(jet_eta) < 1.45) {
472 if (photon_eta * jet_eta > 0) {
473 h_photon_et_jetcs->Fill(photon_et);
475 h_photon_et_jetco->Fill(photon_et);
477 }
else if (jet_eta > 1.55 && jet_eta < 2.5) {
478 if (photon_eta * jet_eta > 0) {
479 h_photon_et_jetfs->Fill(photon_et);
481 h_photon_et_jetfo->Fill(photon_et);
487 h_jet_pt->Fill(jet_pt);
488 h_jet_eta->Fill(jet_eta);
489 h_jet_count->Fill(jet_count);
490 h_deltaPhi_photon_jet->Fill(
abs(
deltaPhi(photon_phi, jet_phi)));
492 h_deltaEt_photon_jet->Fill((photon_et - jet_pt) / photon_et);
496 h_jet2_pt->Fill(jet2_pt);
497 h_jet2_eta->Fill(jet2_eta);
498 h_jet2_ptOverPhotonEt->Fill(jet2_pt / photon_et);
499 h_deltaPhi_photon_jet2->Fill(
abs(
deltaPhi(photon_phi, jet2_phi)));
500 h_deltaPhi_jet_jet2->Fill(
abs(
deltaPhi(jet_phi, jet2_phi)));
501 h_deltaR_jet_jet2->Fill(
deltaR(jet_eta, jet_phi, jet2_eta, jet2_phi));
502 h_deltaR_photon_jet2->Fill(
deltaR(photon_eta, photon_phi, jet2_eta, jet2_phi));