From 8aae290615111377c1bcfb03b840befe6fe48cca Mon Sep 17 00:00:00 2001 From: Michael Revering Date: Mon, 3 Apr 2023 10:30:51 -0500 Subject: [PATCH 1/5] Backport of disappearing muon skim to CMSSW_10_6_X --- .../interface/DisappearingMuonsSkimming.h | 103 ++++ .../Skimming/python/PDWG_EXODisappMuon_cff.py | 24 + .../Skimming/python/Skims_PDWG_cff.py | 11 + .../Skimming/src/DisappearingMuonsSkimming.cc | 444 ++++++++++++++++++ 4 files changed, 582 insertions(+) create mode 100644 Configuration/Skimming/interface/DisappearingMuonsSkimming.h create mode 100644 Configuration/Skimming/python/PDWG_EXODisappMuon_cff.py create mode 100644 Configuration/Skimming/src/DisappearingMuonsSkimming.cc diff --git a/Configuration/Skimming/interface/DisappearingMuonsSkimming.h b/Configuration/Skimming/interface/DisappearingMuonsSkimming.h new file mode 100644 index 0000000000000..5267aa792be5d --- /dev/null +++ b/Configuration/Skimming/interface/DisappearingMuonsSkimming.h @@ -0,0 +1,103 @@ +// -*- C++ -*- +// +// Package: Skimming/DisappearingMuonsSkimming +// Class: DisappearingMuonsSkimming +// +/**\class DisappearingMuonsSkimming DisappearingMuonsSkimming.cc Skimming/DisappearingMuonsSkimming/plugins/DisappearingMuonsSkimming.cc + + Description: [one line class summary] + + Implementation: + [Notes on implementation] +*/ +// +// Original Author: Michael Revering +// Created: Tie, 31 Jan 2023 21:22:23 GMT +// +// +#ifndef Configuration_Skimming_DisappearingMuonsSkimming_h +#define Configuration_Skimming_DisappearingMuonsSkimming_h + +// system include files +#include + +// user include filter +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Framework/interface/one/EDFilter.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "TrackingTools/TransientTrack/interface/TransientTrack.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" +#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" + +// +// class declaration +// + +class DisappearingMuonsSkimming : public edm::one::EDFilter<> { +public: + explicit DisappearingMuonsSkimming(const edm::ParameterSet&); + ~DisappearingMuonsSkimming() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginJob() override; + bool filter(edm::Event&, const edm::EventSetup&) override; + void endJob() override; + bool passTriggers(const edm::Event& iEvent, + edm::EDGetToken m_trigResultsToken, + std::vector m_muonPathsToPass); + double getTrackIsolation(const edm::Event&, + edm::Handle vtxHandle, + std::vector::const_iterator& iTrack); + double getECALIsolation(const edm::Event&, const edm::EventSetup&, const reco::TransientTrack track); + + // ----------member data --------------------------- + + const edm::EDGetToken recoMuonToken_; + const edm::EDGetToken standaloneMuonToken_; + const edm::EDGetTokenT> trackCollectionToken_; + const edm::EDGetTokenT> primaryVerticesToken_; + const edm::EDGetTokenT reducedEndcapRecHitCollectionToken_; + const edm::EDGetTokenT reducedBarrelRecHitCollectionToken_; + const edm::EDGetTokenT trigResultsToken_; + const edm::EDGetToken genParticleToken_; + const edm::EDGetToken genInfoToken_; + const edm::ESGetToken transientTrackToken_; + const edm::ESGetToken geometryToken_; + const std::vector muonPathsToPass_; + + //options + const double minMuPt_; + const double maxMuEta_; + const double minTrackEta_; + const double maxTrackEta_; + const double minTrackPt_; + const double maxTransDCA_; + const double maxLongDCA_; + const double maxVtxChi_; + const double minInvMass_; + const double maxInvMass_; + const double trackIsoConesize_; + const double trackIsoInnerCone_; + const double ecalIsoConesize_; + const double minEcalHitE_; + const double maxTrackIso_; + const double maxEcalIso_; + const double minSigInvMass_; + const double maxSigInvMass_; + const double minStandaloneDr_; + const double maxStandaloneDE_; + const bool keepOffPeak_; + const bool keepSameSign_; + const bool keepTotalRegion_; + const bool keepPartialRegion_; +}; +#endif diff --git a/Configuration/Skimming/python/PDWG_EXODisappMuon_cff.py b/Configuration/Skimming/python/PDWG_EXODisappMuon_cff.py new file mode 100644 index 0000000000000..261d6dd2fc687 --- /dev/null +++ b/Configuration/Skimming/python/PDWG_EXODisappMuon_cff.py @@ -0,0 +1,24 @@ +import FWCore.ParameterSet.Config as cms + +import HLTrigger.HLTfilters.hltHighLevel_cfi as hlt + +from Configuration.EventContent.EventContent_cff import AODSIMEventContent +EXODisappMuonSkimContent = AODSIMEventContent.clone() +EXODisappMuonSkimContent.outputCommands.append('keep *_hbhereco_*_*') +EXODisappMuonSkimContent.outputCommands.append('keep *_horeco_*_*') +EXODisappMuonSkimContent.outputCommands.append('keep *_csc2DRecHits_*_*') + +exoDisappMuonsHLT = hlt.hltHighLevel.clone( + throw = False, + andOr = True, + HLTPaths = [ + "HLT_IsoMu*_v*" + ] +) + +from Configuration.Skimming.disappearingMuonsSkimming_cfi import * +disappMuonsSelection = disappearingMuonsSkimming.clone() + +EXODisappMuonSkimSequence = cms.Sequence( + exoDisappMuonsHLT+disappMuonsSelection +) diff --git a/Configuration/Skimming/python/Skims_PDWG_cff.py b/Configuration/Skimming/python/Skims_PDWG_cff.py index 77af8c63d57dc..0ef940e0c81f7 100644 --- a/Configuration/Skimming/python/Skims_PDWG_cff.py +++ b/Configuration/Skimming/python/Skims_PDWG_cff.py @@ -271,6 +271,17 @@ dataTier = cms.untracked.string('USER') ) +from Configuration.Skimming.PDWG_EXODisappMuon_cff import * +EXODisappMuonPath = cms.Path(EXODisappMuonSkimSequence) +SKIMStreamEXODisappMuon = cms.FilteredStream( + responsible = 'PDWG', + name = 'EXODisappMuon', + paths = (EXODisappMuonPath), + content = EXODisappMuonSkimContent.outputCommands, + selectEvents = cms.untracked.PSet(), + dataTier = cms.untracked.string('USER') + ) + ##################### # For the Data on Data Mixing in TSG from HLTrigger.Configuration.HLT_Fake1_cff import fragment as _fragment diff --git a/Configuration/Skimming/src/DisappearingMuonsSkimming.cc b/Configuration/Skimming/src/DisappearingMuonsSkimming.cc new file mode 100644 index 0000000000000..df63bbd839f42 --- /dev/null +++ b/Configuration/Skimming/src/DisappearingMuonsSkimming.cc @@ -0,0 +1,444 @@ +// -*- C++ -*- +// +// Package: MuMu/DisappearingMuonsSkimming +// Class: DisappearingMuonsSkimming +// +/**\class DisappearingMuonsSkimming DisappearingMuonsSkimming_AOD.cc MuMu/DisappearingMuonsSkimming/plugins/DisappearingMuonsSkimming_AOD.cc + + Description: [one line class summary] + + Implementation: + [Notes on implementation] +*/ +// +// Original Author: Michael Revering +// Created: Mon, 18 Jun 2018 21:22:23 GMT +// +// +// system include files +#include + +#include "Math/VectorUtil.h" +// user include files +#include "Configuration/Skimming/interface/DisappearingMuonsSkimming.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDFilter.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/Common/interface/TriggerResults.h" +#include "FWCore/Common/interface/TriggerNames.h" +#include "DataFormats/PatCandidates/interface/Muon.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "TrackingTools/TransientTrack/interface/TransientTrack.h" +#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" +#include "RecoVertex/KalmanVertexFit/interface/KalmanVertexFitter.h" + +DisappearingMuonsSkimming::DisappearingMuonsSkimming(const edm::ParameterSet& iConfig) + : recoMuonToken_(consumes>(iConfig.getParameter("recoMuons"))), + standaloneMuonToken_(consumes>(iConfig.getParameter("StandaloneTracks"))), + trackCollectionToken_(consumes>(iConfig.getParameter("tracks"))), + primaryVerticesToken_( + consumes>(iConfig.getParameter("primaryVertices"))), + reducedEndcapRecHitCollectionToken_( + consumes(iConfig.getParameter("EERecHits"))), + reducedBarrelRecHitCollectionToken_( + consumes(iConfig.getParameter("EBRecHits"))), + trigResultsToken_(consumes(iConfig.getParameter("TriggerResultsTag"))), + transientTrackToken_( + esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), + geometryToken_(esConsumes(edm::ESInputTag{})), + muonPathsToPass_(iConfig.getParameter>("muonPathsToPass")), + minMuPt_(iConfig.getParameter("minMuPt")), + maxMuEta_(iConfig.getParameter("maxMuEta")), + minTrackEta_(iConfig.getParameter("minTrackEta")), + maxTrackEta_(iConfig.getParameter("maxTrackEta")), + minTrackPt_(iConfig.getParameter("minTrackPt")), + maxTransDCA_(iConfig.getParameter("maxTransDCA")), + maxLongDCA_(iConfig.getParameter("maxLongDCA")), + maxVtxChi_(iConfig.getParameter("maxVtxChi")), + minInvMass_(iConfig.getParameter("minInvMass")), + maxInvMass_(iConfig.getParameter("maxInvMass")), + trackIsoConesize_(iConfig.getParameter("trackIsoConesize")), + trackIsoInnerCone_(iConfig.getParameter("trackIsoInnerCone")), + ecalIsoConesize_(iConfig.getParameter("ecalIsoConesize")), + minEcalHitE_(iConfig.getParameter("minEcalHitE")), + maxTrackIso_(iConfig.getParameter("maxTrackIso")), + maxEcalIso_(iConfig.getParameter("maxEcalIso")), + minSigInvMass_(iConfig.getParameter("minSigInvMass")), + maxSigInvMass_(iConfig.getParameter("maxSigInvMass")), + minStandaloneDr_(iConfig.getParameter("minStandaloneDr")), + maxStandaloneDE_(iConfig.getParameter("maxStandaloneDE")), + keepOffPeak_(iConfig.getParameter("keepOffPeak")), + keepSameSign_(iConfig.getParameter("keepSameSign")), + keepTotalRegion_(iConfig.getParameter("keepTotalRegion")), + keepPartialRegion_(iConfig.getParameter("keepPartialRegion")) {} + +// +// member functions +// + +// ------------ method called for each event ------------ +bool DisappearingMuonsSkimming::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + using namespace std; + using namespace reco; + + bool totalRegion = false; + bool sameSign = false; + bool offPeak = false; + bool partialRegion = false; + + edm::Handle staTracks; + iEvent.getByToken(standaloneMuonToken_, staTracks); + edm::Handle> vertices; + iEvent.getByToken(primaryVerticesToken_, vertices); + edm::Handle> recoMuons; + iEvent.getByToken(recoMuonToken_, recoMuons); + edm::Handle> thePATTrackHandle; + iEvent.getByToken(trackCollectionToken_, thePATTrackHandle); + // this wraps tracks with additional methods that are used in vertex-calculation + const TransientTrackBuilder* transientTrackBuilder = &iSetup.getData(transientTrackToken_); + + if (!passTriggers(iEvent, trigResultsToken_, muonPathsToPass_)) + return false; + + int nMuonTrackCand = 0; + float MuonTrackMass = 0.; + + //Looping over the reconstructed Muons + for (std::vector::const_iterator iMuon = recoMuons->begin(); iMuon != recoMuons->end(); iMuon++) { + if (!(iMuon->isPFMuon() && iMuon->isGlobalMuon())) + continue; + if (!(iMuon->passed(reco::Muon::CutBasedIdTight))) + continue; + if (!(iMuon->passed(reco::Muon::PFIsoTight))) + continue; + if (iMuon->pt() < minMuPt_ || fabs(iMuon->eta()) > maxMuEta_) + continue; + + //Looping over tracks for any good muon + for (std::vector::const_iterator iTrack = thePATTrackHandle->begin(); + iTrack != thePATTrackHandle->end(); + ++iTrack) { + if (!iTrack->quality(reco::Track::qualityByName("highPurity"))) + continue; + if (fabs(iTrack->eta()) > maxTrackEta_ || fabs(iTrack->eta()) < minTrackEta_) + continue; + if (iTrack->pt() < minTrackPt_) + continue; + //Check if the track belongs to a primary vertex for isolation calculation + bool foundtrack = false; + GlobalPoint tkVtx; + for (unsigned int i = 0; i < vertices->size(); i++) { + reco::VertexRef vtx(vertices, i); + if (!vtx->isValid()) { + continue; + } + for (unsigned int j = 0; j < vtx->tracksSize(); j++) { + double dPt = fabs(vtx->trackRefAt(j)->pt() - iTrack->pt()) / iTrack->pt(); + //Find the vertex track that is the same as the probe + if (dPt < 0.001) { + double dR2 = deltaR2(vtx->trackRefAt(j)->eta(), vtx->trackRefAt(j)->phi(), iTrack->eta(), iTrack->phi()); + if (dR2 < 0.001 * 0.001) { + foundtrack = true; + GlobalPoint vert(vtx->x(), vtx->y(), vtx->z()); + tkVtx = vert; + break; + } + } + } + } + if (!foundtrack) + continue; + reco::TransientTrack tk = transientTrackBuilder->build(*iTrack); + TrajectoryStateClosestToPoint traj = tk.trajectoryStateClosestToPoint(tkVtx); + double transDCA = traj.perigeeParameters().transverseImpactParameter(); + double longDCA = traj.perigeeParameters().longitudinalImpactParameter(); + if (fabs(longDCA) > maxLongDCA_) + continue; + if (fabs(transDCA) > maxTransDCA_) + continue; + // make a pair of TransientTracks to feed the vertexer + std::vector tracksToVertex; + tracksToVertex.push_back(transientTrackBuilder->build(*iTrack)); + tracksToVertex.push_back(transientTrackBuilder->build(iMuon->globalTrack())); + // try to fit these two tracks to a common vertex + KalmanVertexFitter vertexFitter; + CachingVertex<5> fittedVertex = vertexFitter.vertex(tracksToVertex); + double vtxChi = 0; + // some poor fits will simply fail to find a common vertex + if (fittedVertex.isValid() && fittedVertex.totalChiSquared() >= 0. && fittedVertex.degreesOfFreedom() > 0) { + // others we can exclude by their poor fit + vtxChi = fittedVertex.totalChiSquared() / fittedVertex.degreesOfFreedom(); + + if (vtxChi < maxVtxChi_) { + // important! evaluate momentum vectors AT THE VERTEX + TrajectoryStateClosestToPoint one_TSCP = + tracksToVertex[0].trajectoryStateClosestToPoint(fittedVertex.position()); + TrajectoryStateClosestToPoint two_TSCP = + tracksToVertex[1].trajectoryStateClosestToPoint(fittedVertex.position()); + GlobalVector one_momentum = one_TSCP.momentum(); + GlobalVector two_momentum = two_TSCP.momentum(); + + double total_energy = sqrt(one_momentum.mag2() + 0.106 * 0.106) + sqrt(two_momentum.mag2() + 0.106 * 0.106); + double total_px = one_momentum.x() + two_momentum.x(); + double total_py = one_momentum.y() + two_momentum.y(); + double total_pz = one_momentum.z() + two_momentum.z(); + MuonTrackMass = sqrt(pow(total_energy, 2) - pow(total_px, 2) - pow(total_py, 2) - pow(total_pz, 2)); + } else { + continue; + } + } else { + continue; + } + if (MuonTrackMass < minInvMass_ || MuonTrackMass > maxInvMass_) + continue; + + double trackIso = getTrackIsolation(iEvent, vertices, iTrack); + //Track iso returns -1 when it fails to find the vertex containing the track (already checked in track selection, but might as well make sure) + if (trackIso < 0) + continue; + double ecalIso = getECALIsolation(iEvent, iSetup, transientTrackBuilder->build(*iTrack)); + if (trackIso > maxTrackIso_ || ecalIso > maxEcalIso_) + continue; + + //A good tag/probe pair has been selected, now check for control or signal regions + if (iMuon->charge() == iTrack->charge()) { + sameSign = true; + } + + //If not same sign CR, need to check standalone muons for signal regions + double staMinDr2 = 1000; + double staMinDEoverE = -10; + if (!staTracks->empty()) { + for (reco::TrackCollection::const_iterator staTrack = staTracks->begin(); staTrack != staTracks->end(); + ++staTrack) { + reco::TransientTrack track = transientTrackBuilder->build(*staTrack); + double dR2 = deltaR2(track.impactPointTSCP().momentum().eta(), + track.impactPointTSCP().momentum().phi(), + (*iTrack).eta(), + (*iTrack).phi()); + double staDE = (std::sqrt(track.impactPointTSCP().momentum().mag2()) - (*iTrack).p()) / (*iTrack).p(); + if (dR2 < staMinDr2) { + staMinDr2 = dR2; + } + //Pick the largest standalone muon within the cone + if (dR2 < minStandaloneDr_ * minStandaloneDr_ && staDE > staMinDEoverE) { + staMinDEoverE = staDE; + } + } + } + if (staMinDr2 > minStandaloneDr_ * minStandaloneDr_) { + if (MuonTrackMass < minSigInvMass_ || MuonTrackMass > maxSigInvMass_) { + offPeak = true; + } else { + totalRegion = true; + } + } else { + if (staMinDEoverE < maxStandaloneDE_) { + if (MuonTrackMass < minSigInvMass_ || MuonTrackMass > maxSigInvMass_) { + offPeak = true; + } else { + partialRegion = true; + } + } + } + nMuonTrackCand++; + } + } + + if (nMuonTrackCand == 0) + return false; + bool passes = false; + //Pass all same sign CR events + if (sameSign && keepSameSign_) { + passes = true; + } + //Pass all total disappearance events + else if (totalRegion && keepTotalRegion_) { + passes = true; + } + //Pass all partial disappearkance off-peak events + else if (offPeak && keepOffPeak_) { + passes = true; + } + //Pass partial region events that pass minimum standalone muon DE/E. + else if (partialRegion && keepPartialRegion_) { + passes = true; + } + return passes; +} + +bool DisappearingMuonsSkimming::passTriggers(const edm::Event& iEvent, + edm::EDGetToken m_trigResultsToken, + std::vector m_muonPathsToPass) { + bool passTriggers = false; + edm::Handle triggerResults; + iEvent.getByToken(m_trigResultsToken, triggerResults); + const edm::TriggerNames& trigNames = iEvent.triggerNames(*triggerResults); + for (size_t i = 0; i < trigNames.size(); ++i) { + const std::string& name = trigNames.triggerName(i); + for (auto& pathName : m_muonPathsToPass) { + if ((name.find(pathName) != std::string::npos)) { + if (triggerResults->accept(i)) { + passTriggers = true; + break; + } + } + } + } + return passTriggers; +} + +double DisappearingMuonsSkimming::getTrackIsolation(const edm::Event& iEvent, + edm::Handle vtxHandle, + std::vector::const_iterator& iTrack) { + bool foundtrack = false; + unsigned int vtxindex = -1; + unsigned int trackindex = -1; + double Isolation = 0; + for (unsigned int i = 0; i < vtxHandle->size(); i++) { + reco::VertexRef vtx(vtxHandle, i); + if (!vtx->isValid()) { + continue; + } + for (unsigned int j = 0; j < vtx->tracksSize(); j++) { + double dPt = fabs(vtx->trackRefAt(j)->pt() - iTrack->pt()) / iTrack->pt(); + //Find the vertex track that is the same as the probe + if (dPt < 0.001) { + double dR2 = deltaR2(vtx->trackRefAt(j)->eta(), vtx->trackRefAt(j)->phi(), iTrack->eta(), iTrack->phi()); + if (dR2 < 0.001 * 0.001) { + vtxindex = i; + trackindex = j; + foundtrack = true; + break; + } + } + } + } + + if (!foundtrack) { + return -1; + } + + reco::VertexRef primaryVtx(vtxHandle, vtxindex); + + for (unsigned int i = 0; i < primaryVtx->tracksSize(); i++) { + if (i == trackindex) + continue; + reco::TrackBaseRef secondarytrack = primaryVtx->trackRefAt(i); + if (deltaR2(iTrack->eta(), iTrack->phi(), secondarytrack->eta(), secondarytrack->phi()) > + trackIsoConesize_ * trackIsoConesize_ || + deltaR2(iTrack->eta(), iTrack->phi(), secondarytrack->eta(), secondarytrack->phi()) < + trackIsoInnerCone_ * trackIsoInnerCone_) + continue; + Isolation += secondarytrack->pt(); + } + + return Isolation / iTrack->pt(); +} + +double DisappearingMuonsSkimming::getECALIsolation(const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const reco::TransientTrack track) { + edm::Handle rechitsEE; + iEvent.getByToken(reducedEndcapRecHitCollectionToken_, rechitsEE); + + edm::Handle rechitsEB; + iEvent.getByToken(reducedBarrelRecHitCollectionToken_, rechitsEB); + + const CaloGeometry& caloGeom = iSetup.getData(geometryToken_); + TrajectoryStateClosestToPoint t0 = track.impactPointTSCP(); + double eDR = 0; + + for (EcalRecHitCollection::const_iterator hit = rechitsEE->begin(); hit != rechitsEE->end(); hit++) { + const DetId id = (*hit).detid(); + const GlobalPoint hitPos = caloGeom.getSubdetectorGeometry(id)->getGeometry(id)->getPosition(); + //Check if hit and track trajectory ar in the same endcap (transient track projects both ways) + if ((hitPos.eta() * t0.momentum().eta()) < 0) { + continue; + } + TrajectoryStateClosestToPoint traj = track.trajectoryStateClosestToPoint(hitPos); + math::XYZVector idPositionRoot(hitPos.x(), hitPos.y(), hitPos.z()); + math::XYZVector trajRoot(traj.position().x(), traj.position().y(), traj.position().z()); + if (deltaR2(idPositionRoot, trajRoot) < ecalIsoConesize_ * ecalIsoConesize_ && (*hit).energy() > minEcalHitE_) { + eDR += (*hit).energy(); + } + } + for (EcalRecHitCollection::const_iterator hit = rechitsEB->begin(); hit != rechitsEB->end(); hit++) { + const DetId id = (*hit).detid(); + const GlobalPoint hitPos = caloGeom.getSubdetectorGeometry(id)->getGeometry(id)->getPosition(); + if ((hitPos.eta() * t0.momentum().eta()) < 0) { + continue; + } + TrajectoryStateClosestToPoint traj = track.trajectoryStateClosestToPoint(hitPos); + math::XYZVector idPositionRoot(hitPos.x(), hitPos.y(), hitPos.z()); + math::XYZVector trajRoot(traj.position().x(), traj.position().y(), traj.position().z()); + if (deltaR2(idPositionRoot, trajRoot) < ecalIsoConesize_ * ecalIsoConesize_ && (*hit).energy() > minEcalHitE_) { + eDR += (*hit).energy(); + } + } + + return eDR; +} + +void DisappearingMuonsSkimming::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("recoMuons", edm::InputTag("muons")); + desc.add("tracks", edm::InputTag("generalTracks")); + desc.add("StandaloneTracks", edm::InputTag("standAloneMuons")); + desc.add("primaryVertices", edm::InputTag("offlinePrimaryVertices")); + desc.add("EERecHits", edm::InputTag("reducedEcalRecHitsEE")); + desc.add("EBRecHits", edm::InputTag("reducedEcalRecHitsEB")); + desc.add("TriggerResultsTag", edm::InputTag("TriggerResults", "", "HLT")); + desc.add>("muonPathsToPass", + { + "HLT_IsoMu24_v", + "HLT_IsoMu27_v", + }); + desc.add("minMuPt", 26); + desc.add("maxMuEta", 2.4); + desc.add("minTrackEta", 0); + desc.add("maxTrackEta", 2.4); + desc.add("minTrackPt", 20); + desc.add("maxTransDCA", 0.005); + desc.add("maxLongDCA", 0.05); + desc.add("maxVtxChi", 3.0); + desc.add("minInvMass", 50); + desc.add("maxInvMass", 150); + desc.add("trackIsoConesize", 0.3); + desc.add("trackIsoInnerCone", 0.01); + desc.add("ecalIsoConesize", 0.4); + desc.add("minEcalHitE", 0.3); + desc.add("maxTrackIso", 0.05); + desc.add("maxEcalIso", 10); + desc.add("minSigInvMass", 76); + desc.add("maxSigInvMass", 106); + desc.add("minStandaloneDr", 1.0); + desc.add("maxStandaloneDE", -0.5); + desc.add("keepOffPeak", true); + desc.add("keepSameSign", true); + desc.add("keepTotalRegion", true); + desc.add("keepPartialRegion", true); + descriptions.addWithDefaultLabel(desc); +} + +// ------------ method called once each job just before starting event loop ------------ +void DisappearingMuonsSkimming::beginJob() {} + +// ------------ method called once each job just after ending the event loop ------------ +void DisappearingMuonsSkimming::endJob() {} + +//define this as a plug-in +DEFINE_FWK_MODULE(DisappearingMuonsSkimming); From 3b7b8927250270e588d3acbef0d7cf4a7baf8183 Mon Sep 17 00:00:00 2001 From: Michael Revering Date: Mon, 3 Apr 2023 10:38:24 -0500 Subject: [PATCH 2/5] Updated default minTrackEta to reflect endcap requirement in Run 2 --- Configuration/Skimming/src/DisappearingMuonsSkimming.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/Skimming/src/DisappearingMuonsSkimming.cc b/Configuration/Skimming/src/DisappearingMuonsSkimming.cc index df63bbd839f42..9748282299dfd 100644 --- a/Configuration/Skimming/src/DisappearingMuonsSkimming.cc +++ b/Configuration/Skimming/src/DisappearingMuonsSkimming.cc @@ -409,7 +409,7 @@ void DisappearingMuonsSkimming::fillDescriptions(edm::ConfigurationDescriptions& }); desc.add("minMuPt", 26); desc.add("maxMuEta", 2.4); - desc.add("minTrackEta", 0); + desc.add("minTrackEta", 1.4); desc.add("maxTrackEta", 2.4); desc.add("minTrackPt", 20); desc.add("maxTransDCA", 0.005); From eb41c3df2ed66f29473af270699f1012534d9320 Mon Sep 17 00:00:00 2001 From: Michael Revering Date: Tue, 11 Apr 2023 11:59:32 -0500 Subject: [PATCH 3/5] Implemented optimizations from Marco Musich --- .../interface/DisappearingMuonsSkimming.h | 46 ++-- .../Skimming/src/DisappearingMuonsSkimming.cc | 219 ++++++++---------- 2 files changed, 127 insertions(+), 138 deletions(-) diff --git a/Configuration/Skimming/interface/DisappearingMuonsSkimming.h b/Configuration/Skimming/interface/DisappearingMuonsSkimming.h index 5267aa792be5d..56c9d81f52a3f 100644 --- a/Configuration/Skimming/interface/DisappearingMuonsSkimming.h +++ b/Configuration/Skimming/interface/DisappearingMuonsSkimming.h @@ -22,20 +22,22 @@ #include // user include filter -#include "FWCore/Utilities/interface/EDGetToken.h" -#include "FWCore/Framework/interface/one/EDFilter.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" #include "DataFormats/TrackReco/interface/Track.h" -#include "TrackingTools/TransientTrack/interface/TransientTrack.h" #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/Common/interface/TriggerResults.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "TrackingTools/Records/interface/TransientTrackRecord.h" -#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "FWCore/Framework/interface/one/EDFilter.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/EDGetToken.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" +#include "TrackingTools/TransientTrack/interface/TransientTrack.h" +#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" // // class declaration @@ -48,28 +50,28 @@ class DisappearingMuonsSkimming : public edm::one::EDFilter<> { static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - void beginJob() override; bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; + bool passTriggers(const edm::Event& iEvent, - edm::EDGetToken m_trigResultsToken, + const edm::TriggerResults& results, std::vector m_muonPathsToPass); - double getTrackIsolation(const edm::Event&, - edm::Handle vtxHandle, - std::vector::const_iterator& iTrack); + + bool findTrackInVertices(const reco::TrackRef& tkToMatch, + const reco::VertexCollection& vertices, + unsigned int& vtxIndex, + unsigned int& trackIndex); + + double getTrackIsolation(const reco::TrackRef& tkToMatch, const reco::VertexCollection& vertices); double getECALIsolation(const edm::Event&, const edm::EventSetup&, const reco::TransientTrack track); // ----------member data --------------------------- - - const edm::EDGetToken recoMuonToken_; - const edm::EDGetToken standaloneMuonToken_; - const edm::EDGetTokenT> trackCollectionToken_; - const edm::EDGetTokenT> primaryVerticesToken_; + const edm::EDGetTokenT recoMuonToken_; + const edm::EDGetTokenT standaloneMuonToken_; + const edm::EDGetTokenT trackCollectionToken_; + const edm::EDGetTokenT primaryVerticesToken_; const edm::EDGetTokenT reducedEndcapRecHitCollectionToken_; const edm::EDGetTokenT reducedBarrelRecHitCollectionToken_; const edm::EDGetTokenT trigResultsToken_; - const edm::EDGetToken genParticleToken_; - const edm::EDGetToken genInfoToken_; const edm::ESGetToken transientTrackToken_; const edm::ESGetToken geometryToken_; const std::vector muonPathsToPass_; diff --git a/Configuration/Skimming/src/DisappearingMuonsSkimming.cc b/Configuration/Skimming/src/DisappearingMuonsSkimming.cc index 9748282299dfd..53f1e1b66b6fa 100644 --- a/Configuration/Skimming/src/DisappearingMuonsSkimming.cc +++ b/Configuration/Skimming/src/DisappearingMuonsSkimming.cc @@ -17,38 +17,27 @@ // // system include files #include - #include "Math/VectorUtil.h" + // user include files #include "Configuration/Skimming/interface/DisappearingMuonsSkimming.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDFilter.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/Math/interface/deltaR.h" #include "FWCore/Common/interface/TriggerNames.h" -#include "DataFormats/PatCandidates/interface/Muon.h" -#include "DataFormats/VertexReco/interface/Vertex.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/InputTag.h" -#include "FWCore/Utilities/interface/EDGetToken.h" -#include "DataFormats/Math/interface/deltaR.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/TrackReco/interface/Track.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "TrackingTools/TransientTrack/interface/TransientTrack.h" -#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" -#include "TrackingTools/Records/interface/TransientTrackRecord.h" #include "RecoVertex/KalmanVertexFit/interface/KalmanVertexFitter.h" DisappearingMuonsSkimming::DisappearingMuonsSkimming(const edm::ParameterSet& iConfig) - : recoMuonToken_(consumes>(iConfig.getParameter("recoMuons"))), - standaloneMuonToken_(consumes>(iConfig.getParameter("StandaloneTracks"))), - trackCollectionToken_(consumes>(iConfig.getParameter("tracks"))), - primaryVerticesToken_( - consumes>(iConfig.getParameter("primaryVertices"))), + : recoMuonToken_(consumes(iConfig.getParameter("recoMuons"))), + standaloneMuonToken_(consumes(iConfig.getParameter("StandaloneTracks"))), + trackCollectionToken_(consumes(iConfig.getParameter("tracks"))), + primaryVerticesToken_(consumes(iConfig.getParameter("primaryVertices"))), reducedEndcapRecHitCollectionToken_( consumes(iConfig.getParameter("EERecHits"))), reducedBarrelRecHitCollectionToken_( @@ -98,80 +87,68 @@ bool DisappearingMuonsSkimming::filter(edm::Event& iEvent, const edm::EventSetup bool offPeak = false; bool partialRegion = false; - edm::Handle staTracks; - iEvent.getByToken(standaloneMuonToken_, staTracks); - edm::Handle> vertices; - iEvent.getByToken(primaryVerticesToken_, vertices); - edm::Handle> recoMuons; - iEvent.getByToken(recoMuonToken_, recoMuons); - edm::Handle> thePATTrackHandle; - iEvent.getByToken(trackCollectionToken_, thePATTrackHandle); + const auto& staTracks = iEvent.get(standaloneMuonToken_); + const auto& vertices = iEvent.get(primaryVerticesToken_); + const auto& recoMuons = iEvent.get(recoMuonToken_); + const auto& thePATTracks = iEvent.get(trackCollectionToken_); + const auto& triggerResults = iEvent.get(trigResultsToken_); + // this wraps tracks with additional methods that are used in vertex-calculation const TransientTrackBuilder* transientTrackBuilder = &iSetup.getData(transientTrackToken_); - if (!passTriggers(iEvent, trigResultsToken_, muonPathsToPass_)) + if (!passTriggers(iEvent, triggerResults, muonPathsToPass_)) return false; int nMuonTrackCand = 0; float MuonTrackMass = 0.; //Looping over the reconstructed Muons - for (std::vector::const_iterator iMuon = recoMuons->begin(); iMuon != recoMuons->end(); iMuon++) { - if (!(iMuon->isPFMuon() && iMuon->isGlobalMuon())) + for (const auto& iMuon : recoMuons) { + if (!(iMuon.isPFMuon() && iMuon.isGlobalMuon())) continue; - if (!(iMuon->passed(reco::Muon::CutBasedIdTight))) + if (!(iMuon.passed(reco::Muon::CutBasedIdTight))) continue; - if (!(iMuon->passed(reco::Muon::PFIsoTight))) + if (!(iMuon.passed(reco::Muon::PFIsoTight))) continue; - if (iMuon->pt() < minMuPt_ || fabs(iMuon->eta()) > maxMuEta_) + if (iMuon.pt() < minMuPt_ || std::abs(iMuon.eta()) > maxMuEta_) continue; //Looping over tracks for any good muon - for (std::vector::const_iterator iTrack = thePATTrackHandle->begin(); - iTrack != thePATTrackHandle->end(); - ++iTrack) { - if (!iTrack->quality(reco::Track::qualityByName("highPurity"))) + int indx(0); + for (const auto& iTrack : thePATTracks) { + reco::TrackRef trackRef = reco::TrackRef(&thePATTracks, indx); + indx++; + + if (!iTrack.quality(reco::Track::qualityByName("highPurity"))) continue; - if (fabs(iTrack->eta()) > maxTrackEta_ || fabs(iTrack->eta()) < minTrackEta_) + if (std::abs(iTrack.eta()) > maxTrackEta_ || std::abs(iTrack.eta()) < minTrackEta_) continue; - if (iTrack->pt() < minTrackPt_) + if (iTrack.pt() < minTrackPt_) continue; //Check if the track belongs to a primary vertex for isolation calculation - bool foundtrack = false; - GlobalPoint tkVtx; - for (unsigned int i = 0; i < vertices->size(); i++) { - reco::VertexRef vtx(vertices, i); - if (!vtx->isValid()) { - continue; - } - for (unsigned int j = 0; j < vtx->tracksSize(); j++) { - double dPt = fabs(vtx->trackRefAt(j)->pt() - iTrack->pt()) / iTrack->pt(); - //Find the vertex track that is the same as the probe - if (dPt < 0.001) { - double dR2 = deltaR2(vtx->trackRefAt(j)->eta(), vtx->trackRefAt(j)->phi(), iTrack->eta(), iTrack->phi()); - if (dR2 < 0.001 * 0.001) { - foundtrack = true; - GlobalPoint vert(vtx->x(), vtx->y(), vtx->z()); - tkVtx = vert; - break; - } - } - } - } + + unsigned int vtxIndex; + unsigned int tkIndex; + bool foundtrack = this->findTrackInVertices(trackRef, vertices, vtxIndex, tkIndex); + if (!foundtrack) continue; - reco::TransientTrack tk = transientTrackBuilder->build(*iTrack); + + reco::VertexRef vtx(&vertices, vtxIndex); + GlobalPoint tkVtx = GlobalPoint(vtx->x(), vtx->y(), vtx->z()); + + reco::TransientTrack tk = transientTrackBuilder->build(iTrack); TrajectoryStateClosestToPoint traj = tk.trajectoryStateClosestToPoint(tkVtx); double transDCA = traj.perigeeParameters().transverseImpactParameter(); double longDCA = traj.perigeeParameters().longitudinalImpactParameter(); - if (fabs(longDCA) > maxLongDCA_) + if (std::abs(longDCA) > maxLongDCA_) continue; - if (fabs(transDCA) > maxTransDCA_) + if (std::abs(transDCA) > maxTransDCA_) continue; // make a pair of TransientTracks to feed the vertexer std::vector tracksToVertex; - tracksToVertex.push_back(transientTrackBuilder->build(*iTrack)); - tracksToVertex.push_back(transientTrackBuilder->build(iMuon->globalTrack())); + tracksToVertex.push_back(tk); + tracksToVertex.push_back(transientTrackBuilder->build(iMuon.globalTrack())); // try to fit these two tracks to a common vertex KalmanVertexFitter vertexFitter; CachingVertex<5> fittedVertex = vertexFitter.vertex(tracksToVertex); @@ -204,31 +181,30 @@ bool DisappearingMuonsSkimming::filter(edm::Event& iEvent, const edm::EventSetup if (MuonTrackMass < minInvMass_ || MuonTrackMass > maxInvMass_) continue; - double trackIso = getTrackIsolation(iEvent, vertices, iTrack); + double trackIso = getTrackIsolation(trackRef, vertices); //Track iso returns -1 when it fails to find the vertex containing the track (already checked in track selection, but might as well make sure) if (trackIso < 0) continue; - double ecalIso = getECALIsolation(iEvent, iSetup, transientTrackBuilder->build(*iTrack)); + double ecalIso = getECALIsolation(iEvent, iSetup, transientTrackBuilder->build(iTrack)); if (trackIso > maxTrackIso_ || ecalIso > maxEcalIso_) continue; //A good tag/probe pair has been selected, now check for control or signal regions - if (iMuon->charge() == iTrack->charge()) { + if (iMuon.charge() == iTrack.charge()) { sameSign = true; } //If not same sign CR, need to check standalone muons for signal regions double staMinDr2 = 1000; double staMinDEoverE = -10; - if (!staTracks->empty()) { - for (reco::TrackCollection::const_iterator staTrack = staTracks->begin(); staTrack != staTracks->end(); - ++staTrack) { - reco::TransientTrack track = transientTrackBuilder->build(*staTrack); + if (!staTracks.empty()) { + for (const auto& staTrack : staTracks) { + reco::TransientTrack track = transientTrackBuilder->build(staTrack); double dR2 = deltaR2(track.impactPointTSCP().momentum().eta(), track.impactPointTSCP().momentum().phi(), - (*iTrack).eta(), - (*iTrack).phi()); - double staDE = (std::sqrt(track.impactPointTSCP().momentum().mag2()) - (*iTrack).p()) / (*iTrack).p(); + iTrack.eta(), + iTrack.phi()); + double staDE = (std::sqrt(track.impactPointTSCP().momentum().mag2()) - iTrack.p()) / iTrack.p(); if (dR2 < staMinDr2) { staMinDr2 = dR2; } @@ -280,17 +256,15 @@ bool DisappearingMuonsSkimming::filter(edm::Event& iEvent, const edm::EventSetup } bool DisappearingMuonsSkimming::passTriggers(const edm::Event& iEvent, - edm::EDGetToken m_trigResultsToken, + const edm::TriggerResults& triggerResults, std::vector m_muonPathsToPass) { bool passTriggers = false; - edm::Handle triggerResults; - iEvent.getByToken(m_trigResultsToken, triggerResults); - const edm::TriggerNames& trigNames = iEvent.triggerNames(*triggerResults); + const edm::TriggerNames& trigNames = iEvent.triggerNames(triggerResults); for (size_t i = 0; i < trigNames.size(); ++i) { const std::string& name = trigNames.triggerName(i); for (auto& pathName : m_muonPathsToPass) { if ((name.find(pathName) != std::string::npos)) { - if (triggerResults->accept(i)) { + if (triggerResults.accept(i)) { passTriggers = true; break; } @@ -300,52 +274,71 @@ bool DisappearingMuonsSkimming::passTriggers(const edm::Event& iEvent, return passTriggers; } -double DisappearingMuonsSkimming::getTrackIsolation(const edm::Event& iEvent, - edm::Handle vtxHandle, - std::vector::const_iterator& iTrack) { - bool foundtrack = false; - unsigned int vtxindex = -1; - unsigned int trackindex = -1; - double Isolation = 0; - for (unsigned int i = 0; i < vtxHandle->size(); i++) { - reco::VertexRef vtx(vtxHandle, i); - if (!vtx->isValid()) { +bool DisappearingMuonsSkimming::findTrackInVertices(const reco::TrackRef& tkToMatch, + const reco::VertexCollection& vertices, + unsigned int& vtxIndex, + unsigned int& trackIndex) { + // initialize indices + vtxIndex = -1; + trackIndex = -1; + + bool foundtrack{false}; + unsigned int idx = 0; + for (const auto& vtx : vertices) { + if (!vtx.isValid()) { + idx++; continue; } - for (unsigned int j = 0; j < vtx->tracksSize(); j++) { - double dPt = fabs(vtx->trackRefAt(j)->pt() - iTrack->pt()) / iTrack->pt(); - //Find the vertex track that is the same as the probe - if (dPt < 0.001) { - double dR2 = deltaR2(vtx->trackRefAt(j)->eta(), vtx->trackRefAt(j)->phi(), iTrack->eta(), iTrack->phi()); - if (dR2 < 0.001 * 0.001) { - vtxindex = i; - trackindex = j; - foundtrack = true; - break; - } - } + + std::vector thePVkeys; + thePVkeys.reserve(vtx.tracksSize()); + for (unsigned int i=0; ifindTrackInVertices(tkToMatch, vertices, vtxindex, trackIndex); + + LogDebug("DisappearingMuonsSkimming") << "getTrackIsolation vtx Index: " << vtxindex + << " track Index: " << trackIndex; if (!foundtrack) { - return -1; + return -1.; } - reco::VertexRef primaryVtx(vtxHandle, vtxindex); + reco::VertexRef primaryVtx(&vertices, vtxindex); + double Isolation = 0; for (unsigned int i = 0; i < primaryVtx->tracksSize(); i++) { - if (i == trackindex) + if (i == trackIndex) continue; reco::TrackBaseRef secondarytrack = primaryVtx->trackRefAt(i); - if (deltaR2(iTrack->eta(), iTrack->phi(), secondarytrack->eta(), secondarytrack->phi()) > + if (deltaR2(tkToMatch.get()->eta(), tkToMatch.get()->phi(), secondarytrack->eta(), secondarytrack->phi()) > trackIsoConesize_ * trackIsoConesize_ || - deltaR2(iTrack->eta(), iTrack->phi(), secondarytrack->eta(), secondarytrack->phi()) < + deltaR2(tkToMatch.get()->eta(), tkToMatch.get()->phi(), secondarytrack->eta(), secondarytrack->phi()) < trackIsoInnerCone_ * trackIsoInnerCone_) continue; Isolation += secondarytrack->pt(); } - return Isolation / iTrack->pt(); + return Isolation / tkToMatch.get()->pt(); } double DisappearingMuonsSkimming::getECALIsolation(const edm::Event& iEvent, @@ -434,11 +427,5 @@ void DisappearingMuonsSkimming::fillDescriptions(edm::ConfigurationDescriptions& descriptions.addWithDefaultLabel(desc); } -// ------------ method called once each job just before starting event loop ------------ -void DisappearingMuonsSkimming::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void DisappearingMuonsSkimming::endJob() {} - //define this as a plug-in DEFINE_FWK_MODULE(DisappearingMuonsSkimming); From 0b5bcac66aab56bebc532a891de2e2158bf97fcd Mon Sep 17 00:00:00 2001 From: Michael Revering Date: Tue, 11 Apr 2023 12:10:19 -0500 Subject: [PATCH 4/5] Included code-checks and code-format --- Configuration/Skimming/src/DisappearingMuonsSkimming.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/Skimming/src/DisappearingMuonsSkimming.cc b/Configuration/Skimming/src/DisappearingMuonsSkimming.cc index 53f1e1b66b6fa..3fbcc908225a5 100644 --- a/Configuration/Skimming/src/DisappearingMuonsSkimming.cc +++ b/Configuration/Skimming/src/DisappearingMuonsSkimming.cc @@ -292,7 +292,7 @@ bool DisappearingMuonsSkimming::findTrackInVertices(const reco::TrackRef& tkToMa std::vector thePVkeys; thePVkeys.reserve(vtx.tracksSize()); - for (unsigned int i=0; i Date: Tue, 11 Apr 2023 12:42:39 -0500 Subject: [PATCH 5/5] Updated disappearing muons skimming files to use the latest version from optimization PR --- Configuration/Skimming/interface/DisappearingMuonsSkimming.h | 4 ++-- Configuration/Skimming/src/DisappearingMuonsSkimming.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Configuration/Skimming/interface/DisappearingMuonsSkimming.h b/Configuration/Skimming/interface/DisappearingMuonsSkimming.h index 56c9d81f52a3f..5d7520b69b244 100644 --- a/Configuration/Skimming/interface/DisappearingMuonsSkimming.h +++ b/Configuration/Skimming/interface/DisappearingMuonsSkimming.h @@ -54,7 +54,7 @@ class DisappearingMuonsSkimming : public edm::one::EDFilter<> { bool passTriggers(const edm::Event& iEvent, const edm::TriggerResults& results, - std::vector m_muonPathsToPass); + const std::vector& m_muonPathsToPass); bool findTrackInVertices(const reco::TrackRef& tkToMatch, const reco::VertexCollection& vertices, @@ -62,7 +62,7 @@ class DisappearingMuonsSkimming : public edm::one::EDFilter<> { unsigned int& trackIndex); double getTrackIsolation(const reco::TrackRef& tkToMatch, const reco::VertexCollection& vertices); - double getECALIsolation(const edm::Event&, const edm::EventSetup&, const reco::TransientTrack track); + double getECALIsolation(const edm::Event&, const edm::EventSetup&, const reco::TransientTrack& track); // ----------member data --------------------------- const edm::EDGetTokenT recoMuonToken_; diff --git a/Configuration/Skimming/src/DisappearingMuonsSkimming.cc b/Configuration/Skimming/src/DisappearingMuonsSkimming.cc index 3fbcc908225a5..15c6b1e5a9e0d 100644 --- a/Configuration/Skimming/src/DisappearingMuonsSkimming.cc +++ b/Configuration/Skimming/src/DisappearingMuonsSkimming.cc @@ -257,7 +257,7 @@ bool DisappearingMuonsSkimming::filter(edm::Event& iEvent, const edm::EventSetup bool DisappearingMuonsSkimming::passTriggers(const edm::Event& iEvent, const edm::TriggerResults& triggerResults, - std::vector m_muonPathsToPass) { + const std::vector& m_muonPathsToPass) { bool passTriggers = false; const edm::TriggerNames& trigNames = iEvent.triggerNames(triggerResults); for (size_t i = 0; i < trigNames.size(); ++i) { @@ -343,7 +343,7 @@ double DisappearingMuonsSkimming::getTrackIsolation(const reco::TrackRef& tkToMa double DisappearingMuonsSkimming::getECALIsolation(const edm::Event& iEvent, const edm::EventSetup& iSetup, - const reco::TransientTrack track) { + const reco::TransientTrack& track) { edm::Handle rechitsEE; iEvent.getByToken(reducedEndcapRecHitCollectionToken_, rechitsEE);