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
 
 EDFilter (const EDFilter &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDFilteroperator= (const EDFilter &)=delete
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
 EDFilterBase (const EDFilterBase &)=delete
 
ModuleDescription const & moduleDescription () const
 
const EDFilterBaseoperator= (const EDFilterBase &)=delete
 
 ~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
 
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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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)
 

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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 22 of file RecoTauPileUpVertexSelector.cc.

Constructor & Destructor Documentation

◆ RecoTauPileUpVertexSelector()

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

Definition at line 36 of file RecoTauPileUpVertexSelector.cc.

37  : minPt_(pset.getParameter<double>("minTrackSumPt")) {
38  src_ = pset.getParameter<edm::InputTag>("src");
39  token = consumes<reco::VertexCollection>(src_);
40  filter_ = pset.getParameter<bool>("filter");
41  produces<reco::VertexCollection>();
42 }

References filter_, muonDTDigis_cfi::pset, src_, and token.

◆ ~RecoTauPileUpVertexSelector()

RecoTauPileUpVertexSelector::~RecoTauPileUpVertexSelector ( )
inlineoverride

Definition at line 25 of file RecoTauPileUpVertexSelector.cc.

25 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 70 of file RecoTauPileUpVertexSelector.cc.

70  {
71  // recoTauPileUpVertexSelector
73 
74  desc.add<double>("minTrackSumPt");
75  desc.add<edm::InputTag>("src");
76  desc.add<bool>("filter");
77 
78  descriptions.add("recoTauPileUpVertexSelector", desc);
79 }

References edm::ConfigurationDescriptions::add(), and submitPVResolutionJobs::desc.

◆ filter()

bool RecoTauPileUpVertexSelector::filter ( edm::Event evt,
const edm::EventSetup es 
)
overridevirtual

Implements edm::stream::EDFilterBase.

Definition at line 44 of file RecoTauPileUpVertexSelector.cc.

44  {
46  evt.getByToken(token, vertices_);
47  auto output = std::make_unique<reco::VertexCollection>();
48  // If there is only one vertex, there are no PU vertices!
49  if (vertices_->size() > 1) {
50  // Copy over all the vertices that have associatd tracks with pt greater
51  // than the threshold. The predicate function is the VertexTrackPtSumFilter
52  // better name: copy_if_not
53  std::remove_copy_if(vertices_->begin() + 1, vertices_->end(), std::back_inserter(*output), [this](auto const& vtx) {
54  double trackPtSum = 0.;
55  for (reco::Vertex::trackRef_iterator track = vtx.tracks_begin(); track != vtx.tracks_end(); ++track) {
56  trackPtSum += (*track)->pt();
57  }
58  return trackPtSum > this->minPt_;
59  });
60  }
61  size_t nPUVtx = output->size();
62  evt.put(std::move(output));
63  // If 'filter' is enabled, return whether true if there are PU vertices
64  if (!filter_)
65  return true;
66  else
67  return nPUVtx;
68 }

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

Member Data Documentation

◆ filter_

bool RecoTauPileUpVertexSelector::filter_
private

Definition at line 32 of file RecoTauPileUpVertexSelector.cc.

Referenced by filter(), and RecoTauPileUpVertexSelector().

◆ minPt_

double RecoTauPileUpVertexSelector::minPt_
private

Definition at line 31 of file RecoTauPileUpVertexSelector.cc.

Referenced by filter().

◆ src_

edm::InputTag RecoTauPileUpVertexSelector::src_
private

Definition at line 30 of file RecoTauPileUpVertexSelector.cc.

Referenced by RecoTauPileUpVertexSelector().

◆ token

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

Definition at line 33 of file RecoTauPileUpVertexSelector.cc.

Referenced by filter(), and RecoTauPileUpVertexSelector().

reco::Vertex::trackRef_iterator
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:38
RecoTauPileUpVertexSelector::src_
edm::InputTag src_
Definition: RecoTauPileUpVertexSelector.cc:30
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::Handle< reco::VertexCollection >
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
RecoTauPileUpVertexSelector::filter_
bool filter_
Definition: RecoTauPileUpVertexSelector.cc:32
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
RecoTauPileUpVertexSelector::minPt_
double minPt_
Definition: RecoTauPileUpVertexSelector.cc:31
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
RecoTauPileUpVertexSelector::token
edm::EDGetTokenT< reco::VertexCollection > token
Definition: RecoTauPileUpVertexSelector.cc:33
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:19
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27