CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CloneProducer< C > Class Template Reference

#include <CloneProducer.h>

Inheritance diagram for CloneProducer< C >:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 CloneProducer (const edm::ParameterSet &)
 constructor from parameter set
 ~CloneProducer ()
 destructor

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 process an event

Private Attributes

edm::InputTag src_
 labels of the collection to be converted

Detailed Description

template<typename C>
class CloneProducer< C >

Clones a concrete Candidate collection to a CandidateCollection (i.e.: OwnVector<Candidate>) filled with clones of the original candidate collection

Author:
: Francesco Fabozzi, INFN modified by Luca Lista, INFN

Template parameters:

Definition at line 23 of file CloneProducer.h.


Constructor & Destructor Documentation

template<typename C >
CloneProducer< C >::CloneProducer ( const edm::ParameterSet par) [explicit]

constructor from parameter set

Definition at line 38 of file CloneProducer.h.

                                                            : 
  src_( par.template getParameter<edm::InputTag>( "src" ) ) {
  produces<reco::CandidateCollection>();
}
template<typename C >
CloneProducer< C >::~CloneProducer ( )

destructor

Definition at line 44 of file CloneProducer.h.

                                 {
}

Member Function Documentation

template<typename C >
void CloneProducer< C >::produce ( edm::Event evt,
const edm::EventSetup  
) [private, virtual]

process an event

Implements edm::EDProducer.

Definition at line 48 of file CloneProducer.h.

References coll, edm::Event::getByLabel(), i, and edm::Event::put().

                                                                    {
  std::auto_ptr<reco::CandidateCollection> coll( new reco::CandidateCollection );
  edm::Handle<C> masterCollection;
  evt.getByLabel( src_, masterCollection );
  for( size_t i = 0; i < masterCollection->size(); ++i ) {
    reco::CandidateBaseRef masterClone( edm::Ref<C>( masterCollection, i ) );
    coll->push_back( masterClone->clone() );
  }
  evt.put( coll );
}

Member Data Documentation

template<typename C >
edm::InputTag CloneProducer< C >::src_ [private]

labels of the collection to be converted

Definition at line 34 of file CloneProducer.h.