Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:35

0001 // -*- C++ -*-
0002 // $Id: SphericalBessel.icc,v 1.4 2010/06/16 18:22:01 garren Exp $
0003 #include "CLHEP/GenericFunctions/Sin.hh"
0004 #include "CLHEP/GenericFunctions/Cos.hh"
0005 #include "CLHEP/GenericFunctions/Variable.hh"
0006 #include "gsl/gsl_sf_bessel.h"
0007 #include <signal.h>
0008 
0009 namespace Genfun {
0010 
0011 FUNCTION_OBJECT_IMP(SphericalBessel)
0012 
0013 //---------------------------------------------------------------------------------//
0014 // Implementation notes:  The Spherical Bessel function is implemented in terms of //
0015 // lower order spherical bessel functions.  This is possible thanks to a recursion //
0016 // relation.                                                                       //
0017 //---------------------------------------------------------------------------------//
0018 
0019 inline
0020 SphericalBessel::SphericalBessel(unsigned int l):
0021   _l(l)
0022 {
0023 }
0024 
0025 inline
0026 SphericalBessel::~SphericalBessel() {
0027 }
0028 
0029 inline
0030 SphericalBessel::SphericalBessel(const SphericalBessel & right):
0031 _l(right._l)
0032 {
0033 }
0034 
0035 inline
0036 double SphericalBessel::operator() (double x) const {
0037   //
0038   // First try the GSL implementation:
0039   //
0040   gsl_sf_result result;
0041   int status =gsl_sf_bessel_jl_e(_l, x,&result);
0042   if (status!=0) {
0043     std::cerr << "Warning, GSL function gsl_sf_bessel_jl_impl" 
0044           << " return code" << status << std::endl;
0045     raise(SIGFPE);
0046   }
0047   return result.val;
0048 }
0049 
0050 inline
0051 unsigned int SphericalBessel::l() const {
0052   return _l;
0053 }
0054 
0055 } // end namespace Genfun