48 return (& mu1 == & mu2) ||
49 (mu1.reco::Muon::innerTrack().isNonnull() ?
50 mu1.reco::Muon::innerTrack() == mu2.reco::Muon::innerTrack() :
51 mu1.reco::Muon::outerTrack() == mu2.reco::Muon::outerTrack());
83 sharedFraction_(iConfig.getParameter<double>(
"fractionOfSharedSegments")),
88 produces<std::vector<T> >();
98 unique_ptr<vector<T> >
out(
new vector<T>());
101 unsigned int nsrc = src->size();
103 std::vector<int> good(nsrc,
true);
104 for (
unsigned int i = 0;
i < nsrc; ++
i) {
105 const T &mu1 = (*src)[
i];
107 if (!good[
i])
continue;
109 for (
unsigned int j = i+1; j < nsrc; ++j) {
110 const T &mu2 = (*src)[j];
114 if (nSegments2 == 0 || nSegments1 == 0)
continue;
125 for (
unsigned int i = 0;
i < nsrc; ++
i) {
126 const T &mu1 = (*src)[
i];
139 if (mu2.track().isNull())
return true;
140 if (mu1.track().isNull())
return false;
141 if (mu1.isPFMuon() != mu2.isPFMuon())
return mu1.isPFMuon();
142 if (mu1.isGlobalMuon() != mu2.isGlobalMuon())
return mu1.isGlobalMuon();
143 if (mu1.charge() == mu2.charge() &&
deltaR2(mu1,mu2) < 0.0009) {
144 return mu1.track()->ptError()/mu1.track()->pt() < mu2.track()->ptError()/mu2.track()->pt();
148 return (nm1 != nm2 ? nm1 > nm2 : mu1.pt() > mu2.pt());
155 return (& mu1 == & mu2) ||
157 (mu1.reco::Muon::innerTrack().isNonnull() ?
158 mu1.reco::Muon::innerTrack() == mu2.reco::Muon::innerTrack() :
159 mu1.reco::Muon::outerTrack() == mu2.reco::Muon::outerTrack());
modules::MuonCleanerBySegmentsT< reco::Muon > MuonCleanerBySegments
double sharedFraction_
Fraction of shared segments.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
StringCutObjectSelector< T > preselection_
Preselection cut.
modules::MuonCleanerBySegmentsT< pat::Muon > PATMuonCleanerBySegments
StringCutObjectSelector< T > passthrough_
Always-accept cut.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::pair< const reco::Muon *, const reco::Muon * > MuonPointerPair
Cut on the pair of objects together.
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
~MuonCleanerBySegmentsT() override
bool isSameMuon(const T &mu1, const T &mu2) const
edm::EDGetTokenT< edm::View< T > > srcToken_
Tokens for input collections.
bool isBetterMuon(const T &mu1, const T &mu2) const
const edm::Ptr< reco::Candidate > & originalObjectRef() const
reference to original object. Returns a null reference if not available
MuonCleanerBySegmentsT(const edm::ParameterSet &iConfig)
int sharedSegments(const reco::Muon &muon1, const reco::Muon &muon2, unsigned int segmentArbitrationMask=reco::MuonSegmentMatch::BestInChamberByDR)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Removes duplicates from a muon collection using segment references.
StringCutObjectSelector< MuonPointerPair, true > bestMuonSelector_
Analysis-level muon class.
bool defaultBestMuon_
Use default criteria to choose the best muon.
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override