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:
15  static constexpr uint32_t DETA_LUT_SPLIT = 1 << 13; // hw 2pi
16 
18  : data_(lutConfig.getParameter<std::vector<int>>("lut")),
19  unused_lsbs_(lutConfig.getParameter<uint32_t>("unused_lsbs")),
20  output_scale_(lutConfig.getParameter<double>("output_scale_factor")),
21  // I guess ceil is required due to small differences in C++ and python's cos/cosh implementation.
22  hwMax_error_(std::ceil(lutConfig.getParameter<double>("max_error") * output_scale_)) {}
23 
24  int32_t operator[](uint32_t i) const { return data_[(i >> unused_lsbs_) % data_.size()]; }
25  double hwMax_error() const { return hwMax_error_; }
26  double output_scale() const { return output_scale_; }
27 
29  desc.add<std::vector<int32_t>>("lut");
30  desc.add<double>("output_scale_factor");
31  desc.add<uint32_t>("unused_lsbs");
32  desc.add<double>("max_error");
33  }
34 
35  private:
36  const std::vector<int32_t> data_;
37  const uint32_t unused_lsbs_;
38  const double output_scale_;
39  const double hwMax_error_; // Sanity check
40  };
41 } // namespace l1t
42 
43 #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)
static constexpr uint32_t DETA_LUT_SPLIT
L1GTSingleInOutLUT(const edm::ParameterSet &lutConfig)