/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/Mcgpj/Mcgpj-00-01-04/src/code/src/TLi2.C

Go to the documentation of this file.
00001 #include <cmath>
00002 #include "TLi2.h"
00003 
00004 #define H00 .267652639082732605202e-0
00005 #define H01 .287682072451780916527e-0
00006 #define H02 .228256304407765443676e-1
00007 #define H03 .330143155800177691582e-2
00008 #define H04 .610346084574433927254e-3
00009 #define H05 .129007082934408056818e-3
00010 #define H06 .296683089332297434665e-4
00011 #define H07 .723054765493866154886e-5
00012 #define H08 .183840162262654437189e-5
00013 #define H09 .482749728124851384963e-6
00014 #define H10 .130030954762267291337e-6
00015 #define H11 .357504457581813602892e-7
00016 #define H12 .998842103108304614670e-8
00017 #define H13 .283121494557618801322e-8
00018 #define H14 .824126647619321043570e-9
00019 #define H15 .240539930902255726013e-9
00020 #define H16 .606886706788283640174e-10
00021 #define H17 .171549429260100878638e-10
00022 #define H18 .967569971597286669658e-11
00023 #define H19 .305051035251868842991e-11
00024 
00025 #define K00 -.448414206923646205760e-0  
00026 #define K01  .405465108108164360846e-0
00027 #define K02  .360658873874161845522e-1  
00028 #define K03  .552540640642657203433e-2
00029 #define K04  .105763505171079838462e-2  
00030 #define K05  .228824090740860163934e-3
00031 #define K06  .535125313340340103575e-4  
00032 #define K07  .132073575305965864612e-4
00033 #define K08  .339130422475175972690e-5  
00034 #define K09  .897606968058315434299e-6
00035 #define K10  .243351017811575051344e-6  
00036 #define K11  .672707775328645948125e-7
00037 #define K12  .188813993393826052532e-7  
00038 #define K13  .537309714837069990632e-8
00039 #define K14  .156975759629269910672e-8  
00040 #define K15  .459579714548034691074e-9
00041 #define K16  .116082717316582652134e-9  
00042 #define K17  .328819236160670711131e-10
00043 #define K18  .186463598871037633001e-10  
00044 #define K19  .588984177266277254402e-11
00045 
00046 double TLi2::Li2Cern(const double &x){
00047   static long double pi3  = M_PI*M_PI/3; 
00048   static long double pi6  = M_PI*M_PI/6;
00049   static long double pi12 = M_PI*M_PI/12;
00050   static long double c[20]={0.42996693560813697L, 0.40975987533077105L,
00051                             -0.01858843665014592L, 0.00145751084062268L,
00052                             -0.00014304184442340L, 0.00001588415541880L,
00053                             -0.00000190784959387L, 0.00000024195180854L,
00054                             -0.00000003193341274L, 0.00000000434545063L,
00055                             -0.00000000060578480L, 0.00000000008612098L,
00056                             -0.00000000001244332L, 0.00000000000182256L,
00057                             -0.00000000000027007L, 0.00000000000004042L,
00058                             -0.00000000000000610L, 0.00000000000000093L,
00059                             -0.00000000000000014L, 0.00000000000000002L};
00060   long double h,t,y,s,l,ll,a,alfa,b0,b1,b2,*cp;
00061   static long double two = 2L, one=1L, half=0.5L, zero = 0L;
00062   if(x == one){
00063     h = pi6;
00064   }else if(x == -one){
00065     h = -pi12;
00066   }else{
00067     t = -x;
00068     if(t <= -two){
00069       y =-one/(one + t);
00070       s = one;
00071       l = log(-t);
00072       ll = log(one + one/t);
00073       a =-pi3 + half*(l*l - ll*ll);
00074     }else if(t < -one){
00075       y =-one-t;
00076       s =-one;
00077       a = log(-t);
00078       a =-pi6 + a*(a + log(one + one/t));
00079     }else if(t <= -half){
00080       y =-(one+t)/t;
00081       s = one;
00082       a = log(-t);
00083       a =-pi6 + a*(-half*a+log(one + t));
00084     }else if(t < zero){
00085       y =-t/(one + t);
00086       s =-one;
00087       a = half*log(one + t)*log(one + t);
00088     }else if(t <= one){
00089       y = t;
00090       s = one;
00091       a = zero;
00092     }else{
00093       y = one/t;
00094       s =-one;
00095       a = pi6 + half*log(t)*log(t);
00096     }
00097     h    = y + y - one;
00098     alfa = h + h;
00099     b1   = zero;
00100     b2   = zero;
00101     cp   = &c[19];
00102     for(int i = 20; i; i--,cp--){
00103       b0 = *cp + alfa*b1 - b2;
00104       b2 = b1;
00105       b1 = b0;
00106     }
00107     h    = -(s*(b0-h*b2)+a);
00108   }
00109   //  std::cout<<"TLI2 "<<x<<" "<<h<<std::endl;
00110   return h;
00111 }
00112 
00113 double TLi2::Li2My(const double &x){
00114   const double  pi3  =  M_PI*M_PI/3; 
00115   const double  pi6  =  M_PI*M_PI/6;
00116   const double mpi12 = -M_PI*M_PI/12;
00117   const double two = 2, one=1, half=0.5, zero = 0;
00118   static double t,h,y,s,a,l,ll;
00119   if ( x ==  one) return  pi6;
00120   if ( x == -one) return mpi12;
00121   t = -x;
00122   if(t <= -two){
00123     // 2 < x < +inf
00124     y =-one/(one + t);
00125     s = one;
00126     l = log(-t);
00127     ll= log(one + one/t);
00128     a =-pi3 + half*(l*l - ll*ll);
00129   }else if(t < -one){
00130     // 1 < x < 2
00131     y =-one-t;
00132     s =-one;
00133     a = log(-t);
00134     a =-pi6 + a*(a + log(one + one/t));
00135   }else if(t <= -half){
00136     // 0.5 < x < 1
00137     y =-(one+t)/t;
00138     s = one;
00139     a = log(-t);
00140     a =-pi6 + a*(-half*a+log(one + t));
00141   }else if(t < zero){
00142     // 0 < x < 0.5
00143     h = 4*x - one;
00144     // minimax approximation
00145     return 
00146       H00+(H01+(H02+(H03+(H04+(H05+(H06+(H07+(H08+(H09+(H10+(H11+(H12+(H13+(H14+(H15+(H16+(H17+(H18+H19*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h;
00147   }else if(t <= one){
00148     // -1 < x < 0
00149     y = t;
00150     s = one;
00151     a = zero;
00152   }else{
00153     // -inf < x < -1
00154     y = one/t;
00155     s =-one;
00156     a = log(t);
00157     a = pi6 + half*a*a;
00158   }
00159   h = -two*y + one;
00160   // minimax approximation in  -1 < x < 0 range
00161   return
00162     (K00+(K01+(K02+(K03+(K04+(K05+(K06+(K07+(K08+(K09+(K10+(K11+(K12+(K13+(K14+(K15+(K16+(K17+(K18+K19*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*h)*s-a;
00163 }

Generated on Tue Nov 29 23:12:41 2016 for BOSS_7.0.2 by  doxygen 1.4.7