1 | // This may look like C code, but it is really -*- C++ -*-
|
---|
2 | //
|
---|
3 | // Methode d'ajustement non-lineaire sur des objets
|
---|
4 | // R. Ansari 02/2000
|
---|
5 |
|
---|
6 | #ifndef OBJFITTER_SEEN
|
---|
7 | #define OBJFITTER_SEEN
|
---|
8 |
|
---|
9 | #include "machdefs.h"
|
---|
10 |
|
---|
11 | #include "tmatrix.h"
|
---|
12 | #include "tvector.h"
|
---|
13 | #include "histos.h"
|
---|
14 | #include "histos2.h"
|
---|
15 | #include "hisprof.h"
|
---|
16 | #include "generalfit.h"
|
---|
17 |
|
---|
18 |
|
---|
19 | namespace SOPHYA {
|
---|
20 |
|
---|
21 | class ObjectFitter {
|
---|
22 | public:
|
---|
23 | // Residus et fonction fittees sur matrix
|
---|
24 | static TMatrix<int_4> FitResidus(TMatrix<int_4> const & mtx, GeneralFit& gfit,
|
---|
25 | double xorg=0.,double yorg=0.,double dx=1.,double dy=1.);
|
---|
26 | static TMatrix<r_4> FitResidus(TMatrix<r_4> const & mtx, GeneralFit& gfit,
|
---|
27 | double xorg=0.,double yorg=0.,double dx=1.,double dy=1.);
|
---|
28 | static TMatrix<r_8> FitResidus(TMatrix<r_8> const & mtx, GeneralFit& gfit,
|
---|
29 | double xorg=0.,double yorg=0.,double dx=1.,double dy=1.);
|
---|
30 | static TMatrix< complex<r_4> > FitResidus(TMatrix< complex<r_4> > const & mtx, GeneralFit& gfit,
|
---|
31 | double xorg=0.,double yorg=0.,double dx=1.,double dy=1.);
|
---|
32 | static TMatrix< complex<r_8> > FitResidus(TMatrix< complex<r_8> > const & mtx, GeneralFit& gfit,
|
---|
33 | double xorg=0.,double yorg=0.,double dx=1.,double dy=1.);
|
---|
34 |
|
---|
35 | static TMatrix<int_4> FitFunction(TMatrix<int_4> const & mtx, GeneralFit& gfit,
|
---|
36 | double xorg=0.,double yorg=0.,double dx=1.,double dy=1.);
|
---|
37 | static TMatrix<r_4> FitFunction(TMatrix<r_4> const & mtx, GeneralFit& gfit,
|
---|
38 | double xorg=0.,double yorg=0.,double dx=1.,double dy=1.);
|
---|
39 | static TMatrix<r_8> FitFunction(TMatrix<r_8> const & mtx, GeneralFit& gfit,
|
---|
40 | double xorg=0.,double yorg=0.,double dx=1.,double dy=1.);
|
---|
41 | static TMatrix< complex<r_4> > FitFunction(TMatrix< complex<r_4> > const & mtx, GeneralFit& gfit,
|
---|
42 | double xorg=0.,double yorg=0.,double dx=1.,double dy=1.);
|
---|
43 | static TMatrix< complex<r_8> > FitFunction(TMatrix< complex<r_8> > const & mtx, GeneralFit& gfit,
|
---|
44 | double xorg=0.,double yorg=0.,double dx=1.,double dy=1.);
|
---|
45 |
|
---|
46 | // Residus et fonction fittees sur vecteurs
|
---|
47 | static TVector<int_4> FitResidus(TVector<int_4> const & vec, GeneralFit& gfit,
|
---|
48 | double xorg=0.,double dx=1.);
|
---|
49 | static TVector<r_4> FitResidus(TVector<r_4> const & vec, GeneralFit& gfit,
|
---|
50 | double xorg=0.,double dx=1.);
|
---|
51 | static TVector<r_8> FitResidus(TVector<r_8> const & vec, GeneralFit& gfit,
|
---|
52 | double xorg=0.,double dx=1.);
|
---|
53 | static TVector< complex<r_4> > FitResidus(TVector< complex<r_4> > const & vec, GeneralFit& gfit,
|
---|
54 | double xorg=0.,double dx=1.);
|
---|
55 | static TVector< complex<r_8> > FitResidus(TVector< complex<r_8> > const & vec, GeneralFit& gfit,
|
---|
56 | double xorg=0.,double dx=1.);
|
---|
57 |
|
---|
58 | static TVector<int_4> FitFunction(TVector<int_4> const & vec, GeneralFit& gfit,
|
---|
59 | double xorg=0.,double dx=1.);
|
---|
60 | static TVector<r_4> FitFunction(TVector<r_4> const & vec, GeneralFit& gfit,
|
---|
61 | double xorg=0.,double dx=1.);
|
---|
62 | static TVector<r_8> FitFunction(TVector<r_8> const & vec, GeneralFit& gfit,
|
---|
63 | double xorg=0.,double dx=1.);
|
---|
64 | static TVector< complex<r_4> > FitFunction(TVector< complex<r_4> > const & vec, GeneralFit& gfit,
|
---|
65 | double xorg=0.,double dx=1.);
|
---|
66 | static TVector< complex<r_8> > FitFunction(TVector< complex<r_8> > const & vec, GeneralFit& gfit,
|
---|
67 | double xorg=0.,double dx=1.);
|
---|
68 |
|
---|
69 | // Residus et fonction fittees sur Histo
|
---|
70 | static Histo FitResidus(Histo const& h, GeneralFit& gfit);
|
---|
71 | static Histo FitFunction(Histo const& h, GeneralFit& gfit);
|
---|
72 | static int_4 Fit(Histo const & h, GeneralFit& gfit,unsigned short typ_err=0);
|
---|
73 |
|
---|
74 | // Residus et fonction fittees sur Histo2D
|
---|
75 | static Histo2D FitResidus(Histo2D const& h, GeneralFit& gfit);
|
---|
76 | static Histo2D FitFunction(Histo2D const& h, GeneralFit& gfit);
|
---|
77 | static int_4 Fit(Histo2D const & h, GeneralFit& gfit,unsigned short typ_err=0);
|
---|
78 |
|
---|
79 | // Residus et fonction fittees sur HProf
|
---|
80 | static inline Histo FitResidus(HProf const& h, GeneralFit& gfit)
|
---|
81 | {h.UpdateHisto(); return FitResidus((Histo const&) h,gfit);}
|
---|
82 | static inline Histo FitFunction(HProf const& h, GeneralFit& gfit)
|
---|
83 | {h.UpdateHisto(); return FitFunction((Histo const&) h,gfit);}
|
---|
84 | static int_4 Fit(HProf const & h, GeneralFit& gfit)
|
---|
85 | {h.UpdateHisto(); return Fit((Histo const&) h,gfit,0);}
|
---|
86 |
|
---|
87 | // Residus et fonction fittees sur GeneralFitData
|
---|
88 | static inline GeneralFitData FitResidus(GeneralFitData const& g, GeneralFit& gfit)
|
---|
89 | {return g.FitResidus(gfit);}
|
---|
90 | static inline GeneralFitData FitFunction(GeneralFitData const& g, GeneralFit& gfit)
|
---|
91 | {return g.FitFunction(gfit);}
|
---|
92 | };
|
---|
93 |
|
---|
94 | // Classe template pour ajustement sur tableaux (Vecteurs, Matrices)
|
---|
95 | template <class T>
|
---|
96 | class ArrayFitter {
|
---|
97 | public:
|
---|
98 | // Residus et fonction fittees sur matrix
|
---|
99 | static TMatrix<T> FitResidus(TMatrix<T> const & mtx, GeneralFit& gfit,
|
---|
100 | double xorg=0.,double yorg=0.,double dx=1.,double dy=1.);
|
---|
101 | static TMatrix<T> FitFunction(TMatrix<T> const & mtx, GeneralFit& gfit,
|
---|
102 | double xorg=0.,double yorg=0.,double dx=1.,double dy=1.);
|
---|
103 | // Residus et fonction fittees sur vecteurs
|
---|
104 | static TVector<T> FitResidus(TVector<T> const & vec, GeneralFit& gfit,
|
---|
105 | double xorg=0.,double dx=1.);
|
---|
106 | static TVector<T> FitFunction(TVector<T> const & vec, GeneralFit& gfit,
|
---|
107 | double xorg=0.,double dx=1.);
|
---|
108 | };
|
---|
109 |
|
---|
110 | } // Fin du namespace
|
---|
111 |
|
---|
112 |
|
---|
113 | #endif // OBJFITTER_SEEN
|
---|