20 float pt_unscale = 1. / 1.4;
29 int mode_inv =
track.Mode_inv();
39 int dTheta12 = ptlut_data.
delta_th[0];
40 int dTheta13 = ptlut_data.
delta_th[1];
41 int dTheta14 = ptlut_data.
delta_th[2];
42 int dTheta23 = ptlut_data.
delta_th[3];
43 int dTheta24 = ptlut_data.
delta_th[4];
44 int dTheta34 = ptlut_data.
delta_th[5];
45 int FR1 = ptlut_data.
fr[0];
46 int FR2 = ptlut_data.
fr[1];
47 int FR3 = ptlut_data.
fr[2];
48 int FR4 = ptlut_data.
fr[3];
50 int sign12 = ptlut_data.
sign_ph[0];
51 int sign13 = ptlut_data.
sign_ph[1];
52 int sign14 = ptlut_data.
sign_ph[2];
53 int sign23 = ptlut_data.
sign_ph[3];
54 int sign24 = ptlut_data.
sign_ph[4];
55 int sign34 = ptlut_data.
sign_ph[5];
56 int dTheta12Sign = ptlut_data.
sign_th[0];
57 int dTheta13Sign = ptlut_data.
sign_th[1];
58 int dTheta14Sign = ptlut_data.
sign_th[2];
59 int dTheta23Sign = ptlut_data.
sign_th[3];
60 int dTheta24Sign = ptlut_data.
sign_th[4];
61 int dTheta34Sign = ptlut_data.
sign_th[5];
72 int CSCID1 = (ptlut_data.
bt_vi[0] == 0 && ptlut_data.
bt_vi[1] != 0) ? ptlut_data.
bt_ci[1] + 16 : ptlut_data.
bt_ci[0];
73 int CSCID2 = ptlut_data.
bt_ci[2];
74 int CSCID3 = ptlut_data.
bt_ci[3];
75 int CSCID4 = ptlut_data.
bt_ci[4];
77 auto get_signed_int = [](
int var,
int sign) {
return (
sign == 1) ? (
var * 1) : (
var * -1); };
79 dTheta12 =
aux().
getdTheta(get_signed_int(dTheta12, dTheta12Sign));
80 dTheta13 =
aux().
getdTheta(get_signed_int(dTheta13, dTheta13Sign));
81 dTheta14 =
aux().
getdTheta(get_signed_int(dTheta14, dTheta14Sign));
82 dTheta23 =
aux().
getdTheta(get_signed_int(dTheta23, dTheta23Sign));
83 dTheta24 =
aux().
getdTheta(get_signed_int(dTheta24, dTheta24Sign));
84 dTheta34 =
aux().
getdTheta(get_signed_int(dTheta34, dTheta34Sign));
86 bool use_FRLUT =
true;
102 address |= (dPhi12 & ((1 << 9) - 1)) << (0);
103 address |= (sign12 & ((1 << 1) - 1)) << (0 + 9);
104 address |= (dTheta12 & ((1 << 3) - 1)) << (0 + 9 + 1);
105 address |= (CLCT1 & ((1 << 2) - 1)) << (0 + 9 + 1 + 3);
106 address |= (CLCT1Sign & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2);
107 address |= (CLCT2 & ((1 << 2) - 1)) << (0 + 9 + 1 + 3 + 2 + 1);
108 address |= (CLCT2Sign & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2);
109 address |= (FR1 & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1);
110 address |= (FR2 & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1);
111 address |= (
theta & ((1 << 5) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1);
112 address |= (mode_inv & ((1 << 4) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1 + 5);
119 address |= (dPhi13 & ((1 << 9) - 1)) << (0);
120 address |= (sign13 & ((1 << 1) - 1)) << (0 + 9);
121 address |= (dTheta13 & ((1 << 3) - 1)) << (0 + 9 + 1);
122 address |= (CLCT1 & ((1 << 2) - 1)) << (0 + 9 + 1 + 3);
123 address |= (CLCT1Sign & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2);
124 address |= (CLCT3 & ((1 << 2) - 1)) << (0 + 9 + 1 + 3 + 2 + 1);
125 address |= (CLCT3Sign & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2);
126 address |= (FR1 & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1);
127 address |= (FR3 & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1);
128 address |= (
theta & ((1 << 5) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1);
129 address |= (mode_inv & ((1 << 4) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1 + 5);
136 address |= (dPhi14 & ((1 << 9) - 1)) << (0);
137 address |= (sign14 & ((1 << 1) - 1)) << (0 + 9);
138 address |= (dTheta14 & ((1 << 3) - 1)) << (0 + 9 + 1);
139 address |= (CLCT1 & ((1 << 2) - 1)) << (0 + 9 + 1 + 3);
140 address |= (CLCT1Sign & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2);
141 address |= (CLCT4 & ((1 << 2) - 1)) << (0 + 9 + 1 + 3 + 2 + 1);
142 address |= (CLCT4Sign & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2);
143 address |= (FR1 & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1);
144 address |= (FR4 & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1);
145 address |= (
theta & ((1 << 5) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1);
146 address |= (mode_inv & ((1 << 4) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1 + 5);
153 address |= (dPhi23 & ((1 << 9) - 1)) << (0);
154 address |= (sign23 & ((1 << 1) - 1)) << (0 + 9);
155 address |= (dTheta23 & ((1 << 3) - 1)) << (0 + 9 + 1);
156 address |= (CLCT2 & ((1 << 2) - 1)) << (0 + 9 + 1 + 3);
157 address |= (CLCT2Sign & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2);
158 address |= (CLCT3 & ((1 << 2) - 1)) << (0 + 9 + 1 + 3 + 2 + 1);
159 address |= (CLCT3Sign & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2);
160 address |= (FR2 & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1);
161 address |= (FR3 & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1);
162 address |= (
theta & ((1 << 5) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1);
163 address |= (mode_inv & ((1 << 4) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1 + 5);
170 address |= (dPhi24 & ((1 << 9) - 1)) << (0);
171 address |= (sign24 & ((1 << 1) - 1)) << (0 + 9);
172 address |= (dTheta24 & ((1 << 3) - 1)) << (0 + 9 + 1);
173 address |= (CLCT2 & ((1 << 2) - 1)) << (0 + 9 + 1 + 3);
174 address |= (CLCT2Sign & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2);
175 address |= (CLCT4 & ((1 << 2) - 1)) << (0 + 9 + 1 + 3 + 2 + 1);
176 address |= (CLCT4Sign & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2);
177 address |= (FR2 & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1);
178 address |= (FR4 & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1);
179 address |= (
theta & ((1 << 5) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1);
180 address |= (mode_inv & ((1 << 4) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1 + 5);
187 address |= (dPhi34 & ((1 << 9) - 1)) << (0);
188 address |= (sign34 & ((1 << 1) - 1)) << (0 + 9);
189 address |= (dTheta34 & ((1 << 3) - 1)) << (0 + 9 + 1);
190 address |= (CLCT3 & ((1 << 2) - 1)) << (0 + 9 + 1 + 3);
191 address |= (CLCT3Sign & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2);
192 address |= (CLCT4 & ((1 << 2) - 1)) << (0 + 9 + 1 + 3 + 2 + 1);
193 address |= (CLCT4Sign & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2);
194 address |= (FR3 & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1);
195 address |= (FR4 & ((1 << 1) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1);
196 address |= (
theta & ((1 << 5) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1);
197 address |= (mode_inv & ((1 << 4) - 1)) << (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1 + 5);
204 address |= (dPhi12 & ((1 << 7) - 1)) << (0);
205 address |= (dPhi23 & ((1 << 5) - 1)) << (0 + 7);
206 address |= (sign12 & ((1 << 1) - 1)) << (0 + 7 + 5);
207 address |= (sign23 & ((1 << 1) - 1)) << (0 + 7 + 5 + 1);
208 address |= (dTheta13 & ((1 << 3) - 1)) << (0 + 7 + 5 + 1 + 1);
209 address |= (CLCT1 & ((1 << 2) - 1)) << (0 + 7 + 5 + 1 + 1 + 3);
210 address |= (CLCT1Sign & ((1 << 1) - 1)) << (0 + 7 + 5 + 1 + 1 + 3 + 2);
211 address |= (FR1 & ((1 << 1) - 1)) << (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1);
212 address |= (
theta & ((1 << 5) - 1)) << (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1 + 1);
213 address |= (mode_inv & ((1 << 4) - 1)) << (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1 + 1 + 5);
220 address |= (dPhi12 & ((1 << 7) - 1)) << (0);
221 address |= (dPhi24 & ((1 << 5) - 1)) << (0 + 7);
222 address |= (sign12 & ((1 << 1) - 1)) << (0 + 7 + 5);
223 address |= (sign24 & ((1 << 1) - 1)) << (0 + 7 + 5 + 1);
224 address |= (dTheta14 & ((1 << 3) - 1)) << (0 + 7 + 5 + 1 + 1);
225 address |= (CLCT1 & ((1 << 2) - 1)) << (0 + 7 + 5 + 1 + 1 + 3);
226 address |= (CLCT1Sign & ((1 << 1) - 1)) << (0 + 7 + 5 + 1 + 1 + 3 + 2);
227 address |= (FR1 & ((1 << 1) - 1)) << (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1);
228 address |= (
theta & ((1 << 5) - 1)) << (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1 + 1);
229 address |= (mode_inv & ((1 << 4) - 1)) << (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1 + 1 + 5);
236 address |= (dPhi13 & ((1 << 7) - 1)) << (0);
237 address |= (dPhi34 & ((1 << 5) - 1)) << (0 + 7);
238 address |= (sign13 & ((1 << 1) - 1)) << (0 + 7 + 5);
239 address |= (sign34 & ((1 << 1) - 1)) << (0 + 7 + 5 + 1);
240 address |= (dTheta14 & ((1 << 3) - 1)) << (0 + 7 + 5 + 1 + 1);
241 address |= (CLCT1 & ((1 << 2) - 1)) << (0 + 7 + 5 + 1 + 1 + 3);
242 address |= (CLCT1Sign & ((1 << 1) - 1)) << (0 + 7 + 5 + 1 + 1 + 3 + 2);
243 address |= (FR1 & ((1 << 1) - 1)) << (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1);
244 address |= (
theta & ((1 << 5) - 1)) << (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1 + 1);
245 address |= (mode_inv & ((1 << 4) - 1)) << (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1 + 1 + 5);
252 address |= (dPhi23 & ((1 << 7) - 1)) << (0);
253 address |= (dPhi34 & ((1 << 6) - 1)) << (0 + 7);
254 address |= (sign23 & ((1 << 1) - 1)) << (0 + 7 + 6);
255 address |= (sign34 & ((1 << 1) - 1)) << (0 + 7 + 6 + 1);
256 address |= (dTheta24 & ((1 << 3) - 1)) << (0 + 7 + 6 + 1 + 1);
257 address |= (CLCT2 & ((1 << 2) - 1)) << (0 + 7 + 6 + 1 + 1 + 3);
258 address |= (CLCT2Sign & ((1 << 1) - 1)) << (0 + 7 + 6 + 1 + 1 + 3 + 2);
259 address |= (
theta & ((1 << 5) - 1)) << (0 + 7 + 6 + 1 + 1 + 3 + 2 + 1);
260 address |= (mode_inv & ((1 << 4) - 1)) << (0 + 7 + 6 + 1 + 1 + 3 + 2 + 1 + 5);
274 address |= (dPhi12 & ((1 << 7) - 1)) << (0);
275 address |= (dPhi23 & ((1 << 5) - 1)) << (0 + 7);
276 address |= (dPhi34 & ((1 << 6) - 1)) << (0 + 7 + 5);
277 address |= (sign23 & ((1 << 1) - 1)) << (0 + 7 + 5 + 6);
278 address |= (sign34 & ((1 << 1) - 1)) << (0 + 7 + 5 + 6 + 1);
279 address |= (FR1 & ((1 << 1) - 1)) << (0 + 7 + 5 + 6 + 1 + 1);
280 address |= (
theta & ((1 << 5) - 1)) << (0 + 7 + 5 + 6 + 1 + 1 + 1);
281 address |= (mode_inv & ((1 << 4) - 1)) << (0 + 7 + 5 + 6 + 1 + 1 + 1 + 5);
297 int mode_inv = (address >> (30 - 4)) & ((1 << 4) - 1);
299 auto contain = [](
const std::vector<int>& vec,
int elem) {
300 return (
std::find(vec.begin(), vec.end(), elem) != vec.end());
349 dPhi12 = (address >> (0)) & ((1 << 9) - 1);
350 sign12 = (address >> (0 + 9)) & ((1 << 1) - 1);
351 dTheta12 = (address >> (0 + 9 + 1)) & ((1 << 3) - 1);
352 CLCT1 = (address >> (0 + 9 + 1 + 3)) & ((1 << 2) - 1);
353 CLCT1Sign = (address >> (0 + 9 + 1 + 3 + 2)) & ((1 << 1) - 1);
354 CLCT2 = (address >> (0 + 9 + 1 + 3 + 2 + 1)) & ((1 << 2) - 1);
355 CLCT2Sign = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2)) & ((1 << 1) - 1);
356 FR1 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1)) & ((1 << 1) - 1);
357 FR2 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1)) & ((1 << 1) - 1);
358 theta = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1)) & ((1 << 5) - 1);
362 dPhi13 = (address >> (0)) & ((1 << 9) - 1);
363 sign13 = (address >> (0 + 9)) & ((1 << 1) - 1);
364 dTheta13 = (address >> (0 + 9 + 1)) & ((1 << 3) - 1);
365 CLCT1 = (address >> (0 + 9 + 1 + 3)) & ((1 << 2) - 1);
366 CLCT1Sign = (address >> (0 + 9 + 1 + 3 + 2)) & ((1 << 1) - 1);
367 CLCT3 = (address >> (0 + 9 + 1 + 3 + 2 + 1)) & ((1 << 2) - 1);
368 CLCT3Sign = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2)) & ((1 << 1) - 1);
369 FR1 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1)) & ((1 << 1) - 1);
370 FR3 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1)) & ((1 << 1) - 1);
371 theta = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1)) & ((1 << 5) - 1);
375 dPhi14 = (address >> (0)) & ((1 << 9) - 1);
376 sign14 = (address >> (0 + 9)) & ((1 << 1) - 1);
377 dTheta14 = (address >> (0 + 9 + 1)) & ((1 << 3) - 1);
378 CLCT1 = (address >> (0 + 9 + 1 + 3)) & ((1 << 2) - 1);
379 CLCT1Sign = (address >> (0 + 9 + 1 + 3 + 2)) & ((1 << 1) - 1);
380 CLCT4 = (address >> (0 + 9 + 1 + 3 + 2 + 1)) & ((1 << 2) - 1);
381 CLCT4Sign = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2)) & ((1 << 1) - 1);
382 FR1 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1)) & ((1 << 1) - 1);
383 FR4 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1)) & ((1 << 1) - 1);
384 theta = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1)) & ((1 << 5) - 1);
388 dPhi23 = (address >> (0)) & ((1 << 9) - 1);
389 sign23 = (address >> (0 + 9)) & ((1 << 1) - 1);
390 dTheta23 = (address >> (0 + 9 + 1)) & ((1 << 3) - 1);
391 CLCT2 = (address >> (0 + 9 + 1 + 3)) & ((1 << 2) - 1);
392 CLCT2Sign = (address >> (0 + 9 + 1 + 3 + 2)) & ((1 << 1) - 1);
393 CLCT3 = (address >> (0 + 9 + 1 + 3 + 2 + 1)) & ((1 << 2) - 1);
394 CLCT3Sign = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2)) & ((1 << 1) - 1);
395 FR2 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1)) & ((1 << 1) - 1);
396 FR3 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1)) & ((1 << 1) - 1);
397 theta = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1)) & ((1 << 5) - 1);
401 dPhi24 = (address >> (0)) & ((1 << 9) - 1);
402 sign24 = (address >> (0 + 9)) & ((1 << 1) - 1);
403 dTheta24 = (address >> (0 + 9 + 1)) & ((1 << 3) - 1);
404 CLCT2 = (address >> (0 + 9 + 1 + 3)) & ((1 << 2) - 1);
405 CLCT2Sign = (address >> (0 + 9 + 1 + 3 + 2)) & ((1 << 1) - 1);
406 CLCT4 = (address >> (0 + 9 + 1 + 3 + 2 + 1)) & ((1 << 2) - 1);
407 CLCT4Sign = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2)) & ((1 << 1) - 1);
408 FR2 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1)) & ((1 << 1) - 1);
409 FR4 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1)) & ((1 << 1) - 1);
410 theta = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1)) & ((1 << 5) - 1);
414 dPhi34 = (address >> (0)) & ((1 << 9) - 1);
415 sign34 = (address >> (0 + 9)) & ((1 << 1) - 1);
416 dTheta34 = (address >> (0 + 9 + 1)) & ((1 << 3) - 1);
417 CLCT3 = (address >> (0 + 9 + 1 + 3)) & ((1 << 2) - 1);
418 CLCT3Sign = (address >> (0 + 9 + 1 + 3 + 2)) & ((1 << 1) - 1);
419 CLCT4 = (address >> (0 + 9 + 1 + 3 + 2 + 1)) & ((1 << 2) - 1);
420 CLCT4Sign = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2)) & ((1 << 1) - 1);
421 FR3 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1)) & ((1 << 1) - 1);
422 FR4 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1)) & ((1 << 1) - 1);
423 theta = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1)) & ((1 << 5) - 1);
427 dPhi12 = (address >> (0)) & ((1 << 7) - 1);
428 dPhi23 = (address >> (0 + 7)) & ((1 << 5) - 1);
429 sign12 = (address >> (0 + 7 + 5)) & ((1 << 1) - 1);
430 sign23 = (address >> (0 + 7 + 5 + 1)) & ((1 << 1) - 1);
431 dTheta13 = (address >> (0 + 7 + 5 + 1 + 1)) & ((1 << 3) - 1);
432 CLCT1 = (address >> (0 + 7 + 5 + 1 + 1 + 3)) & ((1 << 2) - 1);
433 CLCT1Sign = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2)) & ((1 << 1) - 1);
434 FR1 = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1)) & ((1 << 1) - 1);
435 theta = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1 + 1)) & ((1 << 5) - 1);
442 dPhi12 = (address >> (0)) & ((1 << 7) - 1);
443 dPhi24 = (address >> (0 + 7)) & ((1 << 5) - 1);
444 sign12 = (address >> (0 + 7 + 5)) & ((1 << 1) - 1);
445 sign24 = (address >> (0 + 7 + 5 + 1)) & ((1 << 1) - 1);
446 dTheta14 = (address >> (0 + 7 + 5 + 1 + 1)) & ((1 << 3) - 1);
447 CLCT1 = (address >> (0 + 7 + 5 + 1 + 1 + 3)) & ((1 << 2) - 1);
448 CLCT1Sign = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2)) & ((1 << 1) - 1);
449 FR1 = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1)) & ((1 << 1) - 1);
450 theta = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1 + 1)) & ((1 << 5) - 1);
457 dPhi13 = (address >> (0)) & ((1 << 7) - 1);
458 dPhi34 = (address >> (0 + 7)) & ((1 << 5) - 1);
459 sign13 = (address >> (0 + 7 + 5)) & ((1 << 1) - 1);
460 sign34 = (address >> (0 + 7 + 5 + 1)) & ((1 << 1) - 1);
461 dTheta14 = (address >> (0 + 7 + 5 + 1 + 1)) & ((1 << 3) - 1);
462 CLCT1 = (address >> (0 + 7 + 5 + 1 + 1 + 3)) & ((1 << 2) - 1);
463 CLCT1Sign = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2)) & ((1 << 1) - 1);
464 FR1 = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1)) & ((1 << 1) - 1);
465 theta = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1 + 1)) & ((1 << 5) - 1);
472 dPhi23 = (address >> (0)) & ((1 << 7) - 1);
473 dPhi34 = (address >> (0 + 7)) & ((1 << 6) - 1);
474 sign23 = (address >> (0 + 7 + 6)) & ((1 << 1) - 1);
475 sign34 = (address >> (0 + 7 + 6 + 1)) & ((1 << 1) - 1);
476 dTheta24 = (address >> (0 + 7 + 6 + 1 + 1)) & ((1 << 3) - 1);
477 CLCT2 = (address >> (0 + 7 + 6 + 1 + 1 + 3)) & ((1 << 2) - 1);
478 CLCT2Sign = (address >> (0 + 7 + 6 + 1 + 1 + 3 + 2)) & ((1 << 1) - 1);
479 theta = (address >> (0 + 7 + 6 + 1 + 1 + 3 + 2 + 1)) & ((1 << 5) - 1);
486 dPhi12 = (address >> (0)) & ((1 << 7) - 1);
487 dPhi23 = (address >> (0 + 7)) & ((1 << 5) - 1);
488 dPhi34 = (address >> (0 + 7 + 5)) & ((1 << 6) - 1);
489 sign23 = (address >> (0 + 7 + 5 + 6)) & ((1 << 1) - 1);
490 sign34 = (address >> (0 + 7 + 5 + 6 + 1)) & ((1 << 1) - 1);
491 FR1 = (address >> (0 + 7 + 5 + 6 + 1 + 1)) & ((1 << 1) - 1);
492 theta = (address >> (0 + 7 + 5 + 6 + 1 + 1 + 1)) & ((1 << 5) - 1);
503 auto get_signed_int = [](
int var,
int sign) {
return (
sign == 1) ? (
var * 1) : (
var * -1); };
505 dPhi12 = get_signed_int(dPhi12, sign12);
506 dPhi13 = get_signed_int(dPhi13, sign13);
507 dPhi14 = get_signed_int(dPhi14, sign14);
508 dPhi23 = get_signed_int(dPhi23, sign23);
509 dPhi24 = get_signed_int(dPhi24, sign24);
510 dPhi34 = get_signed_int(dPhi34, sign34);
512 CLCT1 = get_signed_int(CLCT1, CLCT1Sign);
513 CLCT2 = get_signed_int(CLCT2, CLCT2Sign);
514 CLCT3 = get_signed_int(CLCT3, CLCT3Sign);
515 CLCT4 = get_signed_int(CLCT4, CLCT4Sign);
520 bool use_lossy_eta =
true;
523 etaInt &= ((1 << 5) - 1);
531 if (mode_inv == 15) {
532 bool st2_off =
false;
533 bool st3_off =
false;
534 bool st4_off =
false;
536 dPhi13 = dPhi12 + dPhi23;
537 dPhi14 = dPhi13 + dPhi34;
538 dPhi24 = dPhi23 + dPhi34;
540 int sum_st1 =
abs(dPhi12 + dPhi13 + dPhi14);
541 int sum_st2 =
abs(-dPhi12 + dPhi23 + dPhi24);
542 int sum_st3 =
abs(-dPhi13 - dPhi23 + dPhi34);
543 int sum_st4 =
abs(-dPhi14 - dPhi24 - dPhi34);
546 if (sum_st2 > sum_st1 && sum_st2 > sum_st3 && sum_st2 > sum_st4)
548 if (sum_st3 > sum_st1 && sum_st3 > sum_st2 && sum_st3 > sum_st4)
550 if (sum_st4 > sum_st1 && sum_st4 > sum_st2 && sum_st4 > sum_st3)
555 if ((
abs(dPhi12) > 9 ||
abs(dPhi23) > 9 ||
abs(dPhi24) > 9) &&
556 (
abs(dPhi13) < 10 &&
abs(dPhi14) < 10 &&
abs(dPhi34) < 10)) {
562 if ((
abs(dPhi13) > 9 ||
abs(dPhi23) > 9 ||
abs(dPhi34) > 9) &&
563 (
abs(dPhi12) < 10 &&
abs(dPhi14) < 10 &&
abs(dPhi24) < 10)) {
569 if ((
abs(dPhi14) > 9 ||
abs(dPhi24) > 9 ||
abs(dPhi34) > 9) &&
570 (
abs(dPhi12) < 10 &&
abs(dPhi13) < 10 &&
abs(dPhi23) < 10)) {
571 if (
abs(dPhi13) <
abs(dPhi23))
590 sign23 = (dPhi23 > 0) ? 1 : 0;
591 sign34 = (dPhi34 > 0) ? 1 : 0;
593 sign23 = (dPhi23 < 0) ? 1 : 0;
594 sign34 = (dPhi34 < 0) ? 1 : 0;
597 dPhi12 = get_signed_int(
abs(dPhi12), sign12);
598 dPhi23 = get_signed_int(
abs(dPhi23), sign23);
599 dPhi34 = get_signed_int(
abs(dPhi34), sign34);
606 if (mode_inv == 14) {
613 bugged_CLCT2 = (address >> (0 + 7 + 5 + 1 + 1 + 3)) & ((1 << 2) - 1);
614 bugged_address = address & ~(((1 << 2) - 1) << (0 + 7 + 6 + 1 + 1 + 3));
615 bugged_address |= (bugged_CLCT2 & ((1 << 2) - 1)) << (0 + 7 + 6 + 1 + 1 + 3);
616 bugged_CLCT2 = (bugged_address >> (0 + 7 + 5 + 1 + 1 + 3)) & ((1 << 2) - 1);
618 CLCT2 = bugged_CLCT2;
619 CLCT2 = get_signed_int(CLCT2, CLCT2Sign);
627 std::vector<int>
variables = {dPhi12, dPhi13, dPhi14, dPhi23, dPhi24, dPhi34, dTheta12, dTheta13,
628 dTheta14, dTheta23, dTheta24, dTheta34, CLCT1, CLCT2, CLCT3, CLCT4,
629 CSCID1, CSCID2, CSCID3, CSCID4, FR1, FR2, FR3, FR4};
631 std::vector<double> tree_data;
632 tree_data.push_back(1.0);
633 tree_data.push_back(
eta);
635 for (
int i = 0;
i < 6;
i++) {
636 int mv = mode_variables[mode_inv - 3][
i];
639 if (!(mode_inv == 13 &&
i == 3)) {
642 tree_data.push_back(
v);
644 tree_data.push_back(0);
649 std::cout <<
"mode_inv: " << mode_inv <<
" variables: ";
650 for (
const auto&
v : tree_data)
655 auto tree_event = std::make_unique<emtf::Event>();
656 tree_event->predictedValue = 0;
657 tree_event->data = tree_data;
663 float tmp_pt = tree_event->predictedValue;
666 std::cout <<
"mode_inv: " << mode_inv <<
" 1/pT: " << tmp_pt << std::endl;
667 std::cout <<
"dPhi12: " << dPhi12 <<
" dPhi13: " << dPhi13 <<
" dPhi14: " << dPhi14 <<
" dPhi23: " << dPhi23
668 <<
" dPhi24: " << dPhi24 <<
" dPhi34: " << dPhi34 << std::endl;
669 std::cout <<
"dTheta12: " << dTheta12 <<
" dTheta13: " << dTheta13 <<
" dTheta14: " << dTheta14
670 <<
" dTheta23: " << dTheta23 <<
" dTheta24: " << dTheta24 <<
" dTheta34: " << dTheta34 << std::endl;
671 std::cout <<
"CLCT1: " << CLCT1 <<
" CLCT2: " << CLCT2 <<
" CLCT3: " << CLCT3 <<
" CLCT4: " << CLCT4 << std::endl;
672 std::cout <<
"CSCID1: " << CSCID1 <<
" CSCID2: " << CSCID2 <<
" CSCID3: " << CSCID3 <<
" CSCID4: " << CSCID4
674 std::cout <<
"FR1: " << FR1 <<
" FR2: " << FR2 <<
" FR3: " << FR3 <<
" FR4: " << FR4 << std::endl;
678 pt = (tmp_pt == 0) ? tmp_pt : 1.0 / tmp_pt;
687 pt = (tmp_pt == 0) ? tmp_pt : 1.0 / tmp_pt;
void predictEvent(Event *e, unsigned int trees)
int getEtaInt(float eta, int bits=5) const
static PFTauRenderPlugin instance
float getEtaFromEtaInt(int etaInt, int bits=5) const
float getEtaFromThetaInt(int thetaInt, int bits=5) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
int getFRLUT(int sector, int station, int chamber) const
float calculate_pt_xml(const address_t &address) const override
const PtAssignmentEngineAux2016 & aux() const
int getCLCT(int clct) const
Abs< T >::type abs(const T &t)
int getdPhiFromBin(int dPhiBin, int bits, int max=512) const
const int(* getModeVariables() const)[6]
std::array< emtf::Forest, 16 > forests_
float unscale_pt(const float pt, const int mode=15) const override
float scale_pt(const float pt, const int mode=15) const override
int getdTheta(int dTheta) const
address_t calculate_address(const EMTFTrack &track) const override
int getNLBdPhiBin(int dPhi, int bits, int max=512) const
std::vector< int > allowedModes_