60 theTriggerPathToPass_ = parameters.
getParameter<
string>(
"triggerPathToPass");
61 thePlotTheseTriggersToo_ =
62 parameters.
getParameter<vector<string> >(
"plotTheseTriggersToo");
64 trigTagToken_ = consumes<edm::TriggerResults>(
66 thePhotonCollectionToken_ = consumes<reco::PhotonCollection>(
68 theJetCollectionToken_ = consumes<edm::View<reco::Jet> >(
70 theVertexCollectionToken_ = consumes<reco::VertexCollection>(
72 theMinJetPt_ = parameters.
getParameter<
double>(
"minJetPt");
73 theMinPhotonEt_ = parameters.
getParameter<
double>(
"minPhotonEt");
74 theRequirePhotonFound_ = parameters.
getParameter<
bool>(
"requirePhotonFound");
75 thePlotPhotonMaxEt_ = parameters.
getParameter<
double>(
"plotPhotonMaxEt");
76 thePlotPhotonMaxEta_ = parameters.
getParameter<
double>(
"plotPhotonMaxEta");
77 thePlotJetMaxEta_ = parameters.
getParameter<
double>(
"plotJetMaxEta");
80 theBarrelRecHitToken_ = consumes<EcalRecHitCollection>(
82 theEndcapRecHitToken_ = consumes<EcalRecHitCollection>(
86 h_deltaEt_photon_jet = 0;
87 h_deltaPhi_jet_jet2 = 0;
88 h_deltaPhi_photon_jet = 0;
89 h_deltaPhi_photon_jet2 = 0;
90 h_deltaR_jet_jet2 = 0;
91 h_deltaR_photon_jet2 = 0;
94 h_jet2_ptOverPhotonEt = 0;
98 h_photon_count_bar = 0;
99 h_photon_count_end = 0;
101 h_photon_et_beforeCuts = 0;
102 h_photon_et_jetco = 0;
103 h_photon_et_jetcs = 0;
104 h_photon_et_jetfo = 0;
105 h_photon_et_jetfs = 0;
107 h_triggers_passed = 0;
117 logTraceName =
"QcdPhotonAnalyzer";
119 LogTrace(logTraceName) <<
"Parameters initialization";
123 std::stringstream aStringStream;
125 aStringStream << theMinJetPt_;
126 aString = aStringStream.str();
129 int numOfTriggersToMonitor = thePlotTheseTriggersToo_.size();
130 h_triggers_passed = ibooker.
book1D(
"triggers_passed",
131 "Events passing these trigger paths", numOfTriggersToMonitor,
132 0, numOfTriggersToMonitor);
133 for (
int i = 0;
i < numOfTriggersToMonitor;
i++) {
134 h_triggers_passed->
setBinLabel(
i + 1, thePlotTheseTriggersToo_[
i]);
138 h_photon_et_beforeCuts = ibooker.
book1D(
"photon_et_beforeCuts",
139 "#gamma with highest E_{T};E_{T}(#gamma) (GeV)", 20, 0., thePlotPhotonMaxEt_);
140 h_photon_et = ibooker.
book1D(
"photon_et",
141 "#gamma with highest E_{T};E_{T}(#gamma) (GeV)", 20, 0., thePlotPhotonMaxEt_);
142 h_photon_eta = ibooker.
book1D(
"photon_eta",
143 "#gamma with highest E_{T};#eta(#gamma)", 40,
144 -thePlotPhotonMaxEta_, thePlotPhotonMaxEta_);
145 h_photon_count_bar = ibooker.
book1D(
"photon_count_bar",
146 "Number of #gamma's passing selection (Barrel);Number of #gamma's", 8,
148 h_photon_count_end = ibooker.
book1D(
"photon_count_end",
149 "Number of #gamma's passing selection (Endcap);Number of #gamma's", 8,
151 h_jet_pt = ibooker.
book1D(
"jet_pt",
152 "Jet with highest p_{T} (from " + theJetCollectionLabel_.label() +
153 ");p_{T}(1^{st} jet) (GeV)", 20, 0., thePlotPhotonMaxEt_);
154 h_jet_eta = ibooker.
book1D(
"jet_eta",
155 "Jet with highest p_{T} (from " + theJetCollectionLabel_.label() +
156 ");#eta(1^{st} jet)", 20, -thePlotJetMaxEta_, thePlotJetMaxEta_);
157 h_deltaPhi_photon_jet = ibooker.
book1D(
"deltaPhi_photon_jet",
158 "#Delta#phi between Highest E_{T} #gamma and jet;#Delta#phi(#gamma,1^{st} jet)",
160 h_deltaPhi_jet_jet2 = ibooker.
book1D(
"deltaPhi_jet_jet2",
161 "#Delta#phi between Highest E_{T} jet and 2^{nd} "
162 "jet;#Delta#phi(1^{st} jet,2^{nd} jet)",
164 h_deltaEt_photon_jet = ibooker.
book1D(
"deltaEt_photon_jet",
165 "(E_{T}(#gamma)-p_{T}(jet))/E_{T}(#gamma) when #Delta#phi(#gamma,1^{st} "
166 "jet) > 2.8;#DeltaE_{T}(#gamma,1^{st} jet)/E_{T}(#gamma)",
168 h_jet_count = ibooker.
book1D(
"jet_count",
169 "Number of " + theJetCollectionLabel_.label() +
" (p_{T} > " + aString +
170 " GeV);Number of Jets", 8, -0.5, 7.5);
171 h_jet2_pt = ibooker.
book1D(
"jet2_pt",
172 "Jet with 2^{nd} highest p_{T} (from " + theJetCollectionLabel_.label() +
173 ");p_{T}(2^{nd} jet) (GeV)", 20, 0., thePlotPhotonMaxEt_);
174 h_jet2_eta = ibooker.
book1D(
"jet2_eta",
175 "Jet with 2^{nd} highest p_{T} (from " + theJetCollectionLabel_.label() +
176 ");#eta(2^{nd} jet)", 20, -thePlotJetMaxEta_, thePlotJetMaxEta_);
177 h_jet2_ptOverPhotonEt = ibooker.
book1D(
"jet2_ptOverPhotonEt",
178 "p_{T}(2^{nd} highest jet) / E_{T}(#gamma);p_{T}(2^{nd} Jet)/E_{T}(#gamma)",
180 h_deltaPhi_photon_jet2 = ibooker.
book1D(
"deltaPhi_photon_jet2",
181 "#Delta#phi between Highest E_{T} #gamma and 2^{nd} "
182 "highest jet;#Delta#phi(#gamma,2^{nd} jet)", 20, 0, 3.1415926);
183 h_deltaR_jet_jet2 = ibooker.
book1D(
"deltaR_jet_jet2",
184 "#DeltaR between Highest Jet and 2^{nd} Highest;#DeltaR(1^{st} jet,2^{nd} jet)",
186 h_deltaR_photon_jet2 = ibooker.
book1D(
"deltaR_photon_jet2",
187 "#DeltaR between Highest E_{T} #gamma and 2^{nd} "
188 "jet;#DeltaR(#gamma, 2^{nd} jet)", 30, 0, 6.0);
191 Float_t bins_et[] = {15, 20, 30, 50, 80};
193 h_photon_et_jetcs = ibooker.
book1D(
"photon_et_jetcs",
194 "#gamma with highest E_{T} (#eta(jet)<1.45, "
195 "#eta(#gamma)#eta(jet)>0);E_{T}(#gamma) (GeV)", num_bins_et, bins_et);
196 h_photon_et_jetco = ibooker.
book1D(
"photon_et_jetco",
197 "#gamma with highest E_{T} (#eta(jet)<1.45, "
198 "#eta(#gamma)#eta(jet)<0);E_{T}(#gamma) (GeV)", num_bins_et, bins_et);
199 h_photon_et_jetfs = ibooker.
book1D(
"photon_et_jetfs",
200 "#gamma with highest E_{T} (1.55<#eta(jet)<2.5, "
201 "#eta(#gamma)#eta(jet)>0);E_{T}(#gamma) (GeV)", num_bins_et, bins_et);
202 h_photon_et_jetfo = ibooker.
book1D(
"photon_et_jetfo",
203 "#gamma with highest E_{T} (1.55<#eta(jet)<2.5, "
204 "#eta(#gamma)#eta(jet)<0);E_{T}(#gamma) (GeV)", num_bins_et, bins_et);
207 if (
me->getTH1F()->GetSumw2N() == 0) {
208 me->getTH1F()->Sumw2();
212 setSumw2(h_photon_et_jetcs);
213 setSumw2(h_photon_et_jetco);
214 setSumw2(h_photon_et_jetfs);
215 setSumw2(h_photon_et_jetfo);
219 LogTrace(logTraceName) <<
"Analysis of event # ";
231 bool passed_HLT =
false;
235 for (
unsigned int i = 0;
i < thePlotTheseTriggersToo_.size();
i++) {
237 for (
unsigned int ti = 0; (ti < trigNames.
size()) && !passed_HLT; ++ti) {
238 size_t pos = trigNames.
triggerName(ti).find(thePlotTheseTriggersToo_[
i]);
239 if (pos == 0) passed_HLT = HLTresults->accept(ti);
241 if (passed_HLT) h_triggers_passed->Fill(
i);
246 iEvent.
getByToken(thePhotonCollectionToken_, photonCollection);
249 if (!photonCollection.
isValid())
return;
255 for (
unsigned int ti = 0; ti < trigNames.
size(); ++ti) {
256 size_t pos = trigNames.
triggerName(ti).find(theTriggerPathToPass_);
258 passed_HLT = HLTresults->accept(ti);
265 for (PhotonCollection::const_iterator recoPhoton =
266 photonCollection->begin();
267 recoPhoton != photonCollection->end(); recoPhoton++) {
269 if (recoPhoton->et() < theMinPhotonEt_)
break;
271 h_photon_et_beforeCuts->Fill(recoPhoton->et());
289 iEvent.
getByToken(theVertexCollectionToken_, vertexHandle);
302 for (
unsigned int i = 0;
i < vertexCollection.size(); ++
i) {
303 if (vertexCollection[
i].isValid()) nvvertex++;
305 if (nvvertex == 0)
return;
319 iEvent.
getByToken(theBarrelRecHitToken_, EBReducedRecHits);
321 iEvent.
getByToken(theEndcapRecHitToken_, EEReducedRecHits);
323 theEndcapRecHitToken_);
326 float photon_et = -9.0;
327 float photon_eta = -9.0;
328 float photon_phi = -9.0;
329 bool photon_passPhotonID =
false;
330 bool found_lead_pho =
false;
331 int photon_count_bar = 0;
332 int photon_count_end = 0;
335 auto pho_maxet = std::max_element(
336 photonCollection->begin(), photonCollection->end(),
339 if (pho_maxet != photonCollection->end() &&
340 pho_maxet->et() >= theMinPhotonEt_) {
366 bool pho_current_passPhotonID =
false;
367 bool pho_current_isEB = pho_maxet->isEB();
368 bool pho_current_isEE = pho_maxet->isEE();
370 if (pho_current_isEB && (pho_maxet->sigmaIetaIeta() < 0.01 ||
371 pho_maxet->hadronicOverEm() < 0.05)) {
373 pho_current_passPhotonID =
true;
375 }
else if (pho_current_isEE && (pho_maxet->hadronicOverEm() < 0.05)) {
377 pho_current_passPhotonID =
true;
381 if (!found_lead_pho) {
382 found_lead_pho =
true;
383 photon_passPhotonID = pho_current_passPhotonID;
384 photon_et = pho_maxet->et();
385 photon_eta = pho_maxet->eta();
386 photon_phi = pho_maxet->phi();
393 if (theRequirePhotonFound_ &&
394 (!photon_passPhotonID || photon_et < theMinPhotonEt_))
400 iEvent.
getByToken(theJetCollectionToken_, jetCollection);
401 if (!jetCollection.
isValid())
return;
404 float jet_eta = -8.0;
405 float jet_phi = -8.0;
407 float jet2_pt = -9.0;
408 float jet2_eta = -9.0;
409 float jet2_phi = -9.0;
411 for (
unsigned int i_jet = 0; i_jet < jetCollection->size(); i_jet++) {
412 const Jet*
jet = &jetCollection->at(i_jet);
414 float jet_current_pt = jet->
pt();
417 if (
deltaR(jet->
eta(), jet->
phi(), photon_eta, photon_phi) < 0.5)
continue;
419 if (jet_current_pt < theMinJetPt_)
break;
422 if (jet_current_pt > jet_pt) {
428 jet_eta = jet->
eta();
429 jet_phi = jet->
phi();
430 }
else if (jet_current_pt > jet2_pt) {
431 jet2_pt = jet_current_pt;
432 jet2_eta = jet->
eta();
433 jet2_phi = jet->
phi();
445 h_photon_et->Fill(photon_et);
446 h_photon_eta->Fill(photon_eta);
447 h_photon_count_bar->Fill(photon_count_bar);
448 h_photon_count_end->Fill(photon_count_end);
451 if (fabs(photon_eta) < 1.45 &&
452 photon_passPhotonID) {
453 if (fabs(jet_eta) < 1.45) {
454 if (photon_eta * jet_eta > 0) {
455 h_photon_et_jetcs->Fill(photon_et);
457 h_photon_et_jetco->Fill(photon_et);
459 }
else if (jet_eta > 1.55 && jet_eta < 2.5) {
460 if (photon_eta * jet_eta > 0) {
461 h_photon_et_jetfs->Fill(photon_et);
463 h_photon_et_jetfo->Fill(photon_et);
469 h_jet_pt->Fill(jet_pt);
470 h_jet_eta->Fill(jet_eta);
471 h_jet_count->Fill(jet_count);
472 h_deltaPhi_photon_jet->Fill(
abs(
deltaPhi(photon_phi, jet_phi)));
474 h_deltaEt_photon_jet->Fill((photon_et - jet_pt) / photon_et);
478 h_jet2_pt->Fill(jet2_pt);
479 h_jet2_eta->Fill(jet2_eta);
480 h_jet2_ptOverPhotonEt->Fill(jet2_pt / photon_et);
481 h_deltaPhi_photon_jet2->Fill(
abs(
deltaPhi(photon_phi, jet2_phi)));
482 h_deltaPhi_jet_jet2->Fill(
abs(
deltaPhi(jet_phi, jet2_phi)));
483 h_deltaR_jet_jet2->Fill(
deltaR(jet_eta, jet_phi, jet2_eta, jet2_phi));
484 h_deltaR_photon_jet2->Fill(
485 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)
virtual double phi() const final
momentum azimuthal angle
std::vector< Vertex > VertexCollection
collection of Vertex objects
Strings::size_type size() const
QcdPhotonsDQM(const edm::ParameterSet &)
Constructor.
Container::value_type value_type
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
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
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
virtual ~QcdPhotonsDQM()
Destructor.
virtual double eta() const final
momentum pseudorapidity
void analyze(const edm::Event &, const edm::EventSetup &)
Get the analysis.
virtual double pt() const final
transverse momentum