3 // Nikolai Amelin, Ludmila Malinina, Timur Pocheptsov (C) JINR/Dubna
4 // amelin@sunhe.jinr.ru, malinina@sunhe.jinr.ru, pocheptsov@sunhe.jinr.ru
9 #include "TLorentzVector.h"
13 #include "UKUtility.h"
15 //_____________________________________________________________________
16 void IsotropicR3(Double_t r, Double_t *x, Double_t *y, Double_t *z) {
18 // return a random isotropic orientation
20 Double_t pZ = 1. - 2.*(gRandom->Rndm());
21 Double_t st = TMath::Sqrt((1.-pZ)*(1.+pZ)) * r;
22 Double_t phi = 2. * TMath::Pi() * (gRandom->Rndm());
29 //_____________________________________________________________________
30 void IsotropicR3(Double_t r, TVector3 &pos) {
32 // return a random isotropic orientation
34 Double_t pZ = 1. - 2.* (gRandom->Rndm());
35 Double_t st = TMath::Sqrt((1.-pZ)*(1.+pZ)) * r;
36 Double_t phi = 2. * TMath::Pi() * (gRandom->Rndm());
38 pos.SetX(st * TMath::Cos(phi));
39 pos.SetY(st * TMath::Sin(phi));
43 //_____________________________________________________________________
44 void MomAntiMom(TLorentzVector &mom, Double_t mass, TLorentzVector &antiMom,
45 Double_t antiMass, Double_t initialMass) {
47 // perform a 2 - body decay and orientate randomly the product particles momentum vectors
49 Double_t r = initialMass * initialMass - mass * mass - antiMass * antiMass;
50 if (r * r - 4 * mass * mass * antiMass * antiMass < 0.) throw "MomAntiMom";
52 Double_t pAbs = .5 * TMath::Sqrt(r * r - 4 * mass * mass * antiMass * antiMass) / initialMass;
54 IsotropicR3(pAbs, mom3);
55 mom.SetVectM(mom3, mass);
56 antiMom.SetVectM(- mom3, antiMass);