FPSOUT COMMENTS
*-- Author :    Stephen J. Maxfield   17/02/92
      SUBROUTINE FPSOUT
**: FPSOUT 30907 RP. Farm changes.                                                                            
**----------------------------------------------------------------------                                      
**: FPSOUT 30907 SM. Fix histogram handling.                                                                  
*------------------------------------------------------------------*                                          
*  OUTPUT RESULTS OF PLANAR PATTERN RECOGNITION                    *                                          
*                                                                  *                                          
*------------------------------------------------------------------*                                          
*                                                                  *                                          
*  OUTPUT:     FPSG,0     Planar segments                          *                                          
*  =====                                                           *                                          
*------------------------------------------------------------------*                                          
*      FORMAT OF BANKS FROM FORWARD TRACK RECONSTRUCTION           *                                          
*                                                                  *                                          
*      FPSG    TABLE  FMT =        (7F,15I)                        *                                          
*      ====                                                        *                                          
*                                                                  *                                          
*  1  X         F        x    )                                    *                                          
*  2  Y         F        y    )  at beginning of sm                *                                          
*  3  Z         F        z    )                                    *                                          
*  4  X         F        x    )                                    *                                          
*  5  Y         F        y    )  at end       of sm                *                                          
*  6  Z         F        z    )                                    *                                          
*                                                                  *                                          
*  7  PRCHI     F        Chisq prob of segment                     *                                          
*  8  ISM       I        Supermodule number                        *                                          
*  9  MASKSG    I        MASK                                      *                                          
*  10 INEXT     I        Pointer to next segment on track          *                                          
*  11 IDIG      I             ) Row numbers in FPRE bank(0if none) *                                          
*  ...                        ) SIGNED!                            *                                          
*  22                         )                                    *                                          
*                                                                  *                                          
********************************************************************                                          
*KEEP,FPPRAM.                                                                                                 
C                                                                                                             
C---  MAXSEG is maximum number of segments per supermodule                                                    
C---  MAXCON is maximum number of amibiguous segments associatable with                                       
C---         one segment                                                                                      
C---  LIMSTO is maximum number of 2 cluster planes intersections to be                                        
C---         stored per supermodule                                                                           
C---  MSEGLM is maximum number of clusters that can be found before                                           
C---         connectivity considered                                                                          
C---  MAXCLU is maximum number of clusters that can be found after                                            
C---         forming non-connected set    MUST BE 50 IF RUN WITH OLD RCW                                      
C---         (cluster = 3/4 digits found in a straight line in one                                            
C---          4-wire orientation)                                                                             
C                                                                                                             
C---                                                                                                          
*KEEP,FPLSEG.                                                                                                 
C---                                                                                                          
C---                                                                                                          
*KEEP,FPSTSG.                                                                                                 
C---                                                                                                          
*KEEP,BCS.                                                                                                    
*KEEP,BOSMDL.                                                                                                 
C     ------BOSMDL                                                                                            
C     ------                                                                                                  
*KEEP,H1EVDT.                                                                                                 
*                                                                                                             
*  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,FPH1WRK.                                                                                                
C--    *KEEP,FPCSEG.                                                                                          
C---                                                                                                          
C---                                                                                                          
C--    *KEEP,FPDIGI.                                                                                          
C---                                                                                                          
C--    *KEEP,FPDGI.                                                                                           
C---                                                                                                          
C--    *KEEP,FPSTID.                                                                                          
C---                                                                                                          
C--    *interface to real data                                                                                
C---.                                                                                                         
*KEEP,FRH3FT.                                                                                                 
*     Common for RETRAC results (SJM)                                                                         
*KEEP,FDIFLG.                                                                                                 
*KEND.                                                                                                        
*  Bank formatting data...                                                                                    
*  Local arrays...                                                                                            
*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.                                                                                                        
*------------------------BEGIN ROUTINE-------------------------------                                         
*       Format output banks...                                                                                
        CALL BKFMT('FPSG','2I,(7F,15I)')
* Make bank                                                                                                   
      IFPSG = NBANK('FPSG',NBNN,2+NCFPSG*NFPSG)
*  Loop over supermodules...                                                                                  
*       z at beginning and end of this segment                                                                
*       extrapolate x,y to ZMM. Converting from mm to cm!                                                     
C---               NFSSEG(3) --- Number of secondary Segments formed.                                         
C---               NFTSEG(3) --- Number of Tertiary segments formed.                                          
*       Write(6,'(5F10.3, 2I10)') (BAR(JJ), JJ=1,5), IAR(6), IAR(7)                                           
*        Get FRPE row numbers of hits in this segment...                                                      
*       Write(6,'(3I10)') IOSP, ISP, IAR(10+IWIR)                                                             
           CALL SHS(320,     0, FLOAT(IHITS))                                                          
           CALL SHS(320+ISM, 0, FLOAT(IHITS))                                                          
         CALL UCOPY(BAR,IW(INDCR(IFPSG,1,NUMSEG)),NCFPSG)                                              
C        IFPSG  = IADROW('FPSG',NBNN,NCFPSG,BAR)                                                              
*   Close banks...                                                                                            
C      IF(NUMSEG.GT. 0) THEN                                                                                  
C        IFPSG  = IADFIN('FPSG',NBNN)                                                                         
C      ELSE                                                                                                   
*       make empty banks                                                                                      
C        IFPSG = NBANK('FPSG',NBNN,2)                                                                         
C        IW(IFPSG+1) = NCFPSG                                                                                 
C        IW(IFPSG+2) = 0                                                                                      
C      ENDIF                                                                                                  
      CALL BLIST(IW,'R+','FPSG')                                                                       
*