CMS 3D CMS Logo

Namespaces | Classes | Typedefs | Functions | Variables
P2L1HTMHTEmu Namespace Reference

Namespaces

 Scales
 

Classes

class  PtPxPy
 

Typedefs

typedef ap_fixed< 9, 2 > cossin_t
 
typedef l1ct::glbeta_t etaphi_t
 
typedef l1ct::pt_t pt_t
 
typedef ap_fixed< 16, 13 > pxy_t
 
typedef ap_fixed< 12, 3 > radians_t
 

Functions

template<class data_T , class table_T , int N>
void init_sinphi_table (table_T table_out[N])
 
PtPxPy mht_compute (l1ct::Jet jet)
 
etaphi_t phi_cordic (pxy_t y, pxy_t x)
 
template<class in_t , class table_t , int N>
table_t sine_with_conversion (etaphi_t hwPhi)
 

Variables

static constexpr int N_TABLE = 2048
 

Typedef Documentation

◆ cossin_t

typedef ap_fixed<9, 2> P2L1HTMHTEmu::cossin_t

Definition at line 24 of file L1PFHtEmulator.h.

◆ etaphi_t

Definition at line 21 of file L1PFHtEmulator.h.

◆ pt_t

Definition at line 20 of file L1PFHtEmulator.h.

◆ pxy_t

typedef ap_fixed<16, 13> P2L1HTMHTEmu::pxy_t

Definition at line 25 of file L1PFHtEmulator.h.

◆ radians_t

typedef ap_fixed<12, 3> P2L1HTMHTEmu::radians_t

Definition at line 23 of file L1PFHtEmulator.h.

Function Documentation

◆ init_sinphi_table()

template<class data_T , class table_T , int N>
void P2L1HTMHTEmu::init_sinphi_table ( table_T  table_out[N])

Definition at line 50 of file L1PFHtEmulator.h.

References mps_fire::i, M_PI, N, funct::sin(), and x.

50  {
51  for (int i = 0; i < N; i++) {
52  float x = i * (M_PI / 180.) / 2.;
53  table_T sin_x = std::sin(x);
54  table_out[i] = sin_x;
55  }
56  }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
#define M_PI
#define N
Definition: blowfish.cc:9
float x

◆ mht_compute()

PtPxPy P2L1HTMHTEmu::mht_compute ( l1ct::Jet  jet)
inline

Definition at line 75 of file L1PFHtEmulator.h.

References metsig::jet, N_TABLE, P2L1HTMHTEmu::PtPxPy::pt, P2L1HTMHTEmu::PtPxPy::px, P2L1HTMHTEmu::PtPxPy::py, and Validation_hcalonly_cfi::sign.

Referenced by htmht().

75  {
76  // Add an extra bit to px/py for the sign, and one additional bit to improve precision (pt_t is ap_ufixed<14, 12>)
77  PtPxPy v_pxpy;
78 
79  //Initialize table once
80  cossin_t sin_table[N_TABLE];
81  init_sinphi_table<etaphi_t, cossin_t, N_TABLE>(sin_table);
82 
83  cossin_t sinphi;
84  cossin_t cosphi;
85  bool sign = jet.hwPhi.sign();
86 
87  etaphi_t hwphi = jet.hwPhi;
88 
89  // Reduce precision of hwPhi
90  ap_int<10> phi;
91  phi.V = hwphi(11, 1);
92  phi = (phi > 0) ? phi : (ap_int<10>)-phi; //Only store values for positive phi, pick up sign later
93 
94  sinphi = sin_table[phi];
95 
96  sinphi = (sign > 0) ? (cossin_t)(-sign * sinphi) : sinphi; // Change sign bit if hwPt is negative, sin(-x)=-sin(x)
97  cosphi = sin_table[phi + 90 * 2]; //cos(x)=sin(x+90). Do nothing with sign, cos(-θ) = cos θ,
98 
99  v_pxpy.pt = jet.hwPt;
100  v_pxpy.py = jet.hwPt * sinphi;
101  v_pxpy.px = jet.hwPt * cosphi;
102 
103  return v_pxpy;
104  }
ap_fixed< 9, 2 > cossin_t
static constexpr int N_TABLE
ap_fixed< 10, 4 > etaphi_t
Definition: TauNNIdHW.h:14

◆ phi_cordic()

etaphi_t P2L1HTMHTEmu::phi_cordic ( pxy_t  y,
pxy_t  x 
)
inline

Definition at line 65 of file L1PFHtEmulator.h.

References nano_mu_digi_cff::float, l1ct::Scales::INTPHI_PI, M_PI, and x.

Referenced by htmht().

65  {
66 #ifdef CMSSW_GIT_HASH
67  ap_fixed<12, 3> phi = atan2(y.to_double(), x.to_double()); // hls_math.h not available yet in CMSSW
68 #else
69  ap_fixed<12, 3> phi = hls::atan2(y, x);
70 #endif
71  ap_fixed<16, 9> etaphiscale = (float)l1ct::Scales::INTPHI_PI / M_PI; // radians to hwPhi
72  return phi * etaphiscale;
73  }
constexpr int INTPHI_PI
Definition: datatypes.h:141
#define M_PI
float x

◆ sine_with_conversion()

template<class in_t , class table_t , int N>
table_t P2L1HTMHTEmu::sine_with_conversion ( etaphi_t  hwPhi)

Definition at line 58 of file L1PFHtEmulator.h.

References l1trig_cff::hwPhi, N, and MillePedeFileConverter_cfg::out.

58  {
59  table_t sin_table[N];
60  init_sinphi_table<in_t, table_t, N>(sin_table);
61  table_t out = sin_table[hwPhi];
62  return out;
63  }
#define N
Definition: blowfish.cc:9

Variable Documentation

◆ N_TABLE

constexpr int P2L1HTMHTEmu::N_TABLE = 2048
static