| 26 |
C then in a second step we check the residuals of the single |
C then in a second step we check the residuals of the single |
| 27 |
C measurements, reject if > 10 sigma, calculate chi2 and "quality" |
C measurements, reject if > 10 sigma, calculate chi2 and "quality" |
| 28 |
C beta is taken as good if chi2<20 and quality>10 |
C beta is taken as good if chi2<20 and quality>10 |
| 29 |
|
C mar-08 WM: Call to "newbeta" changed, now a flag tells the function if the |
| 30 |
|
C call comes from "tofl2com" or form "toftrack" |
| 31 |
|
C mar-08 WM: Bug found in dEdx if check_charge>1 |
| 32 |
|
C oct-08 WM: Calculation of zenith angle debugged, sometimes strange values |
| 33 |
|
C were possible |
| 34 |
|
C nov-09 WM: the dEdx part ("adctof_c") moved to the new dEdx routine from Napoli |
| 35 |
|
C feb-10 WM: k1 values now for Z=1, Z=2, Z>2, k2 values are fix |
| 36 |
C****************************************************************************** |
C****************************************************************************** |
| 37 |
|
|
| 38 |
INTEGER FUNCTION TOFL2COM() |
INTEGER FUNCTION TOFL2COM() |
| 52 |
INTEGER j,hitvec(6) |
INTEGER j,hitvec(6) |
| 53 |
|
|
| 54 |
REAL dx,dy,dr,ds |
REAL dx,dy,dr,ds |
| 55 |
REAL yhelp,xhelp,xhelp1,xhelp2 |
REAL yhelp,yhelp1,yhelp2,xhelp,xhelp1,xhelp2 |
| 56 |
REAL c1,c2 |
REAL c1,c2 |
| 57 |
|
REAL dist |
| 58 |
|
|
| 59 |
C REAL sw,sxw,w_i |
C REAL sw,sxw,w_i |
| 60 |
C INTEGER icount |
C INTEGER icount |
| 107 |
|
|
| 108 |
|
|
| 109 |
REAL theta13 |
REAL theta13 |
| 110 |
C-- DATA ZTOF/53.74,53.04,23.94,23.44,-23.49,-24.34/ !Sergio 9.05.2006 |
|
| 111 |
|
c DOUBLE PRECISION ZTOF(6) |
| 112 |
|
REAL ZTOF(6) !EM GCC4.7 |
| 113 |
|
DATA ZTOF/53.74,53.04,23.94,23.44,-23.49,-24.34/ !Sergio 9.05.2006 |
| 114 |
|
|
| 115 |
REAL tofarm12 |
REAL tofarm12 |
| 116 |
PARAMETER (tofarm12 = 29.70) ! from 53.39 to 23.69 |
PARAMETER (tofarm12 = 29.70) ! from 53.39 to 23.69 |
| 117 |
REAL tofarm23 |
REAL tofarm23 |
| 118 |
PARAMETER (tofarm23 = 47.61) ! from 23.69 to -23.92 |
PARAMETER (tofarm23 = 47.61) ! from 23.69 to -23.92 |
| 119 |
REAL tofarm13 |
REAL tofarm13 |
| 120 |
PARAMETER (tofarm13 = 77.31) ! from 53.39 to -23.92 |
PARAMETER (tofarm13 = 77.31) ! from 53.39 to -23.92 |
| 127 |
REAL atten,pc_adc,check_charge,newbeta |
REAL atten,pc_adc,check_charge,newbeta |
| 128 |
|
|
| 129 |
INTEGER IZ |
INTEGER IZ |
|
REAL k1corrA1,k1corrB1,k1corrC1 |
|
| 130 |
|
|
| 131 |
|
|
| 132 |
INTEGER ifst |
INTEGER ifst |
| 162 |
itdc = 1 |
itdc = 1 |
| 163 |
iadc = 2 |
iadc = 2 |
| 164 |
|
|
|
C--- These are the corrections to the k1-value for Z>2 particles |
|
|
k1corrA1 = 0. |
|
|
k1corrB1 = -5.0 |
|
|
k1corrC1= 8.0 |
|
|
|
|
|
|
|
| 165 |
ENDIF |
ENDIF |
| 166 |
C--------------------------------------------------------------------- |
C--------------------------------------------------------------------- |
| 167 |
|
|
| 580 |
hitvec(5)=tof31_i |
hitvec(5)=tof31_i |
| 581 |
hitvec(6)=tof32_i |
hitvec(6)=tof32_i |
| 582 |
|
|
|
c write(*,*) 'tofl2com', |
|
|
c & tof11_i,tof12_i,tof21_i,tof22_i,tof31_i,tof32_i |
|
| 583 |
|
|
| 584 |
C------------------------------------------------------------------ |
C------------------------------------------------------------------ |
| 585 |
C-- calculate track position in paddle using timing difference |
C-- calculate track position in paddle using timing difference |
| 637 |
C--------------------- zenith angle theta --------------------------- |
C--------------------- zenith angle theta --------------------------- |
| 638 |
C---------------------------------------------------------------------- |
C---------------------------------------------------------------------- |
| 639 |
|
|
| 640 |
dx=0. |
xhelp1=0. |
| 641 |
dy=0. |
if (tof11_i.GT.none_find) xhelp1=tof11_x(tof11_i) |
| 642 |
dr=0. |
if (xtofpos(1).lt.100) xhelp1=xtofpos(1) |
| 643 |
theta13 = 0. |
|
| 644 |
|
yhelp1=0. |
| 645 |
IF ((tof12_i.GT.none_find).AND.(tof32_i.GT.none_find)) |
if (tof12_i.GT.none_find) yhelp1=tof12_y(tof12_i) |
| 646 |
& dx = xtofpos(1) - xtofpos(3) |
if (ytofpos(1).lt.100) yhelp1=ytofpos(1) |
| 647 |
IF ((tof11_i.GT.none_find).AND.(tof31_i.GT.none_find)) |
|
| 648 |
& dy = ytofpos(1) - ytofpos(3) |
|
| 649 |
dr = sqrt(dx*dx+dy*dy) |
yhelp2=0. |
| 650 |
theta13 = atan(dr/tofarm13) |
if (tof32_i.GT.none_find) yhelp2=tof32_y(tof32_i) |
| 651 |
|
if (ytofpos(3).lt.100) yhelp2=ytofpos(3) |
| 652 |
|
|
| 653 |
|
xhelp2=0. |
| 654 |
|
if (tof31_i.GT.none_find) xhelp2=tof31_x(tof31_i) |
| 655 |
|
if (xtofpos(3).lt.100) xhelp2=xtofpos(3) |
| 656 |
|
|
| 657 |
|
|
| 658 |
|
dx=0. |
| 659 |
|
dy=0. |
| 660 |
|
dr=0. |
| 661 |
|
theta13 = 0. |
| 662 |
|
|
| 663 |
|
dx = xhelp1 - xhelp2 |
| 664 |
|
dy = yhelp1 - yhelp2 |
| 665 |
|
dr = sqrt(dx*dx+dy*dy) |
| 666 |
|
theta13 = atan(dr/tofarm13) |
| 667 |
|
|
| 668 |
|
|
| 669 |
C---------------------------------------------------------------------- |
C---------------------------------------------------------------------- |
| 675 |
C---------------------------------------------------------------------- |
C---------------------------------------------------------------------- |
| 676 |
|
|
| 677 |
iz = int(check_charge(theta13,hitvec)) |
iz = int(check_charge(theta13,hitvec)) |
| 678 |
C write(*,*) 'in tofl2com',iz |
C write(*,*) 'charge in tofl2com',iz |
| 679 |
|
|
| 680 |
C-------------------------------------------------------------------- |
C-------------------------------------------------------------------- |
| 681 |
C---- if TDCleft.and.TDCright and NO ADC insert artificial ADC |
C---- if TDCleft.and.TDCright and NO ADC insert artificial ADC |
| 692 |
|
|
| 693 |
C---------------------------- S1 ------------------------------------- |
C---------------------------- S1 ------------------------------------- |
| 694 |
|
|
| 695 |
yhelp=0. |
c yhelp=0. |
| 696 |
|
yhelp=100. ! WM |
| 697 |
if (tof12_i.GT.none_find) yhelp=tof12_y(tof12_i) |
if (tof12_i.GT.none_find) yhelp=tof12_y(tof12_i) |
| 698 |
if (ytofpos(1).lt.100) yhelp=ytofpos(1) |
if (ytofpos(1).lt.100) yhelp=ytofpos(1) |
| 699 |
|
|
| 713 |
endif |
endif |
| 714 |
ENDIF |
ENDIF |
| 715 |
|
|
| 716 |
xhelp=0. |
c xhelp=0. |
| 717 |
|
xhelp=100. ! WM |
| 718 |
if (tof11_i.GT.none_find) xhelp=tof11_x(tof11_i) |
if (tof11_i.GT.none_find) xhelp=tof11_x(tof11_i) |
| 719 |
if (xtofpos(1).lt.100) xhelp=xtofpos(1) |
if (xtofpos(1).lt.100) xhelp=xtofpos(1) |
| 720 |
|
|
| 736 |
|
|
| 737 |
C-----------------------------S2 -------------------------------- |
C-----------------------------S2 -------------------------------- |
| 738 |
|
|
| 739 |
xhelp=0. |
c xhelp=0. |
| 740 |
|
xhelp=100. ! WM |
| 741 |
if (tof22_i.GT.none_find) xhelp=tof22_x(tof22_i) |
if (tof22_i.GT.none_find) xhelp=tof22_x(tof22_i) |
| 742 |
if (xtofpos(2).lt.100) xhelp=xtofpos(2) |
if (xtofpos(2).lt.100) xhelp=xtofpos(2) |
| 743 |
|
|
| 758 |
ENDIF |
ENDIF |
| 759 |
|
|
| 760 |
|
|
| 761 |
yhelp=0. |
c yhelp=0. |
| 762 |
|
yhelp=100. ! WM |
| 763 |
if (tof21_i.GT.none_find) yhelp=tof21_y(tof21_i) |
if (tof21_i.GT.none_find) yhelp=tof21_y(tof21_i) |
| 764 |
if (ytofpos(2).lt.100) yhelp=ytofpos(2) |
if (ytofpos(2).lt.100) yhelp=ytofpos(2) |
| 765 |
|
|
| 781 |
|
|
| 782 |
C-----------------------------S3 -------------------------------- |
C-----------------------------S3 -------------------------------- |
| 783 |
|
|
| 784 |
yhelp=0. |
c yhelp=0. |
| 785 |
|
yhelp=100. ! WM |
| 786 |
if (tof32_i.GT.none_find) yhelp=tof32_y(tof32_i) |
if (tof32_i.GT.none_find) yhelp=tof32_y(tof32_i) |
| 787 |
if (ytofpos(3).lt.100) yhelp=ytofpos(3) |
if (ytofpos(3).lt.100) yhelp=ytofpos(3) |
| 788 |
|
|
| 802 |
endif |
endif |
| 803 |
ENDIF |
ENDIF |
| 804 |
|
|
| 805 |
xhelp=0. |
c xhelp=0. |
| 806 |
|
xhelp=100. ! WM |
| 807 |
if (tof31_i.GT.none_find) xhelp=tof31_x(tof31_i) |
if (tof31_i.GT.none_find) xhelp=tof31_x(tof31_i) |
| 808 |
if (xtofpos(3).lt.100) xhelp=xtofpos(3) |
if (xtofpos(3).lt.100) xhelp=xtofpos(3) |
| 809 |
|
|
| 943 |
tdc_c(ch32b(i),hb32b(i))=tof32(right,i,itdc) |
tdc_c(ch32b(i),hb32b(i))=tof32(right,i,itdc) |
| 944 |
ENDIF |
ENDIF |
| 945 |
ENDDO |
ENDDO |
| 946 |
|
|
| 947 |
|
|
| 948 |
C--------------------------------------------------------------- |
C--------------------------------------------------------------- |
| 949 |
C--- calculate track position in paddle using timing difference |
C--- calculate track position in paddle using timing difference |
| 950 |
C--- now using the time-walk corrected TDC values |
C--- now using the time-walk corrected TDC values |
| 960 |
IF (tof11_i.GT.none_find) THEN |
IF (tof11_i.GT.none_find) THEN |
| 961 |
ytofpos(1) = ((tof11(1,tof11_i,itdc)-tof11(2,tof11_i,itdc))/2. |
ytofpos(1) = ((tof11(1,tof11_i,itdc)-tof11(2,tof11_i,itdc))/2. |
| 962 |
+ -y_coor_lin11(tof11_i,offset))/y_coor_lin11(tof11_i,slope) |
+ -y_coor_lin11(tof11_i,offset))/y_coor_lin11(tof11_i,slope) |
| 963 |
|
i=tof11_i |
| 964 |
endif |
endif |
| 965 |
|
|
| 966 |
IF (tof12_i.GT.none_find) THEN |
IF (tof12_i.GT.none_find) THEN |
| 967 |
xtofpos(1) = ((tof12(1,tof12_i,itdc)-tof12(2,tof12_i,itdc))/2. |
xtofpos(1) = ((tof12(1,tof12_i,itdc)-tof12(2,tof12_i,itdc))/2. |
| 968 |
+ -x_coor_lin12(tof12_i,offset))/x_coor_lin12(tof12_i,slope) |
+ -x_coor_lin12(tof12_i,offset))/x_coor_lin12(tof12_i,slope) |
| 969 |
|
i=tof12_i |
| 970 |
endif |
endif |
| 971 |
|
|
| 972 |
|
|
| 975 |
IF (tof21_i.GT.none_find) THEN |
IF (tof21_i.GT.none_find) THEN |
| 976 |
xtofpos(2) = ((tof21(1,tof21_i,itdc)-tof21(2,tof21_i,itdc))/2. |
xtofpos(2) = ((tof21(1,tof21_i,itdc)-tof21(2,tof21_i,itdc))/2. |
| 977 |
+ -x_coor_lin21(tof21_i,offset))/x_coor_lin21(tof21_i,slope) |
+ -x_coor_lin21(tof21_i,offset))/x_coor_lin21(tof21_i,slope) |
| 978 |
|
i=tof21_i |
| 979 |
endif |
endif |
| 980 |
|
|
| 981 |
IF (tof22_i.GT.none_find) THEN |
IF (tof22_i.GT.none_find) THEN |
| 982 |
ytofpos(2) = ((tof22(1,tof22_i,itdc)-tof22(2,tof22_i,itdc))/2. |
ytofpos(2) = ((tof22(1,tof22_i,itdc)-tof22(2,tof22_i,itdc))/2. |
| 983 |
+ -y_coor_lin22(tof22_i,offset))/y_coor_lin22(tof22_i,slope) |
+ -y_coor_lin22(tof22_i,offset))/y_coor_lin22(tof22_i,slope) |
| 984 |
|
i=tof22_i |
| 985 |
endif |
endif |
| 986 |
|
|
| 987 |
|
|
| 990 |
IF (tof31_i.GT.none_find) THEN |
IF (tof31_i.GT.none_find) THEN |
| 991 |
ytofpos(3) = ((tof31(1,tof31_i,itdc)-tof31(2,tof31_i,itdc))/2. |
ytofpos(3) = ((tof31(1,tof31_i,itdc)-tof31(2,tof31_i,itdc))/2. |
| 992 |
+ -y_coor_lin31(tof31_i,offset))/y_coor_lin31(tof31_i,slope) |
+ -y_coor_lin31(tof31_i,offset))/y_coor_lin31(tof31_i,slope) |
| 993 |
|
i=tof31_i |
| 994 |
endif |
endif |
| 995 |
|
|
| 996 |
IF (tof32_i.GT.none_find) THEN |
IF (tof32_i.GT.none_find) THEN |
| 997 |
xtofpos(3) = ((tof32(1,tof32_i,itdc)-tof32(2,tof32_i,itdc))/2. |
xtofpos(3) = ((tof32(1,tof32_i,itdc)-tof32(2,tof32_i,itdc))/2. |
| 998 |
+ -x_coor_lin32(tof32_i,offset))/x_coor_lin32(tof32_i,slope) |
+ -x_coor_lin32(tof32_i,offset))/x_coor_lin32(tof32_i,slope) |
| 999 |
|
i=tof32_i |
| 1000 |
endif |
endif |
| 1001 |
|
|
| 1002 |
|
|
| 1009 |
c endif |
c endif |
| 1010 |
c enddo |
c enddo |
| 1011 |
|
|
| 1012 |
|
|
| 1013 |
C-- restrict TDC measurements to physical paddle dimensions +/- 10 cm |
C-- restrict TDC measurements to physical paddle dimensions +/- 10 cm |
| 1014 |
C-- this cut is now stronger than in the old versions |
C-- this cut is now stronger than in the old versions |
| 1015 |
|
|
| 1021 |
if (abs(ytofpos(2)).gt.18.) ytofpos(2)=101. |
if (abs(ytofpos(2)).gt.18.) ytofpos(2)=101. |
| 1022 |
if (abs(ytofpos(3)).gt.18.) ytofpos(3)=101. |
if (abs(ytofpos(3)).gt.18.) ytofpos(3)=101. |
| 1023 |
|
|
|
|
|
| 1024 |
C---------------------------------------------------------------------- |
C---------------------------------------------------------------------- |
| 1025 |
C--------------------- zenith angle theta --------------------------- |
C--------------------- zenith angle theta --------------------------- |
| 1026 |
C---------------------------------------------------------------------- |
C---------------------------------------------------------------------- |
| 1027 |
|
C------------------- improved calculation --------------------------- |
| 1028 |
|
|
| 1029 |
dx=0. |
xhelp1=0. |
| 1030 |
dy=0. |
if (tof11_i.GT.none_find) xhelp1=tof11_x(tof11_i) |
| 1031 |
dr=0. |
if (xtofpos(1).lt.100) xhelp1=xtofpos(1) |
| 1032 |
theta13 = 0. |
|
| 1033 |
|
yhelp1=0. |
| 1034 |
IF ((tof12_i.GT.none_find).AND.(tof32_i.GT.none_find)) |
if (tof12_i.GT.none_find) yhelp1=tof12_y(tof12_i) |
| 1035 |
& dx = xtofpos(1) - xtofpos(3) |
if (ytofpos(1).lt.100) yhelp1=ytofpos(1) |
| 1036 |
IF ((tof11_i.GT.none_find).AND.(tof31_i.GT.none_find)) |
|
| 1037 |
& dy = ytofpos(1) - ytofpos(3) |
yhelp2=0. |
| 1038 |
dr = sqrt(dx*dx+dy*dy) |
if (tof32_i.GT.none_find) yhelp2=tof32_y(tof32_i) |
| 1039 |
theta13 = atan(dr/tofarm13) |
if (ytofpos(3).lt.100) yhelp2=ytofpos(3) |
| 1040 |
|
|
| 1041 |
C------------------------------------------------------------------ |
xhelp2=0. |
| 1042 |
c dx=0. |
if (tof31_i.GT.none_find) xhelp2=tof31_x(tof31_i) |
| 1043 |
c dy=0. |
if (xtofpos(3).lt.100) xhelp2=xtofpos(3) |
| 1044 |
c dr=0. |
|
| 1045 |
c theta12 = 0. |
|
| 1046 |
c |
dx=0. |
| 1047 |
c IF ((tof12_i.GT.none_find).AND.(tof21_i.GT.none_find)) |
dy=0. |
| 1048 |
c & dx = xtofpos(1) - xtofpos(2) |
dr=0. |
| 1049 |
c IF ((tof11_i.GT.none_find).AND.(tof22_i.GT.none_find)) |
theta13 = 0. |
| 1050 |
c & dy = ytofpos(1) - ytofpos(2) |
|
| 1051 |
c dr = sqrt(dx*dx+dy*dy) |
dx = xhelp1 - xhelp2 |
| 1052 |
c theta12 = atan(dr/tofarm12) |
dy = yhelp1 - yhelp2 |
| 1053 |
c |
dr = sqrt(dx*dx+dy*dy) |
| 1054 |
c dx=0. |
theta13 = atan(dr/tofarm13) |
|
c dy=0. |
|
|
c dr=0. |
|
|
c theta23 = 0. |
|
|
c |
|
|
c IF ((tof21_i.GT.none_find).AND.(tof32_i.GT.none_find)) |
|
|
c & dx = xtofpos(2) - xtofpos(3) |
|
|
c IF ((tof22_i.GT.none_find).AND.(tof31_i.GT.none_find)) |
|
|
c & dy = ytofpos(2) - ytofpos(3) |
|
|
c dr = sqrt(dx*dx+dy*dy) |
|
|
c theta23 = atan(dr/tofarm23) |
|
|
c |
|
|
C---------------------------------------------------------------------- |
|
|
C------------------angle and ADC(x) correction |
|
|
C---------------------------------------------------------------------- |
|
|
C-----------------------------S1 -------------------------------- |
|
|
c middle y (or x) position of the upper and middle ToF-Paddle |
|
|
c DATA tof11_x/ -17.85,-12.75,-7.65,-2.55,2.55,7.65,12.75,17.85/ |
|
|
c DATA tof12_y/ -13.75,-8.25,-2.75,2.75,8.25,13.75/ |
|
|
c DATA tof21_y/ 3.75,-3.75/ ! paddles in different order |
|
|
c DATA tof22_x/ -4.5,4.5/ |
|
|
c DATA tof31_x/ -6.0,0.,6.0/ |
|
|
c DATA tof32_y/ -5.0,0.0,5.0/ |
|
|
|
|
|
yhelp=0. |
|
|
if (tof12_i.GT.none_find) yhelp=tof12_y(tof12_i) |
|
|
if (ytofpos(1).lt.100) yhelp=ytofpos(1) |
|
|
|
|
|
IF (tof11_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
|
|
|
|
|
i = tof11_i |
|
|
if (tof11(left,i,iadc).lt.3786) then |
|
|
c if (adc(ch11a(i),hb11a(i)).lt.4095) then |
|
|
tof11(left,i,iadc) = tof11(left,i,iadc)*cos(theta13) |
|
|
xkorr = atten(left,11,i,yhelp) |
|
|
c write(40+i,*) yhelp,xkorr |
|
|
if (iz.le.1) xkorr=xkorr/hepratio |
|
|
adctof_c(ch11a(i),hb11a(i))=tof11(left,i,iadc)/xkorr |
|
|
endif |
|
|
|
|
|
if (tof11(right,i,iadc).lt.3786) then |
|
|
c if (adc(ch11b(i),hb11b(i)).lt.4095) then |
|
|
tof11(right,i,iadc) = tof11(right,i,iadc)*cos(theta13) |
|
|
xkorr = atten(right,11,i,yhelp) |
|
|
c write(40+i,*) yhelp,xkorr |
|
|
if (iz.le.1) xkorr=xkorr/hepratio |
|
|
adctof_c(ch11b(i),hb11b(i))=tof11(right,i,iadc)/xkorr |
|
|
endif |
|
|
ENDIF |
|
|
|
|
|
xhelp=0. |
|
|
if (tof11_i.GT.none_find) xhelp=tof11_x(tof11_i) |
|
|
if (xtofpos(1).lt.100) xhelp=xtofpos(1) |
|
|
|
|
|
IF (tof12_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
|
|
|
|
|
i = tof12_i |
|
|
if (tof12(left,i,iadc).lt.3786) then |
|
|
c if (adc(ch12a(i),hb12a(i)).lt.4095) then |
|
|
tof12(left,i,iadc) = tof12(left,i,iadc)*cos(theta13) |
|
|
xkorr = atten(left,12,i,xhelp) |
|
|
c write(50+i,*) xhelp,xkorr |
|
|
if (iz.le.1) xkorr=xkorr/hepratio |
|
|
adctof_c(ch12a(i),hb12a(i))=tof12(left,i,iadc)/xkorr |
|
|
endif |
|
|
|
|
|
if (tof12(right,i,iadc).lt.3786) then |
|
|
c if (adc(ch12b(i),hb12b(i)).lt.4095) then |
|
|
tof12(right,i,iadc) = tof12(right,i,iadc)*cos(theta13) |
|
|
xkorr = atten(right,12,i,xhelp) |
|
|
c write(50+i,*) xhelp,xkorr |
|
|
if (iz.le.1) xkorr=xkorr/hepratio |
|
|
adctof_c(ch12b(i),hb12b(i))=tof12(right,i,iadc)/xkorr |
|
|
endif |
|
|
ENDIF |
|
|
|
|
|
C-----------------------------S2 -------------------------------- |
|
|
|
|
|
xhelp=0. |
|
|
if (tof22_i.GT.none_find) xhelp=tof22_x(tof22_i) |
|
|
if (xtofpos(2).lt.100) xhelp=xtofpos(2) |
|
|
|
|
|
IF (tof21_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
|
|
|
|
|
i = tof21_i |
|
|
if (tof21(left,i,iadc).lt.3786) then |
|
|
c if (adc(ch21a(i),hb21a(i)).lt.4095) then |
|
|
tof21(left,i,iadc) = tof21(left,i,iadc)*cos(theta13) |
|
|
xkorr = atten(left,21,i,xhelp) |
|
|
c write(60+i,*) xhelp,xkorr |
|
|
if (iz.le.1) xkorr=xkorr/hepratio |
|
|
adctof_c(ch21a(i),hb21a(i))=tof21(left,i,iadc)/xkorr |
|
|
endif |
|
|
|
|
|
if (tof21(right,i,iadc).lt.3786) then |
|
|
c if (adc(ch21b(i),hb21b(i)).lt.4095) then |
|
|
tof21(right,i,iadc) = tof21(right,i,iadc)*cos(theta13) |
|
|
xkorr=adcx21(right,i,1)*exp(xhelp/adcx21(right,i,2)) |
|
|
xkorr = atten(right,21,i,xhelp) |
|
|
c write(60+i,*) xhelp,xkorr |
|
|
if (iz.le.1) xkorr=xkorr/hepratio |
|
|
adctof_c(ch21b(i),hb21b(i))=tof21(right,i,iadc)/xkorr |
|
|
endif |
|
|
ENDIF |
|
|
|
|
| 1055 |
|
|
|
yhelp=0. |
|
|
if (tof21_i.GT.none_find) yhelp=tof21_y(tof21_i) |
|
|
if (ytofpos(2).lt.100) yhelp=ytofpos(2) |
|
| 1056 |
|
|
| 1057 |
IF (tof22_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
C------------------------------------------------------------------ |
| 1058 |
|
C------------------------------------------------------------------ |
| 1059 |
i = tof22_i |
C-------angle and ADC(x) correction: moved to new dEdx routine |
| 1060 |
if (tof22(left,i,iadc).lt.3786) then |
C------------------------------------------------------------------ |
| 1061 |
c if (adc(ch22a(i),hb22a(i)).lt.4095) then |
C------------------------------------------------------------------ |
|
tof22(left,i,iadc) = tof22(left,i,iadc)*cos(theta13) |
|
|
xkorr = atten(left,22,i,yhelp) |
|
|
c write(70+i,*) yhelp,xkorr |
|
|
if (iz.le.1) xkorr=xkorr/hepratio |
|
|
adctof_c(ch22a(i),hb22a(i))=tof22(left,i,iadc)/xkorr |
|
|
endif |
|
|
|
|
|
if (tof22(right,i,iadc).lt.3786) then |
|
|
c if (adc(ch22b(i),hb22b(i)).lt.4095) then |
|
|
tof22(right,i,iadc) = tof22(right,i,iadc)*cos(theta13) |
|
|
xkorr = atten(right,22,i,yhelp) |
|
|
c write(70+i,*) yhelp,xkorr |
|
|
if (iz.le.1) xkorr=xkorr/hepratio |
|
|
adctof_c(ch22b(i),hb22b(i))=tof22(right,i,iadc)/xkorr |
|
|
endif |
|
|
ENDIF |
|
|
|
|
|
C-----------------------------S3 -------------------------------- |
|
|
|
|
|
yhelp=0. |
|
|
if (tof32_i.GT.none_find) yhelp=tof32_y(tof32_i) |
|
|
if (ytofpos(3).lt.100) yhelp=ytofpos(3) |
|
|
|
|
|
IF (tof31_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
|
|
|
|
|
i = tof31_i |
|
|
if (tof31(left,i,iadc).lt.3786) then |
|
|
c if (adc(ch31a(i),hb31a(i)).lt.4095) then |
|
|
tof31(left,i,iadc) = tof31(left,i,iadc)*cos(theta13) |
|
|
xkorr = atten(left,31,i,yhelp) |
|
|
c write(80+i,*) yhelp,xkorr |
|
|
if (iz.le.1) xkorr=xkorr/hepratio |
|
|
adctof_c(ch31a(i),hb31a(i))=tof31(left,i,iadc)/xkorr |
|
|
endif |
|
|
|
|
|
if (tof31(right,i,iadc).lt.3786) then |
|
|
c if (adc(ch31b(i),hb31b(i)).lt.4095) then |
|
|
tof31(right,i,iadc) = tof31(right,i,iadc)*cos(theta13) |
|
|
xkorr = atten(right,31,i,yhelp) |
|
|
c write(80+i,*) yhelp,xkorr |
|
|
if (iz.le.1) xkorr=xkorr/hepratio |
|
|
adctof_c(ch31b(i),hb31b(i))=tof31(right,i,iadc)/xkorr |
|
|
endif |
|
|
ENDIF |
|
|
|
|
|
xhelp=0. |
|
|
if (tof31_i.GT.none_find) xhelp=tof31_x(tof31_i) |
|
|
if (xtofpos(3).lt.100) xhelp=xtofpos(3) |
|
|
|
|
|
IF (tof32_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
|
|
|
|
|
i = tof32_i |
|
|
if (tof32(left,i,iadc).lt.3786) then |
|
|
c if (adc(ch32a(i),hb32a(i)).lt.4095) then |
|
|
tof32(left,i,iadc) = tof32(left,i,iadc)*cos(theta13) |
|
|
xkorr = atten(left,32,i,xhelp) |
|
|
c write(90+i,*) xhelp,xkorr |
|
|
if (iz.le.1) xkorr=xkorr/hepratio |
|
|
adctof_c(ch32a(i),hb32a(i))=tof32(left,i,iadc)/xkorr |
|
|
endif |
|
|
|
|
|
if (tof32(right,i,iadc).lt.3786) then |
|
|
c if (adc(ch32b(i),hb32b(i)).lt.4095) then |
|
|
tof32(right,i,iadc) = tof32(right,i,iadc)*cos(theta13) |
|
|
xkorr = atten(right,32,i,xhelp) |
|
|
c write(90+i,*) xhelp,xkorr |
|
|
if (iz.le.1) xkorr=xkorr/hepratio |
|
|
adctof_c(ch32b(i),hb32b(i))=tof32(right,i,iadc)/xkorr |
|
|
endif |
|
|
ENDIF |
|
| 1062 |
|
|
| 1063 |
C-------------------------------------------------------------------- |
C-------------------------------------------------------------------- |
| 1064 |
C----------------------calculate Beta ------------------------------ |
C----------------------calculate Beta ------------------------------ |
| 1073 |
|
|
| 1074 |
C S11 - S31 |
C S11 - S31 |
| 1075 |
|
|
| 1076 |
|
dist = ZTOF(1) - ZTOF(5) |
| 1077 |
|
c2 = (2.*0.01*dist)/(3.E08*50.E-12 ) |
| 1078 |
|
|
| 1079 |
IF ((tof11_i.GT.none_find).AND.(tof31_i.GT.none_find).AND. |
IF ((tof11_i.GT.none_find).AND.(tof31_i.GT.none_find).AND. |
| 1080 |
& (ytofpos(1).NE.101.).AND.(ytofpos(3).NE.101.)) THEN |
& (ytofpos(1).NE.101.).AND.(ytofpos(3).NE.101.)) THEN |
| 1081 |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
| 1082 |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
| 1083 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
| 1084 |
ihelp=(tof11_i-1)*3+tof31_i |
ihelp=(tof11_i-1)*3+tof31_i |
| 1085 |
c1 = k_S11S31(1,ihelp) |
if (iz.le.1) c1 = k_S11S31(1,ihelp) |
| 1086 |
if (iz.gt.2) c1 = c1 + k1corrA1 |
if (iz.eq.2) c1 = k_S11S31(2,ihelp) |
| 1087 |
c2 = k_S11S31(2,ihelp) |
if (iz.gt.2) c1 = k_S11S31(3,ihelp) |
| 1088 |
betatof_a(1) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(1) = c2/(cos(theta13)*(ds-c1)) |
| 1089 |
|
|
| 1090 |
C------- ToF Mask - S11 - S31 |
C------- ToF Mask - S11 - S31 |
| 1105 |
|
|
| 1106 |
C S11 - S32 |
C S11 - S32 |
| 1107 |
|
|
| 1108 |
|
dist = ZTOF(1) - ZTOF(6) |
| 1109 |
|
c2 = (2.*0.01*dist)/(3.E08*50.E-12 ) |
| 1110 |
|
|
| 1111 |
IF ((tof11_i.GT.none_find).AND.(tof32_i.GT.none_find).AND. |
IF ((tof11_i.GT.none_find).AND.(tof32_i.GT.none_find).AND. |
| 1112 |
& (ytofpos(1).NE.101.).AND.(xtofpos(3).NE.101.)) THEN |
& (ytofpos(1).NE.101.).AND.(xtofpos(3).NE.101.)) THEN |
| 1113 |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
| 1114 |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
| 1115 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
| 1116 |
ihelp=(tof11_i-1)*3+tof32_i |
ihelp=(tof11_i-1)*3+tof32_i |
| 1117 |
c1 = k_S11S32(1,ihelp) |
if (iz.le.1) c1 = k_S11S32(1,ihelp) |
| 1118 |
if (iz.gt.2) c1 = c1 + k1corrA1 |
if (iz.eq.2) c1 = k_S11S32(2,ihelp) |
| 1119 |
c2 = k_S11S32(2,ihelp) |
if (iz.gt.2) c1 = k_S11S32(3,ihelp) |
| 1120 |
betatof_a(2) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(2) = c2/(cos(theta13)*(ds-c1)) |
| 1121 |
|
|
| 1122 |
C------- ToF Mask - S11 - S32 |
C------- ToF Mask - S11 - S32 |
| 1137 |
|
|
| 1138 |
C S12 - S31 |
C S12 - S31 |
| 1139 |
|
|
| 1140 |
|
dist = ZTOF(2) - ZTOF(5) |
| 1141 |
|
c2 = (2.*0.01*dist)/(3.E08*50.E-12 ) |
| 1142 |
|
|
| 1143 |
IF ((tof12_i.GT.none_find).AND.(tof31_i.GT.none_find).AND. |
IF ((tof12_i.GT.none_find).AND.(tof31_i.GT.none_find).AND. |
| 1144 |
& (xtofpos(1).NE.101.).AND.(ytofpos(3).NE.101.)) THEN |
& (xtofpos(1).NE.101.).AND.(ytofpos(3).NE.101.)) THEN |
| 1145 |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
| 1146 |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
| 1147 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
| 1148 |
ihelp=(tof12_i-1)*3+tof31_i |
ihelp=(tof12_i-1)*3+tof31_i |
| 1149 |
c1 = k_S12S31(1,ihelp) |
if (iz.le.1) c1 = k_S12S31(1,ihelp) |
| 1150 |
if (iz.gt.2) c1 = c1 + k1corrA1 |
if (iz.eq.2) c1 = k_S12S31(2,ihelp) |
| 1151 |
c2 = k_S12S31(2,ihelp) |
if (iz.gt.2) c1 = k_S12S31(3,ihelp) |
| 1152 |
betatof_a(3) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(3) = c2/(cos(theta13)*(ds-c1)) |
| 1153 |
|
|
| 1154 |
C------- ToF Mask - S12 - S31 |
C------- ToF Mask - S12 - S31 |
| 1169 |
|
|
| 1170 |
C S12 - S32 |
C S12 - S32 |
| 1171 |
|
|
| 1172 |
|
dist = ZTOF(2) - ZTOF(6) |
| 1173 |
|
c2 = (2.*0.01*dist)/(3.E08*50.E-12 ) |
| 1174 |
|
|
| 1175 |
IF ((tof12_i.GT.none_find).AND.(tof32_i.GT.none_find).AND. |
IF ((tof12_i.GT.none_find).AND.(tof32_i.GT.none_find).AND. |
| 1176 |
& (xtofpos(1).NE.101.).AND.(xtofpos(3).NE.101.)) THEN |
& (xtofpos(1).NE.101.).AND.(xtofpos(3).NE.101.)) THEN |
| 1177 |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
| 1178 |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
| 1179 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
| 1180 |
ihelp=(tof12_i-1)*3+tof32_i |
ihelp=(tof12_i-1)*3+tof32_i |
| 1181 |
c1 = k_S12S32(1,ihelp) |
if (iz.le.1) c1 = k_S12S32(1,ihelp) |
| 1182 |
if (iz.gt.2) c1 = c1 + k1corrA1 |
if (iz.eq.2) c1 = k_S12S32(2,ihelp) |
| 1183 |
c2 = k_S12S32(2,ihelp) |
if (iz.gt.2) c1 = k_S12S32(3,ihelp) |
| 1184 |
betatof_a(4) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(4) = c2/(cos(theta13)*(ds-c1)) |
| 1185 |
|
|
| 1186 |
C------- ToF Mask - S12 - S32 |
C------- ToF Mask - S12 - S32 |
| 1201 |
|
|
| 1202 |
C S21 - S31 |
C S21 - S31 |
| 1203 |
|
|
| 1204 |
|
dist = ZTOF(3) - ZTOF(5) |
| 1205 |
|
c2 = (2.*0.01*dist)/(3.E08*50.E-12 ) |
| 1206 |
|
|
| 1207 |
IF ((tof21_i.GT.none_find).AND.(tof31_i.GT.none_find).AND. |
IF ((tof21_i.GT.none_find).AND.(tof31_i.GT.none_find).AND. |
| 1208 |
& (xtofpos(2).NE.101.).AND.(ytofpos(3).NE.101.)) THEN |
& (xtofpos(2).NE.101.).AND.(ytofpos(3).NE.101.)) THEN |
| 1209 |
xhelp1 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
xhelp1 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
| 1210 |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
| 1211 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
| 1212 |
ihelp=(tof21_i-1)*3+tof31_i |
ihelp=(tof21_i-1)*3+tof31_i |
| 1213 |
c1 = k_S21S31(1,ihelp) |
if (iz.le.1) c1 = k_S21S31(1,ihelp) |
| 1214 |
if (iz.gt.2) c1 = c1 + k1corrB1 |
if (iz.eq.2) c1 = k_S21S31(2,ihelp) |
| 1215 |
c2 = k_S21S31(2,ihelp) |
if (iz.gt.2) c1 = k_S21S31(3,ihelp) |
| 1216 |
betatof_a(5) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(5) = c2/(cos(theta13)*(ds-c1)) |
| 1217 |
|
|
| 1218 |
C------- ToF Mask - S21 - S31 |
C------- ToF Mask - S21 - S31 |
| 1233 |
|
|
| 1234 |
C S21 - S32 |
C S21 - S32 |
| 1235 |
|
|
| 1236 |
|
dist = ZTOF(3) - ZTOF(6) |
| 1237 |
|
c2 = (2.*0.01*dist)/(3.E08*50.E-12 ) |
| 1238 |
|
|
| 1239 |
|
|
| 1240 |
IF ((tof21_i.GT.none_find).AND.(tof32_i.GT.none_find).AND. |
IF ((tof21_i.GT.none_find).AND.(tof32_i.GT.none_find).AND. |
| 1241 |
& (xtofpos(2).NE.101.).AND.(xtofpos(3).NE.101.)) THEN |
& (xtofpos(2).NE.101.).AND.(xtofpos(3).NE.101.)) THEN |
| 1242 |
xhelp1 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
xhelp1 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
| 1243 |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
| 1244 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
| 1245 |
ihelp=(tof21_i-1)*3+tof32_i |
ihelp=(tof21_i-1)*3+tof32_i |
| 1246 |
c1 = k_S21S32(1,ihelp) |
if (iz.le.1) c1 = k_S21S32(1,ihelp) |
| 1247 |
if (iz.gt.2) c1 = c1 + k1corrB1 |
if (iz.eq.2) c1 = k_S21S32(2,ihelp) |
| 1248 |
c2 = k_S21S32(2,ihelp) |
if (iz.gt.2) c1 = k_S21S32(3,ihelp) |
| 1249 |
betatof_a(6) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(6) = c2/(cos(theta13)*(ds-c1)) |
| 1250 |
|
|
| 1251 |
C------- ToF Mask - S21 - S32 |
C------- ToF Mask - S21 - S32 |
| 1266 |
|
|
| 1267 |
C S22 - S31 |
C S22 - S31 |
| 1268 |
|
|
| 1269 |
|
dist = ZTOF(4) - ZTOF(5) |
| 1270 |
|
c2 = (2.*0.01*dist)/(3.E08*50.E-12 ) |
| 1271 |
|
|
| 1272 |
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. |
| 1273 |
& (ytofpos(2).NE.101.).AND.(ytofpos(3).NE.101.)) THEN |
& (ytofpos(2).NE.101.).AND.(ytofpos(3).NE.101.)) THEN |
| 1274 |
xhelp1 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
xhelp1 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
| 1275 |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
xhelp2 = tof31(1,tof31_i,itdc)+tof31(2,tof31_i,itdc) |
| 1276 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
| 1277 |
ihelp=(tof22_i-1)*3+tof31_i |
ihelp=(tof22_i-1)*3+tof31_i |
| 1278 |
c1 = k_S22S31(1,ihelp) |
if (iz.le.1) c1 = k_S22S31(1,ihelp) |
| 1279 |
if (iz.gt.2) c1 = c1 + k1corrB1 |
if (iz.eq.2) c1 = k_S22S31(2,ihelp) |
| 1280 |
c2 = k_S22S31(2,ihelp) |
if (iz.gt.2) c1 = k_S22S31(3,ihelp) |
| 1281 |
betatof_a(7) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(7) = c2/(cos(theta13)*(ds-c1)) |
| 1282 |
|
|
| 1283 |
C------- ToF Mask - S22 - S31 |
C------- ToF Mask - S22 - S31 |
| 1298 |
|
|
| 1299 |
C S22 - S32 |
C S22 - S32 |
| 1300 |
|
|
| 1301 |
|
dist = ZTOF(4) - ZTOF(6) |
| 1302 |
|
c2 = (2.*0.01*dist)/(3.E08*50.E-12 ) |
| 1303 |
|
|
| 1304 |
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. |
| 1305 |
& (ytofpos(2).NE.101.).AND.(xtofpos(3).NE.101.)) THEN |
& (ytofpos(2).NE.101.).AND.(xtofpos(3).NE.101.)) THEN |
| 1306 |
xhelp1 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
xhelp1 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
| 1307 |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
xhelp2 = tof32(1,tof32_i,itdc)+tof32(2,tof32_i,itdc) |
| 1308 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
| 1309 |
ihelp=(tof22_i-1)*3+tof32_i |
ihelp=(tof22_i-1)*3+tof32_i |
| 1310 |
c1 = k_S22S32(1,ihelp) |
if (iz.le.1) c1 = k_S22S32(1,ihelp) |
| 1311 |
if (iz.gt.2) c1 = c1 + k1corrB1 |
if (iz.eq.2) c1 = k_S22S32(2,ihelp) |
| 1312 |
c2 = k_S22S32(2,ihelp) |
if (iz.gt.2) c1 = k_S22S32(3,ihelp) |
| 1313 |
betatof_a(8) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(8) = c2/(cos(theta13)*(ds-c1)) |
| 1314 |
|
|
| 1315 |
C------- ToF Mask - S22 - S32 |
C------- ToF Mask - S22 - S32 |
| 1330 |
|
|
| 1331 |
C S11 - S21 |
C S11 - S21 |
| 1332 |
|
|
| 1333 |
|
dist = ZTOF(1) - ZTOF(3) |
| 1334 |
|
c2 = (2.*0.01*dist)/(3.E08*50.E-12 ) |
| 1335 |
|
|
| 1336 |
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. |
| 1337 |
& (ytofpos(1).NE.101.).AND.(xtofpos(2).NE.101.)) THEN |
& (ytofpos(1).NE.101.).AND.(xtofpos(2).NE.101.)) THEN |
| 1338 |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
| 1339 |
xhelp2 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
xhelp2 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
| 1340 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
| 1341 |
ihelp=(tof11_i-1)*2+tof21_i |
ihelp=(tof11_i-1)*2+tof21_i |
| 1342 |
c1 = k_S11S21(1,ihelp) |
if (iz.le.1) c1 = k_S11S21(1,ihelp) |
| 1343 |
if (iz.gt.2) c1 = c1 + k1corrC1 |
if (iz.eq.2) c1 = k_S11S21(2,ihelp) |
| 1344 |
c2 = k_S11S21(2,ihelp) |
if (iz.gt.2) c1 = k_S11S21(3,ihelp) |
| 1345 |
betatof_a(9) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(9) = c2/(cos(theta13)*(ds-c1)) |
| 1346 |
|
|
| 1347 |
C------- ToF Mask - S11 - S21 |
C------- ToF Mask - S11 - S21 |
| 1362 |
|
|
| 1363 |
C S11 - S22 |
C S11 - S22 |
| 1364 |
|
|
| 1365 |
|
dist = ZTOF(1) - ZTOF(4) |
| 1366 |
|
c2 = (2.*0.01*dist)/(3.E08*50.E-12 ) |
| 1367 |
|
|
| 1368 |
IF ((tof11_i.GT.none_find).AND.(tof22_i.GT.none_find).AND. |
IF ((tof11_i.GT.none_find).AND.(tof22_i.GT.none_find).AND. |
| 1369 |
& (ytofpos(1).NE.101.).AND.(ytofpos(2).NE.101.)) THEN |
& (ytofpos(1).NE.101.).AND.(ytofpos(2).NE.101.)) THEN |
| 1370 |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
xhelp1 = tof11(1,tof11_i,itdc)+tof11(2,tof11_i,itdc) |
| 1371 |
xhelp2 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
xhelp2 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
| 1372 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
| 1373 |
ihelp=(tof11_i-1)*2+tof22_i |
ihelp=(tof11_i-1)*2+tof22_i |
| 1374 |
c1 = k_S11S22(1,ihelp) |
if (iz.le.1) c1 = k_S11S22(1,ihelp) |
| 1375 |
if (iz.gt.2) c1 = c1 + k1corrC1 |
if (iz.eq.2) c1 = k_S11S22(2,ihelp) |
| 1376 |
c2 = k_S11S22(2,ihelp) |
if (iz.gt.2) c1 = k_S11S22(3,ihelp) |
| 1377 |
betatof_a(10) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(10) = c2/(cos(theta13)*(ds-c1)) |
| 1378 |
|
|
| 1379 |
C------- ToF Mask - S11 - S22 |
C------- ToF Mask - S11 - S22 |
| 1394 |
|
|
| 1395 |
C S12 - S21 |
C S12 - S21 |
| 1396 |
|
|
| 1397 |
|
dist = ZTOF(2) - ZTOF(3) |
| 1398 |
|
c2 = (2.*0.01*dist)/(3.E08*50.E-12 ) |
| 1399 |
|
|
| 1400 |
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. |
| 1401 |
& (xtofpos(1).NE.101.).AND.(xtofpos(2).NE.101.)) THEN |
& (xtofpos(1).NE.101.).AND.(xtofpos(2).NE.101.)) THEN |
| 1402 |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
| 1403 |
xhelp2 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
xhelp2 = tof21(1,tof21_i,itdc)+tof21(2,tof21_i,itdc) |
| 1404 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
| 1405 |
ihelp=(tof12_i-1)*2+tof21_i |
ihelp=(tof12_i-1)*2+tof21_i |
| 1406 |
c1 = k_S12S21(1,ihelp) |
if (iz.le.1) c1 = k_S12S21(1,ihelp) |
| 1407 |
if (iz.gt.2) c1 = c1 + k1corrC1 |
if (iz.eq.2) c1 = k_S12S21(2,ihelp) |
| 1408 |
c2 = k_S12S21(2,ihelp) |
if (iz.gt.2) c1 = k_S12S21(3,ihelp) |
| 1409 |
betatof_a(11) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(11) = c2/(cos(theta13)*(ds-c1)) |
| 1410 |
|
|
| 1411 |
C------- ToF Mask - S12 - S21 |
C------- ToF Mask - S12 - S21 |
| 1426 |
|
|
| 1427 |
C S12 - S22 |
C S12 - S22 |
| 1428 |
|
|
| 1429 |
|
dist = ZTOF(2) - ZTOF(4) |
| 1430 |
|
c2 = (2.*0.01*dist)/(3.E08*50.E-12 ) |
| 1431 |
|
|
| 1432 |
IF ((tof12_i.GT.none_find).AND.(tof22_i.GT.none_find).AND. |
IF ((tof12_i.GT.none_find).AND.(tof22_i.GT.none_find).AND. |
| 1433 |
& (xtofpos(1).NE.101.).AND.(ytofpos(2).NE.101.)) THEN |
& (xtofpos(1).NE.101.).AND.(ytofpos(2).NE.101.)) THEN |
| 1434 |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
xhelp1 = tof12(1,tof12_i,itdc)+tof12(2,tof12_i,itdc) |
| 1435 |
xhelp2 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
xhelp2 = tof22(1,tof22_i,itdc)+tof22(2,tof22_i,itdc) |
| 1436 |
ds = xhelp1-xhelp2 |
ds = xhelp1-xhelp2 |
| 1437 |
ihelp=(tof12_i-1)*2+tof22_i |
ihelp=(tof12_i-1)*2+tof22_i |
| 1438 |
c1 = k_S12S22(1,ihelp) |
if (iz.le.1) c1 = k_S12S22(1,ihelp) |
| 1439 |
if (iz.gt.2) c1 = c1 + k1corrC1 |
if (iz.eq.2) c1 = k_S12S22(2,ihelp) |
| 1440 |
c2 = k_S12S22(2,ihelp) |
if (iz.gt.2) c1 = k_S12S22(3,ihelp) |
| 1441 |
betatof_a(12) = c2/(cos(theta13)*(ds-c1)) |
betatof_a(12) = c2/(cos(theta13)*(ds-c1)) |
| 1442 |
|
|
| 1443 |
C------- ToF Mask - S12 - S22 |
C------- ToF Mask - S12 - S22 |
| 1468 |
C icount= icount+1 |
C icount= icount+1 |
| 1469 |
C if (i.le.4) w_i=1./(0.13**2.) |
C if (i.le.4) w_i=1./(0.13**2.) |
| 1470 |
C if ((i.ge.5).and.(i.le.8)) w_i=1./(0.16**2.) |
C if ((i.ge.5).and.(i.le.8)) w_i=1./(0.16**2.) |
| 1471 |
C if (i.ge.9) w_i=1./(0.25**2.) ! to be checked |
C if (i.ge.9) w_i=1./(0.25**2.) ! to be checked |
| 1472 |
C sxw=sxw + betatof_a(i)*w_i |
C sxw=sxw + betatof_a(i)*w_i |
| 1473 |
C sw =sw + w_i |
C sw =sw + w_i |
| 1474 |
C endif |
C endif |
| 1477 |
C if (icount.gt.0) beta_mean=sxw/sw |
C if (icount.gt.0) beta_mean=sxw/sw |
| 1478 |
C betatof_a(13) = beta_mean |
C betatof_a(13) = beta_mean |
| 1479 |
C |
C |
| 1480 |
|
|
| 1481 |
C-------- New mean beta calculation ----------------------- |
C-------- New mean beta calculation ----------------------- |
| 1482 |
|
|
| 1483 |
do i=1,12 |
do i=1,12 |
| 1484 |
btemp(i) = betatof_a(i) |
btemp(i) = betatof_a(i) |
| 1485 |
enddo |
enddo |
| 1486 |
|
|
| 1487 |
betatof_a(13)=newbeta(btemp,hitvec,10.,10.,20.) |
betatof_a(13)=newbeta(1,btemp,hitvec,10.,10.,20.) |
| 1488 |
|
|
| 1489 |
C-------------------------------------------------------------- |
C-------------------------------------------------------------- |
| 1490 |
C write(*,*) betatof_a |
C write(*,*) betatof_a |
| 1498 |
c write(*,*) xtr_tof |
c write(*,*) xtr_tof |
| 1499 |
c write(*,*) ytr_tof |
c write(*,*) ytr_tof |
| 1500 |
|
|
| 1501 |
100 continue |
c 100 continue |
| 1502 |
|
continue |
| 1503 |
|
|
| 1504 |
C |
C |
| 1505 |
RETURN |
RETURN |
| 1643 |
REAL a1,a2 |
REAL a1,a2 |
| 1644 |
INTEGER jj |
INTEGER jj |
| 1645 |
|
|
| 1646 |
|
c get rid of warnings EMILIANO |
| 1647 |
|
i = 0 |
| 1648 |
|
slope = 0 |
| 1649 |
|
offset = 0 |
| 1650 |
|
none_find = 0 |
| 1651 |
|
none_ev = 0 |
| 1652 |
|
adc_ev = 0 |
| 1653 |
|
tdc_ev = 0 |
| 1654 |
|
iadc = 0 |
| 1655 |
|
itdc = 0 |
| 1656 |
|
right = 0 |
| 1657 |
|
left = 0 |
| 1658 |
|
tof12_y(1) = tof12_y(1) |
| 1659 |
|
tof11_x(1) = tof11_x(1) |
| 1660 |
|
tof21_y(1) = tof21_y(1) |
| 1661 |
|
tof22_x(1) = tof22_x(1) |
| 1662 |
|
tof32_y(1) = tof32_y(1) |
| 1663 |
|
tof31_x(1) = tof31_x(1) |
| 1664 |
|
c get rid of warnings |
| 1665 |
|
|
| 1666 |
C----------------------------------------------------------- |
C----------------------------------------------------------- |
| 1667 |
C--- get data |
C--- get data |
| 1668 |
C----------------------------------------------------------- |
C----------------------------------------------------------- |
| 1889 |
|
|
| 1890 |
if (sw.gt.0) beta_mean_tof=sxw/sw; |
if (sw.gt.0) beta_mean_tof=sxw/sw; |
| 1891 |
|
|
| 1892 |
c write(*,*) 'beta_mean_tof ',beta_mean_tof |
C write(*,*) 'beta_mean_tof ',beta_mean_tof |
| 1893 |
|
|
| 1894 |
beta_help = beta_mean_tof ! pow(beta_mean_tof,1.0) gave best results |
beta_help = beta_mean_tof ! pow(beta_mean_tof,1.0) gave best results |
| 1895 |
|
|
| 2018 |
|
|
| 2019 |
endif ! beta_mean_tof.eq.100. |
endif ! beta_mean_tof.eq.100. |
| 2020 |
|
|
| 2021 |
c write(*,*) 'in function charge: ',charge |
C write(*,*) 'in function charge: ',beta_mean_tof,charge |
| 2022 |
|
|
| 2023 |
check_charge = charge |
check_charge = charge |
| 2024 |
|
|
| 2025 |
|
|
| 2029 |
C**************************************************************************** |
C**************************************************************************** |
| 2030 |
C**************************************************************************** |
C**************************************************************************** |
| 2031 |
|
|
| 2032 |
function newbeta(b,hitvec,resmax,qualitycut,chi2cut) |
function newbeta(iflag,b,hitvec,resmax,qualitycut,chi2cut) |
| 2033 |
|
|
| 2034 |
include 'input_tof.txt' |
include 'input_tof.txt' |
| 2035 |
include 'output_tof.txt' |
include 'output_tof.txt' |
| 2039 |
REAL resmax,qualitycut,chi2cut |
REAL resmax,qualitycut,chi2cut |
| 2040 |
REAL w_i(12),w_il(6),quality,res,betachi,beta_mean_inv |
REAL w_i(12),w_il(6),quality,res,betachi,beta_mean_inv |
| 2041 |
REAL sw,sxw,b(12),beta_mean,chi2,xhelp |
REAL sw,sxw,b(12),beta_mean,chi2,xhelp |
| 2042 |
|
c REAL tdcfl(4,12) |
| 2043 |
|
INTEGER tdcfl(4,12) !EM GCC4.7 |
| 2044 |
|
|
| 2045 |
INTEGER icount,hitvec(6) |
INTEGER iflag,icount,hitvec(6) |
| 2046 |
|
|
| 2047 |
INTEGER itop(12),ibot(12) |
INTEGER itop(12),ibot(12) |
| 2048 |
DATA itop /1,1,2,2,3,3,4,4,1,1,2,2/ |
DATA itop /1,1,2,2,3,3,4,4,1,1,2,2/ |
| 2049 |
DATA ibot /5,6,5,6,5,6,5,6,3,4,3,4/ |
DATA ibot /5,6,5,6,5,6,5,6,3,4,3,4/ |
| 2050 |
|
|
| 2051 |
|
|
| 2052 |
|
c get rid of warnings EMILIANO |
| 2053 |
|
slope = 0 |
| 2054 |
|
offset = 0 |
| 2055 |
|
none_find = 0 |
| 2056 |
|
none_ev = 0 |
| 2057 |
|
adc_ev = 0 |
| 2058 |
|
tdc_ev = 0 |
| 2059 |
|
iadc = 0 |
| 2060 |
|
itdc = 0 |
| 2061 |
|
right = 0 |
| 2062 |
|
left = 0 |
| 2063 |
|
tof12_y(1) = tof12_y(1) |
| 2064 |
|
tof11_x(1) = tof11_x(1) |
| 2065 |
|
tof21_y(1) = tof21_y(1) |
| 2066 |
|
tof22_x(1) = tof22_x(1) |
| 2067 |
|
tof32_y(1) = tof32_y(1) |
| 2068 |
|
tof31_x(1) = tof31_x(1) |
| 2069 |
|
c get rid of warnings |
| 2070 |
|
|
| 2071 |
C==================================================================== |
C==================================================================== |
| 2072 |
|
|
| 2073 |
tof11_i = hitvec(1) |
tof11_i = hitvec(1) |
| 2077 |
tof31_i = hitvec(5) |
tof31_i = hitvec(5) |
| 2078 |
tof32_i = hitvec(6) |
tof32_i = hitvec(6) |
| 2079 |
|
|
| 2080 |
c write(*,*) '------------ In NEWBETA ----------------' |
if (iflag.eq.1) then ! call from tofl2com |
| 2081 |
c write(*,*) hitvec |
do i=1,4 |
| 2082 |
c write(*,*) b |
do j=1,12 |
| 2083 |
|
tdcfl(i,j) = tdcflagtof(i,j) |
| 2084 |
|
enddo |
| 2085 |
|
enddo |
| 2086 |
|
endif |
| 2087 |
|
|
| 2088 |
|
if (iflag.eq.2) then ! call from toftrk |
| 2089 |
|
do i=1,4 |
| 2090 |
|
do j=1,12 |
| 2091 |
|
tdcfl(i,j) = tdcflag(i,j) |
| 2092 |
|
enddo |
| 2093 |
|
enddo |
| 2094 |
|
endif |
| 2095 |
|
|
| 2096 |
|
|
| 2097 |
C--- Find out ToF layers with artificial TDC values ------------- |
C--- Find out ToF layers with artificial TDC values ------------- |
| 2098 |
|
|
| 2100 |
w_il(jj) = 1000. |
w_il(jj) = 1000. |
| 2101 |
enddo |
enddo |
| 2102 |
|
|
|
C write(*,*) tdcflagtof |
|
| 2103 |
|
|
| 2104 |
if (tof11_i.gt.0) then |
if (tof11_i.gt.0) then |
| 2105 |
if ((tofmask(ch11a(tof11_i),hb11a(tof11_i)).gt.0).or. |
if ((tofmask(ch11a(tof11_i),hb11a(tof11_i)).gt.0).or. |
| 2106 |
& (tofmask(ch11b(tof11_i),hb11b(tof11_i)).gt.0)) then |
& (tofmask(ch11b(tof11_i),hb11b(tof11_i)).gt.0)) then |
| 2107 |
w_il(1)=0 |
w_il(1)=0 |
| 2108 |
i1=tdcflagtof(ch11a(tof11_i),hb11a(tof11_i)) |
i1=tdcfl(ch11a(tof11_i),hb11a(tof11_i)) |
| 2109 |
i2=tdcflagtof(ch11b(tof11_i),hb11b(tof11_i)) |
i2=tdcfl(ch11b(tof11_i),hb11b(tof11_i)) |
|
c write(*,*) '11 ',i1,i2 |
|
| 2110 |
if ((i1.eq.1).or.(i2.eq.1)) w_il(1) = 1 ! tdcflag |
if ((i1.eq.1).or.(i2.eq.1)) w_il(1) = 1 ! tdcflag |
| 2111 |
endif |
endif |
| 2112 |
endif |
endif |
| 2115 |
if ((tofmask(ch12a(tof12_i),hb12a(tof12_i)).gt.0).or. |
if ((tofmask(ch12a(tof12_i),hb12a(tof12_i)).gt.0).or. |
| 2116 |
& (tofmask(ch12b(tof12_i),hb12b(tof12_i)).gt.0)) then |
& (tofmask(ch12b(tof12_i),hb12b(tof12_i)).gt.0)) then |
| 2117 |
w_il(2)=0 |
w_il(2)=0 |
| 2118 |
i1=tdcflagtof(ch12a(tof12_i),hb12a(tof12_i)) |
i1=tdcfl(ch12a(tof12_i),hb12a(tof12_i)) |
| 2119 |
i2=tdcflagtof(ch12b(tof12_i),hb12b(tof12_i)) |
i2=tdcfl(ch12b(tof12_i),hb12b(tof12_i)) |
|
c write(*,*) '12 ',i1,i2 |
|
| 2120 |
if ((i1.eq.1).or.(i2.eq.1)) w_il(2) = 1 ! tdcflag |
if ((i1.eq.1).or.(i2.eq.1)) w_il(2) = 1 ! tdcflag |
| 2121 |
endif |
endif |
| 2122 |
endif |
endif |
| 2125 |
if ((tofmask(ch21a(tof21_i),hb21a(tof21_i)).gt.0).or. |
if ((tofmask(ch21a(tof21_i),hb21a(tof21_i)).gt.0).or. |
| 2126 |
& (tofmask(ch21b(tof21_i),hb21b(tof21_i)).gt.0)) then |
& (tofmask(ch21b(tof21_i),hb21b(tof21_i)).gt.0)) then |
| 2127 |
w_il(3)=0 |
w_il(3)=0 |
| 2128 |
i1=tdcflagtof(ch21a(tof21_i),hb21a(tof21_i)) |
i1=tdcfl(ch21a(tof21_i),hb21a(tof21_i)) |
| 2129 |
i2=tdcflagtof(ch21b(tof21_i),hb21b(tof21_i)) |
i2=tdcfl(ch21b(tof21_i),hb21b(tof21_i)) |
|
c write(*,*) '21 ',i1,i2 |
|
| 2130 |
if ((i1.eq.1).or.(i2.eq.1)) w_il(3) = 1 ! tdcflag |
if ((i1.eq.1).or.(i2.eq.1)) w_il(3) = 1 ! tdcflag |
| 2131 |
endif |
endif |
| 2132 |
endif |
endif |
| 2135 |
if ((tofmask(ch22a(tof22_i),hb22a(tof22_i)).gt.0).or. |
if ((tofmask(ch22a(tof22_i),hb22a(tof22_i)).gt.0).or. |
| 2136 |
& (tofmask(ch22b(tof22_i),hb22b(tof22_i)).gt.0)) then |
& (tofmask(ch22b(tof22_i),hb22b(tof22_i)).gt.0)) then |
| 2137 |
w_il(4)=0 |
w_il(4)=0 |
| 2138 |
i1=tdcflagtof(ch22a(tof22_i),hb22a(tof22_i)) |
i1=tdcfl(ch22a(tof22_i),hb22a(tof22_i)) |
| 2139 |
i2=tdcflagtof(ch22b(tof22_i),hb22b(tof22_i)) |
i2=tdcfl(ch22b(tof22_i),hb22b(tof22_i)) |
|
c write(*,*) '22 ',i1,i2 |
|
| 2140 |
if ((i1.eq.1).or.(i2.eq.1)) w_il(4) = 1 ! tdcflag |
if ((i1.eq.1).or.(i2.eq.1)) w_il(4) = 1 ! tdcflag |
| 2141 |
endif |
endif |
| 2142 |
endif |
endif |
| 2145 |
if ((tofmask(ch31a(tof31_i),hb11a(tof31_i)).gt.0).or. |
if ((tofmask(ch31a(tof31_i),hb11a(tof31_i)).gt.0).or. |
| 2146 |
& (tofmask(ch31b(tof31_i),hb31b(tof31_i)).gt.0)) then |
& (tofmask(ch31b(tof31_i),hb31b(tof31_i)).gt.0)) then |
| 2147 |
w_il(5)=0 |
w_il(5)=0 |
| 2148 |
i1=tdcflagtof(ch31a(tof31_i),hb31a(tof31_i)) |
i1=tdcfl(ch31a(tof31_i),hb31a(tof31_i)) |
| 2149 |
i2=tdcflagtof(ch31b(tof31_i),hb31b(tof31_i)) |
i2=tdcfl(ch31b(tof31_i),hb31b(tof31_i)) |
|
c write(*,*) '31 ',i1,i2 |
|
| 2150 |
if ((i1.eq.1).or.(i2.eq.1)) w_il(5) = 1 ! tdcflag |
if ((i1.eq.1).or.(i2.eq.1)) w_il(5) = 1 ! tdcflag |
| 2151 |
endif |
endif |
| 2152 |
endif |
endif |
| 2155 |
if ((tofmask(ch32a(tof32_i),hb32a(tof32_i)).gt.0).or. |
if ((tofmask(ch32a(tof32_i),hb32a(tof32_i)).gt.0).or. |
| 2156 |
& (tofmask(ch32b(tof32_i),hb32b(tof32_i)).gt.0)) then |
& (tofmask(ch32b(tof32_i),hb32b(tof32_i)).gt.0)) then |
| 2157 |
w_il(6)=0 |
w_il(6)=0 |
| 2158 |
i1=tdcflagtof(ch32a(tof32_i),hb32a(tof32_i)) |
i1=tdcfl(ch32a(tof32_i),hb32a(tof32_i)) |
| 2159 |
i2=tdcflagtof(ch32b(tof32_i),hb32b(tof32_i)) |
i2=tdcfl(ch32b(tof32_i),hb32b(tof32_i)) |
|
c write(*,*) '32 ',i1,i2 |
|
| 2160 |
if ((i1.eq.1).or.(i2.eq.1)) w_il(6) = 1 ! tdcflag |
if ((i1.eq.1).or.(i2.eq.1)) w_il(6) = 1 ! tdcflag |
| 2161 |
endif |
endif |
| 2162 |
endif |
endif |
| 2163 |
|
|
|
c write(*,*) w_il |
|
| 2164 |
C------------------------------------------------------------------------ |
C------------------------------------------------------------------------ |
| 2165 |
C--- Set weights for the 12 measurements using information for top and bottom: |
C--- Set weights for the 12 measurements using information for top and bottom: |
| 2166 |
C--- if no measurements: weight = set to very high value=> not used |
C--- if no measurements: weight = set to very high value=> not used |
| 2180 |
w_i(jj) = 1./xhelp |
w_i(jj) = 1./xhelp |
| 2181 |
ENDDO |
ENDDO |
| 2182 |
|
|
|
c write(*,*) w_i |
|
|
|
|
| 2183 |
C======================================================================== |
C======================================================================== |
| 2184 |
C--- Calculate mean beta for the first time ----------------------------- |
C--- Calculate mean beta for the first time ----------------------------- |
| 2185 |
C--- We are using "1/beta" since its error is gaussian ------------------ |
C--- We are using "1/beta" since its error is gaussian ------------------ |
| 2200 |
if (icount.gt.0) beta_mean=1./(sxw/sw) |
if (icount.gt.0) beta_mean=1./(sxw/sw) |
| 2201 |
beta_mean_inv = 1./beta_mean |
beta_mean_inv = 1./beta_mean |
| 2202 |
|
|
|
c write(*,*) icount,beta_mean |
|
| 2203 |
|
|
| 2204 |
C--- Calculate beta for the second time, use residuals of the single |
C--- Calculate beta for the second time, use residuals of the single |
| 2205 |
C--- measurements to get a chi2 value |
C--- measurements to get a chi2 value |
| 2215 |
IF ((abs(1./b(jj)).gt.0.1).and.(abs(1./b(jj)).lt.15.) |
IF ((abs(1./b(jj)).gt.0.1).and.(abs(1./b(jj)).lt.15.) |
| 2216 |
& .and.(w_i(jj).GT.0.01)) THEN |
& .and.(w_i(jj).GT.0.01)) THEN |
| 2217 |
res = beta_mean_inv - (1./b(jj)) ; |
res = beta_mean_inv - (1./b(jj)) ; |
|
C write(*,*) jj,abs(res*w_i(jj)) |
|
| 2218 |
if (abs(res*w_i(jj)).lt.resmax) THEN |
if (abs(res*w_i(jj)).lt.resmax) THEN |
| 2219 |
chi2 = chi2 + (res*w_i(jj))**2. |
chi2 = chi2 + (res*w_i(jj))**2. |
| 2220 |
icount = icount+1 |
icount = icount+1 |
| 2235 |
beta_mean=100. |
beta_mean=100. |
| 2236 |
if ((chi2.lt.chi2cut).and.(quality.gt.qualitycut)) |
if ((chi2.lt.chi2cut).and.(quality.gt.qualitycut)) |
| 2237 |
& beta_mean = betachi |
& beta_mean = betachi |
|
c write(*,*) icount,chi2,quality,beta_mean |
|
| 2238 |
newbeta = beta_mean |
newbeta = beta_mean |
| 2239 |
|
|
| 2240 |
END |
END |
| 2241 |
|
|
| 2242 |
C**************************************************************************** |
C**************************************************************************** |
| 2243 |
|
|
|
|
|
|
|
|