CMS 3D CMS Logo

ShallowCloneProducer.cc
Go to the documentation of this file.
1 
20 
21 template <typename C>
23 public:
25  explicit ShallowCloneProducer(const edm::ParameterSet&);
27  ~ShallowCloneProducer() override;
28 
29 private:
31  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
34 };
35 
36 template <typename C>
38  : srcToken_(consumes<C>(par.template getParameter<edm::InputTag>("src"))) {
39  produces<reco::CandidateCollection>();
40 }
41 
42 template <typename C>
44 
45 template <typename C>
47  std::unique_ptr<reco::CandidateCollection> coll(new reco::CandidateCollection);
48  edm::Handle<C> masterCollection;
49  evt.getByToken(srcToken_, masterCollection);
50  for (size_t i = 0; i < masterCollection->size(); ++i) {
51  reco::CandidateBaseRef masterClone(edm::Ref<C>(masterCollection, i));
52  coll->push_back(new reco::ShallowCloneCandidate(masterClone));
53  }
54  evt.put(std::move(coll));
55 }
56 
69 
77 
79 
ShallowCloneProducer< reco::GenMETCollection > GenMETShallowCloneProducer
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
ShallowCloneProducer(const edm::ParameterSet &)
constructor from parameter set
ShallowCloneProducer< reco::MuonCollection > MuonShallowCloneProducer
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
process an event
ShallowCloneProducer< reco::CaloJetCollection > CaloJetShallowCloneProducer
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ShallowCloneProducer< reco::GsfElectronCollection > PixelMatchGsfElectronShallowCloneProducer
ShallowCloneProducer< reco::GenJetCollection > GenJetShallowCloneProducer
const edm::EDGetTokenT< C > srcToken_
labels of the collection to be converted
ShallowCloneProducer< reco::ElectronCollection > ElectronShallowCloneProducer
HLT enums.
~ShallowCloneProducer() override
destructor
ShallowCloneProducer< reco::CaloMETCollection > CaloMETShallowCloneProducer
def move(src, dest)
Definition: eostools.py:511