diff --git a/plugins/HighPtMuonsInfo.cc b/plugins/HighPtMuonsInfo.cc index f350360c90a..164a7aeee06 100644 --- a/plugins/HighPtMuonsInfo.cc +++ b/plugins/HighPtMuonsInfo.cc @@ -40,6 +40,8 @@ class HighPtMuonsInfo : public edm::EDProducer { const std::vector & values, const std::string & label) const ; + reco::Muon::MuonTrackTypePair getMuonTrackTypePair(const reco::Muon & mu) const; + }; HighPtMuonsInfo::HighPtMuonsInfo(const edm::ParameterSet & iConfig) : @@ -69,11 +71,11 @@ HighPtMuonsInfo::produce(edm::Event & iEvent, const edm::EventSetup & iSetup) { const reco::Muon *mu1 = dynamic_cast(&*d1.masterClone()); if (mu1 == 0) throw cms::Exception("CorruptData") << "First daughter of candidate is not a ShallowClone of a reco::Muon\n"; - reco::Muon::MuonTrackTypePair tuneP1 = muon::tevOptimized(*mu1, 200, 40., 17., 0.25); + reco::Muon::MuonTrackTypePair tuneP1 = getMuonTrackTypePair(*mu1); const reco::Muon *mu2 = dynamic_cast(&*d2.masterClone()); if (mu2 == 0) throw cms::Exception("CorruptData") << "Second daughter of candidate is not a ShallowClone of a reco::Muon\n"; - reco::Muon::MuonTrackTypePair tuneP2 = muon::tevOptimized(*mu2, 200, 40., 17., 0.25); + reco::Muon::MuonTrackTypePair tuneP2 = getMuonTrackTypePair(*mu2); // Momentum and relative uncertainty pt[i] = tuneP2.first->pt(); @@ -116,6 +118,27 @@ HighPtMuonsInfo::writeValueMap(edm::Event &iEvent, iEvent.put(valMap, label); } +reco::Muon::MuonTrackTypePair +HighPtMuonsInfo::getMuonTrackTypePair(const reco::Muon & mu) const +{ + + reco::Muon::MuonTrackTypePair trackTypePair; + + if (mu.tunePMuonBestTrack().isAvailable()) + trackTypePair = std::make_pair(mu.tunePMuonBestTrack(),mu.tunePMuonBestTrackType()); + else if(mu.innerTrack().isAvailable()) + trackTypePair = std::make_pair(mu.innerTrack(),reco::Muon::InnerTrack); + else + trackTypePair = std::make_pair(mu.outerTrack(),reco::Muon::OuterTrack); + + return trackTypePair; + +} + + + + + #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(HighPtMuonsInfo); diff --git a/python/common_variables_cff.py b/python/common_variables_cff.py index 21862c90a27..3c7acc096b5 100644 --- a/python/common_variables_cff.py +++ b/python/common_variables_cff.py @@ -143,6 +143,10 @@ "track.hitPattern.trackerLayersWithMeasurement > 5 && track.hitPattern.numberOfValidPixelHits > 0"), Loose = cms.string("isLooseMuon()"), Medium = cms.string("isPFMuon && innerTrack.validFraction >= 0.8 && ( isGlobalMuon && globalTrack.normalizedChi2 < 3 && combinedQuality.chi2LocalPosition < 12 && combinedQuality.trkKink < 20 && segmentCompatibility >= 0.303 || segmentCompatibility >= 0.451 )"), + HighPt = cms.string("isGlobalMuon && isTrackerMuon && globalTrack.hitPattern.numberOfValidMuonHits > 0 && "+ + "numberOfMatchedStations > 1 && track.hitPattern.numberOfValidPixelHits > 0 && "+ + "track.hitPattern.trackerLayersWithMeasurement > 5 && abs(dB) < 0.2 && "+ + "(tunePMuonBestTrack.ptError / tunePMuonBestTrack.pt) < 0.3"), HWWID = cms.string("( ((isGlobalMuon() && " " globalTrack.normalizedChi2 <10 &&" + " globalTrack.hitPattern.numberOfValidMuonHits > 0 && " + @@ -280,6 +284,15 @@ L3fL1sMu16L1f0L2f10QL3Filtered18QL3pfhcalOldIsoRhoFilteredHB0p21HE0p22 = cms.string("!triggerObjectMatchesByFilter('hltL3fL1sMu16L1f0L2f10QL3Filtered18QL3pfhcalOldIsoRhoFilteredHB0p21HE0p22').empty()"), L3crIsoL1sMu16L1f0L2f10QL3f18QL3OldCaloIsotrkIsoFiltered0p09 = cms.string("!triggerObjectMatchesByFilter('hltL3crIsoL1sMu16L1f0L2f10QL3f18QL3OldCaloIsotrkIsoFiltered0p09').empty()"), L3fL1sMu16f0TkFiltered18Q = cms.string("!triggerObjectMatchesByFilter('hltL3fL1sMu16f0TkFiltered18Q').empty()"), + #add the muon 20 isolation varibles + L3fL1sMu16L1f0L2f10QL3Filtered20Q = cms.string("!triggerObjectMatchesByFilter('hltL3fL1sMu16L1f0L2f10QL3Filtered20Q').empty()"), + L3fL1sMu16L1f0L2f10QL3Filtered20QL3pfecalIsoRhoFilteredEB0p11EE0p08 = cms.string("!triggerObjectMatchesByFilter('hltL3fL1sMu16L1f0L2f10QL3Filtered20QL3pfecalIsoRhoFilteredEB0p11EE0p08').empty()||!triggerObjectMatchesByFilter('hltL3fL1sMu16L1f0L2f10QL3Filtered20QL3pfecalIsoRhoFilteredEB0p13EE0p10').empty()"), + L3fL1sMu16L1f0L2f10QL3Filtered20QL3pfhcalIsoRhoFilteredHB0p21HE0p22 = cms.string("!triggerObjectMatchesByFilter('hltL3fL1sMu16L1f0L2f10QL3Filtered20QL3pfhcalIsoRhoFilteredHB0p21HE0p22').empty()||!triggerObjectMatchesByFilter('hltL3fL1sMu16L1f0L2f10QL3Filtered20QL3pfhcalIsoRhoFiltered0p23').empty()"), + L3crIsoL1sMu16L1f0L2f10QL3f20QL3trkIsoFiltered0p09 = cms.string("!triggerObjectMatchesByFilter('hltL3crIsoL1sMu16L1f0L2f10QL3f20QL3trkIsoFiltered0p09').empty()"), + L3fL1sMu16f0TkFiltered20Q = cms.string("!triggerObjectMatchesByFilter('hltL3fL1sMu16f0TkFiltered20Q').empty()"), + L3fL1sMu16f0TkFiltered20QL3pfecalIsoRhoFilteredEB0p11EE0p08 = cms.string("!triggerObjectMatchesByFilter('hltL3fL1sMu16f0TkFiltered20QL3pfecalIsoRhoFilteredEB0p11EE0p08').empty()||!triggerObjectMatchesByFilter('hltL3fL1sMu16f0TkFiltered20QL3pfecalIsoRhoFilteredEB0p13EE0p10').empty()"), + L3fL1sMu16f0TkFiltered20QL3pfhcalIsoRhoFilteredHB0p21HE0p22 = cms.string("!triggerObjectMatchesByFilter('hltL3fL1sMu16f0TkFiltered20QL3pfhcalIsoRhoFilteredHB0p21HE0p22').empty()||!triggerObjectMatchesByFilter('hltL3fL1sMu16f0TkFiltered20QL3pfhcalIsoRhoFiltered0p23').empty()"), + L3fL1sMu16L1f0Tkf20QL3trkIsoFiltered0p09 = cms.string("!triggerObjectMatchesByFilter('hltL3fL1sMu16L1f0Tkf20QL3trkIsoFiltered0p09').empty()"), ) diff --git a/python/muon/tag_probe_muon_extraIso_cff.py b/python/muon/tag_probe_muon_extraIso_cff.py index 911f9ab7f07..c52dd871093 100644 --- a/python/muon/tag_probe_muon_extraIso_cff.py +++ b/python/muon/tag_probe_muon_extraIso_cff.py @@ -1,9 +1,9 @@ import FWCore.ParameterSet.Config as cms ExtraIsolationVariables = cms.PSet( - kt6RhoAll = cms.InputTag("computeCorrectedIso", "fixedGridRhoFastjetAll"), # was RhoAll - kt6RhoAllCalo = cms.InputTag("computeCorrectedIso", "fixedGridRhoFastjetAllCalo"), # was RhoAllCalo - kt6RhoPU = cms.InputTag("computeCorrectedIso", "fixedGridRhoFastjetCentralChargedPileUp"), # was RhoPU - kt6RhoNeu05 = cms.InputTag("computeCorrectedIso", "fixedGridRhoFastjetCentralNeutral"), # was RhoNeu05 - kt6RhoCentralCalo = cms.InputTag("computeCorrectedIso", "fixedGridRhoFastjetCentralCalo"), # was RhoCentralCalo + fixedGridRhoFastjetAll = cms.InputTag("computeCorrectedIso", "fixedGridRhoFastjetAll"), # was RhoAll / kt6RhoAll + fixedGridRhoFastjetAllCalo = cms.InputTag("computeCorrectedIso", "fixedGridRhoFastjetAllCalo"), # was RhoAllCalo / kt6RhoAllCalo + fixedGridRhoFastjetCentralChargedPileUp = cms.InputTag("computeCorrectedIso", "fixedGridRhoFastjetCentralChargedPileUp"), # was RhoPU / kt6RhoPU + fixedGridRhoFastjetCentralNeutral = cms.InputTag("computeCorrectedIso", "fixedGridRhoFastjetCentralNeutral"), # was RhoNeu05 / kt6RhoNeu05 + fixedGridRhoFastjetCentralCalo = cms.InputTag("computeCorrectedIso", "fixedGridRhoFastjetCentralCalo"), # was RhoCentralCalo / kt6RhoCentralCalo ) diff --git a/test/zmumu/addEAMiniIso.cxx b/test/zmumu/addEAMiniIso.cxx index 3806e2bccfc..fba5f75d318 100644 --- a/test/zmumu/addEAMiniIso.cxx +++ b/test/zmumu/addEAMiniIso.cxx @@ -5,20 +5,26 @@ void addEAMiniIso() { TTree *tIn = (TTree *) gFile->Get("tpTree/fitter_tree"); - Float_t pt, eta, chHad, nHad, phot, rho; + Float_t pt, eta, chHad, nHad, phot, rho, activity_chHad, activity_PUchHad, activity_nHad, activity_phot; tIn->SetBranchAddress("pt", &pt); tIn->SetBranchAddress("eta", &eta); tIn->SetBranchAddress("miniIsoCharged", &chHad); tIn->SetBranchAddress("miniIsoNeutrals", &nHad); tIn->SetBranchAddress("miniIsoPhotons", &phot); + tIn->SetBranchAddress("activity_miniIsoCharged", &activity_chHad); + tIn->SetBranchAddress("activity_miniIsoPUCharged", &activity_PUchHad); + tIn->SetBranchAddress("activity_miniIsoNeutrals", &activity_nHad); + tIn->SetBranchAddress("activity_miniIsoPhotons", &activity_phot); tIn->SetBranchAddress("fixedGridRhoFastjetCentralNeutral", &rho); TFile *fOut = new TFile("tnpZ_withEAMiniIso.root", "RECREATE"); fOut->mkdir("tpTree")->cd(); TTree *tOut = tIn->CloneTree(0); - Float_t pfCombRelMiniIsoEACorr,pfCombAbsMiniIsoEACorr; + Float_t pfCombRelMiniIsoEACorr,pfCombAbsMiniIsoEACorr,pfCombRelActivitydBCorr,pfCombAbsActivitydBCorr; tOut->Branch("pfCombAbsMiniIsoEACorr", &pfCombAbsMiniIsoEACorr, "pfCombAbsMiniIsoEACorr/F"); tOut->Branch("pfCombRelMiniIsoEACorr", &pfCombRelMiniIsoEACorr, "pfCombRelMiniIsoEACorr/F"); + tOut->Branch("pfCombRelActivitydBCorr", &pfCombRelActivitydBCorr, "pfCombRelActivitydBCorr/F"); + tOut->Branch("pfCombAbsActivitydBCorr", &pfCombAbsActivitydBCorr, "pfCombAbsActivitydBCorr/F"); MuonEffectiveArea::MuonEffectiveAreaTarget effAreaTarget = MuonEffectiveArea::kMuEASpring15_25ns; // new 2015 MuonEffectiveArea::MuonEffectiveAreaType effAreaType = MuonEffectiveArea::kMuMiniIso03; @@ -30,14 +36,21 @@ void addEAMiniIso() { tIn->GetEntry(i); Float_t ea_tot = MuonEffectiveArea::GetMuonEffectiveArea(effAreaType, fabs(eta), effAreaTarget); - pfCombAbsMiniIsoEACorr = (chHad + max(0.0, nHad - rho * ea_tot * ((10.0/min(max(pt, 50),200))/0.3)**2) + pfCombAbsMiniIsoEACorr = (chHad + max(0.0, nHad - rho * ea_tot * pow((10.0/min(max((double) pt, 50.),200.))/0.3,2))); pfCombRelMiniIsoEACorr = pfCombAbsMiniIsoEACorr/pt; + + pfCombAbsActivitydBCorr = (activity_chHad + max( (double) (activity_nHad + activity_phot - activity_PUchHad/2) , 0.0)); + pfCombRelActivitydBCorr = pfCombAbsActivitydBCorr/pt; + if (i < 20) { printf("muon with pt = %.2f, eta = %+5.2f:", pt, eta); printf(" charged hadrons %6.3f, neutral hadrons %6.3f, photons %6.3f ", chHad, nHad, phot); printf(" rho %6.3f, ea %6.3f", rho, ea_tot); - printf(" pfCombAbsIsoEAcorr %6.3f\n", pfCombAbsMiniIsoEACorr); - printf(" pfCombRelIsoEAcorr %6.3f\n", pfCombRelMiniIsoEACorr); + printf(" pfCombAbsMiniIsoEAcorr %6.3f\n", pfCombAbsMiniIsoEACorr); + printf(" pfCombRelMiniIsoEAcorr %6.3f\n", pfCombRelMiniIsoEACorr); + printf(" activity charged hadrons %6.3f, PU charged hadrons %6.3f, neutral hadrons %6.3f, photons %6.3f ", activity_chHad, activity_PUchHad, activity_nHad, activity_phot); + printf(" pfCombAbsActivitydBCorr %6.3f\n", pfCombAbsActivitydBCorr); + printf(" pfCombRelActivitydBCorr %6.3f\n", pfCombRelActivitydBCorr); } tOut->Fill(); //if (i > 10000) break;