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