ATLAS Offline Software
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 
7 AFPProtonTransportPolynomial::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 
13  return m_numCoefficients;
14 }
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 }
AFPProtonTransportPolynomial::m_numCoefficients
int m_numCoefficients
Definition: AFPProtonTransportPolynomial.h:26
AFPProtonTransportPolynomial::setCoefficients
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.
Definition: AFPProtonTransportPolynomial.cxx:17
extractSporadic.c1
c1
Definition: extractSporadic.py:134
AFPProtonTransportPolynomial::m_coefficients
double m_coefficients[10]
Definition: AFPProtonTransportPolynomial.h:27
AFPProtonTransportPolynomial::evaluate
double evaluate(double x) const
This function of returns the sum of the polynomial coeficients of a given argument x.
Definition: AFPProtonTransportPolynomial.cxx:32
AFPProtonTransportPolynomial.h
x
#define x
hotSpotInTAG.c0
c0
Definition: hotSpotInTAG.py:192
python.DataFormatRates.c3
c3
Definition: DataFormatRates.py:127
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
beamspotman.n
n
Definition: beamspotman.py:731
AFPProtonTransportPolynomial::numCoefficients
int numCoefficients() const
This function returns the number of coefficients.
Definition: AFPProtonTransportPolynomial.cxx:12
python.DataFormatRates.c2
c2
Definition: DataFormatRates.py:123
AFPProtonTransportPolynomial::AFPProtonTransportPolynomial
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 ...
Definition: AFPProtonTransportPolynomial.cxx:7