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::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 
EDProducer.h
HepMCCopy::HepMCCopy
HepMCCopy(edm::ParameterSet const &p)
Definition: HepMCCopy.cc:17
edm::Handle< edm::HepMCProduct >
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
source
static const std::string source
Definition: EdmProvDump.cc:47
HepMCCopy::~HepMCCopy
~HepMCCopy() override
Definition: HepMCCopy.cc:11
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
eostools.move
def move(src, dest)
Definition: eostools.py:511
HepMCCopy::produce
void produce(edm::Event &e, const edm::EventSetup &c) override
Definition: HepMCCopy.cc:22
edm::EDProducer
Definition: EDProducer.h:35
HepMCProduct.h
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
edm::Event
Definition: Event.h:73
HepMCCopy
Definition: HepMCCopy.cc:8
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37