CMS 3D CMS Logo

Public Member Functions | Protected Attributes

edm::FwdPtrProducer< T, H > Class Template Reference

Produces a list of FwdPtr's to an input collection. More...

#include <CommonTools/UtilAlgos/interface/FwdPtrProducer.h>

Inheritance diagram for edm::FwdPtrProducer< T, H >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 FwdPtrProducer (edm::ParameterSet const &params)
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 ~FwdPtrProducer ()

Protected Attributes

edm::InputTag src_

Detailed Description

template<class T, class H = FwdPtrFromProductFactory<T>>
class edm::FwdPtrProducer< T, H >

Produces a list of FwdPtr's to an input collection.

Author:
Salvatore Rappoccio

Definition at line 27 of file FwdPtrProducer.h.


Constructor & Destructor Documentation

template<class T , class H = FwdPtrFromProductFactory<T>>
edm::FwdPtrProducer< T, H >::FwdPtrProducer ( edm::ParameterSet const &  params) [inline, explicit]

Definition at line 29 of file FwdPtrProducer.h.

                                                              :
       src_( params.getParameter<edm::InputTag>("src") )
    {
      produces< std::vector< edm::FwdPtr<T> > > ();
    }
template<class T , class H = FwdPtrFromProductFactory<T>>
edm::FwdPtrProducer< T, H >::~FwdPtrProducer ( ) [inline]

Definition at line 35 of file FwdPtrProducer.h.

{}

Member Function Documentation

template<class T , class H = FwdPtrFromProductFactory<T>>
virtual void edm::FwdPtrProducer< T, H >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [inline, override, virtual]

Implements edm::EDProducer.

Definition at line 37 of file FwdPtrProducer.h.

References edm::Event::getByLabel(), i, edm::Event::put(), and edm::FwdPtrProducer< T, H >::src_.

                                                                                  {

      edm::Handle< edm::View<T> > hSrc;
      iEvent.getByLabel( src_, hSrc );
      
      std::auto_ptr< std::vector< edm::FwdPtr<T> > > pOutputFwdPtr ( new std::vector<edm::FwdPtr<T> > );
      
      for ( typename edm::View<T>::const_iterator ibegin = hSrc->begin(),
              iend = hSrc->end(),
              i = ibegin; i!= iend; ++i ) {
        H factory;
        FwdPtr<T> ptr = factory( *hSrc, i - ibegin );
        pOutputFwdPtr->push_back( ptr );
      }
      
      
      iEvent.put( pOutputFwdPtr );      
    }

Member Data Documentation

template<class T , class H = FwdPtrFromProductFactory<T>>
edm::InputTag edm::FwdPtrProducer< T, H >::src_ [protected]

Definition at line 57 of file FwdPtrProducer.h.

Referenced by edm::FwdPtrProducer< T, H >::produce().