64 #include "TLorentzVector.h"
77 using namespace trigger;
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::shared_ptr<StringCutObjectSelector<reco::Muon> >(
125 semiE_HadJetPtCut_ = ps.
getParameter<
double>(
"semiE_HadJetPtCut");
126 semiE_dphiHadCut_ = ps.
getParameter<
double>(
"semiE_dphiHadCut");
129 elecSelect_ = std::shared_ptr<StringCutObjectSelector<reco::GsfElectron> >(
137 PFMETToken_ = consumes<std::vector<reco::PFMET> >(PFMETLabel_);
159 std::stringstream
ss;
160 ss <<
"Physics/B2G/" << jetLabels_[
icoll].label();
163 bei.
book1D(
"pfJet_pt",
"Pt of PFJet (GeV)", 50, 0.0, 1000));
165 bei.
book1D(
"pfJet_y",
"Rapidity of PFJet", 60, -6.0, 6.0));
166 pfJet_phi.push_back(bei.
book1D(
"pfJet_phi",
"#phi of PFJet (radians)", 60,
169 bei.
book1D(
"pfJet_m",
"Mass of PFJet (GeV)", 50, 0.0, 500));
170 pfJet_chef.push_back(
171 bei.
book1D(
"pfJet_pfchef",
"PFJetID CHEF", 50, 0.0, 1.0));
172 pfJet_nhef.push_back(
173 bei.
book1D(
"pfJet_pfnhef",
"PFJetID NHEF", 50, 0.0, 1.0));
174 pfJet_cemf.push_back(
175 bei.
book1D(
"pfJet_pfcemf",
"PFJetID CEMF", 50, 0.0, 1.0));
176 pfJet_nemf.push_back(
177 bei.
book1D(
"pfJet_pfnemf",
"PFJetID NEMF", 50, 0.0, 1.0));
179 boostedJet_subjetPt.push_back(
180 bei.
book1D(
"boostedJet_subjetPt",
"Pt of subjets (GeV)", 50, 0.0, 500));
181 boostedJet_subjetY.push_back(
182 bei.
book1D(
"boostedJet_subjetY",
"Rapidity of subjets", 60, -6.0, 6.0));
183 boostedJet_subjetPhi.push_back(bei.
book1D(
"boostedJet_subjetPhi",
184 "#phi of subjets (radians)", 60,
186 boostedJet_subjetM.push_back(bei.
book1D(
187 "boostedJet_subjetM",
"Mass of subjets (GeV)", 50, 0.0, 250.));
188 boostedJet_subjetN.push_back(
189 bei.
book1D(
"boostedJet_subjetN",
"Number of subjets", 10, 0, 10));
190 boostedJet_massDrop.push_back(bei.
book1D(
191 "boostedJet_massDrop",
"Mass drop for W-like jets", 50, 0.0, 1.0));
192 boostedJet_minMass.push_back(
193 bei.
book1D(
"boostedJet_minMass",
194 "Minimum Mass Pairing for top-like jets", 50, 0.0, 250.0));
198 pfMet_pt = bei.
book1D(
"pfMet_pt",
"Pf Missing p_{T}; GeV", 50, 0.0, 500);
199 pfMet_phi = bei.
book1D(
"pfMet_phi",
"Pf Missing p_{T} #phi;#phi (radians)",
205 "semiMu_muPt",
"Pt of Muon in #mu+Jets Channel (GeV)", 50, 0.0, 1000);
206 semiMu_muEta = bei.
book1D(
"semiMu_muEta",
"#eta of Muon in #mu+Jets Channel",
209 bei.
book1D(
"semiMu_muPhi",
"#phi of Muon in #mu+Jets Channel (radians)",
210 60, -3.14159, 3.14159);
212 bei.
book1D(
"semiMu_muDRMin",
213 "#Delta R(E,nearest jet) in #mu+Jets Channel", 50, 0, 10.0);
214 semiMu_muPtRel = bei.
book1D(
"semiMu_muPtRel",
215 "p_{T}^{REL} in #mu+Jets Channel", 60, 0, 300.);
217 bei.
book1D(
"semiMu_hadJetDR",
"#Delta R(E,had jet) in #mu+Jets Channel",
219 semiMu_hadJetPt = bei.
book1D(
220 "semiMu_hadJetPt",
"Pt of Leading Hadronic Jet in #mu+Jets Channel (GeV)",
222 semiMu_hadJetY = bei.
book1D(
223 "semiMu_hadJetY",
"Rapidity of Leading Hadronic Jet in #mu+Jets Channel",
226 bei.
book1D(
"semiMu_hadJetPhi",
227 "#phi of Leading Hadronic Jet in #mu+Jets Channel (radians)",
228 60, -3.14159, 3.14159);
229 semiMu_hadJetMass = bei.
book1D(
231 "Mass of Leading Hadronic Jet in #mu+Jets Channel (GeV)", 50, 0.0, 500);
232 semiMu_hadJetMinMass = bei.
book1D(
233 "semiMu_hadJetminMass",
234 "Minimum Mass Pairing for Leading Hadronic Jet in #mu+Jets Channel (GeV)",
236 semiMu_mttbar = bei.
book1D(
237 "semiMu_mttbar",
"Mass of #mu+Jets ttbar Candidate", 100, 0., 5000.);
241 semiE_ePt = bei.
book1D(
"semiE_ePt",
"Pt of Electron in e+Jets Channel (GeV)",
243 semiE_eEta = bei.
book1D(
"semiE_eEta",
"#eta of Electron in e+Jets Channel",
246 bei.
book1D(
"semiE_ePhi",
"#phi of Electron in e+Jets Channel (radians)",
247 60, -3.14159, 3.14159);
248 semiE_eDRMin = bei.
book1D(
249 "semiE_eDRMin",
"#Delta R(E,nearest jet) in e+Jets Channel", 50, 0, 10.0);
251 bei.
book1D(
"semiE_ePtRel",
"p_{T}^{REL} in e+Jets Channel", 60, 0, 300.);
252 semiE_hadJetDR = bei.
book1D(
253 "semiE_hadJetDR",
"#Delta R(E,had jet) in e+Jets Channel", 50, 0, 10.0);
254 semiE_hadJetPt = bei.
book1D(
255 "semiE_hadJetPt",
"Pt of Leading Hadronic Jet in e+Jets Channel (GeV)",
257 semiE_hadJetY = bei.
book1D(
258 "semiE_hadJetY",
"Rapidity of Leading Hadronic Jet in e+Jets Channel", 60,
261 bei.
book1D(
"semiE_hadJetPhi",
262 "#phi of Leading Hadronic Jet in e+Jets Channel (radians)", 60,
264 semiE_hadJetMass = bei.
book1D(
266 "Mass of Leading Hadronic Jet in e+Jets Channel (GeV)", 50, 0.0, 500);
267 semiE_hadJetMinMass = bei.
book1D(
268 "semiE_hadJetminMass",
269 "Minimum Mass Pairing for Leading Hadronic Jet in e+Jets Channel (GeV)",
271 semiE_mttbar = bei.
book1D(
"semiE_mttbar",
"Mass of e+Jets ttbar Candidate",
277 "allHad_pt0",
"Pt of Leading All-Hadronic PFJet (GeV)", 50, 0.0, 1000);
278 allHad_y0 = bei.
book1D(
"allHad_y0",
"Rapidity of Leading All-Hadronic PFJet",
281 bei.
book1D(
"allHad_phi0",
"#phi of Leading All-Hadronic PFJet (radians)",
282 60, -3.14159, 3.14159);
283 allHad_mass0 = bei.
book1D(
284 "allHad_mass0",
"Mass of Leading All-Hadronic PFJet (GeV)", 50, 0.0, 500);
286 bei.
book1D(
"allHad_minMass0",
287 "Minimum Mass Pairing for Leading All-Hadronic PFJet (GeV)",
290 "allHad_pt1",
"Pt of Subleading All-Hadronic PFJet (GeV)", 50, 0.0, 1000);
292 "allHad_y1",
"Rapidity of Subleading All-Hadronic PFJet", 60, -6.0, 6.0);
293 allHad_phi1 = bei.
book1D(
"allHad_phi1",
294 "#phi of Subleading All-Hadronic PFJet (radians)",
295 60, -3.14159, 3.14159);
297 bei.
book1D(
"allHad_mass1",
"Mass of Subleading All-Hadronic PFJet (GeV)",
300 bei.
book1D(
"allHad_minMass1",
301 "Minimum Mass Pairing for Subleading All-Hadronic PFJet (GeV)",
303 allHad_mttbar = bei.
book1D(
304 "allHad_mttbar",
"Mass of All-Hadronic ttbar Candidate", 100, 0., 5000.);
312 analyzeJets(iEvent, iSetup);
313 analyzeSemiMu(iEvent, iSetup);
314 analyzeSemiE(iEvent, iSetup);
315 analyzeAllHad(iEvent, iSetup);
328 bool ValidPFJets = iEvent.
getByToken(jetTokens_[
icoll], pfJetCollection);
329 if (!ValidPFJets)
continue;
338 jetEnd = pfjets.
end();
340 if (
jet->pt() < jetPtMins_[
icoll])
continue;
342 pfJet_y[
icoll]->Fill(
jet->rapidity());
363 boostedJet_subjetN[
icoll]->Fill(
jet->numberOfDaughters());
365 for (
unsigned int ida = 0; ida <
jet->numberOfDaughters(); ++ida) {
367 boostedJet_subjetPt[
icoll]->Fill(subjet->
pt());
369 boostedJet_subjetPhi[
icoll]->Fill(subjet->
phi());
370 boostedJet_subjetM[
icoll]->Fill(subjet->
mass());
375 if (jetLabels_[icoll].
label() ==
"cmsTopTagPFJetsCHS") {
378 if (
jet->numberOfDaughters() > 2) {
381 boostedJet_minMass[
icoll]->Fill(-1.0);
385 }
else if (jetLabels_[icoll].
label() ==
"ca8PFJetsCHSPruned") {
386 if (
jet->numberOfDaughters() > 1) {
390 boostedJet_massDrop[
icoll]->Fill(da0->
mass() /
jet->mass());
392 boostedJet_massDrop[
icoll]->Fill(da1->
mass() /
jet->mass());
395 boostedJet_massDrop[
icoll]->Fill(-1.0);
407 bool ValidPFMET = iEvent.
getByToken(PFMETToken_, pfMETCollection);
408 if (!ValidPFMET)
return;
410 pfMet_pt->Fill((*pfMETCollection)[0].
pt());
411 pfMet_phi->Fill((*pfMETCollection)[0].
phi());
417 bool validJets = iEvent.
getByToken(cmsTagToken_, jetCollection);
418 if (!validJets)
return;
421 if (jetCollection->size() < 2)
return;
425 if (jet0->pt() < allHadPtCut_ || jet1->pt() < allHadPtCut_)
return;
426 if (
std::abs(jet0->rapidity() - jet1->rapidity()) > allHadRapidityCut_)
432 allHad_pt0->Fill(jet0->pt());
433 allHad_y0->Fill(jet0->rapidity());
434 allHad_phi0->Fill(jet0->phi());
435 allHad_mass0->Fill(jet0->mass());
437 if (jet0->numberOfDaughters() > 2) {
438 allHad_minMass0->Fill(properties0.
minMass);
440 allHad_minMass0->Fill(-1.0);
443 allHad_pt1->Fill(jet1->pt());
444 allHad_y1->Fill(jet1->rapidity());
445 allHad_phi1->Fill(jet1->phi());
446 allHad_mass1->Fill(jet1->mass());
448 if (jet1->numberOfDaughters() > 2) {
449 allHad_minMass1->Fill(properties1.
minMass);
451 allHad_minMass1->Fill(-1.0);
454 auto p4cand = (jet0->p4() + jet1->p4());
455 allHad_mttbar->Fill(p4cand.mass());
461 bool validMuons = iEvent.
getByToken(muonToken_, muonCollection);
463 if (!validMuons)
return;
464 if (muonCollection->size() < 1)
return;
466 if (!(*muonSelect_)(muon))
return;
469 bool validJets = iEvent.
getByToken(cmsTagToken_, jetCollection);
470 if (!validJets)
return;
471 if (jetCollection->size() < 2)
return;
474 double dRMin = 999.0;
478 for (
auto ijet = jetCollection->begin(), ijetBegin = ijet,
479 ijetEnd = jetCollection->end();
480 ijet != ijetEnd; ++ijet) {
483 if (ijet->pt() > pt0 && ijet->p() > semiMu_HadJetPtCut_) {
484 hadJet = jetCollection->ptrAt(ijet - ijetBegin);
489 else if (ijet->pt() > semiMu_LepJetPtCut_) {
491 if (idRMin < dRMin) {
492 lepJet = jetCollection->ptrAt(ijet - ijetBegin);
499 auto lepJetP4 = lepJet->p4();
500 auto muonP4 = muon.
p4();
502 double tot = lepJetP4.mag2();
503 double ss = muonP4.Dot(lepJet->p4());
504 double per = muonP4.mag2();
505 if (tot > 0.0) per -= ss * ss / tot;
506 if (per < 0) per = 0;
508 bool pass2D = dRMin > semiMu_dRMin_ || ptRel > semiMu_ptRel_;
514 semiMu_muPt->Fill(muon.
pt());
515 semiMu_muEta->Fill(muon.
eta());
516 semiMu_muPhi->Fill(muon.
phi());
517 semiMu_muDRMin->Fill(dRMin);
518 semiMu_muPtRel->Fill(ptRel);
521 semiMu_mttbar->Fill(0.0);
523 semiMu_hadJetPt->Fill(hadJet->pt());
524 semiMu_hadJetY->Fill(hadJet->rapidity());
525 semiMu_hadJetPhi->Fill(hadJet->phi());
526 semiMu_hadJetMass->Fill(hadJet->mass());
528 if (hadJet->numberOfDaughters() > 2) {
529 semiMu_hadJetMinMass->Fill(properties0.
minMass);
531 semiMu_hadJetMinMass->Fill(-1.0);
538 bool validElectrons = iEvent.
getByToken(electronToken_, electronCollection);
540 if (!validElectrons)
return;
541 if (electronCollection->size() < 1)
return;
543 if (!(*elecSelect_)(electron))
return;
546 bool validJets = iEvent.
getByToken(cmsTagToken_, jetCollection);
547 if (!validJets)
return;
548 if (jetCollection->size() < 2)
return;
551 double dRMin = 999.0;
555 for (
auto ijet = jetCollection->begin(), ijetBegin = ijet,
556 ijetEnd = jetCollection->end();
557 ijet != ijetEnd; ++ijet) {
560 if (ijet->pt() > pt0 && ijet->p() > semiE_HadJetPtCut_) {
561 hadJet = jetCollection->ptrAt(ijet - ijetBegin);
566 else if (ijet->pt() > semiE_LepJetPtCut_) {
568 if (idRMin < dRMin) {
569 lepJet = jetCollection->ptrAt(ijet - ijetBegin);
576 auto lepJetP4 = lepJet->p4();
577 auto electronP4 = electron.
p4();
579 double tot = lepJetP4.mag2();
580 double ss = electronP4.Dot(lepJet->p4());
581 double per = electronP4.mag2();
582 if (tot > 0.0) per -= ss * ss / tot;
583 if (per < 0) per = 0;
585 bool pass2D = dRMin > semiE_dRMin_ || ptRel > semiE_ptRel_;
591 semiE_ePt->Fill(electron.
pt());
592 semiE_eEta->Fill(electron.
eta());
593 semiE_ePhi->Fill(electron.
phi());
594 semiE_eDRMin->Fill(dRMin);
595 semiE_ePtRel->Fill(ptRel);
598 semiE_mttbar->Fill(0.0);
600 semiE_hadJetPt->Fill(hadJet->pt());
601 semiE_hadJetY->Fill(hadJet->rapidity());
602 semiE_hadJetPhi->Fill(hadJet->phi());
603 semiE_hadJetMass->Fill(hadJet->mass());
605 if (hadJet->numberOfDaughters() > 2) {
606 semiE_hadJetMinMass->Fill(properties0.
minMass);
608 semiE_hadJetMinMass->Fill(-1.0);
T getParameter(std::string const &) const
virtual void analyzeSemiMu(edm::Event const &e, edm::EventSetup const &eSetup)
virtual float mass() const =0
mass
virtual void analyzeAllHad(edm::Event const &e, edm::EventSetup const &eSetup)
virtual float pt() const
transverse momentum
const LorentzVector & p4(P4Kind kind) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual float phi() const
momentum azimuthal angle
float chargedHadronEnergyFraction() const
chargedHadronEnergyFraction
virtual float phi() const =0
momentum azimuthal angle
virtual double rapidity() const =0
rapidity
double deltaR(const T1 &t1, const T2 &t2)
virtual void bookHistograms(DQMStore::IBooker &bei, edm::Run const &, edm::EventSetup const &) override
Jets made from CaloTowers.
Jets made from PFObjects.
float neutralEmEnergyFraction() const
neutralEmEnergyFraction
virtual float pt() const =0
transverse momentum
const_iterator begin() const
virtual float eta() const
momentum pseudorapidity
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
float neutralHadronEnergyFraction() const
neutralHadronEnergyFraction
virtual void analyzeSemiE(edm::Event const &e, edm::EventSetup const &eSetup)
double deltaPhi(double phi1, double phi2)
float chargedEmEnergyFraction() const
chargedEmEnergyFraction
void setCurrentFolder(const std::string &fullpath)
B2GDQM(const edm::ParameterSet &ps)
virtual void analyzeJets(edm::Event const &e, edm::EventSetup const &eSetup)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
const_iterator end() const
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
virtual void analyze(edm::Event const &e, edm::EventSetup const &eSetup)