TGenPhaseSpace bug?

I will answer my own question:

My code was the following:

[quote]
Double_t w;
for(int i=0;i<500000;i++) {
w = S.Generate();
p1 = S.GetDecay(0);
p2 = S.GetDecay(1);
p3 = S.GetDecay(2);
p12=p1+p2;
p13=p1+p3;
p23=p2+p3;

m12=p12.M2();
m13=p13.M2();
m23=p23.M2();

dalitz->Fill(m12,m13);

}[/quote]

To make TGenPhaseSpace work properly, the histogram must be filled using the weight returned by Generate().
When I change dalitz->Fill(m12,m13); to dalitz->Fill(m12,m13,w); then everything works fine.

Thanks to Denis Dujmic for noticing that the PhaseSpace.C tutorial provided with root shows this correct implementation. :blush:

josh