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>(
86 isValidHltConfig_ =
false;
89 h_deltaEt_photon_jet = 0;
90 h_deltaPhi_jet_jet2 = 0;
91 h_deltaPhi_photon_jet = 0;
92 h_deltaPhi_photon_jet2 = 0;
93 h_deltaR_jet_jet2 = 0;
94 h_deltaR_photon_jet2 = 0;
97 h_jet2_ptOverPhotonEt = 0;
101 h_photon_count_bar = 0;
102 h_photon_count_end = 0;
104 h_photon_et_beforeCuts = 0;
105 h_photon_et_jetco = 0;
106 h_photon_et_jetcs = 0;
107 h_photon_et_jetfo = 0;
108 h_photon_et_jetfs = 0;
109 h_photon_et_ratio_co_cs = 0;
110 h_photon_et_ratio_co_fo = 0;
111 h_photon_et_ratio_co_fs = 0;
112 h_photon_et_ratio_cs_fo = 0;
113 h_photon_et_ratio_cs_fs = 0;
114 h_photon_et_ratio_fo_fs = 0;
116 h_triggers_passed = 0;
125 logTraceName =
"QcdPhotonAnalyzer";
127 LogTrace(logTraceName) <<
"Parameters initialization";
129 theDbe->setCurrentFolder(
130 "Physics/QcdPhotons");
132 std::stringstream aStringStream;
134 aStringStream << theMinJetPt_;
135 aString = aStringStream.str();
138 int numOfTriggersToMonitor = thePlotTheseTriggersToo_.size();
140 theDbe->book1D(
"triggers_passed",
"Events passing these trigger paths",
141 numOfTriggersToMonitor, 0, numOfTriggersToMonitor);
142 for (
int i = 0;
i < numOfTriggersToMonitor;
i++) {
143 h_triggers_passed->setBinLabel(
i + 1, thePlotTheseTriggersToo_[
i]);
147 h_photon_et_beforeCuts = theDbe->book1D(
148 "photon_et_beforeCuts",
"#gamma with highest E_{T};E_{T}(#gamma) (GeV)",
149 20, 0., thePlotPhotonMaxEt_);
150 h_photon_et = theDbe->book1D(
"photon_et",
151 "#gamma with highest E_{T};E_{T}(#gamma) (GeV)",
152 20, 0., thePlotPhotonMaxEt_);
154 theDbe->book1D(
"photon_eta",
"#gamma with highest E_{T};#eta(#gamma)", 40,
155 -thePlotPhotonMaxEta_, thePlotPhotonMaxEta_);
156 h_photon_count_bar = theDbe->book1D(
158 "Number of #gamma's passing selection (Barrel);Number of #gamma's", 8,
160 h_photon_count_end = theDbe->book1D(
162 "Number of #gamma's passing selection (Endcap);Number of #gamma's", 8,
165 h_jet_pt = theDbe->book1D(
"jet_pt",
"Jet with highest p_{T} (from " +
166 theJetCollectionLabel_.label() +
167 ");p_{T}(1^{st} jet) (GeV)",
168 20, 0., thePlotPhotonMaxEt_);
169 h_jet_eta = theDbe->book1D(
"jet_eta",
"Jet with highest p_{T} (from " +
170 theJetCollectionLabel_.label() +
171 ");#eta(1^{st} jet)",
172 20, -thePlotJetMaxEta_, thePlotJetMaxEta_);
173 h_deltaPhi_photon_jet =
174 theDbe->book1D(
"deltaPhi_photon_jet",
175 "#Delta#phi between Highest E_{T} #gamma and "
176 "jet;#Delta#phi(#gamma,1^{st} jet)",
178 h_deltaPhi_jet_jet2 =
179 theDbe->book1D(
"deltaPhi_jet_jet2",
180 "#Delta#phi between Highest E_{T} jet and 2^{nd} "
181 "jet;#Delta#phi(1^{st} jet,2^{nd} jet)",
183 h_deltaEt_photon_jet = theDbe->book1D(
184 "deltaEt_photon_jet",
185 "(E_{T}(#gamma)-p_{T}(jet))/E_{T}(#gamma) when #Delta#phi(#gamma,1^{st} "
186 "jet) > 2.8;#DeltaE_{T}(#gamma,1^{st} jet)/E_{T}(#gamma)",
188 h_jet_count = theDbe->book1D(
189 "jet_count",
"Number of " + theJetCollectionLabel_.label() +
190 " (p_{T} > " + aString +
" GeV);Number of Jets",
192 h_jet2_pt = theDbe->book1D(
"jet2_pt",
"Jet with 2^{nd} highest p_{T} (from " +
193 theJetCollectionLabel_.label() +
194 ");p_{T}(2^{nd} jet) (GeV)",
195 20, 0., thePlotPhotonMaxEt_);
196 h_jet2_eta = theDbe->book1D(
197 "jet2_eta",
"Jet with 2^{nd} highest p_{T} (from " +
198 theJetCollectionLabel_.label() +
");#eta(2^{nd} jet)",
199 20, -thePlotJetMaxEta_, thePlotJetMaxEta_);
200 h_jet2_ptOverPhotonEt =
201 theDbe->book1D(
"jet2_ptOverPhotonEt",
202 "p_{T}(2^{nd} highest jet) / E_{T}(#gamma);p_{T}(2^{nd} "
203 "Jet)/E_{T}(#gamma)",
205 h_deltaPhi_photon_jet2 =
206 theDbe->book1D(
"deltaPhi_photon_jet2",
207 "#Delta#phi between Highest E_{T} #gamma and 2^{nd} "
208 "highest jet;#Delta#phi(#gamma,2^{nd} jet)",
210 h_deltaR_jet_jet2 = theDbe->book1D(
"deltaR_jet_jet2",
211 "#DeltaR between Highest Jet and 2^{nd} "
212 "Highest;#DeltaR(1^{st} jet,2^{nd} jet)",
214 h_deltaR_photon_jet2 =
215 theDbe->book1D(
"deltaR_photon_jet2",
216 "#DeltaR between Highest E_{T} #gamma and 2^{nd} "
217 "jet;#DeltaR(#gamma, 2^{nd} jet)",
221 Float_t bins_et[] = {15, 20, 30, 50, 80};
224 theDbe->book1D(
"photon_et_jetcs",
225 "#gamma with highest E_{T} (#eta(jet)<1.45, "
226 "#eta(#gamma)#eta(jet)>0);E_{T}(#gamma) (GeV)",
227 num_bins_et, bins_et);
229 theDbe->book1D(
"photon_et_jetco",
230 "#gamma with highest E_{T} (#eta(jet)<1.45, "
231 "#eta(#gamma)#eta(jet)<0);E_{T}(#gamma) (GeV)",
232 num_bins_et, bins_et);
234 theDbe->book1D(
"photon_et_jetfs",
235 "#gamma with highest E_{T} (1.55<#eta(jet)<2.5, "
236 "#eta(#gamma)#eta(jet)>0);E_{T}(#gamma) (GeV)",
237 num_bins_et, bins_et);
239 theDbe->book1D(
"photon_et_jetfo",
240 "#gamma with highest E_{T} (1.55<#eta(jet)<2.5, "
241 "#eta(#gamma)#eta(jet)<0);E_{T}(#gamma) (GeV)",
242 num_bins_et, bins_et);
243 h_photon_et_jetcs->getTH1F()->Sumw2();
244 h_photon_et_jetco->getTH1F()->Sumw2();
245 h_photon_et_jetfs->getTH1F()->Sumw2();
246 h_photon_et_jetfo->getTH1F()->Sumw2();
248 h_photon_et_ratio_co_cs = theDbe->book1D(
249 "photon_et_ratio_00_co_cs",
250 "D(|#eta(jet)|<1.45, #eta(jet)*#eta(#gamma)<0) / D(|#eta(jet)|<1.45, "
251 "#eta(jet)*#eta(#gamma)>0);E_{T}(#gamma) (GeV); ratio",
252 num_bins_et, bins_et);
253 h_photon_et_ratio_fo_fs =
254 theDbe->book1D(
"photon_et_ratio_01_fo_fs",
255 "D(1.55<|#eta(jet)|<2.6, #eta(jet)*#eta(#gamma)<0) / "
256 "D(1.55<|#eta(jet)|<2.6, "
257 "#eta(jet)*#eta(#gamma)>0);E_{T}(#gamma) (GeV); ratio",
258 num_bins_et, bins_et);
259 h_photon_et_ratio_cs_fs = theDbe->book1D(
260 "photon_et_ratio_02_cs_fs",
261 "D(|#eta(jet)|<1.45, #eta(jet)*#eta(#gamma)>0) / D(1.55<|#eta(jet)|<2.6, "
262 "#eta(jet)*#eta(#gamma)>0);E_{T}(#gamma) (GeV); ratio",
263 num_bins_et, bins_et);
264 h_photon_et_ratio_co_fs = theDbe->book1D(
265 "photon_et_ratio_03_co_fs",
266 "D(|#eta(jet)|<1.45, #eta(jet)*#eta(#gamma)<0) / D(1.55<|#eta(jet)|<2.6, "
267 "#eta(jet)*#eta(#gamma)>0);E_{T}(#gamma) (GeV); ratio",
268 num_bins_et, bins_et);
269 h_photon_et_ratio_cs_fo = theDbe->book1D(
270 "photon_et_ratio_04_cs_fo",
271 "D(|#eta(jet)|<1.45, #eta(jet)*#eta(#gamma)>0) / D(1.55<|#eta(jet)|<2.6, "
272 "#eta(jet)*#eta(#gamma)<0);E_{T}(#gamma) (GeV); ratio",
273 num_bins_et, bins_et);
274 h_photon_et_ratio_co_fo = theDbe->book1D(
275 "photon_et_ratio_05_co_fo",
276 "D(|#eta(jet)|<1.45, #eta(jet)*#eta(#gamma)<0) / D(1.55<|#eta(jet)|<2.6, "
277 "#eta(jet)*#eta(#gamma)<0);E_{T}(#gamma) (GeV); ratio",
278 num_bins_et, bins_et);
279 h_photon_et_ratio_co_cs->getTH1F()->Sumw2();
280 h_photon_et_ratio_fo_fs->getTH1F()->Sumw2();
281 h_photon_et_ratio_cs_fs->getTH1F()->Sumw2();
282 h_photon_et_ratio_co_fs->getTH1F()->Sumw2();
283 h_photon_et_ratio_cs_fo->getTH1F()->Sumw2();
284 h_photon_et_ratio_co_fo->getTH1F()->Sumw2();
294 bool isConfigChanged =
false;
299 hltConfigProvider_.init(iRun, iSet,
"HLT", isConfigChanged);
301 num_events_in_run = 0;
310 LogTrace(logTraceName) <<
"Analysis of event # ";
322 bool passed_HLT =
false;
326 for (
unsigned int i = 0;
i < thePlotTheseTriggersToo_.size();
i++) {
328 for (
unsigned int ti = 0; (ti < trigNames.
size()) && !passed_HLT; ++ti) {
329 size_t pos = trigNames.
triggerName(ti).find(thePlotTheseTriggersToo_[
i]);
330 if (pos == 0) passed_HLT = HLTresults->accept(ti);
332 if (passed_HLT) h_triggers_passed->Fill(
i);
337 iEvent.
getByToken(thePhotonCollectionToken_, photonCollection);
340 if (!photonCollection.
isValid())
return;
346 for (
unsigned int ti = 0; ti < trigNames.
size(); ++ti) {
347 size_t pos = trigNames.
triggerName(ti).find(theTriggerPathToPass_);
349 passed_HLT = HLTresults->accept(ti);
356 for (PhotonCollection::const_iterator recoPhoton =
357 photonCollection->begin();
358 recoPhoton != photonCollection->end(); recoPhoton++) {
360 if (recoPhoton->et() < theMinPhotonEt_)
break;
362 h_photon_et_beforeCuts->Fill(recoPhoton->et());
380 iEvent.
getByToken(theVertexCollectionToken_, vertexHandle);
393 for (
unsigned int i = 0;
i < vertexCollection.size(); ++
i) {
394 if (vertexCollection[
i].isValid()) nvvertex++;
396 if (nvvertex == 0)
return;
410 iEvent.
getByToken(theBarrelRecHitToken_, EBReducedRecHits);
412 iEvent.
getByToken(theEndcapRecHitToken_, EEReducedRecHits);
414 theEndcapRecHitToken_);
417 float photon_et = -9.0;
418 float photon_eta = -9.0;
419 float photon_phi = -9.0;
420 bool photon_passPhotonID =
false;
421 bool found_lead_pho =
false;
422 int photon_count_bar = 0;
423 int photon_count_end = 0;
426 auto pho_maxet = std::max_element(
427 photonCollection->begin(), photonCollection->end(),
430 if (pho_maxet != photonCollection->end() &&
431 pho_maxet->et() >= theMinPhotonEt_) {
457 bool pho_current_passPhotonID =
false;
458 bool pho_current_isEB = pho_maxet->isEB();
459 bool pho_current_isEE = pho_maxet->isEE();
461 if (pho_current_isEB && (pho_maxet->sigmaIetaIeta() < 0.01 ||
462 pho_maxet->hadronicOverEm() < 0.05)) {
464 pho_current_passPhotonID =
true;
466 }
else if (pho_current_isEE && (pho_maxet->hadronicOverEm() < 0.05)) {
468 pho_current_passPhotonID =
true;
472 if (!found_lead_pho) {
473 found_lead_pho =
true;
474 photon_passPhotonID = pho_current_passPhotonID;
475 photon_et = pho_maxet->et();
476 photon_eta = pho_maxet->eta();
477 photon_phi = pho_maxet->phi();
484 if (theRequirePhotonFound_ &&
485 (!photon_passPhotonID || photon_et < theMinPhotonEt_))
491 iEvent.
getByToken(theJetCollectionToken_, jetCollection);
492 if (!jetCollection.
isValid())
return;
495 float jet_eta = -8.0;
496 float jet_phi = -8.0;
498 float jet2_pt = -9.0;
499 float jet2_eta = -9.0;
500 float jet2_phi = -9.0;
502 for (
unsigned int i_jet = 0; i_jet < jetCollection->size(); i_jet++) {
503 const Jet*
jet = &jetCollection->at(i_jet);
505 float jet_current_pt = jet->
pt();
508 if (
deltaR(jet->
eta(), jet->
phi(), photon_eta, photon_phi) < 0.5)
continue;
510 if (jet_current_pt < theMinJetPt_)
break;
513 if (jet_current_pt > jet_pt) {
519 jet_eta = jet->
eta();
520 jet_phi = jet->
phi();
521 }
else if (jet_current_pt > jet2_pt) {
522 jet2_pt = jet_current_pt;
523 jet2_eta = jet->
eta();
524 jet2_phi = jet->
phi();
536 h_photon_et->Fill(photon_et);
537 h_photon_eta->Fill(photon_eta);
538 h_photon_count_bar->Fill(photon_count_bar);
539 h_photon_count_end->Fill(photon_count_end);
542 if (fabs(photon_eta) < 1.45 &&
543 photon_passPhotonID) {
544 if (fabs(jet_eta) < 1.45) {
545 if (photon_eta * jet_eta > 0) {
546 h_photon_et_jetcs->Fill(photon_et);
548 h_photon_et_jetco->Fill(photon_et);
550 }
else if (jet_eta > 1.55 && jet_eta < 2.5) {
551 if (photon_eta * jet_eta > 0) {
552 h_photon_et_jetfs->Fill(photon_et);
554 h_photon_et_jetfo->Fill(photon_et);
560 h_jet_pt->Fill(jet_pt);
561 h_jet_eta->Fill(jet_eta);
562 h_jet_count->Fill(jet_count);
563 h_deltaPhi_photon_jet->Fill(
abs(
deltaPhi(photon_phi, jet_phi)));
565 h_deltaEt_photon_jet->Fill((photon_et - jet_pt) / photon_et);
569 h_jet2_pt->Fill(jet2_pt);
570 h_jet2_eta->Fill(jet2_eta);
571 h_jet2_ptOverPhotonEt->Fill(jet2_pt / photon_et);
572 h_deltaPhi_photon_jet2->Fill(
abs(
deltaPhi(photon_phi, jet2_phi)));
573 h_deltaPhi_jet_jet2->Fill(
abs(
deltaPhi(jet_phi, jet2_phi)));
574 h_deltaR_jet_jet2->Fill(
deltaR(jet_eta, jet_phi, jet2_eta, jet2_phi));
575 h_deltaR_photon_jet2->Fill(
576 deltaR(photon_eta, photon_phi, jet2_eta, jet2_phi));
586 if (num_events_in_run > 0) {
587 h_triggers_passed->getTH1F()->Scale(1.0 / num_events_in_run);
589 h_photon_et_ratio_co_cs->getTH1F()->Divide(h_photon_et_jetco->getTH1F(),
590 h_photon_et_jetcs->getTH1F());
591 h_photon_et_ratio_fo_fs->getTH1F()->Divide(h_photon_et_jetfo->getTH1F(),
592 h_photon_et_jetfs->getTH1F());
593 h_photon_et_ratio_cs_fs->getTH1F()->Divide(h_photon_et_jetcs->getTH1F(),
594 h_photon_et_jetfs->getTH1F());
595 h_photon_et_ratio_co_fs->getTH1F()->Divide(h_photon_et_jetco->getTH1F(),
596 h_photon_et_jetfs->getTH1F());
597 h_photon_et_ratio_cs_fo->getTH1F()->Divide(h_photon_et_jetcs->getTH1F(),
598 h_photon_et_jetfo->getTH1F());
599 h_photon_et_ratio_co_fo->getTH1F()->Divide(h_photon_et_jetco->getTH1F(),
600 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 beginJob()
Inizialize parameters for histo binning.
std::vector< Vertex > VertexCollection
collection of Vertex objects
Strings::size_type size() const
void endRun(const edm::Run &, const edm::EventSetup &)
QcdPhotonsDQM(const edm::ParameterSet &)
Constructor.
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
Abs< T >::type abs(const T &t)
Container::value_type value_type
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
void endJob(void)
Save the histos.
double deltaR(double eta1, double eta2, double phi1, double phi2)
static const char *const trigNames[]
T const * product() const
std::string const & triggerName(unsigned int index) const
void beginRun(const edm::Run &, const edm::EventSetup &)
virtual ~QcdPhotonsDQM()
Destructor.
virtual float pt() const GCC11_FINAL
transverse momentum
void analyze(const edm::Event &, const edm::EventSetup &)
Get the analysis.