next up previous contents index
Next: Ntuple examples Up: Ntuple operations Previous: Rename a column

One-dimensional convolution of Ntuple

  

CALL HCONVOL (ID1,ID2,ID3,IERROR*)

Action: Perform a one-dimensional convolution of the Ntuple with respect to an othergif. All histograms must pre-exist prior to calling this routine.

Idesc

ID1
Ntuple identifier (this Ntuple can be 1-D or 2-D). It is used as kernel for the convolution of ID2.
ID2
Ntuple to be convoluted
ID3
Ntuple resulting from the convolution of ID2 with ID1

Output parameter description:

IERROR
error return code.

Discussion

This method scales badly for large histograms. The best general algorithm would be to unpack the histograms, add a suitable number of zeros, do the two FFTs, multiply the transforms, do yet another FFT and stuff the resulting histogram back into HBOOK. However, for small histograms, the naive method is probably faster, especially if recoded in terms of lower level calls. It will also work with 1-D and 2-D kernel-histograms that do not have matched coordinate systems - the FFT method implies equal binsize in X and Y for the kernel and the histogram to be folded. This simple method uses HBOOK to avoid this in one (X) dimension at least, corresponding to folding in a constant resolution term.

Example of use

      CALL HBOOK1(1,'Kernel 1 - 1D',100,-5.0,5.0,0.0)
      CALL HBOOK2(2,'Kernel 2 - 2D',100,-5.0,5.0,100,0.0,100.0,0.0)
      CALL HBPRO(2,0.0)
      CALL HBOOK2(3,'Kernel 3 - 2D',100,-5.0,5.0,100,0.0,100.0,0.0)
      CALL HBPRO(3,0.0)
      CALL HBOOK1(4,'Function',100,0.0,100.0,0.0)
      CALL HBOOK1(5,'Result 1',100,-10.0,110.0,0.0)
      CALL HBOOK1(6,'Result 2',100,-10.0,110.0,0.0)
      CALL HBOOK1(7,'Result 3',100,-10.0,110.0,0.0)

      DO 10 I=1,100000
        CALL RANNOR(A,B)
        CALL HFILL(1,A,0.0,1.0)
        CALL HFILL(1,B,0.0,1.0)
        CALL RANNOR(A,B)
        CALL HFILL(2,A,100.0*RNDM(I),1.0)
        CALL HFILL(2,B,100.0*RNDM(I),1.0)
        CALL RANNOR(A,B)
        CALL HFILL(3,A,100.0*SQRT(RNDM(I+1)),1.0)
        CALL HFILL(3,B,100.0*SQRT(RNDM(I+1)),1.0)
        X = 30.0*(RNDM(I)-0.5)+50.0
        CALL HFILL(4,X,0.0,1.0)
   10 CONTINUE

      CALL HCONVOL(1,4,5,IERROR)
      CALL HCONVOL(2,4,6,IERROR)
      CALL HCONVOL(3,4,7,IERROR)


Last update: Tue May 16 09:09:27 METDST 1995