146 {
147 if ( datasize % window != 0 )
148 cerr << "ERROR: The data size is not completed in time windows" << endl;
149 uint32_t periods = datasize / window;
150 std::map<uint32_t, std::vector<uint32_t>>::iterator
iter = m_datamap.begin();
151 for ( ;
iter != m_datamap.end();
iter++ )
152 {
153 if (
iter->first != boardId )
continue;
154 std::vector<uint32_t>::iterator iter1 =
iter->second.begin();
155 for ( ; iter1 !=
iter->second.end(); iter1 += 5 )
156 {
157 uint32_t byteId = *( iter1 + 0 ) - 1;
158 uint32_t bitId = *( iter1 + 1 );
159 int layerId = *( iter1 + 2 ) - 1;
160 int wireId = *( iter1 + 3 ) - 1;
161 uint32_t data_type = *( iter1 + 4 );
162 int seriesOne = -100;
163 bool firstSOne = true;
164 bool flag_firstone( true ), flag_lastone( true );
165 for ( uint32_t i = 0; i < window; i++ )
166 {
167 if ( layerId < 0 || wireId < 0 ) continue;
168 if ( (
iter->first ) >= 226 && (
iter->first ) <= 233 )
169 {
170 if ( data_type == 1 )
171 {
172 if ( (
data[byteId + i * periods] >> bitId ) & 1 )
173 {
174 if ( layerId >= 36 && layerId <= 39 )
175 {
176 if ( flag_firstone && ( i - seriesOne != 1 ) && ( i != 0 ) )
177 {
178 m_mdchit_pre[layerId - 16][wireId] = i + 1;
179 flag_firstone = false;
180 }
181 if ( ( ( i - seriesOne ) != 1 ) &&
182 ( m_mdchit_aft[layerId - 16][wireId] != 0 ) )
183 flag_lastone = false;
184 if ( ( flag_firstone == false ) && ( ( i - seriesOne ) == 1 ) && flag_lastone )
185 m_mdchit_aft[layerId - 16][wireId] = i + 1;
186 if ( ( ( i - seriesOne ) == 1 ) && firstSOne )
187 m_mdchit_sone[layerId - 16][wireId] += 1;
188 if ( m_mdchit_sone[layerId - 16][wireId] != 0 && ( i - seriesOne ) != 1 )
189 firstSOne = false;
190 seriesOne = i;
191 m_mdchit_one[layerId - 16][wireId] += 1;
192 m_mdchit_win[layerId - 16][wireId] += 1 << i;
193 }
194 else
195 {
196 if ( flag_firstone && ( i - seriesOne != 1 ) && ( i != 0 ) )
197 {
198 m_mdchit_pre[layerId][wireId] = i + 1;
199 flag_firstone = false;
200 }
201 if ( ( ( i - seriesOne ) != 1 ) && ( m_mdchit_aft[layerId][wireId] != 0 ) )
202 flag_lastone = false;
203 if ( ( flag_firstone == false ) && ( ( i - seriesOne ) == 1 ) && flag_lastone )
204 m_mdchit_aft[layerId][wireId] = i + 1;
205 if ( ( ( i - seriesOne ) == 1 ) && firstSOne )
206 m_mdchit_sone[layerId][wireId] += 1;
207 if ( m_mdchit_sone[layerId][wireId] != 0 && ( i - seriesOne ) != 1 )
208 firstSOne = false;
209 seriesOne = i;
210 m_mdchit_one[layerId][wireId] += 1;
211 m_mdchit_win[layerId][wireId] += 1 << i;
212 }
213 }
214 }
215 if ( data_type == 0 )
216 {
217 if ( (
data[byteId + i * periods] >> bitId ) & 1 )
218 {
219 if ( layerId == 10 )
220 {
221 if ( flag_firstone && ( i - seriesOne != 1 ) && ( i != 0 ) )
222 {
223 m_mdctsf_pre[2][wireId] = i + 1;
224 flag_firstone = false;
225 }
226 if ( ( ( i - seriesOne ) != 1 ) && ( m_mdctsf_aft[2][wireId] != 0 ) )
227 flag_lastone = false;
228 if ( ( flag_firstone == false ) && ( ( i - seriesOne ) == 1 ) && flag_lastone )
229 m_mdctsf_aft[2][wireId] = i + 1;
230
231 if ( ( i - seriesOne ) == 1 && firstSOne ) m_mdctsf_sone[2][wireId] += 1;
232 if ( m_mdctsf_sone[2][wireId] != 0 && ( i - seriesOne ) != 1 )
233 firstSOne = false;
234 seriesOne = i;
235 m_mdctsf_one[2][wireId] += 1;
236 m_mdctsf_win[2][wireId] += 1 << i;
237 }
238 if ( layerId == 14 )
239 {
240 if ( flag_firstone && ( i - seriesOne != 1 ) && ( i != 0 ) )
241 {
242 m_mdctsf_pre[3][wireId] = i + 1;
243 flag_firstone = false;
244 }
245 if ( ( ( i - seriesOne ) != 1 ) && ( m_mdctsf_aft[3][wireId] != 0 ) )
246 flag_lastone = false;
247 if ( ( flag_firstone == false ) && ( ( i - seriesOne ) == 1 ) && flag_lastone )
248 m_mdctsf_aft[3][wireId] = i + 1;
249
250 if ( ( i - seriesOne ) == 1 && firstSOne ) m_mdctsf_sone[3][wireId] += 1;
251 if ( m_mdctsf_sone[3][wireId] != 0 && ( i - seriesOne ) != 1 )
252 firstSOne = false;
253 seriesOne = i;
254 m_mdctsf_one[3][wireId] += 1;
255 m_mdctsf_win[3][wireId] += 1 << i;
256 }
257 if ( layerId == 17 )
258 {
259 if ( flag_firstone && ( i - seriesOne != 1 ) && ( i != 0 ) )
260 {
261 m_mdctsf_pre[4][wireId] = i + 1;
262 flag_firstone = false;
263 }
264 if ( ( ( i - seriesOne ) != 1 ) && ( m_mdctsf_aft[4][wireId] != 0 ) )
265 flag_lastone = false;
266 if ( ( flag_firstone == false ) && ( ( i - seriesOne ) == 1 ) && flag_lastone )
267 m_mdctsf_aft[4][wireId] = i + 1;
268
269 if ( ( i - seriesOne ) == 1 && firstSOne ) m_mdctsf_sone[4][wireId] += 1;
270 if ( m_mdctsf_sone[4][wireId] != 0 && ( i - seriesOne ) != 1 )
271 firstSOne = false;
272 seriesOne = i;
273 m_mdctsf_one[4][wireId] += 1;
274 m_mdctsf_win[4][wireId] += 1 << i;
275 }
276 if ( layerId == 37 )
277 {
278 if ( flag_firstone && ( i - seriesOne != 1 ) && ( i != 0 ) )
279 {
280 m_mdctsf_pre[5][wireId] = i + 1;
281 flag_firstone = false;
282 }
283 if ( ( ( i - seriesOne ) != 1 ) && ( m_mdctsf_aft[5][wireId] != 0 ) )
284 flag_lastone = false;
285 if ( ( flag_firstone == false ) && ( ( i - seriesOne ) == 1 ) && flag_lastone )
286 m_mdctsf_aft[5][wireId] = i + 1;
287
288 if ( ( i - seriesOne ) == 1 && firstSOne ) m_mdctsf_sone[5][wireId] += 1;
289 if ( m_mdctsf_sone[5][wireId] != 0 && ( i - seriesOne ) != 1 )
290 firstSOne = false;
291 seriesOne = i;
292 m_mdctsf_one[5][wireId] += 1;
293 m_mdctsf_win[5][wireId] += 1 << i;
294 }
295 }
296 }
297 if ( data_type == 2 )
298 {
299 if ( (
data[byteId + i * periods] >> bitId ) & 1 )
300 {
301 if ( flag_firstone && ( i - seriesOne != 1 ) && ( i != 0 ) )
302 {
303 m_mdcltrk_pre[wireId] = i + 1;
304 flag_firstone = false;
305 }
306 if ( ( ( i - seriesOne ) != 1 ) && ( m_mdcltrk_aft[wireId] != 0 ) )
307 flag_lastone = false;
308 if ( ( flag_firstone == false ) && ( ( i - seriesOne ) == 1 ) && flag_lastone )
309 m_mdcltrk_aft[wireId] = i + 1;
310
311 if ( ( i - seriesOne ) == 1 && firstSOne ) m_mdcltrk_sone[wireId] += 1;
312 if ( m_mdcltrk_sone[wireId] != 0 && ( i - seriesOne ) != 1 ) firstSOne = false;
313 seriesOne = i;
314 m_mdcltrk_one[wireId] += 1;
315 m_mdcltrk_win[wireId] += 1 << i;
316 }
317 }
318 if ( data_type == 3 )
319 {
320 if ( (
data[byteId + i * periods] >> bitId ) & 1 )
321 {
322 if ( flag_firstone && ( i - seriesOne != 1 ) && ( i != 0 ) )
323 {
324 m_mdcstrk_pre[wireId] = i + 1;
325 flag_firstone = false;
326 }
327 if ( ( ( i - seriesOne ) != 1 ) && ( m_mdcstrk_aft[wireId] != 0 ) )
328 flag_lastone = false;
329 if ( ( flag_firstone == false ) && ( ( i - seriesOne ) == 1 ) && flag_lastone )
330 m_mdcstrk_aft[wireId] = i + 1;
331
332 if ( ( i - seriesOne ) == 1 && firstSOne ) m_mdcstrk_sone[wireId] += 1;
333 if ( m_mdcstrk_sone[wireId] != 0 && ( i - seriesOne ) != 1 ) firstSOne = false;
334 seriesOne = i;
335 m_mdcstrk_one[wireId] += 1;
336 m_mdcstrk_win[wireId] += 1 << i;
337 }
338 }
339 }
340
341 if ( (
iter->first ) == 234 )
342 {
343 if ( data_type == 0 )
344 {
345 if ( (
data[byteId + i * periods] >> bitId ) & 1 )
346 {
347 if ( layerId == 2 )
348 {
349 if ( ( i - seriesOne ) == 1 && firstSOne ) m_mdctsf_sone[0][wireId] += 1;
350 if ( m_mdctsf_sone[0][wireId] != 0 && ( i - seriesOne ) != 1 )
351 firstSOne = false;
352 seriesOne = i;
353 m_mdctsf_one[0][wireId] += 1;
354 }
355 if ( layerId == 6 )
356 {
357 if ( ( i - seriesOne ) == 1 && firstSOne ) m_mdctsf_sone[1][wireId] += 1;
358 if ( m_mdctsf_sone[1][wireId] != 0 && ( i - seriesOne ) != 1 )
359 firstSOne = false;
360 seriesOne = i;
361 m_mdctsf_one[1][wireId] += 1;
362 }
363 }
364 }
365 if ( data_type == 1 )
366 {
367 if ( (
data[byteId + i * periods] >> bitId ) & 1 )
368 {
369 if ( ( i - seriesOne ) == 1 && firstSOne ) m_mdchit_sone[layerId][wireId] += 1;
370 if ( m_mdchit_sone[layerId][wireId] != 0 && ( i - seriesOne ) != 1 )
371 firstSOne = false;
372 seriesOne = i;
373 m_mdchit_one[layerId][wireId] += 1;
374 }
375 }
376 if ( data_type == 4 )
377 {
378 if ( (
data[byteId + i * periods] >> bitId ) & 1 ) { m_mdcTrigCondi[wireId] = 1; }
379 }
380 }
381
382 if ( (
iter->first ) == 235 || (
iter->first ) == 236 )
383 {
384 if ( data_type == 2 )
385 {
386 if ( (
data[byteId + i * periods] >> bitId ) & 1 )
387 {
388 if ( ( i - seriesOne ) == 1 && firstSOne ) m_mdcltrkc_sone[wireId] += 1;
389 if ( m_mdcltrkc_sone[wireId] != 0 && ( i - seriesOne ) != 1 ) firstSOne = false;
390 seriesOne = i;
391 m_mdcltrkc_one[wireId] += 1;
392 if ( wireId >= 128 ) m_mdcTrigCondi[wireId - 126] = 1;
393 }
394 }
395 if ( data_type == 3 )
396 {
397 if ( (
data[byteId + i * periods] >> bitId ) & 1 )
398 {
399 if ( ( i - seriesOne ) == 1 && firstSOne ) m_mdcstrkc_sone[wireId] += 1;
400 if ( m_mdcstrkc_sone[wireId] != 0 && ( i - seriesOne ) != 1 ) firstSOne = false;
401 seriesOne = i;
402 m_mdcstrkc_one[wireId] += 1;
403 if ( wireId >= 128 ) m_mdcTrigCondi[wireId - 122] = 1;
404 }
405 }
406 }
407
408 }
409 }
410 }
411}