CMS 3D CMS Logo

sums.h
Go to the documentation of this file.
1 #ifndef DataFormats_L1TParticleFlow_sums_h
2 #define DataFormats_L1TParticleFlow_sums_h
3 
7 
8 namespace l1ct {
9 
10  struct Sum {
14 
15  inline bool operator==(const Sum &other) const {
16  return hwPt == other.hwPt && hwPhi == other.hwPhi && hwSumPt == other.hwSumPt;
17  }
18 
19  inline void clear() {
20  hwPt = 0;
21  hwPhi = 0;
22  hwSumPt = 0;
23  }
24 
25  int intPt() const { return Scales::intPt(hwPt); }
26  int intPhi() const { return hwPhi.to_int(); }
27  int intSumPt() const { return Scales::intPt(hwSumPt); }
28  float floatPt() const { return Scales::floatPt(hwPt); }
29  float floatPhi() const { return Scales::floatPhi(hwPhi); }
30  float floatSumPt() const { return Scales::floatPt(hwSumPt); }
31 
33  inline ap_uint<BITWIDTH> pack() const {
34  ap_uint<BITWIDTH> ret;
35  unsigned int start = 0;
39  return ret;
40  }
41  inline static Sum unpack(const ap_uint<BITWIDTH> &src) {
42  Sum ret;
43  unsigned int start = 0;
44  unpack_from_bits(src, start, ret.hwPt);
45  unpack_from_bits(src, start, ret.hwPhi);
46  unpack_from_bits(src, start, ret.hwSumPt);
47  return ret;
48  }
49 
50  l1gt::Sum toGT() const {
51  l1gt::Sum sum;
52  sum.valid = (hwPt != 0) || (hwSumPt != 0);
53  sum.vector_pt = CTtoGT_pt(hwPt);
56  return sum;
57  }
58  };
59 
60  inline void clear(Sum &c) { c.clear(); }
61 
62 } // namespace l1ct
63 
64 #endif
Definition: start.py:1
pt_t hwPt
Definition: sums.h:11
int intSumPt() const
Definition: sums.h:27
ret
prodAgent to be discontinued
glbphi_t hwPhi
Definition: sums.h:12
int intPt() const
Definition: sums.h:25
l1gt::Sum toGT() const
Definition: sums.h:50
static const int BITWIDTH
Definition: sums.h:32
ap_int< 11 > glbphi_t
Definition: datatypes.h:28
bool operator==(const Sum &other) const
Definition: sums.h:15
void pack_into_bits(U &u, unsigned int &start, const T &data)
Definition: bit_encoding.h:8
void clear()
Definition: sums.h:19
float floatPt(pt_t pt)
Definition: datatypes.h:161
float floatPt() const
Definition: sums.h:28
float floatPhi() const
Definition: sums.h:29
pt_t vector_pt
Definition: gt_datatypes.h:139
phi_t vector_phi
Definition: gt_datatypes.h:140
int intPt(pt_t pt)
Definition: datatypes.h:164
ap_ufixed< 14, 12, AP_TRN, AP_SAT > pt_t
Definition: datatypes.h:19
int intPhi() const
Definition: sums.h:26
l1gt::phi_t CTtoGT_phi(glbphi_t x)
Definition: gt_datatypes.h:366
Definition: sums.h:10
static Sum unpack(const ap_uint< BITWIDTH > &src)
Definition: sums.h:41
float floatPhi(phi_t phi)
Definition: datatypes.h:167
ap_uint< BITWIDTH > pack() const
Definition: sums.h:33
void unpack_from_bits(const U &u, unsigned int &start, T &data)
Definition: bit_encoding.h:15
l1gt::pt_t CTtoGT_pt(pt_t x)
Definition: gt_datatypes.h:355
void clear(EGIsoObj &c)
Definition: egamma.h:82
pt_t hwSumPt
Definition: sums.h:13
pt_t scalar_pt
Definition: gt_datatypes.h:141
float floatSumPt() const
Definition: sums.h:30
valid_t valid
Definition: gt_datatypes.h:138
Definition: datatypes.h:17