Main Page
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
o
p
q
r
s
t
u
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
_
a
d
e
f
l
m
o
p
s
t
u
v
Related Functions
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Package Documentation
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
EgammaAnalysis
ElectronTools
plugins
ElectronPATIdMVAProducer.cc
Go to the documentation of this file.
1
// system include files
2
#include <memory>
3
4
// user include files
5
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
6
#include "
FWCore/Framework/interface/EDProducer.h
"
7
8
#include "
FWCore/Framework/interface/Event.h
"
9
#include "
FWCore/Framework/interface/MakerMacros.h
"
10
11
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
12
#include "
EgammaAnalysis/ElectronTools/interface/EGammaMvaEleEstimator.h
"
13
#include "
DataFormats/EgammaCandidates/interface/GsfElectron.h
"
14
#include "
DataFormats/EgammaCandidates/interface/GsfElectronFwd.h
"
15
#include "
DataFormats/PatCandidates/interface/Electron.h
"
16
#include "
DataFormats/VertexReco/interface/Vertex.h
"
17
#include "
DataFormats/VertexReco/interface/VertexFwd.h
"
18
#include "
TrackingTools/Records/interface/TransientTrackRecord.h
"
19
#include "
TrackingTools/IPTools/interface/IPTools.h
"
20
//
21
// class declaration
22
//
23
24
class
ElectronPATIdMVAProducer
:
public
edm::EDProducer
{
25
public
:
26
explicit
ElectronPATIdMVAProducer
(
const
edm::ParameterSet
&);
27
~ElectronPATIdMVAProducer
()
override
;
28
29
private
:
30
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
31
32
// ----------member data ---------------------------
33
bool
verbose_
;
34
edm::EDGetTokenT<pat::ElectronCollection>
electronToken_
;
35
double
_Rho
;
36
edm::EDGetTokenT<double>
eventrhoToken_
;
37
std::string
method_
;
38
std::vector<std::string>
mvaWeightFiles_
;
39
40
EGammaMvaEleEstimator
*
mvaID_
;
41
};
42
43
//
44
// constants, enums and typedefs
45
//
46
47
//
48
// static data member definitions
49
//
50
51
//
52
// constructors and destructor
53
//
54
ElectronPATIdMVAProducer::ElectronPATIdMVAProducer
(
const
edm::ParameterSet
& iConfig) {
55
verbose_
= iConfig.
getUntrackedParameter
<
bool
>(
"verbose"
,
false
);
56
electronToken_
= consumes<pat::ElectronCollection>(iConfig.
getParameter
<
edm::InputTag
>(
"electronTag"
));
57
method_
= iConfig.
getParameter
<
std::string
>(
"method"
);
58
std::vector<std::string> fpMvaWeightFiles = iConfig.
getParameter
<std::vector<std::string> >(
"mvaWeightFile"
);
59
eventrhoToken_
= consumes<double>(iConfig.
getParameter
<
edm::InputTag
>(
"Rho"
));
60
61
produces<edm::ValueMap<float> >();
62
63
mvaID_
=
new
EGammaMvaEleEstimator
();
64
65
EGammaMvaEleEstimator::MVAType
type_;
66
67
type_ =
EGammaMvaEleEstimator::kTrigNoIP
;
68
69
bool
manualCat_ =
true
;
70
71
std::string
path_mvaWeightFileEleID;
72
for
(
unsigned
ifile
= 0;
ifile
< fpMvaWeightFiles.size(); ++
ifile
) {
73
path_mvaWeightFileEleID =
edm::FileInPath
(fpMvaWeightFiles[
ifile
].c_str()).
fullPath
();
74
mvaWeightFiles_
.push_back(path_mvaWeightFileEleID);
75
}
76
77
mvaID_
->
initialize
(
method_
, type_, manualCat_,
mvaWeightFiles_
);
78
}
79
80
ElectronPATIdMVAProducer::~ElectronPATIdMVAProducer
() {
81
// do anything here that needs to be done at desctruction time
82
// (e.g. close files, deallocate resources etc.)
83
}
84
85
//
86
// member functions
87
//
88
89
// ------------ method called on each new Event ------------
90
void
ElectronPATIdMVAProducer::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
91
std::unique_ptr<edm::ValueMap<float> >
out
(
new
edm::ValueMap<float>
());
92
93
edm::Handle<pat::ElectronCollection>
egCollection;
94
iEvent
.getByToken(
electronToken_
, egCollection);
95
const
pat::ElectronCollection
egCandidates = (*egCollection.
product
());
96
97
_Rho
= 0;
98
edm::Handle<double>
rhoPtr;
99
//const edm::InputTag eventrhoToken_("kt6PFJets", "rho");
100
iEvent
.getByToken(
eventrhoToken_
, rhoPtr);
101
_Rho
= *rhoPtr;
102
103
std::vector<float>
values
;
104
values
.reserve(egCollection->size());
105
106
for
(pat::ElectronCollection::const_iterator egIter = egCandidates.begin(); egIter != egCandidates.end(); ++egIter) {
107
double
mvaVal = -999999;
108
109
mvaVal =
mvaID_
->
mvaValue
(*egIter,
_Rho
,
verbose_
);
110
111
values
.push_back(mvaVal);
112
}
113
114
edm::ValueMap<float>::Filler
filler
(*
out
);
115
filler
.insert(egCollection,
values
.begin(),
values
.end());
116
filler
.fill();
117
118
iEvent
.put(
std::move
(
out
));
119
}
120
121
//define this as a plug-in
122
DEFINE_FWK_MODULE
(
ElectronPATIdMVAProducer
);
EGammaMvaEleEstimator
Definition:
EGammaMvaEleEstimator.h:38
edm::Handle::product
T const * product() const
Definition:
Handle.h:70
EDProducer.h
pat::ElectronCollection
std::vector< Electron > ElectronCollection
Definition:
Electron.h:36
ElectronPATIdMVAProducer::mvaID_
EGammaMvaEleEstimator * mvaID_
Definition:
ElectronPATIdMVAProducer.cc:40
edm::EDGetTokenT< pat::ElectronCollection >
ElectronPATIdMVAProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
ElectronPATIdMVAProducer.cc:90
EGammaMvaEleEstimator::kTrigNoIP
Definition:
EGammaMvaEleEstimator.h:45
EGammaMvaEleEstimator::initialize
void initialize(std::string methodName, std::string weightsfile, EGammaMvaEleEstimator::MVAType type)
Definition:
EGammaMvaEleEstimator.cc:42
ElectronPATIdMVAProducer::method_
std::string method_
Definition:
ElectronPATIdMVAProducer.cc:37
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition:
AssociativeIterator.h:50
EGammaMvaEleEstimator::MVAType
MVAType
Definition:
EGammaMvaEleEstimator.h:43
ElectronPATIdMVAProducer::ElectronPATIdMVAProducer
ElectronPATIdMVAProducer(const edm::ParameterSet &)
Definition:
ElectronPATIdMVAProducer.cc:54
ElectronPATIdMVAProducer::verbose_
bool verbose_
Definition:
ElectronPATIdMVAProducer.cc:33
edm::FileInPath
Definition:
FileInPath.h:64
ElectronPATIdMVAProducer::eventrhoToken_
edm::EDGetTokenT< double > eventrhoToken_
Definition:
ElectronPATIdMVAProducer.cc:36
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
contentValuesCheck.values
values
Definition:
contentValuesCheck.py:38
compare_using_db.ifile
ifile
Definition:
compare_using_db.py:251
GsfElectron.h
EGammaMvaEleEstimator.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
Vertex.h
GsfElectronFwd.h
edm::ParameterSet
Definition:
ParameterSet.h:47
ElectronPATIdMVAProducer
Definition:
ElectronPATIdMVAProducer.cc:24
Event.h
ElectronPATIdMVAProducer::_Rho
double _Rho
Definition:
ElectronPATIdMVAProducer.cc:35
trigObjTnPSource_cfi.filler
filler
Definition:
trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup
Definition:
EventSetup.h:58
TransientTrackRecord.h
VertexFwd.h
EGammaMvaEleEstimator::mvaValue
Double_t mvaValue(const reco::GsfElectron &ele, const reco::Vertex &vertex, const TransientTrackBuilder &transientTrackBuilder, EcalClusterLazyTools const &myEcalCluster, bool printDebug=kFALSE)
Definition:
EGammaMvaEleEstimator.cc:954
eostools.move
def move(src, dest)
Definition:
eostools.py:511
IPTools.h
Frameworkfwd.h
ElectronPATIdMVAProducer::electronToken_
edm::EDGetTokenT< pat::ElectronCollection > electronToken_
Definition:
ElectronPATIdMVAProducer.cc:34
edm::ValueMap< float >
edm::EDProducer
Definition:
EDProducer.h:35
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
Electron.h
MillePedeFileConverter_cfg.out
out
Definition:
MillePedeFileConverter_cfg.py:31
edm::helper::Filler
Definition:
ValueMap.h:22
ElectronPATIdMVAProducer::~ElectronPATIdMVAProducer
~ElectronPATIdMVAProducer() override
Definition:
ElectronPATIdMVAProducer.cc:80
ParameterSet.h
edm::Event
Definition:
Event.h:73
edm::InputTag
Definition:
InputTag.h:15
edm::FileInPath::fullPath
std::string fullPath() const
Definition:
FileInPath.cc:161
ElectronPATIdMVAProducer::mvaWeightFiles_
std::vector< std::string > mvaWeightFiles_
Definition:
ElectronPATIdMVAProducer.cc:38
Generated for CMSSW Reference Manual by
1.8.16