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
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
22
26
27#include <math.h>
28#include <stdio.h>
29using namespace EvtCyclic3;
30
31EvtDalitzResPdf::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
38{
39 assert( N != 0 );
40
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
63{
64 // Random point generation must be done in a box encompassing the
65 // Dalitz plot
66
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
92double EvtDalitzResPdf::pdf( const EvtDalitzPoint& x ) const
93{
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
101{
102 return 1 / ( EvtConst::pi * m_g0 * m_m0 );
103}
static const double pi
Definition EvtConst.hh:26
double q(EvtCyclic3::Pair) const
bool isValid() const
EvtDalitzResPdf(const EvtDalitzPlot &dp, double m0, double g0, EvtCyclic3::Pair pairRes)
EvtDalitzPlot m_dp
double pdfMaxValue() const
EvtDalitzPoint randomPoint() override
double pdf(const EvtDalitzPoint &) const override
EvtCyclic3::Pair m_pair
virtual EvtValError compute_integral() const
Definition EvtPdf.hh:113
static double Flat()
Definition EvtRandom.cpp:95
Index next(Index i)