~maddevelopers/mg5amcnlo/WWW5_caching

« back to all changes in this revision

Viewing changes to users/mardelcourt/PROC_141512/PROC_141512/Source/hfill.f

  • Committer: John Doe
  • Date: 2013-03-25 20:27:02 UTC
  • Revision ID: john.doe@gmail.com-20130325202702-5sk3t1r8h33ca4p4
first clean version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
C----------------------------------------------
 
2
C
 
3
C               Routine to add zincrement to a bin in a histogram
 
4
C
 
5
        subroutine hfill(id,x,y,zincrement)
 
6
C
 
7
C               id = integer associated with the histogram
 
8
C               x  = x value to locate bin (real)
 
9
C               y  = y value to locate bin (real) [ignored for 1-dim histo]
 
10
C               zincrement = value to be added to bin specified by (x,y)
 
11
C
 
12
        include 'hbook.inc'
 
13
        data nhist/0/,pointer(1)/1/
 
14
 
 
15
        do i=1,nhist
 
16
                if (id number(i) .eq. id) go to 10
 
17
                end do
 
18
        print*,' id number ',id,' does not belong to a current histogram'
 
19
        return
 
20
10      continue
 
21
        k = pointer(i)
 
22
        nx=data(k)+.1
 
23
        ixoff = (x-data(k+1))/(data(k+2)-data(k+1))*data(k)+1
 
24
        if (ixoff .le. 0 .or. ixoff .gt. nx) return
 
25
        if (single dim(i)) then
 
26
                data(k+2+ixoff)=data(k+2+ixoff)+zincrement
 
27
                error(k+2+ixoff)=error(k+2+ixoff)+zincrement**2
 
28
                npoints(k+2+ixoff)=npoints(k+2+ixoff)+1.
 
29
        else
 
30
                ny=data(k+3)+.1
 
31
                iyoff = (y-data(k+4))/(data(k+5)-data(k+4))*data(k+3)+1
 
32
                if (iyoff .le. 0 .or. iyoff .gt. ny) return
 
33
                ioff = nx*(iyoff-1)+ixoff
 
34
                data(k+5+ioff)=data(k+5+ioff)+zincrement
 
35
                end if
 
36
        return
 
37
        end