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");
69 produces<edm::ValueMap<reco::PFCandidateRef>>();
90 auto pOutputCandidateCollection = std::make_unique<reco::PFCandidateCollection>();
91 auto pBadCandidateCollection = std::make_unique<reco::PFCandidateCollection>();
93 bool foundBadCandidate =
false;
96 std::vector<int> candidateIndexMapper(
n, 0);
98 for (iPF = 0; iPF <
n; iPF++) {
103 if (!pfCandidate.
muonRef()->isGlobalMuon() || !pfCandidate.
muonRef()->isTrackerMuon() ||
105 foundBadCandidate =
true;
111 foundBadCandidate =
true;
121 float bestVzError =
vtx.zError();
126 float dzError2 =
track->dzError() *
track->dzError() + bestVzError * bestVzError;
127 float dxyError =
track->dxyError(bestVtx, vtx_cov);
129 float dzSig2 =
dz *
dz / dzError2;
130 float dxySig2 =
dxy *
dxy / dxyError / dxyError;
132 float sig3d =
sqrt(dzSig2 + dxySig2);
135 pBadCandidateCollection->push_back(pfCandidate);
136 candidateIndexMapper[iPF] = -1 * (pBadCandidateCollection->size());
137 foundBadCandidate =
true;
141 if (
track->pt() < pfCandidate.
pt() / 1.5 ||
track->pt() > pfCandidate.
pt() * 1.5) {
142 foundBadCandidate =
true;
143 pBadCandidateCollection->push_back(pfCandidate);
144 candidateIndexMapper[iPF] = -1 * (pBadCandidateCollection->size());
149 foundBadCandidate =
true;
150 pBadCandidateCollection->push_back(pfCandidate);
151 candidateIndexMapper[iPF] = -1 * (pBadCandidateCollection->size());
162 unsigned nPixelHits =
track->hitPattern().numberOfValidPixelHits();
165 foundBadCandidate =
true;
166 pBadCandidateCollection->push_back(pfCandidate);
167 candidateIndexMapper[iPF] = -1 * (pBadCandidateCollection->size());
172 float bestVzError =
vtx.zError();
177 float dzError2 =
track->dzError() *
track->dzError() + bestVzError * bestVzError;
178 float dxyError =
track->dxyError(bestVtx, vtx_cov);
180 float dzSig2 =
dz *
dz / dzError2;
181 float dxySig2 =
dxy *
dxy / dxyError / dxyError;
183 float sig3d =
sqrt(dzSig2 + dxySig2);
186 foundBadCandidate =
true;
187 pBadCandidateCollection->push_back(pfCandidate);
188 candidateIndexMapper[iPF] = -1 * (pBadCandidateCollection->size());
193 foundBadCandidate =
true;
194 pBadCandidateCollection->push_back(pfCandidate);
195 candidateIndexMapper[iPF] = -1 * (pBadCandidateCollection->size());
204 foundBadCandidate =
true;
205 pBadCandidateCollection->push_back(pfCandidate);
206 candidateIndexMapper[iPF] = -1 * (pBadCandidateCollection->size());
211 foundBadCandidate =
true;
212 pBadCandidateCollection->push_back(pfCandidate);
213 candidateIndexMapper[iPF] = -1 * (pBadCandidateCollection->size());
222 foundBadCandidate =
true;
223 pBadCandidateCollection->push_back(pfCandidate);
224 candidateIndexMapper[iPF] = -1 * (pBadCandidateCollection->size());
229 foundBadCandidate =
true;
230 pBadCandidateCollection->push_back(pfCandidate);
231 candidateIndexMapper[iPF] = -1 * (pBadCandidateCollection->size());
236 foundBadCandidate =
true;
237 pBadCandidateCollection->push_back(pfCandidate);
238 candidateIndexMapper[iPF] = -1 * (pBadCandidateCollection->size());
245 pOutputCandidateCollection->push_back(pfCandidate);
246 candidateIndexMapper[iPF] = (pOutputCandidateCollection->size());
249 bool pass = !foundBadCandidate;
254 iEvent.put(std::make_unique<bool>(pass));
259 std::vector<reco::PFCandidateRef> refs;
262 for (iPF = 0; iPF <
n; ++iPF) {
263 if (candidateIndexMapper[iPF] > 0) {
265 }
else if (candidateIndexMapper[iPF] < 0) {
const double maxSigLoose_
double pt() const final
transverse momentum
HiBadParticleCleaner(const edm::ParameterSet &)
const int minTrackerLayersForMuonLoose_
edm::EDGetTokenT< reco::VertexCollection > tokenPV_
bool isNonnull() const
Checks for non-null.
std::vector< Vertex > VertexCollection
collection of Vertex objects
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
std::vector< Vertex > VertexCollection
double hcalEnergy() const
return corrected Hcal energy
const unsigned minPixelNHits_
const double minMuonTrackRelPtErr_
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
double ecalEnergy() const
return corrected Ecal energy
reco::MuonRef muonRef() const
const double maxSigTight_
const double minChargedHadronPt_
const unsigned minTrackNHits_
XYZPointD XYZPoint
point in space with cartesian internal representation
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
~HiBadParticleCleaner() override=default
Particle reconstructed by the particle flow algorithm.
reco::TrackRef trackRef() const
const double minCaloCompatibility_
const int minTrackerLayersForMuonTight_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
edm::EDGetTokenT< edm::View< reco::PFCandidate > > tokenPFCandidates_
edm::View< Candidate > CandidateView
view of a collection containing candidates
virtual ParticleType particleId() const