Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:16

0001 #ifndef L1TObjects_L1CaloEtScale_h
0002 #define L1TObjects_L1CaloEtScale_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     L1TObjects
0006 // Class  :     L1CaloEtScale
0007 //
0008 /**\class L1CaloEtScale L1CaloEtScale.h CondFormats/L1TObjects/interface/L1CaloEtScale.h
0009 
0010  Description: Class to handle non-linear scales in L1 calo trigger hardware, including, e/gamma rank, jet rank, Htmiss
0011 
0012 
0013  Usage:
0014     <usage>
0015 
0016 */
0017 //
0018 // Author:      Jim Brooke
0019 // Created:     Wed Sep 27 17:18:27 CEST 2006
0020 // $Id:
0021 //
0022 
0023 #include "CondFormats/Serialization/interface/Serializable.h"
0024 
0025 #include <vector>
0026 #include <ostream>
0027 #include <cstdint>
0028 
0029 class L1CaloEtScale {
0030 public:
0031   /// default constructor, for testing (out = in)
0032   L1CaloEtScale();
0033 
0034   /// ctor that provides backwards compatibility with fixed scale max values
0035   /// OK to use this with e/gamma and jet rank scales
0036   L1CaloEtScale(const double linearLsbInGeV, const std::vector<double>& thresholdsInGeV);
0037 
0038   /// general case ctor that sets scale max values
0039   L1CaloEtScale(const unsigned linScaleMax,
0040                 const unsigned rankScaleMax,
0041                 const double linearLsbInGeV,
0042                 const std::vector<double>& thresholdsInGeV);
0043 
0044   // destructor
0045   ~L1CaloEtScale();
0046 
0047   // get input scale size
0048   unsigned linScaleMax() const { return m_linScaleMax; }
0049 
0050   // get output scale size
0051   unsigned rankScaleMax() const { return m_rankScaleMax; }
0052 
0053   /// get LSB of linear input scale
0054   double linearLsb() const { return m_linearLsb; }
0055 
0056   /// convert from linear Et scale to rank scale
0057   uint16_t rank(const uint16_t linear) const;
0058 
0059   /// convert from physical Et in GeV to rank scale
0060   uint16_t rank(const double EtInGeV) const;
0061 
0062   /// convert from rank to physically meaningful quantity
0063   double et(const uint16_t rank) const;
0064 
0065   /// get thresholds
0066   const std::vector<double>& getThresholds() const { return m_thresholds; }
0067 
0068   void print(std::ostream& s) const;
0069 
0070 private:
0071   /// linear scale maximum
0072   uint16_t m_linScaleMax;
0073 
0074   /// rank scale maximum
0075   uint16_t m_rankScaleMax;
0076 
0077   /// LSB of linear scale in GeV
0078   double m_linearLsb;
0079 
0080   /// thresholds associated with rank scale in GeV
0081   std::vector<double> m_thresholds;
0082 
0083   COND_SERIALIZABLE;
0084 };
0085 
0086 std::ostream& operator<<(std::ostream& os, const L1CaloEtScale onj);
0087 
0088 #endif