CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
VoigtProfile.cc File Reference
#include "CLHEP/GenericFunctions/VoigtProfile.hh"
#include "CLHEP/GenericFunctions/Variable.hh"
#include <cmath>
#include <complex>

Go to the source code of this file.

Namespaces

namespace  Genfun
 

Functions

double Pow (double x, int n)
 
std::complex< doublenwwerf (std::complex< double > z)
 

Function Documentation

◆ nwwerf()

std::complex< double > nwwerf ( std::complex< double z)
inline

Definition at line 22 of file VoigtProfile.cc.

22 {
23 std::complex<double> zh,r[38],s,t,v;
24
25 const double z1 = 1;
26 const double hf = z1/2;
27 const double z10 = 10;
28 const double c1 = 74/z10;
29 const double c2 = 83/z10;
30 const double c3 = z10/32;
31 const double c4 = 16/z10;
32 const double c = 1.12837916709551257;
33 const double p = Pow(2.0*c4,33);
34
35 double x=z.real();
36 double y=z.imag();
37 double xa=(x >= 0) ? x : -x;
38 double ya=(y >= 0) ? y : -y;
39 if(ya < c1 && xa < c2){
40 zh = std::complex<double>(ya+c4,xa);
41 r[37]= std::complex<double>(0,0);
42 // do 1 n = 36,1,-1
43 for(int n = 36; n>0; n--){
44 t=zh+double(n)*std::conj(r[n+1]);
45 r[n]=hf*t/std::norm(t);
46 }
47 double xl=p;
48 s=std::complex<double>(0,0);
49 // do 2 n = 33,1,-1
50 for(int k=33; k>0; k--){
51 xl=c3*xl;
52 s=r[k]*(s+xl);
53 }
54 v=c*s;
55 }
56 else{
57 zh=std::complex<double>(ya,xa);
58 r[1]=std::complex<double>(0,0);
59 // do 3 n = 9,1,-1
60 for(int n=9;n>0;n--){
61 t=zh+double(n)*std::conj(r[1]);
62 r[1]=hf*t/std::norm(t);
63 }
64 v=c*r[1];
65 }
66 if(ya == 0) v= std::complex<double>(exp(-xa*xa),v.imag());
67 if(y < 0) {
68 v=2.0*std::exp(std::complex<double>(-xa,-ya)*std::complex<double>(xa,ya))-v;
69 if(x > 0) v=std::conj(v);
70 }
71 else{
72 if(x < 0) v=std::conj(v);
73 }
74 return v;
75}
double Pow(double x, int n)
Definition: VoigtProfile.cc:14
#define double(obj)
Definition: excDblThrow.cc:32

Referenced by Genfun::VoigtProfile::operator()().

◆ Pow()

double Pow ( double  x,
int  n 
)
inline

Definition at line 14 of file VoigtProfile.cc.

14 {
15 double val=1;
16 for(int i=0;i<n;i++){
17 val=val*x;
18 }
19 return val;
20}

Referenced by nwwerf().