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
EvtDalitzFlatPdf.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/EvtDalitzFlatPdf.hh
"
22
23
EvtDalitzFlatPdf::EvtDalitzFlatPdf
(
const
EvtDalitzPlot
& dp ) :
24
EvtPdf
<
EvtDalitzPoint
>(),
m_dp
( dp )
25
{
26
}
27
28
EvtDalitzFlatPdf::EvtDalitzFlatPdf
(
const
EvtDalitzFlatPdf
& other ) :
29
EvtPdf
<
EvtDalitzPoint
>( other ),
m_dp
( other.
m_dp
)
30
{
31
}
32
33
EvtPdf<EvtDalitzPoint>
*
EvtDalitzFlatPdf::clone
()
const
34
{
35
return
new
EvtDalitzFlatPdf
( *
this
);
36
}
37
38
double
EvtDalitzFlatPdf::pdf
(
const
EvtDalitzPoint
& )
const
39
{
40
return
1.;
41
}
42
43
EvtValError
EvtDalitzFlatPdf::compute_integral
(
int
N )
const
44
{
45
return
EvtValError
(
m_dp
.getArea( N ), 0. );
46
}
47
48
EvtDalitzPoint
EvtDalitzFlatPdf::randomPoint
()
49
{
50
// To obtain a uniform distribution generate
51
// in terms of q's. Generate in a box that circumscribes the
52
// Dalitz plot. Accept points inside. If there are two
53
// many unsuccessful attempts it's a hint that the Dalitz plot
54
// area is tiny compared to the box. It's a pathological
55
// case. Abort.
56
57
EvtCyclic3::Pair
pair1 =
EvtCyclic3::BC
;
58
EvtCyclic3::Pair
pair2 =
EvtCyclic3::CA
;
59
60
int
n = 0;
61
int
maxTries = 1000;
62
while
( n++ < maxTries ) {
63
double
q1 =
EvtRandom::Flat
(
m_dp
.qAbsMin( pair1 ),
64
m_dp
.qAbsMax( pair2 ) );
65
double
q2 =
EvtRandom::Flat
(
m_dp
.qAbsMin( pair2 ),
66
m_dp
.qAbsMax( pair2 ) );
67
68
EvtDalitzCoord
point( pair1, q1, pair2, q2 );
69
EvtDalitzPoint
x(
m_dp
, point );
70
71
if
( x.
isValid
() )
72
return
x;
73
}
74
75
printf(
"No point generated for dalitz plot after %d tries\n"
, maxTries );
76
return
EvtDalitzPoint
();
77
}
EvtDalitzFlatPdf.hh
EvtDalitzCoord
Definition
EvtDalitzCoord.hh:30
EvtDalitzFlatPdf::EvtDalitzFlatPdf
EvtDalitzFlatPdf(const EvtDalitzPlot &dp)
Definition
EvtDalitzFlatPdf.cpp:23
EvtDalitzFlatPdf::clone
EvtPdf< EvtDalitzPoint > * clone() const override
Definition
EvtDalitzFlatPdf.cpp:33
EvtDalitzFlatPdf::pdf
double pdf(const EvtDalitzPoint &) const override
Definition
EvtDalitzFlatPdf.cpp:38
EvtDalitzFlatPdf::m_dp
EvtDalitzPlot m_dp
Definition
EvtDalitzFlatPdf.hh:47
EvtDalitzFlatPdf::randomPoint
EvtDalitzPoint randomPoint() override
Definition
EvtDalitzFlatPdf.cpp:48
EvtDalitzPlot
Definition
EvtDalitzPlot.hh:30
EvtDalitzPoint
Definition
EvtDalitzPoint.hh:38
EvtDalitzPoint::isValid
bool isValid() const
Definition
EvtDalitzPoint.cpp:182
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::Pair
Pair
Definition
EvtCyclic3.hh:37
EvtCyclic3::BC
@ BC
Definition
EvtCyclic3.hh:38
EvtCyclic3::CA
@ CA
Definition
EvtCyclic3.hh:40
Generated by
1.16.1