From cb488b349751619b3dbee8e343cd8b1ec6cee540 Mon Sep 17 00:00:00 2001 From: Junghwan John Goh Date: Tue, 30 Jun 2015 10:45:58 +0200 Subject: [PATCH] switch to patMuons, fix wrong iso veto values --- .../PatExamples/test/MuonVIDCITKAnalyzer.cc | 38 +++++++++++-------- .../test/patTuple_muonVIDCITK_cfg.py | 2 +- .../python/muonPFIsolationCitk_cfi.py | 17 +++++---- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/PhysicsTools/PatExamples/test/MuonVIDCITKAnalyzer.cc b/PhysicsTools/PatExamples/test/MuonVIDCITKAnalyzer.cc index 667e253bf4f8b..cde3c23a38189 100644 --- a/PhysicsTools/PatExamples/test/MuonVIDCITKAnalyzer.cc +++ b/PhysicsTools/PatExamples/test/MuonVIDCITKAnalyzer.cc @@ -6,7 +6,7 @@ #include "FWCore/Utilities/interface/InputTag.h" #include "DataFormats/Common/interface/View.h" #include "DataFormats/Common/interface/ValueMap.h" -#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/PatCandidates/interface/Muon.h" #include "DataFormats/MuonReco/interface/MuonFwd.h" #include "DataFormats/MuonReco/interface/MuonSelectors.h" #include "DataFormats/VertexReco/interface/Vertex.h" @@ -64,8 +64,8 @@ class MuonVIDCITKAnalyzer : public edm::one::EDAnalyzer >(edm::InputTag("muons")); - vertexToken_ = consumes(edm::InputTag("offlinePrimaryVertices")); + muonToken_ = consumes >(iConfig.getParameter("muon")); + vertexToken_ = consumes(iConfig.getParameter("vertex")); string vidPrefix = "muoMuonIDs:cutBasedMuonId-MuonPOG-V0-"; muonLooseVIDToken_ = consumes(edm::InputTag(vidPrefix+"loose" )); @@ -75,9 +75,9 @@ MuonVIDCITKAnalyzer::MuonVIDCITKAnalyzer(const edm::ParameterSet& iConfig) muonHighPtVIDToken_ = consumes(edm::InputTag(vidPrefix+"highpt")); muonChIsoCITKToken_ = consumes(edm::InputTag("muonPFNoPileUpIsolation:h+-DR040-ThresholdVeto000-ConeVeto000")); - muonNhIsoCITKToken_ = consumes(edm::InputTag("muonPFNoPileUpIsolation:h0-DR040-ThresholdVeto050-ConeVeto000")); - muonPhIsoCITKToken_ = consumes(edm::InputTag("muonPFNoPileUpIsolation:gamma-DR040-ThresholdVeto050-ConeVeto000")); - muonPuIsoCITKToken_ = consumes(edm::InputTag("muonPFPileUpIsolation:h+-DR040-ThresholdVeto050-ConeVeto000")); + muonNhIsoCITKToken_ = consumes(edm::InputTag("muonPFNoPileUpIsolation:h0-DR040-ThresholdVeto050-ConeVeto001")); + muonPhIsoCITKToken_ = consumes(edm::InputTag("muonPFNoPileUpIsolation:gamma-DR040-ThresholdVeto050-ConeVeto001")); + muonPuIsoCITKToken_ = consumes(edm::InputTag("muonPFPileUpIsolation:h+-DR040-ThresholdVeto050-ConeVeto001")); muonChIsoIsoDepToken_ = consumes(edm::InputTag("muPFIsoValueCharged04PAT")); muonNhIsoIsoDepToken_ = consumes(edm::InputTag("muPFIsoValueNeutral04PAT")); @@ -100,7 +100,7 @@ MuonVIDCITKAnalyzer::MuonVIDCITKAnalyzer(const edm::ParameterSet& iConfig) void MuonVIDCITKAnalyzer::analyze(const edm::Event& event, const edm::EventSetup& eSetup) { - edm::Handle > muonHandle; + edm::Handle > muonHandle; event.getByToken(muonToken_, muonHandle); edm::Handle vertexHandle; @@ -141,8 +141,8 @@ void MuonVIDCITKAnalyzer::analyze(const edm::Event& event, const edm::EventSetup for ( size_t i=0, n=muonHandle->size(); i(*muRef); + const auto& mu = dynamic_cast(muonHandle->at(i)); + const auto& muRef = mu.originalObjectRef(); stringstream sout; @@ -165,8 +165,6 @@ void MuonVIDCITKAnalyzer::analyze(const edm::Event& event, const edm::EventSetup if ( vidSoft != isSoft ) { sout << " isSoft " << vidSoft << ' ' << isSoft << endl; } if ( vidHighPt != isHighPt ) { sout << " isHighPt" << vidHighPt << ' ' << isHighPt << endl; } - if ( !mu.isPFMuon() || !isTight ) continue; - // Check standard IsoDeposit vs CITK const double citkChIso = (*muonChIsoCITKHandle)[muRef]; const double citkNhIso = (*muonNhIsoCITKHandle)[muRef]; @@ -178,6 +176,11 @@ void MuonVIDCITKAnalyzer::analyze(const edm::Event& event, const edm::EventSetup const double isoDepPhIso = (*muonPhIsoIsoDepHandle)[muRef]; const double isoDepPuIso = (*muonPuIsoIsoDepHandle)[muRef]; + const double patChIso = mu.chargedHadronIso(); + const double patNhIso = mu.neutralHadronIso(); + const double patPhIso = mu.photonIso(); + const double patPuIso = mu.puChargedHadronIso(); + h2Ch_->Fill(isoDepChIso, citkChIso); h2Nh_->Fill(isoDepNhIso, citkNhIso); h2Ph_->Fill(isoDepPhIso, citkPhIso); @@ -188,10 +191,15 @@ void MuonVIDCITKAnalyzer::analyze(const edm::Event& event, const edm::EventSetup hIsoDiffPh_->Fill(citkPhIso-isoDepPhIso); hIsoDiffPu_->Fill(citkPuIso-isoDepPuIso); - if ( std::abs(citkChIso-isoDepChIso) >= 1e-4 ) { sout << " ChIso " << citkChIso << ' ' << isoDepChIso << endl; } - if ( std::abs(citkNhIso-isoDepNhIso) >= 1e-4 ) { sout << " NhIso " << citkNhIso << ' ' << isoDepNhIso << endl; } - if ( std::abs(citkPhIso-isoDepPhIso) >= 1e-4 ) { sout << " PhIso " << citkPhIso << ' ' << isoDepPhIso << endl; } - if ( std::abs(citkPuIso-isoDepPuIso) >= 1e-4 ) { sout << " PuIso " << citkPuIso << ' ' << isoDepPuIso << endl; } + if ( std::abs(citkChIso-isoDepChIso) >= 1e-4 ) { sout << " ChIso citk=" << citkChIso << " isodep=" << isoDepChIso << endl; } + if ( std::abs(citkNhIso-isoDepNhIso) >= 1e-4 ) { sout << " NhIso citk=" << citkNhIso << " isodep=" << isoDepNhIso << endl; } + if ( std::abs(citkPhIso-isoDepPhIso) >= 1e-4 ) { sout << " PhIso citk=" << citkPhIso << " isodep=" << isoDepPhIso << endl; } + if ( std::abs(citkPuIso-isoDepPuIso) >= 1e-4 ) { sout << " PuIso citk=" << citkPuIso << " isodep=" << isoDepPuIso << endl; } + + if ( std::abs(patChIso-isoDepChIso) >= 1e-4 ) { sout << " ChIso pat=" << patChIso << " isodep=" << isoDepChIso << endl; } + if ( std::abs(patNhIso-isoDepNhIso) >= 1e-4 ) { sout << " NhIso pat=" << patNhIso << " isodep=" << isoDepNhIso << endl; } + if ( std::abs(patPhIso-isoDepPhIso) >= 1e-4 ) { sout << " PhIso pat=" << patPhIso << " isodep=" << isoDepPhIso << endl; } + if ( std::abs(patPuIso-isoDepPuIso) >= 1e-4 ) { sout << " PuIso pat=" << patPuIso << " isodep=" << isoDepPuIso << endl; } if ( !sout.str().empty() ) { diff --git a/PhysicsTools/PatExamples/test/patTuple_muonVIDCITK_cfg.py b/PhysicsTools/PatExamples/test/patTuple_muonVIDCITK_cfg.py index c5014f03cc91d..baf479b4fe141 100644 --- a/PhysicsTools/PatExamples/test/patTuple_muonVIDCITK_cfg.py +++ b/PhysicsTools/PatExamples/test/patTuple_muonVIDCITK_cfg.py @@ -23,7 +23,7 @@ process.options.wantSummary = False process.muonVIDCITKAnalyzer = cms.EDAnalyzer("MuonVIDCITKAnalyzer", - muon = cms.InputTag("muons"), + muon = cms.InputTag("patMuons"), vertex = cms.InputTag("offlinePrimaryVertices"), ) diff --git a/RecoMuon/MuonIsolation/python/muonPFIsolationCitk_cfi.py b/RecoMuon/MuonIsolation/python/muonPFIsolationCitk_cfi.py index 946509b32490c..c40bfc544aada 100644 --- a/RecoMuon/MuonIsolation/python/muonPFIsolationCitk_cfi.py +++ b/RecoMuon/MuonIsolation/python/muonPFIsolationCitk_cfi.py @@ -8,38 +8,38 @@ cms.PSet( isolationAlgo = cms.string('MuonPFIsolationWithConeVeto'), coneSize = cms.double(0.3), VetoThreshold = cms.double(0.0), - VetoConeSize = cms.double(0.0), + VetoConeSize = cms.double(0.0001), isolateAgainst = cms.string('h+'), miniAODVertexCodes = cms.vuint32(2,3) ), cms.PSet( isolationAlgo = cms.string('MuonPFIsolationWithConeVeto'), coneSize = cms.double(0.3), VetoThreshold = cms.double(0.5), - VetoConeSize = cms.double(0.0), + VetoConeSize = cms.double(0.01), isolateAgainst = cms.string('h0'), miniAODVertexCodes = cms.vuint32(2,3) ), cms.PSet( isolationAlgo = cms.string('MuonPFIsolationWithConeVeto'), coneSize = cms.double(0.3), VetoThreshold = cms.double(0.5), - VetoConeSize = cms.double(0.0), + VetoConeSize = cms.double(0.01), isolateAgainst = cms.string('gamma'), miniAODVertexCodes = cms.vuint32(2,3) ), cms.PSet( isolationAlgo = cms.string('MuonPFIsolationWithConeVeto'), coneSize = cms.double(0.4), VetoThreshold = cms.double(0.0), - VetoConeSize = cms.double(0.0), + VetoConeSize = cms.double(0.0001), isolateAgainst = cms.string('h+'), miniAODVertexCodes = cms.vuint32(2,3) ), cms.PSet( isolationAlgo = cms.string('MuonPFIsolationWithConeVeto'), coneSize = cms.double(0.4), VetoThreshold = cms.double(0.5), - VetoConeSize = cms.double(0.0), + VetoConeSize = cms.double(0.01), isolateAgainst = cms.string('h0'), miniAODVertexCodes = cms.vuint32(2,3) ), cms.PSet( isolationAlgo = cms.string('MuonPFIsolationWithConeVeto'), coneSize = cms.double(0.4), VetoThreshold = cms.double(0.5), - VetoConeSize = cms.double(0.0), + VetoConeSize = cms.double(0.01), isolateAgainst = cms.string('gamma'), miniAODVertexCodes = cms.vuint32(2,3) ), ), @@ -53,15 +53,16 @@ cms.PSet( isolationAlgo = cms.string('MuonPFIsolationWithConeVeto'), coneSize = cms.double(0.3), VetoThreshold = cms.double(0.5), - VetoConeSize = cms.double(0.0), + VetoConeSize = cms.double(0.01), isolateAgainst = cms.string('h+'), miniAODVertexCodes = cms.vuint32(0,1) ), cms.PSet( isolationAlgo = cms.string('MuonPFIsolationWithConeVeto'), coneSize = cms.double(0.4), VetoThreshold = cms.double(0.5), - VetoConeSize = cms.double(0.0), + VetoConeSize = cms.double(0.01), isolateAgainst = cms.string('h+'), miniAODVertexCodes = cms.vuint32(0,1) ), ), ) +