FFHTHS COMMENTS
*-- Author :    Stephen Burke   13/03/95
      SUBROUTINE FFHTHS(J1,J2,NPS,IMAP)
**********************************************************************                                        
*                                                                    *                                        
* Fill per-hit monitoring histograms                                 *                                        
*                                                                    *                                        
* J1 and J2 are the indices of the first and last planes with hits   *                                        
* NPS is the number of planar segments                               *                                        
* IMAP is the supermodule map                                        *                                        
*                                                                    *                                        
**********************************************************************                                        
* sin and cos of the wedge angle                                                                              
*KEEP,FKNPL.                                                                                                  
*                                                                                                             
* 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.                                                                        
*                                                                                                             
* /FKPROJ/                                                                                                    
* /FKFILT/                                                                                                    
* /FKSMTH/                                                                                                    
* /FKINT/                                                                                                     
* /FKRSID/                                                                                                    
* /FKTRUE/                                                                                                    
* /FKDBG/                                                                                                     
*KEEP,FKFLAG.                                                                                                 
*KEEP,FFSTEE.                                                                                                 
*KEEP,FKRSID.                                                                                                 
*KEEP,FKMEAS.                                                                                                 
*KEEP,FKSMTH.                                                                                                 
*KEEP,FFGEO.                                                                                                  
*KEEP,FTHIST.                                                                                                 
* indices of filter farm histos                                                                               
*KEND.                                                                                                        
*KEEP,BCS.                                                                                                    
*KEEP,BOSMDL.                                                                                                 
C     ------BOSMDL                                                                                            
C     ------                                                                                                  
*KEEP,STFUNCT.                                                                                                
*     index of element before row number IROW                                                                 
*     index of L'th element  of row number IROW                                                               
*     L'th integer element of the IROW'th row of bank with index IND                                          
*     L'th real element of the IROW'th row of bank with index IND                                             
*KEND.                                                                                                        
**********************************************************************                                        
* Drift residuals                                                                                             
               CALL SHS(3+II,0,SNGL(RSMT(1,JPL)))                                                      
               IF (NPS.GT.1) CALL SHS(74+II,0,SNGL(RSMT(1,JPL)))                                       
* Radius residuals for all hits, not just "good" ones                                                         
C               IF (MES(JPL).EQ.2) CALL SHS(6,0,SNGL(RSMT(2,JPL)))                                            
                  CALL SHS(6,0,RRES)                                                                   
* Residuals vs. Q                                                                                             
                  CALL SHD(68,0,SNGL(RSMT(1,JPL)),Q)                                                   
                  CALL SHD(69,0,SNGL(RSMT(1,JPL)),Q)                                                   
C                  IF (MES(JPL).EQ.2) CALL SHD(70,0,SNGL(RSMT(2,JPL)),Q)                                      
                  CALL SHD(70,0,RRES,Q)                                                                
* Unpack drift sign and hit number                                                                            
               CALL SBIT1(MASK,IWR)                                                                    
               CALL SBIT1(MASK,IWR)                                                                    
               CALL SBIT1(MASK,IWR)                                                                    
               CALL SBIT1(MASK2,IWR)                                                                   
               CALL SBIT1(MASK2,IWR)                                                                   
               CALL SBIT1(MASK2,IWR)                                                                   
* Corrected drift distance                                                                                    
                  CALL SHS(77,0,DD(IWR)*(-1)**ISGN)                                                    
                  CALL SHS(78,0,DD(IWR)*(-1)**ISGN)                                                    
               IF (DUNC.LT.0.5) CALL SHS(82+II,0,SNGL(RSMT(1,JPL)))                                    
* Absolute drift coordinate                                                                                   
* Checksums (4 wire groups)                                                                                   
                  CALL SHS(77+2*II,0,C1)                                                               
                  IF (ABS(C1).LT.0.1) CALL SHS(78+2*II,0,C2)                                           
                  IF (MASK2.EQ.15) CALL SHS(86+II,0,C2W)                                               
                  CALL SHS(88+II,0,C2W)                                                                
* The rest are debug only                                                                                     
* Residuals vs. supermodule map                                                                               
               CALL SHD(64+II,0,SNGL(RSMT(1,JPL)),FLOAT(IMAP))                                         
     &            CALL SHD(67,0,SNGL(RSMT(2,JPL)),FLOAT(IMAP))                                         
*