]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/STEER/AliMillepede.h
Update master to aliroot
[u/mrichter/AliRoot.git] / STEER / STEER / AliMillepede.h
1 #ifndef ALI_MILLEPEDE_H 
2 #define ALI_MILLEPEDE_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 /* $Id$ */
8
9 /// \class AliMillepede
10 /// \brief Class for detector alignment - modified C++ implementation of original
11 /// millepede package
12 //
13 //  Author: Javier Castillo
14
15 #include <TObject.h>
16 #include <TArrayI.h>
17 #include <TArrayD.h>
18
19 class AliMillepede : public TObject {
20
21 public: 
22   /// Standard constructor
23   AliMillepede();
24
25   virtual ~AliMillepede( ); /// Destructor
26
27   /// Initialization
28   virtual Int_t InitMille(int nglo, int nloc, int nstd,                   
29                           double lResCut, double lResCutInit);
30   virtual Int_t GlobalFit(double par[], double error[], double pull[]);
31   virtual Int_t SetGlobalParameters(double *param);
32   virtual Int_t SetGlobalParameter(int iPar, double vPar);
33   virtual Int_t SetParSigma(int iPar, double sigma);
34   virtual Int_t SetNonLinear(int index);
35   virtual Int_t SetGlobalConstraint(double dercs[], double rhs);
36   virtual Int_t SetLocalEquation(double dergb[], double derlc[], double rmeas, double sigma);
37   virtual Int_t LocalFit(int n, double localParams[], Bool_t bSingleFit);
38                 /// Get number of local equations
39   virtual Int_t GetNLocalEquations() const {return fNLocalEquations;};
40                 /// Set number of local equations
41   virtual void  SetNLocalEquations(int value) {fNLocalEquations = value;};
42   virtual Int_t PrintGlobalParameters() const;
43   virtual Int_t SetIterations (double cutfac);
44   virtual Double_t GetParError(int iPar) const;
45
46 private:
47
48 // Max. dimensions
49
50   static const int fgkMaxGlobalPar  = 1000; ///< Max. number of global parameters
51   static const int fgkMaxLocalPar   = 20;   ///< Max. number of local parameters
52   static const int fgkMaxGloCsts    = 20;   ///< Max. number of constraint equations
53   static const int fgkMaxGloPC      = 1020; ///< fgkMaxGlobalPar+fgkMaxGloCsts
54
55
56 // Private methods 
57
58   // Double_t GetParCorrelation(int i, int j);
59
60   int   SpmInv(double v[][fgkMaxGloPC], double b[], int n);
61   int   SpmInv(double v[][fgkMaxLocalPar], double b[], int n);
62   int SpAVAt(double v[][fgkMaxLocalPar], double a[][fgkMaxLocalPar], double w[][fgkMaxGlobalPar], int n, int m);
63   int SpAX(double a[][fgkMaxLocalPar], double x[], double y[], int n, int m);
64   double Chi2DoFLim(int n, int nd);
65
66 // Matrices
67
68   double fMatCGlo[fgkMaxGloPC][fgkMaxGloPC];            ///< Matrix C global
69   double fMatCLoc[fgkMaxLocalPar][fgkMaxLocalPar];      ///< Matrix C local
70   double fMatCGloLoc[fgkMaxGlobalPar][fgkMaxLocalPar];  ///< Rectangular matrix C g*l
71   double fMatCGloCorr[fgkMaxGlobalPar][fgkMaxGlobalPar];///< Correction of matrix C global
72   double fMatDerConstr[fgkMaxGloCsts][fgkMaxGlobalPar]; ///< Constrained derivatives
73
74 // Vectors and useful variables
75
76   double fDiagCGlo[fgkMaxGloPC];        ///< Initial diagonal elements of C global matrix
77   double fVecBGlo[fgkMaxGloPC];         ///< Vector B global (parameters) 
78   double fVecBGloCorr[fgkMaxGlobalPar]; ///< Correction of vector B global
79   double fVecBLoc[fgkMaxLocalPar];      ///< Vector B local (parameters) 
80
81   double fInitPar[fgkMaxGlobalPar];    ///< Initial global parameters
82   double fDeltaPar[fgkMaxGlobalPar];   ///< Variation of global parameters 
83   double fSigmaPar[fgkMaxGlobalPar];   ///< Sigma of allowed variation of global parameter 
84
85   double fLagMult[fgkMaxGloCsts];   ///< Lagrange multipliers of constrained equations
86
87   Bool_t fIsNonLinear[fgkMaxGlobalPar]; ///< Flag for non linear parameters
88   int   fGlo2CGLRow[fgkMaxGlobalPar];   ///< Global parameter to row in "used" g*l matrix
89   int   fCGLRow2Glo[fgkMaxGlobalPar];   ///< Row in "used" g*l matrix to global parameter 
90
91   TArrayI fIndexLocEq;  ///< Table of parameter indexes in local equation 
92   TArrayD fDerivLocEq;  ///< Table of local equation derivatives wrt. parameter 
93   TArrayI fIndexAllEqs; ///< Index in all loc. eq. storage for iterations
94   TArrayD fDerivAllEqs; ///< derivative in all loc. eq. storage for iterations
95   TArrayI fLocEqPlace;  ///< Loc. Eq. position in AllEqs storage
96
97   Int_t fNIndexLocEq;   ///< Number of entries in fIndexLocEq
98   Int_t fNDerivLocEq;   ///< Number of entries in fDerivLocEq
99   Int_t fNIndexAllEqs;  ///< Number of entries in fIndexAllEqs
100   Int_t fNDerivAllEqs;  ///< Number of entries in fDerivAllEqs
101   Int_t fNLocEqPlace;   ///< Number of entries in fLocEqPlace
102   
103
104   int    fNLocalEquations;       ///< Number of local equations 
105   double fResCutInit;            ///< Cut in residual for first iterartion
106   double fResCut;                ///< Cut in residual for other iterartiona
107
108   double fChi2CutFactor;         ///< Cut factor for chi2 cut to accept local fit 
109   double fChi2CutRef;            ///< Reference cut for chi2 cut to accept local fit 
110
111   int fIter;                   ///< Current iteration
112   int fMaxIter;                ///< Maximum number of iterations
113   int fNStdDev;                ///< Number of standard deviations for chi2 cut 
114   int fNGlobalConstraints;     ///< Number of constraint equations
115   int fNLocalFits;             ///< Number of local fits
116   int fNLocalFitsRejected;     ///< Number of local fits rejected
117   int fNGlobalPar;             ///< Number of global parameters
118   int fNLocalPar;              ///< Number of local parameters
119
120   ClassDef(AliMillepede, 1)  // Millepede Class
121 };
122
123 #endif
124
125
126