CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
UKUtility.cc
Go to the documentation of this file.
1 /*
2 
3 Nikolai Amelin, Ludmila Malinina, Timur Pocheptsov (C) JINR/Dubna
4 amelin@sunhe.jinr.ru, malinina@sunhe.jinr.ru, pocheptsov@sunhe.jinr.ru
5 November. 2, 2005
6 
7 */
8 
9 #include "TLorentzVector.h"
10 #include "TVector3.h"
11 
14 
15 #include "CLHEP/Random/RandomEngine.h"
16 #include "CLHEP/Random/RandFlat.h"
17 
18 extern CLHEP::HepRandomEngine* hjRandomEngine;
19 
20 const double GeV = 1.;
21 const double fermi = 1.;
22 const double hbarc = 0.197 * GeV * fermi;
23 const double w = 1.0 / 0.1973;
24 const double hbarc_squared = hbarc * hbarc;
25 
26 void IsotropicR3(double r, double *x, double *y, double *z) {
27  double pZ = 1. - 2.*(CLHEP::RandFlat::shoot(hjRandomEngine));
28  double st = TMath::Sqrt(1. - pZ * pZ) * r;
29  double phi = 2. * TMath::Pi() * (CLHEP::RandFlat::shoot(hjRandomEngine));
30 
31  *x = st * cos(phi);
32  *y = st * sin(phi);
33  *z = pZ * r;
34 }
35 
36 void IsotropicR3(double r, TVector3 &pos) {
37  double pZ = 1. - 2.* (CLHEP::RandFlat::shoot(hjRandomEngine));
38  double st = TMath::Sqrt(1. - pZ * pZ) * r;
39  double phi = 2. * TMath::Pi() * (CLHEP::RandFlat::shoot(hjRandomEngine));
40  pos.SetX(st * TMath::Cos(phi));
41  pos.SetY(st * TMath::Sin(phi));
42  pos.SetZ(pZ * r);
43 }
44 
45 void MomAntiMom(TLorentzVector &mom, double mass, TLorentzVector &antiMom,
46  double antiMass, double initialMass) {
47  double r = initialMass * initialMass - mass * mass - antiMass * antiMass;
48  if (r * r - 4 * mass * mass * antiMass * antiMass < 0.) throw "MomAntiMom";
49 
50  double pAbs = .5 * TMath::Sqrt(r * r - 4 * mass * mass * antiMass * antiMass) / initialMass;
51  TVector3 mom3;
52  IsotropicR3(pAbs, mom3);
53  mom.SetVectM(mom3, mass);
54  antiMom.SetVectM(- mom3, antiMass);
55 }
56 
57 
const double Pi
const double hbarc_squared
Definition: UKUtility.cc:24
const double GeV
Definition: MathUtil.h:16
const double hbarc
Definition: MathUtil.h:18
const double w
Definition: UKUtility.cc:23
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float float float z
const double fermi
Definition: MathUtil.h:17
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
CLHEP::HepRandomEngine * hjRandomEngine
void MomAntiMom(TLorentzVector &mom, double mass, TLorentzVector &antiMom, double antiMass, double initialMass)
Definition: UKUtility.cc:45
void IsotropicR3(double r, double *pX, double *pY, double *pZ)
Definition: UKUtility.cc:26
Definition: DDAxes.h:10
Definition: DDAxes.h:10