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
src
EvtGenBase
EvtDalitzResPdf.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/EvtDalitzResPdf.hh
"
22
23
#include "
EvtGenBase/EvtConst.hh
"
24
#include "
EvtGenBase/EvtDalitzCoord.hh
"
25
#include "
EvtGenBase/EvtRandom.hh
"
26
27
#include <math.h>
28
#include <stdio.h>
29
using namespace
EvtCyclic3
;
30
31
EvtDalitzResPdf::EvtDalitzResPdf
(
const
EvtDalitzPlot
& dp,
double
m0,
double
g0,
32
EvtCyclic3::Pair
pair ) :
33
EvtPdf
<
EvtDalitzPoint
>(),
m_dp
( dp ),
m_m0
( m0 ),
m_g0
( g0 ),
m_pair
( pair )
34
{
35
}
36
37
EvtValError
EvtDalitzResPdf::compute_integral
(
int
N )
const
38
{
39
assert( N != 0 );
40
41
EvtCyclic3::Pair
i =
m_pair
;
42
EvtCyclic3::Pair
j =
EvtCyclic3::next
( i );
43
44
// Trapezoidal integral
45
46
double
dh = (
m_dp
.qAbsMax( j ) -
m_dp
.qAbsMin( j ) ) / ( (double)N );
47
double
sum = 0;
48
49
int
ii;
50
for
( ii = 1; ii < N; ii++ ) {
51
double
x =
m_dp
.qAbsMin( j ) + ii * dh;
52
double
min = (
m_dp
.qMin( i, j, x ) -
m_m0
*
m_m0
) /
m_m0
/
m_g0
;
53
double
max = (
m_dp
.qMax( i, j, x ) -
m_m0
*
m_m0
) /
m_m0
/
m_g0
;
54
double
itg = 1 /
EvtConst::pi
* ( atan( max ) - atan( min ) );
55
sum += itg;
56
}
57
EvtValError
ret( sum * dh, 0. );
58
59
return
ret;
60
}
61
62
EvtDalitzPoint
EvtDalitzResPdf::randomPoint
()
63
{
64
// Random point generation must be done in a box encompassing the
65
// Dalitz plot
66
67
EvtCyclic3::Pair
i =
m_pair
;
68
EvtCyclic3::Pair
j =
EvtCyclic3::next
( i );
69
double
min = 1 /
EvtConst::pi
*
70
atan( (
m_dp
.qAbsMin( i ) -
m_m0
*
m_m0
) /
m_m0
/
m_g0
);
71
double
max = 1 /
EvtConst::pi
*
72
atan( (
m_dp
.qAbsMax( i ) -
m_m0
*
m_m0
) /
m_m0
/
m_g0
);
73
74
int
n = 0;
75
while
( n++ < 1000 ) {
76
double
qj =
EvtRandom::Flat
(
m_dp
.qAbsMin( j ),
m_dp
.qAbsMax( j ) );
77
double
r =
EvtRandom::Flat
( min, max );
78
double
qi = tan(
EvtConst::pi
* r ) *
m_g0
*
m_m0
+
m_m0
*
m_m0
;
79
EvtDalitzCoord
x( i, qi, j, qj );
80
EvtDalitzPoint
ret(
m_dp
, x );
81
if
( ret.
isValid
() )
82
return
ret;
83
}
84
85
// All generated points turned out to be outside of the Dalitz plot
86
// (in the outer box)
87
88
printf(
"No point generated for dalitz plot after 1000 tries\n"
);
89
return
EvtDalitzPoint
( 0., 0., 0., 0., 0., 0. );
90
}
91
92
double
EvtDalitzResPdf::pdf
(
const
EvtDalitzPoint
& x )
const
93
{
94
EvtCyclic3::Pair
i =
m_pair
;
95
double
dq = x.
q
( i ) -
m_m0
*
m_m0
;
96
return
1 /
EvtConst::pi
*
m_g0
*
m_m0
/
97
( dq * dq +
m_g0
*
m_g0
*
m_m0
*
m_m0
);
98
}
99
100
double
EvtDalitzResPdf::pdfMaxValue
()
const
101
{
102
return
1 / (
EvtConst::pi
*
m_g0
*
m_m0
);
103
}
EvtConst.hh
EvtDalitzCoord.hh
EvtDalitzResPdf.hh
EvtRandom.hh
EvtConst::pi
static const double pi
Definition
EvtConst.hh:26
EvtDalitzCoord
Definition
EvtDalitzCoord.hh:30
EvtDalitzPlot
Definition
EvtDalitzPlot.hh:30
EvtDalitzPoint
Definition
EvtDalitzPoint.hh:38
EvtDalitzPoint::q
double q(EvtCyclic3::Pair) const
Definition
EvtDalitzPoint.cpp:91
EvtDalitzPoint::isValid
bool isValid() const
Definition
EvtDalitzPoint.cpp:182
EvtDalitzResPdf::EvtDalitzResPdf
EvtDalitzResPdf(const EvtDalitzPlot &dp, double m0, double g0, EvtCyclic3::Pair pairRes)
Definition
EvtDalitzResPdf.cpp:31
EvtDalitzResPdf::m_m0
double m_m0
Definition
EvtDalitzResPdf.hh:62
EvtDalitzResPdf::m_dp
EvtDalitzPlot m_dp
Definition
EvtDalitzResPdf.hh:61
EvtDalitzResPdf::m_g0
double m_g0
Definition
EvtDalitzResPdf.hh:63
EvtDalitzResPdf::pdfMaxValue
double pdfMaxValue() const
Definition
EvtDalitzResPdf.cpp:100
EvtDalitzResPdf::randomPoint
EvtDalitzPoint randomPoint() override
Definition
EvtDalitzResPdf.cpp:62
EvtDalitzResPdf::pdf
double pdf(const EvtDalitzPoint &) const override
Definition
EvtDalitzResPdf.cpp:92
EvtDalitzResPdf::m_pair
EvtCyclic3::Pair m_pair
Definition
EvtDalitzResPdf.hh:64
EvtPdf< EvtDalitzPoint >::compute_integral
virtual EvtValError compute_integral() const
Definition
EvtPdf.hh:113
EvtPdf< EvtDalitzPoint >::EvtPdf
EvtPdf()
Definition
EvtPdf.hh:74
EvtRandom::Flat
static double Flat()
Definition
EvtRandom.cpp:95
EvtValError
Definition
EvtValError.hh:31
EvtCyclic3
Definition
EvtCyclic3.hh:28
EvtCyclic3::next
Index next(Index i)
Definition
EvtCyclic3.cpp:141
EvtCyclic3::Pair
Pair
Definition
EvtCyclic3.hh:37
Generated by
1.16.1