15 namespace TopSingleLepton {
22 static const double WMASS = 80.4;
30 jetIDSelect_(nullptr),
31 jetlooseSelection_(nullptr),
56 elecSelect_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate>>(
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()) {
391 : ((double)(*electronId)[gsf_el] >=
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))
500 fill(
"muonPt_", muon->pt());
501 fill(
"muonEta_", muon->eta());
502 fill(
"muonPhi_", muon->phi());
508 fill(
"muonMult_", mMult);
509 fill(
"muonMultTight_", mTight);
522 if (setup.
find(edm::eventsetup::EventSetupRecordKey::makeKey<JetCorrectionsRecord>())) {
526 <<
"-----------------------------------------------------------------"
527 "-------------------- \n"
528 <<
" No JetCorrectionsRecord available from EventSetup: "
530 <<
" - Jets will not be corrected. "
532 <<
" - If you want to change this add the following lines to your "
536 <<
" ## load jet corrections "
539 "process.load(\"JetMETCorrections.Configuration."
540 "JetCorrectionServicesAllAlgos_cff\") \n"
541 <<
" process.prefer(\"ak5CaloL2L3\") "
545 <<
"-----------------------------------------------------------------"
546 "-------------------- \n";
558 std::vector<reco::Jet> correctedJets;
559 std::vector<double> JetTagValues;
560 unsigned int mult = 0, multLoose = 0, multCSV = 0;
568 bool isLoose =
false;
570 if (dynamic_cast<const reco::PFJet*>(&*
jet)) {
586 unsigned int idx =
jet - jets->begin();
587 correctedJets.push_back(monitorJet);
591 fill(
"jetBCSV_", (*btagCSV)[jetRef]);
596 JetTagValues.push_back((*btagCSV)[jetRef]);
600 if (multLoose == 0) {
601 fill(
"jet1Pt_", monitorJet.
pt());
602 fill(
"jet1Eta_", monitorJet.
eta());
604 if (multLoose == 1) {
605 fill(
"jet2Pt_", monitorJet.
pt());
606 fill(
"jet2Eta_", monitorJet.
eta());
608 if (multLoose == 2) {
609 fill(
"jet3Pt_", monitorJet.
pt());
610 fill(
"jet3Eta_", monitorJet.
eta());
612 if (multLoose == 3) {
613 fill(
"jet4Pt_", monitorJet.
pt());
614 fill(
"jet4Eta_", monitorJet.
eta());
619 fill(
"jetMult_", mult);
620 fill(
"jetMultLoose_", multLoose);
621 fill(
"jetMultBCSVM_", multCSV);
637 if (met->begin() != met->end()) {
638 unsigned int idx = met_ -
mets_.begin();
640 fill(
"metPflow_", met->begin()->et());
655 double wMass = eventKinematics.
massWBoson(correctedJets);
656 double topMass = eventKinematics.
massTopQuark(correctedJets);
657 if (wMass >= 0 && topMass >= 0) {
658 fill(
"massW_", wMass);
659 fill(
"massTop_", topMass);
666 if (correctedJets.size() != JetTagValues.size())
670 fill(
"massBTop_", btopMass);
676 if (
logged_ <=
hists_.find(
"eventLogger_")->second->getNbinsY()) {
682 if (!correctedJets.empty())
683 fill(
"eventLogger_", 3.5,
logged_ + 0.5, correctedJets[0].
pt());
684 if (correctedJets.size() > 1)
685 fill(
"eventLogger_", 4.5,
logged_ + 0.5, correctedJets[1].
pt());
686 if (correctedJets.size() > 2)
687 fill(
"eventLogger_", 5.5,
logged_ + 0.5, correctedJets[2].
pt());
688 if (correctedJets.size() > 3)
689 fill(
"eventLogger_", 6.5,
logged_ + 0.5, correctedJets[3].
pt());
699 : vertexSelect_(nullptr),
701 beamspotSelect_(nullptr),
703 ElectronStep(nullptr),
727 for (
unsigned int i = 0;
i <
sel_.size(); ++
i) {
730 std::make_pair(
sel_.at(
i),
731 std::make_unique<TopSingleLepton::MonitorEnsemble>(
738 if (
type ==
"muons") {
741 if (
type ==
"elecs") {
747 if (
type ==
"jets") {
750 if (
type ==
"jets/pf") {
753 if (
type ==
"jets/calo") {
765 selIt->second.second->book(ibooker);
784 unsigned int passed = 0;
785 unsigned int nJetSteps = -1;
786 unsigned int nPFJetSteps = -1;
787 unsigned int nCaloJetSteps = -1;
792 if (
type ==
"empty") {
814 if (
PvStep->selectVertex(event)) {
821 if (
type ==
"jets") {
823 if (
JetSteps[nJetSteps] !=
nullptr) {
831 if (
type ==
"jets/pf") {
841 if (
type ==
"jets/calo") {
std::map< std::string, MonitorElement * > hists_
histogram container
std::optional< eventsetup::EventSetupRecordGeneric > find(const eventsetup::EventSetupRecordKey &iKey) const
Log< level::Info, true > LogVerbatim
int logged_
number of logged interesting events
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
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
std::unique_ptr< SelectionStep< reco::PFCandidate > > ElectronStep
virtual void scaleEnergy(double fScale)
scale energy of the jet
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
do this during the event loop
double pt() const final
transverse momentum
virtual void setCurrentFolder(std::string const &fullpath)
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_
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > muonSelect_
extra selection on muons
constexpr bool isUninitialized() const noexcept
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_
EventAuxiliary const & eventAuxiliary() const override
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
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::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
bool getData(T &iHolder) const
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
tuple key
prepare the HTCondor submission files and eventually submit them
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::ESGetToken< JetCorrector, JetCorrectionsRecord > jetCorrector_
jetCorrector
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
constexpr bool isInitialized() const noexcept
std::unique_ptr< SelectionStep< reco::PFCandidate > > MuonStep
std::unique_ptr< SelectionStep< reco::MET > > METStep
std::string label_
instance label
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
T getParameter(std::string const &) const
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_
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
static const unsigned int MAXJETS
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
jetSelection_(iConfig.getParameter< std::string >("jetSelection"))
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
constexpr bool hasValidIndex() const noexcept
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
double eta() const final
momentum pseudorapidity