23 static const double WMASS = 80.4;
25 MonitorEnsemble::MonitorEnsemble(
const char*
label,
50 sources.
getParameter<std::vector<edm::InputTag>>(
"mets"))
138 jetlooseSelection_.reset(
new StringCutObjectSelector<reco::PFJet>(
"chargedHadronEnergyFraction()>0 && chargedMultiplicity()>0 && chargedEmEnergyFraction()<0.99 && neutralHadronEnergyFraction()<0.99 && neutralEmEnergyFraction()<0.99 && (chargedMultiplicity()+neutralMultiplicity())>1"));
150 .getParameter<edm::ParameterSet>(
"cvsVertex");
164 triggerExtras.
getParameter<std::vector<std::string>>(
"paths");
205 hists_[
"pvMult_"] = ibooker.
book1D(
"PvMult",
"N_{good pvs}", 50, 0., 50.);
207 hists_[
"muonPt_"] = ibooker.
book1D(
"MuonPt",
"pt(#mu TightId, TightIso)", 40, 0., 200.);
209 hists_[
"muonMult_"] = ibooker.
book1D(
"MuonMult",
"N_{loose}(#mu)", 10, 0., 10.);
211 hists_[
"muonMultTight_"] = ibooker.
book1D(
"MuonMultTight",
212 "N_{TightIso,TightId}(#mu)", 10, 0., 10.);
214 hists_[
"elecPt_"] = ibooker.
book1D(
"ElecPt",
"pt(e TightId, TightIso)", 40, 0., 200.);
216 hists_[
"jetMult_"] = ibooker.
book1D(
"JetMult",
"N_{30}(jet)", 10, 0., 10.);
218 hists_[
"jetLooseMult_"] = ibooker.
book1D(
"JetLooseMult",
"N_{30,loose}(jet)", 10, 0., 10.);
221 hists_[
"metPflow_"] = ibooker.
book1D(
"METPflow",
"MET_{Pflow}", 50, 0., 200.);
223 hists_[
"massW_"] = ibooker.
book1D(
"MassW",
"M(W)", 60, 0., 300.);
225 hists_[
"massTop_"] = ibooker.
book1D(
"MassTop",
"M(Top)", 50, 0., 500.);
227 hists_[
"MTWm_"] = ibooker.
book1D(
"MTWm",
"M_{T}^{W}(#mu)", 60, 0., 300.);
229 hists_[
"mMTT_"] = ibooker.
book1D(
"mMTT",
"M_{T}^{t}(#mu)", 50, 0., 500.);
232 hists_[
"MTWe_"] = ibooker.
book1D(
"MTWe",
"M_{T}^{W}(e)", 60, 0., 300.);
234 hists_[
"eMTT_"] = ibooker.
book1D(
"eMTT",
"M_{T}^{t}(e)", 50, 0., 500.);
244 hists_[
"muonEta_"] = ibooker.
book1D(
"MuonEta",
"#eta(#mu TightId, TightIso)", 30, -3., 3.);
246 hists_[
"muonRelIso_"] = ibooker.
book1D(
"MuonRelIso",
"Iso_{Rel}(#mu TightId) (#Delta#beta Corrected)", 50, 0., 1.);
248 hists_[
"muonPhi_"] = ibooker.
book1D(
"MuonPhi",
"#phi(#mu TightId, TightIso)", 40, -4., 4.);
250 hists_[
"elecEta_"] = ibooker.
book1D(
"ElecEta",
"#eta(e tightId, TightIso)", 30, -3., 3.);
252 hists_[
"elecRelIso_"] = ibooker.
book1D(
"ElecRelIso",
"Iso_{Rel}(e TightId)", 50, 0., 1.);
254 hists_[
"elecPhi_"] = ibooker.
book1D(
"ElecPhi",
"#phi(e tightId, TightIso)", 40, -4., 4.);
256 hists_[
"elecMultTight_"] = ibooker.
book1D(
"ElecMultTight",
257 "N_{TightIso,TightId}(e)", 10, 0., 10.);
260 hists_[
"jet1Eta_"] = ibooker.
book1D(
"Jet1Eta",
"#eta_{30,loose}(jet1)", 60, -3., 3.);
262 hists_[
"jet1Pt_"] = ibooker.
book1D(
"Jet1Pt",
"pt_{30,loose}(jet1)", 60, 0., 300.);
264 hists_[
"jet2Eta_"] = ibooker.
book1D(
"Jet2Eta",
"#eta_{30,loose}(jet2)", 60, -3., 3.);
266 hists_[
"jet2Pt_"] = ibooker.
book1D(
"Jet2Pt",
"pt_{30,loose}(jet2)", 60, 0., 300.);
269 hists_[
"muonDelZ_"] = ibooker.
book1D(
"MuonDelZ",
"d_{z}(#mu)", 50, -25., 25.);
272 "d_{xy}(#mu)", 50, -0.1, 0.1, 50, -0.1, 0.1);
275 hists_[
"muonDelXY_"]->setAxisTitle(
"x [cm]", 1);
276 hists_[
"muonDelXY_"]->setAxisTitle(
"y [cm]", 2);
283 hists_[
"muonChHadIso_"] = ibooker.
book1D(
"MuonChHadIsoComp",
284 "ChHad_{IsoComponent}(#mu TightId)", 50, 0., 5.);
287 hists_[
"muonNeHadIso_"] = ibooker.
book1D(
"MuonNeHadIsoComp",
288 "NeHad_{IsoComponent}(#mu TightId)", 50, 0., 5.);
292 "Photon_{IsoComponent}(#mu TightId)", 50, 0., 5.);
295 hists_[
"elecChHadIso_"] = ibooker.
book1D(
"ElectronChHadIsoComp",
296 "ChHad_{IsoComponent}(e tightId)", 50, 0., 5.);
299 hists_[
"elecNeHadIso_"] = ibooker.
book1D(
"ElectronNeHadIsoComp",
300 "NeHad_{IsoComponent}(e tightId)", 50, 0., 5.);
303 hists_[
"elecPhIso_"] = ibooker.
book1D(
"ElectronPhIsoComp",
304 "Photon_{IsoComponent}(e tightId)", 50, 0., 5.);
307 hists_[
"jetMultBCSVM_"] = ibooker.
book1D(
"JetMultBCSVM",
"N_{30}(CSVM)", 10, 0., 10.);
310 "BJet Disc_{CSV}(JET)", 100, -1., 2.);
321 "Logged Events", 9, 0., 9., 10, 0., 10.);
324 hists_[
"eventLogger_"]->getTH1()->SetOption(
"TEXT");
325 hists_[
"eventLogger_"]->setBinLabel(1,
"Run", 1);
326 hists_[
"eventLogger_"]->setBinLabel(2,
"Block", 1);
327 hists_[
"eventLogger_"]->setBinLabel(3,
"Event", 1);
328 hists_[
"eventLogger_"]->setBinLabel(4,
"pt_{30,loose}(jet1)", 1);
329 hists_[
"eventLogger_"]->setBinLabel(5,
"pt_{30,loose}(jet2)", 1);
330 hists_[
"eventLogger_"]->setBinLabel(6,
"pt_{30,loose}(jet3)", 1);
331 hists_[
"eventLogger_"]->setBinLabel(7,
"pt_{30,loose}(jet4)", 1);
332 hists_[
"eventLogger_"]->setBinLabel(8,
"M_{W}", 1);
333 hists_[
"eventLogger_"]->setBinLabel(9,
"M_{Top}", 1);
334 hists_[
"eventLogger_"]->setAxisTitle(
"logged evts", 2);
356 unsigned int pvMult = 0;
358 pv != pvs->end(); ++
pv) {
361 fill(
"pvMult_", pvMult);
374 event.getByLabel(
rhoTag,_rhoHandle);
387 unsigned int eMult = 0, eMultIso = 0;
388 std::vector<const reco::PFCandidate*> isoElecs;
391 elec != elecs->end(); ++elec) {
392 if (elec->gsfElectronRef().isNull()) {
401 double el_ChHadIso = gsf_el->pfIsolationVariables().sumChargedHadronPt;
402 double el_NeHadIso = gsf_el->pfIsolationVariables().sumNeutralHadronEt;
403 double el_PhIso = gsf_el->pfIsolationVariables().sumPhotonEt;
404 double absEta =
std::abs(gsf_el->superCluster()->eta());
408 if (absEta < 1.000) eA = 0.1703;
409 else if (absEta < 1.479) eA = 0.1715;
410 else if (absEta < 2.000) eA = 0.1213;
411 else if (absEta < 2.200) eA = 0.1230;
412 else if (absEta < 2.300) eA = 0.1635;
413 else if (absEta < 2.400) eA = 0.1937;
414 else if (absEta < 5.000) eA = 0.2393;
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)))
continue;
434 fill(
"elecPt_", gsf_el->pt());
435 fill(
"elecEta_", gsf_el->eta());
436 fill(
"elecPhi_", gsf_el->phi());
443 fill(
"elecMultTight_", eMultIso);
454 unsigned int mMult = 0, mTight=0, mTightId = 0;
465 if (muonit->muonRef().isNull())
continue;
469 if (muon->isGlobalMuon()) {
470 fill(
"muonDelZ_", muon->innerTrack()->vz());
471 fill(
"muonDelXY_", muon->innerTrack()->vx(), muon->innerTrack()->vy());
476 double chHadPt = muon->pfIsolationR04().sumChargedHadronPt;
477 double neHadEt = muon->pfIsolationR04().sumNeutralHadronEt;
478 double phoEt = muon->pfIsolationR04().sumPhotonEt;
479 double pfRelIso = (chHadPt +
max(0., neHadEt + phoEt - 0.5 * muon->pfIsolationR04().sumPUPt)) / muon->pt();
481 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;
484 fill(
"muonRelIso_", pfRelIso);
485 fill(
"muonChHadIso_", chHadPt);
486 fill(
"muonNeHadIso_", neHadEt);
487 fill(
"muonPhIso_", phoEt);
491 if(!(pfRelIso < 0.15))
continue;
495 fill(
"muonPt_", muon->pt());
496 fill(
"muonEta_", muon->eta());
497 fill(
"muonPhi_", muon->phi());
503 fill(
"muonMult_", mMult);
504 fill(
"muonMultTight_", mTight);
554 std::vector<reco::Jet> correctedJets;
555 std::vector<double> JetTagValues;
557 unsigned int mult = 0, multLoose = 0, multCSV = 0;
558 vector<double> bJetDiscVal;
566 jet != jets->end(); ++
jet) {
567 bool isLoose =
false;
578 if (dynamic_cast<const reco::PFJet*>(&*
jet)) {
608 unsigned int idx =
jet - jets->begin();
609 correctedJets.push_back(monitorJet);
613 fill(
"jetBCSV_", (*btagCSV)[jetRef]);
616 TaggedJetCand = monitorJet;
617 bJetDiscVal.push_back((*btagCSV)[jetRef]);
619 else if(multCSV == 1){
620 bJetDiscVal.push_back((*btagCSV)[jetRef]);
621 if (bJetDiscVal[1] > bJetDiscVal[0]) TaggedJetCand = monitorJet;
625 JetTagValues.push_back((*btagCSV)[jetRef]);
629 if (multLoose == 0) {
630 fill(
"jet1Pt_", monitorJet.
pt());
631 fill(
"jet1Eta_", monitorJet.
eta());
633 if (multLoose == 1) {
634 fill(
"jet2Pt_", monitorJet.
pt());
635 fill(
"jet2Eta_", monitorJet.
eta());
640 fill(
"jetMult_" , mult);
641 fill(
"jetMultLoose_", multLoose);
642 fill(
"jetMultBCSVM_", multCSV);
656 met_ =
mets_.begin();
657 met_ !=
mets_.end(); ++met_) {
660 if (met->begin() != met->end()) {
661 unsigned int idx = met_ -
mets_.begin();
663 fill(
"metPflow_", met->begin()->et());
664 mET = *(met->begin());
678 Calculate eventKinematics(MAXJETS, WMASS);
680 double topMass = eventKinematics.
massTopQuark(correctedJets);
681 if (wMass >= 0 && topMass >= 0) {
682 fill(
"massW_", wMass);
683 fill(
"massTop_", topMass);
690 if (
logged_ <=
hists_.find(
"eventLogger_")->second->getNbinsY()) {
697 if (!correctedJets.empty())
698 fill(
"eventLogger_", 3.5,
logged_ + 0.5, correctedJets[0].
pt());
699 if (correctedJets.size() > 1)
700 fill(
"eventLogger_", 4.5,
logged_ + 0.5, correctedJets[1].
pt());
701 if (correctedJets.size() > 2)
702 fill(
"eventLogger_", 5.5,
logged_ + 0.5, correctedJets[2].
pt());
703 if (correctedJets.size() > 3)
704 fill(
"eventLogger_", 6.5,
logged_ + 0.5, correctedJets[3].
pt());
710 if (multCSV != 0 && mTight == 1) {
712 double mtW = eventKinematics.
tmassWBoson(&mu, mET, TaggedJetCand);
714 double MTT = eventKinematics.
tmassTopQuark(&mu, mET, TaggedJetCand);
718 if (multCSV != 0 && eMultIso == 1) {
719 double mtW = eventKinematics.
tmassWBoson(&e, mET, TaggedJetCand);
721 double MTT = eventKinematics.
tmassTopQuark(&e, mET, TaggedJetCand);
761 std::vector<edm::ParameterSet>
sel =
762 cfg.
getParameter<std::vector<edm::ParameterSet>>(
"selection");
764 for (
unsigned int i = 0;
i < sel.size(); ++
i) {
768 std::unique_ptr<SingleTopTChannelLepton::MonitorEnsemble>(
772 cfg.
getParameter<std::vector<edm::ParameterSet>>(
"selection"),
773 consumesCollector())));
775 for (std::vector<std::string>::const_iterator selIt =
selectionOrder_.begin();
779 using std::unique_ptr;
781 if (
type ==
"muons") {
783 consumesCollector()));
785 if (
type ==
"muons/pf") {
789 if (
type ==
"elecs") {
793 if (
type ==
"elecs/pf") {
799 consumesCollector()));
801 if (
type ==
"jets") {
804 consumesCollector())));
806 if (
type ==
"jets/pf") {
809 consumesCollector())));
811 if (
type ==
"jets/calo") {
814 consumesCollector())));
818 consumesCollector()));
826 selIt->second.second->book(ibooker);
843 unsigned int nJetSteps = -1;
844 unsigned int nPFJetSteps = -1;
845 unsigned int nCaloJetSteps = -1;
846 for (std::vector<std::string>::const_iterator selIt =
selectionOrder_.begin();
850 if (
type ==
"empty") {
853 if (
type ==
"presel") {
887 if (
type ==
"jets") {
897 if (
type ==
"jets/pf") {
907 if (
type ==
"jets/calo") {
std::vector< std::string > selectionOrder_
std::map< std::string, MonitorElement * > hists_
std::string objectType(const std::string &label)
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::JetCorrector > mJetCorrector
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
EventAuxiliary const & eventAuxiliary() const override
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
virtual void scaleEnergy(double fScale)
scale energy of the jet
std::vector< std::string > triggerPaths_
trigger paths
Level verbosity_
verbosity level for booking
std::unique_ptr< StringCutObjectSelector< reco::PFJet > > jetlooseSelection_
static const double WMASS
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
std::vector< ParameterSet > VParameterSet
Base class for all types of Jets.
int logged_
number of logged interesting events
std::vector< std::unique_ptr< SelectionStep< reco::CaloJet > > > CaloJetSteps
std::vector< std::unique_ptr< SelectionStep< reco::Jet > > > JetSteps
double massTopQuark(const std::vector< reco::Jet > &jets)
calculate t-quark mass estimate
def setup(process, global_tag, zero_tesla=False)
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
double pt() const final
transverse momentum
double correction(const LorentzVector &fJet) const
get correction using Jet information only
edm::InputTag beamspot_
beamspot
std::vector< std::string > triggerPaths_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
edm::EDGetTokenT< edm::View< reco::PFCandidate > > muons_
const Point & position() const
position
Jets made from PFObjects.
double massWBoson(const std::vector< reco::Jet > &jets)
calculate W boson mass estimate
SingleTopTChannelLeptonDQM(const edm::ParameterSet &cfg)
default constructor
LuminosityBlockNumber_t luminosityBlock() const
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > muonSelect_
extra selection on muons
Helper class for the calculation of a top and a W boson mass estime.
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > muonIso_
extra isolation criterion on muon
double lowerEdge_
mass window upper and lower edge
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
std::vector< edm::ParameterSet > sel
void setCurrentFolder(std::string const &fullpath)
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > pvSelect_
double tmassTopQuark(reco::RecoCandidate *lep, const reco::MET &met, const reco::Jet &b)
calculate top quark transverse mass estimate
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
std::unique_ptr< SelectionStep< reco::PFCandidate > > PFElectronStep
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
edm::EDGetTokenT< reco::JetTagCollection > btagCSV_
std::string selectionStep(const std::string &label)
double tmassWBoson(reco::RecoCandidate *lep, const reco::MET &met, const reco::Jet &b)
calculate W boson transverse mass estimate
MonitorElement * book2D(Args &&...args)
std::unique_ptr< SelectionStep< reco::GsfElectron > > ElectronStep
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
edm::EDGetTokenT< edm::View< reco::PFCandidate > > elecs_
std::unique_ptr< SelectionStep< reco::MET > > METStep
static const unsigned int MAXJETS
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
Templated helper class to allow a selection on a certain object collection.
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
input sources for monitoring
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
void book(DQMStore::IBooker &ibooker)
book histograms in subdirectory directory
edm::EDGetTokenT< reco::BeamSpot > beamspot__
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< SingleTopTChannelLepton::MonitorEnsemble > > > selection_
bool isUninitialized() const
std::unique_ptr< StringCutObjectSelector< reco::PFJet > > jetSelection_
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
do this during the event loop
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
std::unique_ptr< SelectionStep< reco::Muon > > MuonStep
EventNumber_t event() const
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > elecSelect_
extra selection on electrons
std::unique_ptr< SelectionStep< reco::PFCandidate > > PFMuonStep
std::string label_
instance label