CMS 3D CMS Logo

jets.h
Go to the documentation of this file.
1 #ifndef DataFormats_L1TParticleFlow_jets_h
2 #define DataFormats_L1TParticleFlow_jets_h
3 
7 #include <array>
8 #include <cstdint>
9 
10 namespace l1ct {
11 
12  struct Jet {
16 
17  inline bool operator==(const Jet &other) const {
18  return hwPt == other.hwPt && hwEta == other.hwEta && hwPhi == other.hwPhi;
19  }
20 
21  inline bool operator>(const Jet &other) const { return hwPt > other.hwPt; }
22  inline bool operator<(const Jet &other) const { return hwPt < other.hwPt; }
23 
24  inline void clear() {
25  hwPt = 0;
26  hwEta = 0;
27  hwPhi = 0;
28  }
29 
30  int intPt() const { return Scales::intPt(hwPt); }
31  int intEta() const { return hwEta.to_int(); }
32  int intPhi() const { return hwPhi.to_int(); }
33  float floatPt() const { return Scales::floatPt(hwPt); }
34  float floatEta() const { return Scales::floatEta(hwEta); }
35  float floatPhi() const { return Scales::floatPhi(hwPhi); }
36 
38  inline ap_uint<BITWIDTH> pack_ap() const {
39  ap_uint<BITWIDTH> ret;
40  unsigned int start = 0;
44  return ret;
45  }
46 
47  inline std::array<uint64_t, 2> pack() const {
48  std::array<uint64_t, 2> packed = {{0, 0}};
49  ap_uint<BITWIDTH> bits = this->pack_ap();
50  packed[0] = bits;
51  //packed[1] = bits[slice]; // for when there are more than 64 bits in the word
52  return packed;
53  }
54 
55  inline static Jet unpack_ap(const ap_uint<BITWIDTH> &src) {
56  Jet ret;
57  ret.initFromBits(src);
58  return ret;
59  }
60 
61  inline void initFromBits(const ap_uint<BITWIDTH> &src) {
62  unsigned int start = 0;
66  }
67 
68  inline static Jet unpack(const std::array<uint64_t, 2> &src) {
69  // just one set while the word has fewer than 64 bits
70  ap_uint<BITWIDTH> bits = src[0];
71  return unpack_ap(bits);
72  }
73 
74  inline static Jet unpack(long long unsigned int &src) {
75  // unpack from single 64b int
76  ap_uint<BITWIDTH> bits = src;
77  return unpack_ap(bits);
78  }
79 
80  l1gt::Jet toGT() const {
81  l1gt::Jet j;
82  j.valid = hwPt != 0;
83  j.v3.pt = CTtoGT_pt(hwPt);
84  j.v3.phi = CTtoGT_phi(hwPhi);
85  j.v3.eta = CTtoGT_eta(hwEta);
86  j.z0 = 0;
87  return j;
88  }
89  };
90 
91  inline void clear(Jet &c) { c.clear(); }
92 
93 } // namespace l1ct
94 
95 #endif
Definition: start.py:1
float floatPhi() const
Definition: jets.h:35
static Jet unpack_ap(const ap_uint< BITWIDTH > &src)
Definition: jets.h:55
ap_uint< BITWIDTH > pack_ap() const
Definition: jets.h:38
ret
prodAgent to be discontinued
l1gt::eta_t CTtoGT_eta(glbeta_t x)
Definition: gt_datatypes.h:361
bool operator>(const Jet &other) const
Definition: jets.h:21
static Jet unpack(long long unsigned int &src)
Definition: jets.h:74
constexpr uint32_t bits
Definition: gpuClustering.h:25
int intPt() const
Definition: jets.h:30
glbeta_t hwEta
Definition: jets.h:14
ap_int< 11 > glbphi_t
Definition: datatypes.h:28
pt_t hwPt
Definition: jets.h:13
void clear()
Definition: jets.h:24
float floatEta(eta_t eta)
Definition: datatypes.h:166
Definition: Jet.py:1
void pack_into_bits(U &u, unsigned int &start, const T &data)
Definition: bit_encoding.h:8
float floatPt(pt_t pt)
Definition: datatypes.h:161
static Jet unpack(const std::array< uint64_t, 2 > &src)
Definition: jets.h:68
std::array< uint64_t, 2 > pack() const
Definition: jets.h:47
int intPhi() const
Definition: jets.h:32
l1gt::Jet toGT() const
Definition: jets.h:80
int intPt(pt_t pt)
Definition: datatypes.h:164
ap_ufixed< 14, 12, AP_TRN, AP_SAT > pt_t
Definition: datatypes.h:19
float floatPt() const
Definition: jets.h:33
bool operator<(const Jet &other) const
Definition: jets.h:22
static const int BITWIDTH
Definition: jets.h:37
l1gt::phi_t CTtoGT_phi(glbphi_t x)
Definition: gt_datatypes.h:366
void initFromBits(const ap_uint< BITWIDTH > &src)
Definition: jets.h:61
float floatEta() const
Definition: jets.h:34
float floatPhi(phi_t phi)
Definition: datatypes.h:167
glbphi_t hwPhi
Definition: jets.h:15
void unpack_from_bits(const U &u, unsigned int &start, T &data)
Definition: bit_encoding.h:15
bool operator==(const Jet &other) const
Definition: jets.h:17
l1gt::pt_t CTtoGT_pt(pt_t x)
Definition: gt_datatypes.h:355
void clear(EGIsoObj &c)
Definition: egamma.h:82
int intEta() const
Definition: jets.h:31
ap_int< 12 > glbeta_t
Definition: datatypes.h:27
Definition: datatypes.h:17