FFKAL COMMENTS
*-- Author : Stephen Burke
      SUBROUTINE FFKAL
*-----------------------------------------Updates 07/09/93-------                                             
**: FFKAL 40000 SB.  No more garbage collection.                                                              
*-----------------------------------------Updates 27/07/93-------                                             
**: FFKAL  30907 RP. Farm changes.                                                                            
*-----------------------------------------Updates 03/05/93-------                                             
**: FFKAL 30907 SB.  Print summary on ENDJOB.                                                                 
**: FFKAL 30907 SB.  Output LOOK histograms.                                                                  
*-----------------------------------------Updates 30/11/92-------                                             
**: FFKAL 30907 SB.  Print new counters.                                                                      
**: FFKAL 30907 SB.  Call new diagnostic routine FFTRAN.                                                      
*-----------------------------------------Updates 06/08/92-------                                             
**: FFKAL 30907 SB.  Cosmetic changes.                                                                        
*-----------------------------------------Updates 13/03/92-------                                             
**: FFKAL 30205.SB.  Put REVENT code after ENDRUN code                                                        
**: FFKAL 30205.SB.  Suppress printout if IW(6).LE.0                                                          
*-----------------------------------------Updates 13/02/92-------                                             
**: FFKAL 30205.SB.  Small cosmetic change (IFIRST -> LINIT).                                                 
**: FFKAL 30205.SB.  ERRLOG error numbers changed.                                                            
*-----------------------------------------Updates 07/02/92-------                                             
**: FFKAL 30205.SB.  Change printout format slightly.                                                         
*-----------------------------------------Updates 24/01/92-------                                             
**: FFKAL 30205.SB.  BKFMT calls moved here.                                                                  
**: FFKAL 30205.SB.  New counters added.                                                                      
**: FFKAL 30205.SB.  Call H1STOP if initialisation fails.                                                     
**: FFKAL 30205.SB.  ERRLOG message format changed.                                                           
**: FFKAL 30205.SB.  Make sure PAW directory is reset.                                                        
*-----------------------------------------Updates----------------                                             
**********************************************************************                                        
*                                                                    *                                        
* Steer Kalman filter track fit on results of FTREC                  *                                        
*                                                                    *                                        
**********************************************************************                                        
*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,FFSTEE.                                                                                                 
*KEEP,FFSCAL.                                                                                                 
* Counters                                                                                                    
*KEEP,FFWBI.                                                                                                  
* Work bank indices (note that INDKTR is *NOT* a work bank index!)                                            
*KEEP,FFDBG.                                                                                                  
*KEEP,FKDBG.                                                                                                  
*KEND.                                                                                                        
*KEEP,BCS.                                                                                                    
*KEEP,BOSMDL.                                                                                                 
C     ------BOSMDL                                                                                            
C     ------                                                                                                  
*KEND.                                                                                                        
**********************************************************************                                        
* Initialise Kalman filter, and set parameter defaults                                                        
      IF (BEGJOB) CALL FKINIT
* Zero work bank indices (just in case ...)                                                                   
         CALL VZERO(INDRSX,NWBI)                                                                       
* Zero counters                                                                                               
         CALL VZERO(NPFAIL,NSCAL)                                                                      
* Override defaults with parameters read from text banks                                                      
         CALL FFTEXT
* Format output banks                                                                                         
         CALL BKFMT('FTKR','2I,(6F,I,9F,I,F,3I)')
         CALL BKFMT('FTKX','B16')
         CALL BKFMT('FTPR','B16')
         CALL BKFMT('FTPX','B16')
         CALL BKFMT('FTRX','B16')
* Book monitoring histograms                                                                                  
         CALL FFBKLK
* Book some debug histograms                                                                                  
         CALL FKHBK
         CALL FFHBK
* Initialise GKS                                                                                              
* This shouldn't happen!                                                                                      
         CALL H1STOP                                                                                   
      IF (ENDRUN.OR.ENDJOB) CALL FFEND
      CALL FFFIT
* Count tracks                                                                                                
      INFTUR = NLINK('FTUR',0)
      INFTKR = NLINK('FTKR',0)
* Check output                                                                                                
      IF (MOD(IHFF,1000).GT.100) CALL FFKLCH
      IF (LTRUTH) CALL FFTRAN
* Make sure PAW directory is reset                                                                            
      CALL HCDIR('//PAWC',' ')                                                                         
*