CALL HCONVOL (ID1,ID2,ID3,IERROR*)
Action: Perform a one-dimensional convolution of the Ntuple with respect to an other. All histograms must pre-exist prior to calling this routine.
Idesc
ID2
.
ID2
with ID1
Output parameter description:
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)