FTJN13 COMMENTS
*-- Author : I.O. Skillicorn
      SUBROUTINE FTJN13(CF,IU,LLL,LL,RPC,RPS,PH,CH,    ZI)
**: FTJN13 40000 IS. New linking code.                                                                        
**----------------------------------------------------------------------                                      
**: FTJN13 40000 SM. Fix selection of best link.                                                              
**----------------------------------------------------------------------                                      
C     AUTHOR    I.O.SKILLICORN                                                                                
C      JOIN MODULES 1 AND 3                                                                                   
C     21/5/91  REDUCE SIZE                                                                                    
*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,FJNPAR.                                                                                                 
*KEND.                                                                                                        
*                                                                                                             
*                                                                                                             
*     LOCAL ARRAYS...                                                                                         
C     DIMENSION IP(36),SD(36),IPP(36,MAXTRK),SDD(36,MAXTRK)                                                   
C     'Centre' points of radial modules                                                                       
*                                                                                                             
*                                                                                                             
C     TO JOIN TWO  MODULES                                                                                    
C     STANDARD DEVIATIONS ** 2                                                                                
C     CUTS CHANGED FOR FAST FILTER - SECOND LINE FOR FAST FILTER                                              
C     SELECT TRACKS STR LINE PHI-Z ONLY                                                                       
C     IE THOSE FROM Z-AXIS                                                                                    
C     REPLACEMENT VALUES H1SIM  ****************************                                                  
C                                                                                                             
C     ****************************************************                                                    
*************************NEW CUTS******94 DATA**************                                                  
*     CHT=100.                                                                                                
*     RCUT=20.                                                                                                
*     PCUT=0.04                                                                                               
*     PSCUT=0.002                                                                                             
************************************************************                                                  
C                                                                                                             
C     =0 USE MANY TIMES  =1  USE ONCE                                                                         
C     IU SET IN  FTJN3                                                                                        
C     *******************************                                                                         
C     REFIT PHI-Z WITH R-VALUES OF SEGMENTS                                                                   
C     FILL POINTS/DRIFT SIGN                                                                                  
C     RECALCULATE PHI-Z SLOPE AND INTERCEPT                                                                   
C     R : ASSUMES LINEAR TO VERTEX                                                                            
C     PHI CONTINUOUS                                                                                          
      CALL FTLFTW(XXX,YYY,WWT,IC,0,2,PS1,PZ1,D1,D2,D3,COV)
      CALL FTLFTW(XXX,YYY,WWT,IC,0,2,PS2,PZ2,D1,D2,D3,COV)
C     CHECK RECALCULATED PHI CONTINUOUS                                                                       
*                                                                                                             
*                                                                                                             
      CALL FTCHKH(PCOS, PHZ, PSIN, RI, I, 0, J, CHI)
C     GOOD LINK                                                                                               
C******************************************12/10/88********************                                       
C      LL(LLL,3)=K                                                                                            
*------------------------------------------                                                                   
CDEB      PRINT 1010,LLL,(IPP(NNN,LLL),NNN=1,36)                                                              
*------------------------------------------                                                                   
C     SELECT BEST                                                                                             
C     COMPARE BEST WITH REMAINDER                                                                             
CCCCC IF(LL(K,3).EQ.LL(KB,3))GOTO130                                                                          
C     REMOVE LINK                                                                                             
C     COMPARE FINISHED , MARK BEST SEGMENT USED                                                               
C     RESET CHI WHEN COMPARE FINISHED                                                                         
C                                                                                                             
C                                                                                                             
C                                                                                                             
C     SET USED FLAGS                                                                                          
CCCCCC      IU(LL(I,3),3)=1                                                                                   
      CALL SHS(2040,0,8.)                                                                              
      CALL SHS(2040,0,10.)                                                                             
*------------------------------------------                                                                   
C     PRINT1000,LL(I,1),LL(I,2),LL(I,3)                                                                       
*------------------------------------------                                                                   
C                                                                                                             
*                                                                                                             
*                                                                                                             
C new version imported from IOS fortran 6/6/91                                                                
*