test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CloneProducer.h
Go to the documentation of this file.
1 #ifndef CandAlgos_CloneProducer_h
2 #define CandAlgos_CloneProducer_h
3 
21 
22 template<typename C>
24 public:
26  explicit CloneProducer( const edm::ParameterSet& );
29 
30 private:
32  virtual void produce( edm::Event&, const edm::EventSetup& );
35 };
36 
37 template<typename C>
39  srcToken_( consumes<C>( par.template getParameter<edm::InputTag>( "src" ) ) ) {
40  produces<reco::CandidateCollection>();
41 }
42 
43 template<typename C>
45 }
46 
47 template<typename C>
49  std::auto_ptr<reco::CandidateCollection> coll( new reco::CandidateCollection );
50  edm::Handle<C> masterCollection;
51  evt.getByToken( srcToken_, masterCollection );
52  for( size_t i = 0; i < masterCollection->size(); ++i ) {
53  reco::CandidateBaseRef masterClone( edm::Ref<C>( masterCollection, i ) );
54  coll->push_back( masterClone->clone() );
55  }
56  evt.put( coll );
57 }
58 
59 #endif
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
virtual void produce(edm::Event &, const edm::EventSetup &)
process an event
Definition: CloneProducer.h:48
CloneProducer(const edm::ParameterSet &)
constructor from parameter set
Definition: CloneProducer.h:38
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
~CloneProducer()
destructor
Definition: CloneProducer.h:44
JetCorrectorParametersCollection coll
Definition: classes.h:10
edm::EDGetTokenT< C > srcToken_
labels of the collection to be converted
Definition: CloneProducer.h:34
def template
Definition: svgfig.py:520