CMS 3D CMS Logo

B2GDQM.cc
Go to the documentation of this file.
2 
3 #include <memory>
4 
5 // DQM
7 
8 // Framework
17 
18 // Candidate handling
25 
26 // Vertex utilities
29 
30 // Other
34 
35 // Math
43 
44 // vertexing
45 
46 // Transient tracks
54 
55 // ROOT
56 #include "TLorentzVector.h"
57 
58 // STDLIB
59 #include <iostream>
60 #include <iomanip>
61 #include <cstdio>
62 #include <string>
63 #include <sstream>
64 #include <cmath>
65 
66 using namespace edm;
67 using namespace std;
68 using namespace reco;
69 using namespace trigger;
70 
71 //
72 // -- Constructor
73 //
75  edm::LogInfo("B2GDQM") << " Starting B2GDQM "
76  << "\n";
77 
78  typedef std::vector<edm::InputTag> vtag;
79 
80  // Get parameters from configuration file
81  // Trigger
82  theTriggerResultsCollection = ps.getParameter<InputTag>("triggerResultsCollection");
83  triggerToken_ = consumes<edm::TriggerResults>(theTriggerResultsCollection);
84 
85  // Jets
86  jetLabels_ = ps.getParameter<std::vector<edm::InputTag> >("jetLabels");
87  for (std::vector<edm::InputTag>::const_iterator jetlabel = jetLabels_.begin(), jetlabelEnd = jetLabels_.end();
88  jetlabel != jetlabelEnd;
89  ++jetlabel) {
90  jetTokens_.push_back(consumes<edm::View<reco::Jet> >(*jetlabel));
91  }
92  sdjetLabel_ = ps.getParameter<edm::InputTag>("sdjetLabel");
93  sdjetToken_ = consumes<edm::View<reco::BasicJet> >(sdjetLabel_);
94 
95  muonToken_ = consumes<edm::View<reco::Muon> >(ps.getParameter<edm::InputTag>("muonSrc"));
96  electronToken_ = consumes<edm::View<reco::GsfElectron> >(ps.getParameter<edm::InputTag>("electronSrc"));
97 
98  jetPtMins_ = ps.getParameter<std::vector<double> >("jetPtMins");
99  allHadPtCut_ = ps.getParameter<double>("allHadPtCut");
100  allHadRapidityCut_ = ps.getParameter<double>("allHadRapidityCut");
101  allHadDeltaPhiCut_ = ps.getParameter<double>("allHadDeltaPhiCut");
102 
103  semiMu_HadJetPtCut_ = ps.getParameter<double>("semiMu_HadJetPtCut");
104  semiMu_LepJetPtCut_ = ps.getParameter<double>("semiMu_LepJetPtCut");
105  semiMu_dphiHadCut_ = ps.getParameter<double>("semiMu_dphiHadCut");
106  semiMu_dRMin_ = ps.getParameter<double>("semiMu_dRMin");
107  semiMu_ptRel_ = ps.getParameter<double>("semiMu_ptRel");
108  muonSelect_ = std::make_shared<StringCutObjectSelector<reco::Muon> >(
109 
110  ps.getParameter<std::string>("muonSelect"));
111 
112  semiE_HadJetPtCut_ = ps.getParameter<double>("semiE_HadJetPtCut");
113  semiE_LepJetPtCut_ = ps.getParameter<double>("semiE_LepJetPtCut");
114  semiE_dphiHadCut_ = ps.getParameter<double>("semiE_dphiHadCut");
115  semiE_dRMin_ = ps.getParameter<double>("semiE_dRMin");
116  semiE_ptRel_ = ps.getParameter<double>("semiE_ptRel");
117  elecSelect_ = std::make_shared<StringCutObjectSelector<reco::GsfElectron> >(
118 
119  ps.getParameter<std::string>("elecSelect"));
120 
121  PFJetCorService_ = ps.getParameter<std::string>("PFJetCorService");
122 
123  // MET
124  PFMETLabel_ = ps.getParameter<InputTag>("pfMETCollection");
125  PFMETToken_ = consumes<std::vector<reco::PFMET> >(PFMETLabel_);
126 }
127 
128 //
129 // -- Destructor
130 //
132  edm::LogInfo("B2GDQM") << " Deleting B2GDQM "
133  << "\n";
134 }
135 
136 //
137 // -- Book histograms
138 //
140  bei.setCurrentFolder("Physics/B2G");
141 
142  //--- Jets
143 
144  for (unsigned int icoll = 0; icoll < jetLabels_.size(); ++icoll) {
145  std::stringstream ss;
146  ss << "Physics/B2G/" << jetLabels_[icoll].label();
147  bei.setCurrentFolder(ss.str());
148  pfJet_pt.push_back(bei.book1D("pfJet_pt", "Pt of PFJet (GeV)", 50, 0.0, 1000));
149  pfJet_y.push_back(bei.book1D("pfJet_y", "Rapidity of PFJet", 60, -6.0, 6.0));
150  pfJet_phi.push_back(bei.book1D("pfJet_phi", "#phi of PFJet (radians)", 60, -3.14159, 3.14159));
151  pfJet_m.push_back(bei.book1D("pfJet_m", "Mass of PFJet (GeV)", 50, 0.0, 500));
152  pfJet_chef.push_back(bei.book1D("pfJet_pfchef", "PFJetID CHEF", 50, 0.0, 1.0));
153  pfJet_nhef.push_back(bei.book1D("pfJet_pfnhef", "PFJetID NHEF", 50, 0.0, 1.0));
154  pfJet_cemf.push_back(bei.book1D("pfJet_pfcemf", "PFJetID CEMF", 50, 0.0, 1.0));
155  pfJet_nemf.push_back(bei.book1D("pfJet_pfnemf", "PFJetID NEMF", 50, 0.0, 1.0));
156 
157  boostedJet_subjetPt.push_back(bei.book1D("boostedJet_subjetPt", "Pt of subjets (GeV)", 50, 0.0, 500));
158  boostedJet_subjetY.push_back(bei.book1D("boostedJet_subjetY", "Rapidity of subjets", 60, -6.0, 6.0));
159  boostedJet_subjetPhi.push_back(
160  bei.book1D("boostedJet_subjetPhi", "#phi of subjets (radians)", 60, -3.14159, 3.14159));
161  boostedJet_subjetM.push_back(bei.book1D("boostedJet_subjetM", "Mass of subjets (GeV)", 50, 0.0, 250.));
162  boostedJet_subjetN.push_back(bei.book1D("boostedJet_subjetN", "Number of subjets", 10, 0, 10));
163  boostedJet_massDrop.push_back(bei.book1D("boostedJet_massDrop", "Mass drop for W-like jets", 50, 0.0, 1.0));
164  boostedJet_wMass.push_back(bei.book1D("boostedJet_wMass", "W Mass for top-like jets", 50, 0.0, 250.0));
165  }
166 
167  bei.setCurrentFolder("Physics/B2G/MET");
168  pfMet_pt = bei.book1D("pfMet_pt", "Pf Missing p_{T}; GeV", 50, 0.0, 500);
169  pfMet_phi = bei.book1D("pfMet_phi", "Pf Missing p_{T} #phi;#phi (radians)", 35, -3.5, 3.5);
170 
171  //--- Mu+Jets
172  bei.setCurrentFolder("Physics/B2G/SemiMu");
173  semiMu_muPt = bei.book1D("semiMu_muPt", "Pt of Muon in #mu+Jets Channel (GeV)", 50, 0.0, 1000);
174  semiMu_muEta = bei.book1D("semiMu_muEta", "#eta of Muon in #mu+Jets Channel", 60, -6.0, 6.0);
175  semiMu_muPhi = bei.book1D("semiMu_muPhi", "#phi of Muon in #mu+Jets Channel (radians)", 60, -3.14159, 3.14159);
176  semiMu_muDRMin = bei.book1D("semiMu_muDRMin", "#Delta R(E,nearest jet) in #mu+Jets Channel", 50, 0, 10.0);
177  semiMu_muPtRel = bei.book1D("semiMu_muPtRel", "p_{T}^{REL} in #mu+Jets Channel", 60, 0, 300.);
178  semiMu_hadJetDR = bei.book1D("semiMu_hadJetDR", "#Delta R(E,had jet) in #mu+Jets Channel", 50, 0, 10.0);
179  semiMu_hadJetPt =
180  bei.book1D("semiMu_hadJetPt", "Pt of Leading Hadronic Jet in #mu+Jets Channel (GeV)", 50, 0.0, 1000);
181  semiMu_hadJetY = bei.book1D("semiMu_hadJetY", "Rapidity of Leading Hadronic Jet in #mu+Jets Channel", 60, -6.0, 6.0);
182  semiMu_hadJetPhi = bei.book1D(
183  "semiMu_hadJetPhi", "#phi of Leading Hadronic Jet in #mu+Jets Channel (radians)", 60, -3.14159, 3.14159);
184  semiMu_hadJetMass =
185  bei.book1D("semiMu_hadJetMass", "Mass of Leading Hadronic Jet in #mu+Jets Channel (GeV)", 50, 0.0, 500);
186  semiMu_hadJetWMass =
187  bei.book1D("semiMu_hadJetwMass", "W Mass for Leading Hadronic Jet in #mu+Jets Channel (GeV)", 50, 0.0, 250.0);
188  semiMu_mttbar = bei.book1D("semiMu_mttbar", "Mass of #mu+Jets ttbar Candidate", 100, 0., 5000.);
189 
190  //--- E+Jets
191  bei.setCurrentFolder("Physics/B2G/SemiE");
192  semiE_ePt = bei.book1D("semiE_ePt", "Pt of Electron in e+Jets Channel (GeV)", 50, 0.0, 1000);
193  semiE_eEta = bei.book1D("semiE_eEta", "#eta of Electron in e+Jets Channel", 60, -6.0, 6.0);
194  semiE_ePhi = bei.book1D("semiE_ePhi", "#phi of Electron in e+Jets Channel (radians)", 60, -3.14159, 3.14159);
195  semiE_eDRMin = bei.book1D("semiE_eDRMin", "#Delta R(E,nearest jet) in e+Jets Channel", 50, 0, 10.0);
196  semiE_ePtRel = bei.book1D("semiE_ePtRel", "p_{T}^{REL} in e+Jets Channel", 60, 0, 300.);
197  semiE_hadJetDR = bei.book1D("semiE_hadJetDR", "#Delta R(E,had jet) in e+Jets Channel", 50, 0, 10.0);
198  semiE_hadJetPt = bei.book1D("semiE_hadJetPt", "Pt of Leading Hadronic Jet in e+Jets Channel (GeV)", 50, 0.0, 1000);
199  semiE_hadJetY = bei.book1D("semiE_hadJetY", "Rapidity of Leading Hadronic Jet in e+Jets Channel", 60, -6.0, 6.0);
200  semiE_hadJetPhi =
201  bei.book1D("semiE_hadJetPhi", "#phi of Leading Hadronic Jet in e+Jets Channel (radians)", 60, -3.14159, 3.14159);
202  semiE_hadJetMass =
203  bei.book1D("semiE_hadJetMass", "Mass of Leading Hadronic Jet in e+Jets Channel (GeV)", 50, 0.0, 500);
204  semiE_hadJetWMass =
205  bei.book1D("semiE_hadJetwMass", "W Mass for Leading Hadronic Jet in e+Jets Channel (GeV)", 50, 0.0, 250.0);
206  semiE_mttbar = bei.book1D("semiE_mttbar", "Mass of e+Jets ttbar Candidate", 100, 0., 5000.);
207 
208  //--- All-hadronic
209  bei.setCurrentFolder("Physics/B2G/AllHad");
210  allHad_pt0 = bei.book1D("allHad_pt0", "Pt of Leading All-Hadronic PFJet (GeV)", 50, 0.0, 1000);
211  allHad_y0 = bei.book1D("allHad_y0", "Rapidity of Leading All-Hadronic PFJet", 60, -6.0, 6.0);
212  allHad_phi0 = bei.book1D("allHad_phi0", "#phi of Leading All-Hadronic PFJet (radians)", 60, -3.14159, 3.14159);
213  allHad_mass0 = bei.book1D("allHad_mass0", "Mass of Leading All-Hadronic PFJet (GeV)", 50, 0.0, 500);
214  allHad_wMass0 = bei.book1D("allHad_wMass0", "W Mass for Leading All-Hadronic PFJet (GeV)", 50, 0.0, 250.0);
215  allHad_pt1 = bei.book1D("allHad_pt1", "Pt of Subleading All-Hadronic PFJet (GeV)", 50, 0.0, 1000);
216  allHad_y1 = bei.book1D("allHad_y1", "Rapidity of Subleading All-Hadronic PFJet", 60, -6.0, 6.0);
217  allHad_phi1 = bei.book1D("allHad_phi1", "#phi of Subleading All-Hadronic PFJet (radians)", 60, -3.14159, 3.14159);
218  allHad_mass1 = bei.book1D("allHad_mass1", "Mass of Subleading All-Hadronic PFJet (GeV)", 50, 0.0, 500);
219  allHad_wMass1 = bei.book1D("allHad_wMass1", "W Mass for Subleading All-Hadronic PFJet (GeV)", 50, 0.0, 250.0);
220  allHad_mttbar = bei.book1D("allHad_mttbar", "Mass of All-Hadronic ttbar Candidate", 100, 0., 5000.);
221 }
222 
223 //
224 // -- Analyze
225 //
226 void B2GDQM::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
227  analyzeJets(iEvent, iSetup);
228  analyzeSemiMu(iEvent, iSetup);
229  analyzeSemiE(iEvent, iSetup);
230  analyzeAllHad(iEvent, iSetup);
231 }
232 
233 void B2GDQM::analyzeJets(const Event& iEvent, const edm::EventSetup& iSetup) {
234  // Loop over the different types of jets,
235  // Loop over the jets in that collection,
236  // fill PF jet information as well as substructure
237  // information for boosted jets.
238  // Utilizes the CMS top-tagging algorithm and the "mass drop" W-tagger.
239  for (unsigned int icoll = 0; icoll < jetLabels_.size(); ++icoll) {
241  bool ValidPFJets = iEvent.getByToken(jetTokens_[icoll], pfJetCollection);
242  if (!ValidPFJets)
243  continue;
244  edm::View<reco::Jet> const& pfjets = *pfJetCollection;
245 
246  // Jet Correction
247 
248  for (edm::View<reco::Jet>::const_iterator jet = pfjets.begin(), jetEnd = pfjets.end(); jet != jetEnd; ++jet) {
249  if (jet->pt() < jetPtMins_[icoll])
250  continue;
251  pfJet_pt[icoll]->Fill(jet->pt());
252  pfJet_y[icoll]->Fill(jet->rapidity());
253  pfJet_phi[icoll]->Fill(jet->phi());
254  pfJet_m[icoll]->Fill(jet->mass());
255 
256  // Dynamic cast the base class (reco::Jet) to the derived class (PFJet)
257  // to access the PFJet information
258  reco::PFJet const* pfjet = dynamic_cast<reco::PFJet const*>(&*jet);
259 
260  if (pfjet != nullptr) {
261  pfJet_chef[icoll]->Fill(pfjet->chargedHadronEnergyFraction());
262  pfJet_nhef[icoll]->Fill(pfjet->neutralHadronEnergyFraction());
263  pfJet_cemf[icoll]->Fill(pfjet->chargedEmEnergyFraction());
264  pfJet_nemf[icoll]->Fill(pfjet->neutralEmEnergyFraction());
265  }
266 
267  // Dynamic cast the base class (reco::Jet) to the derived class (BasicJet)
268  // to access the substructure information
269  reco::BasicJet const* basicjet = dynamic_cast<reco::BasicJet const*>(&*jet);
270 
271  if (basicjet != nullptr) {
272  boostedJet_subjetN[icoll]->Fill(jet->numberOfDaughters());
273 
274  for (unsigned int ida = 0; ida < jet->numberOfDaughters(); ++ida) {
275  reco::Candidate const* subjet = jet->daughter(ida);
276  boostedJet_subjetPt[icoll]->Fill(subjet->pt());
277  boostedJet_subjetY[icoll]->Fill(subjet->rapidity());
278  boostedJet_subjetPhi[icoll]->Fill(subjet->phi());
279  boostedJet_subjetM[icoll]->Fill(subjet->mass());
280  }
281  // Check the various tagging algorithms
282  if ((jetLabels_[icoll].label() == "ak8PFJetsPuppiSoftdrop")) {
283  if (jet->numberOfDaughters() > 1) {
284  reco::Candidate const* da0 = jet->daughter(0);
285  reco::Candidate const* da1 = jet->daughter(1);
286  if (da0->mass() > da1->mass()) {
287  boostedJet_wMass[icoll]->Fill(da0->mass());
288  boostedJet_massDrop[icoll]->Fill(da0->mass() / jet->mass());
289  } else {
290  boostedJet_wMass[icoll]->Fill(da1->mass());
291  boostedJet_massDrop[icoll]->Fill(da1->mass() / jet->mass());
292  }
293 
294  } else {
295  boostedJet_massDrop[icoll]->Fill(-1.0);
296  }
297 
298  } // end if collection is AK8 PFJets Puppi soft-drop
299 
300  } // end if basic jet != 0
301  }
302  }
303 
304  // PFMETs
306  bool ValidPFMET = iEvent.getByToken(PFMETToken_, pfMETCollection);
307  if (!ValidPFMET)
308  return;
309 
310  pfMet_pt->Fill((*pfMETCollection)[0].pt());
311  pfMet_phi->Fill((*pfMETCollection)[0].phi());
312 }
313 
314 void B2GDQM::analyzeAllHad(const Event& iEvent, const edm::EventSetup& iSetup) {
316  bool validJets = iEvent.getByToken(sdjetToken_, jetCollection);
317  if (!validJets)
318  return;
319 
320  // Require two back-to-back jets at high pt with |delta y| < 1.0
321  if (jetCollection->size() < 2)
322  return;
323  edm::Ptr<reco::BasicJet> jet0 = jetCollection->ptrAt(0);
324  edm::Ptr<reco::BasicJet> jet1 = jetCollection->ptrAt(1);
325  if (jet0.isAvailable() == false || jet1.isAvailable() == false)
326  return;
327  if (jet0->pt() < allHadPtCut_ || jet1->pt() < allHadPtCut_)
328  return;
329  if (std::abs(jet0->rapidity() - jet1->rapidity()) > allHadRapidityCut_)
330  return;
331  if (std::abs(reco::deltaPhi(jet0->phi(), jet1->phi())) < M_PI * 0.5)
332  return;
333 
334  allHad_pt0->Fill(jet0->pt());
335  allHad_y0->Fill(jet0->rapidity());
336  allHad_phi0->Fill(jet0->phi());
337  allHad_mass0->Fill(jet0->mass());
338  if (jet0->numberOfDaughters() > 2) {
339  double wMass =
340  jet0->daughter(0)->mass() >= jet0->daughter(1)->mass() ? jet0->daughter(0)->mass() : jet0->daughter(1)->mass();
341  allHad_wMass0->Fill(wMass);
342  } else {
343  allHad_wMass0->Fill(-1.0);
344  }
345 
346  allHad_pt1->Fill(jet1->pt());
347  allHad_y1->Fill(jet1->rapidity());
348  allHad_phi1->Fill(jet1->phi());
349  allHad_mass1->Fill(jet1->mass());
350  if (jet1->numberOfDaughters() > 2) {
351  double wMass =
352  jet1->daughter(0)->mass() >= jet1->daughter(1)->mass() ? jet1->daughter(0)->mass() : jet1->daughter(1)->mass();
353  allHad_wMass1->Fill(wMass);
354  } else {
355  allHad_wMass1->Fill(-1.0);
356  }
357 
358  auto p4cand = (jet0->p4() + jet1->p4());
359  allHad_mttbar->Fill(p4cand.mass());
360 }
361 
362 void B2GDQM::analyzeSemiMu(const Event& iEvent, const edm::EventSetup& iSetup) {
364  bool validMuons = iEvent.getByToken(muonToken_, muonCollection);
365 
366  if (!validMuons)
367  return;
368  if (muonCollection->empty())
369  return;
370  reco::Muon const& muon = muonCollection->at(0);
371  if (!(*muonSelect_)(muon))
372  return;
373 
375  bool validJets = iEvent.getByToken(sdjetToken_, jetCollection);
376  if (!validJets)
377  return;
378  if (jetCollection->size() < 2)
379  return;
380 
381  double pt0 = -1.0;
382  double dRMin = 999.0;
383  edm::Ptr<reco::BasicJet> hadJet; // highest pt jet with dphi(lep,jet) > pi/2
384  edm::Ptr<reco::BasicJet> lepJet; // closest jet to lepton with pt > ptMin
385 
386  for (auto ijet = jetCollection->begin(), ijetBegin = ijet, ijetEnd = jetCollection->end(); ijet != ijetEnd; ++ijet) {
387  // Hadronic jets
388  if (std::abs(reco::deltaPhi(muon, *ijet)) > M_PI * 0.5) {
389  if (ijet->pt() > pt0 && ijet->p() > semiMu_HadJetPtCut_) {
390  hadJet = jetCollection->ptrAt(ijet - ijetBegin);
391  pt0 = hadJet->pt();
392  }
393  }
394  // Leptonic jets
395  else if (ijet->pt() > semiMu_LepJetPtCut_) {
396  auto idRMin = reco::deltaR(muon, *ijet);
397  if (idRMin < dRMin) {
398  lepJet = jetCollection->ptrAt(ijet - ijetBegin);
399  dRMin = idRMin;
400  }
401  }
402  }
403  if (hadJet.isAvailable() == false || lepJet.isAvailable() == false)
404  return;
405 
406  auto lepJetP4 = lepJet->p4();
407  const auto& muonP4 = muon.p4();
408 
409  double tot = lepJetP4.mag2();
410  double ss = muonP4.Dot(lepJet->p4());
411  double per = muonP4.mag2();
412  if (tot > 0.0)
413  per -= ss * ss / tot;
414  if (per < 0)
415  per = 0;
416  double ptRel = per;
417  bool pass2D = dRMin > semiMu_dRMin_ || ptRel > semiMu_ptRel_;
418 
419  if (!pass2D)
420  return;
421 
422  semiMu_muPt->Fill(muon.pt());
423  semiMu_muEta->Fill(muon.eta());
424  semiMu_muPhi->Fill(muon.phi());
425  semiMu_muDRMin->Fill(dRMin);
426  semiMu_muPtRel->Fill(ptRel);
427 
428  semiMu_hadJetDR->Fill(reco::deltaR(muon, *hadJet));
429  semiMu_mttbar->Fill(0.0);
430 
431  semiMu_hadJetPt->Fill(hadJet->pt());
432  semiMu_hadJetY->Fill(hadJet->rapidity());
433  semiMu_hadJetPhi->Fill(hadJet->phi());
434  semiMu_hadJetMass->Fill(hadJet->mass());
435  if (hadJet->numberOfDaughters() > 2) {
436  double wMass = hadJet->daughter(0)->mass() >= hadJet->daughter(1)->mass() ? hadJet->daughter(0)->mass()
437  : hadJet->daughter(1)->mass();
438  semiMu_hadJetWMass->Fill(wMass);
439  } else {
440  semiMu_hadJetWMass->Fill(-1.0);
441  }
442 }
443 
444 void B2GDQM::analyzeSemiE(const Event& iEvent, const edm::EventSetup& iSetup) {
446  bool validElectrons = iEvent.getByToken(electronToken_, electronCollection);
447 
448  if (!validElectrons)
449  return;
450  if (electronCollection->empty())
451  return;
453  if (!(*elecSelect_)(electron))
454  return;
455 
457  bool validJets = iEvent.getByToken(sdjetToken_, jetCollection);
458  if (!validJets)
459  return;
460  if (jetCollection->size() < 2)
461  return;
462 
463  double pt0 = -1.0;
464  double dRMin = 999.0;
465  edm::Ptr<reco::BasicJet> hadJet; // highest pt jet with dphi(lep,jet) > pi/2
466  edm::Ptr<reco::BasicJet> lepJet; // closest jet to lepton with pt > ptMin
467 
468  for (auto ijet = jetCollection->begin(), ijetBegin = ijet, ijetEnd = jetCollection->end(); ijet != ijetEnd; ++ijet) {
469  // Hadronic jets
470  if (std::abs(reco::deltaPhi(electron, *ijet)) > M_PI * 0.5) {
471  if (ijet->pt() > pt0 && ijet->p() > semiE_HadJetPtCut_) {
472  hadJet = jetCollection->ptrAt(ijet - ijetBegin);
473  pt0 = hadJet->pt();
474  }
475  }
476  // Leptonic jets
477  else if (ijet->pt() > semiE_LepJetPtCut_) {
478  auto idRMin = reco::deltaR(electron, *ijet);
479  if (idRMin < dRMin) {
480  lepJet = jetCollection->ptrAt(ijet - ijetBegin);
481  dRMin = idRMin;
482  }
483  }
484  }
485  if (hadJet.isAvailable() == false || lepJet.isAvailable() == false)
486  return;
487 
488  auto lepJetP4 = lepJet->p4();
489  const auto& electronP4 = electron.p4();
490 
491  double tot = lepJetP4.mag2();
492  double ss = electronP4.Dot(lepJet->p4());
493  double per = electronP4.mag2();
494  if (tot > 0.0)
495  per -= ss * ss / tot;
496  if (per < 0)
497  per = 0;
498  double ptRel = per;
499  bool pass2D = dRMin > semiE_dRMin_ || ptRel > semiE_ptRel_;
500 
501  if (!pass2D)
502  return;
503 
504  semiE_ePt->Fill(electron.pt());
505  semiE_eEta->Fill(electron.eta());
506  semiE_ePhi->Fill(electron.phi());
507  semiE_eDRMin->Fill(dRMin);
508  semiE_ePtRel->Fill(ptRel);
509 
510  semiE_hadJetDR->Fill(reco::deltaR(electron, *hadJet));
511  semiE_mttbar->Fill(0.0);
512 
513  semiE_hadJetPt->Fill(hadJet->pt());
514  semiE_hadJetY->Fill(hadJet->rapidity());
515  semiE_hadJetPhi->Fill(hadJet->phi());
516  semiE_hadJetMass->Fill(hadJet->mass());
517  if (hadJet->numberOfDaughters() > 2) {
518  double wMass = hadJet->daughter(0)->mass() >= hadJet->daughter(1)->mass() ? hadJet->daughter(0)->mass()
519  : hadJet->daughter(1)->mass();
520  semiE_hadJetWMass->Fill(wMass);
521  } else {
522  semiE_hadJetWMass->Fill(-1.0);
523  }
524 }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
float chargedEmEnergyFraction() const
chargedEmEnergyFraction
Definition: PFJet.h:141
virtual void analyzeSemiMu(edm::Event const &e, edm::EventSetup const &eSetup)
Definition: B2GDQM.cc:362
~B2GDQM() override
Definition: B2GDQM.cc:131
virtual void analyzeAllHad(edm::Event const &e, edm::EventSetup const &eSetup)
Definition: B2GDQM.cc:314
double pt() const final
transverse momentum
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
virtual double pt() const =0
transverse momentum
virtual double mass() const =0
mass
virtual double rapidity() const =0
rapidity
void bookHistograms(DQMStore::IBooker &bei, edm::Run const &, edm::EventSetup const &) override
Definition: B2GDQM.cc:139
Jets made from CaloTowers.
Definition: BasicJet.h:19
Jets made from PFObjects.
Definition: PFJet.h:20
bool isAvailable() const
Definition: Ptr.h:232
const LorentzVector & p4() const final
four-momentum Lorentz vector
char const * label
int iEvent
Definition: GenABIO.cc:224
double rapidity() const final
rapidity
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float chargedHadronEnergyFraction() const
chargedHadronEnergyFraction
Definition: PFJet.h:97
virtual void analyzeSemiE(edm::Event const &e, edm::EventSetup const &eSetup)
Definition: B2GDQM.cc:444
#define M_PI
float neutralEmEnergyFraction() const
neutralEmEnergyFraction
Definition: PFJet.h:149
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
Log< level::Info, false > LogInfo
size_t numberOfDaughters() const override
number of daughters
float neutralHadronEnergyFraction() const
neutralHadronEnergyFraction
Definition: PFJet.h:101
B2GDQM(const edm::ParameterSet &ps)
Definition: B2GDQM.cc:74
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
Definition: B2GDQM.cc:226
virtual void analyzeJets(edm::Event const &e, edm::EventSetup const &eSetup)
Definition: B2GDQM.cc:233
fixed size matrix
HLT enums.
double mass() const final
mass
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
const_iterator begin() const
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
double phi() const final
momentum azimuthal angle
const_iterator end() const
Definition: Run.h:45
virtual double phi() const =0
momentum azimuthal angle
int icoll
Definition: AMPTWrapper.h:146