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