24 static const double WMASS = 80.4;
26 MonitorEnsemble::MonitorEnsemble(
const char*
label,
35 jetIDSelect_(nullptr),
36 jetlooseSelection_(nullptr),
37 jetSelection_(nullptr),
61 elecSelect_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate>>(
83 std::make_unique<StringCutObjectSelector<reco::Vertex>>(
pvExtras.getParameter<
std::string>(
"select"));
92 muonSelect_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate>>(
98 muonIso_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate>>(
126 "chargedHadronEnergyFraction()>0 && chargedMultiplicity()>0 && chargedEmEnergyFraction()<0.99 && "
127 "neutralHadronEnergyFraction()<0.99 && neutralEmEnergyFraction()<0.99 && "
128 "(chargedMultiplicity()+neutralMultiplicity())>1");
186 hists_[
"pvMult_"] = ibooker.
book1D(
"PvMult",
"N_{good pvs}", 50, 0., 50.);
188 hists_[
"muonPt_"] = ibooker.
book1D(
"MuonPt",
"pt(#mu TightId, TightIso)", 40, 0., 200.);
190 hists_[
"muonMult_"] = ibooker.
book1D(
"MuonMult",
"N_{loose}(#mu)", 10, 0., 10.);
192 hists_[
"muonMultTight_"] = ibooker.
book1D(
"MuonMultTight",
"N_{TightIso,TightId}(#mu)", 10, 0., 10.);
194 hists_[
"elecPt_"] = ibooker.
book1D(
"ElecPt",
"pt(e TightId, TightIso)", 40, 0., 200.);
196 hists_[
"jetMult_"] = ibooker.
book1D(
"JetMult",
"N_{30}(jet)", 10, 0., 10.);
198 hists_[
"jetLooseMult_"] = ibooker.
book1D(
"JetLooseMult",
"N_{30,loose}(jet)", 10, 0., 10.);
201 hists_[
"metPflow_"] = ibooker.
book1D(
"METPflow",
"MET_{Pflow}", 50, 0., 200.);
203 hists_[
"massW_"] = ibooker.
book1D(
"MassW",
"M(W)", 60, 0., 300.);
205 hists_[
"massTop_"] = ibooker.
book1D(
"MassTop",
"M(Top)", 50, 0., 500.);
207 hists_[
"MTWm_"] = ibooker.
book1D(
"MTWm",
"M_{T}^{W}(#mu)", 60, 0., 300.);
209 hists_[
"mMTT_"] = ibooker.
book1D(
"mMTT",
"M_{T}^{t}(#mu)", 50, 0., 500.);
212 hists_[
"MTWe_"] = ibooker.
book1D(
"MTWe",
"M_{T}^{W}(e)", 60, 0., 300.);
214 hists_[
"eMTT_"] = ibooker.
book1D(
"eMTT",
"M_{T}^{t}(e)", 50, 0., 500.);
225 hists_[
"muonEta_"] = ibooker.
book1D(
"MuonEta",
"#eta(#mu TightId, TightIso)", 30, -3., 3.);
227 hists_[
"muonRelIso_"] = ibooker.
book1D(
"MuonRelIso",
"Iso_{Rel}(#mu TightId) (#Delta#beta Corrected)", 50, 0., 1.);
229 hists_[
"muonPhi_"] = ibooker.
book1D(
"MuonPhi",
"#phi(#mu TightId, TightIso)", 40, -4., 4.);
231 hists_[
"elecEta_"] = ibooker.
book1D(
"ElecEta",
"#eta(e tightId, TightIso)", 30, -3., 3.);
233 hists_[
"elecRelIso_"] = ibooker.
book1D(
"ElecRelIso",
"Iso_{Rel}(e TightId)", 50, 0., 1.);
235 hists_[
"elecPhi_"] = ibooker.
book1D(
"ElecPhi",
"#phi(e tightId, TightIso)", 40, -4., 4.);
237 hists_[
"elecMultTight_"] = ibooker.
book1D(
"ElecMultTight",
"N_{TightIso,TightId}(e)", 10, 0., 10.);
239 hists_[
"jet1Eta_"] = ibooker.
book1D(
"Jet1Eta",
"#eta_{30,loose}(jet1)", 60, -3., 3.);
241 hists_[
"jet1Pt_"] = ibooker.
book1D(
"Jet1Pt",
"pt_{30,loose}(jet1)", 60, 0., 300.);
243 hists_[
"jet2Eta_"] = ibooker.
book1D(
"Jet2Eta",
"#eta_{30,loose}(jet2)", 60, -3., 3.);
245 hists_[
"jet2Pt_"] = ibooker.
book1D(
"Jet2Pt",
"pt_{30,loose}(jet2)", 60, 0., 300.);
248 hists_[
"muonDelZ_"] = ibooker.
book1D(
"MuonDelZ",
"d_{z}(#mu)", 50, -25., 25.);
250 hists_[
"muonDelXY_"] = ibooker.
book2D(
"MuonDelXY",
"d_{xy}(#mu)", 50, -0.1, 0.1, 50, -0.1, 0.1);
253 hists_[
"muonDelXY_"]->setAxisTitle(
"x [cm]", 1);
254 hists_[
"muonDelXY_"]->setAxisTitle(
"y [cm]", 2);
262 hists_[
"muonChHadIso_"] = ibooker.
book1D(
"MuonChHadIsoComp",
"ChHad_{IsoComponent}(#mu TightId)", 50, 0., 5.);
265 hists_[
"muonNeHadIso_"] = ibooker.
book1D(
"MuonNeHadIsoComp",
"NeHad_{IsoComponent}(#mu TightId)", 50, 0., 5.);
268 hists_[
"muonPhIso_"] = ibooker.
book1D(
"MuonPhIsoComp",
"Photon_{IsoComponent}(#mu TightId)", 50, 0., 5.);
271 hists_[
"elecChHadIso_"] = ibooker.
book1D(
"ElectronChHadIsoComp",
"ChHad_{IsoComponent}(e tightId)", 50, 0., 5.);
274 hists_[
"elecNeHadIso_"] = ibooker.
book1D(
"ElectronNeHadIsoComp",
"NeHad_{IsoComponent}(e tightId)", 50, 0., 5.);
277 hists_[
"elecPhIso_"] = ibooker.
book1D(
"ElectronPhIsoComp",
"Photon_{IsoComponent}(e tightId)", 50, 0., 5.);
280 hists_[
"jetMultBCSVM_"] = ibooker.
book1D(
"JetMultBCSVM",
"N_{30}(CSVM)", 10, 0., 10.);
282 hists_[
"jetBCSV_"] = ibooker.
book1D(
"JetDiscCSV",
"BJet Disc_{CSV}(JET)", 100, -1., 2.);
292 hists_[
"eventLogger_"] = ibooker.
book2D(
"EventLogger",
"Logged Events", 9, 0., 9., 10, 0., 10.);
295 hists_[
"eventLogger_"]->getTH1()->SetOption(
"TEXT");
296 hists_[
"eventLogger_"]->setBinLabel(1,
"Run", 1);
297 hists_[
"eventLogger_"]->setBinLabel(2,
"Block", 1);
298 hists_[
"eventLogger_"]->setBinLabel(3,
"Event", 1);
299 hists_[
"eventLogger_"]->setBinLabel(4,
"pt_{30,loose}(jet1)", 1);
300 hists_[
"eventLogger_"]->setBinLabel(5,
"pt_{30,loose}(jet2)", 1);
301 hists_[
"eventLogger_"]->setBinLabel(6,
"pt_{30,loose}(jet3)", 1);
302 hists_[
"eventLogger_"]->setBinLabel(7,
"pt_{30,loose}(jet4)", 1);
303 hists_[
"eventLogger_"]->setBinLabel(8,
"M_{W}", 1);
304 hists_[
"eventLogger_"]->setBinLabel(9,
"M_{Top}", 1);
305 hists_[
"eventLogger_"]->setAxisTitle(
"logged evts", 2);
327 unsigned int pvMult = 0;
332 fill(
"pvMult_", pvMult);
345 event.getByLabel(
rhoTag, _rhoHandle);
358 unsigned int eMult = 0, eMultIso = 0;
359 std::vector<const reco::PFCandidate*> isoElecs;
362 if (elec->gsfElectronRef().isNull()) {
372 double el_ChHadIso = gsf_el->pfIsolationVariables().sumChargedHadronPt;
373 double el_NeHadIso = gsf_el->pfIsolationVariables().sumNeutralHadronEt;
374 double el_PhIso = gsf_el->pfIsolationVariables().sumPhotonEt;
375 double absEta =
std::abs(gsf_el->superCluster()->eta());
381 else if (absEta < 1.479)
383 else if (absEta < 2.000)
385 else if (absEta < 2.200)
387 else if (absEta < 2.300)
389 else if (absEta < 2.400)
391 else if (absEta < 5.000)
394 double rho = _rhoHandle.
isValid() ? (
float)(*_rhoHandle) : 0;
395 double el_pfRelIso = (el_ChHadIso +
max(0., el_NeHadIso + el_PhIso - rho * eA)) / gsf_el->pt();
399 fill(
"elecRelIso_", el_pfRelIso);
400 fill(
"elecChHadIso_", el_ChHadIso);
401 fill(
"elecNeHadIso_", el_NeHadIso);
402 fill(
"elecPhIso_", el_PhIso);
406 if (!((el_pfRelIso < 0.0588 && absEta < 1.479) || (el_pfRelIso < 0.0571 && absEta > 1.479)))
412 fill(
"elecPt_", gsf_el->pt());
413 fill(
"elecEta_", gsf_el->eta());
414 fill(
"elecPhi_", gsf_el->phi());
421 fill(
"elecMultTight_", eMultIso);
432 unsigned int mMult = 0, mTight = 0, mTightId = 0;
443 if (muonit->muonRef().isNull())
448 if (
muon->isGlobalMuon()) {
449 fill(
"muonDelZ_",
muon->innerTrack()->vz());
450 fill(
"muonDelXY_",
muon->innerTrack()->vx(),
muon->innerTrack()->vy());
455 double chHadPt =
muon->pfIsolationR04().sumChargedHadronPt;
456 double neHadEt =
muon->pfIsolationR04().sumNeutralHadronEt;
457 double phoEt =
muon->pfIsolationR04().sumPhotonEt;
458 double pfRelIso = (chHadPt +
max(0., neHadEt + phoEt - 0.5 *
muon->pfIsolationR04().sumPUPt)) /
461 if (!(
muon->isGlobalMuon() &&
muon->isPFMuon() &&
muon->globalTrack()->normalizedChi2() < 10. &&
462 muon->globalTrack()->hitPattern().numberOfValidMuonHits() > 0 &&
muon->numberOfMatchedStations() > 1 &&
463 muon->innerTrack()->hitPattern().numberOfValidPixelHits() > 0 &&
464 muon->innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5 &&
465 fabs(
muon->muonBestTrack()->dxy(Pvertex.
position())) < 0.2 &&
466 fabs(
muon->muonBestTrack()->dz(Pvertex.
position())) < 0.5))
470 fill(
"muonRelIso_", pfRelIso);
471 fill(
"muonChHadIso_", chHadPt);
472 fill(
"muonNeHadIso_", neHadEt);
473 fill(
"muonPhIso_", phoEt);
477 if (!(pfRelIso < 0.15))
490 fill(
"muonMult_", mMult);
491 fill(
"muonMultTight_", mTight);
542 std::vector<reco::Jet> correctedJets;
543 std::vector<double> JetTagValues;
545 unsigned int mult = 0, multLoose = 0, multCSV = 0;
546 vector<double> bJetDiscVal;
554 bool isLoose =
false;
565 if (dynamic_cast<const reco::PFJet*>(&*
jet)) {
598 correctedJets.push_back(monitorJet);
602 fill(
"jetBCSV_", (*btagCSV)[jetRef]);
605 TaggedJetCand = monitorJet;
606 bJetDiscVal.push_back((*btagCSV)[jetRef]);
607 }
else if (multCSV == 1) {
608 bJetDiscVal.push_back((*btagCSV)[jetRef]);
609 if (bJetDiscVal[1] > bJetDiscVal[0])
610 TaggedJetCand = monitorJet;
614 JetTagValues.push_back((*btagCSV)[jetRef]);
618 if (multLoose == 0) {
619 fill(
"jet1Pt_", monitorJet.
pt());
620 fill(
"jet1Eta_", monitorJet.
eta());
622 if (multLoose == 1) {
623 fill(
"jet2Pt_", monitorJet.
pt());
624 fill(
"jet2Eta_", monitorJet.
eta());
630 fill(
"jetMultLoose_", multLoose);
631 fill(
"jetMultBCSVM_", multCSV);
648 if (
met->begin() !=
met->end()) {
649 unsigned int idx = met_ -
mets_.begin();
651 fill(
"metPflow_",
met->begin()->et());
652 mET = *(
met->begin());
668 double topMass = eventKinematics.
massTopQuark(correctedJets);
669 if (
wMass >= 0 && topMass >= 0) {
671 fill(
"massTop_", topMass);
677 if (
logged_ <=
hists_.find(
"eventLogger_")->second->getNbinsY()) {
681 fill(
"eventLogger_", 1.5,
logged_ + 0.5,
event.eventAuxiliary().luminosityBlock());
683 if (!correctedJets.empty())
684 fill(
"eventLogger_", 3.5,
logged_ + 0.5, correctedJets[0].
pt());
685 if (correctedJets.size() > 1)
686 fill(
"eventLogger_", 4.5,
logged_ + 0.5, correctedJets[1].
pt());
687 if (correctedJets.size() > 2)
688 fill(
"eventLogger_", 5.5,
logged_ + 0.5, correctedJets[2].
pt());
689 if (correctedJets.size() > 3)
690 fill(
"eventLogger_", 6.5,
logged_ + 0.5, correctedJets[3].
pt());
696 if (multCSV != 0 && mTight == 1) {
697 double mtW = eventKinematics.
tmassWBoson(&
mu, mET, TaggedJetCand);
703 if (multCSV != 0 && eMultIso == 1) {
704 double mtW = eventKinematics.
tmassWBoson(&
e, mET, TaggedJetCand);
706 double MTT = eventKinematics.
tmassTopQuark(&
e, mET, TaggedJetCand);
713 : vertexSelect_(nullptr),
715 beamspotSelect_(nullptr),
718 ElectronStep(nullptr),
719 PFElectronStep(nullptr),
737 std::make_unique<StringCutObjectSelector<reco::BeamSpot>>(
beamspot.getParameter<
std::string>(
"select"));
740 std::vector<edm::ParameterSet>
sel =
cfg.getParameter<std::vector<edm::ParameterSet>>(
"selection");
742 for (
unsigned int i = 0;
i <
sel.size(); ++
i) {
745 std::make_pair(
sel.at(
i),
746 std::make_unique<SingleTopTChannelLepton::MonitorEnsemble>(
749 cfg.getParameter<std::vector<edm::ParameterSet>>(
"selection"),
758 if (
type ==
"muons") {
761 if (
type ==
"muons/pf") {
764 if (
type ==
"elecs") {
767 if (
type ==
"elecs/pf") {
773 if (
type ==
"jets") {
776 if (
type ==
"jets/pf") {
779 if (
type ==
"jets/calo") {
791 selIt->second.second->book(ibooker);
811 unsigned int nJetSteps = -1;
812 unsigned int nPFJetSteps = -1;
813 unsigned int nCaloJetSteps = -1;
818 if (
type ==
"empty") {
821 if (
type ==
"presel") {
854 if (
type ==
"jets") {
864 if (
type ==
"jets/pf") {
874 if (
type ==
"jets/calo") {