FPLPKS COMMENTS
*-- Author :   I.O.Skillicorn
      SUBROUTINE FPLPKS( IUSEDP, IUSEG)
*                                                                                                             
*     Routine to pick up planar segments.                                                                     
*     INPUT: IT ... Iteration number.                                                                         
*            K..... Track number.                                                                             
*            IUSEDP(Hit number, wire-plane) = 1 if hit already used                                           
*                                           = 0 if free.                                                      
*     OUTPUT:IUSEDP(Hit number, wire-plane)  (up-dated)                                                       
*                                                                                                             
*            ...and in common block FRH3FT:                                                                   
*                 IRP(wire-plane, K) = number of hit on this plane                                            
*                                      associated with the track K                                            
*                 SDP(wire-plane, K) = +1.0, -1.0 for its drift sign                                          
*                                                                                                             
*     Searches for closest segment to track K in the R-Phi                                                    
*     direction which is sufficiently close in the radial direction.                                          
*     Separation is Rmean*delta-phi, where Rmean is                                                           
*     mean of planar segment and radial predicted R's and delta-phi                                           
*     is separation in Phi.                                                                                   
*                                                                                                             
*                                                                                                             
*     Fit parameters are in H1WORK:                                                                           
*     RPCOSG(K) = Slope of Phi-z fit                                                                          
*     RPSING(K) = Slope of R-z fit                                                                            
*     PHZG(K)   = Intercept of Phi-z fit (at z=0)                                                             
*     ZIG(K)    = Intercept of R-z fit (at z=0)                                                               
*     Errors are in FTRERR:                                                                                   
*     COMMON /FTRERR/ DSLPHI, DPHZER, COVP, DSLPR, DRZER, COVR                                                
*     Dxxxx = sigma (not squared) of parameter xxxx                                                           
*     COVP  = covariance of Phi-z fit parameters                                                              
*     COVR  = covariance of R  -z fit parameters                                                              
*KEEP,FRDIMS.                                                                                                 
*KEEP,FH1WORK.                                                                                                
*    Planar geometry                                                                                          
*                                                                                                             
*    Radial geometry                                                                                          
*                                                                                                             
*    Radial data...                                                                                           
*                                                                                                             
*    Planar Data                                                                                              
*                                                                                                             
*    Pointers into DIGI bank for IOS labelled hits                                                            
*                                                                                                             
*    Track segment data                                                                                       
*                                                                                                             
*    Fit data                                                                                                 
*                                                                                                             
*                                                                                                             
*KEEP,FPTVTX.                                                                                                 
**the common/VERTEX/ becomes /VERTVV/ (in analogy to /VERTFF/) on the                                         
** 17/6/91, since it is in conflict with the VERTEX module (g.bernardi)                                       
** (note that all these common names should start by F in this deck...)                                       
*KEEP,FRH3FT.                                                                                                 
*     Common for RETRAC results (SJM)                                                                         
*KEEP,FPPRAM.                                                                                                 
C                                                                                                             
C---  MAXSEG is maximum number of segments per supermodule                                                    
C---  MAXCON is maximum number of amibiguous segments associatable with                                       
C---         one segment                                                                                      
C---  LIMSTO is maximum number of 2 cluster planes intersections to be                                        
C---         stored per supermodule                                                                           
C---  MSEGLM is maximum number of clusters that can be found before                                           
C---         connectivity considered                                                                          
C---  MAXCLU is maximum number of clusters that can be found after                                            
C---         forming non-connected set    MUST BE 50 IF RUN WITH OLD RCW                                      
C---         (cluster = 3/4 digits found in a straight line in one                                            
C---          4-wire orientation)                                                                             
C                                                                                                             
C---                                                                                                          
*KEEP,FPLSEG.                                                                                                 
C---                                                                                                          
C---                                                                                                          
*KEEP,FPTFLG.                                                                                                 
*KEEP,FPTPAR.                                                                                                 
*KEEP,FDIFLG.                                                                                                 
*KEND.                                                                                                        
*     Common for track parameter errors...                                                                    
*     Common for segment numbers...                                                                           
*     Local arrays...                                                                                         
*     Establish cut values for this iteration...                                                              
*     single iteration in this code                                                                           
C                                                                                                             
C---   Loop over supermodules                                                                                 
C                                                                                                             
C                                                                                                             
C---  Calculate radial prediction for segment in this supermodule                                             
C                                                                                                             
C                                                                                                             
C---  RR and PHI calculated for this Z as predicted by radials                                                
C                                                                                                             
C                                                                                                             
C                                                                                                             
C---  search only unused segments                                                                             
C                                                                                                             
C                                                                                                             
C---  search only the disconnected set                                                                        
C                                                                                                             
C                                                                                                             
C---  Extract planar segment and covariance matrix                                                            
C                                                                                                             
C---                                                                                                          
C---                                                                                                          
C---                                                                                                          
*     R and Phi for planar segment                                                                            
*     note mm                                                                                                 
*     Believe the radial segment prediction in the 'drift' direction                                          
*     only. More-or-less ignore rad radius...                                                                 
C                                                                                                             
C---  End of loop over planars segments for supermodule                                                       
C                                                                                                             
        CALL SHS(214+IT, 0, DRMIN)                                                                     
        CALL SHS(217+IT, 0, DRM)                                                                       
C                                                                                                             
C---  Build list of planar hits and mark segment and hits used                                                
C                                                                                                             
           CALL SHS(210,0,DRMIN)                                                                       
           CALL SHS(211,0,DRM  )                                                                       
           CALL SHD(212,0,DRMIN,DRM)                                                                   
C                                                                                                             
C---  End of loop over supermodules                                                                           
C                                                                                                             
*                                                                                                             
*                                                                                                             
*