#include <TH1.h>
#include <TObjArray.h>
+#include "AliCheb3DCalc.h"
+
class TString;
class TSystem;
class TRandom;
-
-
// to decrease the compilable code size comment this define. This will exclude the routines
// used for the calculation and saving of the coefficients.
// #define _INC_CREATION_ALICHEB3D_
-
-class AliCheb3DCalc: public TNamed
-{
- public:
- AliCheb3DCalc();
- AliCheb3DCalc(FILE* stream); // read coefs from text file
- ~AliCheb3DCalc() {Clear();}
- //
- void Print(Option_t* opt="") const;
- void LoadData(FILE* stream);
- Float_t Eval(Float_t *par) const;
- //
-#ifdef _INC_CREATION_ALICHEB3D_
- void SaveData(const char* outfile,Bool_t append=kFALSE) const;
- void SaveData(FILE* stream=stdout) const;
-#endif
- //
- static void ReadLine(TString& str,FILE* stream);
- //
- protected:
- //
- void Clear(Option_t* option = "");
- void Init0();
- Float_t ChebEval1D(Float_t x, const Float_t * array, int ncf) const;
- void InitRows(int nr);
- void InitCols(int nc);
- void InitElemBound2D(int ne);
- void InitCoefs(int nc);
- Int_t* GetNColsAtRow() const {return fNColsAtRow;}
- Int_t* GetColAtRowBg() const {return fColAtRowBg;}
- Int_t* GetCoefBound2D0() const {return fCoefBound2D0;}
- Int_t* GetCoefBound2D1() const {return fCoefBound2D1;}
- Float_t * GetCoefs() const {return fCoefs;}
- //
- protected:
- Int_t fNCoefs; // total number of coeeficients
- Int_t fNRows; // number of significant rows in the 3D coeffs matrix
- Int_t fNCols; // max number of significant cols in the 3D coeffs matrix
- Int_t fNElemBound2D; // number of elements (fNRows*fNCols) to store for the 2D boundary of significant coeffs
- Int_t* fNColsAtRow; //[fNRows] number of sighificant columns (2nd dim) at each row of 3D coefs matrix
- Int_t* fColAtRowBg; //[fNRows] beginnig of significant columns (2nd dim) for row in the 2D boundary matrix
- Int_t* fCoefBound2D0; //[fNElemBound2D] 2D matrix defining the boundary of significance for 3D coeffs.matrix (Ncoefs for col/row)
- Int_t* fCoefBound2D1; //[fNElemBound2D] 2D matrix defining the start beginnig of significant coeffs for col/row
- Float_t * fCoefs; //[fNCoefs] array of Chebyshev coefficients
- //
- Float_t * fTmpCf1; //[fNCols] temp. coeffs for 2d summation
- Float_t * fTmpCf0; //[fNRows] temp. coeffs for 1d summation
- //
- ClassDef(AliCheb3DCalc,1) // Class for interpolation of 3D->1 function by Chebyshev parametrization
-};
-
-
class AliCheb3D: public TNamed
{
public:
AliCheb3D();
- AliCheb3D(const char* inpFile); // read coefs from text file
- AliCheb3D(FILE*); // read coefs from stream
+ AliCheb3D(const char* inpFile); // read coefs from text file
+ AliCheb3D(FILE* file); // read coefs from stream
+ AliCheb3D(const AliCheb3D &src);
+ AliCheb3D& operator= (const AliCheb3D &rhs);
+
//
#ifdef _INC_CREATION_ALICHEB3D_
AliCheb3D(const char* funName, Int_t DimOut, Float_t *bmin,Float_t *bmax, Int_t *npoints, Float_t prec=1E-6);
//
Float_t MapToInternal(Float_t x,Int_t d) const {return (x-fBOffset[d])*fBScale[d];} // map x to [-1:1]
Float_t MapToExternal(Float_t x,Int_t d) const {return x/fBScale[d]+fBOffset[d];} // map from [-1:1] to x
- //
+ //
protected:
Int_t fDimOut; // dimension of the ouput array
Float_t fPrec; // requested precision
return kTRUE;
}
-//__________________________________________________________________________________________
-inline Float_t AliCheb3DCalc::ChebEval1D(Float_t x, const Float_t * array, int ncf ) const
-{
- // evaluate 1D Chebyshev parameterization. x is the argument mapped to [-1:1] interval
- Float_t b0, b1, b2;
- Float_t x2 = x+x;
- b0 = array[--ncf];
- b1 = b2 = 0;
- for (int i=ncf;i--;) {
- b2 = b1;
- b1 = b0;
- b0 = array[i] + x2*b1 -b2;
- }
- return b0 - x*b1;
-}
-
//__________________________________________________________________________________________
inline void AliCheb3D::Eval(Float_t *par, Float_t *res)
{