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.
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 
22 
23 #include "EvtGenBase/EvtPatches.hh"
24 
26  EvtPdf<EvtDalitzPoint>(), _dp( dp )
27 {
28 }
29 
31  EvtPdf<EvtDalitzPoint>( other ), _dp( other._dp )
32 {
33 }
34 
36 {
37  return new EvtDalitzFlatPdf( *this );
38 }
39 
40 double EvtDalitzFlatPdf::pdf( const EvtDalitzPoint& ) const
41 {
42  return 1.;
43 }
44 
46 {
47  return EvtValError( _dp.getArea( N ), 0. );
48 }
49 
51 {
52  // To obtain a uniform distribution generate
53  // in terms of q's. Generate in a box that circumscribes the
54  // Dalitz plot. Accept points inside. If there are two
55  // many unsuccessful attempts it's a hint that the Dalitz plot
56  // area is tiny compared to the box. It's a pathological
57  // case. Abort.
58 
61 
62  int n = 0;
63  int maxTries = 1000;
64  while ( n++ < maxTries ) {
65  double q1 = EvtRandom::Flat( _dp.qAbsMin( pair1 ), _dp.qAbsMax( pair2 ) );
66  double q2 = EvtRandom::Flat( _dp.qAbsMin( pair2 ), _dp.qAbsMax( pair2 ) );
67 
68  EvtDalitzCoord point( pair1, q1, pair2, q2 );
69  EvtDalitzPoint x( _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 }
bool isValid() const
EvtPdf< EvtDalitzPoint > * clone() const override
EvtDalitzFlatPdf(const EvtDalitzPlot &dp)
double pdf(const EvtDalitzPoint &) const override
double qAbsMin(EvtCyclic3::Pair i) const
EvtDalitzPoint randomPoint() override
virtual EvtValError compute_integral() const
Definition: EvtPdf.hh:113
EvtDalitzPlot _dp
double getArea(int N=1000, EvtCyclic3::Pair i=EvtCyclic3::AB, EvtCyclic3::Pair j=EvtCyclic3::BC) const
static double Flat()
Definition: EvtRandom.cpp:72
Definition: EvtPdf.hh:72
double qAbsMax(EvtCyclic3::Pair i) const
Index other(Index i, Index j)
Definition: EvtCyclic3.cpp:156