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.
EvtDalitzPlot.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 
24 #include "EvtGenBase/EvtPDL.hh"
25 #include "EvtGenBase/EvtPatches.hh"
27 
28 #include <assert.h>
29 #include <math.h>
30 #include <stdio.h>
31 
32 using namespace EvtCyclic3;
33 
35  _mA( 0. ), _mB( 0. ), _mC( 0. ), _bigM( 0. ), _ldel( 0. ), _rdel( 0. )
36 {
37 }
38 
39 EvtDalitzPlot::EvtDalitzPlot( double mA, double mB, double mC, double bigM,
40  double ldel, double rdel ) :
41  _mA( mA ), _mB( mB ), _mC( mC ), _bigM( bigM ), _ldel( ldel ), _rdel( rdel )
42 {
43  sanityCheck();
44 }
45 
46 EvtDalitzPlot::EvtDalitzPlot( const EvtDecayMode& mode, double ldel, double rdel )
47 {
48  _mA = EvtPDL::getMeanMass( EvtPDL::getId( mode.dau( A ) ) );
49  _mB = EvtPDL::getMeanMass( EvtPDL::getId( mode.dau( B ) ) );
50  _mC = EvtPDL::getMeanMass( EvtPDL::getId( mode.dau( C ) ) );
52 
53  _ldel = ldel;
54  _rdel = rdel;
55 
56  sanityCheck();
57 }
58 
60 {
61  bool ret = false;
62  if ( _mA == other._mA && _mB == other._mB && _mC == other._mC &&
63  _bigM == other._bigM )
64  ret = true;
65 
66  return ret;
67 }
68 
70 {
71  return new EvtDalitzPlot( *this );
72 }
73 
75 {
76  if ( _mA < 0 || _mB < 0 || _mC < 0 || _bigM <= 0 ||
77  _bigM - _mA - _mB - _mC < 0. ) {
78  printf( "Invalid Dalitz plot %f %f %f %f\n", _mA, _mB, _mC, _bigM );
79  assert( 0 );
80  }
81  assert( _ldel <= 0. );
82  assert( _rdel >= 0. );
83 }
84 
85 double EvtDalitzPlot::m( Index i ) const
86 {
87  double m = _mA;
88  if ( i == B )
89  m = _mB;
90  else if ( i == C )
91  m = _mC;
92 
93  return m;
94 }
95 
96 double EvtDalitzPlot::sum() const
97 {
98  return _mA * _mA + _mB * _mB + _mC * _mC + _bigM * _bigM;
99 }
100 
101 double EvtDalitzPlot::qAbsMin( Pair i ) const
102 {
103  Index j = first( i );
104  Index k = second( i );
105 
106  return ( m( j ) + m( k ) ) * ( m( j ) + m( k ) );
107 }
108 
109 double EvtDalitzPlot::qAbsMax( Pair i ) const
110 {
111  Index j = other( i );
112  return ( _bigM - m( j ) ) * ( _bigM - m( j ) );
113 }
114 
116 {
117  return qAbsMin( i ) - sum() / 3.;
118 }
119 
121 {
122  return qAbsMax( i ) - sum() / 3.;
123 }
124 
126 {
127  Pair j = next( i );
128  Pair k = prev( i );
129  return ( qAbsMin( j ) - qAbsMax( k ) ) / 2.;
130 }
131 
133 {
134  Pair j = next( i );
135  Pair k = prev( i );
136  return ( qAbsMax( j ) - qAbsMin( k ) ) / 2.;
137 }
138 
139 double EvtDalitzPlot::mAbsMin( Pair i ) const
140 {
141  return sqrt( qAbsMin( i ) );
142 }
143 
144 double EvtDalitzPlot::mAbsMax( Pair i ) const
145 {
146  return sqrt( qAbsMax( i ) );
147 }
148 
149 // parallel
150 
151 double EvtDalitzPlot::qMin( Pair i, Pair j, double q ) const
152 {
153  if ( i == j )
154  return q;
155 
156  else {
157  // Particle pair j defines the rest-frame
158  // 0 - particle common to r.f. and angle calculations
159  // 1 - particle belonging to r.f. but not angle
160  // 2 - particle not belonging to r.f.
161 
162  Index k0 = common( i, j );
163  Index k2 = other( j );
164  Index k1 = other( k0, k2 );
165 
166  // Energy, momentum of particle common to rest-frame and angle
167  EvtTwoBodyKine jpair( m( k0 ), m( k1 ), sqrt( q ) );
168  double pk = jpair.p();
169  double ek = jpair.e( EvtTwoBodyKine::A, EvtTwoBodyKine::AB );
170 
171  // Energy and momentum of the other particle
172  EvtTwoBodyKine mother( sqrt( q ), m( k2 ), bigM() );
173  double ej = mother.e( EvtTwoBodyKine::B, EvtTwoBodyKine::A );
174  double pj = mother.p( EvtTwoBodyKine::A );
175 
176  // See PDG 34.4.3.1
177  return ( ek + ej ) * ( ek + ej ) - ( pk + pj ) * ( pk + pj );
178  }
179 }
180 
181 // antiparallel
182 
183 double EvtDalitzPlot::qMax( Pair i, Pair j, double q ) const
184 {
185  if ( i == j )
186  return q;
187  else {
188  // Particle pair j defines the rest-frame
189  // 0 - particle common to r.f. and angle calculations
190  // 1 - particle belonging to r.f. but not angle
191  // 2 - particle not belonging to r.f.
192 
193  Index k0 = common( i, j );
194  Index k2 = other( j );
195  Index k1 = other( k0, k2 );
196 
197  // Energy, momentum of particle common to rest-frame and angle
198  EvtTwoBodyKine jpair( m( k0 ), m( k1 ), sqrt( q ) );
199  double ek = jpair.e( EvtTwoBodyKine::A, EvtTwoBodyKine::AB );
200  double pk = jpair.p();
201 
202  // Energy and momentum of the other particle
203  EvtTwoBodyKine mother( sqrt( q ), m( k2 ), bigM() );
204  double ej = mother.e( EvtTwoBodyKine::B, EvtTwoBodyKine::A );
205  double pj = mother.p( EvtTwoBodyKine::A );
206 
207  // See PDG 34.4.3.1
208  return ( ek + ej ) * ( ek + ej ) - ( pk - pj ) * ( pk - pj );
209  }
210 }
211 
212 double EvtDalitzPlot::getArea( int N, Pair i, Pair j ) const
213 {
214  // Trapezoidal integral over qi. qj can be calculated.
215  // The first and the last point are zero, so they are not counted
216 
217  double dh = ( qAbsMax( i ) - qAbsMin( i ) ) / ( (double)N );
218  double sum = 0;
219 
220  int ii;
221  for ( ii = 1; ii < N; ii++ ) {
222  double x = qAbsMin( i ) + ii * dh;
223  double dy = qMax( j, i, x ) - qMin( j, i, x );
224  sum += dy;
225  }
226 
227  return sum * dh;
228 }
229 
231  EvtCyclic3::Pair i2, double q2 ) const
232 {
233  if ( i1 == i2 )
234  return 1.;
235 
236  double qmax = qMax( i1, i2, q2 );
237  double qmin = qMin( i1, i2, q2 );
238 
239  double cos = ( qmax + qmin - 2 * q1 ) / ( qmax - qmin );
240 
241  return cos;
242 }
243 
244 double EvtDalitzPlot::e( Index i, Pair j, double q ) const
245 {
246  if ( i == other( j ) ) {
247  // i does not belong to pair j
248 
249  return ( bigM() * bigM() - q - m( i ) * m( i ) ) / 2 / sqrt( q );
250  } else {
251  // i and k make pair j
252 
253  Index k;
254  if ( first( j ) == i )
255  k = second( j );
256  else
257  k = first( j );
258 
259  double e = ( q + m( i ) * m( i ) - m( k ) * m( k ) ) / 2 / sqrt( q );
260  return e;
261  }
262 }
263 
264 double EvtDalitzPlot::p( Index i, Pair j, double q ) const
265 {
266  double en = e( i, j, q );
267  double p2 = en * en - m( i ) * m( i );
268 
269  if ( p2 < 0 ) {
270  printf( "Bad value of p2 %f %d %d %f %f\n", p2, i, j, en, m( i ) );
271  assert( 0 );
272  }
273 
274  return sqrt( p2 );
275 }
276 
278  double q2 ) const
279 {
280  if ( i1 == i2 )
281  return q2;
282 
283  EvtCyclic3::Index f = first( i1 );
284  EvtCyclic3::Index s = second( i1 );
285  return m( f ) * m( f ) + m( s ) * m( s ) +
286  2 * e( f, i2, q2 ) * e( s, i2, q2 ) -
287  2 * p( f, i2, q2 ) * p( s, i2, q2 ) * cosTh;
288 }
289 
290 double EvtDalitzPlot::jacobian( EvtCyclic3::Pair i, double q ) const
291 {
292  return 2 * p( first( i ), i, q ) *
293  p( other( i ), i, q ); // J(BC) = 2pA*pB = 2pA*pC
294 }
295 
296 EvtTwoBodyVertex EvtDalitzPlot::vD( Pair iRes, double m0, int L ) const
297 {
298  return EvtTwoBodyVertex( m( first( iRes ) ), m( second( iRes ) ), m0, L );
299 }
300 
301 EvtTwoBodyVertex EvtDalitzPlot::vB( Pair iRes, double m0, int L ) const
302 {
303  return EvtTwoBodyVertex( m0, m( other( iRes ) ), bigM(), L );
304 }
305 
307 {
308  // masses
309  printf( "Mass M %f\n", bigM() );
310  printf( "Mass mA %f\n", _mA );
311  printf( "Mass mB %f\n", _mB );
312  printf( "Mass mC %f\n", _mC );
313  // limits
314  printf( "Limits qAB %f : %f\n", qAbsMin( AB ), qAbsMax( AB ) );
315  printf( "Limits qBC %f : %f\n", qAbsMin( BC ), qAbsMax( BC ) );
316  printf( "Limits qCA %f : %f\n", qAbsMin( CA ), qAbsMax( CA ) );
317  printf( "Sum q %f\n", sum() );
318  printf( "Limit qsum %f : %f\n", qSumMin(), qSumMax() );
319 }
Index prev(Index i)
Definition: EvtCyclic3.cpp:128
double q(EvtCyclic3::Pair i1, double cosTh, EvtCyclic3::Pair i2, double q2) const
double qResAbsMin(EvtCyclic3::Pair i) const
double qHelAbsMin(EvtCyclic3::Pair i) const
double qAbsMin(EvtCyclic3::Pair i) const
const char * dau(int i) const
EvtTwoBodyVertex vD(EvtCyclic3::Pair iRes, double m0, int L) const
void sanityCheck() const
EvtTwoBodyVertex vB(EvtCyclic3::Pair iRes, double m0, int L) const
double mAbsMin(EvtCyclic3::Pair i) const
static double getMeanMass(EvtId i)
Definition: EvtPDL.cpp:314
double m(EvtCyclic3::Index i) const
double qMin(EvtCyclic3::Pair i, EvtCyclic3::Pair j, double q) const
double sum() const
double getArea(int N=1000, EvtCyclic3::Pair i=EvtCyclic3::AB, EvtCyclic3::Pair j=EvtCyclic3::BC) const
double qSumMax() const
double qSumMin() const
const char * mother() const
Index common(Pair i, Pair j)
Definition: EvtCyclic3.cpp:292
Index next(Index i)
Definition: EvtCyclic3.cpp:142
static EvtId getId(const std::string &name)
Definition: EvtPDL.cpp:287
double e(Index i, Index j) const
Index second(Pair i)
Definition: EvtCyclic3.cpp:264
double jacobian(EvtCyclic3::Pair i, double q) const
double e(EvtCyclic3::Index i, EvtCyclic3::Pair j, double q) const
double qHelAbsMax(EvtCyclic3::Pair i) const
double p(EvtCyclic3::Index i, EvtCyclic3::Pair j, double q) const
double qMax(EvtCyclic3::Pair i, EvtCyclic3::Pair j, double q) const
double p(Index i=AB) const
double qResAbsMax(EvtCyclic3::Pair i) const
double qAbsMax(EvtCyclic3::Pair i) const
static int first
Definition: EvtPDL.cpp:38
bool operator==(const EvtDalitzPlot &other) const
double mAbsMax(EvtCyclic3::Pair i) const
double bigM() const
double cosTh(EvtCyclic3::Pair i1, double q1, EvtCyclic3::Pair i2, double q2) const
Index other(Index i, Index j)
Definition: EvtCyclic3.cpp:156
const EvtDalitzPlot * clone() const
void print() const