CMS 3D CMS Logo

Public Member Functions | Private Attributes

ElectronIDExternalProducer< algo > Class Template Reference

#include <ElectronIDExternalProducer.h>

Inheritance diagram for ElectronIDExternalProducer< algo >:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 ElectronIDExternalProducer (const edm::ParameterSet &iConfig)
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
virtual ~ElectronIDExternalProducer ()

Private Attributes

algo select_
edm::InputTag src_

Detailed Description

template<class algo>
class ElectronIDExternalProducer< algo >

Definition at line 17 of file ElectronIDExternalProducer.h.


Constructor & Destructor Documentation

template<class algo >
ElectronIDExternalProducer< algo >::ElectronIDExternalProducer ( const edm::ParameterSet iConfig) [inline, explicit]

Definition at line 19 of file ElectronIDExternalProducer.h.

                                                                       :
            src_(iConfig.getParameter<edm::InputTag>("src")),
            select_(iConfig)
   {
        produces<edm::ValueMap<float> >();
   }
template<class algo >
virtual ElectronIDExternalProducer< algo >::~ElectronIDExternalProducer ( ) [inline, virtual]

Definition at line 26 of file ElectronIDExternalProducer.h.

{}

Member Function Documentation

template<typename algo >
void ElectronIDExternalProducer< algo >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 37 of file ElectronIDExternalProducer.h.

References HI_PhotonSkim_cff::electrons, edm::helper::Filler< Map >::fill(), edm::Event::getByLabel(), edm::helper::Filler< Map >::insert(), dbtoconf::out, edm::Event::put(), and makeHLTPrescaleTable::values.

                                                                                              {
     // read input collection
     edm::Handle<reco::GsfElectronCollection> electrons;
     iEvent.getByLabel(src_, electrons);

     // initialize common selector
     select_.newEvent(iEvent, iSetup);

     // prepare room for output
     std::vector<float> values; values.reserve(electrons->size());
     for ( reco::GsfElectronCollection::const_iterator eleIt = electrons->begin () ;
             eleIt != electrons->end () ;
             ++eleIt ) {
         values.push_back( float( select_((*eleIt),iEvent,iSetup) ) );
     }

     // fill in the ValueMap
     std::auto_ptr<edm::ValueMap<float> > out(new edm::ValueMap<float>());
     edm::ValueMap<float>::Filler filler(*out);
     filler.insert(electrons, values.begin(), values.end());
     filler.fill();
     // and put it into the event
     iEvent.put(out);

}

Member Data Documentation

template<class algo >
algo ElectronIDExternalProducer< algo >::select_ [private]

Definition at line 32 of file ElectronIDExternalProducer.h.

template<class algo >
edm::InputTag ElectronIDExternalProducer< algo >::src_ [private]

Definition at line 31 of file ElectronIDExternalProducer.h.