CMS 3D CMS Logo

HepMCCopy.cc
Go to the documentation of this file.
4 
6 
8 #include "HepMC/GenEvent.h"
9 
11 {
12  // This producer produces a HepMCProduct, a copy of the original one
13  produces<edm::HepMCProduct>();
14 }
15 
17 {
18 
19  edm::Handle<edm::HepMCProduct> theHepMCProduct;
20  bool source = iEvent.getByLabel("generatorSmeared",theHepMCProduct);
21  if ( !source ) {
22  auto pu_product = std::make_unique<edm::HepMCProduct>();
23  iEvent.put(std::move(pu_product));
24  } else {
25  auto pu_product = std::make_unique<edm::HepMCProduct>(*theHepMCProduct);
26  iEvent.put(std::move(pu_product));
27  }
28 
29 }
30 
virtual void produce(edm::Event &e, const edm::EventSetup &c) override
Definition: HepMCCopy.cc:16
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:230
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
HepMCCopy(edm::ParameterSet const &p)
Definition: HepMCCopy.cc:10
static std::string const source
Definition: EdmProvDump.cc:43
def move(src, dest)
Definition: eostools.py:510