| [361] | 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 |  | 
|---|
| [1207] | 13 | #include "nomgadapter.h" | 
|---|
| [361] | 14 |  | 
|---|
|  | 15 | #include "pdlmgr.h" | 
|---|
|  | 16 | #include "dlftypes.h" | 
|---|
|  | 17 | #include "piacmd.h" | 
|---|
|  | 18 |  | 
|---|
|  | 19 | class PIStdImgApp; | 
|---|
| [379] | 20 | class PIAFitterWind; | 
|---|
| [495] | 21 |  | 
|---|
|  | 22 | #ifdef SANS_EVOLPLANCK | 
|---|
| [545] | 23 | #include "cvector.h" | 
|---|
| [385] | 24 | class GeneralFunction; class GeneralFunc; class GeneralFit; | 
|---|
| [379] | 25 | class GeneralFitData; | 
|---|
| [493] | 26 | #else | 
|---|
| [545] | 27 | #include "tvector.h" | 
|---|
| [551] | 28 | namespace SOPHYA { | 
|---|
| [495] | 29 | class GeneralFunction; class GeneralFunc; class GeneralFit; | 
|---|
|  | 30 | class GeneralFitData; | 
|---|
|  | 31 | } | 
|---|
| [493] | 32 | #endif | 
|---|
| [361] | 33 |  | 
|---|
|  | 34 | class PIAFitter : public CmdExecutor { | 
|---|
|  | 35 | public : | 
|---|
| [379] | 36 | PIAFitter(PIACmd* piac, PIStdImgApp* app); | 
|---|
|  | 37 | virtual ~PIAFitter(); | 
|---|
|  | 38 | virtual int Execute(string& keyw, vector<string>& args); | 
|---|
| [385] | 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); | 
|---|
| [361] | 43 |  | 
|---|
| [379] | 44 | friend class PIAFitterWind; | 
|---|
| [361] | 45 |  | 
|---|
|  | 46 | protected : | 
|---|
| [379] | 47 |  | 
|---|
| [361] | 48 | typedef struct DFOptions { | 
|---|
| [379] | 49 | bool okres, okfun; | 
|---|
| [361] | 50 | int polcx,polcy; double xc,yc; | 
|---|
| [1207] | 51 | GeneralFitData::FitErrType err_type; | 
|---|
|  | 52 | double err_scale,err_min; | 
|---|
| [361] | 53 | double stc2; | 
|---|
|  | 54 | int nstep; | 
|---|
|  | 55 | int lp,lpg; | 
|---|
| [1091] | 56 | int_4 i1,i2,j1,j2; | 
|---|
| [390] | 57 | bool fromlastfit,autoinifit; | 
|---|
| [361] | 58 | } DFOPTIONS ; | 
|---|
|  | 59 |  | 
|---|
| [379] | 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); | 
|---|
| [1207] | 66 | void GetCentering(void); | 
|---|
| [379] | 67 | void DecodeFunction(string func); | 
|---|
|  | 68 | void ReSetParam(void); | 
|---|
| [390] | 69 | void AutoIniFit(void); | 
|---|
| [379] | 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 |  | 
|---|
| [392] | 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 |  | 
|---|
| [385] | 84 | // Graphique | 
|---|
| [379] | 85 | PIStdImgApp* mApp; // Do not delete | 
|---|
| [385] | 86 | PIAFitterWind* FWindFit; // Fenetre de config interactive | 
|---|
|  | 87 | // Objet a fitter | 
|---|
| [1207] | 88 | string mNObj; | 
|---|
|  | 89 | NObjMgrAdapter* mAdObj; // Ne pas deleter | 
|---|
| [385] | 90 | // Structure de data pour le fit, parametres et options | 
|---|
| [379] | 91 | GeneralFitData* mGData; | 
|---|
| [1207] | 92 | bool delmGData; | 
|---|
|  | 93 | int_4 mNPar,mNVar,mNData; | 
|---|
| [379] | 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; | 
|---|
| [385] | 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; | 
|---|
| [384] | 103 | PDynLinkMgr* mDlUFunc; | 
|---|
|  | 104 | string mNameFitFunc; | 
|---|
|  | 105 | DlUserFitFunc mFitFunc; | 
|---|
|  | 106 | DlUserFitFuncDer mFitFuncDer; | 
|---|
| [1091] | 107 | int_4 mUFNVar, mUFNPar; | 
|---|
| [361] | 108 | }; | 
|---|
|  | 109 |  | 
|---|
|  | 110 | #endif | 
|---|