ATLAS Offline Software
Loading...
Searching...
No Matches
AFPProtonTransportPolynomial.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4
6
7AFPProtonTransportPolynomial::AFPProtonTransportPolynomial(int n, double c0, double c1, double c2, double c3, double c4,
8 double c5, double c6, double c7, double c8, double c9) {
9 setCoefficients(n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9);
10}
11
15
17 (int n, double c0, double c1, double c2, double c3, double c4,
18 double c5, double c6, double c7, double c8, double c9) {
20 m_coefficients[0] = c0;
21 m_coefficients[1] = c1;
22 m_coefficients[2] = c2;
23 m_coefficients[3] = c3;
24 m_coefficients[4] = c4;
25 m_coefficients[5] = c5;
26 m_coefficients[6] = c6;
27 m_coefficients[7] = c7;
28 m_coefficients[8] = c8;
29 m_coefficients[9] = c9;
30}
31
33 double xn[10];
34 double sum = 0;
35
36 xn[0] = 1;
37 for (int iCoef = 1; iCoef < 10; iCoef++) {
38 xn[iCoef] = xn[iCoef - 1] * x;
39 }
40
41 for (int iCoef = 0; iCoef < 10; iCoef++) {
42 sum += m_coefficients[iCoef] * xn[iCoef];
43 }
44 return sum;
45}
#define x
AFPProtonTransportPolynomial(int n, double c0, double c1=0, double c2=0, double c3=0, double c4=0, double c5=0, double c6=0, double c7=0, double c8=0, double c9=0)
Default constructor of kinRecoPolynomial. Takes number of coefficients and coefficients itself up to ...
double evaluate(double x) const
This function of returns the sum of the polynomial coeficients of a given argument x.
int numCoefficients() const
This function returns the number of coefficients.
void setCoefficients(int n, double c0, double c1=0, double c2=0, double c3=0, double c4=0, double c5=0, double c6=0, double c7=0, double c8=0, double c9=0)
This function sets the coefficients of the polynomial.