51 {
52
53
54
55 constexpr bool SumETfast = true;
56
57
60
63
66
68
72
73
74
75
76
79 Ascaled[irow][jcolumn] = Atwr[irow][jcolumn] >> 2;
80 AgBlk[irow][jcolumn] = AgBlk[irow][jcolumn] >> 2;
81
82 Bscaled[irow][jcolumn] = Btwr[irow][jcolumn] >> 2;
83 BgBlk[irow][jcolumn] = BgBlk[irow][jcolumn] >> 2;
84
85 Cscaled[irow][jcolumn] = Ctwr[irow][jcolumn] >> 2;
86 CgBlk[irow][jcolumn] = CgBlk[irow][jcolumn] >> 2;
87
88 }
89 }
90
91
92
93 int A_MHT_x = 0x0;
94 int A_MHT_y = 0x0;
95 int A_MST_x = 0x0;
96 int A_MST_y = 0x0;
97 int A_MET_x = 0x0;
98 int A_MET_y = 0x0;
99
100 int A_eth = 0x0;
101 int A_ets = 0x0;
102 int A_etw = 0x0;
103
104
105 int B_MHT_x = 0x0;
106 int B_MHT_y = 0x0;
107 int B_MST_x = 0x0;
108 int B_MST_y = 0x0;
109 int B_MET_x = 0x0;
110 int B_MET_y = 0x0;
111
112 int B_eth = 0x0;
113 int B_ets = 0x0;
114 int B_etw = 0x0;
115
116
117 int C_MHT_x = 0x0;
118 int C_MHT_y = 0x0;
119 int C_MST_x = 0x0;
120 int C_MST_y = 0x0;
121 int C_MET_x = 0x0;
122 int C_MET_y = 0x0;
123
124 int C_eth = 0x0;
125 int C_ets = 0x0;
126 int C_etw = 0x0;
127
128
129 int MHT_x = 0x0;
130 int MHT_y = 0x0;
131 int MST_x = 0x0;
132 int MST_y = 0x0;
133 int MET_x = 0x0;
134 int MET_y = 0x0;
135
136 int ETH = 0x0;
137 int ETS = 0x0;
138 int ETW = 0x0;
139
140 int total_sumEt = 0x0;
142
143
144
145 int etBprime =0;
146
147 metFPGA(0, Ascaled, AgBlk,
m_gBlockthresholdA,
m_aFPGA_A,
m_bFPGA_A, A_MHT_x, A_MHT_y, A_MST_x, A_MST_y, A_MET_x, A_MET_y);
150
151 metFPGA(1, Bscaled, BgBlk,
m_gBlockthresholdB,
m_aFPGA_B,
m_bFPGA_B, B_MHT_x, B_MHT_y, B_MST_x, B_MST_y, B_MET_x, B_MET_y);
154
155 metFPGA(2, Cscaled, CgBlk,
m_gBlockthresholdC,
m_aFPGA_C,
m_bFPGA_C, C_MHT_x, C_MHT_y, C_MST_x, C_MST_y, C_MET_x, C_MET_y);
158
159 metTotal(A_MHT_x, A_MHT_y, B_MHT_x, B_MHT_y, C_MHT_x, C_MHT_y, MHT_x, MHT_y);
160 metTotal(A_MST_x, A_MST_y, B_MST_x, B_MST_y, C_MST_x, C_MST_y, MST_x, MST_y);
161 metTotal(A_MET_x, A_MET_y, B_MET_x, B_MET_y, C_MET_x, C_MET_y, MET_x, MET_y);
162
163 etTotal(A_eth, B_eth, C_eth, ETH);
164 etTotal(A_ets, B_ets, C_ets, ETS);
165 etTotal(A_etw, B_etw, C_etw, ETW);
166 total_sumEt = ETW;
167
168
169 int MET2 = MET_x * MET_x + MET_y * MET_y;
170
171 if (MET2 > 0x0FFFFFF) {
173 } else {
174
175 MET = std::sqrt(MET2);
176
177
178
179
180
181
182
183 }
184
185
186
187 std::vector<std::unique_ptr<gFEXJwoJTOB>> tobs_v;
188 tobs_v.resize(4);
189
190
191
192
193
194
195 outTOB[0] = (total_sumEt & 0x00000FFF) << 0;
196 outTOB[0] = outTOB[0] | (
MET & 0x00000FFF) << 12;
197 if (total_sumEt != 0) outTOB[0] = outTOB[0] | 0x00000001 << 24;
198 if (MET != 0) outTOB[0] = outTOB[0] | 0x00000001 << 25;
199 outTOB[0] = outTOB[0] | (1 & 0x0000001F) << 26;
200
201
202
203
204 outTOB[1] = (MET_y & 0x00000FFF) << 0;
205 outTOB[1] = outTOB[1] | (MET_x & 0x00000FFF) << 12;
206 if (MET_y != 0) outTOB[1] = outTOB[1] | 0x00000001 << 24;
207 if (MET_x != 0) outTOB[1] = outTOB[1] | 0x00000001 << 25;
208 outTOB[1] = outTOB[1] | (2 & 0x0000001F) << 26;
209
210
211 outTOB[2] = (MHT_y & 0x00000FFF) << 0;
212 outTOB[2] = outTOB[2] | (MHT_x & 0x00000FFF) << 12;
213 if (MHT_y != 0) outTOB[2] = outTOB[2] | 0x00000001 << 24;
214 if (MHT_x != 0) outTOB[2] = outTOB[2] | 0x00000001 << 25;
215 outTOB[2] = outTOB[2] | (3 & 0x0000001F) << 26;
216
217
218 outTOB[3] = (MST_y & 0x00000FFF) << 0;
219 outTOB[3] = outTOB[3] | (MST_x & 0x00000FFF) << 12;
220 if (MST_y != 0) outTOB[3] = outTOB[3] | 0x00000001 << 24;
221 if (MST_x != 0) outTOB[3] = outTOB[3] | 0x00000001 << 25;
222 outTOB[3] = outTOB[3] | (4 & 0x0000001F) << 26;
223
224
225 tobs_v[0] = std::make_unique<gFEXJwoJTOB>();
226 tobs_v[0]->setWord(outTOB[0]);
227 tobs_v[0]->setQuantity1(MET);
228 tobs_v[0]->setQuantity2(total_sumEt);
229 tobs_v[0]->setSaturation(0);
230 tobs_v[0]->setTobID(1);
231 if( MET != 0 ) tobs_v[0]->setStatus1(1);
232 else tobs_v[0]->setStatus1(0);
233 if(total_sumEt!= 0) tobs_v[0]->setStatus2(1);
234 else tobs_v[0]->setStatus2(0);
235
236 tobs_v[1] = std::make_unique<gFEXJwoJTOB>();
237 tobs_v[1]->setWord(outTOB[1]);
238 tobs_v[1]->setQuantity1(MET_x);
239 tobs_v[1]->setQuantity2(MET_y);
240 tobs_v[1]->setSaturation(0);
241 tobs_v[1]->setTobID(2);
242 if( MET_x != 0 ) tobs_v[1]->setStatus1(1);
243 else tobs_v[1]->setStatus1(0);
244 if(MET_y!= 0) tobs_v[1]->setStatus2(1);
245 else tobs_v[1]->setStatus2(0);
246
247 tobs_v[2] = std::make_unique<gFEXJwoJTOB>();
248 tobs_v[2]->setWord(outTOB[2]);
249 tobs_v[2]->setQuantity1(MHT_x);
250 tobs_v[2]->setQuantity2(MHT_y);
251 tobs_v[2]->setSaturation(0);
252 tobs_v[2]->setTobID(3);
253 if( MHT_x != 0 ) tobs_v[2]->setStatus1(1);
254 else tobs_v[2]->setStatus1(0);
255 if(MHT_y!= 0) tobs_v[2]->setStatus2(1);
256 else tobs_v[2]->setStatus2(0);
257
258 tobs_v[3] = std::make_unique<gFEXJwoJTOB>();
259 tobs_v[3]->setWord(outTOB[3]);
260 tobs_v[3]->setQuantity1(MST_x);
261 tobs_v[3]->setQuantity2(MST_y);
262 tobs_v[3]->setSaturation(0);
263 tobs_v[3]->setTobID(4);
264 if( MST_x != 0 ) tobs_v[3]->setStatus1(1);
265 else tobs_v[2]->setStatus1(0);
266 if(MST_y!= 0) tobs_v[3]->setStatus2(1);
267 else tobs_v[3]->setStatus2(0);
268
269
270 return tobs_v;
271
272}
static constexpr int ABcolumns
void etFastFPGA(int FPGAnum, const gTowersType &twrs, gTowersType &gBlkSum, int gBlockthreshold, int A, int B, int ð, int &ets, int &etw) const
void metFPGA(int FPGAnum, const gTowersType &twrs, const gTowersType &gBlkSum, int gBlockthreshold, int aFPGA, int bFPGA, int &MHT_x, int &MHT_y, int &MST_x, int &MST_y, int &MET_x, int &MET_y) const
void etFPGA(int FPGAnum, const gTowersType &twrs, gTowersType &gBlkSum, int gBlockthreshold, int A, int B, int ð, int &ets, int &etw) const
void metTotal(int A_MET_x, int A_MET_y, int B_MET_x, int B_MET_y, int C_MET_x, int C_MET_y, int &MET_x, int &MET_y) const
void gBlockAB(const gTowersType &twrs, gTowersType &gBlkSum, gTowersType &hasSeed, int seedThreshold) const
void etTotal(int A_ET, int B_ET, int C_ET, int &ET) const
std::array< std::array< int, 12 >, 32 > gTowersType