559 |
} else { |
} else { |
560 |
ip[i] = pre - 1; |
ip[i] = pre - 1; |
561 |
}; |
}; |
562 |
if ( (base[l][m][ip[i]] == 31000. || base[l][m][ip[i]] == 0.) ){ |
if ( (base[l][m][ip[i]] == 31000. || base[l][m][ip[i]] == 0. || !crosst ) ){ |
563 |
// |
// |
564 |
ck = 2; |
ck = 2; |
565 |
if ( sbase[l][m][pre] == 31000. || sbase[l][m][pre] == 0. ) { |
if ( sbase[l][m][pre] == 31000. || sbase[l][m][pre] == 0. ) { |
573 |
// CALIBRATION ALGORITHM |
// CALIBRATION ALGORITHM |
574 |
// |
// |
575 |
if ( !doneb ){ |
if ( !doneb ){ |
576 |
|
if ( debug ) printf(" ck is %i \n",ck); |
577 |
switch (ck) { |
switch (ck) { |
578 |
case 0: |
case 0: |
579 |
base0 = base[l][m][pre]; |
base0 = base[l][m][pre]; |
580 |
base2 = calbase[l][m][pre]; |
base2 = calbase[l][m][pre]; |
581 |
|
if ( debug ) printf(" base0 = base l m pre = %f base2 = calbase l m pre = %f \n",base[l][m][pre],calbase[l][m][pre]); |
582 |
break; |
break; |
583 |
case 1: |
case 1: |
584 |
base0 = base[l][m][ip[i]]; |
base0 = base[l][m][ip[i]]; |
585 |
base2 = calbase[l][m][ip[i]]; |
base2 = calbase[l][m][ip[i]]; |
586 |
|
if ( debug ) printf(" base0 = base l m ip(i) = %f base2 = calbase l m ip(i) = %f \n",base[l][m][ip[i]],calbase[l][m][ip[i]]); |
587 |
break; |
break; |
588 |
case 2: |
case 2: |
589 |
base0 = sbase[l][m][pre]; |
base0 = sbase[l][m][pre]; |
590 |
base2 = calbase[l][m][pre]; |
base2 = calbase[l][m][pre]; |
591 |
|
if ( debug ) printf(" base0 = sbase l m pre = %f base2 = calbase l m pre = %f \n",sbase[l][m][pre],calbase[l][m][pre]); |
592 |
break; |
break; |
593 |
case 3: |
case 3: |
594 |
base0 = calbase[l][m][pre]; |
base0 = calbase[l][m][pre]; |
595 |
base2 = calbase[l][m][pre]; |
base2 = calbase[l][m][pre]; |
596 |
|
if ( debug ) printf(" base0 = calbase l m pre = %f base2 = calbase l m pre = %f \n",calbase[l][m][pre],calbase[l][m][pre]); |
597 |
break; |
break; |
598 |
}; |
}; |
599 |
base1 = calbase[l][m][pre]; |
base1 = calbase[l][m][pre]; |
603 |
ener0 += ener; |
ener0 += ener; |
604 |
clevel1->estrip[n][m][l] = 0.; |
clevel1->estrip[n][m][l] = 0.; |
605 |
if ( base0>0 && base0 < 30000. ){ |
if ( base0>0 && base0 < 30000. ){ |
606 |
if ( !donec && (base0 - base1 + base2) != 0. ){ |
// if ( !donec && (base0 - base1 + base2) != 0. ){ |
607 |
sbase[l][m][pre] = base0 - base1 + base2; |
// sbase[l][m][pre] = base0 - base1 + base2; |
608 |
|
if ( !donec && (base0 + base1 - base2) != 0. ){ |
609 |
|
sbase[l][m][pre] = base0 + base1 - base2; |
610 |
donec = 1; |
donec = 1; |
611 |
}; |
}; |
612 |
if ( ener > 0. ){ |
if ( ener > 0. ){ |
615 |
// OK, now in estrip we have the energy deposit in MIP of all the strips for this event (at the end of loops of course) |
// OK, now in estrip we have the energy deposit in MIP of all the strips for this event (at the end of loops of course) |
616 |
// |
// |
617 |
qpre[pre] += clevel1->estrip[n][m][l]; |
qpre[pre] += clevel1->estrip[n][m][l]; |
618 |
|
// |
619 |
|
// |
620 |
}; |
}; |
621 |
}; |
}; |
622 |
}; |
}; |