CMS 3D CMS Logo

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

List of all members.

Public Member Functions

 GenericSelectorByValueMap (edm::ParameterSet const &config)

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

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.

                                                                                        :
  m_electrons(config.getParameter<edm::InputTag>("input")),
  m_selection(config.getParameter<edm::InputTag>("selection")),
  m_cut(config.getParameter<cut_type>("cut"))
{
  // register the product
  produces<edm::RefToBaseVector<candidate_type> >();
}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 84 of file GenericSelectorByValueMap.h.

References i, edm::View< T >::refAt(), and edm::View< T >::size().

{
  std::auto_ptr<edm::RefToBaseVector<candidate_type> > candidates(new edm::RefToBaseVector<candidate_type>());

  // read the collection of GsfElectrons from the Event
  edm::Handle<edm::View<candidate_type> > h_electrons;
  event.getByLabel(m_electrons, h_electrons);
  edm::View<candidate_type> const & electrons = * h_electrons;

  // read the selection map from the Event
  edm::Handle<edm::ValueMap<selection_type> > h_selection;
  event.getByLabel(m_selection, h_selection);
  edm::ValueMap<selection_type> const & selectionMap = * h_selection;
 
  for (unsigned int i = 0; i < electrons.size(); ++i) {
    edm::RefToBase<candidate_type> ptr = electrons.refAt(i);
    if (selectionMap[ptr] > m_cut)
     candidates->push_back(ptr); 
  }

  // put the product in the event
  event.put(candidates);
}

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.