L1Trigger
Phase2L1ParticleFlow
src
HGC3DClusterEgID.cc
Go to the documentation of this file.
1
#include "
L1Trigger/Phase2L1ParticleFlow/interface/HGC3DClusterEgID.h
"
2
#include "
CommonTools/MVAUtils/interface/TMVAZipReader.h
"
3
4
l1tpf::HGC3DClusterEgID::HGC3DClusterEgID
(
const
edm::ParameterSet
&
pset
)
5
: isPUFilter_(
pset
.getParameter<
bool
>(
"isPUFilter"
)),
6
preselection_(
pset
.getParameter<
std
::
string
>(
"preselection"
)),
7
method_(
pset
.getParameter<
std
::
string
>(
"method"
)),
8
weightsFile_(
pset
.getParameter<
std
::
string
>(
"weightsFile"
)),
9
reader_(new TMVA::Reader()),
10
wp_(
pset
.getParameter<
std
::
string
>(
"wp"
)) {
11
// first create all the variables
12
for
(
const
auto
&psvar :
pset
.getParameter<std::vector<edm::ParameterSet>>(
"variables"
)) {
13
variables_
.emplace_back(psvar.getParameter<
std::string
>(
"name"
), psvar.getParameter<
std::string
>(
"value"
));
14
}
15
}
16
17
void
l1tpf::HGC3DClusterEgID::prepareTMVA
() {
18
// Declare the variables
19
for
(
auto
&
var
: variables_)
20
var
.declare(*reader_);
21
// then read the weights
22
if
(weightsFile_[0] !=
'/'
&& weightsFile_[0] !=
'.'
) {
23
weightsFile_ =
edm::FileInPath
(weightsFile_).
fullPath
();
24
}
25
reco::details::loadTMVAWeights
(&*reader_, method_, weightsFile_);
26
}
27
28
float
l1tpf::HGC3DClusterEgID::passID
(
l1t::HGCalMulticluster
c
,
l1t::PFCluster
&cpf) {
29
if
(preselection_(
c
)) {
30
for
(
auto
&
var
: variables_)
31
var
.fill(
c
);
32
float
mvaOut = reader_->EvaluateMVA(method_);
33
if
(isPUFilter_)
34
cpf.
setEgVsPUMVAOut
(mvaOut);
35
else
36
cpf.
setEgVsPionMVAOut
(mvaOut);
37
return
(mvaOut > wp_(
c
) ? 1 : 0);
38
}
else
{
39
if
(isPUFilter_)
40
cpf.
setEgVsPUMVAOut
(-100.0);
41
else
42
cpf.
setEgVsPionMVAOut
(-100.0);
43
return
0;
44
}
45
}
electrons_cff.bool
bool
Definition:
electrons_cff.py:366
l1tpf::HGC3DClusterEgID::variables_
std::vector< Var > variables_
Definition:
HGC3DClusterEgID.h:46
l1tpf::HGC3DClusterEgID::prepareTMVA
void prepareTMVA()
Definition:
HGC3DClusterEgID.cc:17
l1tpf::HGC3DClusterEgID::passID
float passID(l1t::HGCalMulticluster c, l1t::PFCluster &cpf)
Definition:
HGC3DClusterEgID.cc:28
trigObjTnPSource_cfi.var
var
Definition:
trigObjTnPSource_cfi.py:21
edm::FileInPath
Definition:
FileInPath.h:61
l1t::HGCalMulticluster
Definition:
HGCalMulticluster.h:13
edm::ParameterSet
Definition:
ParameterSet.h:47
l1t::PFCluster::setEgVsPionMVAOut
void setEgVsPionMVAOut(float egVsPionMVAOut)
Definition:
PFCluster.h:63
HGC3DClusterEgID.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
std
Definition:
JetResolutionObject.h:76
l1t::PFCluster
Definition:
PFCluster.h:10
reco::details::loadTMVAWeights
TMVA::IMethod * loadTMVAWeights(TMVA::Reader *reader, const std::string &method, const std::string &weightFile, bool verbose=false)
Definition:
TMVAZipReader.cc:52
TMVAZipReader.h
l1t::PFCluster::setEgVsPUMVAOut
void setEgVsPUMVAOut(float egVsPUMVAOut)
Definition:
PFCluster.h:66
l1tpf::HGC3DClusterEgID::HGC3DClusterEgID
HGC3DClusterEgID(const edm::ParameterSet &pset)
Definition:
HGC3DClusterEgID.cc:4
c
auto & c
Definition:
CAHitNtupletGeneratorKernelsImpl.h:56
edm::FileInPath::fullPath
std::string fullPath() const
Definition:
FileInPath.cc:161
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
Generated for CMSSW Reference Manual by
1.8.16