CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes
l1tpf::ParametricResolution Class Reference

#include <ParametricResolution.h>

Public Member Functions

float operator() (const float pt, const float abseta) const
 
 ParametricResolution ()
 
 ParametricResolution (const edm::ParameterSet &cpset)
 

Static Public Member Functions

static std::vector< float > getVFloat (const edm::ParameterSet &cpset, const std::string &name)
 

Protected Types

enum  Kind { Kind::Calo, Kind::Track }
 

Protected Attributes

std::vector< float > etas_
 
Kind kind_
 
std::vector< float > offsets_
 
std::vector< float > ptMaxs_
 
std::vector< float > ptMins_
 
std::vector< float > scales_
 

Detailed Description

Definition at line 10 of file ParametricResolution.h.

Member Enumeration Documentation

◆ Kind

enum l1tpf::ParametricResolution::Kind
strongprotected
Enumerator
Calo 
Track 

Definition at line 21 of file ParametricResolution.h.

21 { Calo, Track };

Constructor & Destructor Documentation

◆ ParametricResolution() [1/2]

l1tpf::ParametricResolution::ParametricResolution ( )
inline

Definition at line 14 of file ParametricResolution.h.

14 {}

◆ ParametricResolution() [2/2]

l1tpf::ParametricResolution::ParametricResolution ( const edm::ParameterSet cpset)

Definition at line 8 of file ParametricResolution.cc.

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 }

References Calo, etas_, Exception, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), getVFloat(), kind_, ptMaxs_, ptMin, ptMins_, AlCaHLTBitMon_QueryRunRegistry::string, and Track.

Member Function Documentation

◆ getVFloat()

std::vector< float > l1tpf::ParametricResolution::getVFloat ( const edm::ParameterSet cpset,
const std::string &  name 
)
static

Definition at line 3 of file ParametricResolution.cc.

3  {
4  std::vector<double> vd = cpset.getParameter<std::vector<double>>(name);
5  return std::vector<float>(vd.begin(), vd.end());
6 }

References edm::ParameterSet::getParameter(), and Skims_PA_cff::name.

Referenced by ParametricResolution().

◆ operator()()

float l1tpf::ParametricResolution::operator() ( const float  pt,
const float  abseta 
) const

Definition at line 31 of file ParametricResolution.cc.

31  {
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 }

References dumpRecoGeometry_cfg::Calo, f, mps_fire::i, dqmiodumpmetadata::n, and DiDispStaMuonMonitor_cfi::pt.

Member Data Documentation

◆ etas_

std::vector<float> l1tpf::ParametricResolution::etas_
protected

Definition at line 20 of file ParametricResolution.h.

Referenced by ParametricResolution().

◆ kind_

Kind l1tpf::ParametricResolution::kind_
protected

Definition at line 22 of file ParametricResolution.h.

Referenced by ParametricResolution().

◆ offsets_

std::vector<float> l1tpf::ParametricResolution::offsets_
protected

Definition at line 20 of file ParametricResolution.h.

◆ ptMaxs_

std::vector<float> l1tpf::ParametricResolution::ptMaxs_
protected

Definition at line 20 of file ParametricResolution.h.

Referenced by ParametricResolution().

◆ ptMins_

std::vector<float> l1tpf::ParametricResolution::ptMins_
protected

Definition at line 20 of file ParametricResolution.h.

Referenced by ParametricResolution().

◆ scales_

std::vector<float> l1tpf::ParametricResolution::scales_
protected

Definition at line 20 of file ParametricResolution.h.

l1tpf::ParametricResolution::ptMins_
std::vector< float > ptMins_
Definition: ParametricResolution.h:20
mps_fire.i
i
Definition: mps_fire.py:355
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:153
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:160
l1tpf::ParametricResolution::Kind::Track
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
l1tpf::ParametricResolution::scales_
std::vector< float > scales_
Definition: ParametricResolution.h:20
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
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Exception
Definition: hltDiff.cc:246
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
l1tpf::ParametricResolution::offsets_
std::vector< float > offsets_
Definition: ParametricResolution.h:20
l1tpf::ParametricResolution::kind_
Kind kind_
Definition: ParametricResolution.h:22
l1tpf::ParametricResolution::etas_
std::vector< float > etas_
Definition: ParametricResolution.h:20