40 #define init_param(type, varname) varname(ps.getParameter<type>(#varname)) 68 bool* fromFakeSet)
const;
132 mutable std::vector<std::pair<double, unsigned> >
zAssoc;
169 produces<reco::PFCandidateCollection>();
182 auto pOutput = std::make_unique<reco::PFCandidateCollection>();
195 throw cms::Exception(
"FFTJetBadConfig") <<
"ERROR in FFTJetPFPileupCleaner:" 196 " could not find fake vertices" 201 for (
unsigned i = 0;
i < ncand; ++
i) {
206 bool fromFakeSet =
false;
226 const double eta = candptr->p4().Eta();
227 remove = eta < etaMin || eta >
etaMax;
235 pOutput->push_back(
cand);
236 pOutput->back().setSourceCandidatePtr(candptr);
244 const unsigned shift =
static_cast<unsigned>(
ptype);
250 const unsigned shift =
static_cast<unsigned>(
ptype);
265 bool* fromFakeSet)
const {
266 typedef reco::VertexCollection::const_iterator IV;
269 *fromFakeSet =
false;
273 unsigned nFoundVertex = 0;
278 double bestweight = 0.0;
284 IT trackend(
vtx.tracks_end());
285 for (
IT iTrack =
vtx.tracks_begin(); iTrack != trackend; ++iTrack) {
290 if (baseRef == trackBaseRef) {
292 const double w =
vtx.trackWeight(baseRef);
293 if (
w > bestweight) {
303 if (nFoundVertex > 0) {
304 if (nFoundVertex != 1)
305 edm::LogWarning(
"TrackOnTwoVertex") <<
"a track is shared by at least two vertices. " 306 <<
"Used to be an assert";
311 const double ztrack =
pfcand.vertex().z();
314 const IV fakeEnd(fakeVertices->end());
316 for (IV
iv = fakeVertices->begin();
iv != fakeEnd; ++
iv, ++
index)
332 const double ztrack =
pfcand.vertex().z();
333 bool foundVertex =
false;
341 zAssoc.push_back(std::pair<double, unsigned>(
iv->z(),
index));
342 const unsigned numRealVertices =
index;
347 const IV fakeEnd(fakeVertices->end());
348 for (IV
iv = fakeVertices->begin();
iv != fakeEnd; ++
iv, ++
index)
350 zAssoc.push_back(std::pair<double, unsigned>(
iv->z(),
index));
356 std::pair<double, unsigned> tPair(ztrack, UINT_MAX);
363 unsigned ich[2] = {0
U, 0
U};
366 ich[0] = iAbove - 1
U;
368 if (iAbove <
zAssoc.size())
372 double dzmin = 1.0e100;
373 unsigned bestVertexNum = UINT_MAX;
374 for (
unsigned icheck = 0; icheck < nch; ++icheck) {
375 const unsigned zAssocIndex = ich[icheck];
376 const unsigned vertexNum =
zAssoc[zAssocIndex].second;
379 bestVertexNum = vertexNum;
386 bestVertexNum = vertexNum;
390 foundVertex = bestVertexNum < UINT_MAX;
392 iVertex = bestVertexNum;
393 if (iVertex >= numRealVertices) {
395 iVertex -= numRealVertices;
402 double dzmin = 1.0e100;
415 const IV fakeEnd(fakeVertices->end());
417 for (IV
iv = fakeVertices->begin();
iv != fakeEnd; ++
iv, ++
index)
void setRemovalBit(reco::PFCandidate::ParticleType ptype, bool onOff)
ParticleType
particle types
bool useFakePrimaryVertex
~FFTJetPFPileupCleaner() override
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< reco::VertexCollection > FakePrimaryVerticesToken
bool isRemovable(reco::PFCandidate::ParticleType ptype) const
key_type key() const
Accessor for product key.
FFTJetPFPileupCleaner & operator=(const FFTJetPFPileupCleaner &)=delete
bool isAcceptableVtx(reco::VertexCollection::const_iterator iv) const
FFTJetPFPileupCleaner()=delete
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< reco::VertexCollection > VerticesToken
bool reverseRemovalDecision
reco::VertexRef findSomeVertexWFakes(const edm::Handle< reco::VertexCollection > &vertices, const edm::Handle< reco::VertexCollection > &fakeVertices, const reco::PFCandidate &pfcand, bool *fromFakeSet) const
std::vector< LinkConnSpec >::const_iterator IT
void produce(edm::Event &, const edm::EventSetup &) override
bool isNull() const
Checks for null.
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
edm::InputTag PFCandidates
std::vector< std::pair< double, unsigned > > zAssoc
edm::EDGetTokenT< reco::PFCandidateCollection > PFCandidatesToken
#define init_param(type, varname)
Particle reconstructed by the particle flow algorithm.
edm::InputTag FakePrimaryVertices
static unsigned int const shift
Log< level::Warning, false > LogWarning
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>