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.
EvtDiLog.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/EvtDiLog.hh"
22 
23 #include <cmath>
24 
25 //-----------------------------------------------------------------------------
26 // Implementation file for class : EvtDiLog
27 //
28 // 2007-01-23 : Patrick Robbe
29 //-----------------------------------------------------------------------------
30 
31 double EvtDiLog::DiLog( double x )
32 {
33  double h, t, y, s, a, alfa, b0, b1, b2;
34  if ( x == 1. )
35  h = PI6;
36  else if ( x == -1. )
37  h = -PI12;
38  else {
39  t = -x;
40  if ( t <= -2. ) {
41  y = -1. / ( 1. + t );
42  s = 1.;
43  a = -PI3 + HF * ( std::pow( log( -t ), 2 ) -
44  std::pow( log( 1. + 1. / t ), 2 ) );
45  } else if ( t < -1. ) {
46  y = -1. - t;
47  s = -1.;
48  a = log( -t );
49  a = -PI6 + a * ( a + log( 1. + 1. / t ) );
50  } else if ( t <= -HF ) {
51  y = -( 1. + t ) / t;
52  s = 1.;
53  a = log( -t );
54  a = -PI6 + a * ( -HF * a + log( 1. + t ) );
55  } else if ( t < 0 ) {
56  y = -t / ( 1. + t );
57  s = -1.;
58  a = HF * std::pow( log( 1. + t ), 2 );
59  } else if ( t <= 1. ) {
60  y = t;
61  s = 1.;
62  a = 0.;
63  } else {
64  y = 1. / t;
65  s = -1.;
66  a = PI6 + HF * std::pow( log( t ), 2 );
67  }
68 
69  h = y + y - 1.;
70  alfa = h + h;
71  b1 = 0.;
72  b2 = 0.;
73  for ( int i = 19; i >= 0; --i ) {
74  b0 = C[i] + alfa * b1 - b2;
75  b2 = b1;
76  b1 = b0;
77  }
78 
79  h = -( s * ( b0 - h * b2 ) + a );
80  }
81 
82  return h;
83 }
static const double HF
Definition: EvtDiLog.hh:37
static const double PI3
Definition: EvtDiLog.hh:39
static const double PI12
Definition: EvtDiLog.hh:41
static const double PI6
Definition: EvtDiLog.hh:40
double DiLog(double x)
Definition: EvtDiLog.cpp:31