SUBROUTINE FTDGEO
*-- Author : S.J. Maxfield
      SUBROUTINE FTDGEO
*#**********************************************************************                                      
*#                                                                     *                                      
*#    VERSION: 12/04/90   Steve Maxfield                               *                                      
*#                                                                     *                                      
*#                                                                     *                                      
*# PURPOSE: Get certain geometrical data for IOS arrays                *                                      
*#                                                                     *                                      
*#                                                                     *                                      
*#**********************************************************************                                      
*KEEP,BCS.                                                                                                    
      INTEGER      NHROW,NHCOL,NHLEN                                    
      PARAMETER   (NHROW = 2, NHCOL = 1, NHLEN=2)                       
      INTEGER      NBOSIW                                               
      PARAMETER   (NBOSIW=1000000)                                      
      INTEGER      IW(NBOSIW)                                           
      REAL         RW(NBOSIW)                                           
      COMMON /BCS/ IW                                                   
      EQUIVALENCE (RW(1),IW(1))                                         
      SAVE   /BCS/                                                      
*KEEP,FGMIOS.                                                                                                 
       COMMON/FGMIOS/                                                   
*    Planar geometry                                                                                          
     + ZPP(140),C(140),S(140),ITYPE(140),WZERO(140),WSPACE,             
*                                                                                                             
*    Radial geometry                                                                                          
     + ZP(36),PHW(36),WS(36)                                            
*                                                                                                             
*KEEP,FPLGEO.                                                                                                 
C---                                                                                                          
      COMMON /FPLGEO/   ZPLAN(36)   , TP(9)   , YP(26)    , PLANE(3,9), 
     1                 RMAX    , RMIN    , YSTART    , YSPACE    ,      
     2                 X0      , Y0      , PZSTRU (8), STAGER   ,       
     3                 RESOL   , ACUT    , CTP(9)    , STP(9)           
C---                                                                                                          
*KEND.                                                                                                        
*                                                                                                             
*                                                                                                             
*                                                                                                             
      PARAMETER(TWOPI=6.283185)                                         
      LOGICAL FIRST                                                     
      DATA FIRST/.TRUE./                                                
                                                                        
*----------------------------------------------------------------------                                       
*     Set up some nominal Geometry a la IOS.                                                                  
      IF(FIRST) THEN                                                    
*     --------------                                                                                          
        FIRST = .FALSE.                                                 
        CALL UGTBNK('FGAR',INFGAR)
        IF( INFGAR .EQ. 0) THEN                                         
           WRITE(6,*)' ***FTDGEO >> FGAR BANK NOT FOUND'                
           CALL H1STOP                                                                                 
        ENDIF                                                           
        CALL UGTBNK('FGAP',INDP)
        IF( INDP .EQ. 0) THEN                                           
           WRITE(6,*)' ***FTDGEO >> FGAP BANK NOT FOUND'                
           CALL H1STOP                                                                                 
        ENDIF                                                           
                                                                        
*       Get basic radial parameters...                                                                        
*       Everything is labelled by wire-plane number (1-36)                                                    
        NMOD  = IW(INFGAR+3)                                            
        NPLANE= IW(INFGAR+5)                                            
*                                                                                                             
        DPHI  = TWOPI / FLOAT(IW(INFGAR+4))                             
        STAG  = RW(INFGAR+6)                                            
        ZSEP  = RW(INFGAR+7)                                            
        KIND  = INFGAR + 5                                              
*                                                                                                             
        DO 1 KMOD = 0, NMOD-1                                           
          KIND   = KIND + 4                                             
          PHIWIR = RW(KIND+4) + DPHI/2.                                 
          DO 4   KK= 1, NPLANE                                          
            K = KMOD*12 + KK                                            
            ZP(K)  =  RW(KIND+3) - ZSEP/2.0 + KK*ZSEP                   
            PHW(K) =  PHIWIR                                            
            WS(K)  =  -STAG * ( (-1)**KK)                               
 4        CONTINUE                                                      
 1      CONTINUE                                                        
*                                                                                                             
*       Get basic planar parameters...                                                                        
        NMODP = IW(INDP+3)                                              
        NPLANP= IW(INDP+5)                                              
*                                                                                                             
        ZSEPP = RW(INDP+6)                                              
        KIND  = INDP + IW(INDP+1) + 1                                   
        DO 2 KMOD = 0, NMODP-1                                          
         DO 202  KK= 1, NPLANP                                          
            K = KMOD*4 + KK                                             
            ZPP(K)  =  RW(KIND+3) - ZSEPP/2.0 + KK*ZSEPP                
*    Cosine and Sine of WIRES:-                                                                               
            C(K) =  COS( RW(KIND+4) - TWOPI/4.)                         
            S(K) =  SIN( RW(KIND+4) - TWOPI/4.)                         
*           For RWCH Planar code                                                                              
            TP(KMOD+1)  =  RW(KIND+4) - TWOPI/4.                        
            CTP(KMOD+1) =  C(K)                                         
            STP(KMOD+1) =  S(K)                                         
            ZPLAN(K)    =  ZPP(K)*10.0                                  
 202     CONTINUE                                                       
          KIND   = KIND + IW(KIND+1) + 1                                
 2      CONTINUE                                                        
                                                                        
                                                                        
      ENDIF                                                             
*     -----                                                                                                   
      RETURN                                                            
      END                                                               
*