CLHEP 2.0.4.7 Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

Psi2Hydrogen.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: 
00003 #include "CLHEP/GenericFunctions/Psi2Hydrogen.hh"
00004 #include "CLHEP/GenericFunctions/AssociatedLegendre.hh"
00005 #include "CLHEP/GenericFunctions/AssociatedLaguerre.hh"
00006 #include "CLHEP/GenericFunctions/Power.hh"
00007 #include "CLHEP/GenericFunctions/Exponential.hh"
00008 #include "CLHEP/GenericFunctions/FixedConstant.hh"
00009 #include "CLHEP/GenericFunctions/Psi2Hydrogen.hh"
00010 #include "CLHEP/GenericFunctions/Variable.hh"
00011 #include "CLHEP/GenericFunctions/Power.hh"
00012 #include <assert.h>
00013 #include <cmath>      // for pow()
00014 
00015 namespace Genfun {
00016 FUNCTION_OBJECT_IMP(Psi2Hydrogen)
00017 
00018 // This is the product n (n-1) (n-1)... 
00019 inline double factorial (int n) {
00020   if (n<=1) return 1.0;
00021   else return n*factorial(n-1);
00022 }
00023 
00024 //
00025 Psi2Hydrogen::Psi2Hydrogen(unsigned int n, unsigned int l, unsigned int m):
00026   _n(n),
00027   _l(l),
00028   _m(m)
00029 {
00030   assert(m<=l);
00031   create();
00032 }
00033 
00034 Psi2Hydrogen::~Psi2Hydrogen() {
00035   delete _function;
00036 }
00037 
00038 Psi2Hydrogen::Psi2Hydrogen(const Psi2Hydrogen & right):
00039 _n(right._n),
00040 _l(right._l),
00041 _m(right._m)
00042 {
00043   create();
00044 }
00045 
00046 
00047 double Psi2Hydrogen::operator() (const Argument & a) const {
00048   assert (a.dimension()==3);
00049   return (*_function)(a);
00050 }
00051 
00052 
00053 double Psi2Hydrogen::operator() (double x) const {
00054   std::cerr
00055     << "Warning. Psi2Hydrogen called with scalar argument"
00056     << std::endl;
00057   assert(0);
00058   return 0;
00059 }
00060 
00061 unsigned int Psi2Hydrogen::n() const {
00062   return _n;
00063 } 
00064 
00065 unsigned int Psi2Hydrogen::l() const {
00066   return _l;
00067 }
00068 
00069 unsigned int Psi2Hydrogen::m() const {
00070   return _m;
00071 }
00072 
00073 
00074 void Psi2Hydrogen::create() {
00075   FixedConstant I(1.0);
00076   Variable r;
00077   double asq = pow(2.0/_n, 3.0)*factorial(_n-_l-1)/(2.0*_n*factorial(_n+1));
00078   GENFUNCTION ar = (2.0/_n)*r;
00079   AssociatedLegendre P(_l, _m);
00080   AssociatedLaguerre L(_n-_l-1, 2*_l+1);
00081   Exponential exp;
00082   Power pow2L(2*_l);
00083   
00084   _function = (asq*exp(ar)*pow2L(ar)*L(ar)*L(ar)%(P*P)%(I*I)).clone();
00085 
00086 }
00087 }

Generated on Thu Jul 1 22:02:30 2010 for CLHEP by  doxygen 1.4.7