SUBROUTINE FFHBK
*-- Author : S.Burke
      SUBROUTINE FFHBK
*-----------------------------------------Updates 03/05/93-------                                             
**: FFHBK.......SB.  Reinstate missing track histograms.                                                      
*-----------------------------------------Updates 29/10/92-------                                             
**: FFHBK .......SB. Debug steering changed slightly.                                                         
*-----------------------------------------Updates 07/08/92-------                                             
**: FFHBK .......SB. New histograms.                                                                          
*-----------------------------------------Updates----------------                                             
**********************************************************************                                        
*                                                                    *                                        
* Book diagnostic histograms                                         *                                        
*                                                                    *                                        
**********************************************************************                                        
                                                                        
*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,FFSTEE.                                                                                                 
      PARAMETER (NFT=72)                                                
      LOGICAL LRISV,LWMAP,LGRAPH,LTRUTH                                 
      REAL DSX,DSY,DSQOP,DSTTH,DSPHI,PMCUT,PCUT,CHPCUT                  
     &,    QOPMAX,THEMAX,RFTMIN,RFTMAX,CEMAX                            
      COMMON /FFSTEE/ DSX,DSY,DSQOP,DSTTH,DSPHI                         
     &,               PMCUT,IDIAG,JPLRSV,LRISV,LWMAP(NFT),JPLMAX        
     &,               IRP(NPL),JPLFT(NPL),JFTPL(NFT)                    
     &,               LUNGKS,IWKGKS,IDGKS,LUNHB,LUNGKM,IWKGKM,IDGKM     
     &,               LGRAPH,LTRUTH,IHFF,IHFK,ISRJCT,PCUT,CHPCUT        
     &,               QOPMAX,THEMAX,RFTMIN,RFTMAX,CEMAX                 
*KEEP,FFDBG.                                                                                                  
      CHARACTER*5 CFDBG                                                 
      CHARACTER*6 CFKDBG                                                
      PARAMETER (CFDBG='FFDBG',CFKDBG='FFKDBG')                         
      PARAMETER (NTRACK=1000)                                           
      COMMON /FFDBG/ ITRTR(2,NTRACK),ITRNF(5,NTRACK),JTRTR              
*KEND.                                                                                                        
                                                                        
**********************************************************************                                        
                                                                        
      CALL HCDIR('//PAWC',' ')                                                                         
      CALL HMDIR(CFDBG,'S')                                                                            
      IPASS = 1                                                         
                                                                        
      IF (IHFF/1000.GT.0) THEN                                          
         CALL HBOOK1(101,'TRACK ANGLE CORR (PLANAR)$',100,0.,0.025,0.)                                 
         CALL HBOOK1(102,'TRACK ANGLE CORR (RADIAL)$',100,0.,0.025,0.)                                 
         CALL HBOOK1(103,'TRACK ANGLE (PLANAR)$',100,0.,1.,0.)                                         
         CALL HBOOK1(104,'TRACK ANGLE (RADIAL)$',100,0.,1.,0.)                                         
         CALL HBOOK1(105,'EVT0 CORRECTION$',100,-0.025,0.025,0.)                                       
         CALL HBOOK1(106,'TOF CORR (PLANAR)$',100,-0.025,0.025,0.)                                     
         CALL HBOOK1(107,'TOF CORR (RADIAL)$',100,-0.025,0.025,0.)                                     
         CALL HBOOK1(108,'PROP CORRECTION$',100,-0.025,0.025,0.)                                       
         CALL HBOOK1(109,'B-FIELD CORR (PLANAR)$',100,-0.025,0.025,0.)                                 
         CALL HBOOK1(110,'B-FIELD CORR (RADIAL)$',100,-0.025,0.025,0.)                                 
         CALL HBOOK1(111,'DELTA(B) (PLANAR)$',100,-0.2,0.2,0.)                                         
         CALL HBOOK1(112,'DELTA(B) (RADIAL)$',100,-0.2,0.2,0.)                                         
         CALL HBOOK1(113,'TOTAL CORR (PLANAR)$',100,-0.025,0.025,0.)                                   
         CALL HBOOK1(114,'TOTAL CORR (RADIAL)$',100,-0.025,0.025,0.)                                   
      ENDIF                                                             
                                                                        
 100  CONTINUE                                                          
                                                                        
      IF (MOD(IHFF,10).GT.0) THEN                                       
         CALL HBOOK1(300,'NUMBER OF TRACKS$',100,0.,100.,0.)                                           
         IF (LTRUTH) CALL HBOOK1(301,'P(CHISQ)$',100,0.,1.,0.)                                         
         CALL HBOOK1(311,'EFFICIENCY (PLANAR)$',100,0.,1.,0.)                                          
         CALL HBOOK1(312,'EFFICIENCY (RADIAL)$',100,0.,1.,0.)                                          
         CALL HBOOK1(313,'EFFICIENCY',100,0.,1.,0.)                                                    
         CALL HBOOK1(314,'ERROR RATE (PLANAR)$',100,0.,1.,0.)                                          
         CALL HBOOK1(315,'ERROR RATE (RADIAL)$',100,0.,1.,0.)                                          
         CALL HBOOK1(316,'ERROR RATE$',100,0.,1.,0.)                                                   
      ENDIF                                                             
                                                                        
      IF (MOD(IHFF/10,10).GT.0) THEN                                    
         CALL HBOOK1(321,'NUMBER OF HITS (PLANAR)$',100,0.,100.,0.)                                    
         CALL HBOOK1(322,'NUMBER OF HITS (RADIAL)$',100,0.,100.,0.)                                    
         CALL HBOOK1(323,'HITS BY MODULE$',100,0.,100.,0.)                                             
         CALL HBOOK1(331,'MISSING TRACKS$',100,0.,100.,0.)                                             
         CALL HBOOK1(332,'HITS PER MISSING TRACK (PLANAR)$'                                            
     &,              100,0.,100.,0.)                                    
         CALL HBOOK1(333,'HITS PER MISSING TRACK (RADIAL)$'                                            
     &,              100,0.,100.,0.)                                    
         CALL HBOOK1(334,'MISSING TRACK MOMENTUM$'                                                     
     &,              100,0.,10.,0.)                                     
         CALL HBOOK1(335,'HITS PER MISSING TRACK (PRIMARY)$'                                           
     &,              100,0.,100.,0.)                                    
         CALL HBOOK1(336,'MISSING TRACK MOMENTUM (PRIMARY)$'                                           
     &,              100,0.,10.,0.)                                     
      ENDIF                                                             
                                                                        
      CALL HBPRO(0,0.)                                                                                 
      CALL HMINIM(0,0.)                                                                                
      CALL HIDOPT(0,'INTE')                                                                            
                                                                        
      CALL HCDIR('//PAWC',' ')                                                                         
      CALL HMDIR(CFKDBG,'S')                                                                           
                                                                        
      IF (MOD(IHFF,1000).GT.100 .AND. IPASS.EQ.1) THEN                  
         IPASS = 2                                                      
         GOTO 100                                                       
      ENDIF                                                             
                                                                        
      CALL HCDIR('//PAWC',' ')                                                                         
                                                                        
      RETURN                                                            
      END                                                               
*