CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ShallowCloneProducer.h
Go to the documentation of this file.
1 #ifndef CandAlgos_ShallowCloneProducer_h
2 #define CandAlgos_ShallowCloneProducer_h
3 
21 
22 template<typename C>
24 public:
26  explicit ShallowCloneProducer( 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( new reco::ShallowCloneCandidate( masterClone ) );
55  }
56  evt.put( coll );
57 }
58 
59 #endif
int i
Definition: DBlmapReader.cc:9
ShallowCloneProducer(const edm::ParameterSet &)
constructor from parameter set
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
virtual void produce(edm::Event &, const edm::EventSetup &)
process an event
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
edm::EDGetTokenT< C > srcToken_
labels of the collection to be converted
JetCorrectorParametersCollection coll
Definition: classes.h:10
~ShallowCloneProducer()
destructor
def template
Definition: svgfig.py:520