Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-12 04:16:16

0001 //
0002 // NOTE:  This file was automatically generated from UTM library via import_utm.pl
0003 // DIRECT EDITS MIGHT BE LOST.
0004 //
0005 /**
0006  * @author      Takashi Matsushita
0007  * Created:     9 Nov 2015
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  *  This class implements data structure for Scale
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   /** get scale name */
0074   const std::string& getName() const { return name_; };
0075 
0076   /** get target object type */
0077   int getObjectType() const { return object_; };
0078 
0079   /** get scale type */
0080   int getScaleType() const { return type_; };
0081 
0082   /** get minimum value of the scale */
0083   double getMinimum() const { return minimum_; };
0084 
0085   /** get maximum value of the scale */
0086   double getMaximum() const { return maximum_; };
0087 
0088   /** get step size of linear scale */
0089   double getStep() const { return step_; };
0090 
0091   /** get number of bits for the scale */
0092   unsigned int getNbits() const { return n_bits_; };
0093 
0094   /** get bins for the scale */
0095   const std::vector<L1TUtmBin>& getBins() const { return bins_; };
0096 
0097 protected:
0098   std::string name_;            /**< name of scale */
0099   int object_;                  /**< type of object */
0100   int type_;                    /**< type of scale */
0101   double minimum_;              /**< minimum value of scale */
0102   double maximum_;              /**< maximum value of scale */
0103   double step_;                 /**< step size of linear scale */
0104   unsigned int n_bits_;         /**< number of bits for scale */
0105   std::vector<L1TUtmBin> bins_; /**< array of L1TUtmBin */
0106   unsigned int version;
0107   COND_SERIALIZABLE;
0108 };
0109 
0110 #endif  // tmEventSetup_L1TUtmScale_hh