| 31 | C  mar-08 WM: Bug found in dEdx if check_charge>1 | 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 | C  oct-08 WM: Calculation of zenith angle debugged, sometimes strange values | 
| 33 | C             were possible | C             were possible | 
| 34 |  | C  nov-09 WM: the dEdx part ("adctof_c") moved to the new dEdx routine from Napoli | 
| 35 | C****************************************************************************** | C****************************************************************************** | 
| 36 |  |  | 
| 37 | INTEGER FUNCTION TOFL2COM() | INTEGER FUNCTION TOFL2COM() | 
| 637 | C---------------------------------------------------------------------- | C---------------------------------------------------------------------- | 
| 638 | C---------------------  zenith angle theta  --------------------------- | C---------------------  zenith angle theta  --------------------------- | 
| 639 | C---------------------------------------------------------------------- | C---------------------------------------------------------------------- | 
|  | C-----------------------------  old  ---------------------------------- |  | 
|  | c      dx=0. |  | 
|  | c      dy=0. |  | 
|  | c      dr=0. |  | 
|  | c      theta13 = 0. |  | 
|  | c |  | 
|  | c         IF ((tof12_i.GT.none_find).AND.(tof32_i.GT.none_find)) |  | 
|  | c     &        dx  = xtofpos(1) - xtofpos(3) |  | 
|  | c         IF ((tof11_i.GT.none_find).AND.(tof31_i.GT.none_find)) |  | 
|  | c     &        dy  = ytofpos(1) - ytofpos(3) |  | 
|  | c         dr = sqrt(dx*dx+dy*dy) |  | 
|  | c         theta13 = atan(dr/tofarm13) |  | 
|  | c |  | 
|  | c |  | 
|  | C-----------------------------  new  ------------------------------ |  | 
| 640 |  |  | 
| 641 | xhelp1=0. | xhelp1=0. | 
| 642 | if (tof11_i.GT.none_find) xhelp1=tof11_x(tof11_i) | if (tof11_i.GT.none_find) xhelp1=tof11_x(tof11_i) | 
| 1056 |  |  | 
| 1057 |  |  | 
| 1058 | C------------------------------------------------------------------ | C------------------------------------------------------------------ | 
| 1059 | C---------------------------------------------------------------------- | C------------------------------------------------------------------ | 
| 1060 | C------------------angle and ADC(x) correction | C-------angle and ADC(x) correction: moved to new dEdx routine | 
| 1061 | C---------------------------------------------------------------------- | C------------------------------------------------------------------ | 
| 1062 | C-----------------------------S1 -------------------------------- | C------------------------------------------------------------------ | 
|  | 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. |  | 
|  | c      yhelp=100. |  | 
|  | 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) |  | 
|  | 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) |  | 
|  | xkorr=xkorr/hepratio |  | 
|  | adctof_c(ch11b(i),hb11b(i))=tof11(right,i,iadc)/xkorr |  | 
|  | endif |  | 
|  | ENDIF |  | 
|  |  |  | 
|  | xhelp=0. |  | 
|  | c      xhelp=100. |  | 
|  | 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) |  | 
|  | 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) |  | 
|  | xkorr=xkorr/hepratio |  | 
|  | adctof_c(ch12b(i),hb12b(i))=tof12(right,i,iadc)/xkorr |  | 
|  | endif |  | 
|  | ENDIF |  | 
|  |  |  | 
|  | C-----------------------------S2 -------------------------------- |  | 
|  |  |  | 
|  | xhelp=0. |  | 
|  | c      xhelp=100. |  | 
|  | 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) |  | 
|  | 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) |  | 
|  | xkorr=xkorr/hepratio |  | 
|  | adctof_c(ch21b(i),hb21b(i))=tof21(right,i,iadc)/xkorr |  | 
|  | endif |  | 
|  | ENDIF |  | 
|  |  |  | 
|  |  |  | 
|  | yhelp=0. |  | 
|  | c      yhelp=100. |  | 
|  | 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) |  | 
|  | 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) |  | 
|  | xkorr=xkorr/hepratio |  | 
|  | adctof_c(ch22b(i),hb22b(i))=tof22(right,i,iadc)/xkorr |  | 
|  | endif |  | 
|  | ENDIF |  | 
|  |  |  | 
|  | C-----------------------------S3 -------------------------------- |  | 
|  |  |  | 
|  | yhelp=0. |  | 
|  | c      yhelp=100. |  | 
|  | 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) |  | 
|  | 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) |  | 
|  | xkorr=xkorr/hepratio |  | 
|  | adctof_c(ch31b(i),hb31b(i))=tof31(right,i,iadc)/xkorr |  | 
|  | endif |  | 
|  | ENDIF |  | 
|  |  |  | 
|  | xhelp=0. |  | 
|  | c      xhelp=100. |  | 
|  | 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) |  | 
|  | 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) |  | 
|  | xkorr=xkorr/hepratio |  | 
|  | adctof_c(ch32b(i),hb32b(i))=tof32(right,i,iadc)/xkorr |  | 
|  | endif |  | 
|  | ENDIF |  | 
| 1063 |  |  | 
| 1064 | C-------------------------------------------------------------------- | C-------------------------------------------------------------------- | 
| 1065 | C----------------------calculate Beta  ------------------------------ | C----------------------calculate Beta  ------------------------------ |