SUBROUTINE FFBKLK
*-- Author : Stephen Burke
      SUBROUTINE FFBKLK
*-----------------------------------------Updates 22/11/93-------                                             
**: FFBKLK.......SB. Changes to monitoring histograms.                                                        
*-----------------------------------------Updates 27/07/93-------                                             
**: FFBKLK 30907 SB. Changes to monitoring histograms.                                                        
**: FFBKLK 30907 RP. Farm changes.                                                                            
*-----------------------------------------Updates 02/06/93-------                                             
**: FFBKLK 30907 SB. Correct bad update.                                                                      
*-----------------------------------------Updates 03/05/93-------                                             
**: FFBKLK 30907 SB. Change range of MC histos.                                                               
*-----------------------------------------Updates 03/03/93-------                                             
**: FFBKLK 30907 SB. New monitoring histograms.                                                               
*-----------------------------------------Updates 03/03/93-------                                             
**: FFBKLK 30907 SB. New monitoring histograms.                                                               
*-----------------------------------------Updates 30/11/92-------                                             
**: FFBKLK 30907 SB. New monitoring histograms.                                                               
*-----------------------------------------Updates 06/08/92-------                                             
**: FFBKLK 30205.SB. Remove vertex histos, add xy, change scales.                                             
*-----------------------------------------Updates 24/01/92-------                                             
**: FFBKLK 30205.SB. Add some new histograms, with new numbering.                                             
**: FFBKLK 30205.SB. Change range of histograms for data.                                                     
*-----------------------------------------Updates----------------                                             
**********************************************************************                                        
*                                                                    *                                        
* Book LOOK monitoring histograms for the Kalman filter              *                                        
*                                                                    *                                        
**********************************************************************                                        
                                                                        
*KEEP,H1EVDT.                                                                                                 
      COMMON /H1EVDT/ KEVENT,IDATA,MONTE,LCONF                          
      INTEGER KEVENT,IDATA,LCONF                                        
      LOGICAL MONTE                                                     
*                                                                                                             
*  IDATA  type of information (HEAD bank word 6) :                                                            
*                                                                                                             
*                       0 - real data H1                                                                      
*                       1 - MC data H1SIM                                                                     
*                       2 - real data CERN tests                                                              
*                       3 - MC data ARCET                                                                     
*                                                                                                             
*  MONTE = .TRUE.   if IDATA=1                                                                                
*  KEVENT = event processed counter for H1REC                                                                 
*                                                                                                             
*KEEP,BCS.                                                                                                    
      INTEGER      NHROW,NHCOL,NHLEN                                    
      PARAMETER   (NHROW = 2, NHCOL = 1, NHLEN=2)                       
      INTEGER      NBOSIW                                               
      PARAMETER   (NBOSIW=1000000)                                      
      INTEGER      IW(NBOSIW)                                           
      REAL         RW(NBOSIW)                                           
      COMMON /BCS/ IW                                                   
      EQUIVALENCE (RW(1),IW(1))                                         
      SAVE   /BCS/                                                      
*KEEP,BOSMDL.                                                                                                 
C     ------BOSMDL                                                                                            
      LOGICAL       BEGJOB,ENDRUN,BEGRUN,REVENT,ENDJOB,OTHDAT           
      COMMON/BOSMDL/BEGJOB,ENDRUN,BEGRUN,REVENT,ENDJOB,OTHDAT,          
     +              LCCRUN,NCCRUN,NEVENT,                               
     +              IHA,IBS,IDB,IDATEL,LUP,ISN,JSN                      
      SAVE  /BOSMDL/                                                    
C     ------                                                                                                  
*KEEP,FTHIST.                                                                                                 
* indices of filter farm histos                                                                               
      COMMON/FTHIST/IHP(100)                                            
*KEND.                                                                                                        
                                                                        
**********************************************************************                                        
                                                                        
*                                                                                                             
* Histogram offset (for filter)                                                                               
*                                                                                                             
                                                                        
      IHX=0                                                             
                                                                        
*                                                                                                             
* Residual histogram range for MC and data                                                                    
*                                                                                                             
                                                                        
      IF (IDATA.NE.0) THEN                                              
