src
RecoParticleFlow
Configuration
plugins
HepMCCopy.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/one/EDProducer.h
"
2
#include "
FWCore/Framework/interface/Event.h
"
3
#include "
FWCore/ServiceRegistry/interface/Service.h
"
4
#include "
SimDataFormats/GeneratorProducts/interface/HepMCProduct.h
"
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
17
HepMCCopy::HepMCCopy
(
edm::ParameterSet
const
&
p
) {
18
// This producer produces a HepMCProduct, a copy of the original one
19
produces<edm::HepMCProduct>();
20
}
21
22
void
HepMCCopy::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& es) {
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
34
#include "
FWCore/Framework/interface/MakerMacros.h
"
35
DEFINE_FWK_MODULE
(
HepMCCopy
);
EDProducer.h
HepMCCopy::produce
void produce(edm::Event &e, const edm::EventSetup &c) override
Definition:
HepMCCopy.cc:22
Event.h
edm::Handle< edm::HepMCProduct >
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
c
auto & c
Definition:
CAHitNtupletGeneratorKernelsImpl.h:56
iEvent
int iEvent
Definition:
GenABIO.cc:224
Service.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::EventSetup
Definition:
EventSetup.h:59
HepMCProduct.h
HepMCCopy::~HepMCCopy
~HepMCCopy() override=default
HepMCCopy::HepMCCopy
HepMCCopy(edm::ParameterSet const &p)
Definition:
HepMCCopy.cc:17
edm::ParameterSet
Definition:
ParameterSet.h:47
edm::Event
Definition:
Event.h:73
edm::one::EDProducer
Definition:
EDProducer.h:30
MakerMacros.h
source
static std::string const source
Definition:
EdmProvDump.cc:49
eostools.move
def move(src, dest)
Definition:
eostools.py:511
AlCaHLTBitMon_ParallelJobs.p
def p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
HepMCCopy
Definition:
HepMCCopy.cc:8
Generated for CMSSW Reference Manual by
1.8.14