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 template <typename C>
48  std::unique_ptr<reco::CandidateCollection> coll(new reco::CandidateCollection);
49  edm::Handle<C> masterCollection;
50  evt.getByToken(srcToken_, masterCollection);
51  for (size_t i = 0; i < masterCollection->size(); ++i) {
52  reco::CandidateBaseRef masterClone(edm::Ref<C>(masterCollection, i));
53  coll->push_back(new reco::ShallowCloneCandidate(masterClone));
54  }
55  evt.put(std::move(coll));
56 }
57 
58 #endif
mps_fire.i
i
Definition: mps_fire.py:428
ShallowCloneProducer
Definition: ShallowCloneProducer.h:23
EDProducer.h
ShallowCloneProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
process an event
Definition: ShallowCloneProducer.h:47
edm::EDGetTokenT< C >
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
ShallowCloneProducer::srcToken_
edm::EDGetTokenT< C > srcToken_
labels of the collection to be converted
Definition: ShallowCloneProducer.h:34
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref
Definition: AssociativeIterator.h:58
ShallowCloneProducer::ShallowCloneProducer
ShallowCloneProducer(const edm::ParameterSet &)
constructor from parameter set
Definition: ShallowCloneProducer.h:38
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::EventSetup
Definition: EventSetup.h:58
svgfig.template
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
InputTag.h
ShallowCloneCandidate.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
gen::C
C
Definition: PomwigHadronizer.cc:78
edm::EDProducer
Definition: EDProducer.h:35
edm::RefToBase< Candidate >
reco::ShallowCloneCandidate
Definition: ShallowCloneCandidate.h:15
ParameterSet.h
edm::Event
Definition: Event.h:73
ShallowCloneProducer::~ShallowCloneProducer
~ShallowCloneProducer() override
destructor
Definition: ShallowCloneProducer.h:44
edm::OwnVector
Definition: OwnVector.h:24