CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
FFTJetPFPileupCleaner Class Reference

#include <RecoJets/FFTJetProducers/plugins/FFTJetPFPileupCleaner.cc>

Inheritance diagram for FFTJetPFPileupCleaner:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 FFTJetPFPileupCleaner (const edm::ParameterSet &)
 
 FFTJetPFPileupCleaner ()=delete
 
 FFTJetPFPileupCleaner (const FFTJetPFPileupCleaner &)=delete
 
FFTJetPFPileupCleaneroperator= (const FFTJetPFPileupCleaner &)=delete
 
 ~FFTJetPFPileupCleaner () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void beginJob () override
 
void endJob () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Private Member Functions

void buildRemovalMask ()
 
reco::VertexRef findSomeVertexWFakes (const edm::Handle< reco::VertexCollection > &vertices, const edm::Handle< reco::VertexCollection > &fakeVertices, const reco::PFCandidate &pfcand, bool *fromFakeSet) const
 
bool isAcceptableVtx (reco::VertexCollection::const_iterator iv) const
 
bool isRemovable (reco::PFCandidate::ParticleType ptype) const
 
void setRemovalBit (reco::PFCandidate::ParticleType ptype, bool onOff)
 

Private Attributes

bool checkClosestZVertex
 
double etaMax
 
double etaMin
 
edm::InputTag FakePrimaryVertices
 
edm::EDGetTokenT< reco::VertexCollectionFakePrimaryVerticesToken
 
bool keepIfPVneighbor
 
edm::InputTag PFCandidates
 
edm::EDGetTokenT< reco::PFCandidateCollectionPFCandidatesToken
 
unsigned removalMask
 
bool remove_e
 
bool remove_egamma_HF
 
bool remove_gamma
 
bool remove_h
 
bool remove_h0
 
bool remove_h_HF
 
bool remove_mu
 
bool remove_X
 
bool removeMainVertex
 
bool removeUnassociated
 
bool reverseRemovalDecision
 
bool useFakePrimaryVertex
 
double vertexNdofCut
 
double vertexRhoCut
 
double vertexZmaxCut
 
edm::InputTag Vertices
 
edm::EDGetTokenT< reco::VertexCollectionVerticesToken
 
std::vector< std::pair< double, unsigned > > zAssoc
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Detailed Description

Description: cleans up a collection of partice flow objects

Implementation: [Notes on implementation]

Definition at line 45 of file FFTJetPFPileupCleaner.cc.

Constructor & Destructor Documentation

◆ FFTJetPFPileupCleaner() [1/3]

FFTJetPFPileupCleaner::FFTJetPFPileupCleaner ( const edm::ParameterSet ps)
explicit

Definition at line 138 of file FFTJetPFPileupCleaner.cc.

References buildRemovalMask(), FakePrimaryVertices, FakePrimaryVerticesToken, PFCandidates, PFCandidatesToken, useFakePrimaryVertex, Vertices, and VerticesToken.

148  init_param(bool, remove_X),
149  init_param(bool, remove_h),
150  init_param(bool, remove_e),
151  init_param(bool, remove_mu),
152  init_param(bool, remove_gamma),
153  init_param(bool, remove_h0),
154  init_param(bool, remove_h_HF),
156  removalMask(0),
157  init_param(double, etaMin),
158  init_param(double, etaMax),
159  init_param(double, vertexNdofCut),
160  init_param(double, vertexZmaxCut),
161  init_param(double, vertexRhoCut) {
163 
164  PFCandidatesToken = consumes<reco::PFCandidateCollection>(PFCandidates);
165  VerticesToken = consumes<reco::VertexCollection>(Vertices);
167  FakePrimaryVerticesToken = consumes<reco::VertexCollection>(FakePrimaryVertices);
168 
169  produces<reco::PFCandidateCollection>();
170 }
edm::EDGetTokenT< reco::VertexCollection > FakePrimaryVerticesToken
edm::EDGetTokenT< reco::VertexCollection > VerticesToken
edm::EDGetTokenT< reco::PFCandidateCollection > PFCandidatesToken
#define init_param(type, varname)

