#include "gamtebType.t"
#include "floatop.t"
#include "consts.t"
#include "utils.t"
#include "transPort.t"
#include "output.t"

let
rec	-- create a particle and transport it
	-- sources :: Random -> Int -> Energy -> ([Result], [Stat])

    sources seed npart e trace & (npart <= 1) =
	let (eIndx, prob) = xsectInterp e in
	let (seed', _) = genRand seed in
	let p = (Part (Pt float0 float0 float0) (Pt float0 float1 float0)
	      float1 e eIndx 1 seed') in
	transPort p prob trace
||  sources seed npart e trace =
	let npart1 = npart/2 in
	let npart2 = npart - npart1 in
	let (r1, r2) = genRand seed in
	let (res1, s1, trace) = sources r1 npart1 e trace in
	let (res2, s2, trace) = sources r2 npart2 e trace in
	(res1 @ res2, s1 @ s2, trace)


in	-- scalar monte carlo code to transport .001 to 20.0 mev
	-- gamma rays in a carbon cylinder of length cl, radius crad
	-- gamteb :: [Char] 

	let scale = 10 in
	let seed = pt5 in
	let npart = 32*scale in  
	let energy = float 6 in 
	let (result, stats, trace) = sources seed npart energy [] in
	outGamteb npart stats result trace
