CMS 3D CMS Logo

Typedefs | Functions | Variables
L1TauEmu Namespace Reference

Typedefs

typedef ap_uint< 5 > count_t
 
typedef ap_fixed< 18, 9 > detaphi2_t
 
typedef ap_fixed< 12, 6 > detaphi_t
 
typedef ap_int< 8 > dxy_t
 
typedef ap_fixed< 10, 4 > etaphi_t
 
typedef ap_uint< 5 > id_t
 
typedef ap_ufixed< 18, -2 > inv_pt_t
 
typedef ap_fixed< 22, 16 > pt_etaphi_t
 
typedef ap_ufixed< 16, 14 > pt_t
 
typedef ap_int< 10 > z0_t
 

Functions

constexpr int ceillog2 (int x)
 
detaphi_t deltaPhi (l1t::PFCandidate a, l1t::PFCandidate b)
 
constexpr int floorlog2 (int x)
 
template<class data_T , int N>
unsigned idx_from_real_val (data_T x)
 
bool inCone (l1t::PFCandidate seed, l1t::PFCandidate part, detaphi_t cone2)
 
template<class data_T , class table_T , int N>
void init_invert_table (table_T table_out[N])
 
template<class in_t , class table_t , int N>
table_t invert_with_shift (in_t in, bool debug=false)
 
constexpr int pow2 (int x)
 
template<class data_T , int N>
float real_val_from_idx (unsigned i)
 

Variables

static constexpr float etaphi_base = 100. / 64
 
static const etaphi_t FIDUCIAL_ETA_PHI = 5.11 * etaphi_base
 
static const detaphi_t HALFPI = 3.14159 / 2 * etaphi_base
 
static constexpr int N_table_inv_pt = 1024
 
static const detaphi_t PI = 3.14159 * etaphi_base
 
static const detaphi_t R2CONE = RCONE * RCONE
 
static const detaphi_t RCONE = 0.4 * 100 / 128
 
static const detaphi_t TWOPI = 3.14159 * 2. * etaphi_base
 

Typedef Documentation

◆ count_t

typedef ap_uint<5> L1TauEmu::count_t

Definition at line 35 of file TauNNIdHW.h.

◆ detaphi2_t

typedef ap_fixed<18, 9> L1TauEmu::detaphi2_t

Definition at line 31 of file TauNNIdHW.h.

◆ detaphi_t

typedef ap_fixed<12, 6> L1TauEmu::detaphi_t

Definition at line 30 of file TauNNIdHW.h.

◆ dxy_t

typedef ap_int<8> L1TauEmu::dxy_t

Definition at line 33 of file TauNNIdHW.h.

◆ etaphi_t

typedef ap_fixed<10, 4> L1TauEmu::etaphi_t

Definition at line 29 of file TauNNIdHW.h.

◆ id_t

typedef ap_uint<5> L1TauEmu::id_t

Definition at line 36 of file TauNNIdHW.h.

◆ inv_pt_t

typedef ap_ufixed<18, -2> L1TauEmu::inv_pt_t

Definition at line 39 of file TauNNIdHW.h.

◆ pt_etaphi_t

typedef ap_fixed<22, 16> L1TauEmu::pt_etaphi_t

Definition at line 32 of file TauNNIdHW.h.

◆ pt_t

typedef ap_ufixed<16, 14> L1TauEmu::pt_t

Definition at line 28 of file TauNNIdHW.h.

◆ z0_t

typedef ap_int<10> L1TauEmu::z0_t

Definition at line 34 of file TauNNIdHW.h.

Function Documentation

◆ ceillog2()

constexpr int L1TauEmu::ceillog2 ( int  x)

Definition at line 49 of file TauNNIdHW.h.

References x.

Referenced by idx_from_real_val(), and real_val_from_idx().

49 { return (x <= 2) ? 1 : 1 + ceillog2((x + 1) / 2); }
constexpr int ceillog2(int x)
Definition: TauNNIdHW.h:49
float x

