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