◆ FFTJetPFPileupCleaner() [2/3]

FFTJetPFPileupCleaner::FFTJetPFPileupCleaner ( )
delete

◆ FFTJetPFPileupCleaner() [3/3]

FFTJetPFPileupCleaner::FFTJetPFPileupCleaner ( const FFTJetPFPileupCleaner )
delete

◆ ~FFTJetPFPileupCleaner()

FFTJetPFPileupCleaner::~FFTJetPFPileupCleaner ( )
override

Definition at line 172 of file FFTJetPFPileupCleaner.cc.

172 {}

Member Function Documentation

◆ beginJob()

void FFTJetPFPileupCleaner::beginJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDProducer.

Definition at line 449 of file FFTJetPFPileupCleaner.cc.

449 {}

◆ buildRemovalMask()

void FFTJetPFPileupCleaner::buildRemovalMask ( )
private

Definition at line 437 of file FFTJetPFPileupCleaner.cc.

References reco::PFCandidate::e, reco::PFCandidate::egamma_HF, reco::PFCandidate::gamma, reco::PFCandidate::h, reco::PFCandidate::h0, reco::PFCandidate::h_HF, reco::PFCandidate::mu, remove_e, remove_egamma_HF, remove_gamma, remove_h, remove_h0, remove_h_HF, remove_mu, remove_X, setRemovalBit(), and reco::PFCandidate::X.

Referenced by FFTJetPFPileupCleaner().

437  {
446 }
void setRemovalBit(reco::PFCandidate::ParticleType ptype, bool onOff)

◆ endJob()

void FFTJetPFPileupCleaner::endJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDProducer.

Definition at line 452 of file FFTJetPFPileupCleaner.cc.

452 {}

◆ findSomeVertexWFakes()

reco::VertexRef FFTJetPFPileupCleaner::findSomeVertexWFakes ( const edm::Handle< reco::VertexCollection > &  vertices,
const edm::Handle< reco::VertexCollection > &  fakeVertices,
const reco::PFCandidate pfcand,
bool *  fromFakeSet 
) const
private

Definition at line 262 of file FFTJetPFPileupCleaner.cc.

References funct::abs(), checkClosestZVertex, PVValHelper::dz, first, isAcceptableVtx(), gpuVertexFinder::iv, keepIfPVneighbor, pfDeepBoostedJetPreprocessParams_cfi::pfcand, jetUpdater_cfi::sort, mitigatedMETSequence_cff::U, pfDeepBoostedJetPreprocessParams_cfi::upper_bound, useFakePrimaryVertex, AlignmentTracksFromVertexSelector_cfi::vertices, extraflags_cff::vtx, w(), z, and zAssoc.

Referenced by produce().

