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