CMS 3D CMS Logo

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, double antiMass, double initialMass) {
46  double r = initialMass * initialMass - mass * mass - antiMass * antiMass;
47  if (r * r - 4 * mass * mass * antiMass * antiMass < 0.)
48  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 }
detailsBasic3DVector::z
float float float z
Definition: extBasic3DVector.h:14
MomAntiMom
void MomAntiMom(TLorentzVector &mom, double mass, TLorentzVector &antiMom, double antiMass, double initialMass)
Definition: UKUtility.cc:45
w
const double w
Definition: UKUtility.cc:23
IsotropicR3
void IsotropicR3(double r, double *x, double *y, double *z)
Definition: UKUtility.cc:26
pos
Definition: PixelAliasList.h:18
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
UKUtility.h
Particle.h
PVValHelper::phi
Definition: PVValidationHelpers.h:68
hjRandomEngine
CLHEP::HepRandomEngine * hjRandomEngine
Definition: Hydjet2Hadronizer.h:55
fermi
const double fermi
Definition: UKUtility.cc:21
GeV
const double GeV
Definition: UKUtility.cc:20
alignCSCRings.r
r
Definition: alignCSCRings.py:93
genVertex_cff.x
x
Definition: genVertex_cff.py:12
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
hbarc_squared
const double hbarc_squared
Definition: UKUtility.cc:24
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
hbarc
const double hbarc
Definition: UKUtility.cc:22