265  {
266  typedef reco::VertexCollection::const_iterator IV;
268 
269  *fromFakeSet = false;
270  reco::TrackBaseRef trackBaseRef(pfcand.trackRef());
271 
272  size_t iVertex = 0;
273  unsigned nFoundVertex = 0;
274  const IV vertend(vertices->end());
275 
276  {
277  unsigned index = 0;
278  double bestweight = 0.0;
279  for (IV iv = vertices->begin(); iv != vertend; ++iv, ++index)
280  if (isAcceptableVtx(iv)) {
281  const reco::Vertex& vtx = *iv;
282 
283  // loop on tracks in vertices
284  IT trackend(vtx.tracks_end());
285  for (IT iTrack = vtx.tracks_begin(); iTrack != trackend; ++iTrack) {
286  const reco::TrackBaseRef& baseRef = *iTrack;
287 
288  // one of the tracks in the vertex is the same as
289  // the track considered in the function
290  if (baseRef == trackBaseRef) {
291  // select the vertex for which the track has the highest weight
292  const double w = vtx.trackWeight(baseRef);
293  if (w > bestweight) {
294  bestweight = w;
295  iVertex = index;
296  nFoundVertex++;
297  }
298  }
299  }
300  }
301  }
302 
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";
307 
308  // Check if we can re-associate this track with one
309  // of the fake vertices
310  if (useFakePrimaryVertex) {
311  const double ztrack = pfcand.vertex().z();
312  double dzmin = std::abs(ztrack - ((*vertices)[iVertex]).z());
313 
314  const IV fakeEnd(fakeVertices->end());
315  unsigned index = 0;
316  for (IV iv = fakeVertices->begin(); iv != fakeEnd; ++iv, ++index)
317  if (isAcceptableVtx(iv)) {
318  const double dz = std::abs(ztrack - iv->z());
319  if (dz < dzmin) {
320  dzmin = dz;
321  iVertex = index;
322  *fromFakeSet = true;
323  }
324  }
325  }
326 
327  return reco::VertexRef(*fromFakeSet ? fakeVertices : vertices, iVertex);
328  }
329 
330  // optional: as a secondary solution, associate the closest vertex in z
331  if (checkClosestZVertex) {
332  const double ztrack = pfcand.vertex().z();
333  bool foundVertex = false;
334 
335  if (keepIfPVneighbor) {
336  // Sort all vertices according to their Z coordinate
337  zAssoc.clear();
338  unsigned index = 0;
339  for (IV iv = vertices->begin(); iv != vertend; ++iv, ++index)
340  if (isAcceptableVtx(iv))
341  zAssoc.push_back(std::pair<double, unsigned>(iv->z(), index));
342  const unsigned numRealVertices = index;
343 
344  // Mix the fake vertex collection into zAssoc.
345  // Note that we do not reset "index" before doing this.
346  if (useFakePrimaryVertex) {
347  const IV fakeEnd(fakeVertices->end());
348  for (IV iv = fakeVertices->begin(); iv != fakeEnd; ++iv, ++index)
349  if (isAcceptableVtx(iv))
350  zAssoc.push_back(std::pair<double, unsigned>(iv->z(), index));
351  }
352 
353  // Check where the track z position fits into this sequence
354  if (!zAssoc.empty()) {
355  std::sort(zAssoc.begin(), zAssoc.end());
356  std::pair<double, unsigned> tPair(ztrack, UINT_MAX);
357  const unsigned iAbove = std::upper_bound(zAssoc.begin(), zAssoc.end(), tPair) - zAssoc.begin();
358 
359  // Check whether one of the vertices with indices
360  // iAbove or (iAbove - 1) is a primary vertex.
361  // If so, return it. Otherwise return the one
362  // with closest distance to the track.
363  unsigned ich[2] = {0U, 0U};
364  unsigned nch = 1;
365  if (iAbove) {
366  ich[0] = iAbove - 1U;
367  ich[1] = iAbove;
368  if (iAbove < zAssoc.size())
369  nch = 2;
370  }
371 
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;
377 
378  if (vertexNum == numRealVertices || (!useFakePrimaryVertex && vertexNum == 0U)) {
379  bestVertexNum = vertexNum;
380  break;
381  }
382 
383  const double dz = std::abs(ztrack - zAssoc[zAssocIndex].first);
384  if (dz < dzmin) {
385  dzmin = dz;
386  bestVertexNum = vertexNum;
387  }
388  }
389 
390  foundVertex = bestVertexNum < UINT_MAX;
391  if (foundVertex) {
392  iVertex = bestVertexNum;
393  if (iVertex >= numRealVertices) {
394  *fromFakeSet = true;
395  iVertex -= numRealVertices;
396  }
397  }
398  }
399  } else {
400  // This is a simple association algorithm (from PFPileUp)
401  // extended to take fake vertices into account
402  double dzmin = 1.0e100;
403  unsigned index = 0;
404  for (IV iv = vertices->begin(); iv != vertend; ++iv, ++index)
405  if (isAcceptableVtx(iv)) {
406  const double dz = std::abs(ztrack - iv->z());
407  if (dz < dzmin) {
408  dzmin = dz;
409  iVertex = index;
410  foundVertex = true;
411  }
412  }
413 
414  if (useFakePrimaryVertex) {
415  const IV fakeEnd(fakeVertices->end());
416  index = 0;
417  for (IV iv = fakeVertices->begin(); iv != fakeEnd; ++iv, ++index)
418  if (isAcceptableVtx(iv)) {
419  const double dz = std::abs(ztrack - iv->z());
420  if (dz < dzmin) {
421  dzmin = dz;
422  iVertex = index;
423  *fromFakeSet = true;
424  foundVertex = true;
425  }
426  }
427  }
428  }
429 
430  if (foundVertex)
431  return reco::VertexRef(*fromFakeSet ? fakeVertices : vertices, iVertex);
432  }
433 
434  return reco::VertexRef();
435 }
int32_t *__restrict__ iv
T w() const
bool isAcceptableVtx(reco::VertexCollection::const_iterator iv) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< LinkConnSpec >::const_iterator IT
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
Definition: VertexFwd.h:13
std::vector< std::pair< double, unsigned > > zAssoc
Log< level::Warning, false > LogWarning
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:38

