|
ATLAS Offline Software
|
Go to the documentation of this file.
6 #ifndef MUONCALIBMATH_LEGENDREPOLYS_H
7 #define MUONCALIBMATH_LEGENDREPOLYS_H
12 #define POLYSWITCH(order , x) \
14 return Legendre::poly<order>(x); \
17 #define DERIVPOLYSWITICH(l, d, x) \
19 return Legendre::derivative<l,d>(x); \
24 #define DERIVORDERSWITCH(l, d, x) \
27 DERIVPOLYSWITICH(0, d, x) \
28 DERIVPOLYSWITICH(1, d, x) \
29 DERIVPOLYSWITICH(2, d, x) \
30 DERIVPOLYSWITICH(3, d, x) \
31 DERIVPOLYSWITICH(4, d, x) \
32 DERIVPOLYSWITICH(5, d, x) \
33 DERIVPOLYSWITICH(6, d, x) \
34 DERIVPOLYSWITICH(7, d, x) \
35 DERIVPOLYSWITICH(8, d, x) \
36 DERIVPOLYSWITICH(9, d, x) \
37 DERIVPOLYSWITICH(10, d, x) \
38 DERIVPOLYSWITICH(11, d, x) \
39 DERIVPOLYSWITICH(12, d, x) \
40 DERIVPOLYSWITICH(13, d, x) \
41 DERIVPOLYSWITICH(14, d, x) \
42 DERIVPOLYSWITICH(15, d, x) \
43 DERIVPOLYSWITICH(16, d, x) \
63 constexpr
unsigned long binomial(
unsigned int n,
unsigned k) {
73 constexpr
double coeff(
unsigned int l,
unsigned int k) {
77 const double a_k = -(1.*(
l-
k +2)*(
l+
k-1)) / (1.*(
k * (
k-1))) *
coeff(
l,
k-2);
80 unsigned fl = (
l -
l %2) /2;
89 template <
unsigned int l,
unsigned int k>
92 if constexpr (
k > 1) {
103 template <
unsigned int l,
unsigned int k,
unsigned int d>
106 if constexpr(k <= l && k>=
d) {
108 const double a_n =
coeff(
l,
k) * powFac;
115 template <
unsigned int l>
116 constexpr
double poly(
const double x) {
117 return polySum<l,l>(
x);
119 template <
unsigned int l,
unsigned d>
121 return derivativeSum<l,l,d>(
x);
152 const unsigned int derivOrder){
154 switch (derivOrder) {
174 #undef DERIVPOLYSWITICH
constexpr double derivativeSum(const double x)
Assembles the n-th derivative of the legendre polynomial.
double binom(int n, int k)
constexpr double polySum(const double x)
Assembles the sum of the legendre monomials.
constexpr double legendreDeriv(const unsigned int l, const double x, const unsigned int derivOrder)
constexpr double derivative(const double x)
constexpr double poly(const double x)
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
#define DERIVORDERSWITCH(l, d, x)
constexpr unsigned long binomial(unsigned int n, unsigned k)
Calculates the binomial coefficient at compile time.
constexpr double legendrePoly(const unsigned int l, const double x)
constexpr double coeff(unsigned int l, unsigned int k)
Calculates the n-th coefficient of the legendre polynomial series.
#define POLYSWITCH(order, x)
constexpr unsigned long factorial(int n)
Evaluated the n-th factorial at compile time.