Project
Loading...
Searching...
No Matches
o2::math_utils::Chebyshev3D Class Reference

#include <Chebyshev3D.h>

Inherits TNamed.

Public Member Functions

 Chebyshev3D ()
 
 Chebyshev3D (const Chebyshev3D &src)
 
 Chebyshev3D (const char *inpFile)
 
 Chebyshev3D (FILE *stream)
 
 ~Chebyshev3D () override
 
Chebyshev3Doperator= (const Chebyshev3D &rhs)
 
void Eval (const Float_t *par, Float_t *res)
 Evaluates Chebyshev parameterization for 3d->DimOut function.
 
Float_t Eval (const Float_t *par, int idim)
 Evaluates Chebyshev parameterization for idim-th output dimension of 3d->DimOut function.
 
void Eval (const Double_t *par, Double_t *res)
 Evaluates Chebyshev parameterization for 3d->DimOut function.
 
Double_t Eval (const Double_t *par, int idim)
 Evaluates Chebyshev parameterization for idim-th output dimension of 3d->DimOut function.
 
void evaluateDerivative (int dimd, const Float_t *par, Float_t *res)
 
void evaluateDerivative2 (int dimd1, int dimd2, const Float_t *par, Float_t *res)
 
Float_t evaluateDerivative (int dimd, const Float_t *par, int idim)
 
Float_t evaluateDerivative2 (int dimd1, int dimd2, const Float_t *par, int idim)
 
void evaluateDerivative3D (const Float_t *par, Float_t dbdr[3][3])
 Returns the gradient matrix.
 
void evaluateDerivative3D2 (const Float_t *par, Float_t dbdrdr[3][3][3])
 Returns the gradient matrix.
 
void Print (const Option_t *opt="") const override
 
Bool_t isInside (const Float_t *par) const
 Checks if the point is inside of the fitted box.
 
Bool_t isInside (const Double_t *par) const
 Checks if the point is inside of the fitted box.
 
Chebyshev3DCalcgetChebyshevCalc (int i) const
 
Float_t getBoundMin (int i) const
 
Float_t getBoundMax (int i) const
 
Float_tgetBoundMin () const
 
Float_tgetBoundMax () const
 
Float_tgetBoundaryMappingScale () const
 
Float_tgetBoundaryMappingOffset () const
 
Float_t getPrecision () const
 
void shiftBound (int id, float dif)
 
void loadData (const char *inpFile)
 
void loadData (FILE *stream)
 

Protected Member Functions

void Clear (const Option_t *option="") override
 
void setDimOut (const int d, const float *prec=nullptr)
 
void prepareBoundaries (const Float_t *bmin, const Float_t *bmax)
 
Float_t mapToInternal (Float_t x, Int_t d) const
 Μaps x to [-1:1].
 
Float_t mapToExternal (Float_t x, Int_t d) const
 
Double_t mapToInternal (Double_t x, Int_t d) const
 Μaps x to [-1:1].
 
Double_t mapToExternal (Double_t x, Int_t d) const
 

Detailed Description

Chebyshev3D produces the interpolation of the user 3D->NDimOut arbitrary function supplied in "void (*fcn)(float* inp,float* out)" format either in a separate macro file or as a function pointer. Only coefficients needed to guarantee the requested precision are kept. The user-callable methods are: To create the interpolation use: Cheb3D(const char* funName, // name of the file with user function or Cheb3D(void (ptr)(float,float*) // pointer on the user function

Parameters
Int_tDimOut dimensionality of the function's output
Float_t*bmin lower 3D bounds of interpolation domain
Float_t*bmax upper 3D bounds of interpolation domain
Int_t*npoints number of points in each of 3 input dimension, defining the interpolation grid
Float_tprec=1E-6); requested max.absolute difference between the interpolation and any point on grid To test obtained parameterization use the method TH1* TestRMS(int idim,int npoints = 1000,TH1* histo=0); it will compare the user output of the user function and interpolation for idim-th output dimension and fill the difference in the supplied histogram. If no histogram is supplied, it will be created. To save the interpolation data: saveData(const char* filename, Bool_t append ) write text file with data. If append is kTRUE and the output file already exists, data will be added in the end of the file. Alternatively, saveData(FILE* stream) will write the data to already existing stream. To read back already stored interpolation use either the constructor Chebyshev3D(const char* inpFile); or the default constructor Chebyshev3D() followed by Chebyshev3D::loadData(const char* inpFile); To compute the interpolation use Eval(float* par,float *res) method, with par being 3D vector of arguments (inside the validity region) and res is the array of DimOut elements for the output. If only one component (say, idim-th) of the output is needed, use faster Float_t Eval(Float_t *par,int idim) method void Print(option="") will print the name, the ranges of validity and the absolute precision of the parameterization. Option "l" will also print the information about the number of coefficients for each output dimension. NOTE: during the evaluation no check is done for parameter vector being outside the interpolation region. If there is such a risk, use Bool_t isInside(float *par) method. Chebyshev parameterization is not good for extrapolation! For the properties of Chebyshev parameterization see: H.Wind, CERN EP Internal Report, 81-12/Rev.

