SUBROUTINE FKINIT
*-- Author : S.Burke
      SUBROUTINE FKINIT
**********************************************************************                                        
*                                                                    *                                        
* Initialise counters for errors and points rejected                 *                                        
*                                                                    *                                        
**********************************************************************                                        
                                                                        
*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,FKCNTL.                                                                                                 
      COMMON /FKCNTL/ LUN,IPR,ITR,IPL,JSTART,JSTOP,JLAST,JSTEP          
*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,FKTRUE.                                                                                                 
*KEEP,FKFTVX.                                                                                                 
      DOUBLE PRECISION DTHMAX,DPHMAX                                    
      COMMON /FKFTVX/ DTHMAX,DPHMAX                                     
*KEEP,FKINT.                                                                                                  
*KEEP,FKLERR.                                                                                                 
      PARAMETER(NROUT=20,NCODE=50)                                      
      COMMON /FKLERR/ NMERR(NCODE,NROUT),NUERR(NCODE,NROUT)             
     &,               NFAT,NERR,NOFL,NUFL,IULAST,IRLAST,MAXERR          
*KEND.                                                                                                        
                                                                        
**********************************************************************                                        
                                                                        
* Set parameter defaults                                                                                      
      LFIRST = .TRUE.                                                   
      LPOINT = .FALSE.                                                  
      LBLOCK = .FALSE.                                                  
      LPRINI = .FALSE.                                                  
      LRPRO  = .FALSE.                                                  
      LRFIL  = .FALSE.                                                  
      LRSMT  = .TRUE.                                                   
      LTRUE  = .FALSE.                                                  
                                                                        
      DO 100 JPL=1,NPL                                                  
* It would be possible to set up the ZPL and RADL arrays here                                                 
         NBLOCK(JPL) = 0                                                
         LWIRE(JPL)  = .FALSE.                                          
         LRAD(JPL)   = .FALSE.                                          
 100  CONTINUE                                                          
                                                                        
* Default printout is full summary + fatal errors during execution                                            
      IPR    = 8                                                        
      LUN    = 6                                                        
      ITR    = 0                                                        
      MAXERR = 100                                                      
                                                                        
* These defaults are meant to be overridden                                                                   
      X2PCUT = 0.001D0                                                  
      X2CUTB = 0.001D0                                                  
      X2CUTA = 0.1D0                                                    
      X2CUTN = 0.1D0                                                    
      X2PCTI = 0.00001D0                                                
      X2CTBI = 0.00001D0                                                
      X2CTAI = 0.1D0                                                    
      X2CTNI = 0.1D0                                                    
      DTHMAX = 0.01                                                     
      DPHMAX = 0.01                                                     
                                                                        
* Set error counts to zero                                                                                    
      CALL FKERR(0,0,0,0,IERR)
                                                                        
* Set rejected-point counts to zero                                                                           
      CALL VZERO(NNEWP,NPL)                                                                            
      CALL VZERO(NBADP,NPL)                                                                            
      CALL VZERO(NBADB,NPL)                                                                            
      CALL VZERO(NUNRJP,NPL)                                                                           
      CALL VZERO(NUNRJB,NPL)                                                                           
      CALL VZERO(NRERJP,NPL)                                                                           
      CALL VZERO(NFAILP,NPL)                                                                           
      CALL VZERO(NFAILB,NPL)                                                                           
                                                                        
      NCPAS = 0                                                         
      NCPRS = 0                                                         
      NBPRS = 0                                                         
                                                                        
      RETURN                                                            
      END                                                               
*