◆ deltaPhi()

detaphi_t L1TauEmu::deltaPhi ( l1t::PFCandidate  a,
l1t::PFCandidate  b 
)
inline

Definition at line 107 of file TauNNIdHW.h.

References a, b, bphi, etaphi_base, l1ct::Scales::INTPHI_PI, and l1ct::Scales::INTPHI_TWOPI.

Referenced by inCone().

107  {
108  // scale the particle eta, phi to hardware units
109  etaphi_t aphi = etaphi_t(a.phi() * etaphi_base);
110  etaphi_t bphi = etaphi_t(b.phi() * etaphi_base);
111  detaphi_t dphi = detaphi_t(aphi) - detaphi_t(bphi);
112  // phi wrap
113  detaphi_t dphi0 =
115  detaphi_t dphi1 =
117  //dphi > PI ? detaphi_t(TWOPI - dphi) : detaphi_t(dphi);
118  //dphi < -PI ? detaphi_t(TWOPI + dphi) : detaphi_t(dphi);
119  detaphi_t dphiw = dphi > detaphi_t(0) ? dphi0 : dphi1;
120  return dphiw;
121  }
constexpr int INTPHI_PI
Definition: datatypes.h:141
static constexpr float etaphi_base
Definition: TauNNIdHW.h:27
ap_fixed< 12, 6 > detaphi_t
Definition: TauNNIdHW.h:30
const float bphi
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
constexpr int INTPHI_TWOPI
Definition: datatypes.h:142
ap_fixed< 10, 4 > etaphi_t
Definition: TauNNIdHW.h:14

◆ floorlog2()

constexpr int L1TauEmu::floorlog2 ( int  x)

Definition at line 50 of file TauNNIdHW.h.

References x.

50 { return (x < 2) ? 0 : 1 + floorlog2(x / 2); }
float x
constexpr int floorlog2(int x)
Definition: TauNNIdHW.h:50

◆ idx_from_real_val()

template<class data_T , int N>
unsigned L1TauEmu::idx_from_real_val ( data_T  x)
inline

Definition at line 66 of file TauNNIdHW.h.

References ceillog2(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), N, and x.

66  {
67  // Slice the top N bits to get an index into the table
68  static constexpr int NB = ceillog2(N); // number of address bits for table
69  // Slice the top-1 NB bits of the value
70  // the MSB of '1' is implicit, so only slice below that
71  ap_uint<NB> y = x(x.width - 2, x.width - NB - 1);
72  return (unsigned)y(NB - 1, 0);
73  }
constexpr int ceillog2(int x)
Definition: TauNNIdHW.h:49
#define N
Definition: blowfish.cc:9
float x

◆ inCone()

bool L1TauEmu::inCone ( l1t::PFCandidate  seed,
l1t::PFCandidate  part,
detaphi_t  cone2 
)
inline

Definition at line 123 of file TauNNIdHW.h.

References deltaPhi(), etaphi_base, runTheMatrix::ret, and fileCollector::seed.

Referenced by L1NNTauProducer::makeTau_HW(), and L1NNTauProducer::process_HW().

123  {
124  // scale the particle eta, phi to hardware units
125  etaphi_t seta = etaphi_t(seed.eta() * etaphi_base);
126  etaphi_t peta = etaphi_t(part.eta() * etaphi_base);
127  detaphi_t deta = detaphi_t(seta) - detaphi_t(peta);
128  detaphi_t dphi = deltaPhi(seed, part);
129  bool ret = (deta * deta + dphi * dphi) < cone2;
130  return ret;
131  }
detaphi_t deltaPhi(l1t::PFCandidate a, l1t::PFCandidate b)
Definition: TauNNIdHW.h:107
static constexpr float etaphi_base
Definition: TauNNIdHW.h:27
ret
prodAgent to be discontinued
ap_fixed< 12, 6 > detaphi_t
Definition: TauNNIdHW.h:30
part
Definition: HCALResponse.h:20
ap_fixed< 10, 4 > etaphi_t
Definition: TauNNIdHW.h:14

