sofrid said:
I'd like to do a Monte Carlo-simulation of the Compton electron energy distribution. The scattered photon angle is easy to simulate by random numbers, which easily gives the scattered photon energy by the classic hv' = hv/(1 + hv*(1-cos(theta))/511) [keV]. But what about the Compton electrons? I do not want to use tables. I'm stuck with the problem... Can someone enlighten me in how to proceed...?
You need to have an analytical formula for the distribution of any variable describing the process. e\gamma\rightarrow e\gamma is described by only one independent variable (of course, you know the initial state, and you don't have final state's polarisations, right ?). It could be energy, it could be angle, for either particle. Once you have chosen one variable, you can calculate all others.
Now assume you have an analytical formula for the distribution of variable X
in the range of your interest. Say you are interested in electron angles from 15 to 30 degrees for instance (it does not matter for the principle). I will assume your formula is normalized so that the maximum of the distribution is 1 in this range (I did not say integral, I said maximum). One way to proceed is the following : pick up a uniformly distributed value for your variable in the range. Compute the value of the distribution at this point. Pick up a random number between 0 and 1 (or the maximum of your distribution in the range). If the random number is lower that the value of the distribution, keep this event, proceed to compute all other kinematical variables, and save entry. Otherwise, if the random number is more than the value of the distribution, discard this event.
It is not quite what people call "fast Monte-Carlo" but probably close enough for your purposes. Additional hint : when calculating other variables, just go to the center of mass, where both particles carry the same (opposite) momentum, and apply energy conservation. That allows you to compute the momentum carried in the center of mass, and boosting back to the lab, you can easily contruct everything.
What people would call "fast Monte-Carlo" would amount to almost the same procedure, except that you would directly generate your independent variable according to its distribution instead of this "compare/discard or keep" method. Having just one independent variable, it should be quite good enough in practice.