CLHEP  2.4.7.2
C++ Class Library for High Energy Physics
SphericalBessel.icc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id: SphericalBessel.icc,v 1.4 2010/06/16 18:22:01 garren Exp $
3 #include "CLHEP/GenericFunctions/Sin.hh"
4 #include "CLHEP/GenericFunctions/Cos.hh"
5 #include "CLHEP/GenericFunctions/Variable.hh"
6 #include "gsl/gsl_sf_bessel.h"
7 #include <signal.h>
8 
9 namespace Genfun {
10 
11 FUNCTION_OBJECT_IMP(SphericalBessel)
12 
13 //---------------------------------------------------------------------------------//
14 // Implementation notes: The Spherical Bessel function is implemented in terms of //
15 // lower order spherical bessel functions. This is possible thanks to a recursion //
16 // relation. //
17 //---------------------------------------------------------------------------------//
18 
19 inline
20 SphericalBessel::SphericalBessel(unsigned int l):
21  _l(l)
22 {
23 }
24 
25 inline
26 SphericalBessel::~SphericalBessel() {
27 }
28 
29 inline
30 SphericalBessel::SphericalBessel(const SphericalBessel & right):
31 _l(right._l)
32 {
33 }
34 
35 inline
36 double SphericalBessel::operator() (double x) const {
37  //
38  // First try the GSL implementation:
39  //
40  gsl_sf_result result;
41  int status =gsl_sf_bessel_jl_e(_l, x,&result);
42  if (status!=0) {
43  std::cerr << "Warning, GSL function gsl_sf_bessel_jl_impl"
44  << " return code" << status << std::endl;
45  raise(SIGFPE);
46  }
47  return result.val;
48 }
49 
50 inline
51 unsigned int SphericalBessel::l() const {
52  return _l;
53 }
54 
55 } // end namespace Genfun
Definition: Airy.icc:9