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,
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);
238 unsigned int hitPattern,
239 unsigned int mvaQuality,
240 unsigned int mvaOther,
249 unsigned int chi2RPhi,
251 unsigned int bendChi2,
252 unsigned int hitPattern,
253 unsigned int mvaQuality,
254 unsigned int mvaOther);
257 ap_uint<TrackBitWidths::kRinvSize> rInv,
258 ap_uint<TrackBitWidths::kPhiSize> phi0,
259 ap_uint<TrackBitWidths::kTanlSize> tanl,
260 ap_uint<TrackBitWidths::kZ0Size>
z0,
261 ap_uint<TrackBitWidths::kD0Size>
d0,
262 ap_uint<TrackBitWidths::kChi2RPhiSize> chi2RPhi,
263 ap_uint<TrackBitWidths::kChi2RZSize> chi2RZ,
264 ap_uint<TrackBitWidths::kBendChi2Size> bendChi2,
265 ap_uint<TrackBitWidths::kHitPatternSize> hitPattern,
266 ap_uint<TrackBitWidths::kMVAQualitySize> mvaQuality,
267 ap_uint<TrackBitWidths::kMVAOtherSize> mvaOther);
283 unsigned int count = 0;
293 int digitizedValue = std::floor(
value /
lsb);
296 int digitizedMaximum = (1 << (nBits - 1)) - 1;
297 int digitizedMinimum = -1. * (digitizedMaximum + 1);
300 digitizedValue = std::clamp(digitizedValue, digitizedMinimum, digitizedMaximum);
303 unsigned int twosValue = digitizedValue;
304 if (digitizedValue < 0) {
305 twosValue += (1 << nBits);
311 template <
typename T>
314 return (
up -
bins.begin() - 1);
321 assert((twosValue >> nBits) == 0);
324 int digitizedValue = twosValue;
325 if (twosValue & (1 << (nBits - 1))) {
326 digitizedValue -= (1 << nBits);
330 return (
double(digitizedValue) +
offset) *
lsb;
constexpr double deltaPhi(double phi1, double phi2)
unsigned int getMVAQuality() const
ap_uint< TrackBitWidths::kTrackWordSize > tkword_t
static constexpr std::array< double, 1<< TrackBitWidths::kChi2RPhiSize > chi2RPhiBins
ap_uint< TrackBitWidths::kMVAQualitySize > qualityMVA_t
chi2rphi_t getChi2RPhiWord() const
unsigned int countSetBits(unsigned int n) const
otherMVA_t getMVAOtherWord() const
unsigned int getChi2RZBits() const
static constexpr double sectorWidth
static constexpr double minZ0
unsigned int getMVAQualityBits() const
unsigned int getChi2RPhiBits() const
static constexpr double minD0
valid_t getValidWord() const
static constexpr double stepD0
void infoTestDigitizationScheme(const unsigned int, const double, const double, const unsigned int, const double, const unsigned int)
static constexpr std::array< double, 1<< TrackBitWidths::kBendChi2Size > bendChi2Bins
unsigned int getHitPatternBits() const
static constexpr double minTanl
static constexpr double minRinv
void testDigitizationScheme() const
double getChi2RPhi() const
unsigned int getValidBits() const
unsigned int getMVAOther() const
unsigned int getMVAOtherBits() const
ap_uint< TrackBitWidths::kZ0Size > z0_t
void setTrackWord(unsigned int valid, const GlobalVector &momentum, const GlobalPoint &POCA, double rInv, double chi2RPhi, double chi2RZ, double bendChi2, unsigned int hitPattern, unsigned int mvaQuality, unsigned int mvaOther, unsigned int sector)
double undigitizeSignedValue(unsigned int twosValue, unsigned int nBits, double lsb, double offset=0.5) const
static constexpr double stepRinv
const unsigned int kValidSize
ap_uint< TrackBitWidths::kMVAOtherSize > otherMVA_t
TTTrack_TrackWord(const TTTrack_TrackWord &word)
ap_uint< TrackBitWidths::kValidSize > valid_t
ap_uint< TrackBitWidths::kRinvSize > rinv_t
Abs< T >::type abs(const T &t)
static constexpr double stepTanL
unsigned int getZ0Bits() const
std::bitset< TrackBitWidths::kTrackWordSize > tkword_bs_t
rinv_t getRinvWord() const
tkword_t getTrackWord() const
ap_uint< TrackBitWidths::kHitPatternSize > hit_t
ap_uint< TrackBitWidths::kChi2RZSize > chi2rz_t
constexpr unsigned int getBin(double value, const T &bins) const
static constexpr double minPhi0
bendChi2_t getBendChi2Word() const
qualityMVA_t getMVAQualityWord() const
static constexpr float d0
unsigned int getTanlBits() const
static constexpr double stepPhi0
unsigned int getHitPattern() const
unsigned int digitizeSignedValue(double value, unsigned int nBits, double lsb) const
static constexpr unsigned int nSectors
ap_uint< TrackBitWidths::kTanlSize > tanl_t
static constexpr std::array< double, 1<< TrackBitWidths::kChi2RZSize > chi2RZBins
unsigned int getBendChi2Bits() const
unsigned int getNStubs() const
chi2rz_t getChi2RZWord() const
unsigned int getPhiBits() const
hit_t getHitPatternWord() const
ap_uint< TrackBitWidths::kD0Size > d0_t
TTTrack_TrackWord & operator=(const TTTrack_TrackWord &word)
static constexpr double stepZ0
bool singleDigitizationSchemeTest(const double floatingPointValue, const unsigned int nBits, const double lsb) const
ap_uint< TrackBitWidths::kChi2RPhiSize > chi2rphi_t
tanl_t getTanlWord() const
double getBendChi2() const
unsigned int getRinvBits() const
ap_uint< TrackBitWidths::kBendChi2Size > bendChi2_t
float localPhi(float globalPhi, unsigned int sector) const
ap_uint< TrackBitWidths::kPhiSize > phi_t
unsigned int getD0Bits() const