! GeFillTree.f90 ! ! Fill one Tree with given pt, eta. Phi is generated ! isotropically. Space for the tree has to be allocated in ! advance. ! ! Detlef Irmscher, Thomas Ullrich, Uni Heidelberg, September 1993 ! Last update: 16.3.95 tu ! subroutine GeFillTree (treeindex, pt, y, weight) use genesis_m, self=>GeFillTree use f90_kind implicit none integer, intent(in) :: treeindex real(kind=double), intent(in) :: pt, y, weight type(tree), pointer :: new_tree real(kind=double) :: phi, p1, mt, pl integer :: indexp, i real :: rand ! set up tree new_tree => treeList(treeindex) ! check if pointer is set up if (.not.associated(new_tree%parttype)) then call GeErrorMessage ("GeFillTree", "particle pointer not set up") return endif ! check if particle type is in particle list indexp = GeParticleIndex (new_tree%parttype%name) if (indexp == -1) then call GeErrorMessage ("GeFillTree", "particle " // & new_tree%parttype%name // & " not found") return endif ! set the pointers to parent, child and decay to zero; ! set decay flag to false nullify (new_tree%decaytype) new_tree%parent = 0 do i = 1, 3 new_tree%child(i) = 0 enddo new_tree%decayed = .false. ! set up 4-momentum call random_number(rand) phi = TWOPI * rand mt = sqrt(new_tree%parttype%mass**2 + pt**2) pl = mt * (exp(y) - exp(-y))/2. p1 = sqrt(pl**2 + pt**2) new_tree%p4%E = sqrt(p1**2 + new_tree%parttype%mass**2) new_tree%p4%p%px = pt*cos(phi) new_tree%p4%p%py = pt*sin(phi) new_tree%p4%p%pz = pl ! set up weights new_tree%mass_weight = is_mass_weight*new_tree%parttype%relSigmaTotal new_tree%pt_weight = weight end subroutine GeFillTree