Definition at line 64 of file Chebyshev3D.h.

Constructor & Destructor Documentation

◆ Chebyshev3D() [1/4]

Chebyshev3D::Chebyshev3D ( )

Definition at line 37 of file Chebyshev3D.cxx.

◆ Chebyshev3D() [2/4]

Chebyshev3D::Chebyshev3D ( const Chebyshev3D src)

Definition at line 56 of file Chebyshev3D.cxx.

◆ Chebyshev3D() [3/4]

Chebyshev3D::Chebyshev3D ( const char inpFile)

Definition at line 85 of file Chebyshev3D.cxx.

◆ Chebyshev3D() [4/4]

Chebyshev3D::Chebyshev3D ( FILE *  stream)

Definition at line 105 of file Chebyshev3D.cxx.

◆ ~Chebyshev3D()

o2::math_utils::Chebyshev3D::~Chebyshev3D ( )
inlineoverride

Definition at line 124 of file Chebyshev3D.h.

Member Function Documentation

◆ Clear()

void Chebyshev3D::Clear ( const Option_t *  option = "")
overrideprotected

Definition at line 291 of file Chebyshev3D.cxx.

◆ Eval() [1/4]

void o2::math_utils::Chebyshev3D::Eval ( const Double_t *  par,
Double_t *  res 
)
inline

Evaluates Chebyshev parameterization for 3d->DimOut function.

Definition at line 304 of file Chebyshev3D.h.

◆ Eval() [2/4]

Double_t o2::math_utils::Chebyshev3D::Eval ( const Double_t *  par,
int  idim 
)
inline

Evaluates Chebyshev parameterization for idim-th output dimension of 3d->DimOut function.

Definition at line 315 of file Chebyshev3D.h.

◆ Eval() [3/4]

void o2::math_utils::Chebyshev3D::Eval ( const Float_t par,
Float_t res 
)
inline

Evaluates Chebyshev parameterization for 3d->DimOut function.

Definition at line 293 of file Chebyshev3D.h.

◆ Eval() [4/4]

Float_t o2::math_utils::Chebyshev3D::Eval ( const Float_t par,
int  idim 
)
inline

Evaluates Chebyshev parameterization for idim-th output dimension of 3d->DimOut function.

Definition at line 324 of file Chebyshev3D.h.

◆ evaluateDerivative() [1/2]

void o2::math_utils::Chebyshev3D::evaluateDerivative ( int  dimd,
const Float_t par,
Float_t res 
)
inline

Definition at line 362 of file Chebyshev3D.h.

◆ evaluateDerivative() [2/2]

Float_t o2::math_utils::Chebyshev3D::evaluateDerivative ( int  dimd,
const Float_t par,
int  idim 
)
inline

Evaluates Chebyshev parameterization derivative over dimd dimention for idim-th output dimension of 3d->DimOut function

Definition at line 386 of file Chebyshev3D.h.

◆ evaluateDerivative2() [1/2]

void o2::math_utils::Chebyshev3D::evaluateDerivative2 ( int  dimd1,
int  dimd2,
const Float_t par,
Float_t res 
)
inline

Definition at line 373 of file Chebyshev3D.h.

◆ evaluateDerivative2() [2/2]

Float_t o2::math_utils::Chebyshev3D::evaluateDerivative2 ( int  dimd1,
int  dimd2,
const Float_t par,
int  idim 
)
inline

Evaluates Chebyshev parameterization 2ns derivative over dimd1 and dimd2 dimensions for idim-th output dimension of 3d->DimOut function

Definition at line 396 of file Chebyshev3D.h.

◆ evaluateDerivative3D()

void o2::math_utils::Chebyshev3D::evaluateDerivative3D ( const Float_t par,
Float_t  dbdr[3][3] 
)
inline

Returns the gradient matrix.

Definition at line 333 of file Chebyshev3D.h.

◆ evaluateDerivative3D2()

