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