1 | // This may look like C code, but it is really -*- C++ -*-
|
---|
2 | // Classe d ajustement pour piapp
|
---|
3 | // cmv 98-99
|
---|
4 | // CEA-DAPNIA LAL-IN2P3/CNRS
|
---|
5 |
|
---|
6 | #ifndef PIAFITTING_H_SEEN
|
---|
7 | #define PIAFITTING_H_SEEN
|
---|
8 |
|
---|
9 | #include "machdefs.h"
|
---|
10 | #include <string>
|
---|
11 | #include <vector>
|
---|
12 | #if defined(__KCC__)
|
---|
13 | using std::string ;
|
---|
14 | #include <vector.h>
|
---|
15 | #endif
|
---|
16 |
|
---|
17 | #include "anydataobj.h"
|
---|
18 |
|
---|
19 | #include "pdlmgr.h"
|
---|
20 | #include "dlftypes.h"
|
---|
21 | #include "piacmd.h"
|
---|
22 | #include "cvector.h"
|
---|
23 |
|
---|
24 | class PIStdImgApp;
|
---|
25 | class PIAFitterWind;
|
---|
26 | class GeneralFunction; class GeneralFunc; class GeneralFit;
|
---|
27 | class GeneralFitData;
|
---|
28 | class Histo; class Matrix; class Histo2D; class RzImage;
|
---|
29 |
|
---|
30 | class PIAFitter : public CmdExecutor {
|
---|
31 | public :
|
---|
32 | PIAFitter(PIACmd* piac, PIStdImgApp* app);
|
---|
33 | virtual ~PIAFitter();
|
---|
34 | virtual int Execute(string& keyw, vector<string>& args);
|
---|
35 | virtual void LinkFitFunc(string const& fname, string const& funcname
|
---|
36 | ,int nvar,int npar);
|
---|
37 | virtual void PrepareFitFuncCFile(string const& fname, string const& funcname
|
---|
38 | ,int nvar,int npar);
|
---|
39 |
|
---|
40 | friend class PIAFitterWind;
|
---|
41 |
|
---|
42 | protected :
|
---|
43 |
|
---|
44 | typedef struct DFOptions {
|
---|
45 | bool okres, okfun;
|
---|
46 | int polcx,polcy; double xc,yc;
|
---|
47 | double err_e, err_E;
|
---|
48 | double stc2;
|
---|
49 | int nstep;
|
---|
50 | int lp,lpg;
|
---|
51 | int i1,i2,j1,j2;
|
---|
52 | bool fromlastfit,autoinifit;
|
---|
53 | } DFOPTIONS ;
|
---|
54 |
|
---|
55 | void ResetDPointer(void);
|
---|
56 | void ResetOptions(void);
|
---|
57 | void DecodeOptions(string opt);
|
---|
58 | void DecodeObject(string obj);
|
---|
59 | void CheckOptions(void);
|
---|
60 | void PrintOptions(void);
|
---|
61 | void FillGData(void);
|
---|
62 | void DecodeFunction(string func);
|
---|
63 | void ReSetParam(void);
|
---|
64 | void AutoIniFit(void);
|
---|
65 | void InitParFromLastFit(void);
|
---|
66 | void DecodeParam(string par,string step,string min,string max,string fix);
|
---|
67 | int DoFit(void);
|
---|
68 | void FitFunRes(void);
|
---|
69 | void LinFit(void);
|
---|
70 |
|
---|
71 | // pour initialiser les parametres du fit
|
---|
72 | void IniFitP1ou2D(void);
|
---|
73 | void IniFitGhP1D(void);
|
---|
74 | void IniFitGvP1D(void);
|
---|
75 | void IniFitGv2D(void);
|
---|
76 | static int IniFitGaus(GeneralFitData& g,double& h,double& v
|
---|
77 | ,double& x0,double& y0,double& sx,double& sy,double& f);
|
---|
78 |
|
---|
79 | // Graphique
|
---|
80 | PIStdImgApp* mApp; // Do not delete
|
---|
81 | PIAFitterWind* FWindFit; // Fenetre de config interactive
|
---|
82 | // Objet a fitter
|
---|
83 | string mNObj; AnyDataObj* mObj; // Do not delete
|
---|
84 | // Structure de data pour le fit, parametres et options
|
---|
85 | GeneralFitData* mGData;
|
---|
86 | int mNPar,mNVar,mNBinX,mNBinY,mNData;
|
---|
87 | Vector mPar; Vector mStep; Vector mMin; Vector mMax; Vector mFix;
|
---|
88 | Vector mParSave; Vector mStepSave; Vector mMinSave; Vector mMaxSave; Vector mFixSave;
|
---|
89 | GeneralFit* mFit;
|
---|
90 | DFOPTIONS mOpt;
|
---|
91 | DFOPTIONS mOptSave;
|
---|
92 | // Possibles objets a fitter
|
---|
93 | Vector* mV; Histo* mH; // Do not delete
|
---|
94 | Matrix* mM; Histo2D* mH2; RzImage* mIm; // Do not delete
|
---|
95 | GeneralFitData* mG; // Do not delete
|
---|
96 | // Gestion des fonctions de fit predefinies
|
---|
97 | GeneralFunction* mFunction; string mFName;
|
---|
98 | // Gestion de fonction de fit definie par l'utilisateur
|
---|
99 | GeneralFunc* mFunc;
|
---|
100 | PDynLinkMgr* mDlUFunc;
|
---|
101 | string mNameFitFunc;
|
---|
102 | DlUserFitFunc mFitFunc;
|
---|
103 | DlUserFitFuncDer mFitFuncDer;
|
---|
104 | int mUFNVar, mUFNPar;
|
---|
105 | };
|
---|
106 |
|
---|
107 | #endif
|
---|