41 cout <<
"DTBtiChip::findTrig called" << endl;
57 for (
int i = 0;
i < 32;
i++) {
62 for (
int hl = 0; hl < 2; hl++) {
64 if (keepTrigPatt(PTMS[0], 0, 1, hl))
67 if (keepTrigPatt(PTMS[1], 1, 2, hl))
69 if (keepTrigPatt(PTMS[2], 2, 1, hl))
71 if (keepTrigPatt(PTMS[3], 3, 1, hl))
73 if (keepTrigPatt(PTMS[4], 4, 3, hl))
75 if (keepTrigPatt(PTMS[5], 5, 1, hl))
77 if (keepTrigPatt(PTMS[6], 6, 1, hl))
79 if (keepTrigPatt(PTMS[7], 7, 5, hl))
81 if (keepTrigPatt(PTMS[8], 8, 6, hl))
83 if (keepTrigPatt(PTMS[9], 9, 7, hl))
85 if (keepTrigPatt(PTMS[10], 10, 1, hl))
87 if (keepTrigPatt(PTMS[11], 11, 1, hl))
89 if (keepTrigPatt(PTMS[12], 12, 6, hl))
91 if (keepTrigPatt(PTMS[13], 13, 1, hl))
93 if (keepTrigPatt(PTMS[14], 14, 1, hl))
95 if (keepTrigPatt(PTMS[15], 15, 5, hl))
97 if (keepTrigPatt(PTMS[16], 16, 1, hl))
99 if (keepTrigPatt(PTMS[17], 17, 1, hl))
101 if (keepTrigPatt(PTMS[18], 18, 1, hl))
103 if (keepTrigPatt(PTMS[19], 19, 4, hl))
105 if (keepTrigPatt(PTMS[20], 20, 1, hl))
107 if (keepTrigPatt(PTMS[21], 21, 1, hl))
109 if (keepTrigPatt(PTMS[22], 22, 7, hl))
111 if (keepTrigPatt(PTMS[23], 23, 3, hl))
113 if (keepTrigPatt(PTMS[24], 24, 2, hl))
115 if (keepTrigPatt(PTMS[25], 25, 4, hl))
117 if (keepTrigPatt(PTMS[26], 26, 1, hl))
120 if (keepTrigPatt(PTMS[27], 27, 2, hl))
122 if (keepTrigPatt(PTMS[28], 28, 1, hl))
124 if (keepTrigPatt(PTMS[29], 29, 1, hl))
126 if (keepTrigPatt(PTMS[30], 30, 1, hl))
128 if (keepTrigPatt(PTMS[31], 31, 1, hl))
364 int tiKes =
config()->XON();
367 cout <<
"DTBtiChip::keepTrigPatt called with arguments: ";
368 cout << eq <<
", " << pattType <<
", " << hlflag << endl;
369 cout <<
"AC1,AC2,ACH,ACL=" <<
AC1 <<
" " <<
AC2 <<
" " <<
ACH <<
" " <<
ACL << endl;
380 float Keqfloat[6] = {0, 0, 0, 0, 0, 0};
381 for (
i = 0;
i < 6;
i++) {
383 int mk = (
int)(_Keq[eq][
i] - K0);
385 if (
abs(mk) > 2 * K0)
387 Keqfloat[
i] = _Keq[eq][
i];
388 mm[
i] = (
int)(_Keq[eq][
i]);
407 acceptMask(&val0, mm[0],
AC2);
408 acceptMask(&val1, mm[1],
AC2);
409 acceptMask(&val2, mm[2],
AC2);
414 acceptMask(&val0, mm[0],
AC1);
415 acceptMask(&val1, mm[1],
ACL);
416 acceptMask(&val2, mm[2],
AC1);
420 acceptMask(&val0, mm[0],
AC1);
421 acceptMask(&val1, mm[1],
AC1);
422 acceptMask(&val2, mm[2],
ACL);
426 acceptMask(&val0, mm[0],
ACL);
427 acceptMask(&val1, mm[1],
AC1);
428 acceptMask(&val2, mm[2],
AC1);
432 acceptMask(&val0, mm[0],
AC1);
433 acceptMask(&val1, mm[1],
ACH);
434 acceptMask(&val2, mm[2],
AC1);
438 acceptMask(&val0, mm[0],
AC1);
439 acceptMask(&val1, mm[1],
AC1);
440 acceptMask(&val2, mm[2],
ACH);
444 acceptMask(&val0, mm[0],
ACH);
445 acceptMask(&val1, mm[1],
AC1);
446 acceptMask(&val2, mm[2],
AC1);
450 acceptMask(&val0, mm[0],
AC2);
451 acceptMask(&val1, mm[1],
AC2);
452 acceptMask(&val2, mm[2],
AC2);
458 acceptMask(&val3, mm[3], acc);
459 acceptMask(&val4, mm[4], acc);
468 cout <<
" dump of val arrays: " << endl;
495 for (
i = 0;
i < 80;
i++) {
512 X =
int(_Xeq[eq][0]);
514 X =
int(_Xeq[eq][1]);
515 store(eq, code, LKMax,
X, Keqfloat[0], Keqfloat[1], Keqfloat[2], Keqfloat[3], Keqfloat[4], Keqfloat[5]);
528 cout <<
"SelTrig: searching low-B" << endl;
530 for (
i = 0;
i < 80;
i++) {
539 if (eq == 3 || eq == 13 || eq == 17 || eq == 21 || eq == 29) {
541 cout <<
"SelTrig: doing XON suppression!" << endl;
550 cout <<
"SelTrig: doing RON low triggers suppression!" << endl;
561 X =
int(_Xeq[eq][0]);
563 X =
int(_Xeq[eq][1]);
564 store(eq, code, LKMax,
X, Keqfloat[0], Keqfloat[1], Keqfloat[2], Keqfloat[3], Keqfloat[4], Keqfloat[5]);
572 cout <<
"SelTrig: searching low-C" << endl;
573 for (
i = 0;
i < 80;
i++) {
582 if (eq == 0 || eq == 6 || eq == 10 || eq == 16 || eq == 26 || eq == 30) {
584 cout <<
"SelTrig: doing XON suppression!" << endl;
596 X =
int(_Xeq[eq][0]);
598 X =
int(_Xeq[eq][1]);
599 store(eq, code, LKMax,
X, Keqfloat[0], Keqfloat[1], Keqfloat[2], Keqfloat[3], Keqfloat[4], Keqfloat[5]);
610 acceptMask(&val0, mm[0],
AC1);
611 acceptMask(&val1, mm[1],
AC1);
612 acceptMask(&val2, mm[2],
AC1);
617 cout <<
"SelTrig: searching low-A" << endl;
618 for (
i = 0;
i < 80;
i++) {
620 if (
val == 3 &&
i == mm[4]) {
627 if (eq == 9 || eq == 19 || eq == 22 || eq == 25) {
629 cout <<
"SelTrig: doing low-A XON suppression!" << endl;
637 cout <<
"SelTrig: doing RON low triggers suppression!" << endl;
664 cout <<
"SelTrig: searching low-D" << endl;
665 for (
i = 0;
i < 80;
i++) {
667 if (
val == 3 &&
i == mm[3]) {
674 if (eq == 4 || eq == 8 || eq == 12 || eq == 23) {
676 cout <<
"SelTrig: doing XON suppression!" << endl;
683 if (eq == 1 || eq == 2 || eq == 3 || eq == 24 || eq == 25) {
685 cout <<
"SelTrig: doing RON low triggers suppression!" << endl;
716 if (
k >= 0 &&
k < 78) {
718 cout <<
"DTBtiChip::acceptMask -> Setting acceptance for k=" <<
k << endl;
722 BitArrPtr->
set(
k - 1);
724 BitArrPtr->
set(
k + 1);
728 BitArrPtr->
set(
k + 1);
729 BitArrPtr->
set(
k + 2);
733 BitArrPtr->
set(
k - 2);
735 BitArrPtr->
set(
k - 1);
740 BitArrPtr->
set(
k - 2);
742 BitArrPtr->
set(
k - 1);
744 BitArrPtr->
set(
k + 1);
745 BitArrPtr->
set(
k + 2);
750 cout <<
"DTBtiChip::acceptMask -> END " << endl;
755 cout <<
"DTBtiChip::keepTrig called with arguments: ";
756 cout << eq <<
", " << acp <<
", " << code << endl;
764 for (
i = 0;
i < 6;
i++) {
766 int mk = (
int)(2 * _Keq[eq][
i]);
769 mm[
i] = (
int)(_Keq[eq][
i] * 2) + KCen;
777 if (mm[0] > 0 && (code == 8 || code == 3 || code == 4)) {
781 if (acp == 2 && (code == 8 || code == 3)) {
787 if (mm[1] > 0 && (code == 8 || code == 1 || code == 4)) {
791 if (acp == 2 && code == 8) {
797 if (mm[2] > 0 && (code == 8 || code == 1 || code == 2)) {
801 if (acp == 2 && (code == 8 || code == 2)) {
807 if (mm[3] > 0 && (code == 8 || code == 2 || code == 4)) {
813 if (mm[4] > 0 && (code == 8 || code == 1 || code == 3)) {
819 if (mm[5] > 0 && (code == 8 || code == 2 || code == 3)) {
825 cout <<
" dump of val arrays: " << endl;
849 for (
i = 0;
i < 80;
i++) {
862 if (KMax == 6 && code == 8) {
863 store(eq, 8, LKMax - KCen,
int(_Xeq[eq][1]));
865 }
else if (KMax == 3 && code != 8) {
866 if (code == 1 || code == 4) {
867 store(eq, code, LKMax - KCen,
int(_Xeq[eq][0]));
869 store(eq, code, LKMax - KCen,
int(_Xeq[eq][1]));