64 #include "TLorentzVector.h" 87 typedef std::vector<edm::InputTag> vtag;
91 theTriggerResultsCollection =
93 triggerToken_ = consumes<edm::TriggerResults>(theTriggerResultsCollection);
96 jetLabels_ = ps.
getParameter<std::vector<edm::InputTag> >(
"jetLabels");
97 for (std::vector<edm::InputTag>::const_iterator
98 jetlabel = jetLabels_.begin(),
99 jetlabelEnd = jetLabels_.end();
100 jetlabel != jetlabelEnd; ++jetlabel) {
104 cmsTagToken_ = consumes<edm::View<reco::BasicJet> >(cmsTagLabel_);
106 muonToken_ = consumes<edm::View<reco::Muon> >(
108 electronToken_ = consumes<edm::View<reco::GsfElectron> >(
111 jetPtMins_ = ps.
getParameter<std::vector<double> >(
"jetPtMins");
113 allHadRapidityCut_ = ps.
getParameter<
double>(
"allHadRapidityCut");
114 allHadDeltaPhiCut_ = ps.
getParameter<
double>(
"allHadDeltaPhiCut");
116 semiMu_HadJetPtCut_ = ps.
getParameter<
double>(
"semiMu_HadJetPtCut");
117 semiMu_LepJetPtCut_ = ps.
getParameter<
double>(
"semiMu_LepJetPtCut");
118 semiMu_dphiHadCut_ = ps.
getParameter<
double>(
"semiMu_dphiHadCut");
119 semiMu_dRMin_ = ps.
getParameter<
double>(
"semiMu_dRMin");
120 semiMu_ptRel_ = ps.
getParameter<
double>(
"semiMu_ptRel");
121 muonSelect_ = std::make_shared<StringCutObjectSelector<reco::Muon> >(
125 semiE_HadJetPtCut_ = ps.
getParameter<
double>(
"semiE_HadJetPtCut");
126 semiE_LepJetPtCut_ = ps.
getParameter<
double>(
"semiE_LepJetPtCut");
127 semiE_dphiHadCut_ = ps.
getParameter<
double>(
"semiE_dphiHadCut");
130 elecSelect_ = std::make_shared<StringCutObjectSelector<reco::GsfElectron> >(
138 PFMETToken_ = consumes<std::vector<reco::PFMET> >(PFMETLabel_);
160 std::stringstream ss;
161 ss <<
"Physics/B2G/" << jetLabels_[
icoll].label();
164 bei.
book1D(
"pfJet_pt",
"Pt of PFJet (GeV)", 50, 0.0, 1000));
166 bei.
book1D(
"pfJet_y",
"Rapidity of PFJet", 60, -6.0, 6.0));
167 pfJet_phi.push_back(bei.
book1D(
"pfJet_phi",
"#phi of PFJet (radians)", 60,
170 bei.
book1D(
"pfJet_m",
"Mass of PFJet (GeV)", 50, 0.0, 500));
171 pfJet_chef.push_back(
172 bei.
book1D(
"pfJet_pfchef",
"PFJetID CHEF", 50, 0.0, 1.0));
173 pfJet_nhef.push_back(
174 bei.
book1D(
"pfJet_pfnhef",
"PFJetID NHEF", 50, 0.0, 1.0));
175 pfJet_cemf.push_back(
176 bei.
book1D(
"pfJet_pfcemf",
"PFJetID CEMF", 50, 0.0, 1.0));
177 pfJet_nemf.push_back(
178 bei.
book1D(
"pfJet_pfnemf",
"PFJetID NEMF", 50, 0.0, 1.0));
180 boostedJet_subjetPt.push_back(
181 bei.
book1D(
"boostedJet_subjetPt",
"Pt of subjets (GeV)", 50, 0.0, 500));
182 boostedJet_subjetY.push_back(
183 bei.
book1D(
"boostedJet_subjetY",
"Rapidity of subjets", 60, -6.0, 6.0));
184 boostedJet_subjetPhi.push_back(bei.
book1D(
"boostedJet_subjetPhi",
185 "#phi of subjets (radians)", 60,
187 boostedJet_subjetM.push_back(bei.
book1D(
188 "boostedJet_subjetM",
"Mass of subjets (GeV)", 50, 0.0, 250.));
189 boostedJet_subjetN.push_back(
190 bei.
book1D(
"boostedJet_subjetN",
"Number of subjets", 10, 0, 10));
191 boostedJet_massDrop.push_back(bei.
book1D(
192 "boostedJet_massDrop",
"Mass drop for W-like jets", 50, 0.0, 1.0));
193 boostedJet_minMass.push_back(
194 bei.
book1D(
"boostedJet_minMass",
195 "Minimum Mass Pairing for top-like jets", 50, 0.0, 250.0));
199 pfMet_pt = bei.
book1D(
"pfMet_pt",
"Pf Missing p_{T}; GeV", 50, 0.0, 500);
200 pfMet_phi = bei.
book1D(
"pfMet_phi",
"Pf Missing p_{T} #phi;#phi (radians)",
206 "semiMu_muPt",
"Pt of Muon in #mu+Jets Channel (GeV)", 50, 0.0, 1000);
207 semiMu_muEta = bei.
book1D(
"semiMu_muEta",
"#eta of Muon in #mu+Jets Channel",
210 bei.
book1D(
"semiMu_muPhi",
"#phi of Muon in #mu+Jets Channel (radians)",
211 60, -3.14159, 3.14159);
213 bei.
book1D(
"semiMu_muDRMin",
214 "#Delta R(E,nearest jet) in #mu+Jets Channel", 50, 0, 10.0);
215 semiMu_muPtRel = bei.
book1D(
"semiMu_muPtRel",
216 "p_{T}^{REL} in #mu+Jets Channel", 60, 0, 300.);
218 bei.
book1D(
"semiMu_hadJetDR",
"#Delta R(E,had jet) in #mu+Jets Channel",
220 semiMu_hadJetPt = bei.
book1D(
221 "semiMu_hadJetPt",
"Pt of Leading Hadronic Jet in #mu+Jets Channel (GeV)",
223 semiMu_hadJetY = bei.
book1D(
224 "semiMu_hadJetY",
"Rapidity of Leading Hadronic Jet in #mu+Jets Channel",
227 bei.
book1D(
"semiMu_hadJetPhi",
228 "#phi of Leading Hadronic Jet in #mu+Jets Channel (radians)",
229 60, -3.14159, 3.14159);
230 semiMu_hadJetMass = bei.
book1D(
232 "Mass of Leading Hadronic Jet in #mu+Jets Channel (GeV)", 50, 0.0, 500);
233 semiMu_hadJetMinMass = bei.
book1D(
234 "semiMu_hadJetminMass",
235 "Minimum Mass Pairing for Leading Hadronic Jet in #mu+Jets Channel (GeV)",
237 semiMu_mttbar = bei.
book1D(
238 "semiMu_mttbar",
"Mass of #mu+Jets ttbar Candidate", 100, 0., 5000.);
242 semiE_ePt = bei.
book1D(
"semiE_ePt",
"Pt of Electron in e+Jets Channel (GeV)",
244 semiE_eEta = bei.
book1D(
"semiE_eEta",
"#eta of Electron in e+Jets Channel",
247 bei.
book1D(
"semiE_ePhi",
"#phi of Electron in e+Jets Channel (radians)",
248 60, -3.14159, 3.14159);
249 semiE_eDRMin = bei.
book1D(
250 "semiE_eDRMin",
"#Delta R(E,nearest jet) in e+Jets Channel", 50, 0, 10.0);
252 bei.
book1D(
"semiE_ePtRel",
"p_{T}^{REL} in e+Jets Channel", 60, 0, 300.);
253 semiE_hadJetDR = bei.
book1D(
254 "semiE_hadJetDR",
"#Delta R(E,had jet) in e+Jets Channel", 50, 0, 10.0);
255 semiE_hadJetPt = bei.
book1D(
256 "semiE_hadJetPt",
"Pt of Leading Hadronic Jet in e+Jets Channel (GeV)",
258 semiE_hadJetY = bei.
book1D(
259 "semiE_hadJetY",
"Rapidity of Leading Hadronic Jet in e+Jets Channel", 60,
262 bei.
book1D(
"semiE_hadJetPhi",
263 "#phi of Leading Hadronic Jet in e+Jets Channel (radians)", 60,
265 semiE_hadJetMass = bei.
book1D(
267 "Mass of Leading Hadronic Jet in e+Jets Channel (GeV)", 50, 0.0, 500);
268 semiE_hadJetMinMass = bei.
book1D(
269 "semiE_hadJetminMass",
270 "Minimum Mass Pairing for Leading Hadronic Jet in e+Jets Channel (GeV)",
272 semiE_mttbar = bei.
book1D(
"semiE_mttbar",
"Mass of e+Jets ttbar Candidate",
278 "allHad_pt0",
"Pt of Leading All-Hadronic PFJet (GeV)", 50, 0.0, 1000);
279 allHad_y0 = bei.
book1D(
"allHad_y0",
"Rapidity of Leading All-Hadronic PFJet",
282 bei.
book1D(
"allHad_phi0",
"#phi of Leading All-Hadronic PFJet (radians)",
283 60, -3.14159, 3.14159);
284 allHad_mass0 = bei.
book1D(
285 "allHad_mass0",
"Mass of Leading All-Hadronic PFJet (GeV)", 50, 0.0, 500);
287 bei.
book1D(
"allHad_minMass0",
288 "Minimum Mass Pairing for Leading All-Hadronic PFJet (GeV)",
291 "allHad_pt1",
"Pt of Subleading All-Hadronic PFJet (GeV)", 50, 0.0, 1000);
293 "allHad_y1",
"Rapidity of Subleading All-Hadronic PFJet", 60, -6.0, 6.0);
294 allHad_phi1 = bei.
book1D(
"allHad_phi1",
295 "#phi of Subleading All-Hadronic PFJet (radians)",
296 60, -3.14159, 3.14159);
298 bei.
book1D(
"allHad_mass1",
"Mass of Subleading All-Hadronic PFJet (GeV)",
301 bei.
book1D(
"allHad_minMass1",
302 "Minimum Mass Pairing for Subleading All-Hadronic PFJet (GeV)",
304 allHad_mttbar = bei.
book1D(
305 "allHad_mttbar",
"Mass of All-Hadronic ttbar Candidate", 100, 0., 5000.);
313 analyzeJets(iEvent, iSetup);
314 analyzeSemiMu(iEvent, iSetup);
315 analyzeSemiE(iEvent, iSetup);
316 analyzeAllHad(iEvent, iSetup);
329 bool ValidPFJets = iEvent.
getByToken(jetTokens_[
icoll], pfJetCollection);
330 if (!ValidPFJets)
continue;
339 jetEnd = pfjets.
end();
341 if (
jet->pt() < jetPtMins_[
icoll])
continue;
343 pfJet_y[
icoll]->Fill(
jet->rapidity());
351 if (pfjet !=
nullptr) {
363 if (basicjet !=
nullptr) {
364 boostedJet_subjetN[
icoll]->Fill(
jet->numberOfDaughters());
366 for (
unsigned int ida = 0; ida <
jet->numberOfDaughters(); ++ida) {
368 boostedJet_subjetPt[
icoll]->Fill(subjet->
pt());
370 boostedJet_subjetPhi[
icoll]->Fill(subjet->
phi());
371 boostedJet_subjetM[
icoll]->Fill(subjet->
mass());
376 if (jetLabels_[icoll].
label() ==
"cmsTopTagPFJetsCHS") {
379 if (
jet->numberOfDaughters() > 2) {
382 boostedJet_minMass[
icoll]->Fill(-1.0);
386 }
else if ((jetLabels_[icoll].
label() ==
"ak8PFJetsCHSPruned")||(jetLabels_[icoll].
label() ==
"ak8PFJetsCHSSoftdrop")) {
387 if (
jet->numberOfDaughters() > 1) {
391 boostedJet_massDrop[
icoll]->Fill(da0->
mass() /
jet->mass());
393 boostedJet_massDrop[
icoll]->Fill(da1->
mass() /
jet->mass());
396 boostedJet_massDrop[
icoll]->Fill(-1.0);
408 bool ValidPFMET = iEvent.
getByToken(PFMETToken_, pfMETCollection);
409 if (!ValidPFMET)
return;
411 pfMet_pt->Fill((*pfMETCollection)[0].
pt());
412 pfMet_phi->Fill((*pfMETCollection)[0].phi());
418 bool validJets = iEvent.
getByToken(cmsTagToken_, jetCollection);
419 if (!validJets)
return;
422 if (jetCollection->size() < 2)
return;
426 if (jet0->
pt() < allHadPtCut_ || jet1->
pt() < allHadPtCut_)
return;
433 allHad_pt0->Fill(jet0->
pt());
435 allHad_phi0->Fill(jet0->
phi());
436 allHad_mass0->Fill(jet0->
mass());
439 allHad_minMass0->Fill(properties0.
minMass);
441 allHad_minMass0->Fill(-1.0);
444 allHad_pt1->Fill(jet1->
pt());
446 allHad_phi1->Fill(jet1->
phi());
447 allHad_mass1->Fill(jet1->
mass());
450 allHad_minMass1->Fill(properties1.
minMass);
452 allHad_minMass1->Fill(-1.0);
455 auto p4cand = (jet0->
p4() + jet1->
p4());
456 allHad_mttbar->Fill(p4cand.mass());
462 bool validMuons = iEvent.
getByToken(muonToken_, muonCollection);
464 if (!validMuons)
return;
465 if (muonCollection->empty())
return;
467 if (!(*muonSelect_)(muon))
return;
470 bool validJets = iEvent.
getByToken(cmsTagToken_, jetCollection);
471 if (!validJets)
return;
472 if (jetCollection->size() < 2)
return;
475 double dRMin = 999.0;
479 for (
auto ijet = jetCollection->begin(), ijetBegin = ijet,
480 ijetEnd = jetCollection->end();
481 ijet != ijetEnd; ++ijet) {
484 if (ijet->pt() > pt0 && ijet->p() > semiMu_HadJetPtCut_) {
485 hadJet = jetCollection->ptrAt(ijet - ijetBegin);
490 else if (ijet->pt() > semiMu_LepJetPtCut_) {
492 if (idRMin < dRMin) {
493 lepJet = jetCollection->ptrAt(ijet - ijetBegin);
500 auto lepJetP4 = lepJet->
p4();
501 const auto& muonP4 = muon.
p4();
503 double tot = lepJetP4.mag2();
504 double ss = muonP4.Dot(lepJet->
p4());
505 double per = muonP4.mag2();
506 if (tot > 0.0) per -= ss * ss / tot;
507 if (per < 0) per = 0;
509 bool pass2D = dRMin > semiMu_dRMin_ || ptRel > semiMu_ptRel_;
515 semiMu_muPt->Fill(muon.
pt());
516 semiMu_muEta->Fill(muon.
eta());
517 semiMu_muPhi->Fill(muon.
phi());
518 semiMu_muDRMin->Fill(dRMin);
519 semiMu_muPtRel->Fill(ptRel);
522 semiMu_mttbar->Fill(0.0);
524 semiMu_hadJetPt->Fill(hadJet->
pt());
525 semiMu_hadJetY->Fill(hadJet->
rapidity());
526 semiMu_hadJetPhi->Fill(hadJet->
phi());
527 semiMu_hadJetMass->Fill(hadJet->
mass());
530 semiMu_hadJetMinMass->Fill(properties0.
minMass);
532 semiMu_hadJetMinMass->Fill(-1.0);
539 bool validElectrons = iEvent.
getByToken(electronToken_, electronCollection);
541 if (!validElectrons)
return;
542 if (electronCollection->empty())
return;
544 if (!(*elecSelect_)(electron))
return;
547 bool validJets = iEvent.
getByToken(cmsTagToken_, jetCollection);
548 if (!validJets)
return;
549 if (jetCollection->size() < 2)
return;
552 double dRMin = 999.0;
556 for (
auto ijet = jetCollection->begin(), ijetBegin = ijet,
557 ijetEnd = jetCollection->end();
558 ijet != ijetEnd; ++ijet) {
561 if (ijet->pt() > pt0 && ijet->p() > semiE_HadJetPtCut_) {
562 hadJet = jetCollection->ptrAt(ijet - ijetBegin);
567 else if (ijet->pt() > semiE_LepJetPtCut_) {
569 if (idRMin < dRMin) {
570 lepJet = jetCollection->ptrAt(ijet - ijetBegin);
577 auto lepJetP4 = lepJet->
p4();
578 const auto& electronP4 = electron.
p4();
580 double tot = lepJetP4.mag2();
581 double ss = electronP4.Dot(lepJet->
p4());
582 double per = electronP4.mag2();
583 if (tot > 0.0) per -= ss * ss / tot;
584 if (per < 0) per = 0;
586 bool pass2D = dRMin > semiE_dRMin_ || ptRel > semiE_ptRel_;
592 semiE_ePt->Fill(electron.
pt());
593 semiE_eEta->Fill(electron.
eta());
594 semiE_ePhi->Fill(electron.
phi());
595 semiE_eDRMin->Fill(dRMin);
596 semiE_ePtRel->Fill(ptRel);
599 semiE_mttbar->Fill(0.0);
601 semiE_hadJetPt->Fill(hadJet->
pt());
602 semiE_hadJetY->Fill(hadJet->
rapidity());
603 semiE_hadJetPhi->Fill(hadJet->
phi());
604 semiE_hadJetMass->Fill(hadJet->
mass());
607 semiE_hadJetMinMass->Fill(properties0.
minMass);
609 semiE_hadJetMinMass->Fill(-1.0);
constexpr double deltaPhi(double phi1, double phi2)
T getParameter(std::string const &) const
double eta() const final
momentum pseudorapidity
virtual void analyzeSemiMu(edm::Event const &e, edm::EventSetup const &eSetup)
virtual void analyzeAllHad(edm::Event const &e, edm::EventSetup const &eSetup)
const LorentzVector & p4(P4Kind kind) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
float chargedHadronEnergyFraction() const
chargedHadronEnergyFraction
double rapidity() const final
rapidity
double pt() const final
transverse momentum
void bookHistograms(DQMStore::IBooker &bei, edm::Run const &, edm::EventSetup const &) override
Jets made from CaloTowers.
Jets made from PFObjects.
size_t numberOfDaughters() const override
number of daughters
float neutralEmEnergyFraction() const
neutralEmEnergyFraction
const_iterator begin() const
void setCurrentFolder(std::string const &fullpath)
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
float neutralHadronEnergyFraction() const
neutralHadronEnergyFraction
const LorentzVector & p4() const final
four-momentum Lorentz vector
virtual void analyzeSemiE(edm::Event const &e, edm::EventSetup const &eSetup)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
float chargedEmEnergyFraction() const
chargedEmEnergyFraction
virtual double pt() const =0
transverse momentum
B2GDQM(const edm::ParameterSet &ps)
virtual double mass() const =0
mass
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
virtual void analyzeJets(edm::Event const &e, edm::EventSetup const &eSetup)
virtual double rapidity() const =0
rapidity
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
const_iterator end() const
double phi() const final
momentum azimuthal angle
virtual double phi() const =0
momentum azimuthal angle
double mass() const final
mass