8#include "GaudiKernel/MsgStream.h"
38 const unsigned order) {
39 const auto [minT, maxT] =
interval(dataPoints);
44 fitter.fit_parameters(
normalizeDomain(dataPoints), 1, dataPoints.size(), legendre);
45 for (
unsigned k = 0; k < fitter.coefficients().size(); k++) {
46 pars.emplace_back(fitter.coefficients()[k]);
52 const unsigned order) {
54 const auto [minT, maxT] =
interval(dataPoints);
60 fitter.fit_parameters(
normalizeDomain(dataPoints), 1, dataPoints.size(), chebyshev);
61 for (
unsigned k = 0; k < fitter.coefficients().size(); k++) {
62 pars.emplace_back(fitter.coefficients()[k]);
67 const unsigned order) {
68 const auto [minT, maxT] =
interval(dataPoints);
72 fitter.fit_parameters(
normalizeDomain(dataPoints), 1, dataPoints.size(), simplePoly);
73 for (
unsigned k = 0; k < fitter.coefficients().size(); k++) {
74 pars.emplace_back(fitter.coefficients()[k]);
80 return std::make_unique<RtChebyshev>(
chebyFit(dataPoints, order));
83 return std::make_unique<TrChebyshev>(
chebyFit(dataPoints, order));
86 return std::make_unique<RtResolutionChebyshev>(
chebyFit(dataPoints, order));
89 const double relUnc,
const unsigned order) {
91 chebyCoeff.erase(chebyCoeff.begin(), chebyCoeff.begin() +2);
92 return std::make_unique<RadiusResolutionChebyshev>(chebyCoeff, rtRelPtr);
96 return std::make_unique<RtLegendre>(
legendreFit(dataPoints, order));
99 return std::make_unique<TrLegendre>(
legendreFit(dataPoints, order));
102 return std::make_unique<RtSimplePolynomial>(
simplePolyFit(dataPoints, order));
105 return std::make_unique<TrSimplePolynomial>(
simplePolyFit(dataPoints, order));
114 CalibFunc ::ParVec pars(2 * dataPoints.size());
115 for (
unsigned i = 0; i < dataPoints.size(); i++) {
116 pars[2 * i] = dataPoints[i].x1();
117 pars[2 * i + 1] = dataPoints[i].x2();
122 unsigned nb_points(100);
123 double bin_width((rt.
tUpper() - rt.
tLower()) /
static_cast<double>(nb_points - 1));
124 std::vector<double> rt_param(nb_points + 2);
129 rt_param[0] = rt.
tLower();
130 rt_param[1] = bin_width;
131 for (
unsigned k = 0; k < nb_points; k++) { rt_param[k + 2] = rt.
radius(rt.
tLower() + k * bin_width); }
132 return std::make_unique<RtRelationLookUp>(rt_param);
This class performs a fit of a linear combination of base functions to a set of sample points.
std::vector< double > ParVec
This class class provides a Chebyshev polynomial of order k.
This class provides a legendre polynomial of order k.
static std::unique_ptr< ITrRelation > getTrLegendre(const std::vector< SamplePoint > &dataPoints, const unsigned order)
Converts a list of t(r) data points into a t(r) relation expressed as a series of legendre polynomial...
static std::unique_ptr< IRtRelation > getRtChebyshev(const std::vector< SamplePoint > &dataPoints, const unsigned order)
Converts a list of r-t data points into a r(t) relation expressed as a series of chebychev polynomial...
static std::unique_ptr< ITrRelation > getTrChebyshev(const std::vector< SamplePoint > &dataPoints, const unsigned order)
Converts a list of r-t data points into a t(r) relation expressed as a series of chebychev polynomial...
static std::unique_ptr< IRtRelation > getRtSimplePoly(const std::vector< SamplePoint > &dataPoints, const unsigned order)
Converts a list of r(t) data points into a r(t) relation expressed as a series of elementary monomoni...
static std::unique_ptr< IRtResolution > getResoChebyshev(const std::vector< SamplePoint > &dataPoints, const unsigned order)
Converts a list of reso - t into a reso(t) relation expressed as a series of chebychev polynomials.
static std::unique_ptr< IRtRelation > getRtLegendre(const std::vector< SamplePoint > &dataPoints, const unsigned order)
Converts a list of r-t data points into a r(t) relation expressed as a series of legendre polynomials...
static CalibFunc::ParVec legendreFit(const std::vector< SamplePoint > &dataPoints, const unsigned order)
Executes the fit of Legendre polynomials to the data points.
static CalibFunc::ParVec chebyFit(const std::vector< SamplePoint > &dataPoints, const unsigned order)
Executes the fit of chebychev polynomials to the data points.
static std::unique_ptr< IRtRelation > getRtRelationLookUp(const std::vector< SamplePoint > &sample_points)
static std::unique_ptr< ITrRelation > getTrSimplePoly(const std::vector< SamplePoint > &dataPoints, const unsigned order)
Converts a list of t(r) data points into a t(r) relation expressed as a series of elementary monomoni...
static CalibFunc::ParVec simplePolyFit(const std::vector< SamplePoint > &dataPoints, const unsigned order)
Exectues the fit of simple monomials to the data points.
This class contains the implementation of an r(t) relationship parameterized as support points to a c...
virtual double tLower() const override final
get the lower drift-time bound
virtual double tUpper() const override final
get the upper drift-time bound
virtual double radius(double t) const override final
get the radius corresponding to the drift time t; 0 or 14.6 is returned if t is outside the range
This class provides the simple polynomials x^k (k=0, 1, ...) as base functions for fits.
singleton-like access to IMessageSvc via open function and helper
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
std::pair< double, double > interval(const std::vector< SamplePoint > &points)
Returns the interval covered by the sample points.
GeoModel::TransientConstSharedPtr< IRtRelation > IRtRelationPtr
std::vector< SamplePoint > resoFromRadius(const std::vector< SamplePoint > &points, const double uncert)
Creates a new vector of sample points where the x2 coordinate becomes the x1 coordinate and the resol...
std::vector< SamplePoint > normalizeDomain(const std::vector< SamplePoint > &dataPoints)
Normalizes the domain of the samples points to the interval -1 to 1.