CMS 3D CMS Logo

ParametricCalibration.cc
Go to the documentation of this file.
2 
3 namespace l1tp2 {
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  }
16 
17  // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
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  }
26 
27  float ParametricCalibration::operator()(const float pt, const float abseta) const {
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  }
48 
49 }; // namespace l1tp2
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
etaBin
int etaBin(const l1t::HGCalMulticluster *cl)
Definition: L1EGammaEEProducer.cc:19
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HLT_FULL_cff.etaBins
etaBins
Definition: HLT_FULL_cff.py:15288
l1tp2::ParametricCalibration::pts
std::vector< float > pts
Definition: ParametricCalibration.h:21
muonRecoAnalyzer_cfi.ptBin
ptBin
Definition: muonRecoAnalyzer_cfi.py:45
ParametricCalibration.h
l1tp2::ParametricCalibration::scales
std::vector< float > scales
Definition: ParametricCalibration.h:21
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
l1tp2::ParametricCalibration::etas
std::vector< float > etas
Definition: ParametricCalibration.h:21
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
l1tp2::ParametricCalibration::operator()
float operator()(const float pt, const float abseta) const
Definition: ParametricCalibration.cc:27
l1tp2::ParametricCalibration::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: ParametricCalibration.cc:18
edm::ParameterSet
Definition: ParameterSet.h:47
l1tp2::ParametricCalibration::ParametricCalibration
ParametricCalibration()
Definition: ParametricCalibration.h:14
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
cms::Exception
Definition: Exception.h:70
l1tp2
Definition: CaloCrystalCluster.h:11
L1EGammaCrystalsEmulatorProducer_cfi.ptBins
ptBins
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:9