51 cout <<
"DTBtiChip::computeSums called" << endl;
89 if( _thisStepUsedHit[a-1]!=0 && _thisStepUsedHit[b-1]!=0 ){
90 _sums[s-1] = (
float)(_thisStepUsedHit[a-1]->jtrig() +
91 _thisStepUsedHit[b-1]->jtrig() );
92 _difs[s-1] = (
float)(_thisStepUsedHit[a-1]->jtrig() -
93 _thisStepUsedHit[b-1]->jtrig() );
108 reSumAr[2][-1 +2]=-1;
109 reSumAr[2][-2 +2]=-1;
121 reSumAr[0][-2 +2]=-1;
123 reSumAr23[2][ 2 +2]=1;
124 reSumAr23[2][ 1 +2]=1;
125 reSumAr23[2][ 0 +2]=1;
126 reSumAr23[2][-1 +2]=0;
127 reSumAr23[2][-2 +2]=0;
129 reSumAr23[1][ 2 +2]=1;
130 reSumAr23[1][ 1 +2]=1;
131 reSumAr23[1][ 0 +2]=0;
132 reSumAr23[1][-1 +2]=0;
133 reSumAr23[1][-2 +2]=0;
135 reSumAr23[0][ 2 +2]=1;
136 reSumAr23[0][ 1 +2]=0;
137 reSumAr23[0][ 0 +2]=0;
138 reSumAr23[0][-1 +2]=0;
139 reSumAr23[0][-2 +2]=-1;
150 float K0 =
config()->ST();
155 for(
int i=0;
i<32;
i++){
163 _Keq[
i][0] = _difs[1] + 2.*K0;
164 _Keq[
i][1] = -_sums[5] + 2.*K0;
165 _Keq[
i][2] = _sums[6];
166 _Keq[
i][3] = -(_sums[0]/2.) + 2.*K0 + 0.01;
167 _Keq[
i][4] = (_difs[8]/2.) + K0 + 0.01 ;
170 reSum( RE43 ,
int(fmod(
double(_difs[2]),3.)) ) +
171 int( (
double(_difs[2])/3.) );
176 float _difs_p0 = _difs[5];
180 if(_thisStepUsedHit[3-1]==0){
181 if(_hits[3-1].
size()==0 )
183 if(_hits[3-1].
size()>0 && (*(_hits[3-1].
begin()))->clockTime()<=-K0 )
187 TshiftB = _thisStepUsedHit[3-1]->jtrig();
189 if(_thisStepUsedHit[2-1]==0){
190 if(_hits[2-1].
size()==0 )
192 if(_hits[2-1].
size()>0 && (*(_hits[2-1].
begin()))->clockTime()<=-K0 )
196 TshiftC = _thisStepUsedHit[2-1]->jtrig();
198 _difs_p0 = (
float)(TshiftB - TshiftC);
201 _XeqAB_patt0 = (_sums[1] - K0) / 4.;
202 _Xeq[
i][0] = (_difs_p0 + K0) / 4.;
203 _XeqCD_patt0 = (_difs[6] + K0) / 4.;
204 _XeqAC_patt0 = -(_difs[0]) / 4.;
205 _XeqBD_patt0 = (_sums[8]) / 4.;
206 _Xeq[
i][1] = (_sums[2] - K0) / 4.;
223 _Keq[
i][0] = _difs[1] + 2.*K0;
224 _Keq[
i][1] = -(_sums[5]) + 2.*K0;
225 _Keq[
i][2] = -_difs[6] + 2.*K0;
226 _Keq[
i][3] = -(_sums[0]/2.) + 2.*K0 + 0.01;
227 _Keq[
i][4] = -(_sums[8]/2.) + 2.*K0 + 0.01;
230 reSum23( 0 ,
int(fmod(
double(-_sums[2]),3.)) ) +
231 int( (
double(-_sums[2])/3.) );
233 _Xeq[
i][0] = ( _difs[5] + K0) / 4.;
234 _Xeq[
i][1] = (-_difs[2] + K0) / 4.;
239 _Keq[
i][0] = _sums[1];
240 _Keq[
i][1] = -_sums[5] + 2.*K0;
241 _Keq[
i][2] = _sums[6];
242 _Keq[
i][3] = -(_difs[0]/2.) + K0 + 0.01;
243 _Keq[
i][4] = (_difs[8]/2.) + K0 + 0.01;
246 reSum23( RE23 ,
int(fmod(
double(_sums[2]),3.)) ) +
247 int( (
double(_sums[2])/3.) );
256 _Xeq[
i][0] = (_difs[5] + K0) / 4.;
257 _Xeq[
i][1] = (_difs[2] + K0) / 4.;
262 _Keq[
i][0] = _sums[1];
263 _Keq[
i][1] = -_sums[5] + 2.*K0;
264 _Keq[
i][2] = -_difs[6] + 2.*K0;
265 _Keq[
i][3] = -(_difs[0]/2.) + K0 + 0.01;
266 _Keq[
i][4] = -(_sums[8]/2.) + 2.*K0 + 0.01;
269 reSum( RE43 ,
int(fmod(
double(-_difs[2]),3.)) ) +
270 int( (
double(-_difs[2])/3.) );
273 _Xeq[
i][0] = ( _difs[5] + K0) / 4.;
274 _Xeq[
i][1] = (-_sums[2] + 3.*K0) / 4.;
280 _Keq[
i][0] = _difs[1] + 2.*K0;
281 _Keq[
i][1] = _difs[10] + 2.*K0;
282 _Keq[
i][2] = -(_sums[13]) + 2.*K0;
283 _Keq[
i][3] = (_difs[3]/2.) + 2.*K0 + 0.01;
284 _Keq[
i][4] = -(_sums[8]/2.) + 2.*K0 + 0.01;
287 reSum23( 0 ,
int(fmod(
double(-_sums[2]),3.)) ) +
288 int( (
double(-_sums[2])/3.) );
290 _Xeq[
i][0] = ( _sums[10] + K0) / 4.;
291 _Xeq[
i][1] = (-_difs[2] + K0) / 4.;
296 _Keq[
i][0] = _sums[1];
297 _Keq[
i][1] = _difs[10] + 2.*K0;
298 _Keq[
i][2] = -_sums[13] + 2.*K0;
299 _Keq[
i][3] = (_sums[3]/2.) + K0 + 0.01;
300 _Keq[
i][4] = -(_sums[8]/2.) + 2.*K0 + 0.01;
303 reSum( RE43 ,
int(fmod(
double(-_difs[2]),3.)) ) +
304 int( (
double(-_difs[2])/3.) );
306 _Xeq[
i][0] = ( _sums[10]+ K0) / 4.;
307 _Xeq[
i][1] = (-_sums[2] + 3.*K0) / 4.;
312 _Keq[
i][0] = -_difs[1] + 2.*K0;
313 _Keq[
i][1] = _sums[10];
314 _Keq[
i][2] = -_sums[13] + 2.*K0;
315 _Keq[
i][3] = (_sums[3]/2.) + K0 + 0.01;
316 _Keq[
i][4] = -(_difs[8]/2.) + K0 + 0.01;
319 reSum( RE43 ,
int(fmod(
double(-_difs[2]),3.)) ) +
320 int( (
double(-_difs[2])/3.) );
322 _Xeq[
i][0] = ( _difs[10]+ 3.*K0) / 4.;
323 _Xeq[
i][1] = (-_sums[2] + 3.*K0) / 4.;
328 _Keq[
i][0] = -_difs[1] + 2.*K0;
329 _Keq[
i][1] = (_sums[10]);
330 _Keq[
i][2] = _difs[20] + 2.*K0;
331 _Keq[
i][3] = (_sums[3]/2.) + K0 + 0.01;
332 _Keq[
i][4] = (_sums[11]/2.) + K0 + 0.01;
335 reSum( RE43 ,
int(fmod(
double(_sums[4]),3.)) ) +
336 int( (
double(_sums[4])/3.) );
338 _Xeq[
i][0] = (_difs[10]+ 3.*K0) / 4.;
339 _Xeq[
i][1] = (_difs[4] + 3.*K0) / 4.;
344 _Keq[
i][0] = -_difs[1] + 2.*K0;
345 _Keq[
i][1] = -_difs[10] + 2.*K0;
346 _Keq[
i][2] = (_sums[20]);
347 _Keq[
i][3] = -(_difs[3]/2.) + 2.*K0 + 0.01;
348 _Keq[
i][4] = (_sums[11]/2.) + K0 + 0.01;
351 reSum( RE43 ,
int(fmod(
double(_sums[4]),3.)) ) +
352 int( (
double(_sums[4])/3.) );
355 _Xeq[
i][0] = (-_sums[10]+ 5.*K0) / 4.;
356 _Xeq[
i][1] = ( _difs[4] + 3.*K0) / 4.;
361 _Keq[
i][0] = (_sums[1]);
362 _Keq[
i][1] = _difs[10] + 2.*K0;
363 _Keq[
i][2] = _difs[20] + 2.*K0;
364 _Keq[
i][3] = (_sums[3]/2.) + K0 + 0.01;
365 _Keq[
i][4] = (_difs[11]/2.) + 2.*K0 + 0.01;
368 reSum( RE43 ,
int(fmod(
double(_sums[4]),3.)) ) +
369 int( (
double(_sums[4])/3.) );
372 _Xeq[
i][0] = (_sums[10]+ K0) / 4.;
373 _Xeq[
i][1] = (_difs[4] + 3.*K0) / 4.;
378 _Keq[
i][0] = -_difs[9];
379 _Keq[
i][1] = -_sums[5] + 2.*K0;
380 _Keq[
i][2] = _sums[6];
381 _Keq[
i][3] = -(_sums[7]/2.) + K0 + 0.01;
382 _Keq[
i][4] = (_difs[8]/2.) + K0 + 0.01;
385 reSum23( RE23 ,
int(fmod(
double(-_difs[12]),3.)) ) +
386 int( (
double(-_difs[12])/3.) );
388 _Xeq[
i][0] = (_difs[5] + K0) / 4.;
389 _Xeq[
i][1] = (_sums[12]+ K0) / 4.;
394 _Keq[
i][0] = -_sums[9] + 2.*K0;
395 _Keq[
i][1] = _difs[5];
396 _Keq[
i][2] = _sums[6];
397 _Keq[
i][3] = -(_sums[7]/2.) + K0 + 0.01;
398 _Keq[
i][4] = (_sums[8]/2. + 0.01);
401 reSum23( RE23 ,
int(fmod(
double(-_difs[12]),3.)) ) +
402 int( (
double(-_difs[12])/3.) );
404 _Xeq[
i][0] = (-_sums[5] + 3.*K0) / 4.;
405 _Xeq[
i][1] = ( _sums[12]+ K0) / 4.;
410 _Keq[
i][0] = _difs[9];
411 _Keq[
i][1] = _difs[5];
412 _Keq[
i][2] = (_sums[6]);
413 _Keq[
i][3] = (_difs[7]/2.) + 0.01;
414 _Keq[
i][4] = (_sums[8]/2.) + 0.01;
415 _Keq[
i][5] = (_sums[12]/3.) + 0.51;
417 _Xeq[
i][0] = (-_sums[5] + 3. * K0) / 4.;
418 _Xeq[
i][1] = (-_difs[12]+ 3. * K0) / 4.;
423 _Keq[
i][0] = -_sums[9] + 2.*K0;
424 _Keq[
i][1] = _sums[10];
425 _Keq[
i][2] = -_difs[13];
426 _Keq[
i][3] = (_difs[16]/2.) + K0 + 0.01;
427 _Keq[
i][4] = (_sums[8]/2. + 0.01);
430 reSum23( RE23 ,
int(fmod(
double(-_difs[12]),3.)) ) +
431 int( (
double(-_difs[12])/3.) );
433 _Xeq[
i][0] = (_difs[10]+ 3.*K0) / 4.;
434 _Xeq[
i][1] = (_sums[12]+ K0) / 4.;
439 _Keq[
i][0] = -_sums[9] + 2.*K0;
440 _Keq[
i][1] = _sums[10];
441 _Keq[
i][2] = -_sums[13] + 2.*K0;
442 _Keq[
i][3] = (_difs[16]/2.) + K0 + 0.01;
443 _Keq[
i][4] = -(_difs[8]/2.) + K0 + 0.01;
446 reSum( RE43 ,
int(fmod(
double(-_sums[12]),3.)) ) +
447 int( (
double(-_sums[12])/3.) );
449 _Xeq[
i][0] = (_difs[10]+ 3.*K0) / 4.;
450 _Xeq[
i][1] = (_difs[12]+ 3.*K0) / 4.;
455 _Keq[
i][0] = _difs[9];
456 _Keq[
i][1] = (_sums[10]);
457 _Keq[
i][2] = -_difs[13];
458 _Keq[
i][3] = (_sums[16]/2. + 0.01);
459 _Keq[
i][4] = (_sums[8]/2. + 0.01);
460 _Keq[
i][5] = (_sums[12]/3.) + 0.51;
462 _Xeq[
i][0] = ( _difs[10]+ 3.*K0) / 4.;
463 _Xeq[
i][1] = (-_difs[12]+ 3.*K0) / 4.;
468 _Keq[
i][0] = _difs[9];
469 _Keq[
i][1] = _sums[10];
470 _Keq[
i][2] = -_sums[13] + 2.*K0;
471 _Keq[
i][3] = (_sums[16]/2. + 0.01);
472 _Keq[
i][4] = -(_difs[8]/2.) + K0 + 0.01;
475 reSum23( RE23 ,
int(fmod(
double(_difs[12]),3.)) ) +
476 int( (
double(_difs[12])/3.) );
478 _Xeq[
i][0] = ( _difs[10]+ 3.*K0) / 4.;
479 _Xeq[
i][1] = (-_sums[12]+ 5.*K0) / 4.;
484 _Keq[
i][0] = -_sums[9] + 2.*K0;
485 _Keq[
i][1] = _sums[10];
486 _Keq[
i][2] = _difs[20] + 2.*K0;
487 _Keq[
i][3] = (_difs[16]/2.) + K0 + 0.01;
488 _Keq[
i][4] = (_sums[11]/2.) + K0 + 0.01;
491 reSum( RE43 ,
int(fmod(
double(_difs[18]),3.)) ) +
492 int( (
double(_difs[18])/3.) );
494 _Xeq[
i][0] = (_difs[10]+ 3.*K0) / 4.;
495 _Xeq[
i][1] = (_sums[18]+ 3.*K0) / 4.;
500 _Keq[
i][0] = -_sums[9] + 2.*K0;
501 _Keq[
i][1] = -_difs[10] + 2.*K0;
502 _Keq[
i][2] = _sums[20];
503 _Keq[
i][3] = -(_sums[16]/2.) + 2.*K0 + 0.01;
504 _Keq[
i][4] = (_sums[11]/2.) + K0 + 0.01;
507 reSum( RE43 ,
int(fmod(
double(_difs[18]),3.)) ) +
508 int( (
double(_difs[18])/3.) );
510 _Xeq[
i][0] = (-_sums[10]+ 5.*K0) / 4.;
511 _Xeq[
i][1] = ( _sums[18]+ 3.*K0) / 4.;
516 _Keq[
i][0] = -(_sums[9]) + 2.*K0;
517 _Keq[
i][1] = -_difs[10] + 2.*K0;
518 _Keq[
i][2] = -_difs[20] + 2.*K0;
519 _Keq[
i][3] = -(_sums[16]/2.) + 2.*K0 + 0.01;
520 _Keq[
i][4] = -(_difs[11]/2.) + 2.*K0 + 0.01;
523 reSum23( 0 ,
int(fmod(
double(-_sums[18]),3.)) ) +
524 int( (
double(-_sums[18])/3.) );
526 _Xeq[
i][0] = (-_sums[10]+ 5.*K0) / 4.;
527 _Xeq[
i][1] = (-_difs[18]+ 5.*K0) / 4.;
532 _Keq[
i][0] = _sums[17];
533 _Keq[
i][1] = -_difs[19];
534 _Keq[
i][2] = -_sums[13] + 2.*K0;
535 _Keq[
i][3] = (_sums[16]/2. + 0.01);
536 _Keq[
i][4] = -(_sums[14]/2.) + K0 + 0.01;
539 reSum23( RE23 ,
int(fmod(
double(_difs[12]),3.)) ) +
540 int( (
double(_difs[12])/3.) );
542 _Xeq[
i][0] = ( _sums[19]+ 3.*K0) / 4.;
543 _Xeq[
i][1] = (-_sums[12]+ 5.*K0) / 4.;
548 _Keq[
i][0] = _sums[17];
549 _Keq[
i][1] = -_sums[19] + 2.*K0;
550 _Keq[
i][2] = _difs[13];
551 _Keq[
i][3] = -(_difs[16]/2.) + K0 + 0.01;
552 _Keq[
i][4] = -(_sums[14]/2.) + K0 + 0.01;
555 reSum23( RE23 ,
int(fmod(
double(_difs[12]),3.)) ) +
556 int( (
double(_difs[12])/3.) );
558 _Xeq[
i][0] = ( _difs[19]+ 5.*K0) / 4.;
559 _Xeq[
i][1] = (-_sums[12]+ 5.*K0) / 4.;
564 _Keq[
i][0] = (_sums[17]);
565 _Keq[
i][1] = -_difs[19];
566 _Keq[
i][2] = -_difs[13];
567 _Keq[
i][3] = (_sums[16]/2. + 0.01);
568 _Keq[
i][4] = -(_difs[14]/2.) + 0.01;
569 _Keq[
i][5] = (_sums[12]/3.) + 0.51;
571 _Xeq[
i][0] = ( _sums[19]+ 3.*K0) / 4.;
572 _Xeq[
i][1] = (-_difs[12]+ 3.*K0) / 4.;
577 _Keq[
i][0] = -_difs[23];
578 _Keq[
i][1] = -_difs[19];
579 _Keq[
i][2] = -(_sums[13]) + 2.*K0;
580 _Keq[
i][3] = -(_difs[21]/2.) + 0.01;
581 _Keq[
i][4] = -(_sums[14]/2.) + K0 + 0.01;
584 reSum23( RE23 ,
int(fmod(
double(-_sums[15]),3.)) ) +
585 int( (
double(-_sums[15])/3.) );
587 _Xeq[
i][0] = (_sums[19]+ 3.*K0) / 4.;
588 _Xeq[
i][1] = (_difs[15]+ 5.*K0) / 4.;
593 _Keq[
i][0] = -_difs[23];
594 _Keq[
i][1] = -(_sums[19]) + 2.*K0;
595 _Keq[
i][2] = _difs[13];
596 _Keq[
i][3] = -(_sums[21]/2.) + K0 + 0.01;
597 _Keq[
i][4] = -(_sums[14]/2.) + K0 + 0.01;
600 reSum23( RE23 ,
int(fmod(
double(-_sums[15]),3.)) ) +
601 int( (
double(-_sums[15])/3.) );
603 _Xeq[
i][0] = (_difs[19]+ 5.*K0) / 4.;
604 _Xeq[
i][1] = (_difs[15]+ 5.*K0) / 4.;
609 _Keq[
i][0] = -(_sums[23]) + 2.*K0;
610 _Keq[
i][1] = _difs[19];
611 _Keq[
i][2] = _difs[13];
612 _Keq[
i][3] = -(_sums[21]/2.) + K0 + 0.01;
613 _Keq[
i][4] = (_difs[14]/2.) + 0.01;
616 reSum23( RE23 ,
int(fmod(
double(-_sums[15]),3.)) ) +
617 int( (
double(-_sums[15])/3.) );
619 _Xeq[
i][0] = (-_sums[19]+ 7.*K0) / 4.;
620 _Xeq[
i][1] = ( _difs[15]+ 5.*K0) / 4.;
625 _Keq[
i][0] = _difs[17] + 2.*K0;
626 _Keq[
i][1] = -_sums[19] + 2.*K0;
627 _Keq[
i][2] = _sums[20];
628 _Keq[
i][3] = -(_sums[16]/2.) + 2.*K0 + 0.01;
629 _Keq[
i][4] = (_difs[22]/2.) + K0 + 0.01;
632 reSum( RE43 ,
int(fmod(
double(_difs[18]),3.)) ) +
633 int( (
double(_difs[18])/3.) );
635 _Xeq[
i][0] = (_difs[19] + 5.*K0) / 4.;
636 _Xeq[
i][1] = (_sums[18] + 3.*K0) / 4.;
641 _Keq[
i][0] = _difs[17] + 2.*K0;
642 _Keq[
i][1] = -(_sums[19]) + 2.*K0;
643 _Keq[
i][2] = -_difs[20] + 2.*K0;
644 _Keq[
i][3] = -(_sums[16]/2.) + 2.*K0 + 0.01;
645 _Keq[
i][4] = -(_sums[22]/2.) + 2.*K0 + 0.01;
648 reSum23( 0 ,
int(fmod(
double(-_sums[18]),3.)) ) +
649 int( (
double(-_sums[18])/3.) );
651 _Xeq[
i][0] = ( _difs[19] + 5.*K0) / 4.;
652 _Xeq[
i][1] = (-_difs[18] + 5.*K0) / 4.;
657 _Keq[
i][0] = _sums[17];
658 _Keq[
i][1] = -_sums[19] + 2.*K0;
659 _Keq[
i][2] = _sums[20];
660 _Keq[
i][3] = -(_difs[16]/2.) + K0 + 0.01;
661 _Keq[
i][4] = (_difs[22]/2.) + K0 + 0.01;
664 reSum23( RE23 ,
int(fmod(
double(_sums[18]),3.)) ) +
665 int( (
double(_sums[18])/3.) );
667 _Xeq[
i][0] = (_difs[19] + 5.*K0) / 4.;
668 _Xeq[
i][1] = (_difs[18] + 5.*K0) / 4.;
673 _Keq[
i][0] = _sums[17];
674 _Keq[
i][1] = -_sums[19] + 2.*K0;
675 _Keq[
i][2] = -_difs[20] + 2.*K0;
676 _Keq[
i][3] = -(_difs[16]/2.) + K0 + 0.01;
677 _Keq[
i][4] = -(_sums[22]/2.) + 2.*K0 + 0.01;
680 reSum( RE43 ,
int(fmod(
double(-_difs[18]),3.)) ) +
681 int( (
double(-_difs[18])/3.) );
683 _Xeq[
i][0] = ( _difs[19] + 5.*K0) / 4.;
684 _Xeq[
i][1] = (-_sums[18] + 7.*K0) / 4.;
689 _Keq[
i][0] = -_difs[23];
690 _Keq[
i][1] = -_sums[19] + 2.*K0;
691 _Keq[
i][2] = _sums[20];
692 _Keq[
i][3] = -(_sums[21]/2.) + K0 + 0.01;
693 _Keq[
i][4] = (_difs[22]/2.) + K0 + 0.01;
696 reSum23( RE23 ,
int(fmod(
double(-_difs[24]),3.)) ) +
697 int( (
double(-_difs[24])/3.) );
699 _Xeq[
i][0] = (_difs[19] + 5.*K0) / 4.;
700 _Xeq[
i][1] = (_sums[24] + 5.*K0) / 4.;
705 _Keq[
i][0] = -_sums[23] + 2.*K0;
706 _Keq[
i][1] = _difs[19];
707 _Keq[
i][2] = _sums[20];
708 _Keq[
i][3] = -(_sums[21]/2.) + K0 + 0.01;
709 _Keq[
i][4] = (_sums[22]/2.) + 0.01;
712 reSum23( RE23 ,
int(fmod(
double(-_difs[24]),3.)) ) +
713 int( (
double(-_difs[24])/3.) );
715 _Xeq[
i][0] = (-_sums[19] + 7.*K0) / 4.;
716 _Xeq[
i][1] = ( _sums[24] + 5.*K0) / 4.;
721 cout << endl <<
" Step: " << currentStep() << endl;
724 cout <<
"K Equation " << i <<
" --> ";
727 cout << _Keq[
i][j] <<
" ";
730 cout <<
"X Equation " << i <<
" --> ";
732 cout << _Xeq[
i][j] <<
" ";
735 cout << _XeqAB_patt0 <<
" " << _XeqCD_patt0 <<
" ";
736 cout << _XeqAC_patt0 <<
" " << _XeqBD_patt0 <<
" ";
void sum(const int s, const int a, const int b)