Skip to content

Commit

Permalink
Addressed comments of #29904 (b4fdcc3)
Browse files Browse the repository at this point in the history
  • Loading branch information
rekovic committed Jun 25, 2020
1 parent 051a083 commit 071ddb6
Show file tree
Hide file tree
Showing 7 changed files with 376 additions and 381 deletions.
28 changes: 4 additions & 24 deletions L1Trigger/L1CaloTrigger/interface/ParametricCalibration.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define L1Trigger_L1CaloTrigger_ParametricCalibration_h
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include <vector>
#include <cmath>
#include <iostream>
Expand All @@ -10,31 +12,9 @@ namespace l1tp2 {
class ParametricCalibration {
public:
ParametricCalibration() {}
ParametricCalibration(const edm::ParameterSet &cpset) {
std::vector<double> etaBins = cpset.getParameter<std::vector<double>>("etaBins");
std::vector<double> ptBins = cpset.getParameter<std::vector<double>>("ptBins");
std::vector<double> scale = cpset.getParameter<std::vector<double>>("scale");
etas.insert(etas.end(), etaBins.begin(), etaBins.end());
pts.insert(pts.end(), ptBins.begin(), ptBins.end());
scales.insert(scales.end(), scale.begin(), scale.end());
if (cpset.existsAs<std::vector<double>>("ptMin")) {
std::vector<double> ptMin = cpset.getParameter<std::vector<double>>("ptMin");
ptMins.insert(ptMins.end(), ptMin.begin(), ptMin.end());
} else {
float ptMin = cpset.existsAs<double>("ptMin") ? cpset.getParameter<double>("ptMin") : 0;
ptMins = std::vector<float>(etaBins.size(), ptMin);
}
if (cpset.existsAs<std::vector<double>>("ptMax")) {
std::vector<double> ptMax = cpset.getParameter<std::vector<double>>("ptMax");
ptMaxs.insert(ptMaxs.end(), ptMax.begin(), ptMax.end());
} else {
ptMaxs = std::vector<float>(etaBins.size(), 1e6);
}
ParametricCalibration(const edm::ParameterSet& cpset);
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

if (pts.size() * etas.size() != scales.size())
throw cms::Exception("Configuration",
"Bad number of calibration scales, pts.size() * etas.size() != scales.size()");
}
float operator()(const float pt, const float abseta) const {
int ptBin = -1;
for (unsigned int i = 0, n = pts.size(); i < n; ++i) {
Expand Down
Loading

0 comments on commit 071ddb6

Please sign in to comment.