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;
108 h_triggers_passed = 0;
118 logTraceName =
"QcdPhotonAnalyzer";
120 LogTrace(logTraceName) <<
"Parameters initialization";
124 std::stringstream aStringStream;
126 aStringStream << theMinJetPt_;
127 aString = aStringStream.str();
130 int numOfTriggersToMonitor = thePlotTheseTriggersToo_.size();
131 h_triggers_passed = ibooker.
book1D(
"triggers_passed",
132 "Events passing these trigger paths", numOfTriggersToMonitor,
133 0, numOfTriggersToMonitor);
134 for (
int i = 0;
i < numOfTriggersToMonitor;
i++) {
135 h_triggers_passed->
setBinLabel(
i + 1, thePlotTheseTriggersToo_[
i]);
139 h_photon_et_beforeCuts = ibooker.
book1D(
"photon_et_beforeCuts",
140 "#gamma with highest E_{T};E_{T}(#gamma) (GeV)", 20, 0., thePlotPhotonMaxEt_);
141 h_photon_et = ibooker.
book1D(
"photon_et",
142 "#gamma with highest E_{T};E_{T}(#gamma) (GeV)", 20, 0., thePlotPhotonMaxEt_);
143 h_photon_eta = ibooker.
book1D(
"photon_eta",
144 "#gamma with highest E_{T};#eta(#gamma)", 40,
145 -thePlotPhotonMaxEta_, thePlotPhotonMaxEta_);
146 h_photon_count_bar = ibooker.
book1D(
"photon_count_bar",
147 "Number of #gamma's passing selection (Barrel);Number of #gamma's", 8,
149 h_photon_count_end = ibooker.
book1D(
"photon_count_end",
150 "Number of #gamma's passing selection (Endcap);Number of #gamma's", 8,
152 h_jet_pt = ibooker.
book1D(
"jet_pt",
153 "Jet with highest p_{T} (from " + theJetCollectionLabel_.label() +
154 ");p_{T}(1^{st} jet) (GeV)", 20, 0., thePlotPhotonMaxEt_);
155 h_jet_eta = ibooker.
book1D(
"jet_eta",
156 "Jet with highest p_{T} (from " + theJetCollectionLabel_.label() +
157 ");#eta(1^{st} jet)", 20, -thePlotJetMaxEta_, thePlotJetMaxEta_);
158 h_deltaPhi_photon_jet = ibooker.
book1D(
"deltaPhi_photon_jet",
159 "#Delta#phi between Highest E_{T} #gamma and jet;#Delta#phi(#gamma,1^{st} jet)",
161 h_deltaPhi_jet_jet2 = ibooker.
book1D(
"deltaPhi_jet_jet2",
162 "#Delta#phi between Highest E_{T} jet and 2^{nd} "
163 "jet;#Delta#phi(1^{st} jet,2^{nd} jet)",
165 h_deltaEt_photon_jet = ibooker.
book1D(
"deltaEt_photon_jet",
166 "(E_{T}(#gamma)-p_{T}(jet))/E_{T}(#gamma) when #Delta#phi(#gamma,1^{st} "
167 "jet) > 2.8;#DeltaE_{T}(#gamma,1^{st} jet)/E_{T}(#gamma)",
169 h_jet_count = ibooker.
book1D(
"jet_count",
170 "Number of " + theJetCollectionLabel_.label() +
" (p_{T} > " + aString +
171 " GeV);Number of Jets", 8, -0.5, 7.5);
172 h_jet2_pt = ibooker.
book1D(
"jet2_pt",
173 "Jet with 2^{nd} highest p_{T} (from " + theJetCollectionLabel_.label() +
174 ");p_{T}(2^{nd} jet) (GeV)", 20, 0., thePlotPhotonMaxEt_);
175 h_jet2_eta = ibooker.
book1D(
"jet2_eta",
176 "Jet with 2^{nd} highest p_{T} (from " + theJetCollectionLabel_.label() +
177 ");#eta(2^{nd} jet)", 20, -thePlotJetMaxEta_, thePlotJetMaxEta_);
178 h_jet2_ptOverPhotonEt = ibooker.
book1D(
"jet2_ptOverPhotonEt",
179 "p_{T}(2^{nd} highest jet) / E_{T}(#gamma);p_{T}(2^{nd} Jet)/E_{T}(#gamma)",
181 h_deltaPhi_photon_jet2 = ibooker.
book1D(
"deltaPhi_photon_jet2",
182 "#Delta#phi between Highest E_{T} #gamma and 2^{nd} "
183 "highest jet;#Delta#phi(#gamma,2^{nd} jet)", 20, 0, 3.1415926);
184 h_deltaR_jet_jet2 = ibooker.
book1D(
"deltaR_jet_jet2",
185 "#DeltaR between Highest Jet and 2^{nd} Highest;#DeltaR(1^{st} jet,2^{nd} jet)",
187 h_deltaR_photon_jet2 = ibooker.
book1D(
"deltaR_photon_jet2",
188 "#DeltaR between Highest E_{T} #gamma and 2^{nd} "
189 "jet;#DeltaR(#gamma, 2^{nd} jet)", 30, 0, 6.0);
192 Float_t bins_et[] = {15, 20, 30, 50, 80};
194 h_photon_et_jetcs = ibooker.
book1D(
"photon_et_jetcs",
195 "#gamma with highest E_{T} (#eta(jet)<1.45, "
196 "#eta(#gamma)#eta(jet)>0);E_{T}(#gamma) (GeV)", num_bins_et, bins_et);
197 h_photon_et_jetco = ibooker.
book1D(
"photon_et_jetco",
198 "#gamma with highest E_{T} (#eta(jet)<1.45, "
199 "#eta(#gamma)#eta(jet)<0);E_{T}(#gamma) (GeV)", num_bins_et, bins_et);
200 h_photon_et_jetfs = ibooker.
book1D(
"photon_et_jetfs",
201 "#gamma with highest E_{T} (1.55<#eta(jet)<2.5, "
202 "#eta(#gamma)#eta(jet)>0);E_{T}(#gamma) (GeV)", num_bins_et, bins_et);
203 h_photon_et_jetfo = ibooker.
book1D(
"photon_et_jetfo",
204 "#gamma with highest E_{T} (1.55<#eta(jet)<2.5, "
205 "#eta(#gamma)#eta(jet)<0);E_{T}(#gamma) (GeV)", num_bins_et, bins_et);
208 if (me->getTH1F()->GetSumw2N() == 0) {
213 setSumw2(h_photon_et_jetcs);
214 setSumw2(h_photon_et_jetco);
215 setSumw2(h_photon_et_jetfs);
216 setSumw2(h_photon_et_jetfo);
220 LogTrace(logTraceName) <<
"Analysis of event # ";
232 bool passed_HLT =
false;
236 for (
unsigned int i = 0;
i < thePlotTheseTriggersToo_.size();
i++) {
238 for (
unsigned int ti = 0; (ti < trigNames.
size()) && !passed_HLT; ++ti) {
239 size_t pos = trigNames.
triggerName(ti).find(thePlotTheseTriggersToo_[
i]);
240 if (pos == 0) passed_HLT = HLTresults->accept(ti);
242 if (passed_HLT) h_triggers_passed->Fill(
i);
247 iEvent.
getByToken(thePhotonCollectionToken_, photonCollection);
250 if (!photonCollection.
isValid())
return;
256 for (
unsigned int ti = 0; ti < trigNames.
size(); ++ti) {
257 size_t pos = trigNames.
triggerName(ti).find(theTriggerPathToPass_);
259 passed_HLT = HLTresults->accept(ti);
266 for (PhotonCollection::const_iterator recoPhoton =
267 photonCollection->begin();
268 recoPhoton != photonCollection->end(); recoPhoton++) {
270 if (recoPhoton->et() < theMinPhotonEt_)
break;
272 h_photon_et_beforeCuts->Fill(recoPhoton->et());
290 iEvent.
getByToken(theVertexCollectionToken_, vertexHandle);
303 for (
unsigned int i = 0;
i < vertexCollection.size(); ++
i) {
304 if (vertexCollection[
i].isValid()) nvvertex++;
306 if (nvvertex == 0)
return;
320 iEvent.
getByToken(theBarrelRecHitToken_, EBReducedRecHits);
322 iEvent.
getByToken(theEndcapRecHitToken_, EEReducedRecHits);
324 theEndcapRecHitToken_);
327 float photon_et = -9.0;
328 float photon_eta = -9.0;
329 float photon_phi = -9.0;
330 bool photon_passPhotonID =
false;
331 bool found_lead_pho =
false;
332 int photon_count_bar = 0;
333 int photon_count_end = 0;
336 auto pho_maxet = std::max_element(
337 photonCollection->begin(), photonCollection->end(),
340 if (pho_maxet != photonCollection->end() &&
341 pho_maxet->et() >= theMinPhotonEt_) {
367 bool pho_current_passPhotonID =
false;
368 bool pho_current_isEB = pho_maxet->isEB();
369 bool pho_current_isEE = pho_maxet->isEE();
371 if (pho_current_isEB && (pho_maxet->sigmaIetaIeta() < 0.01 ||
372 pho_maxet->hadronicOverEm() < 0.05)) {
374 pho_current_passPhotonID =
true;
376 }
else if (pho_current_isEE && (pho_maxet->hadronicOverEm() < 0.05)) {
378 pho_current_passPhotonID =
true;
382 if (!found_lead_pho) {
383 found_lead_pho =
true;
384 photon_passPhotonID = pho_current_passPhotonID;
385 photon_et = pho_maxet->et();
386 photon_eta = pho_maxet->eta();
387 photon_phi = pho_maxet->phi();
394 if (theRequirePhotonFound_ &&
395 (!photon_passPhotonID || photon_et < theMinPhotonEt_))
401 iEvent.
getByToken(theJetCollectionToken_, jetCollection);
402 if (!jetCollection.
isValid())
return;
405 float jet_eta = -8.0;
406 float jet_phi = -8.0;
408 float jet2_pt = -9.0;
409 float jet2_eta = -9.0;
410 float jet2_phi = -9.0;
412 for (
unsigned int i_jet = 0; i_jet < jetCollection->size(); i_jet++) {
413 const Jet*
jet = &jetCollection->at(i_jet);
415 float jet_current_pt = jet->
pt();
418 if (
deltaR(jet->
eta(), jet->
phi(), photon_eta, photon_phi) < 0.5)
continue;
420 if (jet_current_pt < theMinJetPt_)
break;
423 if (jet_current_pt > jet_pt) {
429 jet_eta = jet->
eta();
430 jet_phi = jet->
phi();
431 }
else if (jet_current_pt > jet2_pt) {
432 jet2_pt = jet_current_pt;
433 jet2_eta = jet->
eta();
434 jet2_phi = jet->
phi();
446 h_photon_et->Fill(photon_et);
447 h_photon_eta->Fill(photon_eta);
448 h_photon_count_bar->Fill(photon_count_bar);
449 h_photon_count_end->Fill(photon_count_end);
452 if (fabs(photon_eta) < 1.45 &&
453 photon_passPhotonID) {
454 if (fabs(jet_eta) < 1.45) {
455 if (photon_eta * jet_eta > 0) {
456 h_photon_et_jetcs->Fill(photon_et);
458 h_photon_et_jetco->Fill(photon_et);
460 }
else if (jet_eta > 1.55 && jet_eta < 2.5) {
461 if (photon_eta * jet_eta > 0) {
462 h_photon_et_jetfs->Fill(photon_et);
464 h_photon_et_jetfo->Fill(photon_et);
470 h_jet_pt->Fill(jet_pt);
471 h_jet_eta->Fill(jet_eta);
472 h_jet_count->Fill(jet_count);
473 h_deltaPhi_photon_jet->Fill(
abs(
deltaPhi(photon_phi, jet_phi)));
475 h_deltaEt_photon_jet->Fill((photon_et - jet_pt) / photon_et);
479 h_jet2_pt->Fill(jet2_pt);
480 h_jet2_eta->Fill(jet2_eta);
481 h_jet2_ptOverPhotonEt->Fill(jet2_pt / photon_et);
482 h_deltaPhi_photon_jet2->Fill(
abs(
deltaPhi(photon_phi, jet2_phi)));
483 h_deltaPhi_jet_jet2->Fill(
abs(
deltaPhi(jet_phi, jet2_phi)));
484 h_deltaR_jet_jet2->Fill(
deltaR(jet_eta, jet_phi, jet2_eta, jet2_phi));
485 h_deltaR_photon_jet2->Fill(
486 deltaR(photon_eta, photon_phi, jet2_eta, jet2_phi));
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
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