61 theTriggerPathToPass_ = parameters.
getParameter<
string>(
"triggerPathToPass");
62 thePlotTheseTriggersToo_ =
63 parameters.
getParameter<vector<string> >(
"plotTheseTriggersToo");
65 trigTagToken_ = consumes<edm::TriggerResults>(
67 thePhotonCollectionToken_ = consumes<reco::PhotonCollection>(
69 theJetCollectionToken_ = consumes<edm::View<reco::Jet> >(
71 theVertexCollectionToken_ = consumes<reco::VertexCollection>(
73 theMinJetPt_ = parameters.
getParameter<
double>(
"minJetPt");
74 theMinPhotonEt_ = parameters.
getParameter<
double>(
"minPhotonEt");
75 theRequirePhotonFound_ = parameters.
getParameter<
bool>(
"requirePhotonFound");
76 thePlotPhotonMaxEt_ = parameters.
getParameter<
double>(
"plotPhotonMaxEt");
77 thePlotPhotonMaxEta_ = parameters.
getParameter<
double>(
"plotPhotonMaxEta");
78 thePlotJetMaxEta_ = parameters.
getParameter<
double>(
"plotJetMaxEta");
81 theBarrelRecHitToken_ = consumes<EcalRecHitCollection>(
83 theEndcapRecHitToken_ = consumes<EcalRecHitCollection>(
87 h_deltaEt_photon_jet = 0;
88 h_deltaPhi_jet_jet2 = 0;
89 h_deltaPhi_photon_jet = 0;
90 h_deltaPhi_photon_jet2 = 0;
91 h_deltaR_jet_jet2 = 0;
92 h_deltaR_photon_jet2 = 0;
95 h_jet2_ptOverPhotonEt = 0;
99 h_photon_count_bar = 0;
100 h_photon_count_end = 0;
102 h_photon_et_beforeCuts = 0;
103 h_photon_et_jetco = 0;
104 h_photon_et_jetcs = 0;
105 h_photon_et_jetfo = 0;
106 h_photon_et_jetfs = 0;
107 h_photon_et_ratio_co_cs = 0;
108 h_photon_et_ratio_co_fo = 0;
109 h_photon_et_ratio_co_fs = 0;
110 h_photon_et_ratio_cs_fo = 0;
111 h_photon_et_ratio_cs_fs = 0;
112 h_photon_et_ratio_fo_fs = 0;
114 h_triggers_passed = 0;
124 logTraceName =
"QcdPhotonAnalyzer";
126 LogTrace(logTraceName) <<
"Parameters initialization";
130 std::stringstream aStringStream;
132 aStringStream << theMinJetPt_;
133 aString = aStringStream.str();
136 int numOfTriggersToMonitor = thePlotTheseTriggersToo_.size();
137 h_triggers_passed = ibooker.
book1D(
"triggers_passed",
138 "Events passing these trigger paths", numOfTriggersToMonitor,
139 0, numOfTriggersToMonitor);
140 for (
int i = 0;
i < numOfTriggersToMonitor;
i++) {
141 h_triggers_passed->
setBinLabel(
i + 1, thePlotTheseTriggersToo_[
i]);
145 h_photon_et_beforeCuts = ibooker.
book1D(
"photon_et_beforeCuts",
146 "#gamma with highest E_{T};E_{T}(#gamma) (GeV)", 20, 0., thePlotPhotonMaxEt_);
147 h_photon_et = ibooker.
book1D(
"photon_et",
148 "#gamma with highest E_{T};E_{T}(#gamma) (GeV)", 20, 0., thePlotPhotonMaxEt_);
149 h_photon_eta = ibooker.
book1D(
"photon_eta",
150 "#gamma with highest E_{T};#eta(#gamma)", 40,
151 -thePlotPhotonMaxEta_, thePlotPhotonMaxEta_);
152 h_photon_count_bar = ibooker.
book1D(
"photon_count_bar",
153 "Number of #gamma's passing selection (Barrel);Number of #gamma's", 8,
155 h_photon_count_end = ibooker.
book1D(
"photon_count_end",
156 "Number of #gamma's passing selection (Endcap);Number of #gamma's", 8,
158 h_jet_pt = ibooker.
book1D(
"jet_pt",
159 "Jet with highest p_{T} (from " + theJetCollectionLabel_.label() +
160 ");p_{T}(1^{st} jet) (GeV)", 20, 0., thePlotPhotonMaxEt_);
161 h_jet_eta = ibooker.
book1D(
"jet_eta",
162 "Jet with highest p_{T} (from " + theJetCollectionLabel_.label() +
163 ");#eta(1^{st} jet)", 20, -thePlotJetMaxEta_, thePlotJetMaxEta_);
164 h_deltaPhi_photon_jet = ibooker.
book1D(
"deltaPhi_photon_jet",
165 "#Delta#phi between Highest E_{T} #gamma and jet;#Delta#phi(#gamma,1^{st} jet)",
167 h_deltaPhi_jet_jet2 = ibooker.
book1D(
"deltaPhi_jet_jet2",
168 "#Delta#phi between Highest E_{T} jet and 2^{nd} "
169 "jet;#Delta#phi(1^{st} jet,2^{nd} jet)",
171 h_deltaEt_photon_jet = ibooker.
book1D(
"deltaEt_photon_jet",
172 "(E_{T}(#gamma)-p_{T}(jet))/E_{T}(#gamma) when #Delta#phi(#gamma,1^{st} "
173 "jet) > 2.8;#DeltaE_{T}(#gamma,1^{st} jet)/E_{T}(#gamma)",
175 h_jet_count = ibooker.
book1D(
"jet_count",
176 "Number of " + theJetCollectionLabel_.label() +
" (p_{T} > " + aString +
177 " GeV);Number of Jets", 8, -0.5, 7.5);
178 h_jet2_pt = ibooker.
book1D(
"jet2_pt",
179 "Jet with 2^{nd} highest p_{T} (from " + theJetCollectionLabel_.label() +
180 ");p_{T}(2^{nd} jet) (GeV)", 20, 0., thePlotPhotonMaxEt_);
181 h_jet2_eta = ibooker.
book1D(
"jet2_eta",
182 "Jet with 2^{nd} highest p_{T} (from " + theJetCollectionLabel_.label() +
183 ");#eta(2^{nd} jet)", 20, -thePlotJetMaxEta_, thePlotJetMaxEta_);
184 h_jet2_ptOverPhotonEt = ibooker.
book1D(
"jet2_ptOverPhotonEt",
185 "p_{T}(2^{nd} highest jet) / E_{T}(#gamma);p_{T}(2^{nd} Jet)/E_{T}(#gamma)",
187 h_deltaPhi_photon_jet2 = ibooker.
book1D(
"deltaPhi_photon_jet2",
188 "#Delta#phi between Highest E_{T} #gamma and 2^{nd} "
189 "highest jet;#Delta#phi(#gamma,2^{nd} jet)", 20, 0, 3.1415926);
190 h_deltaR_jet_jet2 = ibooker.
book1D(
"deltaR_jet_jet2",
191 "#DeltaR between Highest Jet and 2^{nd} Highest;#DeltaR(1^{st} jet,2^{nd} jet)",
193 h_deltaR_photon_jet2 = ibooker.
book1D(
"deltaR_photon_jet2",
194 "#DeltaR between Highest E_{T} #gamma and 2^{nd} "
195 "jet;#DeltaR(#gamma, 2^{nd} jet)", 30, 0, 6.0);
198 Float_t bins_et[] = {15, 20, 30, 50, 80};
200 h_photon_et_jetcs = ibooker.
book1D(
"photon_et_jetcs",
201 "#gamma with highest E_{T} (#eta(jet)<1.45, "
202 "#eta(#gamma)#eta(jet)>0);E_{T}(#gamma) (GeV)", num_bins_et, bins_et);
203 h_photon_et_jetco = ibooker.
book1D(
"photon_et_jetco",
204 "#gamma with highest E_{T} (#eta(jet)<1.45, "
205 "#eta(#gamma)#eta(jet)<0);E_{T}(#gamma) (GeV)", num_bins_et, bins_et);
206 h_photon_et_jetfs = ibooker.
book1D(
"photon_et_jetfs",
207 "#gamma with highest E_{T} (1.55<#eta(jet)<2.5, "
208 "#eta(#gamma)#eta(jet)>0);E_{T}(#gamma) (GeV)", num_bins_et, bins_et);
209 h_photon_et_jetfo = ibooker.
book1D(
"photon_et_jetfo",
210 "#gamma with highest E_{T} (1.55<#eta(jet)<2.5, "
211 "#eta(#gamma)#eta(jet)<0);E_{T}(#gamma) (GeV)", num_bins_et, bins_et);
214 if (me->getTH1F()->GetSumw2N() == 0) {
219 setSumw2(h_photon_et_jetcs);
220 setSumw2(h_photon_et_jetco);
221 setSumw2(h_photon_et_jetfs);
222 setSumw2(h_photon_et_jetfo);
225 h_photon_et_ratio_co_cs = ibooker.
book1D(
"photon_et_ratio_00_co_cs",
226 "D(|#eta(jet)|<1.45, #eta(jet)*#eta(#gamma)<0) / D(|#eta(jet)|<1.45, "
227 "#eta(jet)*#eta(#gamma)>0);E_{T}(#gamma) (GeV); ratio", num_bins_et, bins_et);
228 h_photon_et_ratio_fo_fs = ibooker.
book1D(
"photon_et_ratio_01_fo_fs",
229 "D(1.55<|#eta(jet)|<2.6, #eta(jet)*#eta(#gamma)<0) / "
230 "D(1.55<|#eta(jet)|<2.6, #eta(jet)*#eta(#gamma)>0);E_{T}(#gamma) (GeV); ratio",
231 num_bins_et, bins_et);
232 h_photon_et_ratio_cs_fs = ibooker.
book1D(
"photon_et_ratio_02_cs_fs",
233 "D(|#eta(jet)|<1.45, #eta(jet)*#eta(#gamma)>0) / D(1.55<|#eta(jet)|<2.6, "
234 "#eta(jet)*#eta(#gamma)>0);E_{T}(#gamma) (GeV); ratio",
235 num_bins_et, bins_et);
236 h_photon_et_ratio_co_fs = ibooker.
book1D(
"photon_et_ratio_03_co_fs",
237 "D(|#eta(jet)|<1.45, #eta(jet)*#eta(#gamma)<0) / D(1.55<|#eta(jet)|<2.6, "
238 "#eta(jet)*#eta(#gamma)>0);E_{T}(#gamma) (GeV); ratio",
239 num_bins_et, bins_et);
240 h_photon_et_ratio_cs_fo = ibooker.
book1D(
"photon_et_ratio_04_cs_fo",
241 "D(|#eta(jet)|<1.45, #eta(jet)*#eta(#gamma)>0) / D(1.55<|#eta(jet)|<2.6, "
242 "#eta(jet)*#eta(#gamma)<0);E_{T}(#gamma) (GeV); ratio",
243 num_bins_et, bins_et);
244 h_photon_et_ratio_co_fo = ibooker.
book1D(
"photon_et_ratio_05_co_fo",
245 "D(|#eta(jet)|<1.45, #eta(jet)*#eta(#gamma)<0) / D(1.55<|#eta(jet)|<2.6, "
246 "#eta(jet)*#eta(#gamma)<0);E_{T}(#gamma) (GeV); ratio",
247 num_bins_et, bins_et);
248 setSumw2(h_photon_et_ratio_co_cs);
249 setSumw2(h_photon_et_ratio_fo_fs);
250 setSumw2(h_photon_et_ratio_cs_fs);
251 setSumw2(h_photon_et_ratio_co_fs);
252 setSumw2(h_photon_et_ratio_cs_fo);
253 setSumw2(h_photon_et_ratio_co_fo);
259 LogTrace(logTraceName) <<
"Analysis of event # ";
271 bool passed_HLT =
false;
275 for (
unsigned int i = 0;
i < thePlotTheseTriggersToo_.size();
i++) {
277 for (
unsigned int ti = 0; (ti < trigNames.
size()) && !passed_HLT; ++ti) {
278 size_t pos = trigNames.
triggerName(ti).find(thePlotTheseTriggersToo_[
i]);
279 if (pos == 0) passed_HLT = HLTresults->accept(ti);
281 if (passed_HLT) h_triggers_passed->Fill(
i);
286 iEvent.
getByToken(thePhotonCollectionToken_, photonCollection);
289 if (!photonCollection.
isValid())
return;
295 for (
unsigned int ti = 0; ti < trigNames.
size(); ++ti) {
296 size_t pos = trigNames.
triggerName(ti).find(theTriggerPathToPass_);
298 passed_HLT = HLTresults->accept(ti);
305 for (PhotonCollection::const_iterator recoPhoton =
306 photonCollection->begin();
307 recoPhoton != photonCollection->end(); recoPhoton++) {
309 if (recoPhoton->et() < theMinPhotonEt_)
break;
311 h_photon_et_beforeCuts->Fill(recoPhoton->et());
329 iEvent.
getByToken(theVertexCollectionToken_, vertexHandle);
342 for (
unsigned int i = 0;
i < vertexCollection.size(); ++
i) {
343 if (vertexCollection[
i].isValid()) nvvertex++;
345 if (nvvertex == 0)
return;
359 iEvent.
getByToken(theBarrelRecHitToken_, EBReducedRecHits);
361 iEvent.
getByToken(theEndcapRecHitToken_, EEReducedRecHits);
363 theEndcapRecHitToken_);
366 float photon_et = -9.0;
367 float photon_eta = -9.0;
368 float photon_phi = -9.0;
369 bool photon_passPhotonID =
false;
370 bool found_lead_pho =
false;
371 int photon_count_bar = 0;
372 int photon_count_end = 0;
375 auto pho_maxet = std::max_element(
376 photonCollection->begin(), photonCollection->end(),
379 if (pho_maxet != photonCollection->end() &&
380 pho_maxet->et() >= theMinPhotonEt_) {
406 bool pho_current_passPhotonID =
false;
407 bool pho_current_isEB = pho_maxet->isEB();
408 bool pho_current_isEE = pho_maxet->isEE();
410 if (pho_current_isEB && (pho_maxet->sigmaIetaIeta() < 0.01 ||
411 pho_maxet->hadronicOverEm() < 0.05)) {
413 pho_current_passPhotonID =
true;
415 }
else if (pho_current_isEE && (pho_maxet->hadronicOverEm() < 0.05)) {
417 pho_current_passPhotonID =
true;
421 if (!found_lead_pho) {
422 found_lead_pho =
true;
423 photon_passPhotonID = pho_current_passPhotonID;
424 photon_et = pho_maxet->et();
425 photon_eta = pho_maxet->eta();
426 photon_phi = pho_maxet->phi();
433 if (theRequirePhotonFound_ &&
434 (!photon_passPhotonID || photon_et < theMinPhotonEt_))
440 iEvent.
getByToken(theJetCollectionToken_, jetCollection);
441 if (!jetCollection.
isValid())
return;
444 float jet_eta = -8.0;
445 float jet_phi = -8.0;
447 float jet2_pt = -9.0;
448 float jet2_eta = -9.0;
449 float jet2_phi = -9.0;
451 for (
unsigned int i_jet = 0; i_jet < jetCollection->size(); i_jet++) {
452 const Jet*
jet = &jetCollection->at(i_jet);
454 float jet_current_pt = jet->
pt();
457 if (
deltaR(jet->
eta(), jet->
phi(), photon_eta, photon_phi) < 0.5)
continue;
459 if (jet_current_pt < theMinJetPt_)
break;
462 if (jet_current_pt > jet_pt) {
468 jet_eta = jet->
eta();
469 jet_phi = jet->
phi();
470 }
else if (jet_current_pt > jet2_pt) {
471 jet2_pt = jet_current_pt;
472 jet2_eta = jet->
eta();
473 jet2_phi = jet->
phi();
485 h_photon_et->Fill(photon_et);
486 h_photon_eta->Fill(photon_eta);
487 h_photon_count_bar->Fill(photon_count_bar);
488 h_photon_count_end->Fill(photon_count_end);
491 if (fabs(photon_eta) < 1.45 &&
492 photon_passPhotonID) {
493 if (fabs(jet_eta) < 1.45) {
494 if (photon_eta * jet_eta > 0) {
495 h_photon_et_jetcs->Fill(photon_et);
497 h_photon_et_jetco->Fill(photon_et);
499 }
else if (jet_eta > 1.55 && jet_eta < 2.5) {
500 if (photon_eta * jet_eta > 0) {
501 h_photon_et_jetfs->Fill(photon_et);
503 h_photon_et_jetfo->Fill(photon_et);
509 h_jet_pt->Fill(jet_pt);
510 h_jet_eta->Fill(jet_eta);
511 h_jet_count->Fill(jet_count);
512 h_deltaPhi_photon_jet->Fill(
abs(
deltaPhi(photon_phi, jet_phi)));
514 h_deltaEt_photon_jet->Fill((photon_et - jet_pt) / photon_et);
518 h_jet2_pt->Fill(jet2_pt);
519 h_jet2_eta->Fill(jet2_eta);
520 h_jet2_ptOverPhotonEt->Fill(jet2_pt / photon_et);
521 h_deltaPhi_photon_jet2->Fill(
abs(
deltaPhi(photon_phi, jet2_phi)));
522 h_deltaPhi_jet_jet2->Fill(
abs(
deltaPhi(jet_phi, jet2_phi)));
523 h_deltaR_jet_jet2->Fill(
deltaR(jet_eta, jet_phi, jet2_eta, jet2_phi));
524 h_deltaR_photon_jet2->Fill(
525 deltaR(photon_eta, photon_phi, jet2_eta, jet2_phi));
533 if (num_events_in_run > 0) {
534 h_triggers_passed->getTH1F()->Scale(1.0 / num_events_in_run);
536 h_photon_et_ratio_co_cs->getTH1F()->Divide(h_photon_et_jetco->getTH1F(),
537 h_photon_et_jetcs->getTH1F());
538 h_photon_et_ratio_fo_fs->getTH1F()->Divide(h_photon_et_jetfo->getTH1F(),
539 h_photon_et_jetfs->getTH1F());
540 h_photon_et_ratio_cs_fs->getTH1F()->Divide(h_photon_et_jetcs->getTH1F(),
541 h_photon_et_jetfs->getTH1F());
542 h_photon_et_ratio_co_fs->getTH1F()->Divide(h_photon_et_jetco->getTH1F(),
543 h_photon_et_jetfs->getTH1F());
544 h_photon_et_ratio_cs_fo->getTH1F()->Divide(h_photon_et_jetcs->getTH1F(),
545 h_photon_et_jetfo->getTH1F());
546 h_photon_et_ratio_co_fo->getTH1F()->Divide(h_photon_et_jetco->getTH1F(),
547 h_photon_et_jetfo->getTH1F());
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Base class for all types of Jets.
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
std::vector< Vertex > VertexCollection
collection of Vertex objects
Strings::size_type size() const
virtual double eta() const
momentum pseudorapidity
void endRun(const edm::Run &, const edm::EventSetup &)
virtual double pt() const
transverse momentum
QcdPhotonsDQM(const edm::ParameterSet &)
Constructor.
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
Container::value_type value_type
double deltaR(double eta1, double eta2, double phi1, double phi2)
static const char *const trigNames[]
void setCurrentFolder(const std::string &fullpath)
T const * product() const
std::string const & triggerName(unsigned int index) const
TH1F * getTH1F(void) const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
virtual ~QcdPhotonsDQM()
Destructor.
void analyze(const edm::Event &, const edm::EventSetup &)
Get the analysis.
virtual double phi() const
momentum azimuthal angle