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 |
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 apr-08 WM: Bug found in S22 artificial ADC, mismatch found between the track |
51 |
|
C length from DOTRACK2 and "GetLength" method for 4 combinations |
52 |
C**************************************************************************** |
C**************************************************************************** |
53 |
IMPLICIT NONE |
IMPLICIT NONE |
54 |
C |
C |
81 |
REAL ds |
REAL ds |
82 |
REAL t1,t2,t3,t4 |
REAL t1,t2,t3,t4 |
83 |
REAL yhelp,xhelp,xhelp1,xhelp2 |
REAL yhelp,xhelp,xhelp1,xhelp2 |
84 |
REAL c1,c2,sw,sxw,w_i |
REAL c1,c2 |
85 |
|
C REAL sw,sxw,w_i |
86 |
REAL dist,dl,F |
REAL dist,dl,F |
87 |
INTEGER icount,ievent |
INTEGER ievent |
88 |
REAL xhelp_a,xhelp_t |
C INTEGER icount |
89 |
|
C REAL beta_mean |
90 |
REAL beta_mean |
REAL btemp(12) |
91 |
REAL hepratio |
REAL hepratio |
92 |
|
|
93 |
INTEGER j |
INTEGER j,hitvec(6) |
94 |
|
|
95 |
real atten,pc_adc |
real atten,pc_adc,check_charge,newbeta |
96 |
|
|
97 |
|
|
98 |
REAL theta,phi |
REAL theta,phi |
108 |
INTEGER ihelp |
INTEGER ihelp |
109 |
REAL xkorr,xpos |
REAL xkorr,xpos |
110 |
|
|
111 |
|
INTEGER IZ |
112 |
|
REAL k1corrA1,k1corrB1,k1corrC1 |
113 |
|
|
114 |
REAL yl,yh,xl,xh |
REAL yl,yh,xl,xh |
115 |
C |
C |
116 |
REAL hmemor(9000000) |
REAL hmemor(9000000) |
118 |
C |
C |
119 |
DATA ievent / 0 / |
DATA ievent / 0 / |
120 |
|
|
121 |
|
INTEGER ifst |
122 |
|
DATA ifst /0/ |
123 |
|
|
124 |
COMMON / pawcd / hmemor |
COMMON / pawcd / hmemor |
125 |
save / pawcd / |
save / pawcd / |
126 |
C |
C |
133 |
|
|
134 |
******************************************************************* |
******************************************************************* |
135 |
|
|
136 |
ievent = ievent +1 |
if (ifst.eq.0) then |
137 |
|
ifst=1 |
138 |
|
|
139 |
C ratio helium to proton ca. 4 |
C ratio helium to proton ca. 4 |
140 |
hepratio = 4. |
hepratio = 4. |
150 |
itdc = 1 |
itdc = 1 |
151 |
iadc = 2 |
iadc = 2 |
152 |
|
|
153 |
|
|
154 |
|
k1corrA1 = 0. |
155 |
|
k1corrB1 = -5.0 |
156 |
|
k1corrC1= 8.0 |
157 |
|
|
158 |
|
ENDIF ! ifst |
159 |
|
|
160 |
|
******************************************************************* |
161 |
|
|
162 |
|
ievent = ievent +1 |
163 |
|
|
164 |
do i=1,13 |
do i=1,13 |
165 |
beta_a(i) = 100. |
beta_a(i) = 100. |
166 |
enddo |
enddo |
201 |
ytr_tof(j) = 100. |
ytr_tof(j) = 100. |
202 |
enddo |
enddo |
203 |
|
|
204 |
|
|
205 |
C---------------------------------------------------------------------- |
C---------------------------------------------------------------------- |
206 |
C-------------------------get ToF data -------------------------------- |
C-------------------------get ToF data -------------------------------- |
207 |
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 |
537 |
|
|
538 |
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 |
539 |
|
|
540 |
C----------------------------------------------------------------------- |
hitvec(1)=tof11_i |
541 |
C--------------------Insert Artifical TDC Value --------------------- |
hitvec(2)=tof12_i |
542 |
C For each Paddle perform check: |
hitvec(3)=tof21_i |
543 |
C if left paddle=4095 and right paddle OK => create TDC value left |
hitvec(4)=tof22_i |
544 |
C if right paddle=4095 and left paddle OK => create TDC value right |
hitvec(5)=tof31_i |
545 |
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 |
|
546 |
|
|
547 |
C-----------------------S31 ----------------------------------------- |
c write(*,*) 'toftrk ', |
548 |
|
c & tof11_i,tof12_i,tof21_i,tof22_i,tof31_i,tof32_i |
549 |
|
|
550 |
IF (tof31_i.GT.none_find) THEN |
C---------------------------------------------------------------------- |
551 |
xpos = yout(5) |
C--- check charge: |
552 |
i = tof31_i |
C--- if Z=2 we should use the attenuation curve for helium to |
553 |
if ((tof31(1,tof31_i,itdc).EQ.4095).AND. |
C--- fill the artificail ADC values and NOT divide by "hepratio" |
554 |
& (tof31(2,tof31_i,itdc).LT.4095)) THEN |
C--- if Z>2 we should do a correction to |
555 |
tof31(1,tof31_i,itdc) = tof31(2,tof31_i,itdc) |
C--- the k1 constants in the beta calculation |
556 |
& + 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 |
|
557 |
|
|
558 |
C-----------------------S32 ----------------------------------------- |
theta=0. |
559 |
|
dist = ZTOF(1) - ZTOF(5) |
560 |
|
dl = 0. |
561 |
|
DO I=1,5 |
562 |
|
dl = dl + TLOUT(i) |
563 |
|
ENDDO |
564 |
|
F = dl/dist |
565 |
|
theta = acos(1/F) |
566 |
|
|
567 |
IF (tof32_i.GT.none_find) THEN |
iz = int(check_charge(theta,hitvec)) |
568 |
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 |
|
569 |
|
|
570 |
C-------------------------------------------------------------------- |
C-------------------------------------------------------------------- |
571 |
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 |
583 |
yhelp=yout(1) |
yhelp=yout(1) |
584 |
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 |
585 |
i = tof11_i |
i = tof11_i |
586 |
if ((tof11(left,tof11_i,itdc).LT.4095).AND. |
if ((tdc(ch11a(i),hb11a(i)).lt.4095).AND. |
587 |
& (adc(ch11a(i),hb11a(i)).eq.4095)) then |
& (adc(ch11a(i),hb11a(i)).eq.4095)) then |
588 |
phi = atan(tan(THYOUT(1))/tan(THXOUT(1))) |
phi = atan(tan(THYOUT(1))/tan(THXOUT(1))) |
589 |
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)) |
|
590 |
xkorr = atten(left,11,i,yhelp) |
xkorr = atten(left,11,i,yhelp) |
591 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
592 |
tof11(left,i,iadc)=xkorr/cos(theta) |
tof11(left,i,iadc)=xkorr/cos(theta) |
593 |
adcflag(ch11a(i),hb11a(i)) = 1 |
adcflag(ch11a(i),hb11a(i)) = 1 |
594 |
endif |
endif |
595 |
if ((tof11(right,tof11_i,itdc).LT.4095).AND. |
if ((tdc(ch11b(i),hb11b(i)).lt.4095).AND. |
596 |
& (adc(ch11b(i),hb11b(i)).eq.4095)) then |
& (adc(ch11b(i),hb11b(i)).eq.4095)) then |
597 |
phi = atan(tan(THYOUT(1))/tan(THXOUT(1))) |
phi = atan(tan(THYOUT(1))/tan(THXOUT(1))) |
598 |
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)) |
|
599 |
xkorr = atten(right,11,i,yhelp) |
xkorr = atten(right,11,i,yhelp) |
600 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
601 |
tof11(right,i,iadc)=xkorr/cos(theta) |
tof11(right,i,iadc)=xkorr/cos(theta) |
602 |
adcflag(ch11b(i),hb11b(i)) = 1 |
adcflag(ch11b(i),hb11b(i)) = 1 |
603 |
endif |
endif |
606 |
xhelp=xout(2) |
xhelp=xout(2) |
607 |
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 |
608 |
i = tof12_i |
i = tof12_i |
609 |
if ((tof12(left,tof12_i,itdc).LT.4095).AND. |
if ((tdc(ch12a(i),hb12a(i)).lt.4095).AND. |
610 |
& (adc(ch12a(i),hb12a(i)).eq.4095)) then |
& (adc(ch12a(i),hb12a(i)).eq.4095)) then |
611 |
phi = atan(tan(THYOUT(2))/tan(THXOUT(2))) |
phi = atan(tan(THYOUT(2))/tan(THXOUT(2))) |
612 |
theta = atan(tan(THXOUT(2))/cos(phi)) |
theta = atan(tan(THXOUT(2))/cos(phi)) |
613 |
c xkorr=adcx12(left,i,1)*exp(-xhelp/adcx12(left,i,2)) |
c xkorr=adcx12(left,i,1)*exp(-xhelp/adcx12(left,i,2)) |
614 |
xkorr = atten(left,12,i,xhelp) |
xkorr = atten(left,12,i,xhelp) |
615 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
616 |
tof12(left,i,iadc) = xkorr/cos(theta) |
tof12(left,i,iadc) = xkorr/cos(theta) |
617 |
adcflag(ch12a(i),hb12a(i)) = 1 |
adcflag(ch12a(i),hb12a(i)) = 1 |
618 |
endif |
endif |
619 |
if ((tof12(right,tof12_i,itdc).LT.4095).AND. |
if ((tdc(ch12b(i),hb12b(i)).lt.4095).AND. |
620 |
& (adc(ch12b(i),hb12b(i)).eq.4095)) then |
& (adc(ch12b(i),hb12b(i)).eq.4095)) then |
621 |
phi = atan(tan(THYOUT(2))/tan(THXOUT(2))) |
phi = atan(tan(THYOUT(2))/tan(THXOUT(2))) |
622 |
theta = atan(tan(THXOUT(2))/cos(phi)) |
theta = atan(tan(THXOUT(2))/cos(phi)) |
623 |
c xkorr=adcx12(right,i,1)*exp(xhelp/adcx12(right,i,2)) |
c xkorr=adcx12(right,i,1)*exp(xhelp/adcx12(right,i,2)) |
624 |
xkorr = atten(right,12,i,xhelp) |
xkorr = atten(right,12,i,xhelp) |
625 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
626 |
tof12(right,i,iadc) = xkorr/cos(theta) |
tof12(right,i,iadc) = xkorr/cos(theta) |
627 |
adcflag(ch12b(i),hb12b(i)) = 1 |
adcflag(ch12b(i),hb12b(i)) = 1 |
628 |
endif |
endif |
633 |
xhelp=xout(3) |
xhelp=xout(3) |
634 |
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 |
635 |
i = tof21_i |
i = tof21_i |
636 |
if ((tof21(left,tof21_i,itdc).LT.4095).AND. |
if ((tdc(ch21a(i),hb21a(i)).lt.4095).AND. |
637 |
& (adc(ch21a(i),hb21a(i)).eq.4095)) then |
& (adc(ch21a(i),hb21a(i)).eq.4095)) then |
638 |
phi = atan(tan(THYOUT(3))/tan(THXOUT(3))) |
phi = atan(tan(THYOUT(3))/tan(THXOUT(3))) |
639 |
theta = atan(tan(THXOUT(3))/cos(phi)) |
theta = atan(tan(THXOUT(3))/cos(phi)) |
640 |
c xkorr=adcx21(left,i,1)*exp(-xhelp/adcx21(left,i,2)) |
c xkorr=adcx21(left,i,1)*exp(-xhelp/adcx21(left,i,2)) |
641 |
xkorr = atten(left,21,i,xhelp) |
xkorr = atten(left,21,i,xhelp) |
642 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
643 |
tof21(left,i,iadc) = xkorr/cos(theta) |
tof21(left,i,iadc) = xkorr/cos(theta) |
644 |
adcflag(ch21a(i),hb21a(i)) = 1 |
adcflag(ch21a(i),hb21a(i)) = 1 |
645 |
endif |
endif |
646 |
if ((tof21(right,tof21_i,itdc).LT.4095).AND. |
if ((tdc(ch21b(i),hb21b(i)).lt.4095).AND. |
647 |
& (adc(ch21b(i),hb21b(i)).eq.4095)) then |
& (adc(ch21b(i),hb21b(i)).eq.4095)) then |
648 |
phi = atan(tan(THYOUT(3))/tan(THXOUT(3))) |
phi = atan(tan(THYOUT(3))/tan(THXOUT(3))) |
649 |
theta = atan(tan(THXOUT(3))/cos(phi)) |
theta = atan(tan(THXOUT(3))/cos(phi)) |
650 |
c xkorr=adcx21(right,i,1)*exp(xhelp/adcx21(right,i,2)) |
c xkorr=adcx21(right,i,1)*exp(xhelp/adcx21(right,i,2)) |
651 |
xkorr = atten(right,21,i,xhelp) |
xkorr = atten(right,21,i,xhelp) |
652 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
653 |
tof21(right,i,iadc) = xkorr/cos(theta) |
tof21(right,i,iadc) = xkorr/cos(theta) |
654 |
adcflag(ch21b(i),hb21b(i)) = 1 |
adcflag(ch21b(i),hb21b(i)) = 1 |
655 |
endif |
endif |
659 |
yhelp=yout(4) |
yhelp=yout(4) |
660 |
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 |
661 |
i = tof22_i |
i = tof22_i |
662 |
if ((tof22(left,tof22_i,itdc).LT.4095).AND. |
if ((tdc(ch22a(i),hb22a(i)).lt.4095).AND. |
663 |
& (adc(ch22a(i),hb22a(i)).eq.4095)) then |
& (adc(ch22a(i),hb22a(i)).eq.4095)) then |
664 |
phi = atan(tan(THYOUT(4))/tan(THXOUT(4))) |
phi = atan(tan(THYOUT(4))/tan(THXOUT(4))) |
665 |
theta = atan(tan(THXOUT(4))/cos(phi)) |
theta = atan(tan(THXOUT(4))/cos(phi)) |
666 |
c xkorr=adcx22(left,i,1)*exp(-yhelp/adcx22(left,i,2)) |
c xkorr=adcx22(left,i,1)*exp(-yhelp/adcx22(left,i,2)) |
667 |
xkorr = atten(left,22,i,yhelp) |
xkorr = atten(left,22,i,yhelp) |
668 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
669 |
tof22(left,i,iadc) = xkorr/cos(theta) |
tof22(left,i,iadc) = xkorr/cos(theta) |
670 |
adcflag(ch22a(i),hb22a(i)) = 1 |
adcflag(ch22a(i),hb22a(i)) = 1 |
671 |
endif |
endif |
672 |
if ((tof22(right,tof22_i,itdc).LT.4095).AND. |
if ((tdc(ch22b(i),hb22b(i)).lt.4095).AND. |
673 |
& (adc(ch22b(i),hb22b(i)).eq.4095)) then |
& (adc(ch22b(i),hb22b(i)).eq.4095)) then |
674 |
phi = atan(tan(THYOUT(4))/tan(THXOUT(4))) |
phi = atan(tan(THYOUT(4))/tan(THXOUT(4))) |
675 |
theta = atan(tan(THXOUT(4))/cos(phi)) |
theta = atan(tan(THXOUT(4))/cos(phi)) |
676 |
c xkorr=adcx22(right,i,1)*exp(yhelp/adcx22(right,i,2)) |
c xkorr=adcx22(right,i,1)*exp(yhelp/adcx22(right,i,2)) |
677 |
xkorr = atten(right,22,i,yhelp) |
xkorr = atten(right,22,i,yhelp) |
678 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
679 |
tof22(right,i,iadc) = xkorr/cos(theta) |
tof22(right,i,iadc) = xkorr/cos(theta) |
680 |
adcflag(ch22b(i),hb22b(i)) = 1 |
adcflag(ch22b(i),hb22b(i)) = 1 |
681 |
endif |
endif |
686 |
yhelp=yout(5) |
yhelp=yout(5) |
687 |
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 |
688 |
i = tof31_i |
i = tof31_i |
689 |
if ((tof31(left,tof31_i,itdc).LT.4095).AND. |
if ((tdc(ch31a(i),hb31a(i)).lt.4095).AND. |
690 |
& (adc(ch31a(i),hb31a(i)).eq.4095)) then |
& (adc(ch31a(i),hb31a(i)).eq.4095)) then |
691 |
phi = atan(tan(THYOUT(5))/tan(THXOUT(5))) |
phi = atan(tan(THYOUT(5))/tan(THXOUT(5))) |
692 |
theta = atan(tan(THXOUT(5))/cos(phi)) |
theta = atan(tan(THXOUT(5))/cos(phi)) |
693 |
c xkorr=adcx31(left,i,1)*exp(-yhelp/adcx31(left,i,2)) |
c xkorr=adcx31(left,i,1)*exp(-yhelp/adcx31(left,i,2)) |
694 |
xkorr = atten(left,31,i,yhelp) |
xkorr = atten(left,31,i,yhelp) |
695 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
696 |
tof31(left,i,iadc) = xkorr/cos(theta) |
tof31(left,i,iadc) = xkorr/cos(theta) |
697 |
adcflag(ch31a(i),hb31a(i)) = 1 |
adcflag(ch31a(i),hb31a(i)) = 1 |
698 |
endif |
endif |
699 |
if ((tof31(right,tof31_i,itdc).LT.4095).AND. |
if ((tdc(ch31b(i),hb31b(i)).lt.4095).AND. |
700 |
& (adc(ch31b(i),hb31b(i)).eq.4095)) then |
& (adc(ch31b(i),hb31b(i)).eq.4095)) then |
701 |
phi = atan(tan(THYOUT(5))/tan(THXOUT(5))) |
phi = atan(tan(THYOUT(5))/tan(THXOUT(5))) |
702 |
theta = atan(tan(THXOUT(5))/cos(phi)) |
theta = atan(tan(THXOUT(5))/cos(phi)) |
703 |
c xkorr=adcx31(right,i,1)*exp(yhelp/adcx31(right,i,2)) |
c xkorr=adcx31(right,i,1)*exp(yhelp/adcx31(right,i,2)) |
704 |
xkorr = atten(right,31,i,yhelp) |
xkorr = atten(right,31,i,yhelp) |
705 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
706 |
tof31(right,i,iadc) = xkorr/cos(theta) |
tof31(right,i,iadc) = xkorr/cos(theta) |
707 |
adcflag(ch31b(i),hb31b(i)) = 1 |
adcflag(ch31b(i),hb31b(i)) = 1 |
708 |
endif |
endif |
712 |
xhelp=xout(6) |
xhelp=xout(6) |
713 |
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 |
714 |
i = tof32_i |
i = tof32_i |
715 |
if ((tof32(left,tof32_i,itdc).LT.4095).AND. |
if ((tdc(ch32a(i),hb32a(i)).lt.4095).AND. |
716 |
& (adc(ch32a(i),hb32a(i)).eq.4095)) then |
& (adc(ch32a(i),hb32a(i)).eq.4095)) then |
717 |
phi = atan(tan(THYOUT(6))/tan(THXOUT(6))) |
phi = atan(tan(THYOUT(6))/tan(THXOUT(6))) |
718 |
theta = atan(tan(THXOUT(6))/cos(phi)) |
theta = atan(tan(THXOUT(6))/cos(phi)) |
719 |
c xkorr=adcx32(left,i,1)*exp(-xhelp/adcx32(left,i,2)) |
c xkorr=adcx32(left,i,1)*exp(-xhelp/adcx32(left,i,2)) |
720 |
xkorr = atten(left,32,i,xhelp) |
xkorr = atten(left,32,i,xhelp) |
721 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
722 |
tof32(left,i,iadc) = xkorr/cos(theta) |
tof32(left,i,iadc) = xkorr/cos(theta) |
723 |
adcflag(ch32a(i),hb32a(i)) = 1 |
adcflag(ch32a(i),hb32a(i)) = 1 |
724 |
endif |
endif |
725 |
if ((tof32(right,tof32_i,itdc).LT.4095).AND. |
if ((tdc(ch32b(i),hb32b(i)).lt.4095).AND. |
726 |
& (adc(ch32b(i),hb32b(i)).eq.4095)) then |
& (adc(ch32b(i),hb32b(i)).eq.4095)) then |
727 |
phi = atan(tan(THYOUT(6))/tan(THXOUT(6))) |
phi = atan(tan(THYOUT(6))/tan(THXOUT(6))) |
728 |
theta = atan(tan(THXOUT(6))/cos(phi)) |
theta = atan(tan(THXOUT(6))/cos(phi)) |
729 |
c xkorr=adcx32(right,i,1)*exp(xhelp/adcx32(right,i,2)) |
c xkorr=adcx32(right,i,1)*exp(xhelp/adcx32(right,i,2)) |
730 |
xkorr = atten(right,32,i,xhelp) |
xkorr = atten(right,32,i,xhelp) |
731 |
xkorr=xkorr/hepratio |
if (iz.le.1) xkorr=xkorr/hepratio |
732 |
tof32(right,i,iadc) = xkorr/cos(theta) |
tof32(right,i,iadc) = xkorr/cos(theta) |
733 |
adcflag(ch32b(i),hb32b(i)) = 1 |
adcflag(ch32b(i),hb32b(i)) = 1 |
734 |
endif |
endif |
735 |
ENDIF |
ENDIF |
736 |
|
|
737 |
|
C------------------------------------------------------------------- |
738 |
|
C Now there is for each hitted paddle a TDC and ADC value, if the |
739 |
|
C TDC was < 4095. |
740 |
|
C There might be also TDC-ADC pairs in paddles not hitted |
741 |
|
C Let's correct the raw TDC value with the time walk |
742 |
|
C------------------------------------------------------------------- |
743 |
|
C--------------------Time walk correction ------------------------- |
744 |
|
C------------------------------------------------------------------- |
745 |
|
|
746 |
|
DO i=1,8 |
747 |
|
if ((tdc(ch11a(i),hb11a(i)).lt.4095).and. |
748 |
|
& (tof11(left,i,iadc).lt.3786)) THEN |
749 |
|
xhelp = tw11(left,i)/(tof11(left,i,iadc)**0.5) |
750 |
|
tof11(left,i,itdc) = tof11(left,i,itdc) + xhelp |
751 |
|
tdc_c(ch11a(i),hb11a(i))=tof11(left,i,itdc) |
752 |
|
ENDIF |
753 |
|
|
754 |
|
if ((tdc(ch11b(i),hb11b(i)).lt.4095).and. |
755 |
|
& (tof11(right,i,iadc).lt.3786)) THEN |
756 |
|
xhelp = tw11(right,i)/(tof11(right,i,iadc)**0.5) |
757 |
|
tof11(right,i,itdc) = tof11(right,i,itdc) + xhelp |
758 |
|
tdc_c(ch11b(i),hb11b(i))=tof11(right,i,itdc) |
759 |
|
ENDIF |
760 |
|
ENDDO |
761 |
|
|
762 |
|
|
763 |
|
DO i=1,6 |
764 |
|
if ((tdc(ch12a(i),hb12a(i)).lt.4095).and. |
765 |
|
& (tof12(left,i,iadc).lt.3786)) THEN |
766 |
|
xhelp = tw12(left,i)/(tof12(left,i,iadc)**0.5) |
767 |
|
tof12(left,i,itdc) = tof12(left,i,itdc) + xhelp |
768 |
|
tdc_c(ch12a(i),hb12a(i))=tof12(left,i,itdc) |
769 |
|
ENDIF |
770 |
|
|
771 |
|
if ((tdc(ch12b(i),hb12b(i)).lt.4095).and. |
772 |
|
& (tof12(right,i,iadc).lt.3786)) THEN |
773 |
|
xhelp = tw12(right,i)/(tof12(right,i,iadc)**0.5) |
774 |
|
tof12(right,i,itdc) = tof12(right,i,itdc) + xhelp |
775 |
|
tdc_c(ch12b(i),hb12b(i))=tof12(right,i,itdc) |
776 |
|
ENDIF |
777 |
|
ENDDO |
778 |
|
|
779 |
|
C---- |
780 |
|
DO I=1,2 |
781 |
|
if ((tdc(ch21a(i),hb21a(i)).lt.4095).and. |
782 |
|
& (tof21(left,i,iadc).lt.3786)) THEN |
783 |
|
xhelp = tw21(left,i)/(tof21(left,i,iadc)**0.5) |
784 |
|
tof21(left,i,itdc) = tof21(left,i,itdc) + xhelp |
785 |
|
tdc_c(ch21a(i),hb21a(i))=tof21(left,i,itdc) |
786 |
|
ENDIF |
787 |
|
|
788 |
|
if ((tdc(ch21b(i),hb21b(i)).lt.4095).and. |
789 |
|
& (tof21(right,i,iadc).lt.3786)) THEN |
790 |
|
xhelp = tw21(right,i)/(tof21(right,i,iadc)**0.5) |
791 |
|
tof21(right,i,itdc) = tof21(right,i,itdc) + xhelp |
792 |
|
tdc_c(ch21b(i),hb21b(i))=tof21(right,i,itdc) |
793 |
|
ENDIF |
794 |
|
ENDDO |
795 |
|
|
796 |
|
DO I=1,2 |
797 |
|
if ((tdc(ch22a(i),hb22a(i)).lt.4095).and. |
798 |
|
& (tof22(left,i,iadc).lt.3786)) THEN |
799 |
|
xhelp = tw22(left,i)/(tof22(left,i,iadc)**0.5) |
800 |
|
tof22(left,i,itdc) = tof22(left,i,itdc) + xhelp |
801 |
|
tdc_c(ch22a(i),hb22a(i))=tof22(left,i,itdc) |
802 |
|
ENDIF |
803 |
|
|
804 |
|
if ((tdc(ch22b(i),hb22b(i)).lt.4095).and. |
805 |
|
& (tof22(right,i,iadc).lt.3786)) THEN |
806 |
|
xhelp = tw22(right,i)/(tof22(right,i,iadc)**0.5) |
807 |
|
tof22(right,i,itdc) = tof22(right,i,itdc) + xhelp |
808 |
|
tdc_c(ch22b(i),hb22b(i))=tof22(right,i,itdc) |
809 |
|
ENDIF |
810 |
|
ENDDO |
811 |
|
|
812 |
|
C---- |
813 |
|
DO I=1,3 |
814 |
|
if ((tdc(ch31a(i),hb31a(i)).lt.4095).and. |
815 |
|
& (tof31(left,i,iadc).lt.3786)) THEN |
816 |
|
xhelp = tw31(left,i)/(tof31(left,i,iadc)**0.5) |
817 |
|
tof31(left,i,itdc) = tof31(left,i,itdc) + xhelp |
818 |
|
tdc_c(ch31a(i),hb31a(i))=tof31(left,i,itdc) |
819 |
|
ENDIF |
820 |
|
|
821 |
|
if ((tdc(ch31b(i),hb31b(i)).lt.4095).and. |
822 |
|
& (tof31(right,i,iadc).lt.3786)) THEN |
823 |
|
xhelp = tw31(right,i)/(tof31(right,i,iadc)**0.5) |
824 |
|
tof31(right,i,itdc) = tof31(right,i,itdc) + xhelp |
825 |
|
tdc_c(ch31b(i),hb31b(i))=tof31(right,i,itdc) |
826 |
|
ENDIF |
827 |
|
ENDDO |
828 |
|
|
829 |
|
DO I=1,3 |
830 |
|
if ((tdc(ch32a(i),hb32a(i)).lt.4095).and. |
831 |
|
& (tof32(left,i,iadc).lt.3786)) THEN |
832 |
|
xhelp = tw32(left,i)/(tof32(left,i,iadc)**0.5) |
833 |
|
tof32(left,i,itdc) = tof32(left,i,itdc) + xhelp |
834 |
|
tdc_c(ch32a(i),hb32a(i))=tof32(left,i,itdc) |
835 |
|
ENDIF |
836 |
|
|
837 |
|
if ((tdc(ch32b(i),hb32b(i)).lt.4095).and. |
838 |
|
& (tof32(right,i,iadc).lt.3786)) THEN |
839 |
|
xhelp = tw32(right,i)/(tof32(right,i,iadc)**0.5) |
840 |
|
tof32(right,i,itdc) = tof32(right,i,itdc) + xhelp |
841 |
|
tdc_c(ch32b(i),hb32b(i))=tof32(right,i,itdc) |
842 |
|
ENDIF |
843 |
|
ENDDO |
844 |
|
|
845 |
|
|
846 |
|
C----------------------------------------------------------------------- |
847 |
|
C--------------------Insert Artifical TDC Value --------------------- |
848 |
|
C For each Paddle perform check: |
849 |
|
C if left paddle=4095 and right paddle OK => create TDC value left |
850 |
|
C if right paddle=4095 and left paddle OK => create TDC value right |
851 |
|
C----------------------------------------------------------------------- |
852 |
|
|
853 |
|
C-----------------------S11 ----------------------------------------- |
854 |
|
|
855 |
|
IF (tof11_i.GT.none_find) THEN |
856 |
|
xpos = yout(1) |
857 |
|
i = tof11_i |
858 |
|
if ((tdc(ch11a(i),hb11a(i)).EQ.4095).AND. |
859 |
|
& (tdc(ch11b(i),hb11b(i)).LT.4095)) THEN |
860 |
|
tof11(1,tof11_i,itdc) = tof11(2,tof11_i,itdc) |
861 |
|
& + 2*(y_coor_lin11(tof11_i,offset) |
862 |
|
& + xpos*y_coor_lin11(tof11_i,slope)) |
863 |
|
tdcflag(ch11a(i),hb11a(i)) = 1 |
864 |
|
ENDIF |
865 |
|
|
866 |
|
if ((tdc(ch11b(i),hb11b(i)).EQ.4095).AND. |
867 |
|
& (tdc(ch11a(i),hb11a(i)).LT.4095)) THEN |
868 |
|
tof11(2,tof11_i,itdc) = tof11(1,tof11_i,itdc) |
869 |
|
& - 2*(y_coor_lin11(tof11_i,offset) |
870 |
|
& + xpos*y_coor_lin11(tof11_i,slope)) |
871 |
|
tdcflag(ch11b(i),hb11b(i)) = 1 |
872 |
|
ENDIF |
873 |
|
|
874 |
|
ENDIF |
875 |
|
|
876 |
|
C-----------------------S12 ----------------------------------------- |
877 |
|
|
878 |
|
IF (tof12_i.GT.none_find) THEN |
879 |
|
xpos = xout(2) |
880 |
|
i = tof12_i |
881 |
|
if ((tdc(ch12a(i),hb12a(i)).EQ.4095).AND. |
882 |
|
& (tdc(ch12b(i),hb12b(i)).LT.4095)) THEN |
883 |
|
tof12(1,tof12_i,itdc) = tof12(2,tof12_i,itdc) |
884 |
|
& + 2*(x_coor_lin12(tof12_i,offset) |
885 |
|
& + xpos*x_coor_lin12(tof12_i,slope)) |
886 |
|
tdcflag(ch12a(i),hb12a(i)) = 1 |
887 |
|
ENDIF |
888 |
|
|
889 |
|
if ((tdc(ch12b(i),hb12b(i)).EQ.4095).AND. |
890 |
|
& (tdc(ch12a(i),hb12a(i)).LT.4095)) THEN |
891 |
|
tof12(2,tof12_i,itdc) = tof12(1,tof12_i,itdc) |
892 |
|
& - 2*(x_coor_lin12(tof12_i,offset) |
893 |
|
& + xpos*x_coor_lin12(tof12_i,slope)) |
894 |
|
tdcflag(ch12b(i),hb12b(i)) = 1 |
895 |
|
ENDIF |
896 |
|
ENDIF |
897 |
|
|
898 |
|
C-----------------------S21 ----------------------------------------- |
899 |
|
|
900 |
|
IF (tof21_i.GT.none_find) THEN |
901 |
|
xpos = xout(3) |
902 |
|
i = tof21_i |
903 |
|
if ((tdc(ch21a(i),hb21a(i)).EQ.4095).AND. |
904 |
|
& (tdc(ch21b(i),hb21b(i)).LT.4095)) THEN |
905 |
|
tof21(1,tof21_i,itdc) = tof21(2,tof21_i,itdc) |
906 |
|
& + 2*(x_coor_lin21(tof21_i,offset) |
907 |
|
& + xpos*x_coor_lin21(tof21_i,slope)) |
908 |
|
tdcflag(ch21a(i),hb21a(i)) = 1 |
909 |
|
ENDIF |
910 |
|
|
911 |
|
if ((tdc(ch21b(i),hb21b(i)).EQ.4095).AND. |
912 |
|
& (tdc(ch21a(i),hb21a(i)).LT.4095)) THEN |
913 |
|
tof21(2,tof21_i,itdc) = tof21(1,tof21_i,itdc) |
914 |
|
& - 2*(x_coor_lin21(tof21_i,offset) |
915 |
|
& + xpos*x_coor_lin21(tof21_i,slope)) |
916 |
|
tdcflag(ch21b(i),hb21b(i)) = 1 |
917 |
|
ENDIF |
918 |
|
ENDIF |
919 |
|
|
920 |
|
C-----------------------S22 ----------------------------------------- |
921 |
|
|
922 |
|
IF (tof22_i.GT.none_find) THEN |
923 |
|
xpos = yout(4) |
924 |
|
i = tof22_i |
925 |
|
if ((tdc(ch22a(i),hb22a(i)).EQ.4095).AND. |
926 |
|
& (tdc(ch22b(i),hb22b(i)).LT.4095)) THEN |
927 |
|
tof22(1,tof22_i,itdc) = tof22(2,tof22_i,itdc) |
928 |
|
& + 2*(y_coor_lin22(tof22_i,offset) |
929 |
|
& + xpos*y_coor_lin22(tof22_i,slope)) |
930 |
|
tdcflag(ch22a(i),hb22a(i)) = 1 |
931 |
|
ENDIF |
932 |
|
|
933 |
|
if ((tdc(ch22b(i),hb22b(i)).EQ.4095).AND. |
934 |
|
& (tdc(ch22a(i),hb22a(i)).LT.4095)) THEN |
935 |
|
tof22(2,tof22_i,itdc) = tof22(1,tof22_i,itdc) |
936 |
|
& - 2*(y_coor_lin22(tof22_i,offset) |
937 |
|
& + xpos*y_coor_lin22(tof22_i,slope)) |
938 |
|
tdcflag(ch22b(i),hb22b(i)) = 1 |
939 |
|
ENDIF |
940 |
|
ENDIF |
941 |
|
|
942 |
|
C-----------------------S31 ----------------------------------------- |
943 |
|
|
944 |
|
IF (tof31_i.GT.none_find) THEN |
945 |
|
xpos = yout(5) |
946 |
|
i = tof31_i |
947 |
|
if ((tdc(ch31a(i),hb31a(i)).EQ.4095).AND. |
948 |
|
& (tdc(ch31b(i),hb31b(i)).LT.4095)) THEN |
949 |
|
tof31(1,tof31_i,itdc) = tof31(2,tof31_i,itdc) |
950 |
|
& + 2*(y_coor_lin31(tof31_i,offset) |
951 |
|
& + xpos*y_coor_lin31(tof31_i,slope)) |
952 |
|
tdcflag(ch31a(i),hb31a(i)) = 1 |
953 |
|
ENDIF |
954 |
|
|
955 |
|
if ((tdc(ch31b(i),hb31b(i)).EQ.4095).AND. |
956 |
|
& (tdc(ch31a(i),hb31a(i)).LT.4095)) THEN |
957 |
|
tof31(2,tof31_i,itdc) = tof31(1,tof31_i,itdc) |
958 |
|
& - 2*(y_coor_lin31(tof31_i,offset) |
959 |
|
& + xpos*y_coor_lin31(tof31_i,slope)) |
960 |
|
tdcflag(ch31b(i),hb31b(i)) = 1 |
961 |
|
ENDIF |
962 |
|
ENDIF |
963 |
|
|
964 |
|
C-----------------------S32 ----------------------------------------- |
965 |
|
|
966 |
|
IF (tof32_i.GT.none_find) THEN |
967 |
|
xpos = xout(6) |
968 |
|
i = tof32_i |
969 |
|
if ((tdc(ch32a(i),hb32a(i)).EQ.4095).AND. |
970 |
|
& (tdc(ch32b(i),hb32b(i)).LT.4095)) THEN |
971 |
|
tof32(1,tof32_i,itdc) = tof32(2,tof32_i,itdc) |
972 |
|
& + 2*(x_coor_lin32(tof32_i,offset) |
973 |
|
& + xpos*x_coor_lin32(tof32_i,slope)) |
974 |
|
tdcflag(ch32a(i),hb32a(i)) = 1 |
975 |
|
ENDIF |
976 |
|
|
977 |
|
if ((tdc(ch32b(i),hb32b(i)).EQ.4095).AND. |
978 |
|
& (tdc(ch32a(i),hb32a(i)).LT.4095)) THEN |
979 |
|
tof32(2,tof32_i,itdc) = tof32(1,tof32_i,itdc) |
980 |
|
& - 2*(x_coor_lin32(tof32_i,offset) |
981 |
|
& + xpos*x_coor_lin32(tof32_i,slope)) |
982 |
|
tdcflag(ch32b(i),hb32b(i)) = 1 |
983 |
|
ENDIF |
984 |
|
ENDIF |
985 |
|
|
986 |
|
|
987 |
C------------------------------------------------------------------ |
C------------------------------------------------------------------ |
988 |
C--- calculate track position in paddle using timing difference |
C--- calculate track position in paddle using timing difference |
992 |
xtofpos(i)=100. |
xtofpos(i)=100. |
993 |
ytofpos(i)=100. |
ytofpos(i)=100. |
994 |
enddo |
enddo |
995 |
|
|
996 |
C-----------------------------S1 -------------------------------- |
C-----------------------------S1 -------------------------------- |
997 |
|
|
998 |
IF (tof11_i.GT.none_find) THEN |
IF (tof11_i.GT.none_find) THEN |
1064 |
|
|
1065 |
|
|
1066 |
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
1067 |
C--------------------------------------------------------------------- |
C--------------------------------------------------------------------- |
1068 |
C--------------------Corrections on ADC-data ------------------------- |
C--------------------Corrections on ADC-data ------------------------- |
1069 |
C-----------------angle and ADC(x) correction ----------------------- |
C-----------------angle and ADC(x) correction ----------------------- |
1080 |
i = tof11_i |
i = tof11_i |
1081 |
|
|
1082 |
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 |
|
1083 |
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)) |
|
1084 |
xkorr = atten(left,11,i,yhelp) |
xkorr = atten(left,11,i,yhelp) |
1085 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1086 |
adc_c(ch11a(i),hb11a(i))=tof11(left,i,iadc)/xkorr |
adc_c(ch11a(i),hb11a(i))=tof11(left,i,iadc)/xkorr |
1088 |
|
|
1089 |
|
|
1090 |
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 |
|
1091 |
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)) |
|
1092 |
xkorr = atten(right,11,i,yhelp) |
xkorr = atten(right,11,i,yhelp) |
1093 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1094 |
adc_c(ch11b(i),hb11b(i))=tof11(right,i,iadc)/xkorr |
adc_c(ch11b(i),hb11b(i))=tof11(right,i,iadc)/xkorr |
1099 |
xhelp=xout(2) |
xhelp=xout(2) |
1100 |
phi = atan(tan(THYOUT(2))/tan(THXOUT(2))) |
phi = atan(tan(THYOUT(2))/tan(THXOUT(2))) |
1101 |
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 |
|
1102 |
|
|
1103 |
|
IF (tof12_i.GT.none_find.AND.xhelp.lt.100) THEN |
1104 |
i = tof12_i |
i = tof12_i |
1105 |
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 |
|
1106 |
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)) |
|
1107 |
xkorr = atten(left,12,i,xhelp) |
xkorr = atten(left,12,i,xhelp) |
1108 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1109 |
adc_c(ch12a(i),hb12a(i))=tof12(left,i,iadc)/xkorr |
adc_c(ch12a(i),hb12a(i))=tof12(left,i,iadc)/xkorr |
1110 |
endif |
endif |
1111 |
|
|
1112 |
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 |
|
1113 |
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)) |
|
1114 |
xkorr = atten(right,12,i,xhelp) |
xkorr = atten(right,12,i,xhelp) |
1115 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1116 |
adc_c(ch12b(i),hb12b(i))=tof12(right,i,iadc)/xkorr |
adc_c(ch12b(i),hb12b(i))=tof12(right,i,iadc)/xkorr |
1122 |
xhelp=xout(3) |
xhelp=xout(3) |
1123 |
phi = atan(tan(THYOUT(3))/tan(THXOUT(3))) |
phi = atan(tan(THYOUT(3))/tan(THXOUT(3))) |
1124 |
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 |
|
1125 |
|
|
1126 |
|
IF (tof21_i.GT.none_find.AND.xhelp.lt.100) THEN |
1127 |
i = tof21_i |
i = tof21_i |
1128 |
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 |
|
1129 |
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)) |
|
1130 |
xkorr = atten(left,21,i,xhelp) |
xkorr = atten(left,21,i,xhelp) |
1131 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1132 |
adc_c(ch21a(i),hb21a(i))=tof21(left,i,iadc)/xkorr |
adc_c(ch21a(i),hb21a(i))=tof21(left,i,iadc)/xkorr |
1133 |
endif |
endif |
1134 |
|
|
1135 |
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 |
|
1136 |
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)) |
|
1137 |
xkorr = atten(right,21,i,xhelp) |
xkorr = atten(right,21,i,xhelp) |
1138 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1139 |
adc_c(ch21b(i),hb21b(i))=tof21(right,i,iadc)/xkorr |
adc_c(ch21b(i),hb21b(i))=tof21(right,i,iadc)/xkorr |
1143 |
yhelp=yout(4) |
yhelp=yout(4) |
1144 |
phi = atan(tan(THYOUT(4))/tan(THXOUT(4))) |
phi = atan(tan(THYOUT(4))/tan(THXOUT(4))) |
1145 |
theta = atan(tan(THXOUT(4))/cos(phi)) |
theta = atan(tan(THXOUT(4))/cos(phi)) |
|
c write(*,*) 'theta22 ',theta |
|
1146 |
|
|
1147 |
IF (tof22_i.GT.none_find.AND.yhelp.lt.100) THEN |
IF (tof22_i.GT.none_find.AND.yhelp.lt.100) THEN |
|
|
|
1148 |
i = tof22_i |
i = tof22_i |
1149 |
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 |
|
1150 |
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)) |
|
1151 |
xkorr = atten(left,22,i,yhelp) |
xkorr = atten(left,22,i,yhelp) |
1152 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1153 |
adc_c(ch22a(i),hb22a(i))=tof22(left,i,iadc)/xkorr |
adc_c(ch22a(i),hb22a(i))=tof22(left,i,iadc)/xkorr |
1154 |
endif |
endif |
1155 |
|
|
1156 |
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 |
|
1157 |
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)) |
|
1158 |
xkorr = atten(right,22,i,yhelp) |
xkorr = atten(right,22,i,yhelp) |
1159 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1160 |
adc_c(ch22b(i),hb22b(i))=tof22(right,i,iadc)/xkorr |
adc_c(ch22b(i),hb22b(i))=tof22(right,i,iadc)/xkorr |
1166 |
yhelp=yout(5) |
yhelp=yout(5) |
1167 |
phi = atan(tan(THYOUT(5))/tan(THXOUT(5))) |
phi = atan(tan(THYOUT(5))/tan(THXOUT(5))) |
1168 |
theta = atan(tan(THXOUT(5))/cos(phi)) |
theta = atan(tan(THXOUT(5))/cos(phi)) |
|
c write(*,*) 'theta31 ',theta |
|
1169 |
|
|
1170 |
IF (tof31_i.GT.none_find.AND.yhelp.lt.100) THEN |
IF (tof31_i.GT.none_find.AND.yhelp.lt.100) THEN |
1171 |
|
|
1172 |
i = tof31_i |
i = tof31_i |
1173 |
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 |
|
1174 |
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)) |
|
1175 |
xkorr = atten(left,31,i,yhelp) |
xkorr = atten(left,31,i,yhelp) |
1176 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1177 |
adc_c(ch31a(i),hb31a(i))=tof31(left,i,iadc)/xkorr |
adc_c(ch31a(i),hb31a(i))=tof31(left,i,iadc)/xkorr |
1178 |
endif |
endif |
1179 |
|
|
1180 |
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 |
|
1181 |
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)) |
|
1182 |
xkorr = atten(right,31,i,yhelp) |
xkorr = atten(right,31,i,yhelp) |
1183 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1184 |
adc_c(ch31b(i),hb31b(i))=tof31(right,i,iadc)/xkorr |
adc_c(ch31b(i),hb31b(i))=tof31(right,i,iadc)/xkorr |
1188 |
xhelp=xout(6) |
xhelp=xout(6) |
1189 |
phi = atan(tan(THYOUT(6))/tan(THXOUT(6))) |
phi = atan(tan(THYOUT(6))/tan(THXOUT(6))) |
1190 |
theta = atan(tan(THXOUT(6))/cos(phi)) |
theta = atan(tan(THXOUT(6))/cos(phi)) |
|
c write(*,*) 'theta32 ',theta |
|
1191 |
|
|
1192 |
IF (tof32_i.GT.none_find.AND.xhelp.lt.100) THEN |
IF (tof32_i.GT.none_find.AND.xhelp.lt.100) THEN |
|
|
|
1193 |
i = tof32_i |
i = tof32_i |
1194 |
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 |
|
1195 |
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)) |
|
1196 |
xkorr = atten(left,32,i,xhelp) |
xkorr = atten(left,32,i,xhelp) |
1197 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1198 |
adc_c(ch32a(i),hb32a(i))=tof32(left,i,iadc)/xkorr |
adc_c(ch32a(i),hb32a(i))=tof32(left,i,iadc)/xkorr |
1199 |
endif |
endif |
1200 |
|
|
1201 |
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 |
|
1202 |
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)) |
|
1203 |
xkorr = atten(right,32,i,xhelp) |
xkorr = atten(right,32,i,xhelp) |
1204 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1205 |
adc_c(ch32b(i),hb32b(i))=tof32(right,i,iadc)/xkorr |
adc_c(ch32b(i),hb32b(i))=tof32(right,i,iadc)/xkorr |
1206 |
endif |
endif |
1207 |
ENDIF |
ENDIF |
1208 |
|
|
1209 |
|
|
1210 |
C----------------------------------------------------------------------- |
C----------------------------------------------------------------------- |
1211 |
C----------------------calculate Beta ------------------------------ |
C----------------------calculate Beta ------------------------------ |
1212 |
C----------------------------------------------------------------------- |
C----------------------------------------------------------------------- |
1243 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1244 |
ihelp=(tof11_i-1)*3+tof31_i |
ihelp=(tof11_i-1)*3+tof31_i |
1245 |
c1 = k_S11S31(1,ihelp) |
c1 = k_S11S31(1,ihelp) |
1246 |
|
if (iz.gt.2) c1 = c1 + k1corrA1 |
1247 |
c2 = k_S11S31(2,ihelp) |
c2 = k_S11S31(2,ihelp) |
1248 |
beta_a(1) = c2*F/(ds-c1) |
beta_a(1) = c2*F/(ds-c1) |
1249 |
c write(*,*) 'S11-S31 ',c1,c2,F |
c write(*,*) 'S11-S31 ',c1,c2,F |
1285 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1286 |
ihelp=(tof11_i-1)*3+tof32_i |
ihelp=(tof11_i-1)*3+tof32_i |
1287 |
c1 = k_S11S32(1,ihelp) |
c1 = k_S11S32(1,ihelp) |
1288 |
|
if (iz.gt.2) c1 = c1 + k1corrA1 |
1289 |
c2 = k_S11S32(2,ihelp) |
c2 = k_S11S32(2,ihelp) |
1290 |
beta_a(2) = c2*F/(ds-c1) |
beta_a(2) = c2*F/(ds-c1) |
1291 |
C write(*,*) 'S11-S32 ',xhelp1,xhelp2, beta_a(2) |
C write(*,*) 'S11-S32 ',xhelp1,xhelp2, beta_a(2) |
1329 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1330 |
ihelp=(tof12_i-1)*3+tof31_i |
ihelp=(tof12_i-1)*3+tof31_i |
1331 |
c1 = k_S12S31(1,ihelp) |
c1 = k_S12S31(1,ihelp) |
1332 |
|
if (iz.gt.2) c1 = c1 + k1corrA1 |
1333 |
c2 = k_S12S31(2,ihelp) |
c2 = k_S12S31(2,ihelp) |
1334 |
beta_a(3) = c2*F/(ds-c1) |
beta_a(3) = c2*F/(ds-c1) |
1335 |
C write(*,*) 'S12-S31 ',xhelp1,xhelp2, beta_a(3) |
C write(*,*) 'S12-S31 ',xhelp1,xhelp2, beta_a(3) |
1374 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1375 |
ihelp=(tof12_i-1)*3+tof32_i |
ihelp=(tof12_i-1)*3+tof32_i |
1376 |
c1 = k_S12S32(1,ihelp) |
c1 = k_S12S32(1,ihelp) |
1377 |
|
if (iz.gt.2) c1 = c1 + k1corrA1 |
1378 |
c2 = k_S12S32(2,ihelp) |
c2 = k_S12S32(2,ihelp) |
1379 |
beta_a(4) = c2*F/(ds-c1) |
beta_a(4) = c2*F/(ds-c1) |
1380 |
C write(*,*) 'S12-S32 ',xhelp1,xhelp2, beta_a(4) |
C write(*,*) 'S12-S32 ',xhelp1,xhelp2, beta_a(4) |
1419 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1420 |
ihelp=(tof21_i-1)*3+tof31_i |
ihelp=(tof21_i-1)*3+tof31_i |
1421 |
c1 = k_S21S31(1,ihelp) |
c1 = k_S21S31(1,ihelp) |
1422 |
|
if (iz.gt.2) c1 = c1 + k1corrB1 |
1423 |
c2 = k_S21S31(2,ihelp) |
c2 = k_S21S31(2,ihelp) |
1424 |
beta_a(5) = c2*F/(ds-c1) |
beta_a(5) = c2*F/(ds-c1) |
1425 |
|
|
1463 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1464 |
ihelp=(tof21_i-1)*3+tof32_i |
ihelp=(tof21_i-1)*3+tof32_i |
1465 |
c1 = k_S21S32(1,ihelp) |
c1 = k_S21S32(1,ihelp) |
1466 |
|
if (iz.gt.2) c1 = c1 + k1corrB1 |
1467 |
c2 = k_S21S32(2,ihelp) |
c2 = k_S21S32(2,ihelp) |
1468 |
beta_a(6) = c2*F/(ds-c1) |
beta_a(6) = c2*F/(ds-c1) |
1469 |
|
|
1492 |
dl = dl + TLOUT(i) |
dl = dl + TLOUT(i) |
1493 |
ENDDO |
ENDDO |
1494 |
F = dl/dist |
F = dl/dist |
1495 |
|
|
1496 |
|
C WM workaround |
1497 |
|
dl = dl - 0.06*F |
1498 |
|
F = dl/dist |
1499 |
|
|
1500 |
C IF (tof22_i.GT.none_find.AND.tof31_i.GT.none_find) THEN |
C IF (tof22_i.GT.none_find.AND.tof31_i.GT.none_find) THEN |
1501 |
IF ((tof22_i.GT.none_find).AND.(tof31_i.GT.none_find).AND. |
IF ((tof22_i.GT.none_find).AND.(tof31_i.GT.none_find).AND. |
1511 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1512 |
ihelp=(tof22_i-1)*3+tof31_i |
ihelp=(tof22_i-1)*3+tof31_i |
1513 |
c1 = k_S22S31(1,ihelp) |
c1 = k_S22S31(1,ihelp) |
1514 |
|
if (iz.gt.2) c1 = c1 + k1corrB1 |
1515 |
c2 = k_S22S31(2,ihelp) |
c2 = k_S22S31(2,ihelp) |
1516 |
beta_a(7) = c2*F/(ds-c1) |
beta_a(7) = c2*F/(ds-c1) |
1517 |
|
|
1540 |
dl = dl + TLOUT(i) |
dl = dl + TLOUT(i) |
1541 |
ENDDO |
ENDDO |
1542 |
F = dl/dist |
F = dl/dist |
1543 |
|
|
1544 |
|
C WM workaround |
1545 |
|
dl = dl - 0.06*F |
1546 |
|
F = dl/dist |
1547 |
|
|
1548 |
|
|
1549 |
C IF (tof22_i.GT.none_find.AND.tof32_i.GT.none_find) THEN |
C IF (tof22_i.GT.none_find.AND.tof32_i.GT.none_find) THEN |
1550 |
IF ((tof22_i.GT.none_find).AND.(tof32_i.GT.none_find).AND. |
IF ((tof22_i.GT.none_find).AND.(tof32_i.GT.none_find).AND. |
1560 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1561 |
ihelp=(tof22_i-1)*3+tof32_i |
ihelp=(tof22_i-1)*3+tof32_i |
1562 |
c1 = k_S22S32(1,ihelp) |
c1 = k_S22S32(1,ihelp) |
1563 |
|
if (iz.gt.2) c1 = c1 + k1corrB1 |
1564 |
c2 = k_S22S32(2,ihelp) |
c2 = k_S22S32(2,ihelp) |
1565 |
beta_a(8) = c2*F/(ds-c1) |
beta_a(8) = c2*F/(ds-c1) |
1566 |
|
|
1590 |
ENDDO |
ENDDO |
1591 |
F = dl/dist |
F = dl/dist |
1592 |
|
|
1593 |
|
C WM workaround |
1594 |
|
dl = dl - 0.442*F |
1595 |
|
F = dl/dist |
1596 |
|
|
1597 |
C IF (tof11_i.GT.none_find.AND.tof21_i.GT.none_find) THEN |
C IF (tof11_i.GT.none_find.AND.tof21_i.GT.none_find) THEN |
1598 |
IF ((tof11_i.GT.none_find).AND.(tof21_i.GT.none_find).AND. |
IF ((tof11_i.GT.none_find).AND.(tof21_i.GT.none_find).AND. |
1599 |
& (ytofpos(1).NE.101.).AND.(xtofpos(2).NE.101.)) THEN |
& (ytofpos(1).NE.101.).AND.(xtofpos(2).NE.101.)) THEN |
1608 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1609 |
ihelp=(tof11_i-1)*2+tof21_i |
ihelp=(tof11_i-1)*2+tof21_i |
1610 |
c1 = k_S11S21(1,ihelp) |
c1 = k_S11S21(1,ihelp) |
1611 |
|
if (iz.gt.2) c1 = c1 + k1corrC1 |
1612 |
c2 = k_S11S21(2,ihelp) |
c2 = k_S11S21(2,ihelp) |
1613 |
beta_a(9) = c2*F/(ds-c1) |
beta_a(9) = c2*F/(ds-c1) |
1614 |
|
|
1652 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1653 |
ihelp=(tof11_i-1)*2+tof22_i |
ihelp=(tof11_i-1)*2+tof22_i |
1654 |
c1 = k_S11S22(1,ihelp) |
c1 = k_S11S22(1,ihelp) |
1655 |
|
if (iz.gt.2) c1 = c1 + k1corrC1 |
1656 |
c2 = k_S11S22(2,ihelp) |
c2 = k_S11S22(2,ihelp) |
1657 |
beta_a(10) = c2*F/(ds-c1) |
beta_a(10) = c2*F/(ds-c1) |
1658 |
|
|
1682 |
ENDDO |
ENDDO |
1683 |
F = dl/dist |
F = dl/dist |
1684 |
|
|
1685 |
|
C WM workaround |
1686 |
|
dl = dl - 0.442*F |
1687 |
|
F = dl/dist |
1688 |
|
|
1689 |
C IF (tof12_i.GT.none_find.AND.tof21_i.GT.none_find) THEN |
C IF (tof12_i.GT.none_find.AND.tof21_i.GT.none_find) THEN |
1690 |
IF ((tof12_i.GT.none_find).AND.(tof21_i.GT.none_find).AND. |
IF ((tof12_i.GT.none_find).AND.(tof21_i.GT.none_find).AND. |
1691 |
& (xtofpos(1).NE.101.).AND.(xtofpos(2).NE.101.)) THEN |
& (xtofpos(1).NE.101.).AND.(xtofpos(2).NE.101.)) THEN |
1700 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1701 |
ihelp=(tof12_i-1)*2+tof21_i |
ihelp=(tof12_i-1)*2+tof21_i |
1702 |
c1 = k_S12S21(1,ihelp) |
c1 = k_S12S21(1,ihelp) |
1703 |
|
if (iz.gt.2) c1 = c1 + k1corrC1 |
1704 |
c2 = k_S12S21(2,ihelp) |
c2 = k_S12S21(2,ihelp) |
1705 |
beta_a(11) = c2*F/(ds-c1) |
beta_a(11) = c2*F/(ds-c1) |
1706 |
|
|
1744 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
1745 |
ihelp=(tof12_i-1)*2+tof22_i |
ihelp=(tof12_i-1)*2+tof22_i |
1746 |
c1 = k_S12S22(1,ihelp) |
c1 = k_S12S22(1,ihelp) |
1747 |
|
if (iz.gt.2) c1 = c1 + k1corrC1 |
1748 |
c2 = k_S12S22(2,ihelp) |
c2 = k_S12S22(2,ihelp) |
1749 |
beta_a(12) = c2*F/(ds-c1) |
beta_a(12) = c2*F/(ds-c1) |
1750 |
|
|
1766 |
ENDIF |
ENDIF |
1767 |
|
|
1768 |
C------- |
C------- |
1769 |
|
C |
1770 |
|
C icount=0 |
1771 |
|
C sw=0. |
1772 |
|
C sxw=0. |
1773 |
|
C beta_mean=100. |
1774 |
|
C |
1775 |
|
C do i=1,12 |
1776 |
|
C if ((beta_a(i).gt.-1.5).and.(beta_a(i).lt.1.5)) then |
1777 |
|
C icount= icount+1 |
1778 |
|
C if (i.le.4) w_i=1./(0.13**2.) |
1779 |
|
C if ((i.ge.5).and.(i.le.8)) w_i=1./(0.16**2.) |
1780 |
|
C if (i.ge.9) w_i=1./(0.25**2.) ! to be checked |
1781 |
|
C sxw=sxw + beta_a(i)*w_i |
1782 |
|
C sw =sw + w_i |
1783 |
|
C endif |
1784 |
|
C enddo |
1785 |
|
C |
1786 |
|
C if (icount.gt.0) beta_mean=sxw/sw |
1787 |
|
C beta_a(13) = beta_mean |
1788 |
|
C |
1789 |
|
|
1790 |
icount=0 |
C------- New mean beta calculation |
|
sw=0. |
|
|
sxw=0. |
|
|
beta_mean=100. |
|
1791 |
|
|
1792 |
do i=1,12 |
do i=1,12 |
1793 |
if ((beta_a(i).gt.-1.5).and.(beta_a(i).lt.1.5)) then |
btemp(i) = beta_a(i) |
1794 |
icount= icount+1 |
enddo |
1795 |
if (i.le.4) w_i=1./(0.13**2.) |
|
1796 |
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 |
|
1797 |
|
|
1798 |
if (icount.gt.0) beta_mean=sxw/sw |
C------- |
|
beta_a(13) = beta_mean |
|
1799 |
|
|
1800 |
|
|
1801 |
c IF (tof11_i.GT.none_find) |
c IF (tof11_i.GT.none_find) |
1825 |
c write(*,*) ytr_tof |
c write(*,*) ytr_tof |
1826 |
|
|
1827 |
|
|
|
|
|
1828 |
RETURN |
RETURN |
1829 |
END |
END |
1830 |
|
|
1833 |
|
|
1834 |
C------------------------------------------------------------------ |
C------------------------------------------------------------------ |
1835 |
|
|
1836 |
|
|