SUBROUTINE FKLPAF
*-- Author : Stephen Burke
      SUBROUTINE FKLPAF(JPL,IERR)
*-----------------------------------------Updates 27/04/92-------                                             
**: FKLPAF.......SB. Error message description updated.                                                       
*-----------------------------------------Updates 07/02/92-------                                             
**: FKLPAF 30205.SB. Initialise IFAIL to please UNDEF.                                                        
*-----------------------------------------Updates----------------                                             
**********************************************************************                                        
*                                                                    *                                        
* Point acquisition during filtering (at plane JPL)                  *                                        
*                                                                    *                                        
* ERROR CONDITIONS;                                                  *                                        
*       IERR =   0  ; normal termination                             *                                        
*   ->  IERR =   1  ; projected vector missing or invalid prob cut   *                                        
*   ->  IERR =   3  ; invalid value in MES array                     *                                        
*   ->  IERR =   4  ; invalid value in MES array, or internal error  *                                        
*       IERR =  12  ; covariance of residuals not positive definite  *                                        
*                                                                    *                                        
*   ->  `Fatal' error                                                *                                        
*                                                                    *                                        
* `Fatal' means that a serious problem occurred, but all errors      *                                        
* are recoverable as no changes are made.                            *                                        
*                                                                    *                                        
* Error codes from FKHUNT are passed back unchanged, but these are   *                                        
* not yet defined.                                                   *                                        
*                                                                    *                                        
**********************************************************************                                        
                                                                        
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)                               
      LOGICAL FKHUNT
                                                                        
      PARAMETER (IUTIL=0,IROUT=16)                                      
*KEEP,FKECODE.                                                                                                
      PARAMETER (IWARN=0,IFATAL=1,IFPRO=2,IFFLT=3,IFSMO=4,IFPRS=5,      
     &           IFPAS=6,IFPAF=7)                                       
      PARAMETER (IINF1=1,IINF2=2,IINF3=3,IINV=4,IDONE=5)                
      PARAMETER (IICV=6,IMCV=7,IOCV=11,IRCV=12,IOVCV=13,                
     &           ITHGP2=16,ITHG1=17)                                    
      PARAMETER (IFREE=20,IFREE1=30,IFREE2=40,IFREE3=50)                
*KEND.                                                                                                        
                                                                        
*KEEP,FKNPL.                                                                                                  
      CHARACTER*5 CKDBG                                                 
      PARAMETER (CKDBG='FKDBG')                                         
      PARAMETER (NPL=72)                                                
      LOGICAL LTRUE,LFIRST,LTRPL,LTRPLD                                 
      DOUBLE PRECISION TRUE,RTRUE,CHITRU,SPRO,CPRO,SFIL,CFIL            
     &,                SSMT,CSMT,SSMTR,CSMTR,DPRO,CBPRO,QPRO,QGAIN      
     &,                RPRO,CRPRO,RFIL,CRFIL,RSMT,CRSMT,CHIFIL,CHISMT   
*                                                                                                             
* 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.                                                                        
*                                                                                                             
      COMMON /H1WORK/                                                   
* /FKPROJ/                                                                                                    
     &                SPRO(5,NPL),CPRO(5,5,NPL)                         
* /FKFILT/                                                                                                    
     &,               SFIL(5,NPL),CFIL(5,5,NPL)                         
* /FKSMTH/                                                                                                    
     &,               SSMT(5,NPL),CSMT(5,5,NPL)                         
     &,               SSMTR(5,NPL),CSMTR(5,5,NPL)                       
* /FKINT/                                                                                                     
     &,               DPRO(5,5,NPL),CBPRO(5,5,NPL),QPRO(5,5,NPL)        
     &,               QGAIN(5,5,NPL),IAPROX,LFIRST                      
* /FKRSID/                                                                                                    
     &,               RPRO(2,NPL),CRPRO(2,2,NPL),RFIL(2,NPL)            
     &,               CRFIL(2,2,NPL),RSMT(2,NPL),CRSMT(2,2,NPL)         
     &,               CHIFIL(NPL),CHISMT(NPL)                           
* /FKTRUE/                                                                                                    
     &,               TRUE(5,NPL),RTRUE(5,NPL),CHITRU(NPL),LTRUE        
* /FKDBG/                                                                                                     
     &,               LTRPL(NPL),LTRPLD(NPL)                            
*KEEP,FKFLAG.                                                                                                 
      LOGICAL LPRO,LFIL,LSMT,LMES,LRAD,LRPRO,LRFIL,LRSMT,LPOINT,LBLOCK  
      COMMON /FKFLAG/ LPRO(NPL),LFIL(NPL),LSMT(NPL),LMES(NPL)           
     &,               LRAD(NPL),LRPRO,LRFIL,LRSMT,LPOINT,LBLOCK         
*KEEP,FKRJCT.                                                                                                 
      DOUBLE PRECISION CHITOT,X2PCUT,X2CUTB,X2CUTA,X2CUTN               
     &,                       X2PCTI,X2CTBI,X2CTAI,X2CTNI               
      LOGICAL LWIRE,LPRINI                                              
      COMMON /FKRJCT/ X2PCUT,X2CUTB,X2CUTA,X2CUTN                       
     &,               X2PCTI,X2CTBI,X2CTAI,X2CTNI                       
     &,               CHITOT(NPL),NDF(NPL)                              
     &,               NBLOCK(NPL),NBADP(NPL),NBADB(NPL)                 
     &,               NFAILP(NPL),NFAILB(NPL),NNEWP(NPL)                
     &,               NUNRJP(NPL),NUNRJB(NPL),NRERJP(NPL)               
     &,               NCPRS,NBPRS,NCPAS,NPASS,IRJCT(NPL)                
     &,               LWIRE(NPL),LPRINI                                 
*KEEP,FKPROJ.                                                                                                 
*KEND.                                                                                                        
                                                                        
**********************************************************************                                        
                                                                        
      IERR = 0                                                          
                                                                        
      IF (.NOT.LPRO(JPL)) THEN                                          
         CALL FKERR(IUTIL,IROUT,IWARN,IINF1,IERR)
         RETURN                                                         
      ENDIF                                                             
                                                                        
      NCPAS = NCPAS + 1                                                 
                                                                        
* See if there's a new digi                                                                                   
      IFAIL = 0                                                         
      IF (FKHUNT(JPL,SPRO(1,JPL),CPRO(1,1,JPL),IFAIL))
     &                            NNEWP(JPL) = NNEWP(JPL) + 1           
      IF (IFAIL.NE.0) CALL FKERR(IUTIL,IROUT,IWARN,IFAIL,IERR)
                                                                        
      RETURN                                                            
      END                                                               
*