21 static const double WMASS = 80.4;
23 MonitorEnsemble::MonitorEnsemble(
const char*
label,
50 sources.
getParameter<std::vector<edm::InputTag> >(
"mets"))
135 jetlooseSelection_.reset(
new StringCutObjectSelector<reco::PFJet>(
"chargedHadronEnergyFraction()>0 && chargedMultiplicity()>0 && chargedEmEnergyFraction()<0.99 && neutralHadronEnergyFraction()<0.99 && neutralEmEnergyFraction()<0.99 && (chargedMultiplicity()+neutralMultiplicity())>1"));
146 .getParameter<edm::ParameterSet>(
"cvsVertex");
160 triggerExtras.
getParameter<std::vector<std::string> >(
"paths");
207 hists_[
"pvMult_"] = ibooker.
book1D(
"PvMult",
"N_{good pvs}", 50, 0., 50.);
209 hists_[
"muonPt_"] = ibooker.
book1D(
"MuonPt",
"pt(#mu TightId, TightIso)", 40, 0., 200.);
211 hists_[
"muonMult_"] = ibooker.
book1D(
"MuonMult",
"N_{loose}(#mu)", 10, 0., 10.);
216 hists_[
"muonMultTight_"] = ibooker.
book1D(
"MuonMultTight",
217 "N_{TightIso,TightId}(#mu)", 10, 0., 10.);
219 hists_[
"elecPt_"] = ibooker.
book1D(
"ElecPt",
"pt(e TightId, TightIso)", 40, 0., 200.);
225 hists_[
"jetMult_"] = ibooker.
book1D(
"JetMult",
"N_{30}(jet)", 10, 0., 10.);
227 hists_[
"jetMultLoose_"] = ibooker.
book1D(
"JetMultLoose",
"N_{30, loose}(jet)", 10, 0., 10.);
236 hists_[
"metPflow_"] = ibooker.
book1D(
"METPflow",
"MET_{Pflow}", 50, 0., 200.);
238 hists_[
"massW_"] = ibooker.
book1D(
"MassW",
"M(W)", 60, 0., 300.);
240 hists_[
"massTop_"] = ibooker.
book1D(
"MassTop",
"M(Top)", 50, 0., 500.);
242 hists_[
"massBTop_"] = ibooker.
book1D(
"MassBTop",
"M(Top, 1 b-tag)", 50, 0., 500.);
250 hists_[
"muonEta_"] = ibooker.
book1D(
"MuonEta",
"#eta(#mu TightId, TightIso)", 30, -3., 3.);
253 "MuonRelIso",
"Iso_{Rel}(#mu TightId) (#Delta#beta Corrected)", 50, 0., 1.);
255 hists_[
"muonPhi_"] = ibooker.
book1D(
"MuonPhi",
"#phi(#mu TightId, TightIso)", 40, -4., 4.);
257 hists_[
"elecEta_"] = ibooker.
book1D(
"ElecEta",
"#eta(e tightId)", 30, -3., 3.);
259 hists_[
"elecRelIso_"] = ibooker.
book1D(
"ElecRelIso",
"Iso_{Rel}(e TightId, TightIso)", 50, 0., 1.);
261 hists_[
"elecPhi_"] = ibooker.
book1D(
"ElecPhi",
"#phi(e tightId)", 40, -4., 4.);
263 hists_[
"elecMultTight_"] = ibooker.
book1D(
"ElecMultTight",
264 "N_{TightIso,TightId}(e)", 10, 0., 10.);
274 hists_[
"jet1Eta_"] = ibooker.
book1D(
"Jet1Eta",
"#eta_{30,loose}(jet1)", 60, -3., 3.);
276 hists_[
"jet1Pt_"] = ibooker.
book1D(
"Jet1Pt",
"pt_{30,loose}(jet1)", 60, 0., 300.);
278 hists_[
"jet2Eta_"] = ibooker.
book1D(
"Jet2Eta",
"#eta_{30,loose}(jet2)", 60, -3., 3.);
280 hists_[
"jet2Pt_"] = ibooker.
book1D(
"Jet2Pt",
"pt_{30,loose}(jet2)", 60, 0., 300.);
282 hists_[
"jet3Eta_"] = ibooker.
book1D(
"Jet3Eta",
"#eta_{30,loose}(jet3)", 60, -3., 3.);
284 hists_[
"jet3Pt_"] = ibooker.
book1D(
"Jet3Pt",
"pt_{30,loose}(jet3)", 60, 0., 300.);
286 hists_[
"jet4Eta_"] = ibooker.
book1D(
"Jet4Eta",
"#eta_{30,loose}(jet4)", 60, -3., 3.);
288 hists_[
"jet4Pt_"] = ibooker.
book1D(
"Jet4Pt",
"pt_{30,loose}(jet4)", 60, 0., 300.);
290 hists_[
"muonDelZ_"] = ibooker.
book1D(
"MuonDelZ",
"d_{z}(#mu)", 50, -25., 25.);
293 "d_{xy}(#mu)", 50, -0.1, 0.1, 50, -0.1, 0.1);
296 hists_[
"muonDelXY_"]->setAxisTitle(
"x [cm]", 1);
297 hists_[
"muonDelXY_"]->setAxisTitle(
"y [cm]", 2);
304 hists_[
"muonChHadIso_"] = ibooker.
book1D(
"MuonChHadIsoComp",
305 "ChHad_{IsoComponent}(#mu TightId)", 50, 0., 5.);
308 hists_[
"muonNeHadIso_"] = ibooker.
book1D(
"MuonNeHadIsoComp",
309 "NeHad_{IsoComponent}(#mu TightId)", 50, 0., 5.);
313 "Photon_{IsoComponent}(#mu )", 50, 0., 5.);
316 hists_[
"elecChHadIso_"] = ibooker.
book1D(
"ElectronChHadIsoComp",
317 "ChHad_{IsoComponent}(e tightId)", 50, 0., 5.);
320 hists_[
"elecNeHadIso_"] = ibooker.
book1D(
"ElectronNeHadIsoComp",
321 "NeHad_{IsoComponent}(e tightId)", 50, 0., 5.);
324 hists_[
"elecPhIso_"] = ibooker.
book1D(
"ElectronPhIsoComp",
325 "Photon_{IsoComponent}(e tightId)", 50, 0., 5.);
328 hists_[
"jetMultBCSVM_"] = ibooker.
book1D(
"JetMultBCSVM",
"N_{30}(CSVM)", 10, 0., 10.);
331 "BJet Disc_{CSV}(JET)", 100, -1., 2.);
342 "Logged Events", 9, 0., 9., 10, 0., 10.);
345 hists_[
"eventLogger_"]->getTH1()->SetOption(
"TEXT");
346 hists_[
"eventLogger_"]->setBinLabel(1,
"Run", 1);
347 hists_[
"eventLogger_"]->setBinLabel(2,
"Block", 1);
348 hists_[
"eventLogger_"]->setBinLabel(3,
"Event", 1);
349 hists_[
"eventLogger_"]->setBinLabel(4,
"pt_{30,loose}(jet1)", 1);
350 hists_[
"eventLogger_"]->setBinLabel(5,
"pt_{30,loose}(jet2)", 1);
351 hists_[
"eventLogger_"]->setBinLabel(6,
"pt_{30,loose}(jet3)", 1);
352 hists_[
"eventLogger_"]->setBinLabel(7,
"pt_{30,loose}(jet4)", 1);
353 hists_[
"eventLogger_"]->setBinLabel(8,
"M_{W}", 1);
354 hists_[
"eventLogger_"]->setBinLabel(9,
"M_{Top}", 1);
355 hists_[
"eventLogger_"]->setAxisTitle(
"logged evts", 2);
381 unsigned int pvMult = 0;
383 pv != pvs->end(); ++
pv) {
386 fill(
"pvMult_", pvMult);
399 event.getByLabel(
rhoTag,_rhoHandle);
409 unsigned int eMult = 0, eMultIso = 0;
410 std::vector<const reco::PFCandidate*> isoElecs;
412 elec != elecs->end(); ++elec) {
413 if (elec->gsfElectronRef().isNull()) {
422 double el_ChHadIso = gsf_el->pfIsolationVariables().sumChargedHadronPt;
423 double el_NeHadIso = gsf_el->pfIsolationVariables().sumNeutralHadronEt;
424 double el_PhIso = gsf_el->pfIsolationVariables().sumPhotonEt;
425 double absEta = std::fabs(gsf_el->superCluster()->eta());
429 if (absEta < 1.000) eA = 0.1703;
430 else if (absEta < 1.479) eA = 0.1715;
431 else if (absEta < 2.000) eA = 0.1213;
432 else if (absEta < 2.200) eA = 0.1230;
433 else if (absEta < 2.300) eA = 0.1635;
434 else if (absEta < 2.400) eA = 0.1937;
435 else if (absEta < 5.000) eA = 0.2393;
437 double rho = _rhoHandle.
isValid() ? (
float)(*_rhoHandle) : 0;
438 double el_pfRelIso = (el_ChHadIso +
max(0., el_NeHadIso + el_PhIso - rho * eA)) /gsf_el->pt();
442 fill(
"elecRelIso_", el_pfRelIso);
443 fill(
"elecChHadIso_", el_ChHadIso);
444 fill(
"elecNeHadIso_", el_NeHadIso);
445 fill(
"elecPhIso_", el_PhIso);
449 if (!((el_pfRelIso<0.0588 && absEta<1.479)||(el_pfRelIso<0.0571 && absEta>1.479)))
continue;
454 fill(
"elecPt_", elec->pt());
455 fill(
"elecEta_", elec->eta());
456 fill(
"elecPhi_", elec->phi());
463 fill(
"elecMultTight_", eMultIso);
474 unsigned int mMult = 0, mTight=0, mTightId = 0;
483 if (muonit->muonRef().isNull())
continue;
487 if (muon->isGlobalMuon()) {
488 fill(
"muonDelZ_", muon->innerTrack()->vz());
489 fill(
"muonDelXY_", muon->innerTrack()->vx(), muon->innerTrack()->vy());
494 double chHadPt = muon->pfIsolationR04().sumChargedHadronPt;
495 double neHadEt = muon->pfIsolationR04().sumNeutralHadronEt;
496 double phoEt = muon->pfIsolationR04().sumPhotonEt;
497 double pfRelIso = (chHadPt +
max(0., neHadEt + phoEt - 0.5 * muon->pfIsolationR04().sumPUPt)) / muon->pt();
499 if(!(muon->isGlobalMuon() && muon->isPFMuon() && muon->globalTrack()->normalizedChi2() < 10. && muon->globalTrack()->hitPattern().numberOfValidMuonHits() > 0 && muon->numberOfMatchedStations() > 1 && muon->innerTrack()->hitPattern().numberOfValidPixelHits() > 0 && muon->innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5 && fabs(muon->muonBestTrack()->dxy(Pvertex.
position())) < 0.2 && fabs(muon->muonBestTrack()->dz(Pvertex.
position())) < 0.5) )
continue;
502 fill(
"muonRelIso_", pfRelIso);
503 fill(
"muonChHadIso_", chHadPt);
504 fill(
"muonNeHadIso_", neHadEt);
505 fill(
"muonPhIso_", phoEt);
509 if(!(pfRelIso < 0.15))
continue;
512 fill(
"muonPt_", muon->pt());
513 fill(
"muonEta_", muon->eta());
514 fill(
"muonPhi_", muon->phi());
520 fill(
"muonMult_", mMult);
521 fill(
"muonMultTight_", mTight);
543 std::vector<reco::Jet> correctedJets;
544 std::vector<double> JetTagValues;
545 unsigned int mult = 0, multLoose = 0, multCSV = 0;
553 jet != jets->end(); ++
jet) {
554 bool isLoose =
false;
556 if (dynamic_cast<const reco::PFJet*>(&*
jet)) {
570 unsigned int idx =
jet - jets->begin();
571 correctedJets.push_back(monitorJet);
575 fill(
"jetBCSV_", (*btagCSV)[jetRef]);
576 if ((*btagCSV)[jetRef] >
btagCSVWP_) ++multCSV;
579 JetTagValues.push_back((*btagCSV)[jetRef]);
583 if (multLoose == 0) {
584 fill(
"jet1Pt_", monitorJet.
pt());
585 fill(
"jet1Eta_", monitorJet.
eta());
587 if (multLoose == 1) {
588 fill(
"jet2Pt_", monitorJet.
pt());
589 fill(
"jet2Eta_", monitorJet.
eta());
591 if (multLoose == 2) {
592 fill(
"jet3Pt_", monitorJet.
pt());
593 fill(
"jet3Eta_", monitorJet.
eta());
595 if (multLoose == 3) {
596 fill(
"jet4Pt_", monitorJet.
pt());
597 fill(
"jet4Eta_", monitorJet.
eta());
602 fill(
"jetMult_" , mult);
603 fill(
"jetMultLoose_", multLoose);
604 fill(
"jetMultBCSVM_", multCSV);
616 met_ =
mets_.begin();
617 met_ !=
mets_.end(); ++met_) {
620 if (met->begin() != met->end()) {
621 unsigned int idx = met_ -
mets_.begin();
622 if (idx == 0)
fill(
"metPflow_", met->begin()->et());
636 Calculate eventKinematics(MAXJETS, WMASS);
637 double wMass = eventKinematics.massWBoson(correctedJets);
638 double topMass = eventKinematics.massTopQuark(correctedJets);
639 if (wMass >= 0 && topMass >= 0) {
640 fill(
"massW_", wMass);
641 fill(
"massTop_", topMass);
647 if (correctedJets.size() != JetTagValues.size())
return;
649 eventKinematics.massBTopQuark(correctedJets, JetTagValues,
btagCSVWP_);
650 if (btopMass >= 0)
fill(
"massBTop_", btopMass);
657 if (
logged_ <=
hists_.find(
"eventLogger_")->second->getNbinsY()) {
664 if (!correctedJets.empty())
665 fill(
"eventLogger_", 3.5,
logged_ + 0.5, correctedJets[0].
pt());
666 if (correctedJets.size() > 1)
667 fill(
"eventLogger_", 4.5,
logged_ + 0.5, correctedJets[1].
pt());
668 if (correctedJets.size() > 2)
669 fill(
"eventLogger_", 5.5,
logged_ + 0.5, correctedJets[2].
pt());
670 if (correctedJets.size() > 3)
671 fill(
"eventLogger_", 6.5,
logged_ + 0.5, correctedJets[3].
pt());
714 for (
unsigned int i = 0;
i <
sel_.size(); ++
i) {
718 std::unique_ptr<TopSingleLepton::MonitorEnsemble>(
723 for (std::vector<std::string>::const_iterator selIt =
selectionOrder_.begin();
727 if (
type ==
"muons") {
731 if (
type ==
"elecs") {
739 if (
type ==
"jets") {
743 if (
type ==
"jets/pf") {
747 if (
type ==
"jets/calo") {
762 selIt->second.second->book(ibooker);
780 unsigned int nJetSteps = -1;
781 unsigned int nPFJetSteps = -1;
782 unsigned int nCaloJetSteps = -1;
783 for (std::vector<std::string>::const_iterator selIt =
selectionOrder_.begin();
787 if (
type ==
"empty") {
809 if (
PvStep->selectVertex(event)) {
816 if (
type ==
"jets") {
818 if (
JetSteps[nJetSteps] !=
nullptr) {
826 if (
type ==
"jets/pf") {
836 if (
type ==
"jets/calo") {
std::map< std::string, MonitorElement * > hists_
histogram container
T getParameter(std::string const &) const
int logged_
number of logged interesting events
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
EventAuxiliary const & eventAuxiliary() const override
edm::EDGetTokenT< edm::View< reco::PFCandidate > > muons_
double eta() const final
momentum pseudorapidity
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
std::unique_ptr< SelectionStep< reco::PFCandidate > > ElectronStep
virtual void scaleEnergy(double fScale)
scale energy of the jet
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup) override
do this during the event loop
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< std::string > triggerPaths_
Base class for all types of Jets.
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > muonSelect_
extra selection on muons
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > elecSelect_
extra selection on electrons
def setup(process, global_tag, zero_tesla=False)
double pt() const final
transverse momentum
TopSingleLeptonDQM(const edm::ParameterSet &cfg)
default constructor
edm::EDGetTokenT< reco::BeamSpot > beamspot__
double correction(const LorentzVector &fJet) const
get correction using Jet information only
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< TopSingleLepton::MonitorEnsemble > > > selection_
edm::EDGetTokenT< reco::JetTagCollection > btagCSV_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
const Point & position() const
position
Jets made from PFObjects.
std::vector< std::string > triggerPaths_
trigger paths
std::vector< std::string > selectionOrder_
edm::EDGetTokenT< reco::JetCorrector > mJetCorrector
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
std::string selectionStep(const std::string &label)
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
input sources for monitoring
LuminosityBlockNumber_t luminosityBlock() const
Level verbosity_
verbosity level for booking
static const double WMASS
double lowerEdge_
mass window upper and lower edge
std::vector< std::unique_ptr< SelectionStep< reco::Jet > > > JetSteps
std::unique_ptr< StringCutObjectSelector< reco::PFJet > > jetSelection_
Helper class for the calculation of a top and a W boson mass estime.
std::string jetSelect_
extra selection on jets
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::InputTag beamspot_
beamspot
MonitorElement * book1D(Args &&...args)
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
edm::EDGetTokenT< edm::View< reco::PFCandidate > > elecs_
void book(DQMStore::IBooker &ibooker)
book histograms in subdirectory directory
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
std::unique_ptr< SelectionStep< reco::PFCandidate > > MuonStep
std::unique_ptr< SelectionStep< reco::MET > > METStep
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
std::string label_
instance label
Templated helper class to allow a selection on a certain object collection.
std::string objectType(const std::string &label)
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > pvSelect_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
std::unique_ptr< StringCutObjectSelector< reco::PFJet > > jetlooseSelection_
std::vector< edm::ParameterSet > sel_
bool isUninitialized() const
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
static const unsigned int MAXJETS
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
EventNumber_t event() const
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
std::vector< std::unique_ptr< SelectionStep< reco::CaloJet > > > CaloJetSteps
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > muonIso_
extra isolation criterion on muon