SUBROUTINE FVTEXT
*-- Author :    Stephen Burke   07/05/92
      SUBROUTINE FVTEXT
*-----------------------------------------Updates 21/09/93-------                                             
**: FVTEXT.......SB. Turn off momentum cuts for zero field.                                                   
*-----------------------------------------Updates 30/10/92-------                                             
**: FVTEXT.......SB. Separate cuts on # of planar/radial hits.                                                
**: FVTEXT.......SB. FVRP steering bank format changed.                                                       
*-----------------------------------------Updates 06/05/92-------                                             
**: FVTEXT.......SB. New steering banks FVRS and FVRP from db:                                                
*!: FVRP  .......SB. New steering bank for forward z-vertex fit.                                              
*!: FVRS  .......SB. New steering bank for forward z-vertex fit.                                              
**: FVTEXT.......SB. New deck to read z-vertex fit steering banks.                                            
*-----------------------------------------Updates----------------                                             
**********************************************************************                                        
*                                                                    *                                        
* Read parameters from steering banks                                *                                        
*                                                                    *                                        
**********************************************************************                                        
                                                                        
      DIMENSION R(3),B(3)                                               
                                                                        
*KEEP,FVSTEE.                                                                                                 
      LOGICAL LTRUTH,LCUT,LRESID                                        
      COMMON /FVSTEE/ IDIAG,LUN,LUNHB,LTRUTH,LCUT,LRESID                
*KEEP,FVPAR.                                                                                                  
      DOUBLE PRECISION ZWALL1,ZWALL2,RADLEN                             
      COMMON /FVPAR/ ZWALL1,ZWALL2,RADLEN,MINHTP,MINHTR,ZSQMAX          
     &,              PMIN,DCAMAX,Z0MAX,CHIMAX                           
*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/                                                      
*KEND.                                                                                                        
                                                                        
**********************************************************************                                        
                                                                        
* Get the steering bank                                                                                       
      CALL UGTBNK('FVRS',INDS)
      IF (INDS.GT.0) THEN                                               
         IVERS = IW(INDS+1)                                             
         IF (IVERS.NE.6592) THEN                                        
            INDS = 0                                                    
            CALL ERRLOG(551,'F:FVTEXT: Wrong version of bank FVRS;'//                                  
     &                     ' defaults used')                            
         ENDIF                                                          
      ELSE                                                              
         CALL ERRLOG(552,'W:FVTEXT: Bank FVRS not found;'//                                            
     &                  ' defaults used')                               
      ENDIF                                                             
      IF (INDS.LE.0) THEN                                               
         LUN   = 6                                                      
         IDIAG = 0                                                      
         LUNHB = 0                                                      
      ELSE                                                              
         LUN   = IW(INDS+2)                                             
         IDIAG = IW(INDS+3)                                             
         LUNHB = IW(INDS+4)                                             
      ENDIF                                                             
                                                                        
* Decode the histogram steering                                                                               
      LTRUTH = MOD(IDIAG,10).NE.0                                       
      IF (MOD(IDIAG/100,10).GT.0 .AND. LTRUTH) THEN                     
         LRESID = .TRUE.                                                
      ELSE                                                              
         LRESID = .FALSE.                                               
      ENDIF                                                             
      IF (MOD(IDIAG/10,10).GT.0) THEN                                   
         LCUT = .TRUE.                                                  
      ELSE                                                              
         LCUT = .FALSE.                                                 
      ENDIF                                                             
                                                                        
* Get the parameter bank                                                                                      
      CALL UGTBNK('FVRP',INDP)
      IF (INDP.GT.0) THEN                                               
         IVERS = IW(INDP+1)                                             
         IF (IVERS.NE.301092) THEN                                      
            INDP = 0                                                    
            CALL ERRLOG(553,'F:FVTEXT: Wrong version of bank FVRP;'//                                  
     &                     ' defaults used')                            
         ENDIF                                                          
      ELSE                                                              
         CALL ERRLOG(554,'W:FVTEXT: Bank FVRP not found;'//                                            
     &                  ' defaults used')                               
      ENDIF                                                             
      IF (INDP.LE.0) THEN                                               
         ZWALL1 = 108.0                                                 
         ZWALL2 = 123.6                                                 
         RADLEN = 43.9                                                  
         MINHTP = 9                                                     
         MINHTR = 6                                                     
         ZSQMAX = 100.*100.                                             
         PMIN   = 1.0                                                   
         DCAMAX = 10.                                                   
         Z0MAX  = 50.                                                   
         CHIMAX = 10.                                                   
      ELSE                                                              
         ZWALL1 = RW(INDP+2)                                            
         ZWALL2 = RW(INDP+3)                                            
         RADLEN = RW(INDP+4)                                            
         MINHTP = IW(INDP+5)                                            
         MINHTR = IW(INDP+6)                                            
         ZSQMAX = RW(INDP+7)                                            
         PMIN   = RW(INDP+8)                                            
         DCAMAX = RW(INDP+9)                                            
         Z0MAX  = RW(INDP+10)                                           
         CHIMAX = RW(INDP+11)                                           
      ENDIF                                                             
                                                                        
* Don't cut on momentum if field is too small                                                                 
      CALL VZERO(R,3)                                                                                  
      CALL GUFLD(R,B)                                                                                  
      IF (ABS(B(3)).LT.1.0) PMIN = -1.0                                 
                                                                        
* Check print flag                                                                                            
      IF (IW(6).LE.0) RETURN                                            
                                                                        
      WRITE(LUN,*)                                                      
      WRITE(LUN,*)                                                      
      WRITE(LUN,*) '            *** FVFIT steering parameters ***'      
      WRITE(LUN,*)                                                      
      WRITE(LUN,*)                                                      
                                                                        
      WRITE(LUN,1001) MINHTP                                            
      WRITE(LUN,1002) MINHTR                                            
      WRITE(LUN,1003) ZSQMAX                                            
      WRITE(LUN,1004) PMIN                                              
      WRITE(LUN,1005) DCAMAX                                            
      WRITE(LUN,1006) Z0MAX                                             
      WRITE(LUN,1007) CHIMAX                                            
                                                                        
 1001 FORMAT(' Minimum number of planar hits:',I4)                      
 1002 FORMAT(' Minimum number of radial hits:',I4)                      
 1003 FORMAT(' Maximum initial z0 squared: ',F8.1)                      
 1004 FORMAT(' Minimum momentum:               ',F5.2)                  
 1005 FORMAT(' Maximum dca:                  ',F6.1)                    
 1006 FORMAT(' Maximum z0:                   ',F6.1)                    
 1007 FORMAT(' Maximum chi-squared:          ',F6.1//)                  
                                                                        
      RETURN                                                            
      END                                                               
*