File indexing completed on 2025-01-18 09:54:35
0001
0002
0003 #include "CLHEP/GenericFunctions/Psi2Hydrogen.hh"
0004 #include "CLHEP/GenericFunctions/AssociatedLegendre.hh"
0005 #include "CLHEP/GenericFunctions/AssociatedLaguerre.hh"
0006 #include "CLHEP/GenericFunctions/Power.hh"
0007 #include "CLHEP/GenericFunctions/Exponential.hh"
0008 #include "CLHEP/GenericFunctions/FixedConstant.hh"
0009 #include "CLHEP/GenericFunctions/Psi2Hydrogen.hh"
0010 #include "CLHEP/GenericFunctions/Variable.hh"
0011 #include "CLHEP/GenericFunctions/Power.hh"
0012 #include <assert.h>
0013 #include <cmath> // for pow()
0014
0015 namespace Genfun {
0016 FUNCTION_OBJECT_IMP(Psi2Hydrogen)
0017
0018
0019 inline double factorial (int n) {
0020 if (n<=1) return 1.0;
0021 else return n*factorial(n-1);
0022 }
0023
0024
0025 inline
0026 Psi2Hydrogen::Psi2Hydrogen(unsigned int n, unsigned int l, unsigned int m):
0027 _n(n),
0028 _l(l),
0029 _m(m)
0030 {
0031 assert(m<=l);
0032 create();
0033 }
0034
0035 inline
0036 Psi2Hydrogen::~Psi2Hydrogen() {
0037 delete _function;
0038 }
0039
0040 inline
0041 Psi2Hydrogen::Psi2Hydrogen(const Psi2Hydrogen & right):
0042 _n(right._n),
0043 _l(right._l),
0044 _m(right._m)
0045 {
0046 create();
0047 }
0048
0049 inline
0050 double Psi2Hydrogen::operator() (const Argument & a) const {
0051 assert (a.dimension()==3);
0052 return (*_function)(a);
0053 }
0054
0055 inline
0056 double Psi2Hydrogen::operator() (double x) const {
0057 std::cerr
0058 << "Warning. Psi2Hydrogen called with scalar argument"
0059 << std::endl;
0060 assert(0);
0061 return 0;
0062 }
0063
0064 inline
0065 unsigned int Psi2Hydrogen::n() const {
0066 return _n;
0067 }
0068
0069 inline
0070 unsigned int Psi2Hydrogen::l() const {
0071 return _l;
0072 }
0073
0074 inline
0075 unsigned int Psi2Hydrogen::m() const {
0076 return _m;
0077 }
0078
0079
0080 inline
0081 void Psi2Hydrogen::create() {
0082 FixedConstant I(1.0);
0083 Variable r;
0084 double asq = pow(2.0/_n, 3.0)*factorial(_n-_l-1)/(2.0*_n*factorial(_n+_l));
0085 GENFUNCTION ar = (2.0/_n)*r;
0086 AssociatedLegendre P(_l, _m);
0087 AssociatedLaguerre L(_n-_l-1, 2*_l+1);
0088 Exponential exp;
0089 Power pow2L(2*_l);
0090
0091 _function = (asq*exp(ar)*pow2L(ar)*L(ar)*L(ar)%(P*P)%(I*I)).clone();
0092
0093 }
0094 }