Event.
291{
292
293 B2INFO("trgrawdata: event() started.");
295
297 int _exp = bevt->getExperiment();
298 int _run = bevt->getRun();
299 unsigned _eve = bevt->getEvent();
300 if (0)
301 std::cout << "**************_eve(" << _eve
303 << "), m_nclk_cdctrg(" << m_nclk_cdctrg
304 << "), _exp(" << _exp
305 << "), _run(" << _run
306 << "), _eve(" << _eve
307 << "), _Form(" << Form("he%010d", (int)_eve)
308 << ")" << std::endl;
309
310 TH2D* h_0 = new TH2D(Form("he%010d", (int)_eve),
311 Form("e%02dr%04d ev %08d", _exp, _run, (int)_eve),
313 m_nclk_cdctrg, 0, m_nclk_cdctrg);
314
316 h_0->GetXaxis()->SetBinLabel(4 * i + 1, Form("%s hdevt", moduleNames[i]));
317 h_0->GetXaxis()->SetBinLabel(4 * i + 2, Form("%s dtevt", moduleNames[i]));
318 h_0->GetXaxis()->SetBinLabel(4 * i + 3, Form("%s L1rvc", moduleNames[i]));
319 h_0->GetXaxis()->SetBinLabel(4 * i + 4, Form("%s cc", moduleNames[i]));
320 }
321
322
323
324
325 unsigned gdlrvc12 = -1;
326 for (
int i = 0; i < raw_trgarray.
getEntries(); i++) {
327 for (int j = 0; j < raw_trgarray[i]->GetNumEntries(); j++) {
328 int cprid = (int)raw_trgarray[i]->GetNodeID(j);
329 unsigned eve20 = (_eve & 0xfffff);
330 for (int hslb = 0; hslb < 2; hslb++) {
331 int nword = raw_trgarray[i]->GetDetectorNwords(j, hslb);
332 int* buf = raw_trgarray[i]->GetDetectorBuffer(j, hslb);
333 if (0x15000001 == cprid && hslb == 0) {
334
335 if (m_mydebug) {
336 printf("aa:GDL start: 0x%x%c exp(%d), run(%d), eve(%u), eve(0x%x), nword(%d)\n",
337 cprid, 'a' + hslb, _exp, _run, _eve, _eve, nword);
338 }
339
340 unsigned buf0 = 0;
341 if (nword > 0) buf0 = (unsigned)buf[0];
342 unsigned buf1 = 0;
343 if (nword > 1) buf1 = (unsigned)buf[1];
344 unsigned buf2 = 0;
345 if (nword > 2) buf2 = (unsigned)buf[2];
346
347
348
349 if (nword < 3) {
350 cntr_nwe_badnwd[e_gdl]++;
351 printf("ab:GDL(0x%x%c) exp(%d), run(%d), eve(%u), eve(0x%x), nword(%d), ",
352 cprid, 'a' + hslb, _exp, _run, _eve, _eve, nword);
353 printf("buf0(0x%x), buf1(0x%x), buf2(0x%x)\n", buf0, buf1, buf2);
354 continue;
355 }
356
357 if (nword < 8) {
358 printf("ad:GDL(0x%x%c) exp(%d), run(%d), eve(%u), eve(0x%x), nword(%d)\n",
359 cprid, 'a' + hslb, _exp, _run, _eve, _eve, nword);
360 cntr_nwe_badnwd[e_gdl]++;
361 } else {
362 unsigned buf5 = (unsigned)buf[m_hdr_nwd_gdl - 1];
363
364 unsigned buf6 = (unsigned)buf[626];
365 unsigned buf7 = (unsigned)buf[627];
366 unsigned lastdd = (buf6 >> 24) & 0xff;
367 unsigned last_rvc = (buf6 >> 4) & 0xfff;
368 unsigned cnttrg_data_15to12 = buf6 & (0xf);
369 unsigned cnttrg_data_12 = (buf7 >> 20) & (0xfff);
370 gdlrvc12 = (buf5 & 0xfff);
371 unsigned gdlhdrcnttrg20 = (buf5 >> 12) & 0xfffff;
372
373
374
375
376
377
378 unsigned cnttrg_data_16 = (cnttrg_data_15to12 << 12) + cnttrg_data_12;
379 unsigned eve16 = (_eve & 0xffff);
380
381 h_0->SetBinContent(4 * (int)e_gdl + 1, m_nclk_gdl, gdlhdrcnttrg20);
382 h_0->SetBinContent(4 * (int)e_gdl + 2, m_nclk_gdl, cnttrg_data_16);
383 h_0->SetBinContent(4 * (int)e_gdl + 3, m_nclk_gdl, gdlrvc12);
384
385 if (nword != m_nwd_gdl || buf0 != m_fmid_gdl || lastdd != 0xdd ||
386 gdlhdrcnttrg20 != eve20 ||
387 !(eve16 == cnttrg_data_16 + 1 || (eve16 == 0 && cnttrg_data_16 == 0xffff))
388 ) {
389
390 unsigned diag = 0;
391 diag |= (nword != m_nwd_gdl) ? 1 : 0;
392 diag |= (buf0 != m_fmid_gdl) ? 2 : 0;
393 diag |= (lastdd != 0xdd) ? 4 : 0;
394 diag |= (gdlhdrcnttrg20 != eve20) ? 8 : 0;
395 diag |= !(eve16 == cnttrg_data_16 + 1 || (eve16 == 0 && cnttrg_data_16 == 0xffff)) ? 16 : 0;
396 printf("ae:GDL(0x%x%c) exp(%d), run(%d), evedaq(%u=0x%x), gdlhdrcnttrg20(%u,0x%x), "
397 "cnttrg_data16(%u=0x%x), l1rvc(%u)-lastrvc(%u)=%u, nword(%d), diag(%u)\n",
398 cprid, 'a' + hslb, _exp, _run, _eve, _eve, gdlhdrcnttrg20, gdlhdrcnttrg20,
399 cnttrg_data_16, cnttrg_data_16, gdlrvc12, last_rvc, gdlrvc12 - last_rvc, nword, diag);
400 printf("\n");
401 cntr_nwn_badtrg[e_gdl]++;
402 } else {
403 cntr_nwn[e_gdl]++;
404 }
405 }
406 }
407 }
408 }
409 }
410
411
412 for (
int i = 0; i < raw_trgarray.
getEntries(); i++) {
413 for (int j = 0; j < raw_trgarray[i]->GetNumEntries(); j++) {
414 unsigned cprid = raw_trgarray[i]->GetNodeID(j);
415
416 unsigned eve20 = (_eve & 0xfffff);
417 for (int hslb = 0; hslb < 2; hslb++) {
418 unsigned e_mdl = -1;
419 unsigned _nwd = -1;
420 unsigned _scale = -1;
421 unsigned _nclk = -1;
422 unsigned _hdr_nwd = 3;
423 if (m_cpr_2d0 == cprid && hslb == 0 && m_on_2d0) {
424 e_mdl = e_2d0; _nwd = m_nwd_2ds; _scale = m_scale_2ds; _nclk = m_nclk_2ds; _hdr_nwd = m_hdr_nwd_2d0;
425 } else if (m_cpr_2d1 == cprid && hslb == 1 && m_on_2d1) {
426 e_mdl = e_2d1; _nwd = m_nwd_2ds; _scale = m_scale_2ds; _nclk = m_nclk_2ds; _hdr_nwd = m_hdr_nwd_2d1;
427 } else if (m_cpr_2d2 == cprid && hslb == 0 && m_on_2d2) {
428 e_mdl = e_2d2; _nwd = m_nwd_2ds; _scale = m_scale_2ds; _nclk = m_nclk_2ds; _hdr_nwd = m_hdr_nwd_2d2;
429 } else if (m_cpr_2d3 == cprid && hslb == 1 && m_on_2d3) {
430 e_mdl = e_2d3; _nwd = m_nwd_2ds; _scale = m_scale_2ds; _nclk = m_nclk_2ds; _hdr_nwd = m_hdr_nwd_2d3;
431 } else if (m_cpr_3d0 == cprid && hslb == 0 && m_on_3d0) {
432 e_mdl = e_3d0; _nwd = m_nwd_3ds; _scale = m_scale_3ds; _nclk = m_nclk_3ds; _hdr_nwd = m_hdr_nwd_3d0;
433 } else if (m_cpr_3d1 == cprid && hslb == 1 && m_on_3d1) {
434 e_mdl = e_3d1; _nwd = m_nwd_3ds; _scale = m_scale_3ds; _nclk = m_nclk_3ds; _hdr_nwd = m_hdr_nwd_3d1;
435 } else if (m_cpr_3d2 == cprid && hslb == 0 && m_on_3d2) {
436 e_mdl = e_3d2; _nwd = m_nwd_3ds; _scale = m_scale_3ds; _nclk = m_nclk_3ds; _hdr_nwd = m_hdr_nwd_3d2;
437 } else if (m_cpr_3d3 == cprid && hslb == 1 && m_on_3d3) {
438 e_mdl = e_3d3; _nwd = m_nwd_3ds; _scale = m_scale_3ds; _nclk = m_nclk_3ds; _hdr_nwd = m_hdr_nwd_3d3;
439 } else if (m_cpr_nn0 == cprid && hslb == 0 && m_on_nn0) {
440 e_mdl = e_nn0; _nwd = m_nwd_nns; _scale = m_scale_nns; _nclk = m_nclk_nns; _hdr_nwd = m_hdr_nwd_nn0;
441 } else if (m_cpr_nn1 == cprid && hslb == 1 && m_on_nn1) {
442 e_mdl = e_nn1; _nwd = m_nwd_nns; _scale = m_scale_nns; _nclk = m_nclk_nns; _hdr_nwd = m_hdr_nwd_nn1;
443 } else if (m_cpr_nn2 == cprid && hslb == 0 && m_on_nn2) {
444 e_mdl = e_nn2; _nwd = m_nwd_nns; _scale = m_scale_nns; _nclk = m_nclk_nns; _hdr_nwd = m_hdr_nwd_nn2;
445 } else if (m_cpr_nn3 == cprid && hslb == 1 && m_on_nn3) {
446 e_mdl = e_nn3; _nwd = m_nwd_nns; _scale = m_scale_nns; _nclk = m_nclk_nns; _hdr_nwd = m_hdr_nwd_nn3;
447 } else if (m_cpr_sl0 == cprid && hslb == 0 && m_on_sl0) {
448 e_mdl = e_sl0; _nwd = m_nwd_sl0; _scale = m_scale_sl0; _nclk = m_nclk_sl0; _hdr_nwd = m_hdr_nwd_sl0;
449 } else if (m_cpr_sl1 == cprid && hslb == 0 && m_on_sl1) {
450 e_mdl = e_sl1; _nwd = m_nwd_sl1; _scale = m_scale_sl1; _nclk = m_nclk_sl1; _hdr_nwd = m_hdr_nwd_sl1;
451 } else if (m_cpr_sl2 == cprid && hslb == 0 && m_on_sl2) {
452 e_mdl = e_sl2; _nwd = m_nwd_sl2; _scale = m_scale_sl2; _nclk = m_nclk_sl2; _hdr_nwd = m_hdr_nwd_sl2;
453 } else if (m_cpr_sl3 == cprid && hslb == 1 && m_on_sl3) {
454 e_mdl = e_sl3; _nwd = m_nwd_sl3; _scale = m_scale_sl3; _nclk = m_nclk_sl3; _hdr_nwd = m_hdr_nwd_sl3;
455 } else if (m_cpr_sl4 == cprid && hslb == 1 && m_on_sl4) {
456 e_mdl = e_sl4; _nwd = m_nwd_sl4; _scale = m_scale_sl4; _nclk = m_nclk_sl4; _hdr_nwd = m_hdr_nwd_sl4;
457 } else if (m_cpr_sl5 == cprid && hslb == 1 && m_on_sl5) {
458 e_mdl = e_sl5; _nwd = m_nwd_sl5; _scale = m_scale_sl5; _nclk = m_nclk_sl5; _hdr_nwd = m_hdr_nwd_sl5;
459 } else if (m_cpr_sl6 == cprid && hslb == 0 && m_on_sl6) {
460 e_mdl = e_sl6; _nwd = m_nwd_sl6; _scale = m_scale_sl6; _nclk = m_nclk_sl6; _hdr_nwd = m_hdr_nwd_sl6;
461 } else if (m_cpr_sl8 == cprid && hslb == 0 && m_on_sl8) {
462 e_mdl = e_sl8; _nwd = m_nwd_sl8; _scale = m_scale_sl8; _nclk = m_nclk_sl8; _hdr_nwd = m_hdr_nwd_sl8;
463 } else if (m_cpr_etf == cprid && hslb == 1 && m_on_etf) {
464 e_mdl = e_etf; _nwd = m_nwd_etf; _scale = m_scale_etf; _nclk = m_nclk_etf; _hdr_nwd = m_hdr_nwd_etf;
465 } else if (m_cpr_top == cprid && hslb == 0 && m_on_top) {
466 e_mdl = e_top; _nwd = m_nwd_top; _scale = m_scale_top; _nclk = m_nclk_top; _hdr_nwd = m_hdr_nwd_top;
467 } else {
468 continue;
469 }
470
471 unsigned nword = raw_trgarray[i]->GetDetectorNwords(j, hslb);
472 int* buf = raw_trgarray[i]->GetDetectorBuffer(j, hslb);
473 unsigned buf0 = 0;
474 if (nword > 0) buf0 = (unsigned)buf[0];
475 unsigned buf1 = 0;
476 if (nword > 1) buf1 = (unsigned)buf[1];
477 unsigned buf2 = 0;
478 if (nword > 2) buf2 = (unsigned)buf[2];
479 unsigned buf2cnttrg20 = (buf2 >> 12) & 0xfffff;
480 unsigned buf2rvc12 = (buf2 & 0xfff);
481
482 if (nword < 3) {
483
484 cntr_nwe_badnwd[e_mdl]++;
485 printf("ah:%s(0x%x%c) exp(%d), run(%d), eve(%u), eve(0x%x), nword(%u), ",
486 moduleNames[e_mdl], cprid, 'a' + hslb, _exp, _run, _eve, _eve, nword);
487 printf("buf0(0x%x), buf1(0x%x), buf2(0x%x)\n", buf0, buf1, buf2);
488 continue;
489 } else if (nword == _hdr_nwd) {
490
491 if (gdlrvc12 != buf2rvc12) {
492 printf("ai:%s(0x%x%c) exp(%d), run(%d), eve(%u,0x%x), nword(%u), gdlrvc12(0x%x), buf2rvc12(0x%x)\n",
493 moduleNames[e_mdl], cprid, 'a' + hslb, _exp, _run, _eve, _eve, nword, gdlrvc12, buf2rvc12);
494 cntr_nw3_badrvc[e_mdl]++;
495 } else if (eve20 != buf2cnttrg20) {
496 printf("aj:%s(0x%x%c) exp(%d), run(%d), eve(%u,0x%x), nword(%u), cnttrg20(0x%x)\n",
497 moduleNames[e_mdl], cprid, 'a' + hslb, _exp, _run, _eve, _eve, nword, buf2cnttrg20);
498 cntr_nw3_badtrg[e_mdl]++;
499 } else if ((_eve % _scale) == 0) {
500 cntr_nw3_badvet[e_mdl]++;
501 } else {
502 cntr_nw3[e_mdl]++;
503 }
504 continue;
505 } else if (nword != _nwd) {
506
507 printf("bo:wrong nword: %s(0x%x%c) exp(%d), run(%d), eve(%u,0x%x), nword(%u), buf0(0x%x), buf2(0x%x)\n",
508 moduleNames[e_mdl], cprid, 'a' + hslb, _exp, _run, _eve, _eve, nword, buf0, buf2);
509 cntr_nwe_badnwd[e_mdl]++;
510 continue;
511 }
512
513 unsigned buf3 = (unsigned)buf[_hdr_nwd];
514 unsigned buf3dddd = ((buf3 >> 16) & 0xffff);
515 unsigned buf4 = (unsigned)buf[_hdr_nwd + 1];
516 unsigned buf5 = (unsigned)buf[_hdr_nwd + 2];
517 unsigned wdperclk = (_nwd - _hdr_nwd) / _nclk;
518
519 unsigned ibuf_lastclk_msw = _nwd - wdperclk;
520
521 unsigned buf_lastclk_msw2 = (unsigned)buf[ibuf_lastclk_msw + 1];
522 unsigned buf_lastclk_msw3 = (unsigned)buf[ibuf_lastclk_msw + 2];
523
524 unsigned datacnttrg32 = 0;
525 unsigned buf4_msb16 = (buf4 & 0xffff);
526 unsigned buf5_lsb16 = ((buf5 >> 16) & 0xffff);
527
528 if (m_mydebug) {
529 printf("af:Debug0: %s(0x%x%c) exp(%d), run(%d), eve(%u), eve(0x%x), nword(%u)\n",
530 moduleNames[e_mdl], cprid, 'a' + hslb, _exp, _run, _eve, _eve, nword);
531 }
532
533
534
535
536
537
538
539
540 if ((0x11000009 == cprid && hslb == 0) ||
541 (0x11000008 == cprid && hslb == 1) ||
542 (0x11000009 == cprid && hslb == 1)
543 ) {
544
545
546
547
548
549
550
551 datacnttrg32 = buf5;
552
553 } else if ((0x11000007 == cprid && hslb == 0) ||
554 (0x11000007 == cprid && hslb == 1) ||
555 (0x1100000a == cprid && hslb == 0)
556 ) {
557
558
559
560
561
562
563
564
565
566 datacnttrg32 = (buf4_msb16 << 16) + buf5_lsb16;
567
568 } else if ((m_cpr_2d0 == cprid && hslb == 0 && m_on_2d0) ||
569 (m_cpr_2d1 == cprid && hslb == 1 && m_on_2d1) ||
570 (m_cpr_2d2 == cprid && hslb == 0 && m_on_2d2) ||
571 (m_cpr_2d3 == cprid && hslb == 1 && m_on_2d3)) {
572
573
574
575
576 unsigned buf_lastclk_lsb = (unsigned)buf[_nwd - 1];
577 unsigned buf_lastclk_lsb2 = (unsigned)buf[_nwd - 2];
578
579
580
581 datacnttrg32 = ((buf_lastclk_lsb2 & 0xff) << 24) + (buf_lastclk_lsb >> 8);
582
583 } else if ((m_cpr_3d0 == cprid && hslb == 0 && m_on_3d0) ||
584 (m_cpr_3d1 == cprid && hslb == 1 && m_on_3d1) ||
585 (m_cpr_3d2 == cprid && hslb == 0 && m_on_3d2) ||
586 (m_cpr_3d3 == cprid && hslb == 1 && m_on_3d3)) {
587
588
589
590
591
592
593
594
595
596 unsigned datacnttrg_msb16 = (buf_lastclk_msw2 & 0xffff);
597 unsigned datacnttrg_lsb16 = ((buf_lastclk_msw3 >> 16) & 0xffff);
598 datacnttrg32 = (datacnttrg_msb16 << 16) + datacnttrg_lsb16;
599
600 } else if ((m_cpr_nn0 == cprid && hslb == 0 && m_on_nn0) ||
601 (m_cpr_nn1 == cprid && hslb == 1 && m_on_nn1) ||
602 (m_cpr_nn2 == cprid && hslb == 0 && m_on_nn2) ||
603 (m_cpr_nn3 == cprid && hslb == 1 && m_on_nn3)) {
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625 unsigned datacnttrg_msb16 = (buf_lastclk_msw2 & 0xffff);
626 unsigned datacnttrg_lsb16 = ((buf_lastclk_msw3 >> 16) & 0xffff);
627 datacnttrg32 = (datacnttrg_msb16 << 16) + datacnttrg_lsb16;
628 } else if (m_cpr_top == cprid && hslb == 0 && m_on_top) {
629
630 }
631
632 bool something_bad = false;
633 h_0->SetBinContent(4 * e_mdl + 1, _nclk, buf2cnttrg20);
634 h_0->SetBinContent(4 * e_mdl + 2, _nclk, datacnttrg32);
635 h_0->SetBinContent(4 * e_mdl + 3, _nclk, buf2rvc12);
636 if (gdlrvc12 != buf2rvc12) {
637 printf("ba:%s(0x%x%c) exp(%d), run(%d), eve(%u,0x%x), nword(%u), gdlrvc12(0x%x), buf2rvc12(0x%x)\n",
638 moduleNames[e_mdl], cprid, 'a' + hslb, _exp, _run, _eve, _eve, nword, gdlrvc12, buf2rvc12);
639 cntr_nwn_badrvc[e_mdl]++;
640 something_bad = true;
641 }
642 if (buf3dddd == 0xbbbb) {
643 cntr_nwn_badbbb[e_mdl]++;
644 printf("bv:%s(0x%x%c) exp(%d), run(%d), eve(%u,0x%x), nword(%u), cnttrg20(0x%x), dddd(0x%x), datacnttrg32(0x%x)\n",
645 moduleNames[e_mdl], cprid, 'a' + hslb, _exp, _run, _eve, _eve, nword, buf2cnttrg20, buf3dddd, datacnttrg32);
646 something_bad = true;
647 }
648 if (buf3dddd != 0xdddd) {
649 cntr_nwn_badddd[e_mdl]++;
650 printf("bb:%s(0x%x%c) exp(%d), run(%d), eve(%u,0x%x), nword(%u), cnttrg20(0x%x), dddd(0x%x), datacnttrg32(0x%x)\n",
651 moduleNames[e_mdl], cprid, 'a' + hslb, _exp, _run, _eve, _eve, nword, buf2cnttrg20, buf3dddd, datacnttrg32);
652 something_bad = true;
653 }
654 if (datacnttrg32 + 1 != _eve) {
655 if (!(
656 (m_cpr_top == cprid) ||
657 (m_cpr_3d0 <= cprid && cprid <= m_cpr_3d3)
658 )
659 ) {
660 printf("bc:%s(0x%x%c) exp(%d), run(%d), eve(%u,0x%x), nword(%u), cnttrg20(0x%x), dddd(0x%x), datacnttrg32(0x%x)\n",
661 moduleNames[e_mdl], cprid, 'a' + hslb, _exp, _run, _eve, _eve, nword, buf2cnttrg20, buf3dddd, datacnttrg32);
662 cntr_nwn_badtrg[e_mdl]++;
663 something_bad = true;
664 }
665 }
666 if (! something_bad) cntr_nwn[e_mdl]++;
667
668 }
669 }
670 }
671
672 if (m_cc_check) {
673 for (
int i = 0; i < raw_trgarray.
getEntries(); i++) {
674 for (int j = 0; j < raw_trgarray[i]->GetNumEntries(); j++) {
675 unsigned cprid = raw_trgarray[i]->GetNodeID(j);
676
677
678 unsigned _eveRaw = raw_trgarray[i]->GetEveNo(j);
679 if ((0x11000001 <= cprid && cprid <= 0x1100000a) ||
680 (0x15000001 <= cprid && cprid <= 0x15000002) ||
681 (0x12000001 == cprid)
682 ) {
683 } else {
684 continue;
685 }
686 for (int hslb = 0; hslb < 2; hslb++) {
687 int nclks = m_nclk_cdctrg;
688 unsigned _hdr_nwd = 3;
689 unsigned e_mdl = -1;
690 unsigned _nwd = -1;
691 if (m_cpr_top == cprid && hslb == 0 && m_on_top) {
692 e_mdl = e_top; _nwd = m_nwd_top;
693 nclks = m_nclk_top; _hdr_nwd = m_hdr_nwd_top;
694 } else if (m_cpr_2d0 == cprid && hslb == 0 && m_on_2d0) {
695 e_mdl = e_2d0; _nwd = m_nwd_2ds; _hdr_nwd = m_hdr_nwd_2d0;
696 } else if (m_cpr_2d1 == cprid && hslb == 1 && m_on_2d1) {
697 e_mdl = e_2d1; _nwd = m_nwd_2ds; _hdr_nwd = m_hdr_nwd_2d1;
698 } else if (m_cpr_2d2 == cprid && hslb == 0 && m_on_2d2) {
699 e_mdl = e_2d2; _nwd = m_nwd_2ds; _hdr_nwd = m_hdr_nwd_2d2;
700 } else if (m_cpr_2d3 == cprid && hslb == 1 && m_on_2d3) {
701 e_mdl = e_2d3; _nwd = m_nwd_2ds; _hdr_nwd = m_hdr_nwd_2d3;
702 } else if (m_cpr_3d0 == cprid && hslb == 0 && m_on_3d0) {
703 e_mdl = e_3d0; _nwd = m_nwd_3ds; _hdr_nwd = m_hdr_nwd_3d0;
704 } else if (m_cpr_3d1 == cprid && hslb == 1 && m_on_3d1) {
705 e_mdl = e_3d1; _nwd = m_nwd_3ds; _hdr_nwd = m_hdr_nwd_3d1;
706 } else if (m_cpr_3d2 == cprid && hslb == 0 && m_on_3d2) {
707 e_mdl = e_3d2; _nwd = m_nwd_3ds; _hdr_nwd = m_hdr_nwd_3d2;
708 } else if (m_cpr_3d3 == cprid && hslb == 1 && m_on_3d3) {
709 e_mdl = e_3d3; _nwd = m_nwd_3ds; _hdr_nwd = m_hdr_nwd_3d3;
710 } else if (m_cpr_nn0 == cprid && hslb == 0 && m_on_nn0) {
711 e_mdl = e_nn0; _nwd = m_nwd_nns; _hdr_nwd = m_hdr_nwd_nn0;
712 } else if (m_cpr_nn1 == cprid && hslb == 1 && m_on_nn1) {
713 e_mdl = e_nn1; _nwd = m_nwd_nns; _hdr_nwd = m_hdr_nwd_nn1;
714 } else if (m_cpr_nn2 == cprid && hslb == 0 && m_on_nn2) {
715 e_mdl = e_nn2; _nwd = m_nwd_nns; _hdr_nwd = m_hdr_nwd_nn2;
716 } else if (m_cpr_nn3 == cprid && hslb == 1 && m_on_nn3) {
717 e_mdl = e_nn3; _nwd = m_nwd_nns; _hdr_nwd = m_hdr_nwd_nn3;
718 } else if (m_cpr_sl0 == cprid && hslb == 0 && m_on_sl0) {
719 e_mdl = e_sl0; _nwd = m_nwd_sl0; _hdr_nwd = m_hdr_nwd_sl0;
720 } else if (m_cpr_sl1 == cprid && hslb == 0 && m_on_sl1) {
721 e_mdl = e_sl1; _nwd = m_nwd_sl1; _hdr_nwd = m_hdr_nwd_sl1;
722 } else if (m_cpr_sl2 == cprid && hslb == 0 && m_on_sl2) {
723 e_mdl = e_sl2; _nwd = m_nwd_sl2; _hdr_nwd = m_hdr_nwd_sl2;
724 } else if (m_cpr_sl3 == cprid && hslb == 1 && m_on_sl3) {
725 e_mdl = e_sl3; _nwd = m_nwd_sl3; _hdr_nwd = m_hdr_nwd_sl3;
726 } else if (m_cpr_sl4 == cprid && hslb == 1 && m_on_sl4) {
727 e_mdl = e_sl4; _nwd = m_nwd_sl4; _hdr_nwd = m_hdr_nwd_sl4;
728 } else if (m_cpr_sl5 == cprid && hslb == 1 && m_on_sl5) {
729 e_mdl = e_sl5; _nwd = m_nwd_sl5; _hdr_nwd = m_hdr_nwd_sl5;
730 } else if (m_cpr_sl6 == cprid && hslb == 0 && m_on_sl6) {
731 e_mdl = e_sl6; _nwd = m_nwd_sl6; _hdr_nwd = m_hdr_nwd_sl6;
732 } else if (m_cpr_sl8 == cprid && hslb == 0 && m_on_sl8) {
733 e_mdl = e_sl8; _nwd = m_nwd_sl8; _hdr_nwd = m_hdr_nwd_sl8;
734 } else if (m_cpr_etf == cprid && hslb == 1 && m_on_etf) {
735 e_mdl = e_etf; _nwd = m_nwd_etf; _hdr_nwd = m_hdr_nwd_etf;
736 } else if (m_cpr_gdl == cprid && hslb == 0 && m_on_gdl) {
737 e_mdl = e_gdl; _nwd = m_nwd_gdl;
738 nclks = m_nclk_gdl; _hdr_nwd = 6;
739 } else {
740 continue;
741 }
742 unsigned nword = raw_trgarray[i]->GetDetectorNwords(j, hslb);
743 if (nword == _hdr_nwd) continue;
744 if (nword != _nwd) {
745 printf("bu:Nword mismatch:nword(%u),expected(%u). eve(%u), %s(0x%x%c), nword(%u)\n",
746 nword, _nwd, _eveRaw, moduleNames[e_mdl], cprid, 'a' + hslb, nword);
747 }
748 int* buf = raw_trgarray[i]->GetDetectorBuffer(j, hslb);
749 int i47 = _hdr_nwd + (nclks - 1) * (_nwd - _hdr_nwd) / nclks;
750 if (i47 > int(nword) - 1) {
751 if (m_print_clkcyc_err)
752 printf("bp:data truncation. eve(%u), %s(0x%x%c), nword(%u)\n",
753 _eveRaw, moduleNames[e_mdl], cprid, 'a' + hslb, nword);
754 break;
755 }
756 unsigned buf47 = buf[i47];
757 bool break_this_module = false;
758 bool cc_disorder = false;
759
760 unsigned prev_cc = buf47 & 0xffff;
761 if (e_mdl == e_gdl) {
762 prev_cc = (buf47 >> 4) & 0xfff;
763 }
764 char ccc[400];
765 sprintf(ccc, "i47(%d),buf47(0x%x),%x", i47, buf47, prev_cc);
766 std::string ccs(ccc);
767 for (int clk = 0; clk < nclks; clk++) {
768 unsigned ibuf = _hdr_nwd + clk * (nword - _hdr_nwd) / nclks;
769 if (ibuf > nword - 1) {
770 if (m_print_clkcyc_err)
771 printf("bq:data truncation. eve(%u), %s(0x%x%c), nword(%u)\n",
772 _eveRaw, moduleNames[e_mdl], cprid, 'a' + hslb, nword);
773 break_this_module = true;
774 cntr_bad_nwd[e_mdl]++;
775 break;
776 }
777 unsigned ddddcc = buf[ibuf];
778 unsigned dddd = (ddddcc >> 16) & 0xffff;
779 unsigned cc = ddddcc & 0xffff;
780 if (e_mdl == e_gdl) {
781 cc = (ddddcc >> 4) & 0xfff;
782 }
783 h_0->SetBinContent(4 * e_mdl + 4, clk + 1, cc);
784 sprintf(ccc, ",%x", cc);
785 if ((int)e_2d0 <= (int)e_mdl && (int)e_mdl <= (int)e_2d3 &&
786 m_nwd_2ds == 3939) {
787
788
789
790
791
792
793
794
795
796
797
798 int i_addr = ibuf + 79;
799 int val_addr = buf[i_addr];
800 int addr_o = (val_addr >> 8) & 0xff;
801 int addr_i = val_addr & 0xff;
802 sprintf(ccc, ",%x(%d,%d)", cc, addr_i, addr_o);
803 }
804 ccs += ccc;
805 if (e_mdl == e_gdl) {
806 dddd = (ddddcc >> 24);
807 if (dddd != 0xdd) {
808 if (m_print_clkcyc_err)
809 printf("br:dddd not found. eve(%u), %s(0x%x%c), nword(%u)\n",
810 _eveRaw, moduleNames[e_mdl], cprid, 'a' + hslb, nword);
811 break_this_module = true;
812 cntr_bad_ddd[e_mdl]++;
813 break;
814 }
815 } else if (dddd != 0xdddd) {
816 if (m_print_clkcyc_err)
817 printf("bs:dddd not found. eve(%u), %s(0x%x%c), nword(%u)\n",
818 _eveRaw, moduleNames[e_mdl], cprid, 'a' + hslb, nword);
819 break_this_module = true;
820 cntr_bad_ddd[e_mdl]++;
821 break;
822 }
823
824 if (!(cc == prev_cc + 4 || prev_cc == cc + 4 * (nclks - 1) || prev_cc + 0x500 == cc + 4 * (nclks - 1)
825 || cc + 0x500 == prev_cc + 4)) {
826 cc_disorder = true;
827 ccs += "*";
828 }
829 prev_cc = cc;
830 }
831 if (break_this_module) continue;
832 if (cc_disorder) {
833 cntr_bad_odr[e_mdl]++;
834 if (m_print_cc) {
835 printf("bt:ccdisorder: eve(%u), %s(0x%x%c), nword(%u), %s\n",
836 _eveRaw, moduleNames[e_mdl], cprid, 'a' + hslb, nword, ccs.c_str());
837 }
838 } else {
839 cntr_good_odr[e_mdl]++;
840 }
841 }
842 }
843 }
844 }
845
846 if (! m_histRecord) {
847 h_0->Delete();
848 }
849}
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
Type-safe access to single objects in the data store.
static const unsigned int c_nModules
number of modules