26 return StatusCode::SUCCESS;
32 std::vector<int>&& B_thr,
33 const int rhoPlusThr) {
42 std::array<uint32_t, 4> & outTOB)
const {
47 int A_MET_x_rms = 0x0;
48 int A_MET_y_rms = 0x0;
51 int A_sumEt_rms = 0x0;
56 int B_MET_x_rms = 0x0;
57 int B_MET_y_rms = 0x0;
60 int B_sumEt_rms = 0x0;
71 int total_sumEt_nc = 0x0;
72 int total_sumEt_rms = 0x0;
74 metFPGA(Atwr, A_MET_x_nc, A_MET_y_nc, 0);
75 metFPGA(Btwr, B_MET_x_nc, B_MET_y_nc, 1);
77 metTotal(A_MET_x_nc, A_MET_y_nc, B_MET_x_nc, B_MET_y_nc, MET_x_nc, MET_y_nc, MET_nc);
84 rho_MET(Atwr, A_MET_x_rms, A_MET_y_rms, A_rho, A_sigma);
85 rho_MET(Btwr, B_MET_x_rms, B_MET_y_rms, B_rho, B_sigma);
87 metTotal(A_MET_x_rms, A_MET_y_rms, B_MET_x_rms, B_MET_y_rms, MET_x_rms, MET_y_rms, MET_rms);
91 total_sumEt_nc =
sumEt(A_sumEt_nc, B_sumEt_nc);
92 total_sumEt_nc = total_sumEt_nc/4;
96 total_sumEt_rms =
sumEt(A_sumEt_rms, B_sumEt_rms);
97 total_sumEt_rms = total_sumEt_rms/4;
110 outTOB[0] = (MET_y_nc& 0x00000FFF) << 0;
111 outTOB[0] = outTOB[0] | (MET_x_nc & 0x00000FFF) << 12;
112 if (MET_y_nc != 0) outTOB[0] = outTOB[0] | 0x00000001 << 24;
113 if (MET_x_nc != 0) outTOB[0] = outTOB[0] | 0x00000001 << 25;
114 outTOB[0] = outTOB[0] | (2 & 0x0000001F) << 26;
117 outTOB[1] = (MET_y_rms& 0x00000FFF) << 0;
118 outTOB[1] = outTOB[1] | (MET_x_rms & 0x00000FFF) << 12;
119 if (MET_y_rms != 0) outTOB[1] = outTOB[1] | 0x00000001 << 24;
120 if (MET_x_rms != 0) outTOB[1] = outTOB[1] | 0x00000001 << 25;
121 outTOB[1] = outTOB[1] | (2 & 0x0000001F) << 26;
124 outTOB[2] = (total_sumEt_nc& 0x00000FFF) << 0;
125 outTOB[2] = outTOB[2] | (MET_nc & 0x00000FFF) << 12;
126 if (total_sumEt_nc != 0) outTOB[2] = outTOB[2] | 0x00000001 << 24;
127 if (MET_nc != 0) outTOB[2] = outTOB[2] | 0x00000001 << 25;
128 outTOB[2] = outTOB[2] | (1 & 0x0000001F) << 26;
131 outTOB[3] = (total_sumEt_rms& 0x00000FFF) << 0;
132 outTOB[3] = outTOB[3] | (MET_rms & 0x00000FFF) << 12;
133 if (total_sumEt_rms != 0) outTOB[3] = outTOB[3] | 0x00000001 << 24;
134 if (MET_rms != 0) outTOB[3] = outTOB[3] | 0x00000001 << 25;
135 outTOB[3] = outTOB[3] | (1 & 0x0000001F) << 26;
144 int rows = twrs.size();
145 int cols = twrs[0].size();
146 for(
int irow = 0; irow <
rows; irow++ ){
147 for(
int jcolumn = 0; jcolumn<
cols; jcolumn++){
149 MET_x +=
filter ? (twrs[irow][jcolumn])*
cosLUT(irow, 5) : 0;
150 MET_y +=
filter ? (twrs[irow][jcolumn])*
sinLUT(irow, 5) : 0;
158 const int B_MET_x,
const int B_MET_y,
159 int & MET_x,
int & MET_y,
int &
MET)
const {
161 MET_x = A_MET_x + B_MET_x;
162 MET_y = A_MET_y + B_MET_y;
164 if (MET_x < -0x0007FF) MET_x = -0x0007FF;
165 if (MET_y < -0x0007FF) MET_y = -0x0007FF;
167 if (MET_x > 0x0007FF) MET_x = 0x0007FF;
168 if (MET_y > 0x0007FF) MET_y = 0x0007FF;
170 int MET2 = MET_x * MET_x + MET_y * MET_y;
172 if (MET2 > 0x000FFF)
MET = 0x000FFF;
173 else if (MET2 < 0)
MET = 0x000FFF;
174 else MET = std::sqrt(MET2);
180 const int rows = twrs.size();
181 const int cols = twrs[0].size();
184 for(
int i = 0;
i <
rows;
i++) {
185 for(
int j = 0; j <
cols; j++) {
195 int rows = twrs.size();
196 int cols = twrs[0].size();
199 for(
int i = 0;
i <
rows; ++
i) {
200 for(
int j = 0; j <
cols; ++j) {
206 return static_cast<int>(std::sqrt(
sigma * 1. /
n));
213 int rows = twrs.size();
214 int cols = twrs[0].size();
215 for(
int irow = 0; irow <
rows; irow++ ){
216 for(
int jcolumn = 0; jcolumn <
cols; jcolumn++){
217 const int ET_gTower_sub{(twrs[irow][jcolumn] -
rho) & 0xFFF};
218 const bool filter{ET_gTower_sub >
sigma && !(ET_gTower_sub & 0x800)};
228 int partial_sumEt = 0;
229 const int rows = twrs.size();
230 const int cols = twrs[0].size();
231 for(
int irow = 0; irow <
rows; irow++ ){
232 for(
int jcolumn = 0; jcolumn<
cols; jcolumn++){
233 partial_sumEt += twrs[irow][jcolumn] >
m_etaThr[FPGA_NO][jcolumn] ? twrs[irow][jcolumn] : 0;
236 return partial_sumEt;
241 int partial_sumEt = 0;
242 const int rows = twrs.size();
243 const int cols = twrs[0].size();
245 for(
int j{0}; j <
cols; ++j) {
246 partial_sumEt += twrs[
i][j] >
sigma ? twrs[
i][j] : 0;
249 return partial_sumEt;
255 return A_sumEt + B_sumEt;