RecoEgamma
EgammaElectronProducers
plugins
LowPtGsfElectronFinalizer.cc
Go to the documentation of this file.
1
#include "
CommonTools/CandAlgos/interface/ModifyObjectValueBase.h
"
2
#include "
DataFormats/EgammaCandidates/interface/GsfElectron.h
"
3
#include "
FWCore/Framework/interface/stream/EDProducer.h
"
4
#include "
FWCore/Framework/interface/Event.h
"
5
#include "
FWCore/Framework/interface/EventSetup.h
"
6
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
7
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
8
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
9
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
10
11
class
LowPtGsfElectronFinalizer
:
public
edm::stream::EDProducer
<> {
12
public
:
13
explicit
LowPtGsfElectronFinalizer
(
const
edm::ParameterSet
&);
14
15
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
16
17
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
&);
18
19
private
:
20
const
edm::EDGetTokenT<reco::GsfElectronCollection>
previousGsfElectrons_
;
21
std::unique_ptr<ModifyObjectValueBase>
regression_
;
22
23
const
edm::EDPutTokenT<reco::GsfElectronCollection>
putToken_
;
24
};
25
26
using
edm::InputTag
;
27
using
reco::GsfElectronCollection
;
28
29
LowPtGsfElectronFinalizer::LowPtGsfElectronFinalizer
(
const
edm::ParameterSet
&
cfg
)
30
: previousGsfElectrons_{consumes<GsfElectronCollection>(
cfg
.getParameter<
InputTag
>(
"previousGsfElectronsTag"
))},
31
putToken_{produces<GsfElectronCollection>()} {
32
auto
const
& iconf =
cfg
.getParameterSet(
"regressionConfig"
);
33
auto
const
& mname = iconf.getParameter<
std::string
>(
"modifierName"
);
34
auto
cc
= consumesCollector();
35
regression_ =
ModifyObjectValueFactory::get
()->create(mname, iconf,
cc
);
36
}
37
38
void
LowPtGsfElectronFinalizer::produce
(
edm::Event
&
event
,
const
edm::EventSetup
&
setup
) {
39
// Setup regression for event
40
regression_
->setEvent(
event
);
41
regression_
->setEventContent(
setup
);
42
43
// Create new modified electron collection
44
reco::GsfElectronCollection
outputElectrons;
45
for
(
auto
const
&
electron
:
event
.get(
previousGsfElectrons_
)) {
46
outputElectrons.emplace_back(
electron
);
47
auto
& newElectron = outputElectrons.back();
48
regression_
->modifyObject(newElectron);
49
}
50
51
// Emplace modified electrons to event
52
event
.emplace(
putToken_
,
std::move
(outputElectrons));
53
}
54
55
void
LowPtGsfElectronFinalizer::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
56
edm::ParameterSetDescription
desc
;
57
desc
.add<
edm::InputTag
>(
"previousGsfElectronsTag"
, {});
58
edm::ParameterSetDescription
psd;
59
psd.
setUnknown
();
60
desc
.add<
edm::ParameterSetDescription
>(
"regressionConfig"
, psd);
61
descriptions.
addWithDefaultLabel
(
desc
);
62
}
63
64
#include "
FWCore/Framework/interface/MakerMacros.h
"
65
DEFINE_FWK_MODULE
(
LowPtGsfElectronFinalizer
);
ConfigurationDescriptions.h
MessageLogger.h
LowPtGsfElectronFinalizer::putToken_
const edm::EDPutTokenT< reco::GsfElectronCollection > putToken_
Definition:
LowPtGsfElectronFinalizer.cc:23
LowPtGsfElectronFinalizer::regression_
std::unique_ptr< ModifyObjectValueBase > regression_
Definition:
LowPtGsfElectronFinalizer.cc:21
edm::EDGetTokenT< reco::GsfElectronCollection >
edm::EDPutTokenT< reco::GsfElectronCollection >
LowPtGsfElectronFinalizer::previousGsfElectrons_
const edm::EDGetTokenT< reco::GsfElectronCollection > previousGsfElectrons_
Definition:
LowPtGsfElectronFinalizer.cc:20
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:89281
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
EDProducer.h
reco::GsfElectronCollection
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
Definition:
GsfElectronFwd.h:14
singleTopDQM_cfi.setup
setup
Definition:
singleTopDQM_cfi.py:37
LowPtGsfElectronFinalizer
Definition:
LowPtGsfElectronFinalizer.cc:11
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
ModifyObjectValueBase.h
metsig::electron
Definition:
SignAlgoResolutions.h:48
ParameterSetDescription.h
GsfElectron.h
LowPtGsfElectronFinalizer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
LowPtGsfElectronFinalizer.cc:38
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
LowPtGsfElectronFinalizer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition:
LowPtGsfElectronFinalizer.cc:55
edm::stream::EDProducer
Definition:
EDProducer.h:38
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition:
ParameterSetDescription.cc:39
edm::EventSetup
Definition:
EventSetup.h:58
get
#define get
cc
looper.cfg
cfg
Definition:
looper.py:297
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition:
eostools.py:511
EventSetup.h
ParameterSet.h
event
Definition:
event.py:1
edm::Event
Definition:
Event.h:73
LowPtGsfElectronFinalizer::LowPtGsfElectronFinalizer
LowPtGsfElectronFinalizer(const edm::ParameterSet &)
Definition:
LowPtGsfElectronFinalizer.cc:29
edm::InputTag
Definition:
InputTag.h:15
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:87
Generated for CMSSW Reference Manual by
1.8.16