*file member=acf_cdfdif  library=snoman language=fortran77 date=01:Nov:2001
 <<<      function acf_cdfdif(pdfa,pdfb,nbins)
     
    *     ACF: Determine greatest difference between cumulative
    *          distribution functions of two pdfs, retaining the sign
    *          of the difference.
     
    *     Contact:  W. Heintzelman, Penn
    *     Verified: 
    *     Refereed: 
     
    *     Parameters:-
    *     ==========
    *     pdfa()        in   one of the pdfs
    *     pdfb()        in   the other pdf
    *     nbins         in   The array dimension of each
    *     acf_cdfdif    out  Greatest difference in the cdfs
     
    *     Common Block Access:-
    *     ===================
    *     none
     
    *     Specification:-
    *     =============
    *     Calculate the cumulative sums of the two pdfs, up to each bin.
    *     Over all the bins, save the value of the largest difference
    *     found between the cumulative sums.
     
    *     Revision History:-
    *     ================
    *     4.02   W. Heintzelman   First version
    *            W. Heintzelman   Second version
     
          IMPLICIT NONE
     
    *     Argument Declarations:-
    *     =====================
            integer nbins
            real acf_cdfdif,pdfa(nbins),pdfb(nbins)
     
    *ENDHEADER
     
    *     Local Variable Declarations:-
    *     ===========================
            real suma,sumb
            integer i
     
            acf_cdfdif = 0.
            suma = 0.
            sumb = 0.
            do i=1,nbins
                suma = suma + pdfa(i)
                sumb = sumb + pdfb(i)
                if(abs(suma-sumb) .gt. abs(acf_cdfdif)) then
                    acf_cdfdif = suma-sumb
                endif
            enddo
            return
            end
    *endfile member=acf_cdfdif