MINT2
src
Mojito
BreitWignerMC
TGenPhaseSpaceWithRnd.cpp
Go to the documentation of this file.
1
#include "
Mint/TGenPhaseSpaceWithRnd.h
"
2
// copy of TGenPhaseSpace, replacing gRandom with _rnd.
3
4
/*
5
Double_t TGenPhaseSpaceWithRnd::Generate(){
6
7
Double_t rno[kMAXP];
8
rno[0] = 0;
9
Int_t n;
10
if (fNt>2) {
11
for (n=1; n<fNt-1; n++) rno[n]=_rnd->Rndm(); // fNt-2 random numbers
12
qsort(rno+1 ,fNt-2 ,sizeof(Double_t) ,DoubleMax); // sort them
13
}
14
rno[fNt-1] = 1;
15
16
Double_t invMas[kMAXP], sum=0;
17
for (n=0; n<fNt; n++) {
18
sum += fMass[n];
19
invMas[n] = rno[n]*fTeCmTm + sum;
20
}
21
22
//
23
//-----> compute the weight of the current event
24
//
25
Double_t wt=fWtMax;
26
Double_t pd[kMAXP];
27
for (n=0; n<fNt-1; n++) {
28
pd[n] = PDK(invMas[n+1],invMas[n],fMass[n+1]);
29
wt *= pd[n];
30
}
31
32
//
33
//-----> complete specification of event (Raubold-Lynch method)
34
//
35
fDecPro[0].SetPxPyPzE(0, pd[0], 0 , TMath::Sqrt(pd[0]*pd[0]+fMass[0]*fMass[0]) );
36
37
Int_t i=1;
38
Int_t j;
39
while (1) {
40
fDecPro[i].SetPxPyPzE(0, -pd[i-1], 0 , TMath::Sqrt(pd[i-1]*pd[i-1]+fMass[i]*fMass[i]) );
41
42
Double_t cZ = 2*_rnd->Rndm() - 1;
43
Double_t sZ = TMath::Sqrt(1-cZ*cZ);
44
Double_t angY = 2*TMath::Pi() * _rnd->Rndm();
45
Double_t cY = TMath::Cos(angY);
46
Double_t sY = TMath::Sin(angY);
47
for (j=0; j<=i; j++) {
48
TLorentzVector *v = fDecPro+j;
49
Double_t x = v->Px();
50
Double_t y = v->Py();
51
v->SetPx( cZ*x - sZ*y );
52
v->SetPy( sZ*x + cZ*y ); // rotation around Z
53
x = v->Px();
54
Double_t z = v->Pz();
55
v->SetPx( cY*x - sY*z );
56
v->SetPz( sY*x + cY*z ); // rotation around Y
57
}
58
59
if (i == (fNt-1)) break;
60
61
Double_t beta = pd[i] / sqrt(pd[i]*pd[i] + invMas[i]*invMas[i]);
62
for (j=0; j<=i; j++) fDecPro[j].Boost(0,beta,0);
63
i++;
64
}
65
66
//
67
//---> final boost of all particles
68
//
69
for (n=0;n<fNt;n++) fDecPro[n].Boost(fBeta[0],fBeta[1],fBeta[2]);
70
71
//
72
//---> return the weigth of event
73
//
74
return wt;
75
}
76
77
//__________________________________________________________________________________
78
TLorentzVector *TGenPhaseSpace::GetDecay(Int_t n)
79
{
80
//return Lorentz vector corresponding to decay n
81
if (n>fNt) return 0;
82
return fDecPro+n;
83
}
84
85
86
//_____________________________________________________________________________________
87
Bool_t TGenPhaseSpace::SetDecay(TLorentzVector &P, Int_t nt,
88
Double_t *mass, Option_t *opt)
89
{
90
// input:
91
// TLorentzVector &P: decay particle (Momentum, Energy units are Gev/C, GeV)
92
// Int_t nt: number of decay products
93
// Double_t *mass: array of decay product masses
94
// Option_t *opt: default -> constant cross section
95
// "Fermi" -> Fermi energy dependece
96
// return value:
97
// kTRUE: the decay is permitted by kinematics
98
// kFALSE: the decay is forbidden by kinematics
99
//
100
101
Int_t n;
102
fNt = nt;
103
if (fNt<2 || fNt>18) return kFALSE; // no more then 18 particle
104
105
//
106
//
107
//
108
fTeCmTm = P.Mag(); // total energy in C.M. minus the sum of the masses
109
for (n=0;n<fNt;n++) {
110
fMass[n] = mass[n];
111
fTeCmTm -= mass[n];
112
}
113
114
if (fTeCmTm<=0) return kFALSE; // not enough energy for this decay
115
116
//
117
//------> the max weigth depends on opt:
118
// opt == "Fermi" --> fermi energy dependence for cross section
119
// else --> constant cross section as function of TECM (default)
120
//
121
if (strcasecmp(opt,"fermi")==0) {
122
// ffq[] = pi * (2*pi)**(FNt-2) / (FNt-2)!
123
Double_t ffq[] = {0
124
,3.141592, 19.73921, 62.01255, 129.8788, 204.0131
125
,256.3704, 268.4705, 240.9780, 189.2637
126
,132.1308, 83.0202, 47.4210, 24.8295
127
,12.0006, 5.3858, 2.2560, 0.8859 };
128
fWtMax = TMath::Power(fTeCmTm,fNt-2) * ffq[fNt-1] / P.Mag();
129
130
} else {
131
Double_t emmax = fTeCmTm + fMass[0];
132
Double_t emmin = 0;
133
Double_t wtmax = 1;
134
for (n=1; n<fNt; n++) {
135
emmin += fMass[n-1];
136
emmax += fMass[n];
137
wtmax *= PDK(emmax, emmin, fMass[n]);
138
}
139
fWtMax = 1/wtmax;
140
}
141
142
//
143
//----> save the betas of the decaying particle
144
//
145
if (P.Beta()) {
146
Double_t w = P.Beta()/P.Rho();
147
fBeta[0] = P(0)*w;
148
fBeta[1] = P(1)*w;
149
fBeta[2] = P(2)*w;
150
}
151
else fBeta[0]=fBeta[1]=fBeta[2]=0;
152
153
return kTRUE;
154
}
155
*/
TGenPhaseSpaceWithRnd.h
Generated by
1.8.15