subroutine event_display_rotate(xa, ya, za, iplane, . xd, yd, zd) c c This routine takes raw coordinates (eg, x = strip number * pitch, and c rotates them into a frame with origin at the detector center, but c axes parallel to the telescope (lab) coordinate system. c c c George Gollin, g-gollin@uiuc.edu, 1999. c c #include "event_display.inc" c c c stuff to keep track of rotation around telescope axis: first index is c which angle (phi, psi, theta), second is which pixel chip. dimension cosine_angle(3,4), sine_angle(3,4) dimension angle(3,4), old_angle(3,4) c c data old_angle / 12*9999. / c degrees per radian: data degrees / 57.29578 / c c c c ************************************************************************* c c xd=xa yd=ya zd=za c c do not rotate the strip planes... we're not looking to work to such c accuracy in the event display program. if(iplane .ne. ipldem1 .and. iplane .ne. ipldem2 .and. . iplane .ne. ipldemm .and. iplane .ne. ipldemd) return c c if(iplane .eq. ipldem1) then idem=1 else if(iplane .eq. ipldem2) then idem=2 else if(iplane .eq. ipldemm) then idem=3 else idem=4 end if c c c load the angles into an array for my convenience: angle(1,1)=phidem1 angle(2,1)=psidem1 angle(3,1)=thetadem1 angle(1,2)=phidem2 angle(2,2)=psidem2 angle(3,2)=thetadem2 angle(1,3)=phidemm angle(2,3)=psidemm angle(3,3)=thetademm angle(1,4)=phidemd angle(2,4)=psidemd angle(3,4)=thetademd c c c have any of the alignment constants changed? If so, recalculate the cosines c and sines of the angles. do iparam=1,3 do id=1,4 c if(angle(iparam,id) .ne. old_angle(iparam,id)) then c old_angle(iparam,id)=angle(iparam,id) cosine_angle(iparam,id)=cos(angle(iparam,id)/degrees) sine_angle(iparam,id)=sin(angle(iparam,id)/degrees) c end if c end do end do c c ************************************************************************* c c rotate the measuring plane's space point around the ya axis by the phi c angle contained in first alignment parameter: angle(1,idem). c iparam=1 c xb=xa*cosine_angle(iparam,idem) + . za*sine_angle(iparam,idem) c yb=ya c zb=za*cosine_angle(iparam,idem) - . xa*sine_angle(iparam,idem) c c c now do the next rotation: measuring plane is to be rotated around xb... iparam=2 c xc=xb c yc=yb*cosine_angle(iparam,idem) + . zb*sine_angle(iparam,idem) c zc=zb*cosine_angle(iparam,idem) - . yb*sine_angle(iparam,idem) c c c c now do the last rotation, around the zc axis. iparam=3 c xd=xc*cosine_angle(iparam,idem) + . yc*sine_angle(iparam,idem) c yd=yc*cosine_angle(iparam,idem) - . xc*sine_angle(iparam,idem) c zd=zc c c c c The (xd, yd, zd) system has its axes parallel to the lab system, but has c its origin at the center of the detector. c c return end