- if (TestBit(kThetaRange)) {
- theta = fThetaMin+random[0]*(fThetaMax-fThetaMin);
- } else {
- Float_t eta = fEtaMin+random[0]*(fEtaMax-fEtaMin);
- theta = 2. * TMath::ATan(TMath::Exp(-eta));
- }
-
-
- if(TestBit(kMomentumRange)) {
- pmom=fPMin+random[1]*(fPMax-fPMin);
- pt=pmom*TMath::Sin(theta);
+ if (TestBit(kYRange)) {
+ y = fYMin+random[0]*(fYMax-fYMin);
+
+ if(TestBit(kMomentumRange)) {
+ pmom=fPMin+random[1]*(fPMax-fPMin);
+ mt = TMath::Sqrt(pmom*pmom+m*m)/TMath::CosH(y);
+ pt = TMath::Sqrt(mt*mt - m*m);
+ } else {
+ pt=fPtMin+random[1]*(fPtMax-fPtMin);
+ mt=TMath::Sqrt(pt*pt+m*m);
+ }
+
+ phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
+ p[0] = pt*TMath::Cos(phi);
+ p[1] = pt*TMath::Sin(phi);
+ p[2] = mt*TMath::SinH(y);