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.

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.

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

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 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
constexpr float ptMin
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:172
static std::vector< float > getVFloat(const edm::ParameterSet &cpset, const std::string &name)

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.

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

Referenced by ParametricResolution().

3  {
4  std::vector<double> vd = cpset.getParameter<std::vector<double>>(name);
5  return std::vector<float>(vd.begin(), vd.end());
6 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< DeviationSensor2D * > vd

◆ operator()()

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

Definition at line 31 of file ParametricResolution.cc.

References dumpRecoGeometry_cfg::Calo, Matriplex::hypot(), mps_fire::i, dqmiodumpmetadata::n, and DiDispStaMuonMonitor_cfi::pt.

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 }
MPlex< T, D1, D2, N > hypot(const MPlex< T, D1, D2, N > &a, const MPlex< T, D1, D2, N > &b)
Definition: Matriplex.h:436

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.