]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliCheb3DCalc.h
By default all events go into one run-loader's file. Allows to remove the correspondi...
[u/mrichter/AliRoot.git] / STEER / AliCheb3DCalc.h
CommitLineData
99adacae 1#ifndef ALICHEB3DCALC_H
2#define ALICHEB3DCALC_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
40389866 5#include <TNamed.h>
6#include <TSystem.h>
99adacae 7//
8// Author: Ruben Shahoyan
9// ruben.shahoyan@cern.ch 09/09/2006
10// See Comments in AliCheb3D.h
11//
40389866 12
13
14// to decrease the compilable code size comment this define. This will exclude the routines
15// used for the calculation and saving of the coefficients.
1cf34ee8 16//#define _INC_CREATION_ALICHEB3D_
40389866 17
18// when _BRING_TO_BOUNDARY_ is defined, the point outside of the fitted folume is assumed
19// to be on the surface
5de97576 20// #define _BRING_TO_BOUNDARY_
40389866 21//
22
99adacae 23
24class AliCheb3DCalc: public TNamed
25{
26 public:
27 AliCheb3DCalc();
40389866 28 AliCheb3DCalc(const AliCheb3DCalc& src);
29 AliCheb3DCalc(FILE* stream);
30 ~AliCheb3DCalc() {Clear();}
99adacae 31 //
40389866 32 AliCheb3DCalc& operator=(const AliCheb3DCalc& rhs);
99adacae 33 void Print(Option_t* opt="") const;
34 void LoadData(FILE* stream);
35 Float_t Eval(Float_t *par) const;
40389866 36 Float_t EvalDeriv(int dim, Float_t *par) const;
1cf34ee8 37 Float_t EvalDeriv2(int dim1,int dim2, Float_t *par) const;
99adacae 38 //
39#ifdef _INC_CREATION_ALICHEB3D_
40 void SaveData(const char* outfile,Bool_t append=kFALSE) const;
41 void SaveData(FILE* stream=stdout) const;
42#endif
43 //
99adacae 44 void InitRows(int nr);
45 void InitCols(int nc);
99adacae 46 Int_t* GetNColsAtRow() const {return fNColsAtRow;}
47 Int_t* GetColAtRowBg() const {return fColAtRowBg;}
40389866 48 void InitElemBound2D(int ne);
99adacae 49 Int_t* GetCoefBound2D0() const {return fCoefBound2D0;}
50 Int_t* GetCoefBound2D1() const {return fCoefBound2D1;}
40389866 51 void Clear(Option_t* option = "");
1cf34ee8 52 static Float_t ChebEval1D(Float_t x, const Float_t * array, int ncf);
53 static Float_t ChebEval1Deriv(Float_t x, const Float_t * array, int ncf);
54 static Float_t ChebEval1Deriv2(Float_t x, const Float_t * array, int ncf);
40389866 55 void InitCoefs(int nc);
99adacae 56 Float_t * GetCoefs() const {return fCoefs;}
57 //
40389866 58 static void ReadLine(TString& str,FILE* stream);
59 //
99adacae 60 protected:
61 Int_t fNCoefs; // total number of coeeficients
62 Int_t fNRows; // number of significant rows in the 3D coeffs matrix
63 Int_t fNCols; // max number of significant cols in the 3D coeffs matrix
64 Int_t fNElemBound2D; // number of elements (fNRows*fNCols) to store for the 2D boundary of significant coeffs
65 Int_t* fNColsAtRow; //[fNRows] number of sighificant columns (2nd dim) at each row of 3D coefs matrix
66 Int_t* fColAtRowBg; //[fNRows] beginnig of significant columns (2nd dim) for row in the 2D boundary matrix
67 Int_t* fCoefBound2D0; //[fNElemBound2D] 2D matrix defining the boundary of significance for 3D coeffs.matrix (Ncoefs for col/row)
68 Int_t* fCoefBound2D1; //[fNElemBound2D] 2D matrix defining the start beginnig of significant coeffs for col/row
69 Float_t * fCoefs; //[fNCoefs] array of Chebyshev coefficients
70 //
71 Float_t * fTmpCf1; //[fNCols] temp. coeffs for 2d summation
72 Float_t * fTmpCf0; //[fNRows] temp. coeffs for 1d summation
73 //
40389866 74 ClassDef(AliCheb3DCalc,1) // Class for interpolation of 3D->1 function by Chebyshev parametrization
99adacae 75};
76
40389866 77//__________________________________________________________________________________________
78inline Float_t AliCheb3DCalc::ChebEval1D(Float_t x, const Float_t * array, int ncf )
99adacae 79{
80 // evaluate 1D Chebyshev parameterization. x is the argument mapped to [-1:1] interval
40389866 81 Float_t b0, b1, b2, x2 = x+x;
99adacae 82 b0 = array[--ncf];
83 b1 = b2 = 0;
84 for (int i=ncf;i--;) {
85 b2 = b1;
86 b1 = b0;
87 b0 = array[i] + x2*b1 -b2;
88 }
89 return b0 - x*b1;
40389866 90 //
99adacae 91}
92
93#endif