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);
275 address |= (dPhi12 & ((1 << 7) - 1)) << (0);
276 address |= (dPhi23 & ((1 << 5) - 1)) << (0 + 7);
277 address |= (dPhi34 & ((1 << 6) - 1)) << (0 + 7 + 5);
278 address |= (sign23 & ((1 << 1) - 1)) << (0 + 7 + 5 + 6);
279 address |= (sign34 & ((1 << 1) - 1)) << (0 + 7 + 5 + 6 + 1);
280 address |= (FR1 & ((1 << 1) - 1)) << (0 + 7 + 5 + 6 + 1 + 1);
281 address |= (
theta & ((1 << 5) - 1)) << (0 + 7 + 5 + 6 + 1 + 1 + 1);
282 address |= (mode_inv & ((1 << 4) - 1)) << (0 + 7 + 5 + 6 + 1 + 1 + 1 + 5);
298 int mode_inv = (address >> (30 - 4)) & ((1 << 4) - 1);
300 auto contain = [](
const std::vector<int>& vec,
int elem) {
301 return (
std::find(vec.begin(), vec.end(), elem) != vec.end());
350 dPhi12 = (address >> (0)) & ((1 << 9) - 1);
351 sign12 = (address >> (0 + 9)) & ((1 << 1) - 1);
352 dTheta12 = (address >> (0 + 9 + 1)) & ((1 << 3) - 1);
353 CLCT1 = (address >> (0 + 9 + 1 + 3)) & ((1 << 2) - 1);
354 CLCT1Sign = (address >> (0 + 9 + 1 + 3 + 2)) & ((1 << 1) - 1);
355 CLCT2 = (address >> (0 + 9 + 1 + 3 + 2 + 1)) & ((1 << 2) - 1);
356 CLCT2Sign = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2)) & ((1 << 1) - 1);
357 FR1 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1)) & ((1 << 1) - 1);
358 FR2 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1)) & ((1 << 1) - 1);
359 theta = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1)) & ((1 << 5) - 1);
363 dPhi13 = (address >> (0)) & ((1 << 9) - 1);
364 sign13 = (address >> (0 + 9)) & ((1 << 1) - 1);
365 dTheta13 = (address >> (0 + 9 + 1)) & ((1 << 3) - 1);
366 CLCT1 = (address >> (0 + 9 + 1 + 3)) & ((1 << 2) - 1);
367 CLCT1Sign = (address >> (0 + 9 + 1 + 3 + 2)) & ((1 << 1) - 1);
368 CLCT3 = (address >> (0 + 9 + 1 + 3 + 2 + 1)) & ((1 << 2) - 1);
369 CLCT3Sign = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2)) & ((1 << 1) - 1);
370 FR1 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1)) & ((1 << 1) - 1);
371 FR3 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1)) & ((1 << 1) - 1);
372 theta = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1)) & ((1 << 5) - 1);
376 dPhi14 = (address >> (0)) & ((1 << 9) - 1);
377 sign14 = (address >> (0 + 9)) & ((1 << 1) - 1);
378 dTheta14 = (address >> (0 + 9 + 1)) & ((1 << 3) - 1);
379 CLCT1 = (address >> (0 + 9 + 1 + 3)) & ((1 << 2) - 1);
380 CLCT1Sign = (address >> (0 + 9 + 1 + 3 + 2)) & ((1 << 1) - 1);
381 CLCT4 = (address >> (0 + 9 + 1 + 3 + 2 + 1)) & ((1 << 2) - 1);
382 CLCT4Sign = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2)) & ((1 << 1) - 1);
383 FR1 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1)) & ((1 << 1) - 1);
384 FR4 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1)) & ((1 << 1) - 1);
385 theta = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1)) & ((1 << 5) - 1);
389 dPhi23 = (address >> (0)) & ((1 << 9) - 1);
390 sign23 = (address >> (0 + 9)) & ((1 << 1) - 1);
391 dTheta23 = (address >> (0 + 9 + 1)) & ((1 << 3) - 1);
392 CLCT2 = (address >> (0 + 9 + 1 + 3)) & ((1 << 2) - 1);
393 CLCT2Sign = (address >> (0 + 9 + 1 + 3 + 2)) & ((1 << 1) - 1);
394 CLCT3 = (address >> (0 + 9 + 1 + 3 + 2 + 1)) & ((1 << 2) - 1);
395 CLCT3Sign = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2)) & ((1 << 1) - 1);
396 FR2 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1)) & ((1 << 1) - 1);
397 FR3 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1)) & ((1 << 1) - 1);
398 theta = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1)) & ((1 << 5) - 1);
402 dPhi24 = (address >> (0)) & ((1 << 9) - 1);
403 sign24 = (address >> (0 + 9)) & ((1 << 1) - 1);
404 dTheta24 = (address >> (0 + 9 + 1)) & ((1 << 3) - 1);
405 CLCT2 = (address >> (0 + 9 + 1 + 3)) & ((1 << 2) - 1);
406 CLCT2Sign = (address >> (0 + 9 + 1 + 3 + 2)) & ((1 << 1) - 1);
407 CLCT4 = (address >> (0 + 9 + 1 + 3 + 2 + 1)) & ((1 << 2) - 1);
408 CLCT4Sign = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2)) & ((1 << 1) - 1);
409 FR2 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1)) & ((1 << 1) - 1);
410 FR4 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1)) & ((1 << 1) - 1);
411 theta = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1)) & ((1 << 5) - 1);
415 dPhi34 = (address >> (0)) & ((1 << 9) - 1);
416 sign34 = (address >> (0 + 9)) & ((1 << 1) - 1);
417 dTheta34 = (address >> (0 + 9 + 1)) & ((1 << 3) - 1);
418 CLCT3 = (address >> (0 + 9 + 1 + 3)) & ((1 << 2) - 1);
419 CLCT3Sign = (address >> (0 + 9 + 1 + 3 + 2)) & ((1 << 1) - 1);
420 CLCT4 = (address >> (0 + 9 + 1 + 3 + 2 + 1)) & ((1 << 2) - 1);
421 CLCT4Sign = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2)) & ((1 << 1) - 1);
422 FR3 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1)) & ((1 << 1) - 1);
423 FR4 = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1)) & ((1 << 1) - 1);
424 theta = (address >> (0 + 9 + 1 + 3 + 2 + 1 + 2 + 1 + 1 + 1)) & ((1 << 5) - 1);
428 dPhi12 = (address >> (0)) & ((1 << 7) - 1);
429 dPhi23 = (address >> (0 + 7)) & ((1 << 5) - 1);
430 sign12 = (address >> (0 + 7 + 5)) & ((1 << 1) - 1);
431 sign23 = (address >> (0 + 7 + 5 + 1)) & ((1 << 1) - 1);
432 dTheta13 = (address >> (0 + 7 + 5 + 1 + 1)) & ((1 << 3) - 1);
433 CLCT1 = (address >> (0 + 7 + 5 + 1 + 1 + 3)) & ((1 << 2) - 1);
434 CLCT1Sign = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2)) & ((1 << 1) - 1);
435 FR1 = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1)) & ((1 << 1) - 1);
436 theta = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1 + 1)) & ((1 << 5) - 1);
443 dPhi12 = (address >> (0)) & ((1 << 7) - 1);
444 dPhi24 = (address >> (0 + 7)) & ((1 << 5) - 1);
445 sign12 = (address >> (0 + 7 + 5)) & ((1 << 1) - 1);
446 sign24 = (address >> (0 + 7 + 5 + 1)) & ((1 << 1) - 1);
447 dTheta14 = (address >> (0 + 7 + 5 + 1 + 1)) & ((1 << 3) - 1);
448 CLCT1 = (address >> (0 + 7 + 5 + 1 + 1 + 3)) & ((1 << 2) - 1);
449 CLCT1Sign = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2)) & ((1 << 1) - 1);
450 FR1 = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1)) & ((1 << 1) - 1);
451 theta = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1 + 1)) & ((1 << 5) - 1);
458 dPhi13 = (address >> (0)) & ((1 << 7) - 1);
459 dPhi34 = (address >> (0 + 7)) & ((1 << 5) - 1);
460 sign13 = (address >> (0 + 7 + 5)) & ((1 << 1) - 1);
461 sign34 = (address >> (0 + 7 + 5 + 1)) & ((1 << 1) - 1);
462 dTheta14 = (address >> (0 + 7 + 5 + 1 + 1)) & ((1 << 3) - 1);
463 CLCT1 = (address >> (0 + 7 + 5 + 1 + 1 + 3)) & ((1 << 2) - 1);
464 CLCT1Sign = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2)) & ((1 << 1) - 1);
465 FR1 = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1)) & ((1 << 1) - 1);
466 theta = (address >> (0 + 7 + 5 + 1 + 1 + 3 + 2 + 1 + 1)) & ((1 << 5) - 1);
473 dPhi23 = (address >> (0)) & ((1 << 7) - 1);
474 dPhi34 = (address >> (0 + 7)) & ((1 << 6) - 1);
475 sign23 = (address >> (0 + 7 + 6)) & ((1 << 1) - 1);
476 sign34 = (address >> (0 + 7 + 6 + 1)) & ((1 << 1) - 1);
477 dTheta24 = (address >> (0 + 7 + 6 + 1 + 1)) & ((1 << 3) - 1);
478 CLCT2 = (address >> (0 + 7 + 6 + 1 + 1 + 3)) & ((1 << 2) - 1);
479 CLCT2Sign = (address >> (0 + 7 + 6 + 1 + 1 + 3 + 2)) & ((1 << 1) - 1);
480 theta = (address >> (0 + 7 + 6 + 1 + 1 + 3 + 2 + 1)) & ((1 << 5) - 1);
487 dPhi12 = (address >> (0)) & ((1 << 7) - 1);
488 dPhi23 = (address >> (0 + 7)) & ((1 << 5) - 1);
489 dPhi34 = (address >> (0 + 7 + 5)) & ((1 << 6) - 1);
490 sign23 = (address >> (0 + 7 + 5 + 6)) & ((1 << 1) - 1);
491 sign34 = (address >> (0 + 7 + 5 + 6 + 1)) & ((1 << 1) - 1);
492 FR1 = (address >> (0 + 7 + 5 + 6 + 1 + 1)) & ((1 << 1) - 1);
493 theta = (address >> (0 + 7 + 5 + 6 + 1 + 1 + 1)) & ((1 << 5) - 1);
504 auto get_signed_int = [](
int var,
int sign) {
return (
sign == 1) ? (
var * 1) : (
var * -1); };
506 dPhi12 = get_signed_int(dPhi12, sign12);
507 dPhi13 = get_signed_int(dPhi13, sign13);
508 dPhi14 = get_signed_int(dPhi14, sign14);
509 dPhi23 = get_signed_int(dPhi23, sign23);
510 dPhi24 = get_signed_int(dPhi24, sign24);
511 dPhi34 = get_signed_int(dPhi34, sign34);
513 CLCT1 = get_signed_int(CLCT1, CLCT1Sign);
514 CLCT2 = get_signed_int(CLCT2, CLCT2Sign);
515 CLCT3 = get_signed_int(CLCT3, CLCT3Sign);
516 CLCT4 = get_signed_int(CLCT4, CLCT4Sign);
521 bool use_lossy_eta =
true;
524 etaInt &= ((1 << 5) - 1);
532 if (mode_inv == 15) {
533 bool st2_off =
false;
534 bool st3_off =
false;
535 bool st4_off =
false;
537 dPhi13 = dPhi12 + dPhi23;
538 dPhi14 = dPhi13 + dPhi34;
539 dPhi24 = dPhi23 + dPhi34;
541 int sum_st1 =
abs(dPhi12 + dPhi13 + dPhi14);
542 int sum_st2 =
abs(-dPhi12 + dPhi23 + dPhi24);
543 int sum_st3 =
abs(-dPhi13 - dPhi23 + dPhi34);
544 int sum_st4 =
abs(-dPhi14 - dPhi24 - dPhi34);
547 if (sum_st2 > sum_st1 && sum_st2 > sum_st3 && sum_st2 > sum_st4)
549 if (sum_st3 > sum_st1 && sum_st3 > sum_st2 && sum_st3 > sum_st4)
551 if (sum_st4 > sum_st1 && sum_st4 > sum_st2 && sum_st4 > sum_st3)
556 if ((
abs(dPhi12) > 9 ||
abs(dPhi23) > 9 ||
abs(dPhi24) > 9) &&
557 (
abs(dPhi13) < 10 &&
abs(dPhi14) < 10 &&
abs(dPhi34) < 10)) {
563 if ((
abs(dPhi13) > 9 ||
abs(dPhi23) > 9 ||
abs(dPhi34) > 9) &&
564 (
abs(dPhi12) < 10 &&
abs(dPhi14) < 10 &&
abs(dPhi24) < 10)) {
570 if ((
abs(dPhi14) > 9 ||
abs(dPhi24) > 9 ||
abs(dPhi34) > 9) &&
571 (
abs(dPhi12) < 10 &&
abs(dPhi13) < 10 &&
abs(dPhi23) < 10)) {
572 if (
abs(dPhi13) <
abs(dPhi23))
591 sign23 = (dPhi23 > 0) ? 1 : 0;
592 sign34 = (dPhi34 > 0) ? 1 : 0;
594 sign23 = (dPhi23 < 0) ? 1 : 0;
595 sign34 = (dPhi34 < 0) ? 1 : 0;
598 dPhi12 = get_signed_int(
abs(dPhi12), sign12);
599 dPhi23 = get_signed_int(
abs(dPhi23), sign23);
600 dPhi34 = get_signed_int(
abs(dPhi34), sign34);
607 if (mode_inv == 14) {
614 bugged_CLCT2 = (address >> (0 + 7 + 5 + 1 + 1 + 3)) & ((1 << 2) - 1);
615 bugged_address = address & ~(((1 << 2) - 1) << (0 + 7 + 6 + 1 + 1 + 3));
616 bugged_address |= (bugged_CLCT2 & ((1 << 2) - 1)) << (0 + 7 + 6 + 1 + 1 + 3);
617 bugged_CLCT2 = (bugged_address >> (0 + 7 + 5 + 1 + 1 + 3)) & ((1 << 2) - 1);
619 CLCT2 = bugged_CLCT2;
620 CLCT2 = get_signed_int(CLCT2, CLCT2Sign);
628 std::vector<int>
variables = {dPhi12, dPhi13, dPhi14, dPhi23, dPhi24, dPhi34, dTheta12, dTheta13,
629 dTheta14, dTheta23, dTheta24, dTheta34, CLCT1, CLCT2, CLCT3, CLCT4,
630 CSCID1, CSCID2, CSCID3, CSCID4, FR1, FR2, FR3, FR4};
632 std::vector<double> tree_data;
633 tree_data.push_back(1.0);
634 tree_data.push_back(
eta);
636 for (
int i = 0;
i < 6;
i++) {
637 int mv = mode_variables[mode_inv - 3][
i];
640 if (!(mode_inv == 13 &&
i == 3)) {
643 tree_data.push_back(
v);
645 tree_data.push_back(0);
650 std::cout <<
"mode_inv: " << mode_inv <<
" variables: ";
651 for (
const auto&
v : tree_data)
656 auto tree_event = std::make_unique<emtf::Event>();
657 tree_event->predictedValue = 0;
658 tree_event->data = tree_data;
664 float tmp_pt = tree_event->predictedValue;
667 std::cout <<
"mode_inv: " << mode_inv <<
" 1/pT: " << tmp_pt << std::endl;
668 std::cout <<
"dPhi12: " << dPhi12 <<
" dPhi13: " << dPhi13 <<
" dPhi14: " << dPhi14 <<
" dPhi23: " << dPhi23
669 <<
" dPhi24: " << dPhi24 <<
" dPhi34: " << dPhi34 << std::endl;
670 std::cout <<
"dTheta12: " << dTheta12 <<
" dTheta13: " << dTheta13 <<
" dTheta14: " << dTheta14
671 <<
" dTheta23: " << dTheta23 <<
" dTheta24: " << dTheta24 <<
" dTheta34: " << dTheta34 << std::endl;
672 std::cout <<
"CLCT1: " << CLCT1 <<
" CLCT2: " << CLCT2 <<
" CLCT3: " << CLCT3 <<
" CLCT4: " << CLCT4 << std::endl;
673 std::cout <<
"CSCID1: " << CSCID1 <<
" CSCID2: " << CSCID2 <<
" CSCID3: " << CSCID3 <<
" CSCID4: " << CSCID4
675 std::cout <<
"FR1: " << FR1 <<
" FR2: " << FR2 <<
" FR3: " << FR3 <<
" FR4: " << FR4 << std::endl;
679 pt = (tmp_pt == 0) ? tmp_pt : 1.0 / tmp_pt;
688 pt = (tmp_pt == 0) ? tmp_pt : 1.0 / tmp_pt;