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