File indexing completed on 2024-09-12 04:16:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef tmEventSetup_L1TUtmScale_hh
0011 #define tmEventSetup_L1TUtmScale_hh
0012
0013 #include "CondFormats/L1TObjects/interface/L1TUtmBin.h"
0014 #include "CondFormats/Serialization/interface/Serializable.h"
0015
0016 #include "tmEventSetup/esScale.hh"
0017
0018 #include <map>
0019 #include <string>
0020 #include <vector>
0021
0022
0023
0024
0025 class L1TUtmScale {
0026 public:
0027 L1TUtmScale() : name_(), object_(), type_(), minimum_(), maximum_(), step_(), n_bits_(), bins_(), version(0) {}
0028
0029 L1TUtmScale(std::string name,
0030 int object,
0031 int type,
0032 double minimum,
0033 double maximum,
0034 double step,
0035 unsigned int n_bits,
0036 std::vector<L1TUtmBin> bins,
0037 unsigned int vers)
0038 : name_(name),
0039 object_(object),
0040 type_(type),
0041 minimum_(minimum),
0042 maximum_(maximum),
0043 step_(step),
0044 n_bits_(n_bits),
0045 bins_(bins),
0046 version(vers) {}
0047
0048 L1TUtmScale(const tmeventsetup::esScale& esSc)
0049 : name_(esSc.getName()),
0050 object_(esSc.getObjectType()),
0051 type_(esSc.getScaleType()),
0052 minimum_(esSc.getMinimum()),
0053 maximum_(esSc.getMaximum()),
0054 step_(esSc.getStep()),
0055 n_bits_(esSc.getNbits()),
0056 version(0) {
0057 bins_.reserve(esSc.getBins().size());
0058 for (auto it = esSc.getBins().begin(); it != esSc.getBins().end(); ++it)
0059 bins_.emplace_back(L1TUtmBin(*it));
0060 };
0061
0062 virtual ~L1TUtmScale() = default;
0063
0064 operator tmeventsetup::esScale() const {
0065 std::vector<tmeventsetup::esBin> bins;
0066 bins.reserve(getBins().size());
0067 for (const auto& it : getBins())
0068 bins.emplace_back(tmeventsetup::esBin(it.hw_index, it.minimum, it.maximum));
0069 return tmeventsetup::esScale(
0070 getName(), getObjectType(), getScaleType(), getMinimum(), getMaximum(), getStep(), getNbits(), bins);
0071 }
0072
0073
0074 const std::string& getName() const { return name_; };
0075
0076
0077 int getObjectType() const { return object_; };
0078
0079
0080 int getScaleType() const { return type_; };
0081
0082
0083 double getMinimum() const { return minimum_; };
0084
0085
0086 double getMaximum() const { return maximum_; };
0087
0088
0089 double getStep() const { return step_; };
0090
0091
0092 unsigned int getNbits() const { return n_bits_; };
0093
0094
0095 const std::vector<L1TUtmBin>& getBins() const { return bins_; };
0096
0097 protected:
0098 std::string name_;
0099 int object_;
0100 int type_;
0101 double minimum_;
0102 double maximum_;
0103 double step_;
0104 unsigned int n_bits_;
0105 std::vector<L1TUtmBin> bins_;
0106 unsigned int version;
0107 COND_SERIALIZABLE;
0108 };
0109
0110 #endif