FPLPKP COMMENTS
*-- Author :    I. O. Skillicorn      16/11/92
      SUBROUTINE FPLPKP
**: FPLPKP 40000 RP. New debug histos kicked out on the farm!                                                 
**: FPLPKP 40000 SM. New debug histos.                                                                        
**----------------------------------------------------------------------                                      
**: FPLPKP 30907 RP. Farm changes.                                                                            
**----------------------------------------------------------------------                                      
*                                                                                                             
*     Routine to organise linking of planar segments                                                          
*     to form planar-based tracks and to pick up                                                              
*     radial line-segments                                                                                    
*                                                                                                             
*                                                                                                             
*MOD SJM. Add section to fill planar drift signs (moved from FTADD)                                           
*MOD SJM. Ensure radial segments only used once!                                                              
*                                                                                                             
*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 IOS PLANAR LINK                                                                              
C     COMMON FOR RADIALS ASSOCIATED WITH PLANAR TRACKS                                                        
C     PLANAR SEGMENTS ASSOCIATED  WITH RADIALS                                                                
*KEEP,FPSTSG.                                                                                                 
C---                                                                                                          
*KEND.                                                                                                        
*     Local arrays...                                                                                         
*     Zero used radial segment array. Note that radial segment may                                            
*     have been used already on a radial-based trac. Such ambiguities                                         
*     are removed later in FTMERG.                                                                            
      CALL VZERO(IRUSED,300)                                                                           
C                                                                                                             
C---   Loop over supermodules                                                                                 
C                                                                                                             
CDEB  WRITE(*,*)' ISM NFSEG ',ISM,NFSEG(ISM)                                                                  
C                                                                                                             
C---   Loop over planar segments. Fill Arrays                                                                 
C                                                                                                             
C                                                                                                             
C---  search only the disconnected set                                                                        
C                                                                                                             
      CALL SHS(765,0,FLOAT(ISM))                                                                       
C                                                                                                             
C---  EXTRACT PLANAR SEGMENT                                                                                  
C                                                                                                             
C     FILL IOS PARAMETERS FOR LINK                                                                            
C     DY/DZ Y DX/DZ X                                                                                         
C     IOS TO RCWH NUMBER LINK                                                                                 
C     WRITE(*,*)' ISM ROB IOS #',ISM,IP,KK                                                                    
C     FILL POINT BANK AND SIGN                                                                                
      CALL SHS(764,0,FPTS)                                                                             
C     PRINT 2000,ISM,IP,KK,(IPT(IWW,KK,ISM),IWW=1,12)                                                         
C                                                                                                             
C---  End of loop over planars segments for supermodule                                                       
C                                                                                                             
C                                                                                                             
C---  End of loop over supermodules                                                                           
C                                                                                                             
C     CALL ROUTINES TO LINK SEGMENTS                                                                          
      CALL FPPJN3
      CALL FPPJ12
      CALL FPPJ23
      CALL FPPJ13
C     LIST LINKS                                                                                              
      CALL SHS(560,0,FLOAT(NPP)+0.01)                                                                  
*     PRINT 1001,I,(IPP(II,I),II=1,36),CHPP(I),IP1,IP2,IP3                                                    
C     STORE RCWH POINTERS                                                                                     
C     zero radial pointers                                                                                    
C     END OF LINK SECTION                                                                                     
      CALL FPKPKR
*-----Debug---------------------------------------------------                                                
*     WRITE(*,*)'   ***FPLPKP*** '                                                                            
*     WRITE(*,*)IG,' RADIAL TRACKS '                                                                          
*-------------------------------------------------------------                                                
*-----Debug---------------------------------------------------                                                
*     DO 300 I=1,IG                                                                                           
*     PRINT 1001,I,(IRN(K,I),K=1,36),LNK3(I,1),LNK3(I,2),LNK3(I,3)                                            
*     PRINT 1002,I,(IRP(K,I),K=1,36),ISGG(1,I),ISGG(2,I),ISGG(3,I)                                            
*300  CONTINUE                                                                                                
*-------------------------------------------------------------                                                
*-----Debug---------------------------------------------------                                                
*     WRITE(*,*)NPP,' PLANAR TRACKS '                                                                         
C                                                                                                             
C                                                                                                             
      CALL SHS(766,0, 1.01)                                                                            
      CALL SHS(766,0, 2.01)                                                                            
      CALL SHS(766,0, 3.01)                                                                            
      CALL SHS(766,0, 4.01)                                                                            
*     PRINT 1004,I,(IRR(K,I),K=1,36),LRR(1,I),LRR(2,I),LRR(3,I)                                               
*     PRINT 1003,I,(IPP(K,I),K=1,36),LPP(1,I),LPP(2,I),LPP(3,I)                                               
*-------------------------------------------------------------                                                
*