◆ init_invert_table()

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

Definition at line 76 of file TauNNIdHW.h.

References mps_fire::i, N, and x.

76  {
77  // The template data_T is the data type used to address the table
78  for (unsigned i = 0; i < N; i++) {
79  float x = real_val_from_idx<data_T, N>(i);
80  table_T inv_x = 1 / x;
81  table_out[i] = inv_x;
82  }
83  }
#define N
Definition: blowfish.cc:9
float x

◆ invert_with_shift()

template<class in_t , class table_t , int N>
table_t L1TauEmu::invert_with_shift ( in_t  in,
bool  debug = false 
)

Definition at line 86 of file TauNNIdHW.h.

References b, heavyIonCSV_trainingSettings::idx, recoMuon::in, N, and MillePedeFileConverter_cfg::out.

86  {
87  table_t inv_table[N];
88  init_invert_table<in_t, table_t, N>(inv_table);
89 
90  // find the first '1' in the denominator
91  int msb = 0;
92  for (int b = 0; b < in.width; b++) {
93  if (in[b])
94  msb = b;
95  }
96  // shift up the denominator such that the left-most bit (msb) is '1'
97  in_t in_shifted = in << (in.width - msb - 1);
98  // lookup the inverse of the shifted input
99  int idx = idx_from_real_val<in_t, N>(in_shifted);
100  table_t inv_in = inv_table[idx];
101  // shift the output back
102  table_t out = inv_in << (in.width - msb - 1);
103 
104  return out;
105  }
#define N
Definition: blowfish.cc:9
double b
Definition: hdecay.h:120

◆ pow2()

constexpr int L1TauEmu::pow2 ( int  x)

◆ real_val_from_idx()

template<class data_T , int N>
float L1TauEmu::real_val_from_idx ( unsigned  i)
inline

Definition at line 54 of file TauNNIdHW.h.

References ceillog2(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), mps_fire::i, N, and x.

54  {
55  // Treat the index as the top N bits
56  static constexpr int NB = ceillog2(N); // number of address bits for table
57  data_T x(0);
58  // The MSB of 1 is implicit in the table
59  x[x.width - 1] = 1;
60  // So we can use the next NB bits for real data
61  x(x.width - 2, x.width - NB - 1) = i;
62  return (float)x;
63  }
constexpr int ceillog2(int x)
Definition: TauNNIdHW.h:49
#define N
Definition: blowfish.cc:9
float x

Variable Documentation

◆ etaphi_base

constexpr float L1TauEmu::etaphi_base = 100. / 64
static

◆ FIDUCIAL_ETA_PHI

const etaphi_t L1TauEmu::FIDUCIAL_ETA_PHI = 5.11 * etaphi_base
static

Definition at line 47 of file TauNNIdHW.h.

◆ HALFPI

const detaphi_t L1TauEmu::HALFPI = 3.14159 / 2 * etaphi_base
static

Definition at line 43 of file TauNNIdHW.h.

◆ N_table_inv_pt

constexpr int L1TauEmu::N_table_inv_pt = 1024
static

Definition at line 40 of file TauNNIdHW.h.

◆ PI

const detaphi_t L1TauEmu::PI = 3.14159 * etaphi_base
static

Definition at line 42 of file TauNNIdHW.h.

◆ R2CONE

const detaphi_t L1TauEmu::R2CONE = RCONE * RCONE
static

Definition at line 45 of file TauNNIdHW.h.

◆ RCONE

const detaphi_t L1TauEmu::RCONE = 0.4 * 100 / 128
static

Definition at line 44 of file TauNNIdHW.h.

◆ TWOPI

const detaphi_t L1TauEmu::TWOPI = 3.14159 * 2. * etaphi_base
static

Definition at line 41 of file TauNNIdHW.h.