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 |
|
---|
13 | #include "nomgadapter.h"
|
---|
14 |
|
---|
15 | #include "pdlmgr.h"
|
---|
16 | #include "dlftypes.h"
|
---|
17 | #include "piacmd.h"
|
---|
18 |
|
---|
19 | class PIStdImgApp;
|
---|
20 | class PIAFitterWind;
|
---|
21 |
|
---|
22 | #ifdef SANS_EVOLPLANCK
|
---|
23 | #include "cvector.h"
|
---|
24 | class GeneralFunction; class GeneralFunc; class GeneralFit;
|
---|
25 | class GeneralFitData;
|
---|
26 | #else
|
---|
27 | #include "tvector.h"
|
---|
28 | namespace SOPHYA {
|
---|
29 | class GeneralFunction; class GeneralFunc; class GeneralFit;
|
---|
30 | class GeneralFitData;
|
---|
31 | }
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | class PIAFitter : public CmdExecutor {
|
---|
35 | public :
|
---|
36 | PIAFitter(PIACmd* piac, PIStdImgApp* app);
|
---|
37 | virtual ~PIAFitter();
|
---|
38 | virtual int Execute(string& keyw, vector<string>& args);
|
---|
39 | virtual void LinkFitFunc(string const& fname, string const& funcname
|
---|
40 | ,int nvar,int npar);
|
---|
41 | virtual void PrepareFitFuncCFile(string const& fname, string const& funcname
|
---|
42 | ,int nvar,int npar);
|
---|
43 |
|
---|
44 | friend class PIAFitterWind;
|
---|
45 |
|
---|
46 | protected :
|
---|
47 |
|
---|
48 | typedef struct DFOptions {
|
---|
49 | bool okres, okfun;
|
---|
50 | int polcx,polcy; double xc,yc;
|
---|
51 | GeneralFitData::FitErrType err_type;
|
---|
52 | double err_scale,err_min;
|
---|
53 | double stc2;
|
---|
54 | int nstep;
|
---|
55 | int lp,lpg;
|
---|
56 | int_4 i1,i2,j1,j2;
|
---|
57 | bool fromlastfit,autoinifit;
|
---|
58 | } DFOPTIONS ;
|
---|
59 |
|
---|
60 | void ResetOptions(void);
|
---|
61 | void DecodeOptions(string opt);
|
---|
62 | void DecodeObject(string obj);
|
---|
63 | void CheckOptions(void);
|
---|
64 | void PrintOptions(void);
|
---|
65 | void FillGData(void);
|
---|
66 | void GetCentering(void);
|
---|
67 | void DecodeFunction(string func);
|
---|
68 | void ReSetParam(void);
|
---|
69 | void AutoIniFit(void);
|
---|
70 | void InitParFromLastFit(void);
|
---|
71 | void DecodeParam(string par,string step,string min,string max,string fix);
|
---|
72 | int DoFit(void);
|
---|
73 | void FitFunRes(void);
|
---|
74 | void LinFit(void);
|
---|
75 |
|
---|
76 | // pour initialiser les parametres du fit
|
---|
77 | void IniFitP1ou2D(void);
|
---|
78 | void IniFitGhP1D(void);
|
---|
79 | void IniFitGvP1D(void);
|
---|
80 | void IniFitGv2D(void);
|
---|
81 | static int IniFitGaus(GeneralFitData& g,double& h,double& v
|
---|
82 | ,double& x0,double& y0,double& sx,double& sy,double& f);
|
---|
83 |
|
---|
84 | // Graphique
|
---|
85 | PIStdImgApp* mApp; // Do not delete
|
---|
86 | PIAFitterWind* FWindFit; // Fenetre de config interactive
|
---|
87 | // Objet a fitter
|
---|
88 | string mNObj;
|
---|
89 | NObjMgrAdapter* mAdObj; // Ne pas deleter
|
---|
90 | // Structure de data pour le fit, parametres et options
|
---|
91 | GeneralFitData* mGData;
|
---|
92 | bool delmGData;
|
---|
93 | int_4 mNPar,mNVar,mNData;
|
---|
94 | Vector mPar; Vector mStep; Vector mMin; Vector mMax; Vector mFix;
|
---|
95 | Vector mParSave; Vector mStepSave; Vector mMinSave; Vector mMaxSave; Vector mFixSave;
|
---|
96 | GeneralFit* mFit;
|
---|
97 | DFOPTIONS mOpt;
|
---|
98 | DFOPTIONS mOptSave;
|
---|
99 | // Gestion des fonctions de fit predefinies
|
---|
100 | GeneralFunction* mFunction; string mFName;
|
---|
101 | // Gestion de fonction de fit definie par l'utilisateur
|
---|
102 | GeneralFunc* mFunc;
|
---|
103 | PDynLinkMgr* mDlUFunc;
|
---|
104 | string mNameFitFunc;
|
---|
105 | DlUserFitFunc mFitFunc;
|
---|
106 | DlUserFitFuncDer mFitFuncDer;
|
---|
107 | int_4 mUFNVar, mUFNPar;
|
---|
108 | };
|
---|
109 |
|
---|
110 | #endif
|
---|