CMS 3D CMS Logo

ParametricResolution.cc
Go to the documentation of this file.
2 
3 std::vector<float> l1tpf::ParametricResolution::getVFloat(const edm::ParameterSet &cpset, const std::string &name) {
4  std::vector<double> vd = cpset.getParameter<std::vector<double>>(name);
5  return std::vector<float>(vd.begin(), vd.end());
6 }
7 
9  : etas_(getVFloat(cpset, "etaBins")), offsets_(getVFloat(cpset, "offset")), scales_(getVFloat(cpset, "scale")) {
10  if (cpset.existsAs<std::vector<double>>("ptMin")) {
11  ptMins_ = getVFloat(cpset, "ptMin");
12  } else {
13  float ptMin = cpset.existsAs<double>("ptMin") ? cpset.getParameter<double>("ptMin") : 0;
14  ptMins_ = std::vector<float>(etas_.size(), ptMin);
15  }
16  if (cpset.existsAs<std::vector<double>>("ptMax")) {
17  ptMaxs_ = getVFloat(cpset, "ptMax");
18  } else {
19  ptMaxs_ = std::vector<float>(etas_.size(), 1e6);
20  }
21 
22  std::string skind = cpset.getParameter<std::string>("kind");
23  if (skind == "track")
25  else if (skind == "calo")
26  kind_ = Kind::Calo;
27  else
28  throw cms::Exception("Configuration", "Bad kind of resolution: " + skind);
29 }
30 
31 float l1tpf::ParametricResolution::operator()(const float pt, const float abseta) const {
32  for (unsigned int i = 0, n = etas_.size(); i < n; ++i) {
33  if (pt > ptMaxs_[i])
34  continue;
35  if (abseta < etas_[i]) {
36  switch (kind_) {
37  case Kind::Track:
38  return pt * std::min<float>(1.f, std::hypot(pt * scales_[i] * 0.001, offsets_[i]));
39  case Kind::Calo:
40  return std::min<float>(pt, pt * scales_[i] + offsets_[i]);
41  if (pt < ptMins_[i])
42  return pt * std::min<float>(1, scales_[i] + offsets_[i] / ptMins_[i]);
43  return std::min<float>(pt, pt * scales_[i] + offsets_[i]);
44  }
45  }
46  }
47  return std::min<float>(pt, 0.3 * pt + 7); // saturate to 100% at 10 GeV, and to 30% at high pt
48 }
l1tpf::ParametricResolution::ptMins_
std::vector< float > ptMins_
Definition: ParametricResolution.h:20
l1tpf::ParametricResolution::ParametricResolution
ParametricResolution()
Definition: ParametricResolution.h:14
ParametricResolution.h
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:155
vd
std::vector< DeviationSensor2D * > vd
Definition: DeviationsFromFileSensor2D.h:21
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
l1tpf::ParametricResolution::operator()
float operator()(const float pt, const float abseta) const
Definition: ParametricResolution.cc:31
l1tpf::ParametricResolution::Kind::Track
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
dumpRecoGeometry_cfg.Calo
Calo
Definition: dumpRecoGeometry_cfg.py:191
l1tpf::ParametricResolution::Kind::Calo
l1tpf::ParametricResolution::ptMaxs_
std::vector< float > ptMaxs_
Definition: ParametricResolution.h:20
l1tpf::ParametricResolution::getVFloat
static std::vector< float > getVFloat(const edm::ParameterSet &cpset, const std::string &name)
Definition: ParametricResolution.cc:3
Exception
Definition: hltDiff.cc:245
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
l1tpf::ParametricResolution::kind_
Kind kind_
Definition: ParametricResolution.h:22
l1tpf::ParametricResolution::etas_
std::vector< float > etas_
Definition: ParametricResolution.h:20