54 : tokenPFCandidates_(consumes<edm::
View<
reco::PFCandidate> >(iConfig.getParameter<edm::
InputTag>(
"PFCandidates"))),
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;
236 iEvent.
put(
std::move(pBadCandidateCollection),
"removed");
238 iEvent.
put(std::make_unique<bool>(pass));
const double maxSigLoose_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
HiBadParticleCleaner(const edm::ParameterSet &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double zError() const
error on z
const int minTrackerLayersForMuonLoose_
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< reco::VertexCollection > tokenPV_
std::vector< Vertex > VertexCollection
collection of Vertex objects
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
std::vector< Vertex > VertexCollection
const Point & position() const
position
const unsigned minPixelNHits_
const double minMuonTrackRelPtErr_
Abs< T >::type abs(const T &t)
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.
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