55 {
56
57
58 SG::ReadCondHandle<gFEXDBCondData> myDBTool = SG::ReadCondHandle<gFEXDBCondData>(
m_DBToolKey);
61 throw std::runtime_error("Could not retrieve DB tool");
62 }
63
64 std::string fwVersion = myDBTool->get_FWVersion();
65 int major = std::stoi(fwVersion);
66 bool SumETfast = (major >= 1);
67 bool metRho = (major >= 2);
68
69
72
75
78
80
84
85
86
87
88
91 Ascaled[irow][jcolumn] = Atwr[irow][jcolumn] >> 2;
92 AgBlk[irow][jcolumn] = AgBlk[irow][jcolumn] >> 2;
93
94 Bscaled[irow][jcolumn] = Btwr[irow][jcolumn] >> 2;
95 BgBlk[irow][jcolumn] = BgBlk[irow][jcolumn] >> 2;
96
97 Cscaled[irow][jcolumn] = Ctwr[irow][jcolumn] >> 2;
98 CgBlk[irow][jcolumn] = CgBlk[irow][jcolumn] >> 2;
99
100 }
101 }
102
103
104
105 int A_MHT_x = 0x0;
106 int A_MHT_y = 0x0;
107 int A_MST_x = 0x0;
108 int A_MST_y = 0x0;
109 int A_MET_x = 0x0;
110 int A_MET_y = 0x0;
111
112 int A_eth = 0x0;
113 int A_ets = 0x0;
114 int A_etw = 0x0;
115
116
117 int B_MHT_x = 0x0;
118 int B_MHT_y = 0x0;
119 int B_MST_x = 0x0;
120 int B_MST_y = 0x0;
121 int B_MET_x = 0x0;
122 int B_MET_y = 0x0;
123
124 int B_eth = 0x0;
125 int B_ets = 0x0;
126 int B_etw = 0x0;
127
128
129 int C_MHT_x = 0x0;
130 int C_MHT_y = 0x0;
131 int C_MST_x = 0x0;
132 int C_MST_y = 0x0;
133 int C_MET_x = 0x0;
134 int C_MET_y = 0x0;
135
136 int C_eth = 0x0;
137 int C_ets = 0x0;
138 int C_etw = 0x0;
139
140
141 int MHT_x = 0x0;
142 int MHT_y = 0x0;
143 int MST_x = 0x0;
144 int MST_y = 0x0;
145 int MET_x = 0x0;
146 int MET_y = 0x0;
147
148 int ETH = 0x0;
149 int ETS = 0x0;
150 int ETW = 0x0;
151
152 int total_sumEt = 0x0;
154
155
156
157 int etBprime = 0;
158
159 if (metRho)
metFPGA_rho(0, Ascaled, pucA_JWJ, 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);
160 else 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);
163
164 if (metRho)
metFPGA_rho(1, Bscaled, pucB_JWJ, 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);
165 else 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);
168
169 if (metRho)
metFPGA_rho(2, Cscaled, pucC_JWJ, 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);
170 else 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);
173
174 metTotal(A_MHT_x, A_MHT_y, B_MHT_x, B_MHT_y, C_MHT_x, C_MHT_y, MHT_x, MHT_y);
175 metTotal(A_MST_x, A_MST_y, B_MST_x, B_MST_y, C_MST_x, C_MST_y, MST_x, MST_y);
176 metTotal(A_MET_x, A_MET_y, B_MET_x, B_MET_y, C_MET_x, C_MET_y, MET_x, MET_y);
177
178 etTotal(A_eth, B_eth, C_eth, ETH);
179 etTotal(A_ets, B_ets, C_ets, ETS);
180 etTotal(A_etw, B_etw, C_etw, ETW);
181 total_sumEt = ETW;
182
183
184 int MET2 = MET_x * MET_x + MET_y * MET_y;
185
186 if (MET2 > 0x0FFFFFF) {
188 } else {
189
190 MET = std::sqrt(MET2);
191
192
193
194
195
196
197
198 }
199
200
201
202 std::vector<std::unique_ptr<gFEXJwoJTOB>> tobs_v;
203 tobs_v.resize(4);
204
205
206
207
208
209
210 outTOB[0] = (total_sumEt & 0x00000FFF) << 0;
211 outTOB[0] = outTOB[0] | (
MET & 0x00000FFF) << 12;
212 if (total_sumEt != 0) outTOB[0] = outTOB[0] | 0x00000001 << 24;
213 if (MET != 0) outTOB[0] = outTOB[0] | 0x00000001 << 25;
214 outTOB[0] = outTOB[0] | (1 & 0x0000001F) << 26;
215
216
217
218
219 outTOB[1] = (MET_y & 0x00000FFF) << 0;
220 outTOB[1] = outTOB[1] | (MET_x & 0x00000FFF) << 12;
221 if (MET_y != 0) outTOB[1] = outTOB[1] | 0x00000001 << 24;
222 if (MET_x != 0) outTOB[1] = outTOB[1] | 0x00000001 << 25;
223 outTOB[1] = outTOB[1] | (2 & 0x0000001F) << 26;
224
225
226 outTOB[2] = (MHT_y & 0x00000FFF) << 0;
227 outTOB[2] = outTOB[2] | (MHT_x & 0x00000FFF) << 12;
228 if (MHT_y != 0) outTOB[2] = outTOB[2] | 0x00000001 << 24;
229 if (MHT_x != 0) outTOB[2] = outTOB[2] | 0x00000001 << 25;
230 outTOB[2] = outTOB[2] | (3 & 0x0000001F) << 26;
231
232
233 outTOB[3] = (MST_y & 0x00000FFF) << 0;
234 outTOB[3] = outTOB[3] | (MST_x & 0x00000FFF) << 12;
235 if (MST_y != 0) outTOB[3] = outTOB[3] | 0x00000001 << 24;
236 if (MST_x != 0) outTOB[3] = outTOB[3] | 0x00000001 << 25;
237 outTOB[3] = outTOB[3] | (4 & 0x0000001F) << 26;
238
239
240 tobs_v[0] = std::make_unique<gFEXJwoJTOB>();
241 tobs_v[0]->setWord(outTOB[0]);
242 tobs_v[0]->setQuantity1(MET);
243 tobs_v[0]->setQuantity2(total_sumEt);
244 tobs_v[0]->setSaturation(0);
245 tobs_v[0]->setTobID(1);
246 if( MET != 0 ) tobs_v[0]->setStatus1(1);
247 else tobs_v[0]->setStatus1(0);
248 if(total_sumEt!= 0) tobs_v[0]->setStatus2(1);
249 else tobs_v[0]->setStatus2(0);
250
251 tobs_v[1] = std::make_unique<gFEXJwoJTOB>();
252 tobs_v[1]->setWord(outTOB[1]);
253 tobs_v[1]->setQuantity1(MET_x);
254 tobs_v[1]->setQuantity2(MET_y);
255 tobs_v[1]->setSaturation(0);
256 tobs_v[1]->setTobID(2);
257 if( MET_x != 0 ) tobs_v[1]->setStatus1(1);
258 else tobs_v[1]->setStatus1(0);
259 if(MET_y!= 0) tobs_v[1]->setStatus2(1);
260 else tobs_v[1]->setStatus2(0);
261
262 tobs_v[2] = std::make_unique<gFEXJwoJTOB>();
263 tobs_v[2]->setWord(outTOB[2]);
264 tobs_v[2]->setQuantity1(MHT_x);
265 tobs_v[2]->setQuantity2(MHT_y);
266 tobs_v[2]->setSaturation(0);
267 tobs_v[2]->setTobID(3);
268 if( MHT_x != 0 ) tobs_v[2]->setStatus1(1);
269 else tobs_v[2]->setStatus1(0);
270 if(MHT_y!= 0) tobs_v[2]->setStatus2(1);
271 else tobs_v[2]->setStatus2(0);
272
273 tobs_v[3] = std::make_unique<gFEXJwoJTOB>();
274 tobs_v[3]->setWord(outTOB[3]);
275 tobs_v[3]->setQuantity1(MST_x);
276 tobs_v[3]->setQuantity2(MST_y);
277 tobs_v[3]->setSaturation(0);
278 tobs_v[3]->setTobID(4);
279 if( MST_x != 0 ) tobs_v[3]->setStatus1(1);
280 else tobs_v[2]->setStatus1(0);
281 if(MST_y!= 0) tobs_v[3]->setStatus2(1);
282 else tobs_v[3]->setStatus2(0);
283
284
285 return tobs_v;
286
287}
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 metFPGA_rho(int FPGAnum, const gTowersType &twrs, int puc_jwj, 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 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