◆ isAcceptableVtx()

bool FFTJetPFPileupCleaner::isAcceptableVtx ( reco::VertexCollection::const_iterator  iv) const
private

Definition at line 174 of file FFTJetPFPileupCleaner.cc.

References funct::abs(), gpuVertexFinder::iv, vertexNdofCut, vertexRhoCut, and vertexZmaxCut.

Referenced by findSomeVertexWFakes().

174  {
175  return !iv->isFake() && static_cast<double>(iv->ndof()) > vertexNdofCut && std::abs(iv->z()) < vertexZmaxCut &&
176  iv->position().rho() < vertexRhoCut;
177 }
int32_t *__restrict__ iv
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ isRemovable()

bool FFTJetPFPileupCleaner::isRemovable ( reco::PFCandidate::ParticleType  ptype) const
private

Definition at line 243 of file FFTJetPFPileupCleaner.cc.

References cms::cuda::assert(), OfflineHarvestingSequence_cosmic::ptype, removalMask, edm::shift, and mitigatedMETSequence_cff::U.

Referenced by produce().

243  {
244  const unsigned shift = static_cast<unsigned>(ptype);
245  assert(shift < 32U);
246  return removalMask & (1U << shift);
247 }
assert(be >=bs)
static unsigned int const shift

◆ operator=()

FFTJetPFPileupCleaner& FFTJetPFPileupCleaner::operator= ( const FFTJetPFPileupCleaner )
delete

◆ produce()

void FFTJetPFPileupCleaner::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Implements edm::EDProducer.

Definition at line 180 of file FFTJetPFPileupCleaner.cc.

References PVValHelper::eta, etaMax, FakePrimaryVerticesToken, findSomeVertexWFakes(), mps_fire::i, iEvent, edm::Ref< C, T, F >::isNull(), isRemovable(), edm::HandleBase::isValid(), edm::Ref< C, T, F >::key(), eostools::move(), zmumugammaAnalyzer_cfi::pfCandidates, PFCandidatesToken, removeMainVertex, removeUnassociated, reverseRemovalDecision, useFakePrimaryVertex, AlignmentTracksFromVertexSelector_cfi::vertices, and VerticesToken.

