CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
edm::GenericSelectorByValueMap< T, C > Class Template Reference

#include <GenericSelectorByValueMap.h>

Inheritance diagram for edm::GenericSelectorByValueMap< T, C >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 GenericSelectorByValueMap (edm::ParameterSet const &config)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef T candidate_type
 
typedef details::template CompatibleConfigurationType< selection_type >::type cut_type
 
typedef C selection_type
 

Private Member Functions

void produce (edm::Event &event, edm::EventSetup const &setup)
 

Private Attributes

cut_type m_cut
 
edm::EDGetTokenT< edm::View< candidate_type > > token_electrons
 
edm::EDGetTokenT< edm::ValueMap< selection_type > > token_selection
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
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)
 
- 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 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

template<typename T, typename C>
class edm::GenericSelectorByValueMap< T, C >

Definition at line 38 of file GenericSelectorByValueMap.h.

Member Typedef Documentation

template<typename T , typename C >
typedef T edm::GenericSelectorByValueMap< T, C >::candidate_type
private

Definition at line 43 of file GenericSelectorByValueMap.h.

template<typename T , typename C >
typedef details::template CompatibleConfigurationType<selection_type>::type edm::GenericSelectorByValueMap< T, C >::cut_type
private

Definition at line 45 of file GenericSelectorByValueMap.h.

template<typename T , typename C >
typedef C edm::GenericSelectorByValueMap< T, C >::selection_type
private

Definition at line 44 of file GenericSelectorByValueMap.h.

Constructor & Destructor Documentation

template<typename T , typename C >
GenericSelectorByValueMap::GenericSelectorByValueMap ( edm::ParameterSet const &  config)
explicit

Definition at line 72 of file GenericSelectorByValueMap.h.

72  :
75  m_cut(config.getParameter<cut_type>("cut"))
76 {
77  // register the product
78  produces<edm::RefToBaseVector<candidate_type> >();
79 }
Definition: config.py:1
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::ValueMap< selection_type > > token_selection
details::template CompatibleConfigurationType< selection_type >::type cut_type
edm::EDGetTokenT< edm::View< candidate_type > > token_electrons

Member Function Documentation

template<typename T , typename C >
void GenericSelectorByValueMap::produce ( edm::Event event,
edm::EventSetup const &  setup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 84 of file GenericSelectorByValueMap.h.

References objects.IsoTrackAnalyzer::candidates, genericTrackCleaner_cfi::electrons, mps_fire::i, edm::GenericSelectorByValueMap< T, C >::m_cut, eostools::move(), edm::View< T >::refAt(), edm::View< T >::size(), edm::GenericSelectorByValueMap< T, C >::token_electrons, and edm::GenericSelectorByValueMap< T, C >::token_selection.

85 {
86  auto candidates = std::make_unique<edm::RefToBaseVector<candidate_type>>();
87 
88  // read the collection of GsfElectrons from the Event
90  event.getByToken(token_electrons, h_electrons);
91  edm::View<candidate_type> const & electrons = * h_electrons;
92 
93  // read the selection map from the Event
95  event.getByToken(token_selection, h_selection);
96  edm::ValueMap<selection_type> const & selectionMap = * h_selection;
97 
98  for (unsigned int i = 0; i < electrons.size(); ++i) {
99  edm::RefToBase<candidate_type> ptr = electrons.refAt(i);
100  if (selectionMap[ptr] > m_cut)
101  candidates->push_back(ptr);
102  }
103 
104  // put the product in the event
105  event.put(std::move(candidates));
106 }
size_type size() const
RefToBase< value_type > refAt(size_type i) const
edm::EDGetTokenT< edm::ValueMap< selection_type > > token_selection
edm::EDGetTokenT< edm::View< candidate_type > > token_electrons
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

template<typename T , typename C >
cut_type edm::GenericSelectorByValueMap< T, C >::m_cut
private
template<typename T , typename C >
edm::EDGetTokenT<edm::View<candidate_type> > edm::GenericSelectorByValueMap< T, C >::token_electrons
private
template<typename T , typename C >
edm::EDGetTokenT<edm::ValueMap<selection_type> > edm::GenericSelectorByValueMap< T, C >::token_selection
private