RecoEgamma
ElectronIdentification
plugins
ElectronIDExternalProducer.h
Go to the documentation of this file.
1
#ifndef RecoEgamma_ElectronIdentification_ElectronIDExternalProducer_h
2
#define RecoEgamma_ElectronIdentification_ElectronIDExternalProducer_h
3
4
#include <memory>
5
#include "
FWCore/Framework/interface/Event.h
"
6
#include "
FWCore/Framework/interface/EventSetup.h
"
7
#include "
FWCore/Framework/interface/ConsumesCollector.h
"
8
#include "
FWCore/Framework/interface/stream/EDProducer.h
"
9
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
10
#include "
FWCore/Utilities/interface/InputTag.h
"
11
12
#include "
DataFormats/EgammaCandidates/interface/GsfElectron.h
"
13
#include "
DataFormats/EgammaCandidates/interface/GsfElectronFwd.h
"
14
15
#include "
DataFormats/Common/interface/ValueMap.h
"
16
17
template
<
class
algo>
18
class
ElectronIDExternalProducer
:
public
edm::stream::EDProducer
<> {
19
public
:
20
explicit
ElectronIDExternalProducer
(
const
edm::ParameterSet
& iConfig)
21
:
srcToken_
(consumes<
reco
::
GsfElectronCollection
>(iConfig.getParameter<
edm
::
InputTag
>(
"src"
))),
22
select_
(iConfig, consumesCollector()) {
23
produces<edm::ValueMap<float>>();
24
}
25
26
~ElectronIDExternalProducer
()
override
{}
27
28
void
produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
override
;
29
30
private
:
31
edm::EDGetTokenT<reco::GsfElectronCollection>
srcToken_
;
32
algo
select_
;
33
};
34
35
template
<
typename
algo>
36
void
ElectronIDExternalProducer<algo>::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
37
// read input collection
38
edm::Handle<reco::GsfElectronCollection>
electrons
;
39
iEvent
.getByToken(srcToken_,
electrons
);
40
41
// initialize common selector
42
select_.newEvent(
iEvent
, iSetup);
43
44
// prepare room for output
45
std::vector<float>
values
;
46
values
.reserve(
electrons
->size());
47
for
(reco::GsfElectronCollection::const_iterator eleIt =
electrons
->begin(); eleIt !=
electrons
->end(); ++eleIt) {
48
values
.push_back(
float
(select_((*eleIt),
iEvent
, iSetup)));
49
}
50
51
// fill in the ValueMap
52
auto
out
= std::make_unique<edm::ValueMap<float>>();
53
edm::ValueMap<float>::Filler
filler
(*
out
);
54
filler
.insert(
electrons
,
values
.begin(),
values
.end());
55
filler
.fill();
56
// and put it into the event
57
iEvent
.put(
std::move
(
out
));
58
}
59
#endif
edm::EDGetTokenT< reco::GsfElectronCollection >
edm
HLT enums.
Definition:
AlignableModifier.h:19
ElectronIDExternalProducer::select_
algo select_
Definition:
ElectronIDExternalProducer.h:32
ElectronIDExternalProducer::srcToken_
edm::EDGetTokenT< reco::GsfElectronCollection > srcToken_
Definition:
ElectronIDExternalProducer.h:31
EDProducer.h
ElectronIDExternalProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition:
ElectronIDExternalProducer.h:36
reco::GsfElectronCollection
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
Definition:
GsfElectronFwd.h:14
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:45
edm::Handle< reco::GsfElectronCollection >
cmsdt::algo
algo
Definition:
constants.h:164
contentValuesCheck.values
values
Definition:
contentValuesCheck.py:38
GsfElectron.h
ElectronIDExternalProducer::ElectronIDExternalProducer
ElectronIDExternalProducer(const edm::ParameterSet &iConfig)
Definition:
ElectronIDExternalProducer.h:20
ElectronIDExternalProducer::~ElectronIDExternalProducer
~ElectronIDExternalProducer() override
Definition:
ElectronIDExternalProducer.h:26
GsfElectronFwd.h
HLT_2018_cff.InputTag
InputTag
Definition:
HLT_2018_cff.py:79016
edm::ParameterSet
Definition:
ParameterSet.h:36
Event.h
trigObjTnPSource_cfi.filler
filler
Definition:
trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::stream::EDProducer
Definition:
EDProducer.h:38
edm::EventSetup
Definition:
EventSetup.h:57
InputTag.h
ValueMap.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
pwdgSkimBPark_cfi.electrons
electrons
Definition:
pwdgSkimBPark_cfi.py:6
EventSetup.h
MillePedeFileConverter_cfg.out
out
Definition:
MillePedeFileConverter_cfg.py:31
ConsumesCollector.h
edm::helper::Filler
Definition:
ValueMap.h:22
ParameterSet.h
edm::Event
Definition:
Event.h:73
ElectronIDExternalProducer
Definition:
ElectronIDExternalProducer.h:18
Generated for CMSSW Reference Manual by
1.8.16