35 |
C aug-07 WM: artificial ADC creation revised: Now an ADC value is created |
C aug-07 WM: artificial ADC creation revised: Now an ADC value is created |
36 |
C only if there is a TDC value (before ADC was created in ANY |
C only if there is a TDC value (before ADC was created in ANY |
37 |
C case) |
C case) |
38 |
|
C jan-08 WM: Major Update: Time Walk correction introduced |
39 |
|
C Additionally we use the information from the "check_charge" |
40 |
|
C function to fill artificial ADC values and make small corrections |
41 |
|
C to the k1-parameter (for Z>2) |
42 |
|
C feb-08 WM: Calculation of beta(13) changed: First a mean beta is calculated, |
43 |
|
C then in a second step we check the residuals of the single |
44 |
|
C measurements, reject if > 10 sigma, calculate chi2 and "quality" |
45 |
|
C beta is taken as good if chi2<20 and quality>10 |
46 |
|
C The function "newbeta" is located in "tofl2com.for" |
47 |
|
C mar-08 WM: Call to "newbeta" changed, now a flag tells the function if the |
48 |
|
C call comes from "tofl2com" or form "toftrack" |
49 |
|
C mar-08 WM: Bug found in dEdx if check_charge>1 |
50 |
C |
C |
51 |
C**************************************************************************** |
C**************************************************************************** |
52 |
IMPLICIT NONE |
IMPLICIT NONE |
80 |
REAL ds |
REAL ds |
81 |
REAL t1,t2,t3,t4 |
REAL t1,t2,t3,t4 |
82 |
REAL yhelp,xhelp,xhelp1,xhelp2 |
REAL yhelp,xhelp,xhelp1,xhelp2 |
83 |
REAL c1,c2,sw,sxw,w_i |
REAL c1,c2 |
84 |
|
C REAL sw,sxw,w_i |
85 |
REAL dist,dl,F |
REAL dist,dl,F |
86 |
INTEGER icount,ievent |
INTEGER ievent |
87 |
REAL xhelp_a,xhelp_t |
C INTEGER icount |
88 |
|
C REAL beta_mean |
89 |
REAL beta_mean |
REAL btemp(12) |
90 |
REAL hepratio |
REAL hepratio |
91 |
|
|
92 |
INTEGER j |
INTEGER j,hitvec(6) |
93 |
|
|
94 |
real atten,pc_adc |
real atten,pc_adc,check_charge,newbeta |
95 |
|
|
96 |
|
|
97 |
REAL theta,phi |
REAL theta,phi |
107 |
INTEGER ihelp |
INTEGER ihelp |
108 |
REAL xkorr,xpos |
REAL xkorr,xpos |
109 |
|
|
110 |
|
INTEGER IZ |
111 |
|
REAL k1corrA1,k1corrB1,k1corrC1 |
112 |
|
|
113 |
REAL yl,yh,xl,xh |
REAL yl,yh,xl,xh |
114 |
C |
C |
115 |
REAL hmemor(9000000) |
REAL hmemor(9000000) |
117 |
C |
C |
118 |
DATA ievent / 0 / |
DATA ievent / 0 / |
119 |
|
|
120 |
|
INTEGER ifst |
121 |
|
DATA ifst /0/ |
122 |
|
|
123 |
COMMON / pawcd / hmemor |
COMMON / pawcd / hmemor |
124 |
save / pawcd / |
save / pawcd / |
125 |
C |
C |
132 |
|
|
133 |
******************************************************************* |
******************************************************************* |
134 |
|
|
135 |
ievent = ievent +1 |
if (ifst.eq.0) then |
136 |
|
ifst=1 |
137 |
|
|
138 |
C ratio helium to proton ca. 4 |
C ratio helium to proton ca. 4 |
139 |
hepratio = 4. |
hepratio = 4. |
149 |
itdc = 1 |
itdc = 1 |
150 |
iadc = 2 |
iadc = 2 |
151 |
|
|
152 |
|
|
153 |
|
k1corrA1 = 0. |
154 |
|
k1corrB1 = -5.0 |
155 |
|
k1corrC1= 8.0 |
156 |
|
|
157 |
|
ENDIF ! ifst |
158 |
|
|
159 |
|
******************************************************************* |
160 |
|
|
161 |
|
ievent = ievent +1 |
162 |
|
|
163 |
do i=1,13 |
do i=1,13 |
164 |
beta_a(i) = 100. |
beta_a(i) = 100. |
165 |
enddo |
enddo |
200 |
ytr_tof(j) = 100. |
ytr_tof(j) = 100. |
201 |
enddo |
enddo |
202 |
|
|
203 |
|
|
204 |
C---------------------------------------------------------------------- |
C---------------------------------------------------------------------- |
205 |
C-------------------------get ToF data -------------------------------- |
C-------------------------get ToF data -------------------------------- |
206 |
C we cannot use the tofxx(x,x,x) data from tofl2com since it is |
C we cannot use the tofxx(x,x,x) data from tofl2com since it is |
316 |
c write(*,*) AL_P |
c write(*,*) AL_P |
317 |
|
|
318 |
if (al_p(5).eq.0.) THEN |
if (al_p(5).eq.0.) THEN |
319 |
PRINT *,' TOF - WARNING F77: track with R = 0, discarded' |
c PRINT *,' TOF - WARNING F77: track with R = 0, discarded' |
320 |
GOTO 969 |
GOTO 969 |
321 |
ENDIF |
ENDIF |
322 |
* -------- *** tracking routine *** -------- |
* -------- *** tracking routine *** -------- |
327 |
C write(*,*) (TLOUT(i),i=1,6) |
C write(*,*) (TLOUT(i),i=1,6) |
328 |
|
|
329 |
if(IFAIL.ne.0)then |
if(IFAIL.ne.0)then |
330 |
print *,' TOF - WARNING F77: tracking failed ' |
c print *,' TOF - WARNING F77: tracking failed ' |
331 |
goto 969 |
goto 969 |
332 |
endif |
endif |
333 |
* ------------------------------------------ |
* ------------------------------------------ |
536 |
|
|
537 |
C write(*,*) tof11_i,tof12_i,tof21_i,tof22_i,tof31_i,tof32_i |
C write(*,*) tof11_i,tof12_i,tof21_i,tof22_i,tof31_i,tof32_i |
538 |
|
|
539 |
C----------------------------------------------------------------------- |
hitvec(1)=tof11_i |
540 |
C--------------------Insert Artifical TDC Value --------------------- |
hitvec(2)=tof12_i |
541 |
C For each Paddle perform check: |
hitvec(3)=tof21_i |
542 |
C if left paddle=4095 and right paddle OK => create TDC value left |
hitvec(4)=tof22_i |
543 |
C if right paddle=4095 and left paddle OK => create TDC value right |
hitvec(5)=tof31_i |
544 |
C----------------------------------------------------------------------- |
hitvec(6)=tof32_i |
|
|
|
|
C-----------------------S11 ----------------------------------------- |
|
|
|
|
|
IF (tof11_i.GT.none_find) THEN |
|
|
xpos = yout(1) |
|
|
i = tof11_i |
|
|
if ((tof11(1,tof11_i,itdc).EQ.4095).AND. |
|
|
& (tof11(2,tof11_i,itdc).LT.4095)) THEN |
|
|
|
|
|
c write(*,*)'11lb4 ',i,tof11(1,tof11_i,itdc),tof11(2,tof11_i,itdc) |
|
|
|
|
|
tof11(1,tof11_i,itdc) = tof11(2,tof11_i,itdc) |
|
|
& + 2*(y_coor_lin11(tof11_i,offset) |
|
|
& + xpos*y_coor_lin11(tof11_i,slope)) |
|
|
|
|
|
c write(*,*)'11laf ',i,tof11(1,tof11_i,itdc),tof11(2,tof11_i,itdc) |
|
|
|
|
|
tdcflag(ch11a(i),hb11a(i)) = 1 |
|
|
|
|
|
ENDIF |
|
|
if ((tof11(2,tof11_i,itdc).EQ.4095).AND. |
|
|
& (tof11(1,tof11_i,itdc).LT.4095)) THEN |
|
|
|
|
|
c write(*,*)'11rb4 ',i,tof11(1,tof11_i,itdc),tof11(2,tof11_i,itdc) |
|
|
|
|
|
tof11(2,tof11_i,itdc) = tof11(1,tof11_i,itdc) |
|
|
& - 2*(y_coor_lin11(tof11_i,offset) |
|
|
& + xpos*y_coor_lin11(tof11_i,slope)) |
|
|
c write(*,*)'11raf ',i,tof11(1,tof11_i,itdc),tof11(2,tof11_i,itdc) |
|
|
|
|
|
tdcflag(ch11b(i),hb11b(i)) = 1 |
|
|
ENDIF |
|
|
ENDIF |
|
|
|
|
|
C-----------------------S12 ----------------------------------------- |
|
|
|
|
|
IF (tof12_i.GT.none_find) THEN |
|
|
xpos = xout(2) |
|
|
i = tof12_i |
|
|
if ((tof12(1,tof12_i,itdc).EQ.4095).AND. |
|
|
& (tof12(2,tof12_i,itdc).LT.4095)) THEN |
|
|
tof12(1,tof12_i,itdc) = tof12(2,tof12_i,itdc) |
|
|
& + 2*(x_coor_lin12(tof12_i,offset) |
|
|
& + xpos*x_coor_lin12(tof12_i,slope)) |
|
|
tdcflag(ch12a(i),hb12a(i)) = 1 |
|
|
ENDIF |
|
|
if ((tof12(2,tof12_i,itdc).EQ.4095).AND. |
|
|
& (tof12(1,tof12_i,itdc).LT.4095)) THEN |
|
|
tof12(2,tof12_i,itdc) = tof12(1,tof12_i,itdc) |
|
|
& - 2*(x_coor_lin12(tof12_i,offset) |
|
|
& + xpos*x_coor_lin12(tof12_i,slope)) |
|
|
tdcflag(ch12b(i),hb12b(i)) = 1 |
|
|
ENDIF |
|
|
ENDIF |
|
|
|
|
|
C-----------------------S21 ----------------------------------------- |
|
|
|
|
|
IF (tof21_i.GT.none_find) THEN |
|
|
xpos = xout(3) |
|
|
i = tof21_i |
|
|
if ((tof21(1,tof21_i,itdc).EQ.4095).AND. |
|
|
& (tof21(2,tof21_i,itdc).LT.4095)) THEN |
|
|
tof21(1,tof21_i,itdc) = tof21(2,tof21_i,itdc) |
|
|
& + 2*(x_coor_lin21(tof21_i,offset) |
|
|
& + xpos*x_coor_lin21(tof21_i,slope)) |
|
|
tdcflag(ch21a(i),hb21a(i)) = 1 |
|
|
ENDIF |
|
|
if ((tof21(2,tof21_i,itdc).EQ.4095).AND. |
|
|
& (tof21(1,tof21_i,itdc).LT.4095)) THEN |
|
|
tof21(2,tof21_i,itdc) = tof21(1,tof21_i,itdc) |
|
|
& - 2*(x_coor_lin21(tof21_i,offset) |
|
|
& + xpos*x_coor_lin21(tof21_i,slope)) |
|
|
tdcflag(ch21b(i),hb21b(i)) = 1 |
|
|
ENDIF |
|
|
ENDIF |
|
|
|
|
|
C-----------------------S22 ----------------------------------------- |
|
|
|
|
|
IF (tof22_i.GT.none_find) THEN |
|
|
xpos = yout(4) |
|
|
i = tof22_i |
|
|
if ((tof22(1,tof22_i,itdc).EQ.4095).AND. |
|
|
& (tof22(2,tof22_i,itdc).LT.4095)) THEN |
|
|
tof22(1,tof22_i,itdc) = tof22(2,tof22_i,itdc) |
|
|
& + 2*(y_coor_lin22(tof22_i,offset) |
|
|
& + xpos*y_coor_lin22(tof22_i,slope)) |
|
|
tdcflag(ch22a(i),hb22a(i)) = 1 |
|
|
ENDIF |
|
|
if ((tof22(2,tof22_i,itdc).EQ.4095).AND. |
|
|
& (tof22(1,tof22_i,itdc).LT.4095)) THEN |
|
|
tof22(2,tof22_i,itdc) = tof22(1,tof22_i,itdc) |
|
|
& - 2*(y_coor_lin22(tof22_i,offset) |
|
|
& + xpos*y_coor_lin22(tof22_i,slope)) |
|
|
tdcflag(ch22b(i),hb22b(i)) = 1 |
|
|
ENDIF |
|
|
ENDIF |
|
545 |
|
|
546 |
C-----------------------S31 ----------------------------------------- |
c write(*,*) 'toftrk ', |
547 |
|
c & tof11_i,tof12_i,tof21_i,tof22_i,tof31_i,tof32_i |
548 |
|
|
549 |
IF (tof31_i.GT.none_find) THEN |
C---------------------------------------------------------------------- |
550 |
xpos = yout(5) |
C--- check charge: |
551 |
i = tof31_i |
C--- if Z=2 we should use the attenuation curve for helium to |
552 |
if ((tof31(1,tof31_i,itdc).EQ.4095).AND. |
C--- fill the artificail ADC values and NOT divide by "hepratio" |
553 |
& (tof31(2,tof31_i,itdc).LT.4095)) THEN |
C--- if Z>2 we should do a correction to |
554 |
tof31(1,tof31_i,itdc) = tof31(2,tof31_i,itdc) |
C--- the k1 constants in the beta calculation |
555 |
& + 2*(y_coor_lin31(tof31_i,offset) |
C---------------------------------------------------------------------- |
|
& + xpos*y_coor_lin31(tof31_i,slope)) |
|
|
tdcflag(ch31a(i),hb31a(i)) = 1 |
|
|
ENDIF |
|
|
if ((tof31(2,tof31_i,itdc).EQ.4095).AND. |
|
|
& (tof31(1,tof31_i,itdc).LT.4095)) THEN |
|
|
tof31(2,tof31_i,itdc) = tof31(1,tof31_i,itdc) |
|
|
& - 2*(y_coor_lin31(tof31_i,offset) |
|
|
& + xpos*y_coor_lin31(tof31_i,slope)) |
|
|
tdcflag(ch31b(i),hb31b(i)) = 1 |
|
|
ENDIF |
|
|
ENDIF |
|
556 |
|
|
557 |
C-----------------------S32 ----------------------------------------- |
theta=0. |
558 |
|
dist = ZTOF(1) - ZTOF(5) |
559 |
|
dl = 0. |
560 |
|
DO I=1,5 |
561 |
|
dl = dl + TLOUT(i) |
562 |
|
ENDDO |
563 |
|
F = dl/dist |
564 |
|
theta = acos(1/F) |
565 |
|
|
566 |
IF (tof32_i.GT.none_find) THEN |
iz = int(check_charge(theta,hitvec)) |
567 |
xpos = xout(6) |
c write(*,*) 'in toftrk',iz |
|
i = tof32_i |
|
|
if ((tof32(1,tof32_i,itdc).EQ.4095).AND. |
|
|
& (tof32(2,tof32_i,itdc).LT.4095)) THEN |
|
|
tof32(1,tof32_i,itdc) = tof32(2,tof32_i,itdc) |
|
|
& + 2*(x_coor_lin32(tof32_i,offset) |
|
|
& + xpos*x_coor_lin32(tof32_i,slope)) |
|
|
tdcflag(ch32a(i),hb32a(i)) = 1 |
|
|
ENDIF |
|
|
if ((tof32(2,tof32_i,itdc).EQ.4095).AND. |
|
|
& (tof32(1,tof32_i,itdc).LT.4095)) THEN |
|
|
tof32(2,tof32_i,itdc) = tof32(1,tof32_i,itdc) |
|
|
& - 2*(x_coor_lin32(tof32_i,offset) |
|
|
& + xpos*x_coor_lin32(tof32_i,slope)) |
|
|
tdcflag(ch32b(i),hb32b(i)) = 1 |
|
|
ENDIF |
|
|
ENDIF |
|
568 |
|
|
569 |
C-------------------------------------------------------------------- |
C-------------------------------------------------------------------- |
570 |
C---- if paddle hit: if we have TDC value but no ADC, create ADC value |
C---- if paddle hit: if we have TDC value but no ADC, create ADC value |
582 |
yhelp=yout(1) |
yhelp=yout(1) |
583 |
IF (tof11_i.GT.none_find.AND.abs(yout(1)).lt.100) THEN |
IF (tof11_i.GT.none_find.AND.abs(yout(1)).lt.100) THEN |
584 |
i = tof11_i |
i = tof11_i |
585 |
if ((tof11(left,tof11_i,itdc).LT.4095).AND. |
if ((tdc(ch11a(i),hb11a(i)).lt.4095).AND. |
586 |
& (adc(ch11a(i),hb11a(i)).eq.4095)) then |
& (adc(ch11a(i),hb11a(i)).eq.4095)) then |
587 |
phi = atan(tan(THYOUT(1))/tan(THXOUT(1))) |
phi = atan(tan(THYOUT(1))/tan(THXOUT(1))) |
588 |
theta = atan(tan(THXOUT(1))/cos(phi)) |
theta = atan(tan(THXOUT(1))/cos(phi)) |
|
c xkorr=adcx11(left,i,1)*exp(-yhelp/adcx11(left,i,2)) |
|
589 |
xkorr = atten(left,11,i,yhelp) |
xkorr = atten(left,11,i,yhelp) |
590 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
591 |
tof11(left,i,iadc)=xkorr/cos(theta) |
tof11(left,i,iadc)=xkorr/cos(theta) |
592 |
adcflag(ch11a(i),hb11a(i)) = 1 |
adcflag(ch11a(i),hb11a(i)) = 1 |
593 |
endif |
endif |
594 |
if ((tof11(right,tof11_i,itdc).LT.4095).AND. |
if ((tdc(ch11b(i),hb11b(i)).lt.4095).AND. |
595 |
& (adc(ch11b(i),hb11b(i)).eq.4095)) then |
& (adc(ch11b(i),hb11b(i)).eq.4095)) then |
596 |
phi = atan(tan(THYOUT(1))/tan(THXOUT(1))) |
phi = atan(tan(THYOUT(1))/tan(THXOUT(1))) |
597 |
theta = atan(tan(THXOUT(1))/cos(phi)) |
theta = atan(tan(THXOUT(1))/cos(phi)) |
|
c xkorr=adcx11(right,i,1)*exp(yhelp/adcx11(right,i,2)) |
|
598 |
xkorr = atten(right,11,i,yhelp) |
xkorr = atten(right,11,i,yhelp) |
599 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
600 |
tof11(right,i,iadc)=xkorr/cos(theta) |
tof11(right,i,iadc)=xkorr/cos(theta) |
601 |
adcflag(ch11b(i),hb11b(i)) = 1 |
adcflag(ch11b(i),hb11b(i)) = 1 |
602 |
endif |
endif |
605 |
xhelp=xout(2) |
xhelp=xout(2) |
606 |
IF (tof12_i.GT.none_find.AND.abs(xout(2)).lt.100) THEN |
IF (tof12_i.GT.none_find.AND.abs(xout(2)).lt.100) THEN |
607 |
i = tof12_i |
i = tof12_i |
608 |
if ((tof12(left,tof12_i,itdc).LT.4095).AND. |
if ((tdc(ch12a(i),hb12a(i)).lt.4095).AND. |
609 |
& (adc(ch12a(i),hb12a(i)).eq.4095)) then |
& (adc(ch12a(i),hb12a(i)).eq.4095)) then |
610 |
phi = atan(tan(THYOUT(2))/tan(THXOUT(2))) |
phi = atan(tan(THYOUT(2))/tan(THXOUT(2))) |
611 |
theta = atan(tan(THXOUT(2))/cos(phi)) |
theta = atan(tan(THXOUT(2))/cos(phi)) |
612 |
c xkorr=adcx12(left,i,1)*exp(-xhelp/adcx12(left,i,2)) |
c xkorr=adcx12(left,i,1)*exp(-xhelp/adcx12(left,i,2)) |
613 |
xkorr = atten(left,12,i,xhelp) |
xkorr = atten(left,12,i,xhelp) |
614 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
615 |
tof12(left,i,iadc) = xkorr/cos(theta) |
tof12(left,i,iadc) = xkorr/cos(theta) |
616 |
adcflag(ch12a(i),hb12a(i)) = 1 |
adcflag(ch12a(i),hb12a(i)) = 1 |
617 |
endif |
endif |
618 |
if ((tof12(right,tof12_i,itdc).LT.4095).AND. |
if ((tdc(ch12b(i),hb12b(i)).lt.4095).AND. |
619 |
& (adc(ch12b(i),hb12b(i)).eq.4095)) then |
& (adc(ch12b(i),hb12b(i)).eq.4095)) then |
620 |
phi = atan(tan(THYOUT(2))/tan(THXOUT(2))) |
phi = atan(tan(THYOUT(2))/tan(THXOUT(2))) |
621 |
theta = atan(tan(THXOUT(2))/cos(phi)) |
theta = atan(tan(THXOUT(2))/cos(phi)) |
622 |
c xkorr=adcx12(right,i,1)*exp(xhelp/adcx12(right,i,2)) |
c xkorr=adcx12(right,i,1)*exp(xhelp/adcx12(right,i,2)) |
623 |
xkorr = atten(right,12,i,xhelp) |
xkorr = atten(right,12,i,xhelp) |
624 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
625 |
tof12(right,i,iadc) = xkorr/cos(theta) |
tof12(right,i,iadc) = xkorr/cos(theta) |
626 |
adcflag(ch12b(i),hb12b(i)) = 1 |
adcflag(ch12b(i),hb12b(i)) = 1 |
627 |
endif |
endif |
632 |
xhelp=xout(3) |
xhelp=xout(3) |
633 |
IF (tof21_i.GT.none_find.AND.abs(xout(3)).lt.100) THEN |
IF (tof21_i.GT.none_find.AND.abs(xout(3)).lt.100) THEN |
634 |
i = tof21_i |
i = tof21_i |
635 |
if ((tof21(left,tof21_i,itdc).LT.4095).AND. |
if ((tdc(ch21a(i),hb21a(i)).lt.4095).AND. |
636 |
& (adc(ch21a(i),hb21a(i)).eq.4095)) then |
& (adc(ch21a(i),hb21a(i)).eq.4095)) then |
637 |
phi = atan(tan(THYOUT(3))/tan(THXOUT(3))) |
phi = atan(tan(THYOUT(3))/tan(THXOUT(3))) |
638 |
theta = atan(tan(THXOUT(3))/cos(phi)) |
theta = atan(tan(THXOUT(3))/cos(phi)) |
639 |
c xkorr=adcx21(left,i,1)*exp(-xhelp/adcx21(left,i,2)) |
c xkorr=adcx21(left,i,1)*exp(-xhelp/adcx21(left,i,2)) |
640 |
xkorr = atten(left,21,i,xhelp) |
xkorr = atten(left,21,i,xhelp) |
641 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
642 |
tof21(left,i,iadc) = xkorr/cos(theta) |
tof21(left,i,iadc) = xkorr/cos(theta) |
643 |
adcflag(ch21a(i),hb21a(i)) = 1 |
adcflag(ch21a(i),hb21a(i)) = 1 |
644 |
endif |
endif |
645 |
if ((tof21(right,tof21_i,itdc).LT.4095).AND. |
if ((tdc(ch21b(i),hb21b(i)).lt.4095).AND. |
646 |
& (adc(ch21b(i),hb21b(i)).eq.4095)) then |
& (adc(ch21b(i),hb21b(i)).eq.4095)) then |
647 |
phi = atan(tan(THYOUT(3))/tan(THXOUT(3))) |
phi = atan(tan(THYOUT(3))/tan(THXOUT(3))) |
648 |
theta = atan(tan(THXOUT(3))/cos(phi)) |
theta = atan(tan(THXOUT(3))/cos(phi)) |
649 |
c xkorr=adcx21(right,i,1)*exp(xhelp/adcx21(right,i,2)) |
c xkorr=adcx21(right,i,1)*exp(xhelp/adcx21(right,i,2)) |
650 |
xkorr = atten(right,21,i,xhelp) |
xkorr = atten(right,21,i,xhelp) |
651 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
652 |
tof21(right,i,iadc) = xkorr/cos(theta) |
tof21(right,i,iadc) = xkorr/cos(theta) |
653 |
adcflag(ch21b(i),hb21b(i)) = 1 |
adcflag(ch21b(i),hb21b(i)) = 1 |
654 |
endif |
endif |
658 |
yhelp=yout(4) |
yhelp=yout(4) |
659 |
IF (tof22_i.GT.none_find.AND.abs(yout(4)).lt.100) THEN |
IF (tof22_i.GT.none_find.AND.abs(yout(4)).lt.100) THEN |
660 |
i = tof22_i |
i = tof22_i |
661 |
if ((tof22(left,tof22_i,itdc).LT.4095).AND. |
if ((tdc(ch22a(i),hb22a(i)).lt.4095).AND. |
662 |
& (adc(ch22a(i),hb22a(i)).eq.4095)) then |
& (adc(ch22a(i),hb22a(i)).eq.4095)) then |
663 |
phi = atan(tan(THYOUT(4))/tan(THXOUT(4))) |
phi = atan(tan(THYOUT(4))/tan(THXOUT(4))) |
664 |
theta = atan(tan(THXOUT(4))/cos(phi)) |
theta = atan(tan(THXOUT(4))/cos(phi)) |
665 |
c xkorr=adcx22(left,i,1)*exp(-yhelp/adcx22(left,i,2)) |
c xkorr=adcx22(left,i,1)*exp(-yhelp/adcx22(left,i,2)) |
666 |
xkorr = atten(left,22,i,yhelp) |
xkorr = atten(left,22,i,yhelp) |
667 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
668 |
tof22(left,i,iadc) = xkorr/cos(theta) |
tof22(left,i,iadc) = xkorr/cos(theta) |
669 |
adcflag(ch22a(i),hb22a(i)) = 1 |
adcflag(ch22a(i),hb22a(i)) = 1 |
670 |
endif |
endif |
671 |
if ((tof22(right,tof22_i,itdc).LT.4095).AND. |
if ((tdc(ch22a(i),hb22b(i)).lt.4095).AND. |
672 |
& (adc(ch22b(i),hb22b(i)).eq.4095)) then |
& (adc(ch22b(i),hb22b(i)).eq.4095)) then |
673 |
phi = atan(tan(THYOUT(4))/tan(THXOUT(4))) |
phi = atan(tan(THYOUT(4))/tan(THXOUT(4))) |
674 |
theta = atan(tan(THXOUT(4))/cos(phi)) |
theta = atan(tan(THXOUT(4))/cos(phi)) |
675 |
c xkorr=adcx22(right,i,1)*exp(yhelp/adcx22(right,i,2)) |
c xkorr=adcx22(right,i,1)*exp(yhelp/adcx22(right,i,2)) |
676 |
xkorr = atten(right,22,i,yhelp) |
xkorr = atten(right,22,i,yhelp) |
677 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
678 |
tof22(right,i,iadc) = xkorr/cos(theta) |
tof22(right,i,iadc) = xkorr/cos(theta) |
679 |
adcflag(ch22b(i),hb22b(i)) = 1 |
adcflag(ch22b(i),hb22b(i)) = 1 |
680 |
endif |
endif |
685 |
yhelp=yout(5) |
yhelp=yout(5) |
686 |
IF (tof31_i.GT.none_find.AND.abs(yout(5)).lt.100) THEN |
IF (tof31_i.GT.none_find.AND.abs(yout(5)).lt.100) THEN |
687 |
i = tof31_i |
i = tof31_i |
688 |
if ((tof31(left,tof31_i,itdc).LT.4095).AND. |
if ((tdc(ch31a(i),hb31a(i)).lt.4095).AND. |
689 |
& (adc(ch31a(i),hb31a(i)).eq.4095)) then |
& (adc(ch31a(i),hb31a(i)).eq.4095)) then |
690 |
phi = atan(tan(THYOUT(5))/tan(THXOUT(5))) |
phi = atan(tan(THYOUT(5))/tan(THXOUT(5))) |
691 |
theta = atan(tan(THXOUT(5))/cos(phi)) |
theta = atan(tan(THXOUT(5))/cos(phi)) |
692 |
c xkorr=adcx31(left,i,1)*exp(-yhelp/adcx31(left,i,2)) |
c xkorr=adcx31(left,i,1)*exp(-yhelp/adcx31(left,i,2)) |
693 |
xkorr = atten(left,31,i,yhelp) |
xkorr = atten(left,31,i,yhelp) |
694 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
695 |
tof31(left,i,iadc) = xkorr/cos(theta) |
tof31(left,i,iadc) = xkorr/cos(theta) |
696 |
adcflag(ch31a(i),hb31a(i)) = 1 |
adcflag(ch31a(i),hb31a(i)) = 1 |
697 |
endif |
endif |
698 |
if ((tof31(right,tof31_i,itdc).LT.4095).AND. |
if ((tdc(ch31b(i),hb31b(i)).lt.4095).AND. |
699 |
& (adc(ch31b(i),hb31b(i)).eq.4095)) then |
& (adc(ch31b(i),hb31b(i)).eq.4095)) then |
700 |
phi = atan(tan(THYOUT(5))/tan(THXOUT(5))) |
phi = atan(tan(THYOUT(5))/tan(THXOUT(5))) |
701 |
theta = atan(tan(THXOUT(5))/cos(phi)) |
theta = atan(tan(THXOUT(5))/cos(phi)) |
702 |
c xkorr=adcx31(right,i,1)*exp(yhelp/adcx31(right,i,2)) |
c xkorr=adcx31(right,i,1)*exp(yhelp/adcx31(right,i,2)) |
703 |
xkorr = atten(right,31,i,yhelp) |
xkorr = atten(right,31,i,yhelp) |
704 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
705 |
tof31(right,i,iadc) = xkorr/cos(theta) |
tof31(right,i,iadc) = xkorr/cos(theta) |
706 |
adcflag(ch31b(i),hb31b(i)) = 1 |
adcflag(ch31b(i),hb31b(i)) = 1 |
707 |
endif |
endif |
711 |
xhelp=xout(6) |
xhelp=xout(6) |
712 |
IF (tof32_i.GT.none_find.AND.abs(xout(6)).lt.100) THEN |
IF (tof32_i.GT.none_find.AND.abs(xout(6)).lt.100) THEN |
713 |
i = tof32_i |
i = tof32_i |
714 |
if ((tof32(left,tof32_i,itdc).LT.4095).AND. |
if ((tdc(ch32a(i),hb32a(i)).lt.4095).AND. |
715 |
& (adc(ch32a(i),hb32a(i)).eq.4095)) then |
& (adc(ch32a(i),hb32a(i)).eq.4095)) then |
716 |
phi = atan(tan(THYOUT(6))/tan(THXOUT(6))) |
phi = atan(tan(THYOUT(6))/tan(THXOUT(6))) |
717 |
theta = atan(tan(THXOUT(6))/cos(phi)) |
theta = atan(tan(THXOUT(6))/cos(phi)) |
718 |
c xkorr=adcx32(left,i,1)*exp(-xhelp/adcx32(left,i,2)) |
c xkorr=adcx32(left,i,1)*exp(-xhelp/adcx32(left,i,2)) |
719 |
xkorr = atten(left,32,i,xhelp) |
xkorr = atten(left,32,i,xhelp) |
720 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
721 |
tof32(left,i,iadc) = xkorr/cos(theta) |
tof32(left,i,iadc) = xkorr/cos(theta) |
722 |
adcflag(ch32a(i),hb32a(i)) = 1 |
adcflag(ch32a(i),hb32a(i)) = 1 |
723 |
endif |
endif |
724 |
if ((tof32(right,tof32_i,itdc).LT.4095).AND. |
if ((tdc(ch32b(i),hb32b(i)).lt.4095).AND. |
725 |
& (adc(ch32b(i),hb32b(i)).eq.4095)) then |
& (adc(ch32b(i),hb32b(i)).eq.4095)) then |
726 |
phi = atan(tan(THYOUT(6))/tan(THXOUT(6))) |
phi = atan(tan(THYOUT(6))/tan(THXOUT(6))) |
727 |
theta = atan(tan(THXOUT(6))/cos(phi)) |
theta = atan(tan(THXOUT(6))/cos(phi)) |
728 |
c xkorr=adcx32(right,i,1)*exp(xhelp/adcx32(right,i,2)) |
c xkorr=adcx32(right,i,1)*exp(xhelp/adcx32(right,i,2)) |
729 |
xkorr = atten(right,32,i,xhelp) |
xkorr = atten(right,32,i,xhelp) |
730 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
731 |
tof32(right,i,iadc) = xkorr/cos(theta) |
tof32(right,i,iadc) = xkorr/cos(theta) |
732 |
adcflag(ch32b(i),hb32b(i)) = 1 |
adcflag(ch32b(i),hb32b(i)) = 1 |
733 |
endif |
endif |
734 |
ENDIF |
ENDIF |
735 |
|
|
736 |
|
C------------------------------------------------------------------- |
737 |
|
C Now there is for each hitted paddle a TDC and ADC value, if the |
738 |
|
C TDC was < 4095. |
739 |
|
C There might be also TDC-ADC pairs in paddles not hitted |
740 |
|
C Let's correct the raw TDC value with the time walk |
741 |
|
C------------------------------------------------------------------- |
742 |
|
C--------------------Time walk correction ------------------------- |
743 |
|
C------------------------------------------------------------------- |
744 |
|
|
745 |
|
DO i=1,8 |
746 |
|
if ((tdc(ch11a(i),hb11a(i)).lt.4095).and. |
747 |
|
& (tof11(left,i,iadc).lt.3786)) THEN |
748 |
|
xhelp = tw11(left,i)/(tof11(left,i,iadc)**0.5) |
749 |
|
tof11(left,i,itdc) = tof11(left,i,itdc) + xhelp |
750 |
|
tdc_c(ch11a(i),hb11a(i))=tof11(left,i,itdc) |
751 |
|
ENDIF |
752 |
|
|
753 |
|
if ((tdc(ch11b(i),hb11b(i)).lt.4095).and. |
754 |
|
& (tof11(right,i,iadc).lt.3786)) THEN |
755 |
|
xhelp = tw11(right,i)/(tof11(right,i,iadc)**0.5) |
756 |
|
tof11(right,i,itdc) = tof11(right,i,itdc) + xhelp |
757 |
|
tdc_c(ch11b(i),hb11b(i))=tof11(right,i,itdc) |
758 |
|
ENDIF |
759 |
|
ENDDO |
760 |
|
|
761 |
|
|
762 |
|
DO i=1,6 |
763 |
|
if ((tdc(ch12a(i),hb12a(i)).lt.4095).and. |
764 |
|
& (tof12(left,i,iadc).lt.3786)) THEN |
765 |
|
xhelp = tw12(left,i)/(tof12(left,i,iadc)**0.5) |
766 |
|
tof12(left,i,itdc) = tof12(left,i,itdc) + xhelp |
767 |
|
tdc_c(ch12a(i),hb12a(i))=tof12(left,i,itdc) |
768 |
|
ENDIF |
769 |
|
|
770 |
|
if ((tdc(ch12b(i),hb12b(i)).lt.4095).and. |
771 |
|
& (tof12(right,i,iadc).lt.3786)) THEN |
772 |
|
xhelp = tw12(right,i)/(tof12(right,i,iadc)**0.5) |
773 |
|
tof12(right,i,itdc) = tof12(right,i,itdc) + xhelp |
774 |
|
tdc_c(ch12b(i),hb12b(i))=tof12(right,i,itdc) |
775 |
|
ENDIF |
776 |
|
ENDDO |
777 |
|
|
778 |
|
C---- |
779 |
|
DO I=1,2 |
780 |
|
if ((tdc(ch21a(i),hb21a(i)).lt.4095).and. |
781 |
|
& (tof21(left,i,iadc).lt.3786)) THEN |
782 |
|
xhelp = tw21(left,i)/(tof21(left,i,iadc)**0.5) |
783 |
|
tof21(left,i,itdc) = tof21(left,i,itdc) + xhelp |
784 |
|
tdc_c(ch21a(i),hb21a(i))=tof21(left,i,itdc) |
785 |
|
ENDIF |
786 |
|
|
787 |
|
if ((tdc(ch21b(i),hb21b(i)).lt.4095).and. |
788 |
|
& (tof21(right,i,iadc).lt.3786)) THEN |
789 |
|
xhelp = tw21(right,i)/(tof21(right,i,iadc)**0.5) |
790 |
|
tof21(right,i,itdc) = tof21(right,i,itdc) + xhelp |
791 |
|
tdc_c(ch21b(i),hb21b(i))=tof21(right,i,itdc) |
792 |
|
ENDIF |
793 |
|
ENDDO |
794 |
|
|
795 |
|
DO I=1,2 |
796 |
|
if ((tdc(ch22a(i),hb22a(i)).lt.4095).and. |
797 |
|
& (tof22(left,i,iadc).lt.3786)) THEN |
798 |
|
xhelp = tw22(left,i)/(tof22(left,i,iadc)**0.5) |
799 |
|
tof22(left,i,itdc) = tof22(left,i,itdc) + xhelp |
800 |
|
tdc_c(ch22a(i),hb22a(i))=tof22(left,i,itdc) |
801 |
|
ENDIF |
802 |
|
|
803 |
|
if ((tdc(ch22b(i),hb22b(i)).lt.4095).and. |
804 |
|
& (tof22(right,i,iadc).lt.3786)) THEN |
805 |
|
xhelp = tw22(right,i)/(tof22(right,i,iadc)**0.5) |
806 |
|
tof22(right,i,itdc) = tof22(right,i,itdc) + xhelp |
807 |
|
tdc_c(ch22b(i),hb22b(i))=tof22(right,i,itdc) |
808 |
|
ENDIF |
809 |
|
ENDDO |
810 |
|
|
811 |
|
C---- |
812 |
|
DO I=1,3 |
813 |
|
if ((tdc(ch31a(i),hb31a(i)).lt.4095).and. |
814 |
|
& (tof31(left,i,iadc).lt.3786)) THEN |
815 |
|
xhelp = tw31(left,i)/(tof31(left,i,iadc)**0.5) |
816 |
|
tof31(left,i,itdc) = tof31(left,i,itdc) + xhelp |
817 |
|
tdc_c(ch31a(i),hb31a(i))=tof31(left,i,itdc) |
818 |
|
ENDIF |
819 |
|
|
820 |
|
if ((tdc(ch31b(i),hb31b(i)).lt.4095).and. |
821 |
|
& (tof31(right,i,iadc).lt.3786)) THEN |
822 |
|
xhelp = tw31(right,i)/(tof31(right,i,iadc)**0.5) |
823 |
|
tof31(right,i,itdc) = tof31(right,i,itdc) + xhelp |
824 |
|
tdc_c(ch31b(i),hb31b(i))=tof31(right,i,itdc) |
825 |
|
ENDIF |
826 |
|
ENDDO |
827 |
|
|
828 |
|
DO I=1,3 |
829 |
|
if ((tdc(ch32a(i),hb32a(i)).lt.4095).and. |
830 |
|
& (tof32(left,i,iadc).lt.3786)) THEN |
831 |
|
xhelp = tw32(left,i)/(tof32(left,i,iadc)**0.5) |
832 |
|
tof32(left,i,itdc) = tof32(left,i,itdc) + xhelp |
833 |
|
tdc_c(ch32a(i),hb32a(i))=tof32(left,i,itdc) |
834 |
|
ENDIF |
835 |
|
|
836 |
|
if ((tdc(ch32b(i),hb32b(i)).lt.4095).and. |
837 |
|
& (tof32(right,i,iadc).lt.3786)) THEN |
838 |
|
xhelp = tw32(right,i)/(tof32(right,i,iadc)**0.5) |
839 |
|
tof32(right,i,itdc) = tof32(right,i,itdc) + xhelp |
840 |
|
tdc_c(ch32b(i),hb32b(i))=tof32(right,i,itdc) |
841 |
|
ENDIF |
842 |
|
ENDDO |
843 |
|
|
844 |
|
|
845 |
|
C----------------------------------------------------------------------- |
846 |
|
C--------------------Insert Artifical TDC Value --------------------- |
847 |
|
C For each Paddle perform check: |
848 |
|
C if left paddle=4095 and right paddle OK => create TDC value left |
849 |
|
C if right paddle=4095 and left paddle OK => create TDC value right |
850 |
|
C----------------------------------------------------------------------- |
851 |
|
|
852 |
|
C-----------------------S11 ----------------------------------------- |
853 |
|
|
854 |
|
IF (tof11_i.GT.none_find) THEN |
855 |
|
xpos = yout(1) |
856 |
|
i = tof11_i |
857 |
|
if ((tdc(ch11a(i),hb11a(i)).EQ.4095).AND. |
858 |
|
& (tdc(ch11b(i),hb11b(i)).LT.4095)) THEN |
859 |
|
tof11(1,tof11_i,itdc) = tof11(2,tof11_i,itdc) |
860 |
|
& + 2*(y_coor_lin11(tof11_i,offset) |
861 |
|
& + xpos*y_coor_lin11(tof11_i,slope)) |
862 |
|
tdcflag(ch11a(i),hb11a(i)) = 1 |
863 |
|
ENDIF |
864 |
|
|
865 |
|
if ((tdc(ch11b(i),hb11b(i)).EQ.4095).AND. |
866 |
|
& (tdc(ch11a(i),hb11a(i)).LT.4095)) THEN |
867 |
|
tof11(2,tof11_i,itdc) = tof11(1,tof11_i,itdc) |
868 |
|
& - 2*(y_coor_lin11(tof11_i,offset) |
869 |
|
& + xpos*y_coor_lin11(tof11_i,slope)) |
870 |
|
tdcflag(ch11b(i),hb11b(i)) = 1 |
871 |
|
ENDIF |
872 |
|
|
873 |
|
ENDIF |
874 |
|
|
875 |
|
C-----------------------S12 ----------------------------------------- |
876 |
|
|
877 |
|
IF (tof12_i.GT.none_find) THEN |
878 |
|
xpos = xout(2) |
879 |
|
i = tof12_i |
880 |
|
if ((tdc(ch12a(i),hb12a(i)).EQ.4095).AND. |
881 |
|
& (tdc(ch12b(i),hb12b(i)).LT.4095)) THEN |
882 |
|
tof12(1,tof12_i,itdc) = tof12(2,tof12_i,itdc) |
883 |
|
& + 2*(x_coor_lin12(tof12_i,offset) |
884 |
|
& + xpos*x_coor_lin12(tof12_i,slope)) |
885 |
|
tdcflag(ch12a(i),hb12a(i)) = 1 |
886 |
|
ENDIF |
887 |
|
|
888 |
|
if ((tdc(ch12b(i),hb12b(i)).EQ.4095).AND. |
889 |
|
& (tdc(ch12a(i),hb12a(i)).LT.4095)) THEN |
890 |
|
tof12(2,tof12_i,itdc) = tof12(1,tof12_i,itdc) |
891 |
|
& - 2*(x_coor_lin12(tof12_i,offset) |
892 |
|
& + xpos*x_coor_lin12(tof12_i,slope)) |
893 |
|
tdcflag(ch12b(i),hb12b(i)) = 1 |
894 |
|
ENDIF |
895 |
|
ENDIF |
896 |
|
|
897 |
|
C-----------------------S21 ----------------------------------------- |
898 |
|
|
899 |
|
IF (tof21_i.GT.none_find) THEN |
900 |
|
xpos = xout(3) |
901 |
|
i = tof21_i |
902 |
|
if ((tdc(ch21a(i),hb21a(i)).EQ.4095).AND. |
903 |
|
& (tdc(ch21b(i),hb21b(i)).LT.4095)) THEN |
904 |
|
tof21(1,tof21_i,itdc) = tof21(2,tof21_i,itdc) |
905 |
|
& + 2*(x_coor_lin21(tof21_i,offset) |
906 |
|
& + xpos*x_coor_lin21(tof21_i,slope)) |
907 |
|
tdcflag(ch21a(i),hb21a(i)) = 1 |
908 |
|
ENDIF |
909 |
|
|
910 |
|
if ((tdc(ch21b(i),hb21b(i)).EQ.4095).AND. |
911 |
|
& (tdc(ch21a(i),hb21a(i)).LT.4095)) THEN |
912 |
|
tof21(2,tof21_i,itdc) = tof21(1,tof21_i,itdc) |
913 |
|
& - 2*(x_coor_lin21(tof21_i,offset) |
914 |
|
& + xpos*x_coor_lin21(tof21_i,slope)) |
915 |
|
tdcflag(ch21b(i),hb21b(i)) = 1 |
916 |
|
ENDIF |
917 |
|
ENDIF |
918 |
|
|
919 |
|
C-----------------------S22 ----------------------------------------- |
920 |
|
|
921 |
|
IF (tof22_i.GT.none_find) THEN |
922 |
|
xpos = yout(4) |
923 |
|
i = tof22_i |
924 |
|
if ((tdc(ch22a(i),hb22a(i)).EQ.4095).AND. |
925 |
|
& (tdc(ch22b(i),hb22b(i)).LT.4095)) THEN |
926 |
|
tof22(1,tof22_i,itdc) = tof22(2,tof22_i,itdc) |
927 |
|
& + 2*(y_coor_lin22(tof22_i,offset) |
928 |
|
& + xpos*y_coor_lin22(tof22_i,slope)) |
929 |
|
tdcflag(ch22a(i),hb22a(i)) = 1 |
930 |
|
ENDIF |
931 |
|
|
932 |
|
if ((tdc(ch22b(i),hb22b(i)).EQ.4095).AND. |
933 |
|
& (tdc(ch22a(i),hb22a(i)).LT.4095)) THEN |
934 |
|
tof22(2,tof22_i,itdc) = tof22(1,tof22_i,itdc) |
935 |
|
& - 2*(y_coor_lin22(tof22_i,offset) |
936 |
|
& + xpos*y_coor_lin22(tof22_i,slope)) |
937 |
|
tdcflag(ch22b(i),hb22b(i)) = 1 |
938 |
|
ENDIF |
939 |
|
ENDIF |
940 |
|
|
941 |
|
C-----------------------S31 ----------------------------------------- |
942 |
|
|
943 |
|
IF (tof31_i.GT.none_find) THEN |
944 |
|
xpos = yout(5) |
945 |
|
i = tof31_i |
946 |
|
if ((tdc(ch31a(i),hb31a(i)).EQ.4095).AND. |
947 |
|
& (tdc(ch31b(i),hb31b(i)).LT.4095)) THEN |
948 |
|
tof31(1,tof31_i,itdc) = tof31(2,tof31_i,itdc) |
949 |
|
& + 2*(y_coor_lin31(tof31_i,offset) |
950 |
|
& + xpos*y_coor_lin31(tof31_i,slope)) |
951 |
|
tdcflag(ch31a(i),hb31a(i)) = 1 |
952 |
|
ENDIF |
953 |
|
|
954 |
|
if ((tdc(ch31b(i),hb31b(i)).EQ.4095).AND. |
955 |
|
& (tdc(ch31a(i),hb31a(i)).LT.4095)) THEN |
956 |
|
tof31(2,tof31_i,itdc) = tof31(1,tof31_i,itdc) |
957 |
|
& - 2*(y_coor_lin31(tof31_i,offset) |
958 |
|
& + xpos*y_coor_lin31(tof31_i,slope)) |
959 |
|
tdcflag(ch31b(i),hb31b(i)) = 1 |
960 |
|
ENDIF |
961 |
|
ENDIF |
962 |
|
|
963 |
|
C-----------------------S32 ----------------------------------------- |
964 |
|
|
965 |
|
IF (tof32_i.GT.none_find) THEN |
966 |
|
xpos = xout(6) |
967 |
|
i = tof32_i |
968 |
|
if ((tdc(ch32a(i),hb32a(i)).EQ.4095).AND. |
969 |
|
& (tdc(ch32b(i),hb32b(i)).LT.4095)) THEN |
970 |
|
tof32(1,tof32_i,itdc) = tof32(2,tof32_i,itdc) |
971 |
|
& + 2*(x_coor_lin32(tof32_i,offset) |
972 |
|
& + xpos*x_coor_lin32(tof32_i,slope)) |
973 |
|
tdcflag(ch32a(i),hb32a(i)) = 1 |
974 |
|
ENDIF |
975 |
|
|
976 |
|
if ((tdc(ch32b(i),hb32b(i)).EQ.4095).AND. |
977 |
|
& (tdc(ch32a(i),hb32a(i)).LT.4095)) THEN |
978 |
|
tof32(2,tof32_i,itdc) = tof32(1,tof32_i,itdc) |
979 |
|
& - 2*(x_coor_lin32(tof32_i,offset) |
980 |
|
& + xpos*x_coor_lin32(tof32_i,slope)) |
981 |
|
tdcflag(ch32b(i),hb32b(i)) = 1 |
982 |
|
ENDIF |
983 |
|
ENDIF |
984 |
|
|
985 |
|
|
986 |
C------------------------------------------------------------------ |
C------------------------------------------------------------------ |
987 |
C--- calculate track position in paddle using timing difference |
C--- calculate track position in paddle using timing difference |
991 |
xtofpos(i)=100. |
xtofpos(i)=100. |
992 |
ytofpos(i)=100. |
ytofpos(i)=100. |
993 |
enddo |
enddo |
994 |
|
|
995 |
C-----------------------------S1 -------------------------------- |
C-----------------------------S1 -------------------------------- |
996 |
|
|
997 |
IF (tof11_i.GT.none_find) THEN |
IF (tof11_i.GT.none_find) THEN |
1063 |
|
|
1064 |
|
|
1065 |
|
|
|
|
|
|
C-------------------------------------------------------------------- |
|
|
C--------------------Time walk correction ------------------------- |
|
|
C-------------------------------------------------------------------- |
|
|
|
|
|
|
|
|
DO i=1,8 |
|
|
xhelp= 0. |
|
|
xhelp_a = tof11(left,i,iadc) |
|
|
xhelp_t = tof11(left,i,itdc) |
|
|
c if (xhelp_a .eq.0) write (*,*) 'trk 11 ',i,xhelp_a |
|
|
|
|
|
if(xhelp_a<3786) xhelp = tw11(left,i)/sqrt(xhelp_a) |
|
|
tof11(left,i,itdc) = xhelp_t + xhelp |
|
|
tdc_c(ch11a(i),hb11a(i))=tof11(left,i,itdc) |
|
|
xhelp_a = tof11(right,i,iadc) |
|
|
xhelp_t = tof11(right,i,itdc) |
|
|
if(xhelp_a<3786) xhelp = tw11(right,i)/sqrt(xhelp_a) |
|
|
tof11(right,i,itdc) = xhelp_t + xhelp |
|
|
tdc_c(ch11b(i),hb11b(i))=tof11(right,i,itdc) |
|
|
ENDDO |
|
|
|
|
|
DO i=1,6 |
|
|
xhelp= 0. |
|
|
xhelp_a = tof12(left,i,iadc) |
|
|
xhelp_t = tof12(left,i,itdc) |
|
|
c if (xhelp_a .eq.0) write (*,*) 'trk 12 ',i,xhelp_a |
|
|
if(xhelp_a<3786) xhelp = tw12(left,i)/sqrt(xhelp_a) |
|
|
tof12(left,i,itdc) = xhelp_t + xhelp |
|
|
tdc_c(ch12a(i),hb12a(i))=tof12(left,i,itdc) |
|
|
xhelp_a = tof12(right,i,iadc) |
|
|
xhelp_t = tof12(right,i,itdc) |
|
|
if(xhelp_a<3786) xhelp = tw12(right,i)/sqrt(xhelp_a) |
|
|
tof12(right,i,itdc) = xhelp_t + xhelp |
|
|
tdc_c(ch12b(i),hb12b(i))=tof12(right,i,itdc) |
|
|
ENDDO |
|
|
C---- |
|
|
DO i=1,2 |
|
|
xhelp= 0. |
|
|
xhelp_a = tof21(left,i,iadc) |
|
|
xhelp_t = tof21(left,i,itdc) |
|
|
c if (xhelp_a .eq.0) write (*,*) ' trk 21 ',i,xhelp_a |
|
|
|
|
|
if(xhelp_a<3786) xhelp = tw21(left,i)/sqrt(xhelp_a) |
|
|
tof21(left,i,itdc) = xhelp_t + xhelp |
|
|
tdc_c(ch21a(i),hb21a(i))=tof21(left,i,itdc) |
|
|
xhelp_a = tof21(right,i,iadc) |
|
|
xhelp_t = tof21(right,i,itdc) |
|
|
if(xhelp_a<3786) xhelp = tw21(right,i)/sqrt(xhelp_a) |
|
|
tof21(right,i,itdc) = xhelp_t + xhelp |
|
|
tdc_c(ch21b(i),hb21b(i))=tof21(right,i,itdc) |
|
|
ENDDO |
|
|
|
|
|
DO i=1,2 |
|
|
xhelp= 0. |
|
|
xhelp_a = tof22(left,i,iadc) |
|
|
xhelp_t = tof22(left,i,itdc) |
|
|
c if (xhelp_a .eq.0) write (*,*) ' trk 22 ',i,xhelp_a |
|
|
if(xhelp_a<3786) xhelp = tw22(left,i)/sqrt(xhelp_a) |
|
|
tof22(left,i,itdc) = xhelp_t + xhelp |
|
|
tdc_c(ch22a(i),hb22a(i))=tof22(left,i,itdc) |
|
|
xhelp_a = tof22(right,i,iadc) |
|
|
xhelp_t = tof22(right,i,itdc) |
|
|
if(xhelp_a<3786) xhelp = tw22(right,i)/sqrt(xhelp_a) |
|
|
tof22(right,i,itdc) = xhelp_t + xhelp |
|
|
tdc_c(ch22b(i),hb22b(i))=tof22(right,i,itdc) |
|
|
ENDDO |
|
|
C---- |
|
|
|
|
|
DO i=1,3 |
|
|
xhelp= 0. |
|
|
xhelp_a = tof31(left,i,iadc) |
|
|
xhelp_t = tof31(left,i,itdc) |
|
|
c if (xhelp_a .eq.0) write (*,*) ' trk 31 ',i,xhelp_a |
|
|
|
|
|
if(xhelp_a<3786) xhelp = tw31(left,i)/sqrt(xhelp_a) |
|
|
tof31(left,i,itdc) = xhelp_t + xhelp |
|
|
tdc_c(ch31a(i),hb31a(i))=tof31(left,i,itdc) |
|
|
xhelp_a = tof31(right,i,iadc) |
|
|
xhelp_t = tof31(right,i,itdc) |
|
|
if(xhelp_a<3786) xhelp = tw31(right,i)/sqrt(xhelp_a) |
|
|
tof31(right,i,itdc) = xhelp_t + xhelp |
|
|
tdc_c(ch31b(i),hb31b(i))=tof31(right,i,itdc) |
|
|
ENDDO |
|
|
|
|
|
DO i=1,3 |
|
|
xhelp= 0. |
|
|
xhelp_a = tof32(left,i,iadc) |
|
|
xhelp_t = tof32(left,i,itdc) |
|
|
c if (xhelp_a .eq.0) write (*,*) ' trk 32 ',i,xhelp_a |
|
|
|
|
|
if(xhelp_a<3786) xhelp = tw32(left,i)/sqrt(xhelp_a) |
|
|
tof32(left,i,itdc) = xhelp_t + xhelp |
|
|
tdc_c(ch32a(i),hb32a(i))=tof32(left,i,itdc) |
|
|
xhelp_a = tof32(right,i,iadc) |
|
|
xhelp_t = tof32(right,i,itdc) |
|
|
if(xhelp_a<3786) xhelp = tw32(right,i)/sqrt(xhelp_a) |
|
|
tof32(right,i,itdc) = xhelp_t + xhelp |
|
|
tdc_c(ch32b(i),hb32b(i))=tof32(right,i,itdc) |
|
|
ENDDO |
|
|
|
|
|
|
|
1066 |
C--------------------------------------------------------------------- |
C--------------------------------------------------------------------- |
1067 |
C--------------------Corrections on ADC-data ------------------------- |
C--------------------Corrections on ADC-data ------------------------- |
1068 |
C-----------------angle and ADC(x) correction ----------------------- |
C-----------------angle and ADC(x) correction ----------------------- |
1079 |
i = tof11_i |
i = tof11_i |
1080 |
|
|
1081 |
if (tof11(left,i,iadc).lt.3786) then |
if (tof11(left,i,iadc).lt.3786) then |
|
c if (adc(ch11a(i),hb11a(i)).lt.4095) then |
|
1082 |
tof11(left,i,iadc) = tof11(left,i,iadc)*cos(theta) |
tof11(left,i,iadc) = tof11(left,i,iadc)*cos(theta) |
|
c xkorr=adcx11(left,i,1)*exp(-yhelp/adcx11(left,i,2)) |
|
1083 |
xkorr = atten(left,11,i,yhelp) |
xkorr = atten(left,11,i,yhelp) |
1084 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1085 |
adc_c(ch11a(i),hb11a(i))=tof11(left,i,iadc)/xkorr |
adc_c(ch11a(i),hb11a(i))=tof11(left,i,iadc)/xkorr |
1087 |
|
|
1088 |
|
|
1089 |
if (tof11(right,i,iadc).lt.3786) then |
if (tof11(right,i,iadc).lt.3786) then |
|
c if (adc(ch11b(i),hb11b(i)).lt.4095) then |
|
1090 |
tof11(right,i,iadc) = tof11(right,i,iadc)*cos(theta) |
tof11(right,i,iadc) = tof11(right,i,iadc)*cos(theta) |
|
c xkorr=adcx11(right,i,1)*exp(yhelp/adcx11(right,i,2)) |
|
1091 |
xkorr = atten(right,11,i,yhelp) |
xkorr = atten(right,11,i,yhelp) |
1092 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1093 |
adc_c(ch11b(i),hb11b(i))=tof11(right,i,iadc)/xkorr |
adc_c(ch11b(i),hb11b(i))=tof11(right,i,iadc)/xkorr |
1098 |
xhelp=xout(2) |
xhelp=xout(2) |
1099 |
phi = atan(tan(THYOUT(2))/tan(THXOUT(2))) |
phi = atan(tan(THYOUT(2))/tan(THXOUT(2))) |
1100 |
theta = atan(tan(THXOUT(2))/cos(phi)) |
theta = atan(tan(THXOUT(2))/cos(phi)) |
|
c write(*,*) 'theta12 ',theta |
|
|
IF (tof12_i.GT.none_find.AND.xhelp.lt.100) THEN |
|
1101 |
|
|
1102 |
|
IF (tof12_i.GT.none_find.AND.xhelp.lt.100) THEN |
1103 |
i = tof12_i |
i = tof12_i |
1104 |
if (tof12(left,i,iadc).lt.3786) then |
if (tof12(left,i,iadc).lt.3786) then |
|
c if (adc(ch12a(i),hb12a(i)).lt.4095) then |
|
1105 |
tof12(left,i,iadc) = tof12(left,i,iadc)*cos(theta) |
tof12(left,i,iadc) = tof12(left,i,iadc)*cos(theta) |
|
c xkorr=adcx12(left,i,1)*exp(-xhelp/adcx12(left,i,2)) |
|
1106 |
xkorr = atten(left,12,i,xhelp) |
xkorr = atten(left,12,i,xhelp) |
1107 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1108 |
adc_c(ch12a(i),hb12a(i))=tof12(left,i,iadc)/xkorr |
adc_c(ch12a(i),hb12a(i))=tof12(left,i,iadc)/xkorr |
1109 |
endif |
endif |
1110 |
|
|
1111 |
if (tof12(right,i,iadc).lt.3786) then |
if (tof12(right,i,iadc).lt.3786) then |
|
c if (adc(ch12b(i),hb12b(i)).lt.4095) then |
|
1112 |
tof12(right,i,iadc) = tof12(right,i,iadc)*cos(theta) |
tof12(right,i,iadc) = tof12(right,i,iadc)*cos(theta) |
|
c xkorr=adcx12(right,i,1)*exp(xhelp/adcx12(right,i,2)) |
|
1113 |
xkorr = atten(right,12,i,xhelp) |
xkorr = atten(right,12,i,xhelp) |
1114 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1115 |
adc_c(ch12b(i),hb12b(i))=tof12(right,i,iadc)/xkorr |
adc_c(ch12b(i),hb12b(i))=tof12(right,i,iadc)/xkorr |
1121 |
xhelp=xout(3) |
xhelp=xout(3) |
1122 |
phi = atan(tan(THYOUT(3))/tan(THXOUT(3))) |
phi = atan(tan(THYOUT(3))/tan(THXOUT(3))) |
1123 |
theta = atan(tan(THXOUT(3))/cos(phi)) |
theta = atan(tan(THXOUT(3))/cos(phi)) |
|
c write(*,*) 'theta21 ',theta |
|
|
IF (tof21_i.GT.none_find.AND.xhelp.lt.100) THEN |
|
1124 |
|
|
1125 |
|
IF (tof21_i.GT.none_find.AND.xhelp.lt.100) THEN |
1126 |
i = tof21_i |
i = tof21_i |
1127 |
if (tof21(left,i,iadc).lt.3786) then |
if (tof21(left,i,iadc).lt.3786) then |
|
c if (adc(ch21a(i),hb21a(i)).lt.4095) then |
|
1128 |
tof21(left,i,iadc) = tof21(left,i,iadc)*cos(theta) |
tof21(left,i,iadc) = tof21(left,i,iadc)*cos(theta) |
|
c xkorr=adcx21(left,i,1)*exp(-xhelp/adcx21(left,i,2)) |
|
1129 |
xkorr = atten(left,21,i,xhelp) |
xkorr = atten(left,21,i,xhelp) |
1130 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1131 |
adc_c(ch21a(i),hb21a(i))=tof21(left,i,iadc)/xkorr |
adc_c(ch21a(i),hb21a(i))=tof21(left,i,iadc)/xkorr |
1132 |
endif |
endif |
1133 |
|
|
1134 |
if (tof21(right,i,iadc).lt.3786) then |
if (tof21(right,i,iadc).lt.3786) then |
|
c if (adc(ch21b(i),hb21b(i)).lt.4095) then |
|
1135 |
tof21(right,i,iadc) = tof21(right,i,iadc)*cos(theta) |
tof21(right,i,iadc) = tof21(right,i,iadc)*cos(theta) |
|
c xkorr=adcx21(right,i,1)*exp(xhelp/adcx21(right,i,2)) |
|
1136 |
xkorr = atten(right,21,i,xhelp) |
xkorr = atten(right,21,i,xhelp) |
1137 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1138 |
adc_c(ch21b(i),hb21b(i))=tof21(right,i,iadc)/xkorr |
adc_c(ch21b(i),hb21b(i))=tof21(right,i,iadc)/xkorr |
1142 |
yhelp=yout(4) |
yhelp=yout(4) |
1143 |
phi = atan(tan(THYOUT(4))/tan(THXOUT(4))) |
phi = atan(tan(THYOUT(4))/tan(THXOUT(4))) |
1144 |
theta = atan(tan(THXOUT(4))/cos(phi)) |
theta = atan(tan(THXOUT(4))/cos(phi)) |
|
c write(*,*) 'theta22 ',theta |
|
1145 |
|
|
1146 |
IF (tof22_i.GT.none_find.AND.yhelp.lt.100) THEN |
IF (tof22_i.GT.none_find.AND.yhelp.lt.100) THEN |
|
|
|
1147 |
i = tof22_i |
i = tof22_i |
1148 |
if (tof22(left,i,iadc).lt.3786) then |
if (tof22(left,i,iadc).lt.3786) then |
|
c if (adc(ch22a(i),hb22a(i)).lt.4095) then |
|
1149 |
tof22(left,i,iadc) = tof22(left,i,iadc)*cos(theta) |
tof22(left,i,iadc) = tof22(left,i,iadc)*cos(theta) |
|
c xkorr=adcx22(left,i,1)*exp(-yhelp/adcx22(left,i,2)) |
|
1150 |
xkorr = atten(left,22,i,yhelp) |
xkorr = atten(left,22,i,yhelp) |
1151 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1152 |
adc_c(ch22a(i),hb22a(i))=tof22(left,i,iadc)/xkorr |
adc_c(ch22a(i),hb22a(i))=tof22(left,i,iadc)/xkorr |
1153 |
endif |
endif |
1154 |
|
|
1155 |
if (tof22(right,i,iadc).lt.3786) then |
if (tof22(right,i,iadc).lt.3786) then |
|
c if (adc(ch22b(i),hb22b(i)).lt.4095) then |
|
1156 |
tof22(right,i,iadc) = tof22(right,i,iadc)*cos(theta) |
tof22(right,i,iadc) = tof22(right,i,iadc)*cos(theta) |
|
c xkorr=adcx22(right,i,1)*exp(yhelp/adcx22(right,i,2)) |
|
1157 |
xkorr = atten(right,22,i,yhelp) |
xkorr = atten(right,22,i,yhelp) |
1158 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1159 |
adc_c(ch22b(i),hb22b(i))=tof22(right,i,iadc)/xkorr |
adc_c(ch22b(i),hb22b(i))=tof22(right,i,iadc)/xkorr |
1165 |
yhelp=yout(5) |
yhelp=yout(5) |
1166 |
phi = atan(tan(THYOUT(5))/tan(THXOUT(5))) |
phi = atan(tan(THYOUT(5))/tan(THXOUT(5))) |
1167 |
theta = atan(tan(THXOUT(5))/cos(phi)) |
theta = atan(tan(THXOUT(5))/cos(phi)) |
|
c write(*,*) 'theta31 ',theta |
|
1168 |
|
|
1169 |
IF (tof31_i.GT.none_find.AND.yhelp.lt.100) THEN |
IF (tof31_i.GT.none_find.AND.yhelp.lt.100) THEN |
1170 |
|
|
1171 |
i = tof31_i |
i = tof31_i |
1172 |
if (tof31(left,i,iadc).lt.3786) then |
if (tof31(left,i,iadc).lt.3786) then |
|
c if (adc(ch31a(i),hb31a(i)).lt.4095) then |
|
1173 |
tof31(left,i,iadc) = tof31(left,i,iadc)*cos(theta) |
tof31(left,i,iadc) = tof31(left,i,iadc)*cos(theta) |
|
c xkorr=adcx31(left,i,1)*exp(-yhelp/adcx31(left,i,2)) |
|
1174 |
xkorr = atten(left,31,i,yhelp) |
xkorr = atten(left,31,i,yhelp) |
1175 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1176 |
adc_c(ch31a(i),hb31a(i))=tof31(left,i,iadc)/xkorr |
adc_c(ch31a(i),hb31a(i))=tof31(left,i,iadc)/xkorr |
1177 |
endif |
endif |
1178 |
|
|
1179 |
if (tof31(right,i,iadc).lt.3786) then |
if (tof31(right,i,iadc).lt.3786) then |
|
c if (adc(ch31b(i),hb31b(i)).lt.4095) then |
|
1180 |
tof31(right,i,iadc) = tof31(right,i,iadc)*cos(theta) |
tof31(right,i,iadc) = tof31(right,i,iadc)*cos(theta) |
|
c xkorr=adcx31(right,i,1)*exp(yhelp/adcx31(right,i,2)) |
|
1181 |
xkorr = atten(right,31,i,yhelp) |
xkorr = atten(right,31,i,yhelp) |
1182 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1183 |
adc_c(ch31b(i),hb31b(i))=tof31(right,i,iadc)/xkorr |
adc_c(ch31b(i),hb31b(i))=tof31(right,i,iadc)/xkorr |
1187 |
xhelp=xout(6) |
xhelp=xout(6) |
1188 |
phi = atan(tan(THYOUT(6))/tan(THXOUT(6))) |
phi = atan(tan(THYOUT(6))/tan(THXOUT(6))) |
1189 |
theta = atan(tan(THXOUT(6))/cos(phi)) |
theta = atan(tan(THXOUT(6))/cos(phi)) |
|
c write(*,*) 'theta32 ',theta |
|
1190 |
|
|
1191 |
IF (tof32_i.GT.none_find.AND.xhelp.lt.100) THEN |
IF (tof32_i.GT.none_find.AND.xhelp.lt.100) THEN |
|
|
|
1192 |
i = tof32_i |
i = tof32_i |
1193 |
if (tof32(left,i,iadc).lt.3786) then |
if (tof32(left,i,iadc).lt.3786) then |
|
c if (adc(ch32a(i),hb32a(i)).lt.4095) then |
|
1194 |
tof32(left,i,iadc) = tof32(left,i,iadc)*cos(theta) |
tof32(left,i,iadc) = tof32(left,i,iadc)*cos(theta) |
|
c xkorr=adcx32(left,i,1)*exp(-xhelp/adcx32(left,i,2)) |
|
1195 |
xkorr = atten(left,32,i,xhelp) |
xkorr = atten(left,32,i,xhelp) |
1196 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1197 |
adc_c(ch32a(i),hb32a(i))=tof32(left,i,iadc)/xkorr |
adc_c(ch32a(i),hb32a(i))=tof32(left,i,iadc)/xkorr |
1198 |
endif |
endif |
1199 |
|
|
1200 |
if (tof32(right,i,iadc).lt.3786) then |
if (tof32(right,i,iadc).lt.3786) then |
|
c if (adc(ch32b(i),hb32b(i)).lt.4095) then |
|
1201 |
tof32(right,i,iadc) = tof32(right,i,iadc)*cos(theta) |
tof32(right,i,iadc) = tof32(right,i,iadc)*cos(theta) |
|
c xkorr=adcx32(right,i,1)*exp(xhelp/adcx32(right,i,2)) |
|
1202 |
xkorr = atten(right,32,i,xhelp) |
xkorr = atten(right,32,i,xhelp) |
1203 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1204 |
adc_c(ch32b(i),hb32b(i))=tof32(right,i,iadc)/xkorr |
adc_c(ch32b(i),hb32b(i))=tof32(right,i,iadc)/xkorr |
1205 |
endif |
endif |
1206 |
ENDIF |
ENDIF |
1207 |
|
|
1208 |
|
|
1209 |
C----------------------------------------------------------------------- |
C----------------------------------------------------------------------- |
1210 |
C----------------------calculate Beta ------------------------------ |
C----------------------calculate Beta ------------------------------ |
1211 |
C----------------------------------------------------------------------- |
C----------------------------------------------------------------------- |
1242 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1243 |
ihelp=(tof11_i-1)*3+tof31_i |
ihelp=(tof11_i-1)*3+tof31_i |
1244 |
c1 = k_S11S31(1,ihelp) |
c1 = k_S11S31(1,ihelp) |
1245 |
|
if (iz.gt.2) c1 = c1 + k1corrA1 |
1246 |
c2 = k_S11S31(2,ihelp) |
c2 = k_S11S31(2,ihelp) |
1247 |
beta_a(1) = c2*F/(ds-c1) |
beta_a(1) = c2*F/(ds-c1) |
1248 |
c write(*,*) 'S11-S31 ',c1,c2,F |
c write(*,*) 'S11-S31 ',c1,c2,F |
1284 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1285 |
ihelp=(tof11_i-1)*3+tof32_i |
ihelp=(tof11_i-1)*3+tof32_i |
1286 |
c1 = k_S11S32(1,ihelp) |
c1 = k_S11S32(1,ihelp) |
1287 |
|
if (iz.gt.2) c1 = c1 + k1corrA1 |
1288 |
c2 = k_S11S32(2,ihelp) |
c2 = k_S11S32(2,ihelp) |
1289 |
beta_a(2) = c2*F/(ds-c1) |
beta_a(2) = c2*F/(ds-c1) |
1290 |
C write(*,*) 'S11-S32 ',xhelp1,xhelp2, beta_a(2) |
C write(*,*) 'S11-S32 ',xhelp1,xhelp2, beta_a(2) |
1328 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1329 |
ihelp=(tof12_i-1)*3+tof31_i |
ihelp=(tof12_i-1)*3+tof31_i |
1330 |
c1 = k_S12S31(1,ihelp) |
c1 = k_S12S31(1,ihelp) |
1331 |
|
if (iz.gt.2) c1 = c1 + k1corrA1 |
1332 |
c2 = k_S12S31(2,ihelp) |
c2 = k_S12S31(2,ihelp) |
1333 |
beta_a(3) = c2*F/(ds-c1) |
beta_a(3) = c2*F/(ds-c1) |
1334 |
C write(*,*) 'S12-S31 ',xhelp1,xhelp2, beta_a(3) |
C write(*,*) 'S12-S31 ',xhelp1,xhelp2, beta_a(3) |
1373 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1374 |
ihelp=(tof12_i-1)*3+tof32_i |
ihelp=(tof12_i-1)*3+tof32_i |
1375 |
c1 = k_S12S32(1,ihelp) |
c1 = k_S12S32(1,ihelp) |
1376 |
|
if (iz.gt.2) c1 = c1 + k1corrA1 |
1377 |
c2 = k_S12S32(2,ihelp) |
c2 = k_S12S32(2,ihelp) |
1378 |
beta_a(4) = c2*F/(ds-c1) |
beta_a(4) = c2*F/(ds-c1) |
1379 |
C write(*,*) 'S12-S32 ',xhelp1,xhelp2, beta_a(4) |
C write(*,*) 'S12-S32 ',xhelp1,xhelp2, beta_a(4) |
1418 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1419 |
ihelp=(tof21_i-1)*3+tof31_i |
ihelp=(tof21_i-1)*3+tof31_i |
1420 |
c1 = k_S21S31(1,ihelp) |
c1 = k_S21S31(1,ihelp) |
1421 |
|
if (iz.gt.2) c1 = c1 + k1corrB1 |
1422 |
c2 = k_S21S31(2,ihelp) |
c2 = k_S21S31(2,ihelp) |
1423 |
beta_a(5) = c2*F/(ds-c1) |
beta_a(5) = c2*F/(ds-c1) |
1424 |
|
|
1462 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1463 |
ihelp=(tof21_i-1)*3+tof32_i |
ihelp=(tof21_i-1)*3+tof32_i |
1464 |
c1 = k_S21S32(1,ihelp) |
c1 = k_S21S32(1,ihelp) |
1465 |
|
if (iz.gt.2) c1 = c1 + k1corrB1 |
1466 |
c2 = k_S21S32(2,ihelp) |
c2 = k_S21S32(2,ihelp) |
1467 |
beta_a(6) = c2*F/(ds-c1) |
beta_a(6) = c2*F/(ds-c1) |
1468 |
|
|
1506 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1507 |
ihelp=(tof22_i-1)*3+tof31_i |
ihelp=(tof22_i-1)*3+tof31_i |
1508 |
c1 = k_S22S31(1,ihelp) |
c1 = k_S22S31(1,ihelp) |
1509 |
|
if (iz.gt.2) c1 = c1 + k1corrB1 |
1510 |
c2 = k_S22S31(2,ihelp) |
c2 = k_S22S31(2,ihelp) |
1511 |
beta_a(7) = c2*F/(ds-c1) |
beta_a(7) = c2*F/(ds-c1) |
1512 |
|
|
1550 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1551 |
ihelp=(tof22_i-1)*3+tof32_i |
ihelp=(tof22_i-1)*3+tof32_i |
1552 |
c1 = k_S22S32(1,ihelp) |
c1 = k_S22S32(1,ihelp) |
1553 |
|
if (iz.gt.2) c1 = c1 + k1corrB1 |
1554 |
c2 = k_S22S32(2,ihelp) |
c2 = k_S22S32(2,ihelp) |
1555 |
beta_a(8) = c2*F/(ds-c1) |
beta_a(8) = c2*F/(ds-c1) |
1556 |
|
|
1594 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1595 |
ihelp=(tof11_i-1)*2+tof21_i |
ihelp=(tof11_i-1)*2+tof21_i |
1596 |
c1 = k_S11S21(1,ihelp) |
c1 = k_S11S21(1,ihelp) |
1597 |
|
if (iz.gt.2) c1 = c1 + k1corrC1 |
1598 |
c2 = k_S11S21(2,ihelp) |
c2 = k_S11S21(2,ihelp) |
1599 |
beta_a(9) = c2*F/(ds-c1) |
beta_a(9) = c2*F/(ds-c1) |
1600 |
|
|
1638 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1639 |
ihelp=(tof11_i-1)*2+tof22_i |
ihelp=(tof11_i-1)*2+tof22_i |
1640 |
c1 = k_S11S22(1,ihelp) |
c1 = k_S11S22(1,ihelp) |
1641 |
|
if (iz.gt.2) c1 = c1 + k1corrC1 |
1642 |
c2 = k_S11S22(2,ihelp) |
c2 = k_S11S22(2,ihelp) |
1643 |
beta_a(10) = c2*F/(ds-c1) |
beta_a(10) = c2*F/(ds-c1) |
1644 |
|
|
1682 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1683 |
ihelp=(tof12_i-1)*2+tof21_i |
ihelp=(tof12_i-1)*2+tof21_i |
1684 |
c1 = k_S12S21(1,ihelp) |
c1 = k_S12S21(1,ihelp) |
1685 |
|
if (iz.gt.2) c1 = c1 + k1corrC1 |
1686 |
c2 = k_S12S21(2,ihelp) |
c2 = k_S12S21(2,ihelp) |
1687 |
beta_a(11) = c2*F/(ds-c1) |
beta_a(11) = c2*F/(ds-c1) |
1688 |
|
|
1726 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1727 |
ihelp=(tof12_i-1)*2+tof22_i |
ihelp=(tof12_i-1)*2+tof22_i |
1728 |
c1 = k_S12S22(1,ihelp) |
c1 = k_S12S22(1,ihelp) |
1729 |
|
if (iz.gt.2) c1 = c1 + k1corrC1 |
1730 |
c2 = k_S12S22(2,ihelp) |
c2 = k_S12S22(2,ihelp) |
1731 |
beta_a(12) = c2*F/(ds-c1) |
beta_a(12) = c2*F/(ds-c1) |
1732 |
|
|
1748 |
ENDIF |
ENDIF |
1749 |
|
|
1750 |
C------- |
C------- |
1751 |
|
C |
1752 |
|
C icount=0 |
1753 |
|
C sw=0. |
1754 |
|
C sxw=0. |
1755 |
|
C beta_mean=100. |
1756 |
|
C |
1757 |
|
C do i=1,12 |
1758 |
|
C if ((beta_a(i).gt.-1.5).and.(beta_a(i).lt.1.5)) then |
1759 |
|
C icount= icount+1 |
1760 |
|
C if (i.le.4) w_i=1./(0.13**2.) |
1761 |
|
C if ((i.ge.5).and.(i.le.8)) w_i=1./(0.16**2.) |
1762 |
|
C if (i.ge.9) w_i=1./(0.25**2.) ! to be checked |
1763 |
|
C sxw=sxw + beta_a(i)*w_i |
1764 |
|
C sw =sw + w_i |
1765 |
|
C endif |
1766 |
|
C enddo |
1767 |
|
C |
1768 |
|
C if (icount.gt.0) beta_mean=sxw/sw |
1769 |
|
C beta_a(13) = beta_mean |
1770 |
|
C |
1771 |
|
|
1772 |
icount=0 |
C------- New mean beta calculation |
|
sw=0. |
|
|
sxw=0. |
|
|
beta_mean=100. |
|
1773 |
|
|
1774 |
do i=1,12 |
do i=1,12 |
1775 |
if ((beta_a(i).gt.-1.5).and.(beta_a(i).lt.1.5)) then |
btemp(i) = beta_a(i) |
1776 |
icount= icount+1 |
enddo |
1777 |
if (i.le.4) w_i=1./(0.13**2.) |
|
1778 |
if ((i.ge.5).and.(i.le.8)) w_i=1./(0.16**2.) |
beta_a(13)=newbeta(2,btemp,hitvec,10.,10.,20.) |
|
if (i.ge.9) w_i=1./(0.25**2.) ! to be checked |
|
|
sxw=sxw + beta_a(i)*w_i |
|
|
sw =sw + w_i |
|
|
endif |
|
|
enddo |
|
1779 |
|
|
1780 |
if (icount.gt.0) beta_mean=sxw/sw |
C------- |
|
beta_a(13) = beta_mean |
|
1781 |
|
|
1782 |
|
|
1783 |
c IF (tof11_i.GT.none_find) |
c IF (tof11_i.GT.none_find) |
1807 |
c write(*,*) ytr_tof |
c write(*,*) ytr_tof |
1808 |
|
|
1809 |
|
|
|
|
|
1810 |
RETURN |
RETURN |
1811 |
END |
END |
1812 |
|
|
1815 |
|
|
1816 |
C------------------------------------------------------------------ |
C------------------------------------------------------------------ |
1817 |
|
|
1818 |
|
|