diff --git a/PhysicsTools/NanoAOD/python/muons_cff.py b/PhysicsTools/NanoAOD/python/muons_cff.py index 8beaff505fb2c..473fe17b88d3c 100644 --- a/PhysicsTools/NanoAOD/python/muons_cff.py +++ b/PhysicsTools/NanoAOD/python/muons_cff.py @@ -40,7 +40,7 @@ inputTensorName= cms.string("float_input"), outputNames = cms.vstring(["probGOOD", "wpMedium", "wpTight"]), batch_eval =cms.bool(True), - outputFormulas = cms.vstring(["at(1)", "? at(1) > 0.14 ? 1 : 0", "? at(1) > 0.35 ? 1 : 0"]), + outputFormulas = cms.vstring(["at(1)", "? at(1) > 0.08 ? 1 : 0", "? at(1) > 0.20 ? 1 : 0"]), variablesOrder = cms.vstring(["LepGood_global_muon","LepGood_validFraction","Muon_norm_chi2_extended","LepGood_local_chi2","LepGood_kink","LepGood_segmentComp","Muon_n_Valid_hits_extended","LepGood_n_MatchedStations","LepGood_Valid_pixel","LepGood_tracker_layers","LepGood_pt","LepGood_eta"]), variables = cms.PSet( LepGood_global_muon = cms.string("isGlobalMuon"), diff --git a/PhysicsTools/PatAlgos/plugins/PATMuonProducer.cc b/PhysicsTools/PatAlgos/plugins/PATMuonProducer.cc index 624a935c47189..ee5fa42c53eb2 100644 --- a/PhysicsTools/PatAlgos/plugins/PATMuonProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATMuonProducer.cc @@ -156,7 +156,9 @@ namespace pat { std::vector effectiveAreaVec_; std::vector miniIsoParams_; double relMiniIsoPUCorrected_; - + /// working points of the muon MVA ID + double mvaIDtightCut_; + double mvaIDmediumCut_; /// embed the track from best muon measurement (global pflow) bool embedBestTrack_; /// embed the track from best muon measurement (muon only) @@ -347,6 +349,10 @@ PATMuonProducer::PATMuonProducer(const edm::ParameterSet& iConfig, PATMuonHeavyO geometryToken_{esConsumes()}, transientTrackBuilderToken_{esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))}, patMuonPutToken_{produces>()} { + // Muon MVA ID wps + mvaIDmediumCut_ = iConfig.getParameter("mvaIDwpMedium"); + mvaIDtightCut_ = iConfig.getParameter("mvaIDwpTight"); + // input source muonToken_ = consumes>(iConfig.getParameter("muonSource")); // embedding of tracks @@ -990,19 +996,15 @@ void PATMuonProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) // MVA ID float mvaID = 0.0; constexpr int MVAsentinelValue = -99; - constexpr float mvaIDmediumCut = 0.08; - constexpr float mvaIDtightCut = 0.12; if (computeMuonIDMVA_) { - const double dz = std::abs(muon.muonBestTrack()->dz(primaryVertex.position())); - const double dxy = std::abs(muon.muonBestTrack()->dxy(primaryVertex.position())); if (muon.isLooseMuon()) { mvaID = globalCache()->muonMvaIDEstimator().computeMVAID(muon)[1]; } else { mvaID = MVAsentinelValue; } muon.setMvaIDValue(mvaID); - muon.setSelector(reco::Muon::MvaIDwpMedium, muon.mvaIDValue() > mvaIDmediumCut); - muon.setSelector(reco::Muon::MvaIDwpTight, muon.mvaIDValue() > mvaIDtightCut and dz < 0.5 and dxy < 0.2); + muon.setSelector(reco::Muon::MvaIDwpMedium, muon.mvaIDValue() > mvaIDmediumCut_); + muon.setSelector(reco::Muon::MvaIDwpTight, muon.mvaIDValue() > mvaIDtightCut_); } //SOFT MVA diff --git a/PhysicsTools/PatAlgos/python/producersLayer1/muonProducer_cfi.py b/PhysicsTools/PatAlgos/python/producersLayer1/muonProducer_cfi.py index b2772de198649..9859b19e68b15 100644 --- a/PhysicsTools/PatAlgos/python/producersLayer1/muonProducer_cfi.py +++ b/PhysicsTools/PatAlgos/python/producersLayer1/muonProducer_cfi.py @@ -111,6 +111,8 @@ # Don't forget to set flags properly in miniAOD_tools.py computeMuonIDMVA = cms.bool(False), mvaIDTrainingFile = cms.FileInPath("RecoMuon/MuonIdentification/data/mvaID.onnx"), + mvaIDwpMedium = cms.double(0.08), + mvaIDwpTight = cms.double(0.20), recomputeBasicSelectors = cms.bool(True), useJec = cms.bool(True), mvaDrMax = cms.double(0.4),