CMS 3D CMS Logo

taus.h
Go to the documentation of this file.
1 #ifndef DataFormats_L1TParticleFlow_taus_h
2 #define DataFormats_L1TParticleFlow_taus_h
3 
7 
8 namespace l1ct {
9 
10  struct Tau {
11  typedef ap_uint<2> type_t;
12  typedef ap_uint<10> rawid_t;
13  typedef ap_uint<2> lepid_t;
14 
20  bool hwCharge;
22  rawid_t hwRawId; // will contain isolation or MVA output
26 
27  inline bool operator==(const Tau &other) const {
28  return hwPt == other.hwPt && hwEta == other.hwEta && hwPhi == other.hwPhi && hwSeedPt == other.hwSeedPt &&
29  hwSeedZ0 == other.hwSeedZ0 && hwCharge == other.hwCharge && hwType == other.hwType &&
30  hwIsoOrMVA == other.hwIsoOrMVA && hwIdVsMu == other.hwIdVsMu && hwIdVsEle == other.hwIdVsEle;
31  }
32 
33  inline bool operator>(const Tau &other) const { return hwPt > other.hwPt; }
34  inline bool operator<(const Tau &other) const { return hwPt < other.hwPt; }
35 
36  inline pt_t hwAbsIso() const {
37  pt10_t ret;
38  ret(9, 0) = hwRawId(9, 0);
39  return ret;
40  }
41 
42  inline void setAbsIso(pt10_t absIso) { hwRawId(9, 0) = absIso(9, 0); }
43 
44  inline void clear() {
45  hwPt = 0;
46  hwEta = 0;
47  hwPhi = 0;
48  hwSeedPt = 0;
49  hwSeedZ0 = 0;
50  hwCharge = false;
51  hwType = 0;
52  hwIsoOrMVA = 0;
53  hwIdVsMu = 0;
54  hwIdVsEle = 0;
55  hwIsoOrMVA = 0;
56  }
57 
58  int intPt() const { return Scales::intPt(hwPt); }
59  int intEta() const { return hwEta.to_int(); }
60  int intPhi() const { return hwPhi.to_int(); }
61  int intSeedPt() const { return Scales::intPt(hwSeedPt); }
62  float floatPt() const { return Scales::floatPt(hwPt); }
63  float floatEta() const { return Scales::floatEta(hwEta); }
64  float floatPhi() const { return Scales::floatPhi(hwPhi); }
65  float floatSeedPt() const { return Scales::floatPt(hwSeedPt); }
66  float floatSeedZ0() const { return Scales::floatZ0(hwSeedZ0); }
67  int intCharge() const { return hwCharge ? +1 : -1; }
68  int pdgId() const { return -15 * intCharge(); }
69  int intType() const { return hwType.to_int(); }
70 
71  float floatAbsIso() const { return Scales::floatPt(hwAbsIso()); }
72 
75  inline ap_uint<BITWIDTH> pack() const {
76  ap_uint<BITWIDTH> ret;
77  unsigned int start = 0;
89  return ret;
90  }
91 
92  inline static Tau unpack(const ap_uint<BITWIDTH> &src) {
93  Tau ret;
94  unsigned int start = 0;
95  unpack_from_bits(src, start, ret.hwPt);
96  unpack_from_bits(src, start, ret.hwEta);
97  unpack_from_bits(src, start, ret.hwPhi);
98  unpack_from_bits(src, start, ret.hwSeedPt);
99  unpack_from_bits(src, start, ret.hwSeedZ0);
100  unpack_from_bits(src, start, ret.hwType);
101  unpack_from_bits(src, start, ret.hwRawId);
102  unpack_from_bits(src, start, ret.hwIdVsMu);
103  unpack_from_bits(src, start, ret.hwIdVsEle);
104  unpack_from_bits(src, start, ret.hwIsoOrMVA);
105  return ret;
106  }
107 
108  l1gt::Tau toGT() const {
109  l1gt::Tau t;
110  t.valid = hwPt != 0;
111 
112  t.v3.pt = CTtoGT_pt(hwPt);
113  t.v3.phi = CTtoGT_phi(hwPhi);
114  t.v3.eta = CTtoGT_eta(hwEta);
115 
116  t.seed_pt = hwSeedPt;
117  t.seed_z0(l1ct::z0_t::width - 1, 0) = hwSeedZ0(l1ct::z0_t::width - 1, 0);
118  t.charge = hwCharge;
119 
120  t.type = hwType;
121  t.isolation = hwRawId;
122  return t;
123  }
124  };
125 
126  inline void clear(Tau &c) { c.clear(); }
127 
128 } // namespace l1ct
129 
130 #endif
Definition: start.py:1
float floatZ0(z0_t z0)
Definition: datatypes.h:172
float floatSeedZ0() const
Definition: taus.h:66
ret
prodAgent to be discontinued
l1gt::eta_t CTtoGT_eta(glbeta_t x)
Definition: gt_datatypes.h:364
int intSeedPt() const
Definition: taus.h:61
void setAbsIso(pt10_t absIso)
Definition: taus.h:42
int intCharge() const
Definition: taus.h:67
float floatPhi() const
Definition: taus.h:64
pt_t hwAbsIso() const
Definition: taus.h:36
type_t hwType
Definition: taus.h:21
ap_uint< 10 > rawid_t
Definition: taus.h:12
int intType() const
Definition: taus.h:69
float floatEta() const
Definition: taus.h:63
ap_int< 11 > glbphi_t
Definition: datatypes.h:28
ap_ufixed< 10, 8, AP_TRN, AP_SAT > pt10_t
Definition: datatypes.h:20
bool operator==(const Tau &other) const
Definition: taus.h:27
rawid_t hwIsoOrMVA
Definition: taus.h:25
float floatEta(eta_t eta)
Definition: datatypes.h:166
float floatAbsIso() const
Definition: taus.h:71
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
ap_uint< 2 > type_t
Definition: taus.h:11
ap_uint< BITWIDTH > pack() const
Definition: taus.h:75
float floatPt() const
Definition: taus.h:62
bool hwCharge
Definition: taus.h:20
glbphi_t hwPhi
Definition: taus.h:17
int intPt() const
Definition: taus.h:58
float floatSeedPt() const
Definition: taus.h:65
lepid_t hwIdVsEle
Definition: taus.h:24
ap_int< 10 > z0_t
Definition: datatypes.h:30
pt_t hwPt
Definition: taus.h:15
Definition: Tau.py:1
z0_t hwSeedZ0
Definition: taus.h:19
int intPt(pt_t pt)
Definition: datatypes.h:164
ap_ufixed< 14, 12, AP_TRN, AP_SAT > pt_t
Definition: datatypes.h:19
void clear()
Definition: taus.h:44
ap_uint< 2 > lepid_t
Definition: taus.h:13
pt_t hwSeedPt
Definition: taus.h:18
l1gt::Tau toGT() const
Definition: taus.h:108
static const int BITWIDTH
Definition: taus.h:73
int intEta() const
Definition: taus.h:59
bool operator<(const Tau &other) const
Definition: taus.h:34
glbeta_t hwEta
Definition: taus.h:16
int intPhi() const
Definition: taus.h:60
l1gt::phi_t CTtoGT_phi(glbphi_t x)
Definition: gt_datatypes.h:369
int pdgId() const
Definition: taus.h:68
lepid_t hwIdVsMu
Definition: taus.h:23
bool operator>(const Tau &other) const
Definition: taus.h:33
float floatPhi(phi_t phi)
Definition: datatypes.h:167
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:358
void clear(EGIsoObj &c)
Definition: egamma.h:82
rawid_t hwRawId
Definition: taus.h:22
ap_int< 12 > glbeta_t
Definition: datatypes.h:27
void pack_bool_into_bits(U &u, unsigned int &start, bool data)
Definition: bit_encoding.h:22
static Tau unpack(const ap_uint< BITWIDTH > &src)
Definition: taus.h:92
Definition: datatypes.h:17