CLHEP 2.4.7.1
C++ Class Library for High Energy Physics
Psi2Hydrogen.icc
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id:
12#include <assert.h>
13#include <cmath> // for pow()
14
15namespace Genfun {
17
18// This is the product n (n-1) (n-1)...
19inline double factorial (int n) {
20 if (n<=1) return 1.0;
21 else return n*factorial(n-1);
22}
23
24//
25inline
26Psi2Hydrogen::Psi2Hydrogen(unsigned int n, unsigned int l, unsigned int m):
27 _n(n),
28 _l(l),
29 _m(m)
30{
31 assert(m<=l);
32 create();
33}
34
35inline
37 delete _function;
38}
39
40inline
42_n(right._n),
43_l(right._l),
44_m(right._m)
45{
46 create();
47}
48
49inline
50double Psi2Hydrogen::operator() (const Argument & a) const {
51 assert (a.dimension()==3);
52 return (*_function)(a);
53}
54
55inline
56double Psi2Hydrogen::operator() (double x) const {
57 std::cerr
58 << "Warning. Psi2Hydrogen called with scalar argument"
59 << std::endl;
60 assert(0);
61 return 0;
62}
63
64inline
65unsigned int Psi2Hydrogen::n() const {
66 return _n;
67}
68
69inline
70unsigned int Psi2Hydrogen::l() const {
71 return _l;
72}
73
74inline
75unsigned int Psi2Hydrogen::m() const {
76 return _m;
77}
78
79
80inline
81void Psi2Hydrogen::create() {
82 FixedConstant I(1.0);
83 Variable r;
84 double asq = pow(2.0/_n, 3.0)*factorial(_n-_l-1)/(2.0*_n*factorial(_n+_l));
85 GENFUNCTION ar = (2.0/_n)*r;
86 AssociatedLegendre P(_l, _m);
87 AssociatedLaguerre L(_n-_l-1, 2*_l+1);
88 Exponential exp;
89 Power pow2L(2*_l);
90
91 _function = (asq*exp(ar)*pow2L(ar)*L(ar)*L(ar)%(P*P)%(I*I)).clone();
92
93}
94}
#define FUNCTION_OBJECT_IMP(classname)
virtual AbsFunction * clone() const =0
unsigned int dimension() const
Definition Argument.hh:61
unsigned int m() const
unsigned int n() const
Psi2Hydrogen(unsigned int n, unsigned int l, unsigned int m)
virtual double operator()(double argument) const override
unsigned int l() const
Definition Abs.hh:14
double factorial(int n)
const AbsFunction & GENFUNCTION