180  {
181  // get PFCandidates
182  auto pOutput = std::make_unique<reco::PFCandidateCollection>();
183 
186 
187  // get vertices
189  iEvent.getByToken(VerticesToken, vertices);
190 
192  if (useFakePrimaryVertex) {
193  iEvent.getByToken(FakePrimaryVerticesToken, fakeVertices);
194  if (!fakeVertices.isValid())
195  throw cms::Exception("FFTJetBadConfig") << "ERROR in FFTJetPFPileupCleaner:"
196  " could not find fake vertices"
197  << std::endl;
198  }
199 
200  const unsigned ncand = pfCandidates->size();
201  for (unsigned i = 0; i < ncand; ++i) {
203  bool remove = false;
204 
205  if (isRemovable(candptr->particleId())) {
206  bool fromFakeSet = false;
207  reco::VertexRef vertexref(findSomeVertexWFakes(vertices, fakeVertices, *candptr, &fromFakeSet));
208  if (vertexref.isNull()) {
209  // Track is not associated with any vertex
210  // in any of the vertex sets
211  remove = removeUnassociated;
212  } else if (vertexref.key() == 0 && (!useFakePrimaryVertex || fromFakeSet)) {
213  // Track is associated with the main primary vertex
214  // However, if we are using fake vertices, this only
215  // matters if the vertex comes from the fake set. If
216  // it comes from the real set, remove the track anyway
217  // because in the combined set the associated vertex
218  // would not be the main primary vertex.
219  remove = removeMainVertex;
220  } else
221  remove = true;
222  }
223 
224  // Check the eta range
225  if (!remove) {
226  const double eta = candptr->p4().Eta();
227  remove = eta < etaMin || eta > etaMax;
228  }
229 
230  // Should we remember this candidate?
232  remove = !remove;
233  if (!remove) {
234  const reco::PFCandidate& cand = (*pfCandidates)[i];
235  pOutput->push_back(cand);
236  pOutput->back().setSourceCandidatePtr(candptr);
237  }
238  }
239 
240  iEvent.put(std::move(pOutput));
241 }
edm::EDGetTokenT< reco::VertexCollection > FakePrimaryVerticesToken
bool isRemovable(reco::PFCandidate::ParticleType ptype) const
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< reco::VertexCollection > VerticesToken
reco::VertexRef findSomeVertexWFakes(const edm::Handle< reco::VertexCollection > &vertices, const edm::Handle< reco::VertexCollection > &fakeVertices, const reco::PFCandidate &pfcand, bool *fromFakeSet) const
edm::EDGetTokenT< reco::PFCandidateCollection > PFCandidatesToken
bool isValid() const
Definition: HandleBase.h:70
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
def move(src, dest)
Definition: eostools.py:511

◆ setRemovalBit()

void FFTJetPFPileupCleaner::setRemovalBit ( reco::PFCandidate::ParticleType  ptype,
bool  onOff 
)
private

Definition at line 249 of file FFTJetPFPileupCleaner.cc.

References cms::cuda::assert(), OfflineHarvestingSequence_cosmic::ptype, removalMask, edm::shift, and mitigatedMETSequence_cff::U.

Referenced by buildRemovalMask().

249  {
250  const unsigned shift = static_cast<unsigned>(ptype);
251  assert(shift < 32U);
252  const unsigned mask = (1U << shift);
253  if (value)
254  removalMask |= mask;
255  else
256  removalMask &= ~mask;
257 }
assert(be >=bs)
Definition: value.py:1
static unsigned int const shift

Member Data Documentation

◆ checkClosestZVertex

bool FFTJetPFPileupCleaner::checkClosestZVertex
private

Definition at line 84 of file FFTJetPFPileupCleaner.cc.

Referenced by findSomeVertexWFakes().

◆ etaMax

double FFTJetPFPileupCleaner::etaMax
private

Definition at line 120 of file FFTJetPFPileupCleaner.cc.

Referenced by produce().

◆ etaMin

double FFTJetPFPileupCleaner::etaMin
private

Definition at line 119 of file FFTJetPFPileupCleaner.cc.

◆ FakePrimaryVertices

edm::InputTag FFTJetPFPileupCleaner::FakePrimaryVertices
private

Definition at line 72 of file FFTJetPFPileupCleaner.cc.

Referenced by FFTJetPFPileupCleaner().

◆ FakePrimaryVerticesToken

edm::EDGetTokenT<reco::VertexCollection> FFTJetPFPileupCleaner::FakePrimaryVerticesToken
private

Definition at line 76 of file FFTJetPFPileupCleaner.cc.

Referenced by FFTJetPFPileupCleaner(), and produce().

◆ keepIfPVneighbor

bool FFTJetPFPileupCleaner::keepIfPVneighbor
private

Definition at line 91 of file FFTJetPFPileupCleaner.cc.

Referenced by findSomeVertexWFakes().

◆ PFCandidates

edm::InputTag FFTJetPFPileupCleaner::PFCandidates
private

Definition at line 70 of file FFTJetPFPileupCleaner.cc.

Referenced by FFTJetPFPileupCleaner().

◆ PFCandidatesToken

edm::EDGetTokenT<reco::PFCandidateCollection> FFTJetPFPileupCleaner::PFCandidatesToken
private

Definition at line 74 of file FFTJetPFPileupCleaner.cc.

