subroutine stdchgdsclst ( j, n, maxn, list ) c c The previous version of this routine fails on events which have c been generated by herwig. This version works correctly on c events generated by any of pythia, isajet, herwig. c c Make a list of all stable, charged descendants of j. c If the particle j is stable, then the list has a length of 0. c c j - input - particle to start at c n - output - number of stable descendants c maxn - input - maximum size of list c list - output - list of stdhep indices of the stable descendants. c #include "stdhep.inc" #include "stdlun.inc" c ! Arguments. integer j integer n integer maxn integer list(maxn) c ! Indexology. integer i, m c ! Functions. real stdchg c ! Handle trivial cases. n = 0 if ( j .lt. 1 .or. j .gt. nhep ) return c ! Get list of all daughters. call stdstdsclst ( j, n, maxn, list ) c ! Compress the list to remove neutral particles. m = 0 do i = 1, min(n,maxn) if ( stdchg(idhep(list(i))) .ne. 0. ) then m = m + 1 if ( m .le. maxn ) list(m) = list(i) endif enddo n = m if ( n .gt. maxn ) write(lnhout,1001) n, maxn return 1001 format(' STDCHGDSCLST: found ',I4, 1 ' descendants, but the list only allows ',I4) end