CMS 3D CMS Logo

L1TrackJetEmulationProducer.h
Go to the documentation of this file.
1 #ifndef L1Trigger_L1TTrackMatch_L1TrackJetEmulationProducer_HH
2 #define L1Trigger_L1TTrackMatch_L1TrackJetEmulationProducer_HH
3 #include <iostream>
4 #include <fstream>
5 #include <cmath>
6 #include <cstdlib>
7 #include <string>
8 #include <cstdlib>
10 
11 //For precision studies
12 const int PT_EXTRABITS = 0;
13 const int ETA_EXTRABITS = 0;
14 const int PHI_EXTRABITS = 0;
15 const int Z0_EXTRABITS = 0;
16 
17 typedef ap_ufixed<16 + PT_EXTRABITS, 11, AP_TRN, AP_SAT> pt_intern;
18 typedef ap_int<14 + ETA_EXTRABITS> glbeta_intern;
19 typedef ap_int<14 + PHI_EXTRABITS> glbphi_intern;
20 typedef ap_int<10 + Z0_EXTRABITS> z0_intern; // 40cm / 0.1
21 
22 namespace convert {
23  const int INTPHI_PI = 720;
24  const int INTPHI_TWOPI = 2 * INTPHI_PI;
25  static const float INTPT_LSB_POW = pow(2.0, -5 - PT_EXTRABITS);
26  static const float INTPT_LSB = INTPT_LSB_POW;
27  static const float ETA_LSB_POW = pow(2.0, -1 * ETA_EXTRABITS);
28  static const float ETA_LSB = M_PI / pow(2.0, 12) * ETA_LSB_POW;
29  static const float PHI_LSB_POW = pow(2.0, -1 * PHI_EXTRABITS);
30  static const float PHI_LSB = M_PI / pow(2.0, 12) * PHI_LSB_POW;
31  static const float Z0_LSB_POW = pow(2.0, -1 * Z0_EXTRABITS);
32  static const float Z0_LSB = 0.05 * Z0_LSB_POW;
33  inline float floatPt(pt_intern pt) { return pt.to_float(); }
34  inline int intPt(pt_intern pt) { return (ap_ufixed<18 + PT_EXTRABITS, 13 + PT_EXTRABITS>(pt)).to_int(); }
35  inline float floatEta(glbeta_intern eta) { return eta.to_float() * ETA_LSB; }
36  inline float floatPhi(glbphi_intern phi) { return phi.to_float() * PHI_LSB; }
37  inline float floatZ0(z0_intern z0) { return z0.to_float() * Z0_LSB; }
38 
39  inline pt_intern makePt(int pt) { return ap_ufixed<18 + PT_EXTRABITS, 13 + PT_EXTRABITS>(pt); }
40  inline pt_intern makePtFromFloat(float pt) { return pt_intern(INTPT_LSB_POW * round(pt / INTPT_LSB_POW)); }
41  inline z0_intern makeZ0(float z0) { return z0_intern(round(z0 / Z0_LSB)); }
42 
43  inline ap_uint<pt_intern::width> ptToInt(pt_intern pt) {
44  // note: this can be synthethized, e.g. when pT is used as intex in a LUT
45  ap_uint<pt_intern::width> ret = 0;
46  ret(pt_intern::width - 1, 0) = pt(pt_intern::width - 1, 0);
47  return ret;
48  }
49 
50  inline glbeta_intern makeGlbEta(float eta) { return round(eta / ETA_LSB); }
52  glbeta_intern ghweta = round(eta / ETA_LSB);
53  return (ghweta % 2) ? glbeta_intern(ghweta + 1) : ghweta;
54  }
55 
56  inline glbphi_intern makeGlbPhi(float phi) { return round(phi / PHI_LSB); }
57 
58 }; // namespace convert
59 
60 //Each individual box in the eta and phi dimension.
61 // Also used to store final cluster data for each zbin.
66  bool used;
67  glbphi_intern phi; //average phi value (halfway b/t min and max)
68  glbeta_intern eta; //average eta value
69 };
70 
71 //store important information for plots
73  int znum = 0; //Numbered from 0 to nzbins (16, 32, or 64) in order
74  int nclust = 0; //number of clusters in this bin
76  TrackJetEmulationEtaPhiBin *clusters = nullptr; //list of all the clusters in this bin
77  pt_intern ht = 0; //sum of all cluster pTs--only the zbin with the maximum ht is stored
78 };
79 #endif
static const float ETA_LSB_POW
pt_intern makePtFromFloat(float pt)
static const float INTPT_LSB
static const float Z0_LSB_POW
glbeta_intern makeGlbEta(float eta)
float floatPt(pt_intern pt)
const int PHI_EXTRABITS
ap_int< 14+PHI_EXTRABITS > glbphi_intern
ret
prodAgent to be discontinued
int intPt(pt_intern pt)
static const float ETA_LSB
z0_intern makeZ0(float z0)
static const float PHI_LSB_POW
ap_ufixed< 16+PT_EXTRABITS, 11, AP_TRN, AP_SAT > pt_intern
ap_int< 10+Z0_EXTRABITS > z0_intern
ap_int< 14+ETA_EXTRABITS > glbeta_intern
glbphi_intern makeGlbPhi(float phi)
static const float PHI_LSB
const int ETA_EXTRABITS
const int Z0_EXTRABITS
glbeta_intern makeGlbEtaRoundEven(float eta)
ap_uint< kXtSize > nx_t
Definition: TkJetWord.h:59
float floatEta(glbeta_intern eta)
#define M_PI
ap_uint< pt_intern::width > ptToInt(pt_intern pt)
float floatPhi(glbphi_intern phi)
pt_intern makePt(int pt)
static const float INTPT_LSB_POW
ap_uint< kNtSize > nt_t
Definition: TkJetWord.h:58
TrackJetEmulationEtaPhiBin * clusters
float floatZ0(z0_intern z0)
const int PT_EXTRABITS
static const float Z0_LSB
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29