CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::ProductRegistryHelper

Public Member Functions

 GenericSelectorByValueMap (edm::ParameterSet const &config)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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::InputTag m_electrons
 
edm::InputTag m_selection
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

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

Definition at line 36 of file GenericSelectorByValueMap.h.

Member Typedef Documentation

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

Definition at line 41 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 43 of file GenericSelectorByValueMap.h.

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

Definition at line 42 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  :
73  m_electrons(config.getParameter<edm::InputTag>("input")),
74  m_selection(config.getParameter<edm::InputTag>("selection")),
75  m_cut(config.getParameter<cut_type>("cut"))
76 {
77  // register the product
78  produces<edm::RefToBaseVector<candidate_type> >();
79 }
details::template CompatibleConfigurationType< selection_type >::type cut_type

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 HI_PhotonSkim_cff::electrons, i, edm::View< T >::refAt(), and edm::View< T >::size().

85 {
86  std::auto_ptr<edm::RefToBaseVector<candidate_type> > candidates(new edm::RefToBaseVector<candidate_type>());
87 
88  // read the collection of GsfElectrons from the Event
90  event.getByLabel(m_electrons, h_electrons);
91  edm::View<candidate_type> const & electrons = * h_electrons;
92 
93  // read the selection map from the Event
95  event.getByLabel(m_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(candidates);
106 }
int i
Definition: DBlmapReader.cc:9
RefToBase< value_type > refAt(size_type i) const
size_type size() const

Member Data Documentation

template<typename T , typename C >
cut_type edm::GenericSelectorByValueMap< T, C >::m_cut
private

Definition at line 50 of file GenericSelectorByValueMap.h.

template<typename T , typename C >
edm::InputTag edm::GenericSelectorByValueMap< T, C >::m_electrons
private

Definition at line 47 of file GenericSelectorByValueMap.h.

template<typename T , typename C >
edm::InputTag edm::GenericSelectorByValueMap< T, C >::m_selection
private

Definition at line 48 of file GenericSelectorByValueMap.h.