CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
RecoTauPileUpVertexSelector Class Reference
Inheritance diagram for RecoTauPileUpVertexSelector:
edm::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

bool filter (edm::Event &evt, const edm::EventSetup &es) override
 
 RecoTauPileUpVertexSelector (const edm::ParameterSet &pset)
 
 ~RecoTauPileUpVertexSelector () override
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilterBase () 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
 
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)
 
 ~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
 
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::vector< ModuleDescription const * > &modules, 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

bool filter_
 
double minPt_
 
edm::InputTag src_
 
edm::EDGetTokenT< reco::VertexCollectiontoken
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDFilter<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase 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
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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<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)
 

Detailed Description

Definition at line 23 of file RecoTauPileUpVertexSelector.cc.

Constructor & Destructor Documentation

RecoTauPileUpVertexSelector::RecoTauPileUpVertexSelector ( const edm::ParameterSet pset)
explicit

Definition at line 37 of file RecoTauPileUpVertexSelector.cc.

References filter_, edm::ParameterSet::getParameter(), src_, and token.

38  : minPt_(pset.getParameter<double>("minTrackSumPt")) {
39  src_ = pset.getParameter<edm::InputTag>("src");
40  token = consumes<reco::VertexCollection>(src_);
41  filter_ = pset.getParameter<bool>("filter");
42  produces<reco::VertexCollection>();
43 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::VertexCollection > token
RecoTauPileUpVertexSelector::~RecoTauPileUpVertexSelector ( )
inlineoverride

Definition at line 26 of file RecoTauPileUpVertexSelector.cc.

References fillDescriptions(), and filter().

26 {}

Member Function Documentation

void RecoTauPileUpVertexSelector::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 71 of file RecoTauPileUpVertexSelector.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and DEFINE_FWK_MODULE.

Referenced by ~RecoTauPileUpVertexSelector().

71  {
72  // recoTauPileUpVertexSelector
74 
75  desc.add<double>("minTrackSumPt");
76  desc.add<edm::InputTag>("src");
77  desc.add<bool>("filter");
78 
79  descriptions.add("recoTauPileUpVertexSelector", desc);
80 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool RecoTauPileUpVertexSelector::filter ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 45 of file RecoTauPileUpVertexSelector.cc.

References filter_, edm::Event::getByToken(), minPt_, eostools::move(), convertSQLitetoXML_cfg::output, edm::Event::put(), token, HLT_2018_cff::track, and badGlobalMuonTaggersAOD_cff::vtx.

Referenced by ~RecoTauPileUpVertexSelector().

45  {
47  evt.getByToken(token, vertices_);
48  auto output = std::make_unique<reco::VertexCollection>();
49  // If there is only one vertex, there are no PU vertices!
50  if (vertices_->size() > 1) {
51  // Copy over all the vertices that have associatd tracks with pt greater
52  // than the threshold. The predicate function is the VertexTrackPtSumFilter
53  // better name: copy_if_not
54  std::remove_copy_if(vertices_->begin() + 1, vertices_->end(), std::back_inserter(*output), [this](auto const& vtx) {
55  double trackPtSum = 0.;
56  for (reco::Vertex::trackRef_iterator track = vtx.tracks_begin(); track != vtx.tracks_end(); ++track) {
57  trackPtSum += (*track)->pt();
58  }
59  return trackPtSum > this->minPt_;
60  });
61  }
62  size_t nPUVtx = output->size();
63  evt.put(std::move(output));
64  // If 'filter' is enabled, return whether true if there are PU vertices
65  if (!filter_)
66  return true;
67  else
68  return nPUVtx;
69 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< reco::VertexCollection > token
def move(src, dest)
Definition: eostools.py:511
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:37

Member Data Documentation

bool RecoTauPileUpVertexSelector::filter_
private

Definition at line 33 of file RecoTauPileUpVertexSelector.cc.

Referenced by filter(), and RecoTauPileUpVertexSelector().

double RecoTauPileUpVertexSelector::minPt_
private

Definition at line 32 of file RecoTauPileUpVertexSelector.cc.

Referenced by filter().

edm::InputTag RecoTauPileUpVertexSelector::src_
private

Definition at line 31 of file RecoTauPileUpVertexSelector.cc.

Referenced by RecoTauPileUpVertexSelector().

edm::EDGetTokenT<reco::VertexCollection> RecoTauPileUpVertexSelector::token
private

Definition at line 34 of file RecoTauPileUpVertexSelector.cc.

Referenced by filter(), and RecoTauPileUpVertexSelector().