I have attached a simple program that produces events for a typical beta decay. I extract the weight of every event and fill the beta spectrum (called E1) using this weight. Then I modify the weight by multiplying energy of the neutrino (particle No. 0) and beta (particle No. 1). Result is in spectrum called E2.
E1 doesn’t look healthy (look at the end point) but E2 is reasonably acceptable.
Is this the right way of using the weight of the event?
Do I need to modify the weight by these factors?
Why event generator doesn’t give the right weight?
Is there any thing wrong with the initialization of the generator?

Thank you for your kind help and attention.
Sohani test-event.cxx (1.34 KB)

I have been looked into your problem, and after careful checking I think the beta spectrum obtained with TGenPhaseSpace are correct, in the approximation that the decaying particle is a scalar (no angular or enery effect in the matrix element)
I have performed a full calculation of t he phase space and as you see in the attached macro, they reproduce exactly the obtained spectra from TGenPhaseSpace. I guess you have to include spin effects, which are not present in TGenPhaseSPace, to have the right beta spectrum
at the end point.
Best Regards,
Lorenzo testEvent2.C (2.97 KB)

For Beta spectrum, there is already a famous derivation that one can find in the text books (for phase space part). I have included it in your code (eDist2). As you see it dos not fit the data produced directly by the event generator, but it dose fit the data after modifying the weight.

I thing that your calculation is done classically while the other one is done in Lorentz invariant condition. I checked few text book and every where you can see the end point of the distribution comes done parallel to the x axis. For this, one dose not need to include any spin effect as we don’t.

Thank you for your kind help,
Sohani. testEvent3.C (3.39 KB)

my calculation is done assuming a matrix element independent of the energy, like is the case in TGenPhaseSpace. If you make the calculation using the full Fermi Weak interaction, after summing on all the spin states you will get a matrix element proportional to E_e*E_nu and you get the distribution that you see in all the text books for beta decay.
That explains the difference in the results between E1 and E2 spectra of your script.
The matrix element calculation is out of the scope of TGenPhaseSpace, you should use for that a dedicated MonteCarlo generator according to the chosen process.