Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Static Public Member Functions | Static Private Member Functions | List of all members
MuonCalib::RtFromPoints Class Reference

#include <RtFromPoints.h>

Collaboration diagram for MuonCalib::RtFromPoints:

Static Public Member Functions

static std::unique_ptr< IRtRelationgetRtChebyshev (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 polynomials. More...
 
static std::unique_ptr< ITrRelationgetTrChebyshev (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 polynomials. More...
 
static std::unique_ptr< IRtResolutiongetResoChebyshev (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. More...
 
static std::unique_ptr< IRtResolutiongetResoChebyshev (const std::vector< SamplePoint > &dataPoints, const IRtRelationPtr rtRelPtr, const double relUnc, const unsigned order)
 Converts a list of sample points into a drift radius resolution function. More...
 
static std::unique_ptr< IRtRelationgetRtLegendre (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. More...
 
static std::unique_ptr< ITrRelationgetTrLegendre (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 polynomials. More...
 
static std::unique_ptr< IRtRelationgetRtSimplePoly (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 monomonials. More...
 
static std::unique_ptr< ITrRelationgetTrSimplePoly (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 monomonials. More...
 
static std::unique_ptr< IRtRelationgetRtRelationLookUp (const std::vector< SamplePoint > &sample_points)
 

Static Private Member Functions

static CalibFunc::ParVec chebyFit (const std::vector< SamplePoint > &dataPoints, const unsigned order)
 Executes the fit of chebychev polynomials to the data points. More...
 
static CalibFunc::ParVec legendreFit (const std::vector< SamplePoint > &dataPoints, const unsigned order)
 Executes the fit of Legendre polynomials to the data points. More...
 
static CalibFunc::ParVec simplePolyFit (const std::vector< SamplePoint > &dataPoints, const unsigned order)
 Exectues the fit of simple monomials to the data points. More...
 

Detailed Description

This class allows the user to retrieve an RtChebyshev or RtRelationLookUp object corresponding to a set of (r, t) points.

Definition at line 22 of file RtFromPoints.h.

Member Function Documentation

◆ chebyFit()

CalibFunc::ParVec RtFromPoints::chebyFit ( const std::vector< SamplePoint > &  dataPoints,
const unsigned  order 
)
staticprivate

Executes the fit of chebychev polynomials to the data points.

Parameters
dataPointsData points to fit. No normalization of the domain required
orderNumber of Chebychev polynomials to use in the fit

Definition at line 51 of file RtFromPoints.cxx.

52  {
53 
54  const auto [minT, maxT] = interval(dataPoints);
55  CalibFunc::ParVec pars{minT, maxT};
57  ChebyshevPolynomial chebyshev{}; // Chebyshev polynomial
58 
59 
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]);
63  }
64  return pars;
65 }

◆ getResoChebyshev() [1/2]

std::unique_ptr< IRtResolution > RtFromPoints::getResoChebyshev ( const std::vector< SamplePoint > &  dataPoints,
const IRtRelationPtr  rtRelPtr,
const double  relUnc,
const unsigned  order 
)
static

Converts a list of sample points into a drift radius resolution function.

The resolution is parametrized as a series of Chebychev polynomials.

Parameters
dataPointsList of data points to convert. The points need to have a resolution attached
rtRelPtrPointer to the rt-relation acting as mediator from t -> r
relUncRelative uncertainty on each point.
orderOrder of the chebychev polynomial

Definition at line 88 of file RtFromPoints.cxx.

89  {
90  std::vector<double> chebyCoeff = chebyFit(resoFromRadius(dataPoints, relUnc), order);
91  chebyCoeff.erase(chebyCoeff.begin(), chebyCoeff.begin() +2);
92  return std::make_unique<RadiusResolutionChebyshev>(chebyCoeff, rtRelPtr);
93 }

◆ getResoChebyshev() [2/2]

std::unique_ptr< IRtResolution > RtFromPoints::getResoChebyshev ( const std::vector< SamplePoint > &  dataPoints,
const unsigned  order 
)
static

Converts a list of reso - t into a reso(t) relation expressed as a series of chebychev polynomials.

Parameters
dataPointsList of data points to be converted x1 -> drift time & x2 -> resolution
orderNumber of chebychev polynomials to fit

Definition at line 85 of file RtFromPoints.cxx.

85  {
86  return std::make_unique<RtResolutionChebyshev>(chebyFit(dataPoints, order));
87 }

◆ getRtChebyshev()

std::unique_ptr< IRtRelation > RtFromPoints::getRtChebyshev ( const std::vector< SamplePoint > &  dataPoints,
const unsigned  order 
)
static

Converts a list of r-t data points into a r(t) relation expressed as a series of chebychev polynomials.

Parameters
dataPointsList of data points to be converted x1 -> drift time & x2 -> drift radius
orderNumber of chebychev polynomials to fit

Definition at line 79 of file RtFromPoints.cxx.

79  {
80  return std::make_unique<RtChebyshev>(chebyFit(dataPoints, order));
81 } // end RtFromPoints::getRtChebyshev

◆ getRtLegendre()

std::unique_ptr< IRtRelation > RtFromPoints::getRtLegendre ( const std::vector< SamplePoint > &  dataPoints,
const unsigned  order 
)
static

Converts a list of r-t data points into a r(t) relation expressed as a series of legendre polynomials.

Parameters
dataPointsList of data points to be converted x1 -> drift radius & x2 -> drift time
orderNumber of legendre polynomials to use in the fit

Definition at line 95 of file RtFromPoints.cxx.

95  {
96  return std::make_unique<RtLegendre>(legendreFit(dataPoints, order));
97 }

◆ getRtRelationLookUp()

std::unique_ptr< IRtRelation > RtFromPoints::getRtRelationLookUp ( const std::vector< SamplePoint > &  sample_points)
static

Definition at line 112 of file RtFromPoints.cxx.

112  {
113  // create spline rt relation
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();
118  }
119  RtSpline rt(pars);
120 
121  // variables
122  unsigned nb_points(100); // number of (r, t) points
123  double bin_width((rt.tUpper() - rt.tLower()) / static_cast<double>(nb_points - 1)); // step size
124  std::vector<double> rt_param(nb_points + 2); // r-t parameters
125 
127  // CREATE AN RtRelationLookUp OBJECT WITH THE CORRECT PARAMETERS //
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);
133 }

◆ getRtSimplePoly()

std::unique_ptr< IRtRelation > RtFromPoints::getRtSimplePoly ( const std::vector< SamplePoint > &  dataPoints,
const unsigned  order 
)
static

Converts a list of r(t) data points into a r(t) relation expressed as a series of elementary monomonials.

Parameters
dataPointsList of data points to be converted x1 -> drift time & x2 -> drift radius
orderOrder of the maximum monomial in the fit

Definition at line 101 of file RtFromPoints.cxx.

101  {
102  return std::make_unique<RtSimplePolynomial>(simplePolyFit(dataPoints, order));
103 }

◆ getTrChebyshev()

std::unique_ptr< ITrRelation > RtFromPoints::getTrChebyshev ( const std::vector< SamplePoint > &  dataPoints,
const unsigned  order 
)
static

Converts a list of r-t data points into a t(r) relation expressed as a series of chebychev polynomials.

Parameters
dataPointsList of data points to be converted x1 -> drift radius & x2 -> drift time
orderNumber of chebychev polynomials to fit

Definition at line 82 of file RtFromPoints.cxx.

82  {
83  return std::make_unique<TrChebyshev>(chebyFit(dataPoints, order));
84 }

◆ getTrLegendre()

std::unique_ptr< ITrRelation > RtFromPoints::getTrLegendre ( const std::vector< SamplePoint > &  dataPoints,
const unsigned  order 
)
static

Converts a list of t(r) data points into a t(r) relation expressed as a series of legendre polynomials.

Parameters
dataPointsList of data points to be converted x1 -> drift radius & x2 -> drift time
orderNumber of chebychev polynomials to fit

Definition at line 98 of file RtFromPoints.cxx.

98  {
99  return std::make_unique<TrLegendre>(legendreFit(dataPoints, order));
100 }

◆ getTrSimplePoly()

std::unique_ptr< ITrRelation > RtFromPoints::getTrSimplePoly ( const std::vector< SamplePoint > &  dataPoints,
const unsigned  order 
)
static

Converts a list of t(r) data points into a t(r) relation expressed as a series of elementary monomonials.

Parameters
dataPointsList of data points to be converted x1 -> drift radius & x2 -> drift time
orderOrder of the maximum monomial in the fit get an RtRelationLookUp resembling the r(t) function as described by the sample points in the vector "sample_points"; x1 coordinate of the sample points contains the drift time, x2 the corresponding radius; the method takes the minimum and maximum x1 values in the set of sample points a lower and upper limits in RtRelationLookUp

Definition at line 104 of file RtFromPoints.cxx.

104  {
105  return std::make_unique<TrSimplePolynomial>(simplePolyFit(dataPoints, order));
106 }

◆ legendreFit()

CalibFunc::ParVec RtFromPoints::legendreFit ( const std::vector< SamplePoint > &  dataPoints,
const unsigned  order 
)
staticprivate

Executes the fit of Legendre polynomials to the data points.

Parameters
dataPointsData points to fit. No normalization of the domain required
orderNumber of Legendre polynomials to use in the fit

Definition at line 37 of file RtFromPoints.cxx.

38  {
39  const auto [minT, maxT] = interval(dataPoints);
40 
41  CalibFunc::ParVec pars{minT, maxT};
43  LegendrePolynomial legendre{};
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]);
47  }
48  return pars;
49 }