C         RANGE = 0.06                                                                                        
         RANGE = 0.12                                                   
      ELSE                                                              
         RANGE = 0.12                                                   
      ENDIF                                                             
                                                                        
      CALL BHS(IHX+1,0,60,1.,61.)                                                                      
      CALL STEXT(IHX+1,4,'Tracks/event')                                                               
                                                                        
      CALL BHS(IHX+2,0,37,0.,37.)                                                                      
      CALL STEXT(IHX+2,4,'Planar hits/track')                                                          
                                                                        
      CALL BHS(IHX+3,0,37,0.,37.)                                                                      
      CALL STEXT(IHX+3,4,'Radial hits/track')                                                          
                                                                        
      CALL BHS(IHX+4,0,60,-RANGE,RANGE)                                                                
      CALL STEXT(IHX+4,4,'Drift residuals (planars)')                                                  
      CALL STEXT(IHX+4,1,'cm')                                                                         
                                                                        
      CALL BHS(IHX+5,0,60,-RANGE,RANGE)                                                                
      CALL STEXT(IHX+5,4,'Drift residuals (radials)')                                                  
      CALL STEXT(IHX+5,1,'cm')                                                                         
                                                                        
      CALL BHS(IHX+6,0,60,-12.0,12.0)                                                                  
      CALL STEXT(IHX+6,4,'Radius residuals (radials)')                                                 
      CALL STEXT(IHX+6,1,'cm')                                                                         
                                                                        
      CALL BHS(IHX+7,0,64,-3.2,3.2)                                                                    
      CALL STEXT(IHX+7,4,'Phi')                                                                        
                                                                        
      CALL BHS(IHX+8,0,60,0.,0.6)                                                                      
      CALL STEXT(IHX+8,4,'Theta')                                                                      
                                                                        
      CALL BHS(IHX+9,0,60,-0.3,0.3)                                                                    
      CALL STEXT(IHX+9,4,'Q/Momentum')                                                                 
      CALL STEXT(IHX+9,1,'GeV**-1')                                                                    
                                                                        
      CALL BHS(IHX+10,0,60,-1.0,2.0)                                                                   
      CALL STEXT(IHX+10,4,'LOG(Momentum)')                                                             
                                                                        
      CALL BHS(IHX+11,0,60,15.,75.)                                                                    
      CALL STEXT(IHX+11,4,'R start')                                                                   
      CALL STEXT(IHX+11,1,'cm')                                                                        
                                                                        
      CALL BHS(IHX+12,0,64,-3.2,3.2)                                                                   
      CALL STEXT(IHX+12,4,'PHI start')                                                                 
                                                                        
      CALL BHS(IHX+13,0,60,0.,2400.)                                                                   
      CALL STEXT(IHX+13,4,'Number of planar hits')                                                     
                                                                        
      CALL BHS(IHX+14,0,60,0.,2400.)                                                                   
      CALL STEXT(IHX+14,4,'Number of radial hits')                                                     
                                                                        
      CALL BHS(IHX+15,0,50,0.,1.)                                                                      
      CALL STEXT(IHX+15,4,'Fraction of planar hits used')                                              
                                                                        
      CALL BHS(IHX+16,0,50,0.,1.)                                                                      
      CALL STEXT(IHX+16,4,'Fraction of radial hits used')                                              
                                                                        
      CALL BHS(IHX+17,0,37,0.,37.)                                                                     
      CALL STEXT(IHX+17,4,'Planar hits per segment')                                                   
                                                                        
      CALL BHS(IHX+18,0,37,0.,37.)                                                                     
      CALL STEXT(IHX+18,4,'Radial hits per segment')                                                   
                                                                        
      CALL BHS(IHX+19,0,64,0.,64.)                                                                     
      CALL STEXT(IHX+19,4,'Supermodule mask')                                                          
                                                                        
