1 #ifndef L1_TRACK_TRIGGER_TRACK_WORD_H
2 #define L1_TRACK_TRIGGER_TRACK_WORD_H
32 const unsigned int,
const double,
const double,
const unsigned int,
const double,
const unsigned int);
88 static constexpr
double minPhi0 = -0.7853981696;
90 static constexpr
double minZ0 = -20.46912512;
91 static constexpr
double minD0 = -16.;
95 static constexpr
double stepTanL = (1. / (1 << 12));
97 static constexpr
double stepD0 = (1. / (1 << 8));
100 static constexpr std::array<double, 1 << TrackBitWidths::kChi2RPhiSize>
chi2RPhiBins = {
101 {0.0, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 5.0, 6.0, 10.0, 15.0, 20.0, 35.0, 60.0, 200.0}};
102 static constexpr std::array<double, 1 << TrackBitWidths::kChi2RZSize>
chi2RZBins = {
103 {0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 8.0, 10.0, 20.0, 50.0}};
104 static constexpr std::array<double, 1 << TrackBitWidths::kBendChi2Size>
bendChi2Bins = {
105 {0.0, 0.75, 1.0, 1.5, 2.25, 3.5, 5.0, 20.0}};
112 typedef ap_uint<TrackBitWidths::kValidSize>
valid_t;
115 typedef ap_uint<TrackBitWidths::kRinvSize>
rinv_t;
116 typedef ap_uint<TrackBitWidths::kPhiSize>
phi_t;
117 typedef ap_uint<TrackBitWidths::kTanlSize>
tanl_t;
118 typedef ap_uint<TrackBitWidths::kZ0Size>
z0_t;
119 typedef ap_uint<TrackBitWidths::kD0Size>
d0_t;
123 typedef ap_uint<TrackBitWidths::kChi2RZSize>
chi2rz_t;
125 typedef ap_uint<TrackBitWidths::kHitPatternSize>
hit_t;
131 typedef ap_uint<TrackBitWidths::kTrackWordSize>
tkword_t;
143 unsigned int hitPattern,
144 unsigned int mvaQuality,
145 unsigned int mvaOther,
146 unsigned int sector);
153 unsigned int chi2RPhi,
155 unsigned int bendChi2,
156 unsigned int hitPattern,
157 unsigned int mvaQuality,
158 unsigned int mvaOther);
179 return getTrackWord()(TrackBitLocations::kChi2RPhiMSB, TrackBitLocations::kChi2RPhiLSB);
182 return getTrackWord()(TrackBitLocations::kChi2RZMSB, TrackBitLocations::kChi2RZLSB);
185 return getTrackWord()(TrackBitLocations::kBendChi2MSB, TrackBitLocations::kBendChi2LSB);
188 return getTrackWord()(TrackBitLocations::kHitPatternMSB, TrackBitLocations::kHitPatternLSB);
191 return getTrackWord()(TrackBitLocations::kMVAQualityMSB, TrackBitLocations::kMVAQualityLSB);
194 return getTrackWord()(TrackBitLocations::kMVAOtherMSB, TrackBitLocations::kMVAOtherLSB);
237 unsigned int hitPattern,
238 unsigned int mvaQuality,
239 unsigned int mvaOther,
240 unsigned int sector);
248 unsigned int chi2RPhi,
250 unsigned int bendChi2,
251 unsigned int hitPattern,
252 unsigned int mvaQuality,
253 unsigned int mvaOther);
256 ap_uint<TrackBitWidths::kRinvSize> rInv,
257 ap_uint<TrackBitWidths::kPhiSize> phi0,
258 ap_uint<TrackBitWidths::kTanlSize> tanl,
259 ap_uint<TrackBitWidths::kZ0Size>
z0,
260 ap_uint<TrackBitWidths::kD0Size>
d0,
261 ap_uint<TrackBitWidths::kChi2RPhiSize> chi2RPhi,
262 ap_uint<TrackBitWidths::kChi2RZSize> chi2RZ,
263 ap_uint<TrackBitWidths::kBendChi2Size> bendChi2,
264 ap_uint<TrackBitWidths::kHitPatternSize> hitPattern,
265 ap_uint<TrackBitWidths::kMVAQualitySize> mvaQuality,
266 ap_uint<TrackBitWidths::kMVAOtherSize> mvaOther);
274 float localPhi(
float globalPhi,
unsigned int sector)
const {
282 int digitizedValue = std::floor(
value /
lsb);
285 int digitizedMaximum = (1 << (nBits - 1)) - 1;
286 int digitizedMinimum = -1. * (digitizedMaximum + 1);
289 digitizedValue = std::clamp(digitizedValue, digitizedMinimum, digitizedMaximum);
292 unsigned int twosValue = digitizedValue;
293 if (digitizedValue < 0) {
294 twosValue += (1 << nBits);
300 template <
typename T>
303 return (
up -
bins.begin() - 1);
310 assert((twosValue >> nBits) == 0);
313 int digitizedValue = twosValue;
314 if (twosValue & (1 << (nBits - 1))) {
315 digitizedValue -= (1 << nBits);
319 return (
double(digitizedValue) + 0.5) *
lsb;