GeneratorInterface
Core
plugins
GeneratorSmearedProducer.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/Event.h
"
2
#include "
FWCore/Utilities/interface/InputTag.h
"
3
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
4
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
5
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
6
7
#include "
SimDataFormats/GeneratorProducts/interface/HepMCProduct.h
"
8
#include "
FWCore/Framework/interface/global/EDProducer.h
"
9
#include "
FWCore/Utilities/interface/EDGetToken.h
"
10
#include "
FWCore/Framework/interface/MakerMacros.h
"
11
12
#include <memory>
13
14
namespace
edm
{
15
class
ParameterSet
;
16
class
ConfigurationDescriptions
;
17
class
Event
;
18
class
EventSetup
;
19
class
HepMCProduct
;
20
}
// namespace edm
21
22
class
GeneratorSmearedProducer
:
public
edm::global::EDProducer
<> {
23
public
:
24
explicit
GeneratorSmearedProducer
(
edm::ParameterSet
const
&
p
);
25
26
void
produce
(
edm::StreamID
,
edm::Event
&
e
,
edm::EventSetup
const
&
c
)
const override
;
27
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions);
28
29
private
:
30
const
edm::EDGetTokenT<edm::HepMCProduct>
newToken_
;
31
const
edm::EDGetTokenT<edm::HepMCProduct>
oldToken_
;
32
};
33
34
GeneratorSmearedProducer::GeneratorSmearedProducer
(
edm::ParameterSet
const
& ps)
35
: newToken_(consumes<
edm
::
HepMCProduct
>(ps.getUntrackedParameter<
edm
::
InputTag
>(
"currentTag"
))),
36
oldToken_(consumes<
edm
::
HepMCProduct
>(ps.getUntrackedParameter<
edm
::
InputTag
>(
"previousTag"
))) {
37
// This producer produces a HepMCProduct, a copy of the original one
38
// It is used for backwaerd compatibility
39
produces<edm::HepMCProduct>();
40
}
41
42
void
GeneratorSmearedProducer::produce
(
edm::StreamID
,
edm::Event
&
iEvent
,
const
edm::EventSetup
& es)
const
{
43
edm::Handle<edm::HepMCProduct>
theHepMCProduct;
44
bool
found
=
iEvent
.getByToken(
newToken_
, theHepMCProduct);
45
if
(!
found
) {
46
found
=
iEvent
.getByToken(
oldToken_
, theHepMCProduct);
47
}
48
if
(
found
) {
49
std::unique_ptr<edm::HepMCProduct> theCopy(
new
edm::HepMCProduct
(*theHepMCProduct));
50
iEvent
.put(
std::move
(theCopy));
51
}
52
}
53
54
void
GeneratorSmearedProducer::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
55
edm::ParameterSetDescription
desc
;
56
desc
.addUntracked<
edm::InputTag
>(
"currentTag"
,
edm::InputTag
(
"VtxSmeared"
));
57
desc
.addUntracked<
edm::InputTag
>(
"previousTag"
,
edm::InputTag
(
"generator"
));
58
descriptions.
add
(
"generatorSmeared"
,
desc
);
59
}
60
61
DEFINE_FWK_MODULE
(
GeneratorSmearedProducer
);
ConfigurationDescriptions.h
edm::StreamID
Definition:
StreamID.h:30
edm::EDGetTokenT< edm::HepMCProduct >
edm
HLT enums.
Definition:
AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
GeneratorSmearedProducer::produce
void produce(edm::StreamID, edm::Event &e, edm::EventSetup const &c) const override
Definition:
GeneratorSmearedProducer.cc:42
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:89353
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
GeneratorSmearedProducer
Definition:
GeneratorSmearedProducer.cc:22
newFWLiteAna.found
found
Definition:
newFWLiteAna.py:118
edm::Handle< edm::HepMCProduct >
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
Event
GeneratorSmearedProducer::newToken_
const edm::EDGetTokenT< edm::HepMCProduct > newToken_
Definition:
GeneratorSmearedProducer.cc:30
ParameterSetDescription.h
GeneratorSmearedProducer::GeneratorSmearedProducer
GeneratorSmearedProducer(edm::ParameterSet const &p)
Definition:
GeneratorSmearedProducer.cc:34
EDGetToken.h
edm::global::EDProducer
Definition:
EDProducer.h:32
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
ParameterSet
Definition:
Functions.h:16
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup
Definition:
EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition:
HltBtagPostValidation_cff.py:31
GeneratorSmearedProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
GeneratorSmearedProducer.cc:54
InputTag.h
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition:
eostools.py:511
ConfigurationDescriptions
GeneratorSmearedProducer::oldToken_
const edm::EDGetTokenT< edm::HepMCProduct > oldToken_
Definition:
GeneratorSmearedProducer.cc:31
HepMCProduct
EventSetup
edm::HepMCProduct
Definition:
HepMCProduct.h:18
ParameterSet.h
HepMCProduct.h
EDProducer.h
edm::Event
Definition:
Event.h:73
edm::InputTag
Definition:
InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
Generated for CMSSW Reference Manual by
1.8.16