CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HepMCCopy.cc
Go to the documentation of this file.
5 
6 #include "HepMC/GenEvent.h"
7 
8 class HepMCCopy : public edm::EDProducer {
9 public:
10  explicit HepMCCopy(edm::ParameterSet const& p);
11  ~HepMCCopy() override {}
12  void produce(edm::Event& e, const edm::EventSetup& c) override;
13 
14 private:
15 };
16 
18  // This producer produces a HepMCProduct, a copy of the original one
19  produces<edm::HepMCProduct>();
20 }
21 
23  edm::Handle<edm::HepMCProduct> theHepMCProduct;
24  bool source = iEvent.getByLabel("generatorSmeared", theHepMCProduct);
25  if (!source) {
26  auto pu_product = std::make_unique<edm::HepMCProduct>();
27  iEvent.put(std::move(pu_product));
28  } else {
29  auto pu_product = std::make_unique<edm::HepMCProduct>(*theHepMCProduct);
30  iEvent.put(std::move(pu_product));
31  }
32 }
33 
void produce(edm::Event &e, const edm::EventSetup &c) override
Definition: HepMCCopy.cc:22
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const edm::EventSetup & c
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
int iEvent
Definition: GenABIO.cc:224
~HepMCCopy() override
Definition: HepMCCopy.cc:11
def move
Definition: eostools.py:511
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:500
HepMCCopy(edm::ParameterSet const &p)
Definition: HepMCCopy.cc:17
static std::string const source
Definition: EdmProvDump.cc:46