Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyfill.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pyfill.f
1 
2 C*********************************************************************
3 
4 C...PYFILL
5 C...Fills entry in histogram.
6 
7  SUBROUTINE pyfill(ID,X,W)
8 
9 C...Double precision declaration.
10  IMPLICIT DOUBLE PRECISION(a-h, o-z)
11  IMPLICIT INTEGER(i-n)
12 C...Commonblock.
13  common/pybins/ihist(4),indx(1000),bin(20000)
14  SAVE /pybins/
15 
16 C...Find initial address in memory. Increase number of entries.
17  IF(id.LE.0.OR.id.GT.ihist(1)) CALL pyerrm(28,
18  &'(PYFILL:) not allowed histogram number')
19  is=indx(id)
20  IF(is.EQ.0) CALL pyerrm(28,
21  &'(PYFILL:) filling unbooked histogram')
22  bin(is+5)=bin(is+5)+1d0
23 
24 C...Find bin in x, including under/overflow, and fill.
25  IF(x.LT.bin(is+2)) THEN
26  bin(is+6)=bin(is+6)+w
27  ELSEIF(x.GE.bin(is+3)) THEN
28  bin(is+8)=bin(is+8)+w
29  ELSE
30  bin(is+7)=bin(is+7)+w
31  ix=(x-bin(is+2))/bin(is+4)
32  ix=max(0,min(nint(bin(is+1))-1,ix))
33  bin(is+9+ix)=bin(is+9+ix)+w
34  ENDIF
35 
36  RETURN
37  END