TGenPhaseSpace, maximum weight issue

Dear all,
I found a problem while using TGenPhaseSpace to generate events according to the following reaction:

e- proton —> e- proton pi0

I create a TGenPhaseSpace object, use the method “SetDecay” to configure it, and finally save the maximum weight using the method TGenPhaseSpace::GetWtMax().

After this, I implement a loop, and in each iteration I call the method TGenPhaseSpace::Generate() in order to randomly extract a final state. However, the return value of the method - that is the weight of the event, is greater than the maximum weight previously stored.

A complete script showing this error is attached. Note that, If I change the line E=11 to E=6, the problem is no longer present.

I am currently using ROOT 6.08/00, compiled from source.


test.C (1.26 KB)

Hi Andrea,

I will ask our expert once he’s back from vacation, but in the meanwhile, searching for ‘TGenPhaseSpace’ in this forum might give some help (even if some are still unanswered…)
See for example this post (just trying to guess…)
But note that I don’t know what TGenPhaseSpace::GetWtMax() is supposed to return (i.e. what ‘max weight’ is)
And beside the fact that the returned weight is higher that the max weight, does your distribution look correct?

Cheers, Bertrand.

Dear Bertrand,
TGenPhaseSpace method “Generate()” produces a new PS-event, and returns the corresponding weight. In order to generate events really distributed according to a PS distribution, all with the same weight, one should apply an “hit-or-miss” (rejection) technique, and to do so one must know the maximum weight of all of them (or a number bigger than this).

The GetWtMax() method is supposed to return the weight of the highest event that could be generated from the TGenPhaseSpace (given the final state set with the SetDecay() method). If the number it returns is, as I see, lower than this, the “hit-or-miss” method is returning wrong results.

The distribuition I get after the “hit or miss” procedure is wrong. Please see the attached comparison (for a given kinematic variable) between the result I get with the “hit-or-miss” procedure (black) and the result obtained filling the histogram, for each event, with the corresponding weight (red) - without applying any rejection.

Two histograms have been scaled to have same normalization.

Clearly, the solution to this problem is to generate all the events before, store them together with their weights, and compute the maximum weight. The knowledge, a priori- of the maximum event weight is however much convenient and usefull!

Cheers, Andrea


This seems to me a bug in the TGenPhaseSpace class. Which option are you using in SetDecay ?
I would need also you running code to reproduce the problem and eventually file a bug report in JIRA to not forget this


Hi Lorenzo,
the code I am using to produce the error is attached to my first message.
The code I am using reproduces this weight error, for few events you will see that the event weight is greater than the maximum weight reported by TGenPhaseSpace::GetWtMax()


Hi Lorenzo, sorry, I forgot to open the JIRA item. I tried today, but the system says that I do not have permissions to open a new JIRA issue. I am using my cern account (acelenta) to login to the JIRA system.