prevent running if CDB snapshot setting failed
[u/mrichter/AliRoot.git] / STEER / STEER / AliMillepede.h
CommitLineData
010eb601 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
010eb601 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
19class AliMillepede : public TObject {
20
21public:
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);
c4ee792d 38 /// Get number of local equations
010eb601 39 virtual Int_t GetNLocalEquations() const {return fNLocalEquations;};
c4ee792d 40 /// Set number of local equations
010eb601 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
46private:
47
48// Max. dimensions
49
c4ee792d 50 static const int fgkMaxGlobalPar = 1000; ///< Max. number of global parameters
51 static const int fgkMaxLocalPar = 20; ///< Max. number of local parameters
523adb30 52 static const int fgkMaxGloCsts = 20; ///< Max. number of constraint equations
3180457c 53 static const int fgkMaxGloPC = 1020; ///< fgkMaxGlobalPar+fgkMaxGloCsts
010eb601 54
55
56// Private methods
57
c4ee792d 58 // Double_t GetParCorrelation(int i, int j);
010eb601 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
c4ee792d 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
010eb601 73
74// Vectors and useful variables
75
c4ee792d 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)
010eb601 80
c4ee792d 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
010eb601 84
c4ee792d 85 double fLagMult[fgkMaxGloCsts]; ///< Lagrange multipliers of constrained equations
010eb601 86
c4ee792d 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
010eb601 90
c4ee792d 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
010eb601 96
c4ee792d 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
010eb601 102
103
c4ee792d 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
010eb601 119
a8fb6c66 120 ClassDef(AliMillepede, 1) // Millepede Class
010eb601 121};
122
123#endif
124
125
126