CMS 3D CMS Logo

TTTrack_TrackWord.h
Go to the documentation of this file.
1 //
3 // class to store the 96-bit track word produced by the L1 Track Trigger. Intended to be inherited by L1 TTTrack.
4 // packing scheme given below.
5 //
6 // author: Mike Hildreth
7 // date: April 9, 2019
8 //
10 
11 #ifndef L1_TRACK_TRIGGER_TRACK_WORD_H
12 #define L1_TRACK_TRIGGER_TRACK_WORD_H
13 
14 #include <iostream>
15 #include <string>
18 
20 public:
21  // Constructors:
22 
24  TTTrack_TrackWord(const GlobalVector& Momentum,
25  const GlobalPoint& POCA,
26  double Rinv,
27  double Chi2, // would be xy chisq if chi2Z is non-zero
28  double Chi2Z,
29  double BendChi2,
30  unsigned int HitPattern,
31  unsigned int iSpare);
32 
33  TTTrack_TrackWord(unsigned int Rinv,
34  unsigned int phi0,
35  unsigned int tanl,
36  unsigned int z0,
37  unsigned int d0,
38  unsigned int Chi2XY, // would be total chisq if chi2Z is zero
39  unsigned int Chi2Z,
40  unsigned int BendChi2,
41  unsigned int HitPattern,
42  unsigned int iSpare);
43 
44  void setTrackWord(const GlobalVector& Momentum,
45  const GlobalPoint& POCA,
46  double Rinv,
47  double Chi2XY, // would be total chisq if chi2Z is zero
48  double Chi2Z,
49  double BendChi2,
50  unsigned int HitPattern,
51  unsigned int iSpare);
52 
53  void setTrackWord(unsigned int Rinv,
54  unsigned int phi0,
55  unsigned int tanl,
56  unsigned int z0,
57  unsigned int d0,
58  unsigned int Chi2XY, // would be total chisq if chi2Z is zero
59  unsigned int Chi2Z,
60  unsigned int BendChi2,
61  unsigned int HitPattern,
62  unsigned int iSpare);
63 
64  // getters for unpacked and converted values.
65  // These functions return real numbers converted from the digitized quantities using the LSB defined for each.
66 
67  float get_iRinv();
68  float get_iphi();
69  float get_itanl();
70  float get_iz0();
71  float get_id0();
72  float get_ichi2XY();
73  float get_ichi2Z();
74  float get_iBendChi2();
75 
76  // separate functions for unpacking 96-bit track word
77 
78  float unpack_iRinv();
79  float unpack_iphi();
80  float unpack_itanl();
81  float unpack_iz0();
82  float unpack_id0();
83  float unpack_ichi2XY();
84  float unpack_ichi2Z();
85  float unpack_iBendChi2();
86  unsigned int unpack_ispare();
87  unsigned int unpack_hitPattern();
88 
89  // getters for packed bits.
90  // These functions return, literally, the packed bits in integer format for each quantity.
91  // Signed quantities have the sign enconded in the left-most bit.
92 
93  unsigned int get_hitPattern();
94  unsigned int get_ispare(); // will need a converter(s) when spare bits are defined
95 
96  unsigned int get_RinvBits();
97  unsigned int get_phiBits();
98  unsigned int get_tanlBits();
99  unsigned int get_z0Bits();
100  unsigned int get_d0Bits();
101  unsigned int get_chi2XYBits();
102  unsigned int get_chi2ZBits();
103  unsigned int get_BendChi2Bits();
104 
105  // copy constructor
106 
108  initialize();
109 
110  iRinv = word.iRinv;
111  iphi = word.iphi;
112  itanl = word.itanl;
113  iz0 = word.iz0;
114  id0 = word.id0;
115  ichi2XY = word.ichi2XY;
116  ichi2Z = word.ichi2Z;
117  iBendChi2 = word.iBendChi2;
118  ispare = word.ispare;
119  iHitPattern = word.iHitPattern;
120 
121  // three 32-bit packed words
122  TrackWord1 = word.TrackWord1;
123  TrackWord2 = word.TrackWord2;
124  TrackWord3 = word.TrackWord3;
125  }
126 
128  initialize();
129  iRinv = word.iRinv;
130  iphi = word.iphi;
131  itanl = word.itanl;
132  iz0 = word.iz0;
133  id0 = word.id0;
134  ichi2XY = word.ichi2XY;
135  ichi2Z = word.ichi2Z;
136  iBendChi2 = word.iBendChi2;
137  ispare = word.ispare;
138  iHitPattern = word.iHitPattern;
139 
140  // three 32-bit packed words
141  TrackWord1 = word.TrackWord1;
142  TrackWord2 = word.TrackWord2;
143  TrackWord3 = word.TrackWord3;
144 
145  return *this;
146  }
147 
148 private:
149  void initialize();
150 
151  unsigned int digitize_Signed(float var, unsigned int maxBit, unsigned int minBit, float lsb);
152 
153  float unpack_Signed(unsigned int bits, unsigned int nBits, float lsb);
154 
155  // individual data members (not packed into 96 bits)
156  unsigned int iRinv;
157  unsigned int iphi;
158  unsigned int itanl;
159  unsigned int iz0;
160  unsigned int id0;
161  unsigned int ichi2XY;
162  unsigned int ichi2Z;
163  unsigned int iBendChi2;
164  unsigned int ispare;
165  unsigned int iHitPattern;
166 
167  // three 32-bit packed words
168 
169  unsigned int TrackWord1;
170  unsigned int TrackWord2;
171  unsigned int TrackWord3;
172 
173  // values of least significant bit for digitization
174 
175  float valLSBCurv;
176  float valLSBPhi;
177  float valLSBTanl;
178  float valLSBZ0;
179  float valLSBD0;
180 
181  float chi2Bins[16];
182  float chi2ZBins[16];
183  float Bchi2Bins[8];
184 
185  unsigned int Nchi2; // both chi2 have same packing
186  unsigned int NBchi2;
187 
188  /* bits for packing:
189  signed quantities (one bit for sign):
190 
191  q/R = 14+1
192  phi = 11+1 (relative to sector center)
193  tanl = 15+1
194  z0 = 11+1
195  d0 = 12+1
196 
197  unsigned:
198  chi2 = 4 (or chisqXY)
199  BendChi2 = 3
200  hitmask = 7
201  chi2Z = 4
202  Spare = 10
203 
204  */
205 
206  // signed quantities: total bits are these values plus one
207  const unsigned int NCurvBits = 14;
208  const unsigned int NPhiBits = 11;
209  const unsigned int NTanlBits = 15;
210  const unsigned int NZ0Bits = 11;
211  const unsigned int ND0Bits = 12;
212 
213  // unsigned:
214  const unsigned int NChi2Bits = 4;
215  const unsigned int NBChi2Bits = 3;
216  const unsigned int NHitsBits = 7;
217  const unsigned int NSpareBits = 14;
218 
219  // establish binning
220  const float maxCurv = 0.00855; // 2 GeV pT Rinv is in cm
221  const float maxPhi = 1.026; // relative to the center of the sector
222  const float maxTanl = 8.0;
223  const float maxZ0 = 30.;
224  const float maxD0 = 15.4;
225 
226  // List of offsets and masks. In principle, all of these could be derived from first
227  // principles given the number of bits. At some future time, we'll do this.
228 
229  const unsigned int maskRinv = 0xFFFE0000;
230  const unsigned int maskPhi = 0xFFF00000;
231  const unsigned int maskTanL = 0xFFFF0000;
232  const unsigned int maskD0 = 0x000FFF80;
233  const unsigned int maskZ0 = 0x0000FFF0;
234  const unsigned int maskChi2XY = 0x0000000F;
235  const unsigned int maskChi2Z = 0x00003C00;
236  const unsigned int maskBendChi2 = 0x0001C000;
237  const unsigned int maskHitPat = 0x0000007F;
238  const unsigned int maskSpare = 0x000003FF;
239 
240  const unsigned int nWordBits = 32;
241 
242 }; // end of class def
243 
244 #endif
Vector3DBase
Definition: Vector3DBase.h:8
TTTrack_TrackWord::TrackWord3
unsigned int TrackWord3
Definition: TTTrack_TrackWord.h:171
TTTrack_TrackWord::TrackWord1
unsigned int TrackWord1
Definition: TTTrack_TrackWord.h:169
TTTrack_TrackWord::get_id0
float get_id0()
Definition: TTTrack_TrackWord.cc:259
TTTrack_TrackWord::get_hitPattern
unsigned int get_hitPattern()
Definition: TTTrack_TrackWord.cc:274
TTTrack_TrackWord::TrackWord2
unsigned int TrackWord2
Definition: TTTrack_TrackWord.h:170
TTTrack_TrackWord::get_ispare
unsigned int get_ispare()
Definition: TTTrack_TrackWord.cc:319
TTTrack_TrackWord::NCurvBits
const unsigned int NCurvBits
Definition: TTTrack_TrackWord.h:207
TTTrack_TrackWord::NBchi2
unsigned int NBchi2
Definition: TTTrack_TrackWord.h:186
TTTrack_TrackWord::get_chi2ZBits
unsigned int get_chi2ZBits()
TTTrack_TrackWord::valLSBPhi
float valLSBPhi
Definition: TTTrack_TrackWord.h:176
TTTrack_TrackWord::unpack_Signed
float unpack_Signed(unsigned int bits, unsigned int nBits, float lsb)
Definition: TTTrack_TrackWord.cc:333
TTTrack_TrackWord::valLSBCurv
float valLSBCurv
Definition: TTTrack_TrackWord.h:175
TTTrack_TrackWord::valLSBTanl
float valLSBTanl
Definition: TTTrack_TrackWord.h:177
TTTrack_TrackWord::unpack_iBendChi2
float unpack_iBendChi2()
Definition: TTTrack_TrackWord.cc:287
TTTrack_TrackWord::maskBendChi2
const unsigned int maskBendChi2
Definition: TTTrack_TrackWord.h:236
TTTrack_TrackWord::NSpareBits
const unsigned int NSpareBits
Definition: TTTrack_TrackWord.h:217
TTTrack_TrackWord::initialize
void initialize()
Definition: TTTrack_TrackWord.cc:345
TTTrack_TrackWord::valLSBD0
float valLSBD0
Definition: TTTrack_TrackWord.h:179
TTTrack_TrackWord::setTrackWord
void setTrackWord(const GlobalVector &Momentum, const GlobalPoint &POCA, double Rinv, double Chi2XY, double Chi2Z, double BendChi2, unsigned int HitPattern, unsigned int iSpare)
Definition: TTTrack_TrackWord.cc:79
TTTrack_TrackWord::maxD0
const float maxD0
Definition: TTTrack_TrackWord.h:224
TTTrack_TrackWord::get_z0Bits
unsigned int get_z0Bits()
Definition: TTTrack_TrackWord.cc:216
TTTrack_TrackWord::get_iRinv
float get_iRinv()
Definition: TTTrack_TrackWord.cc:282
TTTrack_TrackWord::get_d0Bits
unsigned int get_d0Bits()
Definition: TTTrack_TrackWord.cc:264
hgcalVFEProducer_cfi.lsb
lsb
Definition: hgcalVFEProducer_cfi.py:80
TTTrack_TrackWord::ichi2Z
unsigned int ichi2Z
Definition: TTTrack_TrackWord.h:162
TTTrack_TrackWord::maxTanl
const float maxTanl
Definition: TTTrack_TrackWord.h:222
TTTrack_TrackWord::get_RinvBits
unsigned int get_RinvBits()
TTTrack_TrackWord::valLSBZ0
float valLSBZ0
Definition: TTTrack_TrackWord.h:178
TTTrack_TrackWord::operator=
TTTrack_TrackWord & operator=(const TTTrack_TrackWord &word)
Definition: TTTrack_TrackWord.h:127
TTTrack_TrackWord::unpack_id0
float unpack_id0()
Definition: TTTrack_TrackWord.cc:253
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
TTTrack_TrackWord::maskChi2Z
const unsigned int maskChi2Z
Definition: TTTrack_TrackWord.h:235
Chi2
Definition: Chi2.h:15
TTTrack_TrackWord::unpack_ichi2Z
float unpack_ichi2Z()
Definition: TTTrack_TrackWord.cc:303
TTTrack_TrackWord::get_ichi2XY
float get_ichi2XY()
Definition: TTTrack_TrackWord.cc:227
TTTrack_TrackWord::get_phiBits
unsigned int get_phiBits()
Definition: TTTrack_TrackWord.cc:248
TTTrack_TrackWord::maxCurv
const float maxCurv
Definition: TTTrack_TrackWord.h:220
TTTrack_TrackWord::id0
unsigned int id0
Definition: TTTrack_TrackWord.h:160
TTTrack_TrackWord::NTanlBits
const unsigned int NTanlBits
Definition: TTTrack_TrackWord.h:209
TTTrack_TrackWord::nWordBits
const unsigned int nWordBits
Definition: TTTrack_TrackWord.h:240
TTTrack_TrackWord::NChi2Bits
const unsigned int NChi2Bits
Definition: TTTrack_TrackWord.h:214
TTTrack_TrackWord::iBendChi2
unsigned int iBendChi2
Definition: TTTrack_TrackWord.h:163
TTTrack_TrackWord::chi2Bins
float chi2Bins[16]
Definition: TTTrack_TrackWord.h:181
TTTrack_TrackWord::NZ0Bits
const unsigned int NZ0Bits
Definition: TTTrack_TrackWord.h:210
TTTrack_TrackWord::iz0
unsigned int iz0
Definition: TTTrack_TrackWord.h:159
TTTrack_TrackWord::maskZ0
const unsigned int maskZ0
Definition: TTTrack_TrackWord.h:233
HLTMuonOfflineAnalyzer_cfi.z0
z0
Definition: HLTMuonOfflineAnalyzer_cfi.py:98
Point3DBase< float, GlobalTag >
TTTrack_TrackWord::get_iz0
float get_iz0()
Definition: TTTrack_TrackWord.cc:211
TTTrack_TrackWord::NHitsBits
const unsigned int NHitsBits
Definition: TTTrack_TrackWord.h:216
TTTrack_TrackWord::maxPhi
const float maxPhi
Definition: TTTrack_TrackWord.h:221
TTTrack_TrackWord::get_itanl
float get_itanl()
Definition: TTTrack_TrackWord.cc:195
TTTrack_TrackWord::TTTrack_TrackWord
TTTrack_TrackWord(const TTTrack_TrackWord &word)
Definition: TTTrack_TrackWord.h:107
TTTrack_TrackWord::unpack_ispare
unsigned int unpack_ispare()
Definition: TTTrack_TrackWord.cc:314
TTTrack_TrackWord::unpack_iz0
float unpack_iz0()
Definition: TTTrack_TrackWord.cc:205
TTTrack_TrackWord::unpack_itanl
float unpack_itanl()
Definition: TTTrack_TrackWord.cc:189
TTTrack_TrackWord::NPhiBits
const unsigned int NPhiBits
Definition: TTTrack_TrackWord.h:208
TTTrack_TrackWord::unpack_ichi2XY
float unpack_ichi2XY()
Definition: TTTrack_TrackWord.cc:221
TTTrack_TrackWord::get_chi2XYBits
unsigned int get_chi2XYBits()
Definition: TTTrack_TrackWord.cc:232
TTTrack_TrackWord::TTTrack_TrackWord
TTTrack_TrackWord()
Definition: TTTrack_TrackWord.h:23
TTTrack_TrackWord::maskSpare
const unsigned int maskSpare
Definition: TTTrack_TrackWord.h:238
TTTrack_TrackWord::Bchi2Bins
float Bchi2Bins[8]
Definition: TTTrack_TrackWord.h:183
TTTrack_TrackWord::get_iphi
float get_iphi()
Definition: TTTrack_TrackWord.cc:243
TTTrack_TrackWord::maskTanL
const unsigned int maskTanL
Definition: TTTrack_TrackWord.h:231
TTTrack_TrackWord::NBChi2Bits
const unsigned int NBChi2Bits
Definition: TTTrack_TrackWord.h:215
TTTrack_TrackWord::iHitPattern
unsigned int iHitPattern
Definition: TTTrack_TrackWord.h:165
TTTrack_TrackWord::maskPhi
const unsigned int maskPhi
Definition: TTTrack_TrackWord.h:230
TTTrack_TrackWord::digitize_Signed
unsigned int digitize_Signed(float var, unsigned int maxBit, unsigned int minBit, float lsb)
Definition: TTTrack_TrackWord.cc:321
TTTrack_TrackWord::iphi
unsigned int iphi
Definition: TTTrack_TrackWord.h:157
GlobalVector.h
TTTrack_TrackWord::maxZ0
const float maxZ0
Definition: TTTrack_TrackWord.h:223
TTTrack_TrackWord::Nchi2
unsigned int Nchi2
Definition: TTTrack_TrackWord.h:185
TTTrack_TrackWord::maskRinv
const unsigned int maskRinv
Definition: TTTrack_TrackWord.h:229
TTTrack_TrackWord::ispare
unsigned int ispare
Definition: TTTrack_TrackWord.h:164
TTTrack_TrackWord::get_ichi2Z
float get_ichi2Z()
Definition: TTTrack_TrackWord.cc:309
TTTrack_TrackWord
Definition: TTTrack_TrackWord.h:19
TTTrack_TrackWord::maskChi2XY
const unsigned int maskChi2XY
Definition: TTTrack_TrackWord.h:234
TTTrack_TrackWord::iRinv
unsigned int iRinv
Definition: TTTrack_TrackWord.h:156
TTTrack_TrackWord::unpack_iRinv
float unpack_iRinv()
Definition: TTTrack_TrackWord.cc:276
TTTrack_TrackWord::get_iBendChi2
float get_iBendChi2()
Definition: TTTrack_TrackWord.cc:293
d0
static constexpr float d0
Definition: L1EGammaCrystalsEmulatorProducer.cc:85
TTTrack_TrackWord::chi2ZBins
float chi2ZBins[16]
Definition: TTTrack_TrackWord.h:182
TTTrack_TrackWord::get_tanlBits
unsigned int get_tanlBits()
Definition: TTTrack_TrackWord.cc:200
TTTrack_TrackWord::unpack_iphi
float unpack_iphi()
Definition: TTTrack_TrackWord.cc:237
GlobalPoint.h
TTTrack_TrackWord::maskD0
const unsigned int maskD0
Definition: TTTrack_TrackWord.h:232
TTTrack_TrackWord::unpack_hitPattern
unsigned int unpack_hitPattern()
Definition: TTTrack_TrackWord.cc:269
TTTrack_TrackWord::maskHitPat
const unsigned int maskHitPat
Definition: TTTrack_TrackWord.h:237
TTTrack_TrackWord::itanl
unsigned int itanl
Definition: TTTrack_TrackWord.h:158
TTTrack_TrackWord::ND0Bits
const unsigned int ND0Bits
Definition: TTTrack_TrackWord.h:211
TTTrack_TrackWord::get_BendChi2Bits
unsigned int get_BendChi2Bits()
Definition: TTTrack_TrackWord.cc:298
TTTrack_TrackWord::ichi2XY
unsigned int ichi2XY
Definition: TTTrack_TrackWord.h:161