CMS 3D CMS Logo

ShallowCloneProducer< C > Class Template Reference

Clones a concrete Candidate collection to a CandidateCollection (i.e. More...

#include <PhysicsTools/CandAlgos/interface/ShallowCloneProducer.h>

Inheritance diagram for ShallowCloneProducer< C >:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 ShallowCloneProducer (const edm::ParameterSet &)
 constructor from parameter set
 ~ShallowCloneProducer ()
 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 ShallowCloneProducer< C >

Clones a concrete Candidate collection to a CandidateCollection (i.e.

: OwnVector<Candidate>) filled with shallow clones of the original candidate collection

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

Definition at line 23 of file ShallowCloneProducer.h.


Constructor & Destructor Documentation

template<typename C>
ShallowCloneProducer< C >::ShallowCloneProducer ( const edm::ParameterSet par  )  [inline, explicit]

constructor from parameter set

Definition at line 38 of file ShallowCloneProducer.h.

00038                                                                           : 
00039   src_( par.template getParameter<edm::InputTag>( "src" ) ) {
00040   produces<reco::CandidateCollection>();
00041 }

template<typename C>
ShallowCloneProducer< C >::~ShallowCloneProducer (  )  [inline]

destructor

Definition at line 44 of file ShallowCloneProducer.h.

00044                                                {
00045 }


Member Function Documentation

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

process an event

Implements edm::EDProducer.

Definition at line 48 of file ShallowCloneProducer.h.

References coll, edm::Event::getByLabel(), i, edm::Event::put(), and ShallowCloneProducer< C >::src_.

00048                                                                            {
00049   std::auto_ptr<reco::CandidateCollection> coll( new reco::CandidateCollection );
00050   edm::Handle<C> masterCollection;
00051   evt.getByLabel( src_, masterCollection );
00052   for( size_t i = 0; i < masterCollection->size(); ++i ) {
00053     reco::CandidateBaseRef masterClone( edm::Ref<C>( masterCollection, i ) );
00054     coll->push_back( new reco::ShallowCloneCandidate( masterClone ) );
00055   }
00056   evt.put( coll );
00057 }


Member Data Documentation

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

labels of the collection to be converted

Definition at line 34 of file ShallowCloneProducer.h.

Referenced by ShallowCloneProducer< C >::produce().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:31:32 2009 for CMSSW by  doxygen 1.5.4