40 #define init_param(type, varname) varname(ps.getParameter<type>(#varname)) 66 bool* fromFakeSet)
const;
130 mutable std::vector<std::pair<double, unsigned> >
zAssoc;
167 produces<reco::PFCandidateCollection>();
180 auto pOutput = std::make_unique<reco::PFCandidateCollection>();
193 throw cms::Exception(
"FFTJetBadConfig") <<
"ERROR in FFTJetPFPileupCleaner:" 194 " could not find fake vertices" 199 for (
unsigned i = 0;
i < ncand; ++
i) {
204 bool fromFakeSet =
false;
224 const double eta = candptr->p4().Eta();
225 remove = eta < etaMin || eta >
etaMax;
233 pOutput->push_back(
cand);
234 pOutput->back().setSourceCandidatePtr(candptr);
242 const unsigned shift =
static_cast<unsigned>(
ptype);
248 const unsigned shift =
static_cast<unsigned>(
ptype);
263 bool* fromFakeSet)
const {
264 typedef reco::VertexCollection::const_iterator IV;
267 *fromFakeSet =
false;
271 unsigned nFoundVertex = 0;
276 double bestweight = 0.0;
282 IT trackend(
vtx.tracks_end());
283 for (
IT iTrack =
vtx.tracks_begin(); iTrack != trackend; ++iTrack) {
288 if (baseRef == trackBaseRef) {
290 const double w =
vtx.trackWeight(baseRef);
291 if (
w > bestweight) {
301 if (nFoundVertex > 0) {
302 if (nFoundVertex != 1)
303 edm::LogWarning(
"TrackOnTwoVertex") <<
"a track is shared by at least two vertices. " 304 <<
"Used to be an assert";
309 const double ztrack =
pfcand.vertex().z();
312 const IV fakeEnd(fakeVertices->end());
314 for (IV
iv = fakeVertices->begin();
iv != fakeEnd; ++
iv, ++
index)
330 const double ztrack =
pfcand.vertex().z();
331 bool foundVertex =
false;
339 zAssoc.push_back(std::pair<double, unsigned>(
iv->z(),
index));
340 const unsigned numRealVertices =
index;
345 const IV fakeEnd(fakeVertices->end());
346 for (IV
iv = fakeVertices->begin();
iv != fakeEnd; ++
iv, ++
index)
348 zAssoc.push_back(std::pair<double, unsigned>(
iv->z(),
index));
354 std::pair<double, unsigned> tPair(ztrack, UINT_MAX);
361 unsigned ich[2] = {0
U, 0
U};
364 ich[0] = iAbove - 1
U;
366 if (iAbove <
zAssoc.size())
370 double dzmin = 1.0e100;
371 unsigned bestVertexNum = UINT_MAX;
372 for (
unsigned icheck = 0; icheck < nch; ++icheck) {
373 const unsigned zAssocIndex = ich[icheck];
374 const unsigned vertexNum =
zAssoc[zAssocIndex].second;
377 bestVertexNum = vertexNum;
384 bestVertexNum = vertexNum;
388 foundVertex = bestVertexNum < UINT_MAX;
390 iVertex = bestVertexNum;
391 if (iVertex >= numRealVertices) {
393 iVertex -= numRealVertices;
400 double dzmin = 1.0e100;
413 const IV fakeEnd(fakeVertices->end());
415 for (IV
iv = fakeVertices->begin();
iv != fakeEnd; ++
iv, ++
index)
void setRemovalBit(reco::PFCandidate::ParticleType ptype, bool onOff)
ParticleType
particle types
bool useFakePrimaryVertex
~FFTJetPFPileupCleaner() override
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
#define DEFINE_FWK_MODULE(type)
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>