56 minMuonPt_(iConfig.getParameter<double>(
"minMuonPt")),
57 minChargedHadronPt_(iConfig.getParameter<double>(
"minChargedHadronPt")),
58 minMuonTrackRelPtErr_(iConfig.getParameter<double>(
"minMuonTrackRelPtErr")),
59 maxSigLoose_(iConfig.getParameter<double>(
"maxSigLoose")),
60 maxSigTight_(iConfig.getParameter<double>(
"maxSigTight")),
61 minCaloCompatibility_(iConfig.getParameter<double>(
"minCaloCompatibility")),
62 minTrackNHits_(iConfig.getParameter<
uint>(
"minTrackNHits")),
63 minPixelNHits_(iConfig.getParameter<
uint>(
"minPixelNHits")),
64 minTrackerLayersForMuonLoose_(iConfig.getParameter<
int>(
"minTrackerLayersForMuonLoose")),
65 minTrackerLayersForMuonTight_(iConfig.getParameter<
int>(
"minTrackerLayersForMuonTight")) {
67 produces<reco::PFCandidateCollection>();
68 produces<reco::PFCandidateCollection>(
"removed");
89 auto pOutputCandidateCollection = std::make_unique<reco::PFCandidateCollection>();
90 auto pBadCandidateCollection = std::make_unique<reco::PFCandidateCollection>();
92 bool foundBadCandidate =
false;
98 if (!pfCandidate.muonRef()->isGlobalMuon() || !pfCandidate.muonRef()->isTrackerMuon() ||
99 !pfCandidate.trackRef().isNonnull()) {
100 foundBadCandidate =
true;
106 foundBadCandidate =
true;
116 float bestVzError =
vtx.zError();
121 float dzError2 =
track->dzError() *
track->dzError() + bestVzError * bestVzError;
122 float dxyError =
track->dxyError(bestVtx, vtx_cov);
124 float dzSig2 =
dz *
dz / dzError2;
125 float dxySig2 =
dxy *
dxy / dxyError / dxyError;
127 float sig3d =
sqrt(dzSig2 + dxySig2);
130 pBadCandidateCollection->push_back(pfCandidate);
131 foundBadCandidate =
true;
135 if (
track->pt() < pfCandidate.pt() / 1.5 ||
track->pt() > pfCandidate.pt() * 1.5) {
136 foundBadCandidate =
true;
137 pBadCandidateCollection->push_back(pfCandidate);
142 foundBadCandidate =
true;
143 pBadCandidateCollection->push_back(pfCandidate);
153 unsigned nHits =
track->numberOfValidHits();
154 unsigned nPixelHits =
track->hitPattern().numberOfValidPixelHits();
157 foundBadCandidate =
true;
158 pBadCandidateCollection->push_back(pfCandidate);
163 float bestVzError =
vtx.zError();
168 float dzError2 =
track->dzError() *
track->dzError() + bestVzError * bestVzError;
169 float dxyError =
track->dxyError(bestVtx, vtx_cov);
171 float dzSig2 =
dz *
dz / dzError2;
172 float dxySig2 =
dxy *
dxy / dxyError / dxyError;
174 float sig3d =
sqrt(dzSig2 + dxySig2);
177 foundBadCandidate =
true;
178 pBadCandidateCollection->push_back(pfCandidate);
183 foundBadCandidate =
true;
184 pBadCandidateCollection->push_back(pfCandidate);
193 foundBadCandidate =
true;
194 pBadCandidateCollection->push_back(pfCandidate);
199 foundBadCandidate =
true;
200 pBadCandidateCollection->push_back(pfCandidate);
205 double caloEnergy = pfCandidate.ecalEnergy() + pfCandidate.hcalEnergy();
209 foundBadCandidate =
true;
210 pBadCandidateCollection->push_back(pfCandidate);
215 foundBadCandidate =
true;
216 pBadCandidateCollection->push_back(pfCandidate);
221 foundBadCandidate =
true;
222 pBadCandidateCollection->push_back(pfCandidate);
229 pOutputCandidateCollection->push_back(pfCandidate);
233 bool pass = !foundBadCandidate;
238 iEvent.put(std::make_unique<bool>(pass));