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