EvtGen 2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Loading...
Searching...
No Matches
EvtdFunctionSingle.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
22
23#include <assert.h>
24#include <iostream>
25#include <math.h>
26#include <stdlib.h>
27
29{
30 m_j = 0;
31 m_m1 = 0;
32 m_m2 = 0;
33 m_coef = nullptr;
34 m_kmin = 0;
35 m_kmax = 0;
36}
37
39{
40 if ( m_coef != nullptr )
41 delete[] m_coef;
42}
43
44void EvtdFunctionSingle::init( int j, int m1, int m2 )
45{
46 assert( abs( m2 ) >= abs( m1 ) );
47 assert( m2 >= 0 );
48
49 m_j = j;
50 m_m1 = m1;
51 m_m2 = m2;
52
53 m_kmin = m_m2 - m_m1;
54 m_kmax = m_j - m_m1;
55
56 assert( m_kmin <= m_kmax );
57
58 m_coef = new double[( m_kmax - m_kmin ) / 2 + 1];
59
60 int k;
61
62 for ( k = m_kmin; k <= m_kmax; k += 2 ) {
63 int sign = 1;
64 if ( ( k - m_m2 + m_m1 ) % 4 != 0 )
65 sign = -sign;
66 double tmp = fact( ( m_j + m_m2 ) / 2 ) * fact( ( m_j - m_m2 ) / 2 ) *
67 fact( ( m_j + m_m1 ) / 2 ) * fact( ( m_j - m_m1 ) / 2 );
68 m_coef[( k - m_kmin ) / 2] =
69 sign * sqrt( tmp ) /
70 ( fact( ( m_j + m_m2 - k ) / 2 ) * fact( k / 2 ) *
71 fact( ( m_j - m_m1 - k ) / 2 ) * fact( ( k - m_m2 + m_m1 ) / 2 ) );
72 }
73}
74
75double EvtdFunctionSingle::d( [[maybe_unused]] int j, int m1, int m2,
76 double theta )
77{
78 assert( j == m_j );
79 assert( m1 == m_m1 );
80 assert( m2 == m_m2 );
81
82 double c2 = cos( 0.5 * theta );
83 double s2 = sin( 0.5 * theta );
84
85 double d = 0.0;
86
87 int k;
88 for ( k = m_kmin; k <= m_kmax; k += 2 ) {
89 d += m_coef[( k - m_kmin ) / 2] *
90 pow( c2, ( 2 * m_j - 2 * k + m2 - m1 ) / 2 ) *
91 pow( s2, ( 2 * k - m2 + m1 ) / 2 );
92 }
93
94 return d;
95}
96
98{
99 assert( n >= 0 );
100
101 int f = 1;
102
103 int k;
104 for ( k = 2; k <= n; k++ )
105 f *= k;
106
107 return f;
108}
double abs(const EvtComplex &c)
double d(int j, int m1, int m2, double theta)
void init(int j, int m1, int m2)