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
EvtGenBase
EvtCGCoefSingle.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 "
EvtGenBase/EvtCGCoefSingle.hh
"
22
23
#include "
EvtGenBase/EvtOrthogVector.hh
"
24
25
#include <assert.h>
26
#include <iostream>
27
#include <math.h>
28
#include <stdlib.h>
29
30
void
EvtCGCoefSingle::init
(
int
j1,
int
j2 )
31
{
32
m_j1
= j1;
33
m_j2
= j2;
34
35
m_Jmax
=
abs
( j1 + j2 );
36
m_Jmin
=
abs
( j1 - j2 );
37
38
m_table
.resize( (
m_Jmax
-
m_Jmin
) / 2 + 1 );
39
40
int
J, M;
41
42
int
lenmax = j1 + 1;
43
if
( j2 < j1 )
44
lenmax = j2 + 1;
45
46
//set vector sizes
47
for
( J =
m_Jmax
; J >=
m_Jmin
; J -= 2 ) {
48
m_table
[( J -
m_Jmin
) / 2].resize( J + 1 );
49
for
( M = J; J >= -M; M -= 2 ) {
50
int
len = ( (
m_j1
+
m_j2
) -
abs
( M ) ) / 2 + 1;
51
if
( len > lenmax )
52
len = lenmax;
53
m_table
[( J -
m_Jmin
) / 2][( M + J ) / 2].resize( len );
54
}
55
}
56
57
//now fill the vectors
58
for
( J =
m_Jmax
; J >=
m_Jmin
; J -= 2 ) {
59
//bootstrap with highest M(=J) as a special case
60
if
( J ==
m_Jmax
) {
61
cg
( J, J,
m_j1
,
m_j2
) = 1.0;
62
}
else
{
63
int
n = (
m_Jmax
- J ) / 2 + 1;
64
std::vector<double>* vectors =
new
std::vector<double>[n - 1];
65
int
i, k;
66
for
( i = 0; i < n - 1; i++ ) {
67
// i corresponds to J=Jmax-2*i
68
vectors[i].resize( n );
69
for
( k = 0; k < n; k++ ) {
70
double
tmp =
m_table
[(
m_Jmax
-
m_Jmin
) / 2 - i]
71
[( J +
m_Jmax
- 2 * i ) / 2][k];
72
vectors[i][k] = tmp;
73
}
74
}
75
EvtOrthogVector
getOrth( n, vectors );
76
std::vector<double> orth = getOrth.
getOrthogVector
();
77
int
sign = 1;
78
if
( orth[n - 1] < 0.0 )
79
sign = -1;
80
for
( k = 0; k < n; k++ ) {
81
m_table
[( J -
m_Jmin
) / 2][J][k] = sign * orth[k];
82
}
83
delete
[] vectors;
84
}
85
for
( M = J - 2; M >= -J; M -= 2 ) {
86
int
len = ( (
m_j1
+
m_j2
) -
abs
( M ) ) / 2 + 1;
87
if
( len > lenmax )
88
len = lenmax;
89
int
mmin = M - j2;
90
if
( mmin < -j1 )
91
mmin = -j1;
92
int
m1;
93
for
( m1 = mmin; m1 < mmin + len * 2; m1 += 2 ) {
94
int
m2 = M - m1;
95
double
sum = 0.0;
96
float
fkwTmp =
m_j1
* (
m_j1
+ 2 ) - ( m1 + 2 ) * m1;
97
//fkw 2/2/2001: changes needed to satisfy KCC
98
//fkw if (m1+2<=m_j1) sum+=0.5*sqrt(m_j1*(m_j1+2)-(m1+2)*m1)*cg(J,M+2,m1+2,m2);
99
//fkw if (m2+2<=m_j2) sum+=0.5*sqrt(m_j2*(m_j2+2)-(m2+2)*m2)*cg(J,M+2,m1,m2+2);
100
//fkw sum/=(0.5*sqrt(J*(J+2)-(M+2)*M));
101
if
( m1 + 2 <=
m_j1
)
102
sum += 0.5 * sqrt( fkwTmp ) *
cg
( J, M + 2, m1 + 2, m2 );
103
fkwTmp =
m_j2
* (
m_j2
+ 2 ) - ( m2 + 2 ) * m2;
104
if
( m2 + 2 <=
m_j2
)
105
sum += 0.5 * sqrt( fkwTmp ) *
cg
( J, M + 2, m1, m2 + 2 );
106
fkwTmp = J * ( J + 2 ) - ( M + 2 ) * M;
107
sum /= ( 0.5 * sqrt( fkwTmp ) );
108
cg
( J, M, m1, m2 ) = sum;
109
}
110
}
111
}
112
}
113
114
double
EvtCGCoefSingle::coef
(
int
J,
int
M, [[maybe_unused]]
int
j1,
115
[[maybe_unused]]
int
j2,
int
m1,
int
m2 )
116
{
117
assert( j1 ==
m_j1
);
118
assert( j2 ==
m_j2
);
119
120
return
cg
( J, M, m1, m2 );
121
}
122
123
double
&
EvtCGCoefSingle::cg
(
int
J,
int
M,
int
m1, [[maybe_unused]]
int
m2 )
124
{
125
assert( M == m1 + m2 );
126
assert(
abs
( M ) <= J );
127
assert( J <=
m_Jmax
);
128
assert( J >=
m_Jmin
);
129
assert(
abs
( m1 ) <=
m_j1
);
130
assert(
abs
( m2 ) <=
m_j2
);
131
132
//find lowest m1 allowed for the given M
133
134
int
mmin = M -
m_j2
;
135
136
if
( mmin < -
m_j1
)
137
mmin = -
m_j1
;
138
139
int
n = m1 - mmin;
140
141
return
m_table
[( J -
m_Jmin
) / 2][( M + J ) / 2][n / 2];
142
}
EvtCGCoefSingle.hh
abs
double abs(const EvtComplex &c)
Definition
EvtComplex.hh:203
EvtOrthogVector.hh
EvtCGCoefSingle::cg
double & cg(int J, int M, int m1, int m2)
Definition
EvtCGCoefSingle.cpp:123
EvtCGCoefSingle::m_table
std::vector< std::vector< std::vector< double > > > m_table
Definition
EvtCGCoefSingle.hh:42
EvtCGCoefSingle::m_j1
int m_j1
Definition
EvtCGCoefSingle.hh:36
EvtCGCoefSingle::coef
double coef(int J, int M, int j1, int j2, int m1, int m2)
Definition
EvtCGCoefSingle.cpp:114
EvtCGCoefSingle::m_Jmax
int m_Jmax
Definition
EvtCGCoefSingle.hh:39
EvtCGCoefSingle::m_j2
int m_j2
Definition
EvtCGCoefSingle.hh:37
EvtCGCoefSingle::m_Jmin
int m_Jmin
Definition
EvtCGCoefSingle.hh:40
EvtCGCoefSingle::init
void init(int j1, int j2)
Definition
EvtCGCoefSingle.cpp:30
EvtOrthogVector
Definition
EvtOrthogVector.hh:26
EvtOrthogVector::getOrthogVector
std::vector< double > getOrthogVector()
Definition
EvtOrthogVector.hh:30
Generated by
1.17.0