Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:23

0001 #ifndef L1Trigger_Phase2L1GT_L1GTScales_h
0002 #define L1Trigger_Phase2L1GT_L1GTScales_h
0003 
0004 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 
0007 #include <cmath>
0008 
0009 namespace l1t {
0010   class L1GTScales {
0011     static constexpr int RELATIVE_ISOLATION_RESOLUTION = 10;  // Resolution = 1/2^RELATIVE_ISOLATION_RESOLUTION
0012 
0013   public:
0014     L1GTScales(double pT_lsb,
0015                double phi_lsb,
0016                double eta_lsb,
0017                double z0_lsb,
0018                //double dD_lsb,
0019                double isolation_lsb,
0020                double beta_lsb,
0021                double mass_lsb,
0022                double seed_pT_lsb,
0023                double seed_dZ_lsb,
0024                double sca_sum_lsb,
0025                double sum_pT_pv_lsb,
0026                int pos_chg,
0027                int neg_chg);
0028 
0029     L1GTScales(const edm::ParameterSet &);
0030 
0031     static void fillPSetDescription(edm::ParameterSetDescription &);
0032 
0033     int to_hw_pT(double value) const { return std::round(value / pT_lsb_); };
0034     int to_hw_phi(double value) const { return std::round(value / phi_lsb_); };
0035     int to_hw_eta(double value) const { return std::round(value / eta_lsb_); };
0036     int to_hw_z0(double value) const { return std::round(value / z0_lsb_); };
0037     // int to_hw_d0(double value) const { return std::round(value / d0_lsb_); };
0038     int to_hw_isolation(double value) const {
0039       return std::round(pT_lsb_ * value * std::pow(2, isolation_shift_) / isolation_lsb_);
0040     }
0041     int to_hw_beta(double value) const { return std::round(value / beta_lsb_); };
0042     int to_hw_mass(double value) const { return std::round(value / mass_lsb_); };
0043     int to_hw_seed_pT(double value) const { return std::round(value / seed_pT_lsb_); };
0044     int to_hw_seed_z0(double value) const { return std::round(value / seed_z0_lsb_); };
0045     int to_hw_sca_sum(double value) const { return std::round(value / sca_sum_lsb_); };
0046     int to_hw_sum_pT_pv(double value) const { return std::round(value / sum_pT_pv_lsb_); };
0047 
0048     int to_hw_dRSquared(double value) const { return std::round(value * value / (eta_lsb_ * eta_lsb_)); }
0049 
0050     double to_hw_InvMassSqrDiv2(double value) const { return value * value / (2 * pT_lsb_ * pT_lsb_); }
0051     double to_hw_TransMassSqrDiv2(double value) const { return value * value / (2 * pT_lsb_ * pT_lsb_); }
0052 
0053     double to_hw_PtSquared(double value) const { return value * value / (pT_lsb_ * pT_lsb_); }
0054 
0055     double to_pT(int value) const { return value * pT_lsb_; };
0056     double to_phi(int value) const { return value * phi_lsb_; };
0057     double to_eta(int value) const { return value * eta_lsb_; };
0058     double to_z0(int value) const { return value * z0_lsb_; };
0059     double to_sca_sum(int value) const { return value * sca_sum_lsb_; };
0060     int to_chg(int value) const { return value == pos_chg_ ? +1 : value == neg_chg_ ? -1 : 0; }
0061 
0062     double pT_lsb() const { return pT_lsb_; }
0063     double phi_lsb() const { return phi_lsb_; }
0064     double eta_lsb() const { return eta_lsb_; }
0065     double z0_lsb() const { return z0_lsb_; }
0066     double isolation_lsb() const { return isolation_lsb_; }
0067     //const double dD_lsb_;
0068     double beta_lsb() const { return beta_lsb_; }
0069     double mass_lsb() const { return mass_lsb_; }
0070     double seed_pT_lsb() const { return seed_pT_lsb_; }
0071     double seed_z0_lsb() const { return seed_z0_lsb_; }
0072     double sca_sum_lsb() const { return sca_sum_lsb_; }
0073     double sum_pT_pv_lsb() const { return sum_pT_pv_lsb_; }
0074     int pos_chg() const { return pos_chg_; }
0075     int neg_chg() const { return neg_chg_; }
0076     int isolation_shift() const { return isolation_shift_; }
0077 
0078   private:
0079     const double pT_lsb_;
0080     const double phi_lsb_;
0081     const double eta_lsb_;
0082     const double z0_lsb_;
0083     //const double dD_lsb_;
0084     const double isolation_lsb_;
0085     const double isolation_shift_;
0086     const double beta_lsb_;
0087     const double mass_lsb_;
0088     const double seed_pT_lsb_;
0089     const double seed_z0_lsb_;
0090     const double sca_sum_lsb_;
0091     const double sum_pT_pv_lsb_;
0092     const int pos_chg_;
0093     const int neg_chg_;
0094   };
0095 }  // namespace l1t
0096 
0097 #endif  // L1Trigger_Phase2L1GT_L1GTScales_h