Referenced by FFTJetPFPileupCleaner(), and produce().

◆ removalMask

unsigned FFTJetPFPileupCleaner::removalMask
private

Definition at line 116 of file FFTJetPFPileupCleaner.cc.

Referenced by isRemovable(), and setRemovalBit().

◆ remove_e

bool FFTJetPFPileupCleaner::remove_e
private

Definition at line 108 of file FFTJetPFPileupCleaner.cc.

Referenced by buildRemovalMask().

◆ remove_egamma_HF

bool FFTJetPFPileupCleaner::remove_egamma_HF
private

Definition at line 113 of file FFTJetPFPileupCleaner.cc.

Referenced by buildRemovalMask().

◆ remove_gamma

bool FFTJetPFPileupCleaner::remove_gamma
private

Definition at line 110 of file FFTJetPFPileupCleaner.cc.

Referenced by buildRemovalMask().

◆ remove_h

bool FFTJetPFPileupCleaner::remove_h
private

Definition at line 107 of file FFTJetPFPileupCleaner.cc.

Referenced by buildRemovalMask().

◆ remove_h0

bool FFTJetPFPileupCleaner::remove_h0
private

Definition at line 111 of file FFTJetPFPileupCleaner.cc.

Referenced by buildRemovalMask().

◆ remove_h_HF

bool FFTJetPFPileupCleaner::remove_h_HF
private

Definition at line 112 of file FFTJetPFPileupCleaner.cc.

Referenced by buildRemovalMask().

◆ remove_mu

bool FFTJetPFPileupCleaner::remove_mu
private

Definition at line 109 of file FFTJetPFPileupCleaner.cc.

Referenced by buildRemovalMask().

◆ remove_X

bool FFTJetPFPileupCleaner::remove_X
private

Definition at line 106 of file FFTJetPFPileupCleaner.cc.

Referenced by buildRemovalMask().

◆ removeMainVertex

bool FFTJetPFPileupCleaner::removeMainVertex
private

Definition at line 95 of file FFTJetPFPileupCleaner.cc.

Referenced by produce().

◆ removeUnassociated

bool FFTJetPFPileupCleaner::removeUnassociated
private

Definition at line 99 of file FFTJetPFPileupCleaner.cc.

Referenced by produce().

◆ reverseRemovalDecision

bool FFTJetPFPileupCleaner::reverseRemovalDecision
private

Definition at line 102 of file FFTJetPFPileupCleaner.cc.

Referenced by produce().

◆ useFakePrimaryVertex

bool FFTJetPFPileupCleaner::useFakePrimaryVertex
private

Definition at line 80 of file FFTJetPFPileupCleaner.cc.

Referenced by FFTJetPFPileupCleaner(), findSomeVertexWFakes(), and produce().

◆ vertexNdofCut

double FFTJetPFPileupCleaner::vertexNdofCut
private

Definition at line 123 of file FFTJetPFPileupCleaner.cc.

Referenced by isAcceptableVtx().

◆ vertexRhoCut

double FFTJetPFPileupCleaner::vertexRhoCut
private

Definition at line 129 of file FFTJetPFPileupCleaner.cc.

Referenced by isAcceptableVtx().

◆ vertexZmaxCut

double FFTJetPFPileupCleaner::vertexZmaxCut
private

Definition at line 126 of file FFTJetPFPileupCleaner.cc.

Referenced by isAcceptableVtx().

◆ Vertices

edm::InputTag FFTJetPFPileupCleaner::Vertices
private

Definition at line 71 of file FFTJetPFPileupCleaner.cc.

Referenced by FFTJetPFPileupCleaner().

◆ VerticesToken

edm::EDGetTokenT<reco::VertexCollection> FFTJetPFPileupCleaner::VerticesToken
private

Definition at line 75 of file FFTJetPFPileupCleaner.cc.

Referenced by FFTJetPFPileupCleaner(), and produce().

◆ zAssoc

std::vector<std::pair<double, unsigned> > FFTJetPFPileupCleaner::zAssoc
mutableprivate

Definition at line 132 of file FFTJetPFPileupCleaner.cc.

Referenced by findSomeVertexWFakes().