*********************************************************************** SUBROUTINE REFSTEP c c 12-july 99 R. Schicker *********************************************************************** implicit none #include "geant321/gcflag.inc" #include "geant321/gckine.inc" #include "geant321/gcking.inc" #include "geant321/gclist.inc" #include "geant321/gcsets.inc" #include "geant321/gctmed.inc" #include "geant321/gctrak.inc" #include "geant321/gcvolu.inc" #include "geant321/gconst.inc" #include "user.inc" #include "mdcdconst.inc" integer numl(4),i,i1,i2,iac1,j1,j2,nmdc,ihit,icref,kcoun real xl(3),xll(3),xlll(3),pl(3),pll(3),hit(15),theg real d1,d2,d3,the,themdc,phimdc,themdcp,phimdcp,plx,ply,plz character*4 ac1,ac2 equivalence(iac1,ac1) data numl/1,1,1,1/ save icref,kcoun c if(kcoun.eq.0)then c do i1=1,4 c write(6,701)i1,(mdcdy(i2,i1),i2=1,6) c 701 format(' mdc ',i4,' mdcy = ',6f8.3) c end do c end if kcoun=kcoun+1 if(inwvol.eq.1)then iac1=names(nlevel) if(ac1.eq."D4S6")istop=1 if(ac1(3:4).eq."C4")then nmdc=ichar(ac1(2:2))-48 c write(6,101)itra,sleng,step,inwvol,ac1,numed,nmdc c 101 format(' ref101',i4,' sl=',2f8.4,' iw=',i2,' ac1=',a4,' med=',2i4) c write(6,101)itra,sleng,step,inwvol,ac1,numed c 101 format(' ref101',i4,' sl=',2f8.4,' iw=',i2,' ac1=',a4,' med=',i4) do i=1,3 xl(i)=vect(i) pl(i)=vect(i+3) end do call gmtod(xl,xll,1) call gmtod(pl,pll,2) do i=1,3 pll(i)=pll(i)*vect(7) end do d1=sqrt(xl(1)**2+xl(2)**2) the=raddeg*atan2(d1,xl(3)) c write(6,102)(xll(i),i=1,3),(pll(i),i=1,3),the c 102 format(' ref102: xll ',3f8.4,' pll ',3f8.4,' the=',f6.2) xlll(1)=-xll(1) xlll(2)=xll(3)+mdcdy(4,nmdc) xlll(3)=xll(2) plx=-pll(1) ply=pll(3) plz=pll(2) d1=sqrt(plx**2+ply**2) themdc=atan2(d1,plz) if(themdc.lt.0.)then themdcp=themdc+twopi c write(6,301)themdc,themdcp c 301 format(' refstep 301: the ',2f8.3) else themdcp=themdc end if phimdc=atan2(ply,plx) if(phimdc.lt.0.)then phimdcp=phimdc+twopi c write(6,302)phimdc,phimdcp c 302 format(' refstep 302: phi ',2f8.3) else phimdcp=phimdc end if c write(6,103)(xlll(i),i=1,3),(plll(i),i=1,3),the c 103 format(' ref103: xlll ',3f8.4,' plll ',3f8.4,' the=',f6.2) c do j1=1,4 c write(6,201)j1,(mdcdx(j2,j1),j2=1,6) c 201 format(' mdcdx ',i4,2x,6f8.4) c end do c do j1=1,4 c write(6,202)j1,(mdcdy(j2,j1),j2=1,6) c 202 format(' mdcdy ',i4,2x,6f8.4) c end do c write(6,104) c 104 format(' ') c hit(1)=vect(1) c hit(2)=vect(2) c hit(3) =vect(3) hit(1)=plx hit(2)=ply hit(3)=plz hit(4)=vect(4)*vect(7) hit(5)=vect(5)*vect(7) hit(6)=vect(6)*vect(7) hit(7)=xlll(1) hit(8)=xlll(2) hit(9)=1.e9*tofg hit(10)=1.e3*getot hit(11)=float(ipart) hit(12)=sleng hit(13)=themdcp hit(14)=phimdcp hit(15)=float(number(3)) if(hit(13).lt.0.)then write(6,401)themdc,themdcp,phimdc,phimdcp 401 format(' the ',2f8.3,' phi ',2f8.3) write(6,402)(hit(j1),j1=1,7) 402 format(' refstep 402: ',3f9.3,3f9.4,f9.3) write(6,403)(hit(j1),j1=8,14) 403 format(' refstep 403: ',5f9.3,2f9.5) write(6,404)nlevel,(numbv(j1),j1=1,6) 404 format(' refstep 404: nlevel = ',i4,' numbv ',6i5) do j1=1,8 iac1=names(j1) j2=number(j1) write(6,405)j1,ac1,j2 405 format(' level ',i4,' name ',a4,' number ',i4) end do end if icref=icref+1 c write(6,111)icref c 111 format(' NOW IN REFSTEP GSAHIT ',i4) call gsahit(iset,idet,itra,numbv,hit,ihit) end if end if return end