FFKLCH COMMENTS
*-- Author : Stephen Burke
      SUBROUTINE FFKLCH
*-----------------------------------------Updates 04/05/92-------                                             
*-----------------------------------------Updates 13/02/92-------                                             
**: FFKLCH 30205.SB. ERRLOG error numbers changed.                                                            
*-----------------------------------------Updates 07/02/92-------                                             
**: FFKLCH 30205.SB. Remove unused FKCNTL sequence.                                                           
**: FFKLCH 30205.SB. Change to avoid UNDEF warning.                                                           
*-----------------------------------------Updates 24/01/92-------                                             
**: FFKLCH 30205.SB. ERRLOG message format changed.                                                           
*-----------------------------------------Updates----------------                                             
**********************************************************************                                        
*                                                                    *                                        
* Fill histograms to test the Kalman filter output                   *                                        
*                                                                    *                                        
**********************************************************************                                        
*KEEP,FKNPL.                                                                                                  
*                                                                                                             
* Per-track values can go in H1WORK; note that LTRUE and LFIRST must                                          
* be set at least per event.                                                                                  
*                                                                                                             
* This is about 36k words long; the remaining common blocks are                                               
* about 3.6k in total. Some of this could be in /H1WORK/, but the                                             
* blocks would have to be reorganised.                                                                        
*                                                                                                             
* /FKPROJ/                                                                                                    
* /FKFILT/                                                                                                    
* /FKSMTH/                                                                                                    
* /FKINT/                                                                                                     
* /FKRSID/                                                                                                    
* /FKTRUE/                                                                                                    
* /FKDBG/                                                                                                     
*KEEP,FFGEO.                                                                                                  
*KEEP,FFWBI.                                                                                                  
* Work bank indices (note that INDKTR is *NOT* a work bank index!)                                            
*KEEP,FFDBG.                                                                                                  
*KEEP,BCS.                                                                                                    
*KEEP,STFUNCT.                                                                                                
*     index of element before row number IROW                                                                 
*     index of L'th element  of row number IROW                                                               
*     L'th integer element of the IROW'th row of bank with index IND                                          
*     L'th real element of the IROW'th row of bank with index IND                                             
*KEND.                                                                                                        
**********************************************************************                                        
* Look for the track banks - if there aren't any, give up!                                                    
      INDTKR = NLINK('FTKR',0)
* Unpacked digi banks                                                                                         
      INDLC(1) = NLINK('FPLC',0)
         CALL FPLOCO
         INDLC(1) = NLINK('FPLC',0)
      INDLC(2) = NLINK('FRLC',0)
         CALL FRLOCO
         INDLC(2) = NLINK('FPLC',0)
         CALL ERRLOG(401,'W:FFKLCH: Banks FPLC/FRLC not found')                                        
* Zero the work bank indices                                                                                  
      CALL VZERO(INDX,2)                                                                               
      CALL VZERO(INDRSX,2)                                                                             
* Get the pointering bank ...                                                                                 
      IND = NLINK('FTPR',0)
         CALL ERRLOG(402,'S:FFKLCH:  Bank FTPR not found')                                             
      CALL BKTOW(IW,BANK,0,IW,INDTPR,*1000)                                                            
* Now get the link banks ...                                                                                  
      IF (NLINK('FTPX',0).LE.0 .OR. NLINK('FTRX',0).LE.0) THEN
         CALL ERRLOG(403,'S:FFKLCH:  Banks FTPX and FTRX not found')                                   
      CALL BKTOW(IW,BANK,0,IW,INDX(1),*1000)                                                           
      CALL BKTOW(IW,BANK,0,IW,INDX(2),*1000)                                                           
      IF (NLINK('FRPX',0).GT.0) THEN
         CALL BKTOW(IW,BANK,0,IW,INDRSX(1),*1000)                                                      
      IF (NLINK('FRRX',0).GT.0) THEN
         CALL BKTOW(IW,BANK,0,IW,INDRSX(2),*1000)                                                      
      CALL HCDIR('//PAWC/'//CFKDBG,' ')                                                                
      CALL HFILL(300,FLOAT(NTR/2),0.,1.)                                                               
      CALL VZERO(ITRTR,2*NTRACK)                                                                       
         CALL HFILL(301,CHPROB,0.,1.)                                                                  
         CALL FFHUNT(JDIGP,JDIGR,JMAX)
         IF (JMAX.GT.0) CALL FFCHEK(JDIGP,JDIGR,JMAX)
      CALL FFTRCH
      CALL HCDIR('//PAWC',' ')                                                                         
*                                                                                                             
* Must make sure all work banks are dropped!!!                                                                
*                                                                                                             
      CALL WDROP(IW,INDX(1))                                                                           
      CALL WDROP(IW,INDX(2))                                                                           
      CALL WDROP(IW,INDRSX(1))                                                                         
      CALL WDROP(IW,INDRSX(2))                                                                         
      CALL WDROP(IW,INDTPR)                                                                            
 1000 CALL ERRLOG(404,'S:FFKLCH:  Bank '//BANK//' not found by BKTOW')                                 
*