C      CALL BHS(IHX+20,0,60,0.,240.)                                                                          
C      CALL STEXT(IHX+20,4,'Chi-squared between start/end parameters')                                        
                                                                        
      CALL BHS(IHX+20,0,64,0.,64.)                                                                     
      CALL STEXT(IHX+20,4,'Secondary/tertiary mask')                                                   
                                                                        
      CALL BHS(IHX+51,0,60,0.,12.)                                                                     
      CALL STEXT(IHX+51,4,'Chi-squared/DOF')                                                           
                                                                        
      CALL BHS(IHX+52,0,50,0.,1.)                                                                      
      CALL STEXT(IHX+52,4,'Chi-squared probability')                                                   
                                                                        
      CALL BHS(IHX+53,0,60,0.,0.6)                                                                     
      CALL STEXT(IHX+53,4,'Fractional error on 1/r')                                                   
                                                                        
      CALL BHS(IHX+54,0,60,0.,0.012)                                                                   
      CALL STEXT(IHX+54,4,'Error on theta')                                                            
                                                                        
      CALL BHS(IHX+55,0,60,0.,0.15)                                                                    
      CALL STEXT(IHX+55,4,'Error on xy')                                                               
      CALL STEXT(IHX+55,1,'cm')                                                                        
                                                                        
      CALL BHD(IHX+71,0,32,0.,32.,36,0.,36.)                                                           
      CALL STEXT(IHX+71,4,'Planar used hit map (.gt.1 planar segment)')                                
                                                                        
      CALL BHD(IHX+72,0,48,0.,48.,36,0.,36.)                                                           
      CALL STEXT(IHX+72,4,'Radial used hit map (.gt.1 planar segment)')                                
                                                                        
      CALL BHD(IHX+73,0,32,0.,32.,36,0.,36.)                                                           
      CALL STEXT(IHX+73,4,'Planar unused hit map')                                                     
                                                                        
      CALL BHD(IHX+74,0,48,0.,48.,36,0.,36.)                                                           
      CALL STEXT(IHX+74,4,'Radial unused hit map')                                                     
                                                                        
      CALL BHS(IHX+75,0,60,-RANGE,RANGE)                                                               
      CALL STEXT(IHX+75,4,'Drift residuals (planars) (>1 seg)')                                        
      CALL STEXT(IHX+75,1,'cm')                                                                        
                                                                        
      CALL BHS(IHX+76,0,60,-RANGE,RANGE)                                                               
      CALL STEXT(IHX+76,4,'Drift residuals (radials) (>1 seg)')                                        
      CALL STEXT(IHX+76,1,'cm')                                                                        
                                                                        
      CALL BHS(IHX+77,0,60,-3.0,3.0)                                                                   
      CALL STEXT(IHX+77,4,'Planar drift distance')                                                     
      CALL STEXT(IHX+77,1,'cm')                                                                        
                                                                        
      CALL BHS(IHX+78,0,60,-6.0,6.0)                                                                   
      CALL STEXT(IHX+78,4,'Radial drift distance')                                                     
      CALL STEXT(IHX+78,1,'cm')                                                                        
                                                                        
      CALL BHS(IHX+79,0,60,-0.15,0.15)                                                                 
      CALL STEXT(IHX+79,4,'Planar C1 checksum')                                                        
      CALL STEXT(IHX+79,1,'cm')                                                                        
                                                                        
      CALL BHS(IHX+80,0,60,-0.15,0.15)                                                                 
      CALL STEXT(IHX+80,4,'Planar C2 checksum')                                                        
      CALL STEXT(IHX+80,1,'cm')                                                                        
                                                                        
      CALL BHS(IHX+81,0,60,-0.15,0.15)                                                                 
      CALL STEXT(IHX+81,4,'Radial C1 checksum')                                                        
      CALL STEXT(IHX+81,1,'cm')                                                                        
                                                                        
      CALL BHS(IHX+82,0,60,-0.15,0.15)                                                                 
      CALL STEXT(IHX+82,4,'Radial C2 checksum')                                                        
      CALL STEXT(IHX+82,1,'cm')                                                                        
                                                                        
      CALL BHS(IHX+83,0,60,-RANGE,RANGE)                                                               
      CALL STEXT(IHX+83,4,'Drift residuals (planars) (<5 mm)')                                         
      CALL STEXT(IHX+83,1,'cm')                                                                        
                                                                        
      CALL BHS(IHX+84,0,60,-RANGE,RANGE)                                                               
      CALL STEXT(IHX+84,4,'Drift residuals (radials) (<5 mm)')                                         
      CALL STEXT(IHX+84,1,'cm')                                                                        
                                                                        
      CALL BHD(IHX+85,0,32,0.,32.,36,0.,36.)                                                           
      CALL STEXT(IHX+85,4,'Planar used hit map')                                                       
                                                                        
      CALL BHD(IHX+86,0,48,0.,48.,36,0.,36.)                                                           
      CALL STEXT(IHX+86,4,'Radial used hit map')                                                       
                                                                        
      CALL BHS(IHX+87,0,60,-0.15,0.15)                                                                 
      CALL STEXT(IHX+87,4,'Planar C2 checksum (crossing wire plane)')                                  
      CALL STEXT(IHX+87,1,'cm')                                                                        
                                                                        
      CALL BHS(IHX+88,0,60,-0.15,0.15)                                                                 
      CALL STEXT(IHX+88,4,'Radial C2 checksum (crossing wire plane)')                                  
      CALL STEXT(IHX+88,1,'cm')                                                                        
                                                                        
      CALL BHS(IHX+89,0,60,-0.15,0.15)                                                                 
      CALL STEXT(IHX+89,4,'Planar C2 checksum (crossing cathode)')                                     
      CALL STEXT(IHX+89,1,'cm')                                                                        
                                                                        
      CALL BHS(IHX+90,0,60,-0.15,0.15)                                                                 
      CALL STEXT(IHX+90,4,'Radial C2 checksum (crossing cathode)')                                     
      CALL STEXT(IHX+90,1,'cm')                                                                        
                                                                        
      CALL BHD(IHX+68,0,60,-RANGE,RANGE,50,0.,2500.)                                                   
      CALL STEXT(IHX+68,4,'Drift residuals (planars) vs Q')                                            
                                                                        
      CALL BHD(IHX+69,0,60,-RANGE,RANGE,50,0.,2500.)                                                   
      CALL STEXT(IHX+69,4,'Drift residuals (radials) vs Q')                                            
                                                                        
      CALL BHS(IHX+70,0,60,-12.0,12.0,50,0.,2500.)                                                     
      CALL STEXT(IHX+70,4,'Radius residuals (radials) vs Q')                                           
                                                                        
      IF (IDB.LE.1) RETURN                                              
                                                                        
