Event server (Mihai)
[u/mrichter/AliRoot.git] / STEER / STEER / AliParamSolver.h
CommitLineData
3a11fb02 1#ifndef ALIPARAMSOLVER_H
2#define ALIPARAMSOLVER_H
3
4/* ----------------------------------------------------------------------------------------
5 Class to solve a set of N linearized parametric equations of the type
6 Eq(k): sum_i=0^n { g_i G_ik } + t_k T_k = res_k
7 whith n "global" parameters gi and one "local" parameter (per equation) t_k.
8 Each measured points provides 3 measured coordinates, with proper covariance matrix.
9
10 Used for Newton-Raphson iteration step in solution of non-linear parametric equations
11 F(g,t_k) - res_k = 0, with G_ik = dF(g,t_k)/dg_i and T_k = dF(g,t_k)/dt_k
12 Solution is obtained by elimination of local parameters via large (n+N) matrix partitioning
13
14 Author: ruben.shahoyan@cern.ch
15-------------------------------------------------------------------------------------------*/
16
17#include <TObject.h>
18class AliSymMatrix;
19
20class AliParamSolver: public TObject
21{
22 public:
23 enum {kBitGloSol=BIT(14),kBitLocSol=BIT(15),kBitCInv=BIT(16)};
24 enum {kXX=0,kXY=1,kXZ=2,kYX=kXY,kYY=3,kYZ=4,kZX=kXZ,kZY=kYZ,kZZ=5};
25 enum {kX,kY,kZ};
26
27 AliParamSolver();
28 AliParamSolver(Int_t maxglo,Int_t locsize=16);
339fbe23 29 AliParamSolver(const AliParamSolver& src);
3a11fb02 30 AliParamSolver& operator=(const AliParamSolver& src);
31 ~AliParamSolver();
32 //
56881eaf 33 void AddEquation(const Double_t* dGl,const Double_t *dLc,const Double_t *res,const Double_t *covI,Double_t sclErrI=-1.);
3a11fb02 34 void AddConstraint(Int_t parID, Double_t val, Double_t err2inv);
35 Bool_t Solve(Bool_t obtainCov=kFALSE);
36 Bool_t SolveGlobals(Bool_t obtainCov=kFALSE);
37 Bool_t SolveLocals();
38 void SetMaxGlobal(Int_t n);
39 void SetNGlobal(Int_t n);
40 void Clear(Option_t* = "");
41 void Print(Option_t* = "") const;
42 //
43 Int_t GetNGlobal() const {return fNGlobal;}
44 Int_t GetMaxGlobal() const {return fMaxGlobal;}
45 AliSymMatrix* GetCovMatrix();
46 Double_t* GetLocals() const {return (Double_t*)fSolLoc;}
47 Double_t* GetGlobals() const {return (Double_t*)fSolGlo;}
48
49 protected:
50 void Init(Int_t npini=16);
51 void ExpandStorage(Int_t newSize);
52
53 protected:
54 AliSymMatrix* fMatrix; // final matrix for global parameters (C in MP)
55 Double_t* fSolGlo; // solution for globals ( vector a in MP)
56 Double_t* fSolLoc; // solution for locals ( vector alpha in MP)
57 Int_t fMaxGlobal; // max number of globals can process
58 Int_t fNGlobal; // number of globals
59 Int_t fNPoints; // number of added points (=number of local parameters)
60 //
61 // temp storage
62 Int_t fMaxPoints; // buffer size for storage
63 Double_t* fRHSGlo; // RHS of globals (vector b in MP)
64 Double_t* fRHSLoc; // RHS of locals (vector beta in MP)
65 Double_t* fMatGamma; // diagonals of local partition (Gamma_i in MP)
66 Double_t* fMatG; // off-diagonals of local partition (G_i in MP)
67 Double_t* fCovDGl; // temporary matrix of cov*dR/dGlo
68 //
69 ClassDef(AliParamSolver,0)
70};
71
72
73#endif