◆ simplePolyFit()

CalibFunc::ParVec RtFromPoints::simplePolyFit ( const std::vector< SamplePoint > &  dataPoints,
const unsigned  order 
)
staticprivate

Exectues the fit of simple monomials to the data points.

Parameters
dataPointsData points to fit.
orderNumber of Legendre polynomials to use in the fit

Definition at line 66 of file RtFromPoints.cxx.

67  {
68  const auto [minT, maxT] = interval(dataPoints);
69  CalibFunc::ParVec pars{minT, maxT};
71  SimplePolynomial simplePoly{};
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]);
75  }
76  return pars;
77 
78 }

The documentation for this class was generated from the following files:
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
LArSamples::FitterData::fitter
const ShapeFitter * fitter
Definition: ShapeFitter.cxx:23
MuonCalib::ChebyshevPolynomial
Definition: ChebyshevPolynomial.h:17
MuonCalib::normalizeDomain
std::vector< SamplePoint > normalizeDomain(const std::vector< SamplePoint > &dataPoints)
Normalizes the domain of the samples points to the interval -1 to 1.
Definition: SamplePointUtils.cxx:76
CheckAppliedSFs.bin_width
bin_width
Definition: CheckAppliedSFs.py:242
MuonCalib::RtFromPoints::legendreFit
static CalibFunc::ParVec legendreFit(const std::vector< SamplePoint > &dataPoints, const unsigned order)
Executes the fit of Legendre polynomials to the data points.
Definition: RtFromPoints.cxx:37
MuonCalib::interval
std::pair< double, double > interval(const std::vector< SamplePoint > &points)
Returns the interval covered by the sample points.
Definition: SamplePointUtils.cxx:92
MuonCalib::RtFromPoints::simplePolyFit
static CalibFunc::ParVec simplePolyFit(const std::vector< SamplePoint > &dataPoints, const unsigned order)
Exectues the fit of simple monomials to the data points.
Definition: RtFromPoints.cxx:66
MuonCalib::RtFromPoints::chebyFit
static CalibFunc::ParVec chebyFit(const std::vector< SamplePoint > &dataPoints, const unsigned order)
Executes the fit of chebychev polynomials to the data points.
Definition: RtFromPoints.cxx:51
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
MuonCalib::BaseFunctionFitter
Definition: BaseFunctionFitter.h:39
lumiFormat.i
int i
Definition: lumiFormat.py:85
mc.order
order
Configure Herwig7.
Definition: mc.Herwig7_Dijet.py:12
MuonCalib::LegendrePolynomial
Definition: LegendrePolynomial.h:19
MuonCalib::CalibFunc::ParVec
std::vector< double > ParVec
Definition: CalibFunc.h:35
MuonCalib::SimplePolynomial
Definition: SimplePolynomial.h:13
MuonCalib::RtSpline
Definition: RtSpline.h:34
fitman.k
k
Definition: fitman.py:528
MuonCalib::resoFromRadius
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...
Definition: SamplePointUtils.cxx:39