subroutine fpp_init c c Written by Ed Brash - January 2, 1996 - to initialize variables c which are used in the FPP software - this must be called in the c analyzer initialization phase AFTER the geometry database has c been called. c implicit none c include 'fpp_local.h' c include 'parameter.h' include 'espace_type.h' include 'detector.h' include 'option.h' c integer*4 i,ii,jj real*8 gl_pz real*8 rotmat common/KINCOM/rotmat(3,3) c character*8 tpl(24) data tpl /'Front V1','Front V2','Front V3', + 'Front U1','Front U2','Front U3', + 'Front V4','Front V5','Front V6', + 'Front U4','Front U5','Front U6', + 'Rear U1','Rear U2','Rear V1', + 'Rear V2','Rear X1','Rear X2', + 'Rear U3','Rear U4','Rear U5', + 'Rear V3','Rear V4','Rear V5'/ c c Fill local geometry parameters with values from geometry c common blocks. Note that these variables are also used by c the routine UGEOM.f in the GEANT simulation FPP studies. This c routine is called by that routine when running GEANT. Here c we call it directly. c c call init_geom c pi=3.14159265 dtor=3.14159265/180.0 rtod=1.0/dtor nevent = 0 c gl_pz = spdetector.l.fpp.geom.p.z*100. zcarbonmin=spdetector.l.fpp.geom.carbon.p.z*100.- > spdetector.l.fpp.geom.carbon.s.dz*100. zcarbonmax=spdetector.l.fpp.geom.carbon.p.z*100.+ > spdetector.l.fpp.geom.carbon.s.dz*100. zcarbon=(zcarbonmin+zcarbonmax)/2. w_spacingr=spdetector.l.fpp.geom.plane(13).w_spacing*100. w_spacingf=spdetector.l.fpp.geom.plane(1).w_spacing*100. c do i = 1,24 z_fpp(i) = (spdetector.l.fpp.geom.plane(i).p.z+ & spdetector.l.fpp.geom.plane(i).s.zz)*100.+gl_pz uvx_zero(i) = spdetector.l.fpp.geom.plane(i).uvx0*100. enddo c c Debug of new database reading c if(debug_fpp) then write(6,*)'**** Geometry from database for FPP ****' write(6,*)' Plane Zpos (cm) UVXzero (cm) ' do i=1,24 write(6,'(a8,2(3x,f12.7))') tpl(i),z_fpp(i),uvx_zero(i) enddo write(6,*)'*** Other Pars from db for FPP ***' write(6,*)'Wire Spacings are ',w_spacingf,w_spacingr write(6,*)'Carbon at ',zcarbon,zcarbonmin,zcarbonmax endif c c c Chamber position and rotation offsets c used in GEANT xofff=spdetector.l.fpp.geom.plane(1).xoff*100. yofff=spdetector.l.fpp.geom.plane(1).yoff*100. thofff=spdetector.l.fpp.geom.plane(1).thoff*dtor phofff=spdetector.l.fpp.geom.plane(1).phoff*dtor psofff=spdetector.l.fpp.geom.plane(1).psoff*dtor xoff1=spdetector.l.fpp.geom.plane(1).xoff*100. yoff1=spdetector.l.fpp.geom.plane(1).yoff*100. thoff1=spdetector.l.fpp.geom.plane(1).thoff*dtor phoff1=spdetector.l.fpp.geom.plane(1).phoff*dtor psoff1=spdetector.l.fpp.geom.plane(1).psoff*dtor xoff2=spdetector.l.fpp.geom.plane(7).xoff*100. yoff2=spdetector.l.fpp.geom.plane(7).yoff*100. thoff2=spdetector.l.fpp.geom.plane(7).thoff*dtor phoff2=spdetector.l.fpp.geom.plane(7).phoff*dtor psoff2=spdetector.l.fpp.geom.plane(7).psoff*dtor xoff3=spdetector.l.fpp.geom.plane(13).xoff*100. yoff3=spdetector.l.fpp.geom.plane(13).yoff*100. thoff3=spdetector.l.fpp.geom.plane(13).thoff*dtor phoff3=spdetector.l.fpp.geom.plane(13).phoff*dtor psoff3=spdetector.l.fpp.geom.plane(13).psoff*dtor xoff4=spdetector.l.fpp.geom.plane(19).xoff*100. yoff4=spdetector.l.fpp.geom.plane(19).yoff*100. thoff4=spdetector.l.fpp.geom.plane(19).thoff*dtor phoff4=spdetector.l.fpp.geom.plane(19).phoff*dtor psoff4=spdetector.l.fpp.geom.plane(19).psoff*dtor c c Define the inverse Euler rotation for (thofff,phiofff,psiofff) c used in GEANT c rotmat(1,1)=dcos(psofff)*dcos(thofff)+dsin(psofff)*dsin(thofff) $ *dsin(phofff) rotmat(1,2)=-dcos(phofff)*dsin(thofff) rotmat(1,3)=-dsin(psofff)*dcos(thofff)+dcos(psofff)*dsin(thofff) $ *dcos(phofff) rotmat(2,1)=dcos(psofff)*dsin(thofff)-dsin(psofff)*dcos(thofff) $ *dsin(phofff) rotmat(2,2)=dcos(phofff)*dcos(thofff) rotmat(2,3)=-dsin(psofff)*dsin(thofff)-dcos(psofff)*dcos(thofff) $ *dsin(phofff) rotmat(3,1)=dsin(psofff)*dcos(phofff) rotmat(3,2)=dsin(phofff) rotmat(3,3)=dcos(psofff)*dcos(phofff) c c for KW/RG alignment read -in from database c use the first plane on each chamber to get align info c assume align info in m and rad if (debug_fpp) then write(25,*) ' zmid zshift', &' uvx_first uvx_shift thuv thzu thzv' endif do i=1,24 zmid(i) = spdetector.l.fpp.geom.plane(i).xoff*100. uvx_first(i) = spdetector.l.fpp.geom.plane(i).yoff*100. uvrot(i) = spdetector.l.fpp.geom.plane(i).phoff uvno(i) = spdetector.l.fpp.geom.plane(i).w_angle zurot(i) = spdetector.l.fpp.geom.plane(i).thoff zvrot(i) = spdetector.l.fpp.geom.plane(i).psoff w_spacing(i)=spdetector.l.fpp.geom.plane(i).w_spacing*100. zshift(i) = spdetector.l.fpp.geom.plane(i).s.dz*100. uvx_shift(i) = 0. if (i .eq. 2 .or. i .eq. 5) then uvx_shift(i) = - w_spacing(i)/2. endif if (i .eq. 8 .or. i .eq. 11) then uvx_shift(i) = - w_spacing(i)/2. endif if ( i .eq. 14 .or. i .eq. 16 .or. i .eq. 18) then uvx_shift(i) = w_spacing(i)/2.0 endif if ( i .eq. 20 ) then uvx_shift(i) = - w_spacing(i)/2.0 endif if ( i .eq. 21 ) then uvx_shift(i) = - w_spacing(i) endif if ( i .eq. 23 ) then uvx_shift(i) = + w_spacing(i)/2.0 endif if ( i .eq. 24 ) then uvx_shift(i) = + w_spacing(i) endif if (debug_fpp) then write(25,'(2(f10.4,1x),1x,f10.4,1x,f7.4,1x,4(f7.5,1x))') & zmid(i),zshift(i),uvx_first(i), & uvx_shift(i),uvrot(i),zurot(i),zvrot(i),uvno(i) endif enddo c c T0 Calibration Setup c do ii=1,24 do jj=1,40 thits(ii,jj)=0.0 tsum(ii,jj)=0.0 t0(ii,jj)=0.0 enddo enddo return end