EvtGen
2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Toggle main menu visibility
Loading...
Searching...
No Matches
src
EvtGenModels
EvtPartWave.cpp
Go to the documentation of this file.
1
2
/***********************************************************************
3
* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4
* *
5
* This file is part of EvtGen. *
6
* *
7
* EvtGen is free software: you can redistribute it and/or modify *
8
* it under the terms of the GNU General Public License as published by *
9
* the Free Software Foundation, either version 3 of the License, or *
10
* (at your option) any later version. *
11
* *
12
* EvtGen is distributed in the hope that it will be useful, *
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
* GNU General Public License for more details. *
16
* *
17
* You should have received a copy of the GNU General Public License *
18
* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19
***********************************************************************/
20
21
#include "
EvtGenModels/EvtPartWave.hh
"
22
23
#include "
EvtGenBase/EvtCGCoefSingle.hh
"
24
#include "
EvtGenBase/EvtConst.hh
"
25
#include "
EvtGenBase/EvtGenKine.hh
"
26
#include "
EvtGenBase/EvtId.hh
"
27
#include "
EvtGenBase/EvtKine.hh
"
28
#include "
EvtGenBase/EvtPDL.hh
"
29
#include "
EvtGenBase/EvtParticle.hh
"
30
#include "
EvtGenBase/EvtReport.hh
"
31
#include "
EvtGenBase/EvtTensor4C.hh
"
32
#include "
EvtGenBase/EvtVector4C.hh
"
33
34
#include <algorithm>
35
#include <stdlib.h>
36
#include <string>
37
using
std::endl;
38
39
std::string
EvtPartWave::getName
()
const
40
{
41
return
"PARTWAVE"
;
42
}
43
44
EvtDecayBase
*
EvtPartWave::clone
()
const
45
{
46
return
new
EvtPartWave
;
47
}
48
49
void
EvtPartWave::init
()
50
{
51
checkNDaug
( 2 );
52
53
//find out how many states each particle have
54
int
nA =
EvtSpinType::getSpinStates
(
EvtPDL::getSpinType
(
getParentId
() ) );
55
int
nB =
EvtSpinType::getSpinStates
(
EvtPDL::getSpinType
(
getDaug
( 0 ) ) );
56
int
nC =
EvtSpinType::getSpinStates
(
EvtPDL::getSpinType
(
getDaug
( 1 ) ) );
57
58
if
(
verbose
() ) {
59
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
60
<<
"nA,nB,nC:"
<< nA <<
","
<< nB <<
","
<< nC << endl;
61
}
62
63
//find out what 2 times the spin is
64
int
JA2 =
EvtSpinType::getSpin2
(
EvtPDL::getSpinType
(
getParentId
() ) );
65
int
JB2 =
EvtSpinType::getSpin2
(
EvtPDL::getSpinType
(
getDaug
( 0 ) ) );
66
int
JC2 =
EvtSpinType::getSpin2
(
EvtPDL::getSpinType
(
getDaug
( 1 ) ) );
67
68
if
(
verbose
() ) {
69
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
70
<<
"JA2,JB2,JC2:"
<< JA2 <<
","
<< JB2 <<
","
<< JC2 << endl;
71
}
72
73
//allocate memory
74
int
* lambdaA2 =
new
int
[nA];
75
int
* lambdaB2 =
new
int
[nB];
76
int
* lambdaC2 =
new
int
[nC];
77
78
EvtComplexPtr
* HBC =
new
EvtComplexPtr
[nB];
79
for
(
int
ib = 0; ib < nB; ib++ ) {
80
HBC[ib] =
new
EvtComplex
[nC];
81
}
82
83
//find the allowed helicities (actually 2*times the helicity!)
84
85
fillHelicity
( lambdaA2, nA, JA2 );
86
fillHelicity
( lambdaB2, nB, JB2 );
87
fillHelicity
( lambdaC2, nC, JC2 );
88
89
if
(
verbose
() ) {
90
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
91
<<
"Helicity states of particle A:"
<< endl;
92
for
(
int
i = 0; i < nA; i++ ) {
93
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
) << lambdaA2[i] << endl;
94
}
95
96
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
97
<<
"Helicity states of particle B:"
<< endl;
98
for
(
int
i = 0; i < nB; i++ ) {
99
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
) << lambdaB2[i] << endl;
100
}
101
102
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
103
<<
"Helicity states of particle C:"
<< endl;
104
for
(
int
i = 0; i < nC; i++ ) {
105
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
) << lambdaC2[i] << endl;
106
}
107
108
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
109
<<
"Will now figure out the valid (M_LS) states:"
<< endl;
110
}
111
112
int
Lmin = std::max( JA2 - JB2 - JC2,
113
std::max( JB2 - JA2 - JC2, JC2 - JA2 - JB2 ) );
114
if
( Lmin < 0 )
115
Lmin = 0;
116
int
Lmax = JA2 + JB2 + JC2;
117
118
int
nPartialWaveAmp = 0;
119
120
int
nL[50];
121
int
nS[50];
122
123
for
(
int
L = Lmin; L <= Lmax; L += 2 ) {
124
int
Smin =
abs
( L - JA2 );
125
if
( Smin <
abs
( JB2 - JC2 ) )
126
Smin =
abs
( JB2 - JC2 );
127
int
Smax = L + JA2;
128
if
( Smax >
abs
( JB2 + JC2 ) )
129
Smax =
abs
( JB2 + JC2 );
130
for
(
int
S = Smin; S <= Smax; S += 2 ) {
131
nL[nPartialWaveAmp] = L;
132
nS[nPartialWaveAmp] = S;
133
134
nPartialWaveAmp++;
135
if
(
verbose
() ) {
136
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
137
<<
"M["
<< L <<
"]["
<< S <<
"]"
<< endl;
138
}
139
}
140
}
141
142
checkNArg
( nPartialWaveAmp * 2 );
143
144
int
argcounter = 0;
145
146
EvtComplex
M[50];
147
148
double
partampsqtot = 0.0;
149
150
for
(
int
i = 0; i < nPartialWaveAmp; i++ ) {
151
M[i] =
getArg
( argcounter ) *
152
exp
(
EvtComplex
( 0.0,
getArg
( argcounter + 1 ) ) );
153
argcounter += 2;
154
partampsqtot +=
abs2
( M[i] );
155
if
(
verbose
() ) {
156
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
157
<<
"M["
<< nL[i] <<
"]["
<< nS[i] <<
"]="
<< M[i] << endl;
158
}
159
}
160
161
//Now calculate the helicity amplitudes
162
163
double
helampsqtot = 0.0;
164
165
for
(
int
ib = 0; ib < nB; ib++ ) {
166
for
(
int
ic = 0; ic < nC; ic++ ) {
167
HBC[ib][ic] = 0.0;
168
if
(
abs
( lambdaB2[ib] - lambdaC2[ic] ) <= JA2 ) {
169
for
(
int
i = 0; i < nPartialWaveAmp; i++ ) {
170
int
L = nL[i];
171
int
S = nS[i];
172
int
lambda2 = lambdaB2[ib];
173
int
lambda3 = lambdaC2[ic];
174
int
s1 = JA2;
175
int
s2 = JB2;
176
int
s3 = JC2;
177
int
m1 = lambda2 - lambda3;
178
EvtCGCoefSingle
c1( s2, s3 );
179
EvtCGCoefSingle
c2( L, S );
180
181
if
(
verbose
() ) {
182
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
183
<<
"s2,lambda2:"
<< s2 <<
" "
<< lambda2 << endl;
184
}
185
//fkw changes to satisfy KCC
186
double
fkwTmp = ( L + 1.0 ) / ( s1 + 1.0 );
187
188
if
( S >=
abs
( m1 ) ) {
189
EvtComplex
tmp = sqrt( fkwTmp ) *
190
c1.
coef
( S, m1, s2, s3, lambda2,
191
-lambda3 ) *
192
c2.
coef
( s1, m1, L, S, 0, m1 ) * M[i];
193
HBC[ib][ic] += tmp;
194
}
195
}
196
if
(
verbose
() ) {
197
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
198
<<
"HBC["
<< ib <<
"]["
<< ic <<
"]="
<< HBC[ib][ic]
199
<< endl;
200
}
201
}
202
helampsqtot +=
abs2
( HBC[ib][ic] );
203
}
204
}
205
206
if
( fabs( helampsqtot - partampsqtot ) / ( helampsqtot + partampsqtot ) >
207
1e-6 ) {
208
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
209
<<
"In EvtPartWave for decay "
<<
EvtPDL::name
(
getParentId
() )
210
<<
" -> "
<<
EvtPDL::name
(
getDaug
( 0 ) ) <<
" "
211
<<
EvtPDL::name
(
getDaug
( 1 ) ) << std::endl;
212
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
) <<
"With arguments: "
<< std::endl;
213
for
(
int
i = 0; i * 2 <
getNArg
(); i++ ) {
214
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
215
<<
"M("
<< nL[i] <<
","
<< nS[i]
216
<<
")="
217
// <<getArg(2*i)<<" "<<getArg(2*i+1)<<std::endl;
218
<< M[i] << std::endl;
219
}
220
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
221
<<
"The total probability in the partwave basis is: "
<< partampsqtot
222
<< std::endl;
223
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
224
<<
"The total probability in the helamp basis is: "
<< helampsqtot
225
<< std::endl;
226
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
227
<<
"Most likely this is because the specified partwave amplitudes "
228
<< std::endl;
229
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
230
<<
"project onto unphysical helicities of photons or neutrinos. "
231
<< std::endl;
232
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
233
<<
"Seriously consider if your specified amplitudes are correct. "
234
<< std::endl;
235
}
236
237
m_evalHelAmp
= std::make_unique<EvtEvalHelAmp>(
getParentId
(),
getDaug
( 0 ),
238
getDaug
( 1 ), HBC );
239
}
240
241
void
EvtPartWave::initProbMax
()
242
{
243
double
maxprob =
m_evalHelAmp
->probMax();
244
245
if
(
verbose
() ) {
246
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
247
<<
"Calculated probmax"
<< maxprob << endl;
248
}
249
250
setProbMax
( maxprob );
251
}
252
253
void
EvtPartWave::decay
(
EvtParticle
* p )
254
{
255
//first generate simple phase space
256
p->
initializePhaseSpace
(
getNDaug
(),
getDaugs
() );
257
258
m_evalHelAmp
->evalAmp( p,
m_amp2
);
259
260
return
;
261
}
262
263
void
EvtPartWave::fillHelicity
(
int
* lambda2,
int
n,
int
J2 )
264
{
265
//photon is special case!
266
if
( n == 2 && J2 == 2 ) {
267
lambda2[0] = 2;
268
lambda2[1] = -2;
269
return
;
270
}
271
272
assert( n == J2 + 1 );
273
274
for
(
int
i = 0; i < n; i++ ) {
275
lambda2[i] = n - i * 2 - 1;
276
}
277
278
return
;
279
}
EvtCGCoefSingle.hh
abs2
double abs2(const EvtComplex &c)
Definition
EvtComplex.hh:211
exp
EvtComplex exp(const EvtComplex &c)
Definition
EvtComplex.hh:242
EvtComplexPtr
EvtComplex * EvtComplexPtr
Definition
EvtComplex.hh:78
abs
double abs(const EvtComplex &c)
Definition
EvtComplex.hh:203
EvtConst.hh
EvtGenKine.hh
EvtId.hh
EvtKine.hh
EvtPDL.hh
EvtPartWave.hh
EvtParticle.hh
EvtReport.hh
EvtGenReport
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition
EvtReport.cpp:32
EVTGEN_INFO
@ EVTGEN_INFO
Definition
EvtReport.hh:52
EVTGEN_ERROR
@ EVTGEN_ERROR
Definition
EvtReport.hh:49
EvtTensor4C.hh
EvtVector4C.hh
EvtCGCoefSingle
Definition
EvtCGCoefSingle.hh:26
EvtCGCoefSingle::coef
double coef(int J, int M, int j1, int j2, int m1, int m2)
Definition
EvtCGCoefSingle.cpp:114
EvtComplex
Definition
EvtComplex.hh:29
EvtDecayAmp::m_amp2
EvtAmp m_amp2
Definition
EvtDecayAmp.hh:73
EvtDecayBase::EvtDecayBase
EvtDecayBase()=default
EvtDecayBase::getNDaug
int getNDaug() const
Definition
EvtDecayBase.hh:64
EvtDecayBase::getNArg
int getNArg() const
Definition
EvtDecayBase.hh:67
EvtDecayBase::getArg
double getArg(unsigned int j)
Definition
EvtDecayBase.cpp:578
EvtDecayBase::setProbMax
void setProbMax(double prbmx)
Definition
EvtDecayBase.cpp:295
EvtDecayBase::getParentId
EvtId getParentId() const
Definition
EvtDecayBase.hh:60
EvtDecayBase::verbose
bool verbose() const
Definition
EvtDecayBase.hh:81
EvtDecayBase::getDaug
EvtId getDaug(int i) const
Definition
EvtDecayBase.hh:66
EvtDecayBase::checkNDaug
void checkNDaug(int d1, int d2=-1)
Definition
EvtDecayBase.cpp:516
EvtDecayBase::checkNArg
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
Definition
EvtDecayBase.cpp:492
EvtDecayBase::getDaugs
const EvtId * getDaugs() const
Definition
EvtDecayBase.hh:65
EvtPDL::getSpinType
static EvtSpinType::spintype getSpinType(EvtId i)
Definition
EvtPDL.cpp:371
EvtPDL::name
static std::string name(EvtId i)
Definition
EvtPDL.cpp:376
EvtPartWave
Definition
EvtPartWave.hh:36
EvtPartWave::fillHelicity
void fillHelicity(int *lambda2, int n, int J2)
Definition
EvtPartWave.cpp:263
EvtPartWave::clone
EvtDecayBase * clone() const override
Definition
EvtPartWave.cpp:44
EvtPartWave::m_evalHelAmp
std::unique_ptr< EvtEvalHelAmp > m_evalHelAmp
Definition
EvtPartWave.hh:49
EvtPartWave::init
void init() override
Definition
EvtPartWave.cpp:49
EvtPartWave::decay
void decay(EvtParticle *p) override
Definition
EvtPartWave.cpp:253
EvtPartWave::getName
std::string getName() const override
Definition
EvtPartWave.cpp:39
EvtPartWave::initProbMax
void initProbMax() override
Definition
EvtPartWave.cpp:241
EvtParticle
Definition
EvtParticle.hh:45
EvtParticle::initializePhaseSpace
double initializePhaseSpace(size_t numdaughter, const EvtId *daughters, bool forceResetMasses=false, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
Definition
EvtParticle.cpp:1100
EvtSpinType::getSpin2
static int getSpin2(spintype stype)
Definition
EvtSpinType.cpp:25
EvtSpinType::getSpinStates
static int getSpinStates(spintype stype)
Definition
EvtSpinType.cpp:56
Generated by
1.17.0