--- DarthVader/ToFLevel2/src/tofl2com.for 2008/03/03 09:51:03 1.7 +++ DarthVader/ToFLevel2/src/tofl2com.for 2009/11/23 09:50:50 1.13 @@ -26,6 +26,12 @@ C then in a second step we check the residuals of the single C measurements, reject if > 10 sigma, calculate chi2 and "quality" C beta is taken as good if chi2<20 and quality>10 +C mar-08 WM: Call to "newbeta" changed, now a flag tells the function if the +C call comes from "tofl2com" or form "toftrack" +C mar-08 WM: Bug found in dEdx if check_charge>1 +C oct-08 WM: Calculation of zenith angle debugged, sometimes strange values +C were possible +C nov-09 WM: the dEdx part ("adctof_c") moved to the new dEdx routine from Napoli C****************************************************************************** INTEGER FUNCTION TOFL2COM() @@ -45,7 +51,7 @@ INTEGER j,hitvec(6) REAL dx,dy,dr,ds - REAL yhelp,xhelp,xhelp1,xhelp2 + REAL yhelp,yhelp1,yhelp2,xhelp,xhelp1,xhelp2 REAL c1,c2 C REAL sw,sxw,w_i @@ -102,7 +108,7 @@ C-- DATA ZTOF/53.74,53.04,23.94,23.44,-23.49,-24.34/ !Sergio 9.05.2006 REAL tofarm12 PARAMETER (tofarm12 = 29.70) ! from 53.39 to 23.69 - REAL tofarm23 + REAL tofarm23 PARAMETER (tofarm23 = 47.61) ! from 23.69 to -23.92 REAL tofarm13 PARAMETER (tofarm13 = 77.31) ! from 53.39 to -23.92 @@ -575,8 +581,6 @@ hitvec(5)=tof31_i hitvec(6)=tof32_i -c write(*,*) 'tofl2com', -c & tof11_i,tof12_i,tof21_i,tof22_i,tof31_i,tof32_i C------------------------------------------------------------------ C-- calculate track position in paddle using timing difference @@ -634,17 +638,33 @@ C--------------------- zenith angle theta --------------------------- C---------------------------------------------------------------------- - dx=0. - dy=0. - dr=0. - theta13 = 0. - - IF ((tof12_i.GT.none_find).AND.(tof32_i.GT.none_find)) - & dx = xtofpos(1) - xtofpos(3) - IF ((tof11_i.GT.none_find).AND.(tof31_i.GT.none_find)) - & dy = ytofpos(1) - ytofpos(3) - dr = sqrt(dx*dx+dy*dy) - theta13 = atan(dr/tofarm13) + xhelp1=0. + if (tof11_i.GT.none_find) xhelp1=tof11_x(tof11_i) + if (xtofpos(1).lt.100) xhelp1=xtofpos(1) + + yhelp1=0. + if (tof12_i.GT.none_find) yhelp1=tof12_y(tof12_i) + if (ytofpos(1).lt.100) yhelp1=ytofpos(1) + + + yhelp2=0. + if (tof32_i.GT.none_find) yhelp2=tof32_y(tof32_i) + if (ytofpos(3).lt.100) yhelp2=ytofpos(3) + + xhelp2=0. + if (tof31_i.GT.none_find) xhelp2=tof31_x(tof31_i) + if (xtofpos(3).lt.100) xhelp2=xtofpos(3) + + + dx=0. + dy=0. + dr=0. + theta13 = 0. + + dx = xhelp1 - xhelp2 + dy = yhelp1 - yhelp2 + dr = sqrt(dx*dx+dy*dy) + theta13 = atan(dr/tofarm13) C---------------------------------------------------------------------- @@ -656,7 +676,7 @@ C---------------------------------------------------------------------- iz = int(check_charge(theta13,hitvec)) -C write(*,*) 'in tofl2com',iz +c write(*,*) 'charge in tofl2com',iz C-------------------------------------------------------------------- C---- if TDCleft.and.TDCright and NO ADC insert artificial ADC @@ -673,7 +693,8 @@ C---------------------------- S1 ------------------------------------- - yhelp=0. +c yhelp=0. + yhelp=100. ! WM if (tof12_i.GT.none_find) yhelp=tof12_y(tof12_i) if (ytofpos(1).lt.100) yhelp=ytofpos(1) @@ -693,7 +714,8 @@ endif ENDIF - xhelp=0. +c xhelp=0. + xhelp=100. ! WM if (tof11_i.GT.none_find) xhelp=tof11_x(tof11_i) if (xtofpos(1).lt.100) xhelp=xtofpos(1) @@ -715,7 +737,8 @@ C-----------------------------S2 -------------------------------- - xhelp=0. +c xhelp=0. + xhelp=100. ! WM if (tof22_i.GT.none_find) xhelp=tof22_x(tof22_i) if (xtofpos(2).lt.100) xhelp=xtofpos(2) @@ -736,7 +759,8 @@ ENDIF - yhelp=0. +c yhelp=0. + yhelp=100. ! WM if (tof21_i.GT.none_find) yhelp=tof21_y(tof21_i) if (ytofpos(2).lt.100) yhelp=ytofpos(2) @@ -758,7 +782,8 @@ C-----------------------------S3 -------------------------------- - yhelp=0. +c yhelp=0. + yhelp=100. ! WM if (tof32_i.GT.none_find) yhelp=tof32_y(tof32_i) if (ytofpos(3).lt.100) yhelp=ytofpos(3) @@ -778,7 +803,8 @@ endif ENDIF - xhelp=0. +c xhelp=0. + xhelp=100. ! WM if (tof31_i.GT.none_find) xhelp=tof31_x(tof31_i) if (xtofpos(3).lt.100) xhelp=xtofpos(3) @@ -918,7 +944,8 @@ tdc_c(ch32b(i),hb32b(i))=tof32(right,i,itdc) ENDIF ENDDO - + + C--------------------------------------------------------------- C--- calculate track position in paddle using timing difference C--- now using the time-walk corrected TDC values @@ -934,11 +961,13 @@ IF (tof11_i.GT.none_find) THEN ytofpos(1) = ((tof11(1,tof11_i,itdc)-tof11(2,tof11_i,itdc))/2. + -y_coor_lin11(tof11_i,offset))/y_coor_lin11(tof11_i,slope) + i=tof11_i endif IF (tof12_i.GT.none_find) THEN xtofpos(1) = ((tof12(1,tof12_i,itdc)-tof12(2,tof12_i,itdc))/2. + -x_coor_lin12(tof12_i,offset))/x_coor_lin12(tof12_i,slope) + i=tof12_i endif @@ -947,11 +976,13 @@ IF (tof21_i.GT.none_find) THEN xtofpos(2) = ((tof21(1,tof21_i,itdc)-tof21(2,tof21_i,itdc))/2. + -x_coor_lin21(tof21_i,offset))/x_coor_lin21(tof21_i,slope) + i=tof21_i endif IF (tof22_i.GT.none_find) THEN ytofpos(2) = ((tof22(1,tof22_i,itdc)-tof22(2,tof22_i,itdc))/2. + -y_coor_lin22(tof22_i,offset))/y_coor_lin22(tof22_i,slope) + i=tof22_i endif @@ -960,11 +991,13 @@ IF (tof31_i.GT.none_find) THEN ytofpos(3) = ((tof31(1,tof31_i,itdc)-tof31(2,tof31_i,itdc))/2. + -y_coor_lin31(tof31_i,offset))/y_coor_lin31(tof31_i,slope) + i=tof31_i endif IF (tof32_i.GT.none_find) THEN xtofpos(3) = ((tof32(1,tof32_i,itdc)-tof32(2,tof32_i,itdc))/2. + -x_coor_lin32(tof32_i,offset))/x_coor_lin32(tof32_i,slope) + i=tof32_i endif @@ -977,6 +1010,7 @@ c endif c enddo + C-- restrict TDC measurements to physical paddle dimensions +/- 10 cm C-- this cut is now stronger than in the old versions @@ -988,221 +1022,44 @@ if (abs(ytofpos(2)).gt.18.) ytofpos(2)=101. if (abs(ytofpos(3)).gt.18.) ytofpos(3)=101. - C---------------------------------------------------------------------- C--------------------- zenith angle theta --------------------------- C---------------------------------------------------------------------- +C------------------- improved calculation --------------------------- - dx=0. - dy=0. - dr=0. - theta13 = 0. - - IF ((tof12_i.GT.none_find).AND.(tof32_i.GT.none_find)) - & dx = xtofpos(1) - xtofpos(3) - IF ((tof11_i.GT.none_find).AND.(tof31_i.GT.none_find)) - & dy = ytofpos(1) - ytofpos(3) - dr = sqrt(dx*dx+dy*dy) - theta13 = atan(dr/tofarm13) - -C------------------------------------------------------------------ -c dx=0. -c dy=0. -c dr=0. -c theta12 = 0. -c -c IF ((tof12_i.GT.none_find).AND.(tof21_i.GT.none_find)) -c & dx = xtofpos(1) - xtofpos(2) -c IF ((tof11_i.GT.none_find).AND.(tof22_i.GT.none_find)) -c & dy = ytofpos(1) - ytofpos(2) -c dr = sqrt(dx*dx+dy*dy) -c theta12 = atan(dr/tofarm12) -c -c dx=0. -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 - - - yhelp=0. - if (tof21_i.GT.none_find) yhelp=tof21_y(tof21_i) - if (ytofpos(2).lt.100) yhelp=ytofpos(2) - - IF (tof22_i.GT.none_find.AND.abs(yhelp).lt.100) THEN - - i = tof22_i - if (tof22(left,i,iadc).lt.3786) then -c if (adc(ch22a(i),hb22a(i)).lt.4095) then - 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 -------------------------------- + xhelp1=0. + if (tof11_i.GT.none_find) xhelp1=tof11_x(tof11_i) + if (xtofpos(1).lt.100) xhelp1=xtofpos(1) + + yhelp1=0. + if (tof12_i.GT.none_find) yhelp1=tof12_y(tof12_i) + if (ytofpos(1).lt.100) yhelp1=ytofpos(1) + + yhelp2=0. + if (tof32_i.GT.none_find) yhelp2=tof32_y(tof32_i) + if (ytofpos(3).lt.100) yhelp2=ytofpos(3) + + xhelp2=0. + if (tof31_i.GT.none_find) xhelp2=tof31_x(tof31_i) + if (xtofpos(3).lt.100) xhelp2=xtofpos(3) + + + dx=0. + dy=0. + dr=0. + theta13 = 0. + + dx = xhelp1 - xhelp2 + dy = yhelp1 - yhelp2 + dr = sqrt(dx*dx+dy*dy) + theta13 = atan(dr/tofarm13) - 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 +C------------------------------------------------------------------ +C------------------------------------------------------------------ +C-------angle and ADC(x) correction: moved to new dEdx routine +C------------------------------------------------------------------ +C------------------------------------------------------------------ C-------------------------------------------------------------------- C----------------------calculate Beta ------------------------------ @@ -1575,7 +1432,7 @@ C icount= icount+1 C if (i.le.4) w_i=1./(0.13**2.) C if ((i.ge.5).and.(i.le.8)) w_i=1./(0.16**2.) -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 C sxw=sxw + betatof_a(i)*w_i C sw =sw + w_i C endif @@ -1584,13 +1441,14 @@ C if (icount.gt.0) beta_mean=sxw/sw C betatof_a(13) = beta_mean C + C-------- New mean beta calculation ----------------------- do i=1,12 btemp(i) = betatof_a(i) enddo - betatof_a(13)=newbeta(btemp,hitvec,10.,10.,20.) + betatof_a(13)=newbeta(1,btemp,hitvec,10.,10.,20.) C-------------------------------------------------------------- C write(*,*) betatof_a @@ -1604,7 +1462,8 @@ c write(*,*) xtr_tof c write(*,*) ytr_tof - 100 continue +c 100 continue + continue C RETURN @@ -1748,6 +1607,26 @@ REAL a1,a2 INTEGER jj +c get rid of warnings EMILIANO + i = 0 + slope = 0 + offset = 0 + none_find = 0 + none_ev = 0 + adc_ev = 0 + tdc_ev = 0 + iadc = 0 + itdc = 0 + right = 0 + left = 0 + tof12_y(1) = tof12_y(1) + tof11_x(1) = tof11_x(1) + tof21_y(1) = tof21_y(1) + tof22_x(1) = tof22_x(1) + tof32_y(1) = tof32_y(1) + tof31_x(1) = tof31_x(1) +c get rid of warnings + C----------------------------------------------------------- C--- get data C----------------------------------------------------------- @@ -2113,7 +1992,7 @@ C**************************************************************************** C**************************************************************************** - function newbeta(b,hitvec,resmax,qualitycut,chi2cut) + function newbeta(iflag,b,hitvec,resmax,qualitycut,chi2cut) include 'input_tof.txt' include 'output_tof.txt' @@ -2123,13 +2002,34 @@ REAL resmax,qualitycut,chi2cut REAL w_i(12),w_il(6),quality,res,betachi,beta_mean_inv REAL sw,sxw,b(12),beta_mean,chi2,xhelp + REAL tdcfl(4,12) - INTEGER icount,hitvec(6) + INTEGER iflag,icount,hitvec(6) INTEGER itop(12),ibot(12) DATA itop /1,1,2,2,3,3,4,4,1,1,2,2/ DATA ibot /5,6,5,6,5,6,5,6,3,4,3,4/ + +c get rid of warnings EMILIANO + slope = 0 + offset = 0 + none_find = 0 + none_ev = 0 + adc_ev = 0 + tdc_ev = 0 + iadc = 0 + itdc = 0 + right = 0 + left = 0 + tof12_y(1) = tof12_y(1) + tof11_x(1) = tof11_x(1) + tof21_y(1) = tof21_y(1) + tof22_x(1) = tof22_x(1) + tof32_y(1) = tof32_y(1) + tof31_x(1) = tof31_x(1) +c get rid of warnings + C==================================================================== tof11_i = hitvec(1) @@ -2139,9 +2039,22 @@ tof31_i = hitvec(5) tof32_i = hitvec(6) -c write(*,*) '------------ In NEWBETA ----------------' -c write(*,*) hitvec -c write(*,*) b + if (iflag.eq.1) then ! call from tofl2com + do i=1,4 + do j=1,12 + tdcfl(i,j) = tdcflagtof(i,j) + enddo + enddo + endif + + if (iflag.eq.2) then ! call from toftrk + do i=1,4 + do j=1,12 + tdcfl(i,j) = tdcflag(i,j) + enddo + enddo + endif + C--- Find out ToF layers with artificial TDC values ------------- @@ -2149,15 +2062,13 @@ w_il(jj) = 1000. enddo -C write(*,*) tdcflagtof if (tof11_i.gt.0) then if ((tofmask(ch11a(tof11_i),hb11a(tof11_i)).gt.0).or. & (tofmask(ch11b(tof11_i),hb11b(tof11_i)).gt.0)) then w_il(1)=0 - i1=tdcflagtof(ch11a(tof11_i),hb11a(tof11_i)) - i2=tdcflagtof(ch11b(tof11_i),hb11b(tof11_i)) -c write(*,*) '11 ',i1,i2 + i1=tdcfl(ch11a(tof11_i),hb11a(tof11_i)) + i2=tdcfl(ch11b(tof11_i),hb11b(tof11_i)) if ((i1.eq.1).or.(i2.eq.1)) w_il(1) = 1 ! tdcflag endif endif @@ -2166,9 +2077,8 @@ if ((tofmask(ch12a(tof12_i),hb12a(tof12_i)).gt.0).or. & (tofmask(ch12b(tof12_i),hb12b(tof12_i)).gt.0)) then w_il(2)=0 - i1=tdcflagtof(ch12a(tof12_i),hb12a(tof12_i)) - i2=tdcflagtof(ch12b(tof12_i),hb12b(tof12_i)) -c write(*,*) '12 ',i1,i2 + i1=tdcfl(ch12a(tof12_i),hb12a(tof12_i)) + i2=tdcfl(ch12b(tof12_i),hb12b(tof12_i)) if ((i1.eq.1).or.(i2.eq.1)) w_il(2) = 1 ! tdcflag endif endif @@ -2177,9 +2087,8 @@ if ((tofmask(ch21a(tof21_i),hb21a(tof21_i)).gt.0).or. & (tofmask(ch21b(tof21_i),hb21b(tof21_i)).gt.0)) then w_il(3)=0 - i1=tdcflagtof(ch21a(tof21_i),hb21a(tof21_i)) - i2=tdcflagtof(ch21b(tof21_i),hb21b(tof21_i)) -c write(*,*) '21 ',i1,i2 + i1=tdcfl(ch21a(tof21_i),hb21a(tof21_i)) + i2=tdcfl(ch21b(tof21_i),hb21b(tof21_i)) if ((i1.eq.1).or.(i2.eq.1)) w_il(3) = 1 ! tdcflag endif endif @@ -2188,9 +2097,8 @@ if ((tofmask(ch22a(tof22_i),hb22a(tof22_i)).gt.0).or. & (tofmask(ch22b(tof22_i),hb22b(tof22_i)).gt.0)) then w_il(4)=0 - i1=tdcflagtof(ch22a(tof22_i),hb22a(tof22_i)) - i2=tdcflagtof(ch22b(tof22_i),hb22b(tof22_i)) -c write(*,*) '22 ',i1,i2 + i1=tdcfl(ch22a(tof22_i),hb22a(tof22_i)) + i2=tdcfl(ch22b(tof22_i),hb22b(tof22_i)) if ((i1.eq.1).or.(i2.eq.1)) w_il(4) = 1 ! tdcflag endif endif @@ -2199,9 +2107,8 @@ if ((tofmask(ch31a(tof31_i),hb11a(tof31_i)).gt.0).or. & (tofmask(ch31b(tof31_i),hb31b(tof31_i)).gt.0)) then w_il(5)=0 - i1=tdcflagtof(ch31a(tof31_i),hb31a(tof31_i)) - i2=tdcflagtof(ch31b(tof31_i),hb31b(tof31_i)) -c write(*,*) '31 ',i1,i2 + i1=tdcfl(ch31a(tof31_i),hb31a(tof31_i)) + i2=tdcfl(ch31b(tof31_i),hb31b(tof31_i)) if ((i1.eq.1).or.(i2.eq.1)) w_il(5) = 1 ! tdcflag endif endif @@ -2210,14 +2117,12 @@ if ((tofmask(ch32a(tof32_i),hb32a(tof32_i)).gt.0).or. & (tofmask(ch32b(tof32_i),hb32b(tof32_i)).gt.0)) then w_il(6)=0 - i1=tdcflagtof(ch32a(tof32_i),hb32a(tof32_i)) - i2=tdcflagtof(ch32b(tof32_i),hb32b(tof32_i)) -c write(*,*) '32 ',i1,i2 + i1=tdcfl(ch32a(tof32_i),hb32a(tof32_i)) + i2=tdcfl(ch32b(tof32_i),hb32b(tof32_i)) if ((i1.eq.1).or.(i2.eq.1)) w_il(6) = 1 ! tdcflag endif endif -c write(*,*) w_il C------------------------------------------------------------------------ C--- Set weights for the 12 measurements using information for top and bottom: C--- if no measurements: weight = set to very high value=> not used @@ -2237,8 +2142,6 @@ w_i(jj) = 1./xhelp ENDDO -c write(*,*) w_i - C======================================================================== C--- Calculate mean beta for the first time ----------------------------- C--- We are using "1/beta" since its error is gaussian ------------------ @@ -2259,7 +2162,6 @@ if (icount.gt.0) beta_mean=1./(sxw/sw) beta_mean_inv = 1./beta_mean -c write(*,*) icount,beta_mean C--- Calculate beta for the second time, use residuals of the single C--- measurements to get a chi2 value @@ -2275,7 +2177,6 @@ IF ((abs(1./b(jj)).gt.0.1).and.(abs(1./b(jj)).lt.15.) & .and.(w_i(jj).GT.0.01)) THEN res = beta_mean_inv - (1./b(jj)) ; -C write(*,*) jj,abs(res*w_i(jj)) if (abs(res*w_i(jj)).lt.resmax) THEN chi2 = chi2 + (res*w_i(jj))**2. icount = icount+1 @@ -2296,12 +2197,9 @@ beta_mean=100. if ((chi2.lt.chi2cut).and.(quality.gt.qualitycut)) & beta_mean = betachi -c write(*,*) icount,chi2,quality,beta_mean newbeta = beta_mean END C**************************************************************************** - -