CMS 3D CMS Logo

L1GTSingleInOutLUT.h
Go to the documentation of this file.
1 #ifndef L1Trigger_Phase2L1GT_L1GTSingleInOutLUT_h
2 #define L1Trigger_Phase2L1GT_L1GTSingleInOutLUT_h
3 
6 
7 #include <vector>
8 #include <cinttypes>
9 #include <cmath>
10 
11 namespace l1t {
12 
14  public:
16  : data_(lutConfig.getParameter<std::vector<int>>("lut")),
17  unused_lsbs_(lutConfig.getParameter<uint32_t>("unused_lsbs")),
18  output_scale_(lutConfig.getParameter<double>("output_scale_factor")),
19  // I guess ceil is required due to small differences in C++ and python's cos/cosh implementation.
20  hwMax_error_(std::ceil(lutConfig.getParameter<double>("max_error") * output_scale_)) {}
21 
22  int32_t operator[](uint32_t i) const { return data_[(i >> unused_lsbs_) % data_.size()]; }
23  double hwMax_error() const { return hwMax_error_; }
24  double output_scale() const { return output_scale_; }
25 
27  desc.add<std::vector<int32_t>>("lut");
28  desc.add<double>("output_scale_factor");
29  desc.add<uint32_t>("unused_lsbs");
30  desc.add<double>("max_error");
31  }
32 
33  private:
34  const std::vector<int32_t> data_;
35  const uint32_t unused_lsbs_;
36  const double output_scale_;
37  const double hwMax_error_; // Sanity check
38  };
39 } // namespace l1t
40 
41 #endif // L1Trigger_Phase2L1GT_L1GTSingleInOutLUT_h
constexpr int32_t ceil(float num)
delete x;
Definition: CaloConfig.h:22
const std::vector< int32_t > data_
int32_t operator[](uint32_t i) const
static void fillLUTDescriptions(edm::ParameterSetDescription &desc)
L1GTSingleInOutLUT(const edm::ParameterSet &lutConfig)