22 static const double WMASS = 80.4;
30 jetIDSelect_(nullptr),
31 jetlooseSelection_(nullptr),
32 jetSelection_(nullptr),
56 elecSelect_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate>>(
78 std::make_unique<StringCutObjectSelector<reco::Vertex>>(
pvExtras.getParameter<
std::string>(
"select"));
87 muonSelect_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate>>(
93 muonIso_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate>>(
121 "chargedHadronEnergyFraction()>0 && chargedMultiplicity()>0 && chargedEmEnergyFraction()<0.99 && "
122 "neutralHadronEnergyFraction()<0.99 && neutralEmEnergyFraction()<0.99 && "
123 "(chargedMultiplicity()+neutralMultiplicity())>1");
187 hists_[
"pvMult_"] = ibooker.
book1D(
"PvMult",
"N_{good pvs}", 50, 0., 50.);
189 hists_[
"muonPt_"] = ibooker.
book1D(
"MuonPt",
"pt(#mu TightId, TightIso)", 40, 0., 200.);
191 hists_[
"muonMult_"] = ibooker.
book1D(
"MuonMult",
"N_{loose}(#mu)", 10, 0., 10.);
196 hists_[
"muonMultTight_"] = ibooker.
book1D(
"MuonMultTight",
"N_{TightIso,TightId}(#mu)", 10, 0., 10.);
198 hists_[
"elecPt_"] = ibooker.
book1D(
"ElecPt",
"pt(e TightId, TightIso)", 40, 0., 200.);
204 hists_[
"jetMult_"] = ibooker.
book1D(
"JetMult",
"N_{30}(jet)", 10, 0., 10.);
206 hists_[
"jetMultLoose_"] = ibooker.
book1D(
"JetMultLoose",
"N_{30, loose}(jet)", 10, 0., 10.);
215 hists_[
"metPflow_"] = ibooker.
book1D(
"METPflow",
"MET_{Pflow}", 50, 0., 200.);
217 hists_[
"massW_"] = ibooker.
book1D(
"MassW",
"M(W)", 60, 0., 300.);
219 hists_[
"massTop_"] = ibooker.
book1D(
"MassTop",
"M(Top)", 50, 0., 500.);
221 hists_[
"massBTop_"] = ibooker.
book1D(
"MassBTop",
"M(Top, 1 b-tag)", 50, 0., 500.);
230 hists_[
"muonEta_"] = ibooker.
book1D(
"MuonEta",
"#eta(#mu TightId, TightIso)", 30, -3., 3.);
232 hists_[
"muonRelIso_"] = ibooker.
book1D(
"MuonRelIso",
"Iso_{Rel}(#mu TightId) (#Delta#beta Corrected)", 50, 0., 1.);
234 hists_[
"muonPhi_"] = ibooker.
book1D(
"MuonPhi",
"#phi(#mu TightId, TightIso)", 40, -4., 4.);
236 hists_[
"elecEta_"] = ibooker.
book1D(
"ElecEta",
"#eta(e tightId)", 30, -3., 3.);
238 hists_[
"elecRelIso_"] = ibooker.
book1D(
"ElecRelIso",
"Iso_{Rel}(e TightId, TightIso)", 50, 0., 1.);
240 hists_[
"elecPhi_"] = ibooker.
book1D(
"ElecPhi",
"#phi(e tightId)", 40, -4., 4.);
242 hists_[
"elecMultTight_"] = ibooker.
book1D(
"ElecMultTight",
"N_{TightIso,TightId}(e)", 10, 0., 10.);
252 hists_[
"jet1Eta_"] = ibooker.
book1D(
"Jet1Eta",
"#eta_{30,loose}(jet1)", 60, -3., 3.);
254 hists_[
"jet1Pt_"] = ibooker.
book1D(
"Jet1Pt",
"pt_{30,loose}(jet1)", 60, 0., 300.);
256 hists_[
"jet2Eta_"] = ibooker.
book1D(
"Jet2Eta",
"#eta_{30,loose}(jet2)", 60, -3., 3.);
258 hists_[
"jet2Pt_"] = ibooker.
book1D(
"Jet2Pt",
"pt_{30,loose}(jet2)", 60, 0., 300.);
260 hists_[
"jet3Eta_"] = ibooker.
book1D(
"Jet3Eta",
"#eta_{30,loose}(jet3)", 60, -3., 3.);
262 hists_[
"jet3Pt_"] = ibooker.
book1D(
"Jet3Pt",
"pt_{30,loose}(jet3)", 60, 0., 300.);
264 hists_[
"jet4Eta_"] = ibooker.
book1D(
"Jet4Eta",
"#eta_{30,loose}(jet4)", 60, -3., 3.);
266 hists_[
"jet4Pt_"] = ibooker.
book1D(
"Jet4Pt",
"pt_{30,loose}(jet4)", 60, 0., 300.);
268 hists_[
"muonDelZ_"] = ibooker.
book1D(
"MuonDelZ",
"d_{z}(#mu)", 50, -25., 25.);
270 hists_[
"muonDelXY_"] = ibooker.
book2D(
"MuonDelXY",
"d_{xy}(#mu)", 50, -0.1, 0.1, 50, -0.1, 0.1);
273 hists_[
"muonDelXY_"]->setAxisTitle(
"x [cm]", 1);
274 hists_[
"muonDelXY_"]->setAxisTitle(
"y [cm]", 2);
282 hists_[
"muonChHadIso_"] = ibooker.
book1D(
"MuonChHadIsoComp",
"ChHad_{IsoComponent}(#mu TightId)", 50, 0., 5.);
285 hists_[
"muonNeHadIso_"] = ibooker.
book1D(
"MuonNeHadIsoComp",
"NeHad_{IsoComponent}(#mu TightId)", 50, 0., 5.);
288 hists_[
"muonPhIso_"] = ibooker.
book1D(
"MuonPhIsoComp",
"Photon_{IsoComponent}(#mu )", 50, 0., 5.);
291 hists_[
"elecChHadIso_"] = ibooker.
book1D(
"ElectronChHadIsoComp",
"ChHad_{IsoComponent}(e tightId)", 50, 0., 5.);
294 hists_[
"elecNeHadIso_"] = ibooker.
book1D(
"ElectronNeHadIsoComp",
"NeHad_{IsoComponent}(e tightId)", 50, 0., 5.);
297 hists_[
"elecPhIso_"] = ibooker.
book1D(
"ElectronPhIsoComp",
"Photon_{IsoComponent}(e tightId)", 50, 0., 5.);
300 hists_[
"jetMultBCSVM_"] = ibooker.
book1D(
"JetMultBCSVM",
"N_{30}(CSVM)", 10, 0., 10.);
302 hists_[
"jetBCSV_"] = ibooker.
book1D(
"JetDiscCSV",
"BJet Disc_{CSV}(JET)", 100, -1., 2.);
312 hists_[
"eventLogger_"] = ibooker.
book2D(
"EventLogger",
"Logged Events", 9, 0., 9., 10, 0., 10.);
315 hists_[
"eventLogger_"]->getTH1()->SetOption(
"TEXT");
316 hists_[
"eventLogger_"]->setBinLabel(1,
"Run", 1);
317 hists_[
"eventLogger_"]->setBinLabel(2,
"Block", 1);
318 hists_[
"eventLogger_"]->setBinLabel(3,
"Event", 1);
319 hists_[
"eventLogger_"]->setBinLabel(4,
"pt_{30,loose}(jet1)", 1);
320 hists_[
"eventLogger_"]->setBinLabel(5,
"pt_{30,loose}(jet2)", 1);
321 hists_[
"eventLogger_"]->setBinLabel(6,
"pt_{30,loose}(jet3)", 1);
322 hists_[
"eventLogger_"]->setBinLabel(7,
"pt_{30,loose}(jet4)", 1);
323 hists_[
"eventLogger_"]->setBinLabel(8,
"M_{W}", 1);
324 hists_[
"eventLogger_"]->setBinLabel(9,
"M_{Top}", 1);
325 hists_[
"eventLogger_"]->setAxisTitle(
"logged evts", 2);
351 unsigned int pvMult = 0;
356 fill(
"pvMult_", pvMult);
369 event.getByLabel(
rhoTag, _rhoHandle);
381 unsigned int eMult = 0, eMultIso = 0;
382 std::vector<const reco::PFCandidate*> isoElecs;
384 if (elec->gsfElectronRef().isNull()) {
394 double el_ChHadIso = gsf_el->pfIsolationVariables().sumChargedHadronPt;
395 double el_NeHadIso = gsf_el->pfIsolationVariables().sumNeutralHadronEt;
396 double el_PhIso = gsf_el->pfIsolationVariables().sumPhotonEt;
397 double absEta = std::fabs(gsf_el->superCluster()->eta());
403 else if (absEta < 1.479)
405 else if (absEta < 2.000)
407 else if (absEta < 2.200)
409 else if (absEta < 2.300)
411 else if (absEta < 2.400)
413 else if (absEta < 5.000)
416 double rho = _rhoHandle.
isValid() ? (
float)(*_rhoHandle) : 0;
417 double el_pfRelIso = (el_ChHadIso +
max(0., el_NeHadIso + el_PhIso - rho * eA)) / gsf_el->pt();
421 fill(
"elecRelIso_", el_pfRelIso);
422 fill(
"elecChHadIso_", el_ChHadIso);
423 fill(
"elecNeHadIso_", el_NeHadIso);
424 fill(
"elecPhIso_", el_PhIso);
428 if (!((el_pfRelIso < 0.0588 && absEta < 1.479) || (el_pfRelIso < 0.0571 && absEta > 1.479)))
433 fill(
"elecPt_", elec->pt());
434 fill(
"elecEta_", elec->eta());
435 fill(
"elecPhi_", elec->phi());
442 fill(
"elecMultTight_", eMultIso);
453 unsigned int mMult = 0, mTight = 0, mTightId = 0;
462 if (muonit->muonRef().isNull())
467 if (
muon->isGlobalMuon()) {
468 fill(
"muonDelZ_",
muon->innerTrack()->vz());
469 fill(
"muonDelXY_",
muon->innerTrack()->vx(),
muon->innerTrack()->vy());
474 double chHadPt =
muon->pfIsolationR04().sumChargedHadronPt;
475 double neHadEt =
muon->pfIsolationR04().sumNeutralHadronEt;
476 double phoEt =
muon->pfIsolationR04().sumPhotonEt;
477 double pfRelIso = (chHadPt +
max(0., neHadEt + phoEt - 0.5 *
muon->pfIsolationR04().sumPUPt)) /
480 if (!(
muon->isGlobalMuon() &&
muon->isPFMuon() &&
muon->globalTrack()->normalizedChi2() < 10. &&
481 muon->globalTrack()->hitPattern().numberOfValidMuonHits() > 0 &&
muon->numberOfMatchedStations() > 1 &&
482 muon->innerTrack()->hitPattern().numberOfValidPixelHits() > 0 &&
483 muon->innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5 &&
484 fabs(
muon->muonBestTrack()->dxy(Pvertex.
position())) < 0.2 &&
485 fabs(
muon->muonBestTrack()->dz(Pvertex.
position())) < 0.5))
489 fill(
"muonRelIso_", pfRelIso);
490 fill(
"muonChHadIso_", chHadPt);
491 fill(
"muonNeHadIso_", neHadEt);
492 fill(
"muonPhIso_", phoEt);
496 if (!(pfRelIso < 0.15))
508 fill(
"muonMult_", mMult);
509 fill(
"muonMultTight_", mTight);
532 std::vector<reco::Jet> correctedJets;
533 std::vector<double> JetTagValues;
534 unsigned int mult = 0, multLoose = 0, multCSV = 0;
542 bool isLoose =
false;
544 if (dynamic_cast<const reco::PFJet*>(&*
jet)) {
561 correctedJets.push_back(monitorJet);
565 fill(
"jetBCSV_", (*btagCSV)[jetRef]);
570 JetTagValues.push_back((*btagCSV)[jetRef]);
574 if (multLoose == 0) {
575 fill(
"jet1Pt_", monitorJet.
pt());
576 fill(
"jet1Eta_", monitorJet.
eta());
578 if (multLoose == 1) {
579 fill(
"jet2Pt_", monitorJet.
pt());
580 fill(
"jet2Eta_", monitorJet.
eta());
582 if (multLoose == 2) {
583 fill(
"jet3Pt_", monitorJet.
pt());
584 fill(
"jet3Eta_", monitorJet.
eta());
586 if (multLoose == 3) {
587 fill(
"jet4Pt_", monitorJet.
pt());
588 fill(
"jet4Eta_", monitorJet.
eta());
594 fill(
"jetMultLoose_", multLoose);
595 fill(
"jetMultBCSVM_", multCSV);
611 if (
met->begin() !=
met->end()) {
612 unsigned int idx = met_ -
mets_.begin();
614 fill(
"metPflow_",
met->begin()->et());
630 double topMass = eventKinematics.
massTopQuark(correctedJets);
631 if (
wMass >= 0 && topMass >= 0) {
633 fill(
"massTop_", topMass);
640 if (correctedJets.size() != JetTagValues.size())
644 fill(
"massBTop_", btopMass);
650 if (
logged_ <=
hists_.find(
"eventLogger_")->second->getNbinsY()) {
654 fill(
"eventLogger_", 1.5,
logged_ + 0.5,
event.eventAuxiliary().luminosityBlock());
656 if (!correctedJets.empty())
657 fill(
"eventLogger_", 3.5,
logged_ + 0.5, correctedJets[0].
pt());
658 if (correctedJets.size() > 1)
659 fill(
"eventLogger_", 4.5,
logged_ + 0.5, correctedJets[1].
pt());
660 if (correctedJets.size() > 2)
661 fill(
"eventLogger_", 5.5,
logged_ + 0.5, correctedJets[2].
pt());
662 if (correctedJets.size() > 3)
663 fill(
"eventLogger_", 6.5,
logged_ + 0.5, correctedJets[3].
pt());
673 : vertexSelect_(nullptr),
675 beamspotSelect_(nullptr),
677 ElectronStep(nullptr),
695 std::make_unique<StringCutObjectSelector<reco::BeamSpot>>(
beamspot.getParameter<
std::string>(
"select"));
699 sel_ =
cfg.getParameter<std::vector<edm::ParameterSet>>(
"selection");
701 for (
unsigned int i = 0;
i <
sel_.size(); ++
i) {
704 std::make_pair(
sel_.at(
i),
705 std::make_unique<TopSingleLepton::MonitorEnsemble>(
712 if (
type ==
"muons") {
715 if (
type ==
"elecs") {
721 if (
type ==
"jets") {
724 if (
type ==
"jets/pf") {
727 if (
type ==
"jets/calo") {
739 selIt->second.second->book(ibooker);
759 unsigned int nJetSteps = -1;
760 unsigned int nPFJetSteps = -1;
761 unsigned int nCaloJetSteps = -1;
766 if (
type ==
"empty") {
795 if (
type ==
"jets") {
797 if (
JetSteps[nJetSteps] !=
nullptr) {
805 if (
type ==
"jets/pf") {
815 if (
type ==
"jets/calo") {