CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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("generator",theHepMCProduct);
21  if ( !source ) {
22  std::auto_ptr<edm::HepMCProduct> pu_product(new edm::HepMCProduct());
23  iEvent.put(pu_product);
24  } else {
25  std::auto_ptr<edm::HepMCProduct> pu_product(new edm::HepMCProduct(*theHepMCProduct));
26  iEvent.put(pu_product);
27  }
28 
29 }
30 
virtual void produce(edm::Event &e, const edm::EventSetup &c) override
Definition: HepMCCopy.cc:16
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
HepMCCopy(edm::ParameterSet const &p)
Definition: HepMCCopy.cc:10
static std::string const source
Definition: EdmProvDump.cc:43