FTMERG COMMENTS
*-- Author :   I.O.Skillicorn
      SUBROUTINE FTMERG
**: FTMERG 30907 RP. Farm changes.                                                                            
**----------------------------------------------------------------------                                      
*                                                                                                             
*     Merge lists of Radial-based and Planar-based tracks                                                     
*     resolving conflicts.                                                                                    
*         - Planar-based tracks win disputed segments                                                         
*  ***    - Radial-based tracks only accepted if verified by at                                               
*           at least one planar.                                                                              
*  ***    - Keep radial only tracks if 1 or 2 module.                                                         
*                                                                                                             
*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.                                                                                                        
*     POINTERS TO RADIAL SEGMENTS FORMING TRACKS                                                              
*     COMMON FOR IOS PLANAR LINK                                                                              
*     COMMON FOR PLANAR FOUND TRACKS                                                                          
C     COMMON FOR RADIALS ASSOCIATED WITH PLANAR TRACKS                                                        
C     PLANAR SEGMENTS ASSOCIATED  WITH RADIALS                                                                
C     ISGG POINTS TO ROB'S SEGMENT BANKS                                                                      
C            RADIAL  REJECT , UNUSED  , RADIAL VERIFIED BY PLANAR                                             
      CALL VZERO(IUZP,3*MAXSEG)                                                                        
      CALL VZERO(IUZR,3*MAXTRK)                                                                        
      CALL VZERO(IBRR,IG)                                                                              
      CALL VZERO(IVRR,IG)                                                                              
      CALL VZERO(IBPP,NPP)                                                                             
C     CHECK COMMON RADIAL SEGMENT                                                                             
      CALL SHS(713,0,2.01)                                                                             
C     CHECK COMMON PLANAR SEGMENT                                                                             
      CALL SHS(713,0,3.01)                                                                             
C     HERE WE HAVE EITHER RADIAL OR PLANAR SEGMENT IN COMMON                                                  
C     BETWEEN RADIAL AND PLANAR FOUND TRACKS                                                                  
C     MARK RADIAL LINKED TRACK AS BAD                                                                         
C     NEXT LINE COUNTS RADIALS FOUND MORE THAN ONCE BY PLANARS                                                
      CALL SHS(713,0,4.01)                                                                             
*-----Debug---------------------------------------------------                                                
*     WRITE(*,*)' ***FTMERG***'                                                                               
*     WRITE(*,*)IG,' RADIAL TRACKS FTADD'                                                                     
*                                                                                                             
*     Mark planar and radial segments on verified radial tracks                                               
*     used. Label the verified radial tracks in the IG list                                                   
*     Kill off bad links...                                                                                   
      CALL SHS(711,0,5.01)                                                                             
C       RADIAL TRACK VERIFIED BY PLANAR SEGMENT - GOOD TRACK                                                  
*-----Debug---------------------------------------------------                                                
*       Write(6,*) '       Verified Radial-based track:-'                                                     
*       PRINT 1001,I,(IRN(K,I),K=1,36),LNK3(I,1),LNK3(I,2),LNK3(I,3)                                          
*       PRINT 1001,I,(IRP(K,I),K=1,36),ISGG(1,I),ISGG(2,I),ISGG(3,I)                                          
        CALL SHS(711,0,2.01)                                                                           
C       UNVERIFIED - SEEN RADIALS ONLY- ?                                                                     
*-----Debug---------------------------------------------------                                                
*       Write(6,*) '       Unverified Radial-based track:-'                                                   
*       PRINT 1001,I,(IRN(K,I),K=1,36),LNK3(I,1),LNK3(I,2),LNK3(I,3)                                          
*       PRINT 1001,I,(IRP(K,I),K=1,36),ISGG(1,I),ISGG(2,I),ISGG(3,I)                                          
*1001 FORMAT(' RR',I2,3X,12I2,3X,12I2,3X,12I2,2X,3I2)                                                         
*1002 FORMAT(' RP',I2,3X,12I2,3X,12I2,3X,12I2,2X,3I2)                                                         
        CALL SHS(711,0,3.01)                                                                           
*       'Verify' this track also.                                                                             
*       This assumes Radial tracks are at least two module...                                                 
*       LNK3(I,1) = 0                                                                                         
*       LNK3(I,2) = 0                                                                                         
*       LNK3(I,3) = 0                                                                                         
C     RADIAL BASED TRACK HAS SEGMENT IN COMMON WITH PLANAR BASED TRACK                                        
C     SHARE PLANAR SEGMENT WITH PLANAR TRACK - REJECT - IBRR=1                                                
C     SHARE RADIAL SEGMENT WITH PLANAR TRACK - REJECT- IBRR=1                                                 
*     PRINT 1005,I,(IRN(K,I),K=1,36),LNK3(I,1),LNK3(I,2),LNK3(I,3)                                            
*     PRINT 1006,I,(IRP(K,I),K=1,36),ISGG(1,I),ISGG(2,I),ISGG(3,I)                                            
      CALL SHS(711,0,4.01)                                                                             
CC    WRITE(*,*)NPP,' PLANAR TRACKS '                                                                         
C     TRACKS BASED ON LINKED PLANAR SEGMENTS - ACCEPT AS GOOD                                                 
*     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)                                               
      CALL SHS(711,0,1.01)                                                                             
C     PLANAR VERIFIED BY RADIAL                                                                               
      CALL SHS(713,0,1.01)                                                                             
C     FOR COMPLETENESS ADD DRIFT SIGNS FOR PLANAR AND RADIALS                                                 
C                                                                                                             
*