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