*                                                                                                             
* Next lot for debug only                                                                                     
*                                                                                                             
                                                                        
      CALL BHS(IHX+56,0,65,0.,130.)                                                                    
      CALL STEXT(IHX+56,4,'Track length in z')                                                         
                                                                        
      CALL BHS(IHX+57,0,60,0.,300.)                                                                    
      CALL STEXT(IHX+57,4,'Number of planar segments')                                                 
                                                                        
      CALL BHS(IHX+58,0,60,0.,300.)                                                                    
      CALL STEXT(IHX+58,4,'Number of radial segments')                                                 
                                                                        
      CALL BHD(IHX+59,0,40,-80.,80.,40,-80.,80.)                                                       
      CALL STEXT(IHX+59,4,'x-y position of starting point')                                            
                                                                        
      CALL BHD(IHX+60,0,40,-80.,80.,40,-80.,80.)                                                       
      CALL STEXT(IHX+60,4,'x-y position of end point')                                                 
                                                                        
      CALL BHS(IHX+61,0,60,15.,75.)                                                                    
      CALL STEXT(IHX+61,4,'R end')                                                                     
                                                                        
      CALL BHS(IHX+62,0,64,-3.2,3.2)                                                                   
      CALL STEXT(IHX+62,4,'phi end')                                                                   
                                                                        
      CALL BHD(IHX+63,0,37,0.,37.,37,0.,37.)                                                           
      CALL STEXT(IHX+63,4,'Radial hits/track vs planar hits/track')                                    
                                                                        
      CALL BHD(IHX+64,0,50,0.,1.0,73,0.,73.)                                                           
      CALL STEXT(IHX+64,4,'Hits/track vs theta')                                                       
                                                                        
      CALL BHD(IHX+65,0,60,-RANGE,RANGE,64,0.,64.)                                                     
      CALL STEXT(IHX+65,4,'Drift residuals (planars) vs IMAP')                                         
                                                                        
      CALL BHD(IHX+66,0,60,-RANGE,RANGE,64,0.,64.)                                                     
      CALL STEXT(IHX+66,4,'Drift residuals (radials) vs IMAP')                                         
                                                                        
      CALL BHS(IHX+67,0,60,-12.0,12.0,64,0.,64.)                                                       
      CALL STEXT(IHX+67,4,'Radius residuals (radials) vs IMAP')                                        
                                                                        
                                                                        
      RETURN                                                            
      END                                                               
*