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;
129 float dzSig2 =
dz *
dz / dzError2;
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;
180 float dzSig2 =
dz *
dz / dzError2;
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
const int minTrackerLayersForMuonLoose_
edm::EDGetTokenT< reco::VertexCollection > tokenPV_
bool isNonnull() const
Checks for non-null.
std::vector< Vertex > VertexCollection
collection of Vertex objects
double hcalEnergy() const
return corrected Hcal energy
const unsigned minPixelNHits_
const double minMuonTrackRelPtErr_
Abs< T >::type abs(const T &t)
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
Particle reconstructed by the particle flow algorithm.
reco::TrackRef trackRef() const
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
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