41 {
42
43
44 int A_MET_x_nc = 0x0;
45 int A_MET_y_nc = 0x0;
46 int A_MET_x_rms = 0x0;
47 int A_MET_y_rms = 0x0;
48
49 int A_sumEt_nc = 0x0;
50 int A_sumEt_rms = 0x0;
51
52
53 int B_MET_x_nc = 0x0;
54 int B_MET_y_nc = 0x0;
55 int B_MET_x_rms = 0x0;
56 int B_MET_y_rms = 0x0;
57
58 int B_sumEt_nc = 0x0;
59 int B_sumEt_rms = 0x0;
60
61
62 int C_MET_x_nc = 0x0;
63 int C_MET_y_nc = 0x0;
64 int C_MET_x_rms = 0x0;
65 int C_MET_y_rms = 0x0;
66
67 int C_sumEt_nc = 0x0;
68 int C_sumEt_rms = 0x0;
69
70
71 int MET_x_nc = 0x0;
72 int MET_y_nc = 0x0;
73 int MET_nc = 0x0;
74 int MET_x_rms = 0x0;
75 int MET_y_rms = 0x0;
76 int MET_rms = 0x0;
77
78
79 int total_sumEt_nc = 0x0;
80 int total_sumEt_rms = 0x0;
81
82 metFPGA(Atwr, A_MET_x_nc, A_MET_y_nc, 0);
83 metFPGA(Btwr, B_MET_x_nc, B_MET_y_nc, 1);
84 metFPGA(Ctwr, C_MET_x_nc, C_MET_y_nc, 2);
85
86 metTotal(A_MET_x_nc, A_MET_y_nc, B_MET_x_nc, B_MET_y_nc, C_MET_x_nc, C_MET_y_nc, MET_x_nc, MET_y_nc, MET_nc);
87
94
95 rho_MET(Atwr, A_MET_x_rms, A_MET_y_rms, A_rho, A_sigma);
96 rho_MET(Btwr, B_MET_x_rms, B_MET_y_rms, B_rho, B_sigma);
97 rho_MET(Ctwr, C_MET_x_rms, C_MET_y_rms, C_rho, C_sigma);
98
99 metTotal(A_MET_x_rms, A_MET_y_rms, B_MET_x_rms, B_MET_y_rms, C_MET_x_rms, C_MET_y_rms, MET_x_rms, MET_y_rms, MET_rms);
100
104 total_sumEt_nc =
sumEt(A_sumEt_nc, B_sumEt_nc, C_sumEt_nc);
105 total_sumEt_nc = total_sumEt_nc/4;
106
110 total_sumEt_rms =
sumEt(A_sumEt_rms, B_sumEt_rms, C_sumEt_rms);
111 total_sumEt_rms = total_sumEt_rms/4;
112
113
114
115
116
117
118
119
120
121
122
123
124 outTOB[0] = (MET_y_nc& 0x00000FFF) << 0;
125 outTOB[0] = outTOB[0] | (MET_x_nc & 0x00000FFF) << 12;
126 if (MET_y_nc != 0) outTOB[0] = outTOB[0] | 0x00000001 << 24;
127 if (MET_x_nc != 0) outTOB[0] = outTOB[0] | 0x00000001 << 25;
128 outTOB[0] = outTOB[0] | (2 & 0x0000001F) << 26;
129
130
131 outTOB[1] = (MET_y_rms& 0x00000FFF) << 0;
132 outTOB[1] = outTOB[1] | (MET_x_rms & 0x00000FFF) << 12;
133 if (MET_y_rms != 0) outTOB[1] = outTOB[1] | 0x00000001 << 24;
134 if (MET_x_rms != 0) outTOB[1] = outTOB[1] | 0x00000001 << 25;
135 outTOB[1] = outTOB[1] | (2 & 0x0000001F) << 26;
136
137
138 outTOB[2] = (total_sumEt_nc& 0x00000FFF) << 0;
139 outTOB[2] = outTOB[2] | (MET_nc & 0x00000FFF) << 12;
140 if (total_sumEt_nc != 0) outTOB[2] = outTOB[2] | 0x00000001 << 24;
141 if (MET_nc != 0) outTOB[2] = outTOB[2] | 0x00000001 << 25;
142 outTOB[2] = outTOB[2] | (1 & 0x0000001F) << 26;
143
144
145 outTOB[3] = (total_sumEt_rms& 0x00000FFF) << 0;
146 outTOB[3] = outTOB[3] | (MET_rms & 0x00000FFF) << 12;
147 if (total_sumEt_rms != 0) outTOB[3] = outTOB[3] | 0x00000001 << 24;
148 if (MET_rms != 0) outTOB[3] = outTOB[3] | 0x00000001 << 25;
149 outTOB[3] = outTOB[3] | (1 & 0x0000001F) << 26;
150
151
152}