program TEST_RWN c Glen Cowan c 16 October, 1999 c Test program for using row wise ntuples. c Generates momentum vectors for 3 particles distributed uniformly c in phase space; uses the subroutine RAMBO by R. Kleiss, W.J. Stirling c and S.D. Ellis, Comp. Phys. Commun. 40 (1986) 359. implicit NONE c Constants integer num_particles parameter (num_particles = 3) integer ncol parameter (ncol = num_particles*3) real m_pi parameter (m_pi = 0.139) ! GeV double precision E_cm parameter (E_cm = 1.0) ! GeV double precision mass (num_particles) / num_particles*m_pi / c Needed for HBOOK routines integer hsize parameter (hsize = 500000) integer hmemor (hsize) common /pawc/ hmemor c Local variables character*80 outfile character*3 tags(ncol) / 'px1', 'py1', 'pz1', & 'px2', 'py2', 'pz2', 'px3', 'py3', 'pz3' / integer i integer icycle integer j integer k integer istat integer lw integer num_events real event(ncol) double precision p (4, num_particles) double precision wt c Initialize HBOOK, open file, book ntuple. call HLIMIT (hsize) outfile = 'test_rwn.hbook' call HROPEN (20, 'ntuple', outfile, 'N', 1024, istat) call HBOOKN (1, 'rwn: p1, p2, p3', ncol, 'ntuple', 1000, tags) c Assign pion mass to all final state particles do i = 1, num_particles mass(i) = m_pi end do lw = 1 ! requests unweighted events c Get x values and enter into histogram. write (*, *) 'enter number of events to generate' read (*, *) num_events do i = 1, num_events c Generate momentum vectors uniformly distributed in phase space. call RAMBO (num_particles, E_cm, mass, p, wt, lw ) c Pack three-momenta into the variable event and fill ntuple. do j = 1, num_particles do k = 1, 3 event((j-1)*3 + k) = p(k,j) end do end do call HFN (1, event) end do c Store histogram and close. call HROUT (0, icycle, ' ') call HREND ('ntuple') stop END