Garfield++ 3.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
PolLeg.cpp
Go to the documentation of this file.
3
4/*
5Copyright (c) 2003 I. B. Smirnov
6
7Permission to use, copy, modify, distribute and sell this file
8and its documentation for any purpose is hereby granted without fee,
9provided that the above copyright notice, this permission notice,
10and notices about any modifications of the original text
11appear in all copies and in supporting documentation.
12It is provided "as is" without express or implied warranty.
13*/
14
15namespace Heed {
16
17double polleg(const int l, const double x) {
18 mfunname("double polleg(int l, double x)");
19 check_econd11(l, < 0, mcerr);
20 check_econd11a(l, > 6, "not implemented", mcerr);
21 switch (l) {
22 case 0:
23 return 1.0;
24 case 1:
25 return x;
26 case 2:
27 return 0.5 * (3.0 * x * x - 1.0);
28 case 3:
29 return 0.5 * (5.0 * x * x * x - 3.0 * x);
30 case 4: {
31 const double x2 = x * x;
32 return 1.0 / 8.0 * (35.0 * x2 * x2 - 30.0 * x2 + 3.0);
33 }
34 case 5: {
35 const double x2 = x * x;
36 const double x3 = x2 * x;
37 return 1.0 / 8.0 * (63.0 * x3 * x2 - 70.0 * x3 + 15.0 * x);
38 }
39 case 6: {
40 const double x2 = x * x;
41 const double x4 = x2 * x2;
42 return 1.0 / 16.0 * (231.0 * x4 * x2 - 315.0 * x4 + 105.0 * x2 - 5.0);
43 }
44 default:
45 return 0.0;
46 }
47 return 0.0; // should never happen
48}
49}
#define check_econd11(a, signb, stream)
Definition: FunNameStack.h:155
#define check_econd11a(a, signb, add, stream)
Definition: FunNameStack.h:172
#define mfunname(string)
Definition: FunNameStack.h:45
Definition: BGMesh.cpp:6
double polleg(const int l, const double x)
Definition: PolLeg.cpp:17
#define mcerr
Definition: prstream.h:128