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 
6 
7 namespace l1ct {
8 
9  struct Tau {
10  typedef ap_uint<2> type_t;
11  typedef ap_uint<10> rawid_t;
12  typedef ap_uint<2> lepid_t;
13 
19  bool hwCharge;
21  rawid_t hwRawId; // will contain isolation or MVA output
25 
26  inline bool operator==(const Tau &other) const {
27  return hwPt == other.hwPt && hwEta == other.hwEta && hwPhi == other.hwPhi && hwSeedPt == other.hwSeedPt &&
28  hwSeedZ0 == other.hwSeedZ0 && hwCharge == other.hwCharge && hwType == other.hwType &&
29  hwIsoOrMVA == other.hwIsoOrMVA && hwIdVsMu == other.hwIdVsMu && hwIdVsEle == other.hwIdVsEle;
30  }
31 
32  inline bool operator>(const Tau &other) const { return hwPt > other.hwPt; }
33  inline bool operator<(const Tau &other) const { return hwPt < other.hwPt; }
34 
35  inline pt_t hwAbsIso() const {
36  pt10_t ret;
37  ret(9, 0) = hwRawId(9, 0);
38  return ret;
39  }
40 
41  inline void setAbsIso(pt10_t absIso) { hwRawId(9, 0) = absIso(9, 0); }
42 
43  inline void clear() {
44  hwPt = 0;
45  hwEta = 0;
46  hwPhi = 0;
47  hwSeedPt = 0;
48  hwSeedZ0 = 0;
49  hwCharge = 0;
50  hwType = 0;
51  hwIsoOrMVA = 0;
52  hwIdVsMu = 0;
53  hwIdVsEle = 0;
54  hwIsoOrMVA = 0;
55  }
56 
57  int intPt() const { return Scales::intPt(hwPt); }
58  int intEta() const { return hwEta.to_int(); }
59  int intPhi() const { return hwPhi.to_int(); }
60  int intSeedPt() const { return Scales::intPt(hwSeedPt); }
61  float floatPt() const { return Scales::floatPt(hwPt); }
62  float floatEta() const { return Scales::floatEta(hwEta); }
63  float floatPhi() const { return Scales::floatPhi(hwPhi); }
64  float floatSeedPt() const { return Scales::floatPt(hwSeedPt); }
65  float floatSeedZ0() const { return Scales::floatZ0(hwSeedZ0); }
66  int intCharge() const { return hwCharge ? +1 : -1; }
67  int pdgId() const { return -15 * intCharge(); }
68  int intType() const { return hwType.to_int(); }
69 
70  float floatAbsIso() const { return Scales::floatPt(hwAbsIso()); }
71 
74  inline ap_uint<BITWIDTH> pack() const {
75  ap_uint<BITWIDTH> ret;
76  unsigned int start = 0;
88  return ret;
89  }
90  inline static Tau unpack(const ap_uint<BITWIDTH> &src) {
91  Tau ret;
92  unsigned int start = 0;
93  unpack_from_bits(src, start, ret.hwPt);
94  unpack_from_bits(src, start, ret.hwEta);
95  unpack_from_bits(src, start, ret.hwPhi);
96  unpack_from_bits(src, start, ret.hwSeedPt);
97  unpack_from_bits(src, start, ret.hwSeedZ0);
98  unpack_from_bits(src, start, ret.hwType);
99  unpack_from_bits(src, start, ret.hwRawId);
100  unpack_from_bits(src, start, ret.hwIdVsMu);
101  unpack_from_bits(src, start, ret.hwIdVsEle);
102  unpack_from_bits(src, start, ret.hwIsoOrMVA);
103  return ret;
104  }
105  };
106 
107  inline void clear(Tau &c) { c.clear(); }
108 
109 } // namespace l1ct
110 
111 #endif
Definition: start.py:1
float floatZ0(z0_t z0)
Definition: datatypes.h:163
float floatSeedZ0() const
Definition: taus.h:65
ret
prodAgent to be discontinued
int intSeedPt() const
Definition: taus.h:60
void setAbsIso(pt10_t absIso)
Definition: taus.h:41
int intCharge() const
Definition: taus.h:66
float floatPhi() const
Definition: taus.h:63
pt_t hwAbsIso() const
Definition: taus.h:35
type_t hwType
Definition: taus.h:20
ap_uint< 10 > rawid_t
Definition: taus.h:11
int intType() const
Definition: taus.h:68
float floatEta() const
Definition: taus.h:62
ap_int< 11 > glbphi_t
Definition: datatypes.h:30
ap_ufixed< 10, 8, AP_TRN, AP_SAT > pt10_t
Definition: datatypes.h:22
bool operator==(const Tau &other) const
Definition: taus.h:26
rawid_t hwIsoOrMVA
Definition: taus.h:24
float floatEta(eta_t eta)
Definition: datatypes.h:157
float floatAbsIso() const
Definition: taus.h:70
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:152
ap_uint< 2 > type_t
Definition: taus.h:10
ap_uint< BITWIDTH > pack() const
Definition: taus.h:74
float floatPt() const
Definition: taus.h:61
bool hwCharge
Definition: taus.h:19
glbphi_t hwPhi
Definition: taus.h:16
int intPt() const
Definition: taus.h:57
float floatSeedPt() const
Definition: taus.h:64
lepid_t hwIdVsEle
Definition: taus.h:23
ap_int< 10 > z0_t
Definition: datatypes.h:32
pt_t hwPt
Definition: taus.h:14
Definition: Tau.py:1
z0_t hwSeedZ0
Definition: taus.h:18
int intPt(pt_t pt)
Definition: datatypes.h:155
ap_ufixed< 14, 12, AP_TRN, AP_SAT > pt_t
Definition: datatypes.h:21
void clear()
Definition: taus.h:43
ap_uint< 2 > lepid_t
Definition: taus.h:12
pt_t hwSeedPt
Definition: taus.h:17
static const int BITWIDTH
Definition: taus.h:72
int intEta() const
Definition: taus.h:58
bool operator<(const Tau &other) const
Definition: taus.h:33
glbeta_t hwEta
Definition: taus.h:15
int intPhi() const
Definition: taus.h:59
int pdgId() const
Definition: taus.h:67
lepid_t hwIdVsMu
Definition: taus.h:22
bool operator>(const Tau &other) const
Definition: taus.h:32
float floatPhi(phi_t phi)
Definition: datatypes.h:158
void unpack_from_bits(const U &u, unsigned int &start, T &data)
Definition: bit_encoding.h:15
void clear(EGIsoObj &c)
Definition: egamma.h:82
rawid_t hwRawId
Definition: taus.h:21
ap_int< 12 > glbeta_t
Definition: datatypes.h:29
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:90
Definition: datatypes.h:19