CMS 3D CMS Logo

HepMCCopy.cc
Go to the documentation of this file.
5 
6 #include "HepMC/GenEvent.h"
7 
8 class HepMCCopy : public edm::one::EDProducer<> {
9 public:
10  explicit HepMCCopy(edm::ParameterSet const& p);
11  ~HepMCCopy() override = default;
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
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
int iEvent
Definition: GenABIO.cc:224
~HepMCCopy() override=default
HepMCCopy(edm::ParameterSet const &p)
Definition: HepMCCopy.cc:17
static std::string const source
Definition: EdmProvDump.cc:46
def move(src, dest)
Definition: eostools.py:511