Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PhysicsTools/NanoAOD/python/muons_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we preserve the old formula for Run2 reprocessing by adding it back through the run2_nanoAOD_ANY modifier?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the new formula should be used also for Run 2 reprocessing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok cool

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"),
Expand Down
16 changes: 9 additions & 7 deletions PhysicsTools/PatAlgos/plugins/PATMuonProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ namespace pat {
std::vector<double> effectiveAreaVec_;
std::vector<double> 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)
Expand Down Expand Up @@ -347,6 +349,10 @@ PATMuonProducer::PATMuonProducer(const edm::ParameterSet& iConfig, PATMuonHeavyO
geometryToken_{esConsumes()},
transientTrackBuilderToken_{esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))},
patMuonPutToken_{produces<std::vector<Muon>>()} {
// Muon MVA ID wps
mvaIDmediumCut_ = iConfig.getParameter<double>("mvaIDwpMedium");
mvaIDtightCut_ = iConfig.getParameter<double>("mvaIDwpTight");

// input source
muonToken_ = consumes<edm::View<reco::Muon>>(iConfig.getParameter<edm::InputTag>("muonSource"));
// embedding of tracks
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down