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