13 namespace TopSingleLepton {
20 static const double WMASS = 80.4;
22 MonitorEnsemble::MonitorEnsemble(
const char*
label,
48 sources.
getParameter<std::vector<edm::InputTag> >(
"mets"))
143 .getParameter<edm::ParameterSet>(
"trackCountingEff");
149 .getParameter<edm::ParameterSet>(
"trackCountingPur");
152 btagPurWP_ = btagPur.getParameter<
double>(
"workingPoint");
155 .getParameter<edm::ParameterSet>(
"secondaryVertex");
158 btagVtxWP_ = btagVtx.getParameter<
double>(
"workingPoint");
161 .getParameter<edm::ParameterSet>(
"cvsVertex");
164 btagCSVWP_ = btagCSV.getParameter<
double>(
"workingPoint");
175 triggerExtras.
getParameter<std::vector<std::string> >(
"paths");
219 hists_[
"RunNumb_"] = ibooker.
book1D(
"RunNumber",
"Run Nr.", 1.e4, 1.5e5, 3.e5);
221 hists_[
"InstLumi_"] = ibooker.
book1D(
"InstLumi",
"Inst. Lumi.", 100, 0., 1.e3);
223 hists_[
"pvMult_"] = ibooker.
book1D(
"PvMult",
"N_{pvs}", 100, 0., 100.);
225 hists_[
"muonPt_"] = ibooker.
book1D(
"MuonPt",
"pt(#mu)", 50, 0., 250.);
227 hists_[
"muonMult_"] = ibooker.
book1D(
"MuonMult",
"N_{All}(#mu)", 10, 0., 10.);
230 "N_{Iso}(#mu)", 10, 0., 10.);
232 hists_[
"elecPt_"] = ibooker.
book1D(
"ElecPt",
"pt(e)", 50, 0., 250.);
234 hists_[
"elecMult_"] = ibooker.
book1D(
"ElecMult",
"N_{All}(e)", 10, 0., 10.);
236 hists_[
"elecMultIso_"] = ibooker.
book1D(
"ElecMultIso",
"N_{Iso}(e)", 10, 0., 10.);
238 hists_[
"jetMult_"] = ibooker.
book1D(
"JetMult",
"N_{30}(jet)", 10, 0., 10.);
241 "Eff(trigger)", nPaths, 0., nPaths);
244 "Mon(trigger)", nPaths, 0., nPaths);
246 hists_[
"metCalo_"] = ibooker.
book1D(
"METCalo",
"MET_{Calo}", 50, 0., 200.);
248 hists_[
"massW_"] = ibooker.
book1D(
"MassW",
"M(W)", 60, 0., 300.);
250 hists_[
"massTop_"] = ibooker.
book1D(
"MassTop",
"M(Top)", 50, 0., 500.);
252 hists_[
"massBTop_"] = ibooker.
book1D(
"MassBTop",
"M(Top, 1 b-tag)", 50, 0., 500.);
260 hists_[
"muonEta_"] = ibooker.
book1D(
"MuonEta",
"#eta(#mu)", 30, -3., 3.);
263 "MuonRelIso",
"Iso_{Rel}(#mu) (#Delta#beta Corrected)", 50, 0., 1.);
265 hists_[
"elecEta_"] = ibooker.
book1D(
"ElecEta",
"#eta(e)", 30, -3., 3.);
267 hists_[
"elecRelIso_"] = ibooker.
book1D(
"ElecRelIso",
"Iso_{Rel}(e)", 50, 0., 1.);
271 "N_{30}(TCHE)", 10, 0., 10.);
275 "Disc_{TCHE}(jet)", 100, 0., 10.);
277 hists_[
"jet1Eta_"] = ibooker.
book1D(
"Jet1Eta",
"#eta_{L2L3}(jet1)", 60, -3., 3.);
279 hists_[
"jet1Pt_"] = ibooker.
book1D(
"Jet1Pt",
"pt_{L2L3}(jet1)", 60, 0., 300.);
281 hists_[
"jet2Eta_"] = ibooker.
book1D(
"Jet2Eta",
"#eta_{L2L3}(jet2)", 60, -3., 3.);
283 hists_[
"jet2Pt_"] = ibooker.
book1D(
"Jet2Pt",
"pt_{L2L3}(jet2)", 60, 0., 300.);
285 hists_[
"jet3Eta_"] = ibooker.
book1D(
"Jet3Eta",
"#eta_{L2L3}(jet3)", 60, -3., 3.);
287 hists_[
"jet3Pt_"] = ibooker.
book1D(
"Jet3Pt",
"pt_{L2L3}(jet3)", 60, 0., 300.);
289 hists_[
"jet4Eta_"] = ibooker.
book1D(
"Jet4Eta",
"#eta_{L2L3}(jet4)", 60, -3., 3.);
291 hists_[
"jet4Pt_"] = ibooker.
book1D(
"Jet4Pt",
"pt_{L2L3}(jet4)", 60, 0., 300.);
293 hists_[
"metTC_"] = ibooker.
book1D(
"METTC",
"MET_{TC}", 50, 0., 200.);
295 hists_[
"metPflow_"] = ibooker.
book1D(
"METPflow",
"MET_{Pflow}", 50, 0., 200.);
297 hists_[
"muonDelZ_"] = ibooker.
book1D(
"MuonDelZ",
"d_{z}(#mu)", 50, -25., 25.);
300 "d_{xy}(#mu)", 50, -0.1, 0.1, 50, -0.1, 0.1);
303 hists_[
"muonDelXY_"]->setAxisTitle(
"x [cm]", 1);
304 hists_[
"muonDelXY_"]->setAxisTitle(
"y [cm]", 2);
311 hists_[
"muonChHadIso_"] = ibooker.
book1D(
"MuonChHadIsoComp",
312 "ChHad_{IsoComponent}(#mu)", 50, 0., 5.);
315 hists_[
"muonNeHadIso_"] = ibooker.
book1D(
"MuonNeHadIsoComp",
316 "NeHad_{IsoComponent}(#mu)", 50, 0., 5.);
320 "Photon_{IsoComponent}(#mu)", 50, 0., 5.);
323 hists_[
"elecChHadIso_"] = ibooker.
book1D(
"ElectronChHadIsoComp",
324 "ChHad_{IsoComponent}(e)", 50, 0., 5.);
327 hists_[
"elecNeHadIso_"] = ibooker.
book1D(
"ElectronNeHadIsoComp",
328 "NeHad_{IsoComponent}(e)", 50, 0., 5.);
331 hists_[
"elecPhIso_"] = ibooker.
book1D(
"ElectronPhIsoComp",
332 "Photon_{IsoComponent}(e)", 50, 0., 5.);
336 "N_{30}(TCHP)", 10, 0., 10.);
339 "Disc_{TCHP}(Jet)", 100, 0., 10.);
342 "N_{30}(SSVHE)", 10, 0., 10.);
345 "Disc_{SSVHE}(Jet)", 35, -1., 6.);
347 hists_[
"jetMultCSVtx_"] = ibooker.
book1D(
"JetMultCSV",
"N_{30}(CSV)", 10, 0., 10.);
350 "Disc_{CSV}(JET)", 100, -1., 2.);
352 hists_[
"jet1PtRaw_"] = ibooker.
book1D(
"Jet1PtRaw",
"pt_{Raw}(jet1)", 60, 0., 300.);
354 hists_[
"jet2PtRaw_"] = ibooker.
book1D(
"Jet2PtRaw",
"pt_{Raw}(jet2)", 60, 0., 300.);
356 hists_[
"jet3PtRaw_"] = ibooker.
book1D(
"Jet3PtRaw",
"pt_{Raw}(jet3)", 60, 0., 300.);
358 hists_[
"jet4PtRaw_"] = ibooker.
book1D(
"Jet4PtRaw",
"pt_{Raw}(jet4)", 60, 0., 300.);
361 "Logged Events", 9, 0., 9., 10, 0., 10.);
364 hists_[
"eventLogger_"]->getTH1()->SetOption(
"TEXT");
365 hists_[
"eventLogger_"]->setBinLabel(1,
"Run", 1);
366 hists_[
"eventLogger_"]->setBinLabel(2,
"Block", 1);
367 hists_[
"eventLogger_"]->setBinLabel(3,
"Event", 1);
368 hists_[
"eventLogger_"]->setBinLabel(4,
"pt_{L2L3}(jet1)", 1);
369 hists_[
"eventLogger_"]->setBinLabel(5,
"pt_{L2L3}(jet2)", 1);
370 hists_[
"eventLogger_"]->setBinLabel(6,
"pt_{L2L3}(jet3)", 1);
371 hists_[
"eventLogger_"]->setBinLabel(7,
"pt_{L2L3}(jet4)", 1);
372 hists_[
"eventLogger_"]->setBinLabel(8,
"M_{W}", 1);
373 hists_[
"eventLogger_"]->setBinLabel(9,
"M_{Top}", 1);
374 hists_[
"eventLogger_"]->setAxisTitle(
"logged evts", 2);
397 unsigned int pvMult = 0;
399 pv != pvs->end(); ++
pv) {
402 fill(
"pvMult_", pvMult);
416 fill(
"InstLumi_", dummy);
437 unsigned int eMult = 0, eMultIso = 0;
438 std::vector<const reco::PFCandidate*> isoElecs;
440 elec != elecs->end(); ++elec) {
441 if (elec->gsfElectronRef().isNull()) {
450 double el_ChHadIso = gsf_el->pfIsolationVariables().sumChargedHadronPt;
451 double el_NeHadIso = gsf_el->pfIsolationVariables().sumNeutralHadronEt;
452 double el_PhIso = gsf_el->pfIsolationVariables().sumPhotonEt;
455 max(0., el_NeHadIso + el_PhIso -
456 0.5 * gsf_el->pfIsolationVariables().sumPUPt)) /
460 fill(
"elecPt_", elec->pt());
461 fill(
"elecEta_", elec->eta());
462 fill(
"elecRelIso_", el_pfRelIso);
463 fill(
"elecChHadIso_", el_ChHadIso);
464 fill(
"elecNeHadIso_", el_NeHadIso);
465 fill(
"elecPhIso_", el_PhIso);
471 isoElecs.push_back(&(*elec));
477 fill(
"elecMult_", eMult);
478 fill(
"elecMultIso_", eMultIso);
489 unsigned int mMult = 0, mMultIso = 0;
497 muonit != muons->end(); ++muonit) {
499 if (muonit->muonRef().isNull())
continue;
503 if (muon->isGlobalMuon()) {
504 fill(
"muonDelZ_", muon->innerTrack()->vz());
505 fill(
"muonDelXY_", muon->innerTrack()->vx(), muon->innerTrack()->vy());
510 double chHadPt = muon->pfIsolationR04().sumChargedHadronPt;
511 double neHadEt = muon->pfIsolationR04().sumNeutralHadronEt;
512 double phoEt = muon->pfIsolationR04().sumPhotonEt;
516 max(0., neHadEt + phoEt - 0.5 * muon->pfIsolationR04().sumPUPt)) /
521 fill(
"muonPt_", muon->pt());
522 fill(
"muonEta_", muon->eta());
524 fill(
"muonRelIso_", pfRelIso);
526 fill(
"muonChHadIso_", chHadPt);
527 fill(
"muonNeHadIso_", neHadEt);
528 fill(
"muonPhIso_", phoEt);
535 fill(
"muonMult_", mMult);
536 fill(
"muonMultIso_", mMultIso);
564 <<
"-----------------------------------------------------------------"
565 "-------------------- \n"
566 <<
" No JetCorrectionsRecord available from EventSetup: "
568 <<
" - Jets will not be corrected. "
570 <<
" - If you want to change this add the following lines to your "
574 <<
" ## load jet corrections "
577 "process.load(\"JetMETCorrections.Configuration."
578 "JetCorrectionServicesAllAlgos_cff\") \n"
579 <<
" process.prefer(\"ak5CaloL2L3\") "
583 <<
"-----------------------------------------------------------------"
584 "-------------------- \n";
589 std::vector<reco::Jet> correctedJets;
590 std::vector<double> JetTagValues;
591 unsigned int mult = 0, multBEff = 0, multBPur = 0, multBVtx = 0, multCSV = 0;
604 jet != jets->end(); ++
jet) {
606 unsigned int idx =
jet - jets->begin();
608 dynamic_cast<const reco::CaloJet*>(jets->refAt(idx).get())) {
609 if (!(*
jetIDSelect_)((*jetID)[jets->refAt(idx)]))
continue;
612 if (dynamic_cast<const reco::CaloJet*>(&*
jet)) {
616 if (!jetSelect(sel)) {
619 }
else if (dynamic_cast<const reco::PFJet*>(&*
jet)) {
623 if (!jetSelect(sel))
continue;
628 if (!jetSelect(sel))
continue;
634 correctedJets.push_back(monitorJet);
639 fill(
"jetBDiscEff_", (*btagEff)[jetRef]);
640 if ((*btagEff)[jetRef] >
btagEffWP_) ++multBEff;
641 fill(
"jetBDiscPur_", (*btagPur)[jetRef]);
642 if ((*btagPur)[jetRef] >
btagPurWP_) ++multBPur;
643 fill(
"jetBDiscVtx_", (*btagVtx)[jetRef]);
644 if ((*btagVtx)[jetRef] >
btagVtxWP_) ++multBVtx;
645 fill(
"jetBCVtx_", (*btagCSV)[jetRef]);
646 if ((*btagCSV)[jetRef] >
btagCSVWP_) ++multCSV;
650 JetTagValues.push_back((*btagCSV)[jetRef]);
654 fill(
"jet1Pt_", monitorJet.
pt());
656 fill(
"jet1Eta_", monitorJet.
eta());
659 fill(
"jet2Pt_", monitorJet.
pt());
661 fill(
"jet2Eta_", monitorJet.
eta());
664 fill(
"jet3Pt_", monitorJet.
pt());
666 fill(
"jet3Eta_", monitorJet.
eta());
669 fill(
"jet4Pt_", monitorJet.
pt());
671 fill(
"jet4Eta_", monitorJet.
eta());
674 fill(
"jetMult_", mult);
675 fill(
"jetMultBEff_", multBEff);
676 fill(
"jetMultBPur_", multBPur);
677 fill(
"jetMultBVtx_", multBVtx);
678 fill(
"jetMultCSVtx_", multCSV);
690 met_ =
mets_.begin();
691 met_ !=
mets_.end(); ++met_) {
694 if (met->begin() != met->end()) {
695 unsigned int idx = met_ -
mets_.begin();
696 if (idx == 0)
fill(
"metCalo_", met->begin()->et());
697 if (idx == 1)
fill(
"metTC_", met->begin()->et());
698 if (idx == 2)
fill(
"metPflow_", met->begin()->et());
713 double wMass = eventKinematics.
massWBoson(correctedJets);
714 double topMass = eventKinematics.
massTopQuark(correctedJets);
715 if (wMass >= 0 && topMass >= 0) {
716 fill(
"massW_", wMass);
717 fill(
"massTop_", topMass);
723 if (correctedJets.size() != JetTagValues.size())
return;
726 if (btopMass >= 0)
fill(
"massBTop_", btopMass);
733 if (
logged_ <=
hists_.find(
"eventLogger_")->second->getNbinsY()) {
740 if (correctedJets.size() > 0)
741 fill(
"eventLogger_", 3.5,
logged_ + 0.5, correctedJets[0].
pt());
742 if (correctedJets.size() > 1)
743 fill(
"eventLogger_", 4.5,
logged_ + 0.5, correctedJets[1].
pt());
744 if (correctedJets.size() > 2)
745 fill(
"eventLogger_", 5.5,
logged_ + 0.5, correctedJets[2].
pt());
746 if (correctedJets.size() > 3)
747 fill(
"eventLogger_", 6.5,
logged_ + 0.5, correctedJets[3].
pt());
790 for (
unsigned int i = 0;
i <
sel_.size(); ++
i) {
794 std::unique_ptr<TopSingleLepton::MonitorEnsemble>(
799 for (std::vector<std::string>::const_iterator selIt =
selectionOrder_.begin();
803 if (
type ==
"muons") {
807 if (
type ==
"elecs") {
815 if (
type ==
"jets") {
819 if (
type ==
"jets/pf") {
823 if (
type ==
"jets/calo") {
838 selIt->second.second->book(ibooker);
855 unsigned int passed = 0;
856 unsigned int nJetSteps = -1;
857 unsigned int nPFJetSteps = -1;
858 unsigned int nCaloJetSteps = -1;
859 for (std::vector<std::string>::const_iterator selIt =
selectionOrder_.begin();
863 if (
type ==
"empty") {
885 if (
PvStep->selectVertex(event)) {
892 if (
type ==
"jets") {
902 if (
type ==
"jets/pf") {
912 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
double btagEffWP_
btag working points
edm::EDGetTokenT< edm::View< reco::PFCandidate > > muons_
double massBTopQuark(const std::vector< reco::Jet > &jets, std::vector< double > VbtagWP, double btagWP_)
calculate b-tagged t-quark mass estimate
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
Jets made from CaloTowers.
std::unique_ptr< SelectionStep< reco::PFCandidate > > ElectronStep
virtual void scaleEnergy(double fScale)
scale energy of the jet
virtual float pt() const
transverse momentum
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
static const double WMASS
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< std::string > triggerPaths_
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
Base class for all types of Jets.
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > muonSelect_
extra selection on muons
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > elecSelect_
extra selection on electrons
double massTopQuark(const std::vector< reco::Jet > &jets)
calculate t-quark mass estimate
TopSingleLeptonDQM(const edm::ParameterSet &cfg)
default constructor
edm::EDGetTokenT< reco::BeamSpot > beamspot__
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)
Jets made from PFObjects.
std::vector< std::string > triggerPaths_
trigger paths
double massWBoson(const std::vector< reco::Jet > &jets)
calculate W boson mass estimate
std::vector< std::string > selectionOrder_
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > elecIso_
extra isolation criterion on electron
std::string selectionStep(const std::string &label)
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
input sources for monitoring
LuminosityBlockNumber_t luminosityBlock() const
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) 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
Helper class for the calculation of a top and a W boson mass estime.
virtual float eta() const
momentum pseudorapidity
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
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
std::unique_ptr< SelectionStep< reco::PFCandidate > > MuonStep
EventAuxiliary const & eventAuxiliary() const
std::unique_ptr< SelectionStep< reco::MET > > METStep
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
std::string label_
instance label
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
edm::EDGetTokenT< reco::JetTagCollection > btagVtx_
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
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
static EventSetupRecordKey makeKey()
std::vector< edm::ParameterSet > sel_
bool isUninitialized() const
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
volatile std::atomic< bool > shutdown_flag false
std::string jetCorrector_
jetCorrector
static const unsigned int MAXJETS
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
EventNumber_t event() const
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
do this during the event loop
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
edm::EDGetTokenT< reco::JetTagCollection > btagPur_
std::vector< std::unique_ptr< SelectionStep< reco::CaloJet > > > CaloJetSteps
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > muonIso_
extra isolation criterion on muon