CMS 3D CMS Logo

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& );
28  ~ShallowCloneProducer() override;
29 
30 private:
32  void produce( edm::Event&, const edm::EventSetup& ) override;
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::unique_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(std::move(coll));
57 }
58 
59 #endif
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
ShallowCloneProducer(const edm::ParameterSet &)
constructor from parameter set
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< C > srcToken_
labels of the collection to be converted
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:520
void produce(edm::Event &, const edm::EventSetup &) override
process an event
JetCorrectorParametersCollection coll
Definition: classes.h:10
HLT enums.
~ShallowCloneProducer() override
destructor
def move(src, dest)
Definition: eostools.py:510