CLHEP  2.4.7.2
C++ Class Library for High Energy Physics
Psi2Hydrogen.icc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id:
3 #include "CLHEP/GenericFunctions/Psi2Hydrogen.hh"
4 #include "CLHEP/GenericFunctions/AssociatedLegendre.hh"
5 #include "CLHEP/GenericFunctions/AssociatedLaguerre.hh"
6 #include "CLHEP/GenericFunctions/Power.hh"
7 #include "CLHEP/GenericFunctions/Exponential.hh"
8 #include "CLHEP/GenericFunctions/FixedConstant.hh"
9 #include "CLHEP/GenericFunctions/Psi2Hydrogen.hh"
10 #include "CLHEP/GenericFunctions/Variable.hh"
11 #include "CLHEP/GenericFunctions/Power.hh"
12 #include <assert.h>
13 #include <cmath> // for pow()
14 
15 namespace Genfun {
16 FUNCTION_OBJECT_IMP(Psi2Hydrogen)
17 
18 // This is the product n (n-1) (n-1)...
19 inline double factorial (int n) {
20  if (n<=1) return 1.0;
21  else return n*factorial(n-1);
22 }
23 
24 //
25 inline
26 Psi2Hydrogen::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 
35 inline
36 Psi2Hydrogen::~Psi2Hydrogen() {
37  delete _function;
38 }
39 
40 inline
41 Psi2Hydrogen::Psi2Hydrogen(const Psi2Hydrogen & right):
42 _n(right._n),
43 _l(right._l),
44 _m(right._m)
45 {
46  create();
47 }
48 
49 inline
50 double Psi2Hydrogen::operator() (const Argument & a) const {
51  assert (a.dimension()==3);
52  return (*_function)(a);
53 }
54 
55 inline
56 double 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 
64 inline
65 unsigned int Psi2Hydrogen::n() const {
66  return _n;
67 }
68 
69 inline
70 unsigned int Psi2Hydrogen::l() const {
71  return _l;
72 }
73 
74 inline
75 unsigned int Psi2Hydrogen::m() const {
76  return _m;
77 }
78 
79 
80 inline
81 void 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 }
Definition: Airy.icc:9
double factorial(int n)