CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes
l1tp2::ParametricCalibration Class Reference

#include <ParametricCalibration.h>

Public Member Functions

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

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Protected Attributes

std::vector< float > etas
 
std::vector< float > pts
 
std::vector< float > scales
 

Detailed Description

Definition at line 12 of file ParametricCalibration.h.

Constructor & Destructor Documentation

◆ ParametricCalibration() [1/2]

l1tp2::ParametricCalibration::ParametricCalibration ( )
inline

Definition at line 14 of file ParametricCalibration.h.

14 {}

◆ ParametricCalibration() [2/2]

l1tp2::ParametricCalibration::ParametricCalibration ( const edm::ParameterSet cpset)

Definition at line 4 of file ParametricCalibration.cc.

References HLT_2024v14_cff::etaBins, etas, edm::ParameterSet::getParameter(), l1tEGammaCrystalsEmulatorProducer_cfi::ptBins, pts, l1tEGammaCrystalsEmulatorProducer_cfi::scale, and scales.

4  {
5  std::vector<double> etaBins = cpset.getParameter<std::vector<double>>("etaBins");
6  std::vector<double> ptBins = cpset.getParameter<std::vector<double>>("ptBins");
7  std::vector<double> scale = cpset.getParameter<std::vector<double>>("scale");
8  etas.insert(etas.end(), etaBins.begin(), etaBins.end());
9  pts.insert(pts.end(), ptBins.begin(), ptBins.end());
10  scales.insert(scales.end(), scale.begin(), scale.end());
11 
12  if (pts.size() * etas.size() != scales.size())
13  throw cms::Exception("Configuration",
14  "Bad number of calibration scales, pts.size() * etas.size() != scales.size()");
15  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307

Member Function Documentation

◆ fillDescriptions()

void l1tp2::ParametricCalibration::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 18 of file ParametricCalibration.cc.

References edm::ConfigurationDescriptions::add(), and submitPVResolutionJobs::desc.

18  {
20  desc.setComment("");
21  desc.addUntracked<std::vector<double>>("etaBins", std::vector<double>{});
22  desc.addUntracked<std::vector<double>>("ptBins", std::vector<double>{});
23  desc.addUntracked<std::vector<double>>("scale", std::vector<double>{});
24  descriptions.add("createIdealTkAlRecords", desc);
25  }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ operator()()

float l1tp2::ParametricCalibration::operator() ( const float  pt,
const float  abseta 
) const

Definition at line 27 of file ParametricCalibration.cc.

References muonRecoAnalyzer_cfi::etaBin, etas, mps_fire::i, dqmiodumpmetadata::n, DiDispStaMuonMonitor_cfi::pt, muonRecoAnalyzer_cfi::ptBin, pts, and scales.

27  {
28  int ptBin = -1;
29  for (unsigned int i = 0, n = pts.size(); i < n; ++i) {
30  if (pt < pts[i]) {
31  ptBin = i;
32  break;
33  }
34  }
35  int etaBin = -1;
36  for (unsigned int i = 0, n = etas.size(); i < n; ++i) {
37  if (abseta < etas[i]) {
38  etaBin = i;
39  break;
40  }
41  }
42 
43  if (ptBin == -1 || etaBin == -1)
44  return 1;
45  else
46  return scales[ptBin * etas.size() + etaBin];
47  }

Member Data Documentation

◆ etas

std::vector<float> l1tp2::ParametricCalibration::etas
protected

Definition at line 21 of file ParametricCalibration.h.

Referenced by operator()(), and ParametricCalibration().

◆ pts

std::vector<float> l1tp2::ParametricCalibration::pts
protected

Definition at line 21 of file ParametricCalibration.h.

Referenced by operator()(), and ParametricCalibration().

◆ scales

std::vector<float> l1tp2::ParametricCalibration::scales
protected

Definition at line 21 of file ParametricCalibration.h.

Referenced by operator()(), and ParametricCalibration().