void o2::math_utils::Chebyshev3D::evaluateDerivative3D2 ( const Float_t par,
Float_t  dbdrdr[3][3][3] 
)
inline

Returns the gradient matrix.

Definition at line 346 of file Chebyshev3D.h.

◆ getBoundaryMappingOffset()

Float_t * o2::math_utils::Chebyshev3D::getBoundaryMappingOffset ( ) const
inline

Definition at line 187 of file Chebyshev3D.h.

◆ getBoundaryMappingScale()

Float_t * o2::math_utils::Chebyshev3D::getBoundaryMappingScale ( ) const
inline

Definition at line 182 of file Chebyshev3D.h.

◆ getBoundMax() [1/2]

Float_t * o2::math_utils::Chebyshev3D::getBoundMax ( ) const
inline

Definition at line 177 of file Chebyshev3D.h.

◆ getBoundMax() [2/2]

Float_t o2::math_utils::Chebyshev3D::getBoundMax ( int  i) const
inline

Definition at line 167 of file Chebyshev3D.h.

◆ getBoundMin() [1/2]

Float_t * o2::math_utils::Chebyshev3D::getBoundMin ( ) const
inline

Definition at line 172 of file Chebyshev3D.h.

◆ getBoundMin() [2/2]

Float_t o2::math_utils::Chebyshev3D::getBoundMin ( int  i) const
inline

Definition at line 162 of file Chebyshev3D.h.

◆ getChebyshevCalc()

Chebyshev3DCalc * o2::math_utils::Chebyshev3D::getChebyshevCalc ( int  i) const
inline

Definition at line 157 of file Chebyshev3D.h.

◆ getPrecision()

Float_t o2::math_utils::Chebyshev3D::getPrecision ( ) const
inline

Definition at line 192 of file Chebyshev3D.h.

◆ isInside() [1/2]

Bool_t o2::math_utils::Chebyshev3D::isInside ( const Double_t *  par) const
inline

Checks if the point is inside of the fitted box.

Definition at line 282 of file Chebyshev3D.h.

◆ isInside() [2/2]

Bool_t o2::math_utils::Chebyshev3D::isInside ( const Float_t par) const
inline

Checks if the point is inside of the fitted box.

Definition at line 271 of file Chebyshev3D.h.

◆ loadData() [1/2]

void Chebyshev3D::loadData ( const char inpFile)

Definition at line 765 of file Chebyshev3D.cxx.

◆ loadData() [2/2]

void Chebyshev3D::loadData ( FILE *  stream)

Definition at line 775 of file Chebyshev3D.cxx.

◆ mapToExternal() [1/2]

Double_t o2::math_utils::Chebyshev3D::mapToExternal ( Double_t  x,
Int_t  d 
) const
inlineprotected

Definition at line 241 of file Chebyshev3D.h.

◆ mapToExternal() [2/2]

Float_t o2::math_utils::Chebyshev3D::mapToExternal ( Float_t  x,
Int_t  d 
) const
inlineprotected

Definition at line 236 of file Chebyshev3D.h.

◆ mapToInternal() [1/2]

Double_t o2::math_utils::Chebyshev3D::mapToInternal ( Double_t  x,
Int_t  d 
) const
inlineprotected

Μaps x to [-1:1].

Definition at line 423 of file Chebyshev3D.h.

◆ mapToInternal() [2/2]

Float_t o2::math_utils::Chebyshev3D::mapToInternal ( Float_t  x,
Int_t  d 
) const
inlineprotected

Μaps x to [-1:1].

Definition at line 406 of file Chebyshev3D.h.

◆ operator=()

Chebyshev3D & Chebyshev3D::operator= ( const Chebyshev3D rhs)

Definition at line 264 of file Chebyshev3D.cxx.

◆ prepareBoundaries()

void Chebyshev3D::prepareBoundaries ( const Float_t bmin,
const Float_t bmax 
)
protected

Definition at line 327 of file Chebyshev3D.cxx.

◆ Print()

void Chebyshev3D::Print ( const Option_t *  opt = "") const
override

Definition at line 310 of file Chebyshev3D.cxx.

◆ setDimOut()

void Chebyshev3D::setDimOut ( const int  d,
const float *  prec = nullptr 
)
protected

Definition at line 826 of file Chebyshev3D.cxx.

◆ shiftBound()

void Chebyshev3D::shiftBound ( int  id,
float  dif 
)

Definition at line 842 of file Chebyshev3D.cxx.


The documentation for this class was generated from the following files: