| [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 | class RzImage; //CMV_A_FAIRE class RzImage; | 
|---|
|  | 22 |  | 
|---|
|  | 23 | #ifdef SANS_EVOLPLANCK | 
|---|
| [545] | 24 | #include "cvector.h" | 
|---|
| [385] | 25 | class GeneralFunction; class GeneralFunc; class GeneralFit; | 
|---|
| [379] | 26 | class GeneralFitData; | 
|---|
| [495] | 27 | class Histo;  class Histo2D; | 
|---|
| [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; | 
|---|
|  | 34 | } | 
|---|
| [493] | 35 | #endif | 
|---|
| [361] | 36 |  | 
|---|
|  | 37 | class PIAFitter : public CmdExecutor { | 
|---|
|  | 38 | public : | 
|---|
| [379] | 39 | PIAFitter(PIACmd* piac, PIStdImgApp* app); | 
|---|
|  | 40 | virtual ~PIAFitter(); | 
|---|
|  | 41 | virtual int Execute(string& keyw, vector<string>& args); | 
|---|
| [385] | 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); | 
|---|
| [361] | 46 |  | 
|---|
| [379] | 47 | friend class PIAFitterWind; | 
|---|
| [361] | 48 |  | 
|---|
|  | 49 | protected : | 
|---|
| [379] | 50 |  | 
|---|
| [361] | 51 | typedef struct DFOptions { | 
|---|
| [379] | 52 | bool okres, okfun; | 
|---|
| [361] | 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; | 
|---|
| [390] | 59 | bool fromlastfit,autoinifit; | 
|---|
| [361] | 60 | } DFOPTIONS ; | 
|---|
|  | 61 |  | 
|---|
| [379] | 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); | 
|---|
| [390] | 71 | void AutoIniFit(void); | 
|---|
| [379] | 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 |  | 
|---|
| [392] | 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 |  | 
|---|
| [385] | 86 | // Graphique | 
|---|
| [379] | 87 | PIStdImgApp* mApp; // Do not delete | 
|---|
| [385] | 88 | PIAFitterWind* FWindFit; // Fenetre de config interactive | 
|---|
|  | 89 | // Objet a fitter | 
|---|
| [379] | 90 | string mNObj; AnyDataObj* mObj; // Do not delete | 
|---|
| [385] | 91 | // Structure de data pour le fit, parametres et options | 
|---|
| [379] | 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; | 
|---|
| [385] | 99 | // Possibles objets a fitter | 
|---|
| [379] | 100 | Vector* mV; Histo* mH; // Do not delete | 
|---|
| [493] | 101 | Matrix* mM; Histo2D* mH2; // Do not delete | 
|---|
|  | 102 | RzImage* mIm; // Do not delete | 
|---|
| [379] | 103 | GeneralFitData* mG; // Do not delete | 
|---|
| [385] | 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; | 
|---|
| [384] | 108 | PDynLinkMgr* mDlUFunc; | 
|---|
|  | 109 | string mNameFitFunc; | 
|---|
|  | 110 | DlUserFitFunc mFitFunc; | 
|---|
|  | 111 | DlUserFitFuncDer mFitFuncDer; | 
|---|
|  | 112 | int mUFNVar, mUFNPar; | 
|---|
| [361] | 113 | }; | 
|---|
|  | 114 |  | 
|---|
|  | 115 | #endif | 
|---|