RecoEgamma
EgammaElectronProducers
plugins
LowPtGsfElectronSeedHeavyObjectCache.cc
Go to the documentation of this file.
1
#include "
LowPtGsfElectronSeedHeavyObjectCache.h
"
2
#include "
CommonTools/MVAUtils/interface/GBRForestTools.h
"
3
#include "
DataFormats/BeamSpot/interface/BeamSpot.h
"
4
#include "
DataFormats/ParticleFlowReco/interface/PFCluster.h
"
5
#include "
DataFormats/ParticleFlowReco/interface/PFClusterFwd.h
"
6
#include "
DataFormats/ParticleFlowReco/interface/PreId.h
"
7
#include "
DataFormats/TrackReco/interface/Track.h
"
8
#include "
DataFormats/TrackReco/interface/TrackFwd.h
"
9
#include "
FWCore/ParameterSet/interface/FileInPath.h
"
10
#include "
RecoEgamma/EgammaElectronProducers/interface/LowPtGsfElectronFeatures.h
"
11
12
#include <string>
13
14
namespace
lowptgsfeleseed
{
15
17
//
18
HeavyObjectCache::HeavyObjectCache
(
const
edm::ParameterSet
& conf) {
19
for
(
auto
&
name
: conf.
getParameter
<std::vector<std::string> >(
"ModelNames"
)) {
20
names_
.push_back(
name
);
21
}
22
for
(
auto
&
weights
: conf.
getParameter
<std::vector<std::string> >(
"ModelWeights"
)) {
23
models_
.push_back(
createGBRForest
(
edm::FileInPath
(
weights
)));
24
}
25
for
(
auto
&
thresh
: conf.
getParameter
<std::vector<double> >(
"ModelThresholds"
)) {
26
thresholds_
.push_back(
thresh
);
27
}
28
if
(
names_
.size() !=
models_
.size()) {
29
throw
cms::Exception
(
"Incorrect configuration"
)
30
<<
"'ModelNames' size ("
<<
names_
.size() <<
") != 'ModelWeights' size ("
<<
models_
.size() <<
").\n"
;
31
}
32
if
(
models_
.size() !=
thresholds_
.size()) {
33
throw
cms::Exception
(
"Incorrect configuration"
)
34
<<
"'ModelWeights' size ("
<<
models_
.size() <<
") != 'ModelThresholds' size ("
<<
thresholds_
.size()
35
<<
").\n"
;
36
}
37
}
38
40
//
41
bool
HeavyObjectCache::eval
(
const
std::string
&
name
,
42
reco::PreId
&
ecal
,
43
reco::PreId
&
hcal
,
44
double
rho,
45
const
reco::BeamSpot
& spot,
46
noZS::EcalClusterLazyTools
& ecalTools)
const
{
47
std::vector<std::string>::const_iterator iter =
std::find
(
names_
.begin(),
names_
.end(),
name
);
48
if
(iter !=
names_
.end()) {
49
int
index
=
std::distance
(
names_
.begin(), iter);
50
std::vector<float>
inputs
=
features
(
ecal
,
hcal
, rho, spot, ecalTools);
51
float
output
=
models_
.at(
index
)->GetResponse(
inputs
.data());
52
bool
pass =
output
>
thresholds_
.at(
index
);
53
ecal
.setMVA(pass,
output
,
index
);
54
return
pass;
55
}
else
{
56
throw
cms::Exception
(
"Unknown model name"
)
57
<<
"'Name given: '"
<<
name
<<
"'. Check against configuration file.\n"
;
58
}
59
}
60
61
}
// namespace lowptgsfeleseed
LowPtGsfElectronSeedHeavyObjectCache.h
convertSQLitetoXML_cfg.output
output
Definition:
convertSQLitetoXML_cfg.py:72
hcal
Definition:
ConfigurationDatabase.cc:13
GBRForestTools.h
createGBRForest
std::unique_ptr< const GBRForest > createGBRForest(const std::string &weightsFile)
Definition:
GBRForestTools.cc:244
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition:
FindCaloHit.cc:19
reco::PreId
Definition:
PreId.h:13
FileInPath.h
PreId.h
edm::FileInPath
Definition:
FileInPath.h:64
Track.h
TrackFwd.h
BeamSpot.h
LowPtGsfElectronFeatures.h
lowptgsfeleseed::HeavyObjectCache::names_
std::vector< std::string > names_
Definition:
LowPtGsfElectronSeedHeavyObjectCache.h:30
HLT_FULL_cff.weights
weights
Definition:
HLT_FULL_cff.py:95855
reco::BeamSpot
Definition:
BeamSpot.h:21
PFCluster.h
lowptgsfeleseed::HeavyObjectCache::eval
bool eval(const std::string &name, reco::PreId &ecal, reco::PreId &hcal, double rho, const reco::BeamSpot &spot, noZS::EcalClusterLazyTools &ecalTools) const
Definition:
LowPtGsfElectronSeedHeavyObjectCache.cc:41
lowptgsfeleseed::features
std::vector< float > features(const reco::PreId &ecal, const reco::PreId &hcal, double rho, const reco::BeamSpot &spot, noZS::EcalClusterLazyTools &ecalTools)
Definition:
LowPtGsfElectronFeatures.cc:14
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
EcalClusterLazyToolsT
Definition:
EcalClusterLazyTools.h:135
edm::ParameterSet
Definition:
ParameterSet.h:47
PFClusterFwd.h
PixelMapPlotter.inputs
inputs
Definition:
PixelMapPlotter.py:490
lowptgsfeleseed::HeavyObjectCache::models_
std::vector< std::unique_ptr< const GBRForest > > models_
Definition:
LowPtGsfElectronSeedHeavyObjectCache.h:31
lowptgsfeleseed::HeavyObjectCache::HeavyObjectCache
HeavyObjectCache(const edm::ParameterSet &)
Definition:
LowPtGsfElectronSeedHeavyObjectCache.cc:18
GOODCOLL_filter_cfg.thresh
thresh
Definition:
GOODCOLL_filter_cfg.py:74
Exception
Definition:
hltDiff.cc:246
Skims_PA_cff.name
name
Definition:
Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
bsc_activity_cfg.ecal
ecal
Definition:
bsc_activity_cfg.py:25
AlignmentPI::index
index
Definition:
AlignmentPayloadInspectorHelper.h:46
lowptgsfeleseed
Definition:
LowPtGsfElectronFeatures.h:14
HLT_FULL_cff.distance
distance
Definition:
HLT_FULL_cff.py:7796
lowptgsfeleseed::HeavyObjectCache::thresholds_
std::vector< double > thresholds_
Definition:
LowPtGsfElectronSeedHeavyObjectCache.h:32
Generated for CMSSW Reference Manual by
1.8.16