File indexing completed on 2024-07-03 04:18:04
0001 #ifndef L1Trigger_Phase2L1GT_L1GTSingleInOutLUT_h
0002 #define L1Trigger_Phase2L1GT_L1GTSingleInOutLUT_h
0003
0004 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006
0007 #include <vector>
0008 #include <cinttypes>
0009 #include <cmath>
0010
0011 namespace l1t {
0012
0013 class L1GTSingleInOutLUT {
0014 public:
0015 static constexpr uint32_t DETA_LUT_SPLIT = 1 << 13;
0016
0017 L1GTSingleInOutLUT(const edm::ParameterSet& lutConfig)
0018 : data_(lutConfig.getParameter<std::vector<int>>("lut")),
0019 unused_lsbs_(lutConfig.getParameter<uint32_t>("unused_lsbs")),
0020 output_scale_(lutConfig.getParameter<double>("output_scale_factor")),
0021
0022 hwMax_error_(std::ceil(lutConfig.getParameter<double>("max_error") * output_scale_)) {}
0023
0024 int32_t operator[](uint32_t i) const { return data_[(i >> unused_lsbs_) % data_.size()]; }
0025 double hwMax_error() const { return hwMax_error_; }
0026 double output_scale() const { return output_scale_; }
0027
0028 static void fillLUTDescriptions(edm::ParameterSetDescription& desc) {
0029 desc.add<std::vector<int32_t>>("lut");
0030 desc.add<double>("output_scale_factor");
0031 desc.add<uint32_t>("unused_lsbs");
0032 desc.add<double>("max_error");
0033 }
0034
0035 private:
0036 const std::vector<int32_t> data_;
0037 const uint32_t unused_lsbs_;
0038 const double output_scale_;
0039 const double hwMax_error_;
0040 };
0041 }
0042
0043 #endif