#ifndef FITONEDIMDIALOG
#define FITONEDIMDIALOG
#include "TGraph.h"
#include "TH1.h"
#include "TVirtualPad.h"
#include "TPad.h"
#include "TRootCanvas.h"
#include "TString.h"
#include "FhMarker.h"
#include "TGMrbValuesAndText.h"
class FitOneDimDialog : public TObject {
private:
TRootCanvas* fParentWindow;
TGMrbValuesAndText *fDialog;
TString fFuncName;
Int_t fFuncNumber;
TString fFuncFromFile;
TCanvas *fSelPad;
TH1 *fSelHist;
TF1 *fCalFunc;
TF1 *fFitFunc;
TGraph *fGraph;
Color_t fColor;
Width_t fWidth;
Style_t fStyle;
TString fName;
TString fGausFuncName;
TString fExpFuncName;
TString fPolFuncName;
TString fFormFuncName;
TString fFormula;
FhMarkerList * fMarkers;
Double_t fFrom;
Double_t fTo;
Double_t fMean;
Double_t fMeanError;
Double_t fConstant;
Double_t fExpA;
Double_t fExpB;
Double_t fExpC;
Double_t fExpO;
Int_t fExpFixA;
Int_t fExpFixB;
Int_t fExpFixC;
Int_t fExpFixO;
Int_t fPolN;
Double_t fPolPar[6];
Int_t fPolFixPar[6];
Double_t fFormPar[6];
Int_t fFormFixPar[6];
Int_t fAdded;
Double_t fLinBgConst;
Double_t fLinBgSlope;
Bool_t fLinBgSet;
Int_t fUseoldpars;
Int_t fUsedbg;
Int_t fNpeaks;
Int_t fReqNmarks;
Int_t fNmarks;
Int_t fNevents;
Int_t fNsegsGraph;
Int_t fFitOptAddAll;
Bool_t fFitPeakListDone;
Int_t fAutoClearMarks;
Int_t fInteractive;
Double_t fPeakSep;
Double_t fFitWindow;
Int_t fBackg0;
Int_t fSlope0;
Int_t fOnesig;
Int_t fGaussOnly;
Int_t fGaussTail;
Int_t fTailOnly;
Int_t fLowtail;
Int_t fHightail;
Int_t fShowcof;
Double_t fMeanBond;
Int_t fConfirmStartValues;
Int_t fPrintStartValues;
Int_t fFitOptLikelihood;
Int_t fFitOptQuiet;
Int_t fFitOptOneLine;
Int_t fFitOptVerbose;
Int_t fFitOptMinos;
Int_t fFitOptErrors1;
Int_t fFitOptIntegral;
Int_t fFitOptNoDraw;
Int_t fFitPrintCovariance;
Int_t fNpeaksList;
Int_t fNpeaksListIndex;
TArrayD fConstantList;
TArrayD fMeanList;
TArrayD fSigmaList;
TArrayD fChi2List;
public:
enum EFitHistBits {
kSelected = BIT(15)
};
public:
FitOneDimDialog(TH1 * hist, Int_t type = 1, Int_t interactive = 1);
FitOneDimDialog(TGraph * graph, Int_t type = 1, Int_t interactive = 1);
void DisplayMenu(Int_t type = 1);
virtual ~FitOneDimDialog();
void RecursiveRemove(TObject * obj);
Bool_t FitPeakList();
Bool_t FitGausExecute();
void FitExpExecute();
void DrawExpExecute();
void CalcStartParExp();
void ExpExecute(Int_t draw_only = 0);
void FitPolExecute();
void DrawPolExecute();
void PolExecute(Int_t draw_only = 0);
void PrintCorrelation();
void AddPeaktoList(TF1 *func);
Double_t GetParValue(const char * pname);
void PrintPeakList();
void FitFormExecute();
void DrawFormExecute();
void GraphFormExecute();
void FormExecute(Int_t draw_only = 0);
void FillHistRandom();
TH1 *FindHistInPad();
void SetFitOptions(){};
Int_t GetMaxBin(TH1 * h1, Int_t binl, Int_t binu);
void GetGaussEstimate(TH1 *h, Double_t from, Double_t to,
Double_t bg,TArrayD & par);
void GetGaussEstimate(TGraph *g, Double_t from, Double_t to,
Double_t bg,TArrayD & par);
void DetLinearBackground();
Int_t GetMarkers();
void ClearMarkers();
void ClearFunctionList();
void WriteoutFunction();
void PrintMarkers();
Int_t SetMarkers();
void SetFittingOptions();
Bool_t FitPeakListDone() { return fFitPeakListDone; };
void SaveDefaults();
void RestoreDefaults();
void CloseDialog();
void CloseDown(Int_t wid);
void IncrementIndex(TString * arg);
void SaveFunction();
void GetFunction();
void ExecuteGetFunction();
void GetSelectedFunction();
void SetStartParameters();
void SetPeakSep( Double_t peaksep) { fPeakSep = peaksep; };
void SetFitWindow( Double_t fitwindow) { fFitWindow = fitwindow; };
void SetUseoldpars( Int_t useoldpars) { fUseoldpars = useoldpars; };
void SetUsedbg( Int_t usedbg) { fUsedbg = usedbg; };
void SetNpeaks( Int_t npeaks) { fNpeaks = npeaks; };
void SetReqNmarks( Int_t reqnmarks) { fReqNmarks = reqnmarks; };
void SetNmarks( Int_t nmarks) { fNmarks = nmarks; };
void SetNevents( Int_t nevents) { fNevents = nevents; };
void SetBackg0( Int_t backg0) { fBackg0 = backg0; };
void SetSlope0( Int_t slope0) { fSlope0 = slope0; };
void SetOnesig( Int_t onesig) { fOnesig = onesig; };
void SetLowtail( Int_t lowtail) { fLowtail = lowtail; };
void SetHightail( Int_t hightail) { fHightail = hightail; };
void SetShowcof( Int_t showcof) { fShowcof = showcof; };
void SetAutoClearMarks( Int_t autoclearmarks) { fAutoClearMarks = autoclearmarks; };
void SetConfirmStartValues( Int_t confirmstartvalues) { fConfirmStartValues = confirmstartvalues; };
void SetFitOptLikelihood( Int_t fitoptlikelihood) { fFitOptLikelihood = fitoptlikelihood; };
void SetFitOptQuiet( Int_t fitoptquiet) { fFitOptQuiet = fitoptquiet; };
void SetFitOptOneLine( Int_t val) {fFitOptOneLine = val; };
void SetFitOptVerbose( Int_t fitoptverbose) { fFitOptVerbose = fitoptverbose; };
void SetFitOptMinos( Int_t fitoptminos) { fFitOptMinos = fitoptminos; };
void SetFitOptErrors1( Int_t fitopterrors1) { fFitOptErrors1 = fitopterrors1; };
void SetFitOptIntegral( Int_t fitoptintegral) { fFitOptIntegral = fitoptintegral; };
void SetFitOptNoDraw( Int_t fitoptnodraw) { fFitOptNoDraw = fitoptnodraw; };
void SetFitOptAddAll( Int_t fitoptaddall) { fFitOptAddAll = fitoptaddall; };
void SetFitPrintCovariance( Int_t fitprintcovariance) { fFitPrintCovariance = fitprintcovariance; };
Double_t GetPeakSep() { return fPeakSep; };
Double_t GetFitWindow() { return fFitWindow; };
Int_t GetUseoldpars() { return fUseoldpars; };
Int_t GetUsedbg() { return fUsedbg; };
Int_t GetNpeaks() { return fNpeaks; };
Int_t GetReqNmarks() { return fReqNmarks; };
Int_t GetNmarks() { return fNmarks; };
Int_t GetNevents() { return fNevents; };
Int_t GetBackg0() { return fBackg0; };
Int_t GetSlope0() { return fSlope0; };
Int_t GetOnesig() { return fOnesig; };
Int_t GetLowtail() { return fLowtail; };
Int_t GetHightail() { return fHightail; };
Int_t GetShowcof() { return fShowcof; };
Int_t GetAutoClearMarks() { return fAutoClearMarks; };
Int_t GetConfirmStartValues() { return fConfirmStartValues; };
Int_t GetFitOptLikelihood() { return fFitOptLikelihood; };
Int_t GetFitOptQuiet() { return fFitOptQuiet; };
Int_t GetFitOptOneLine() {return fFitOptOneLine; };
Int_t GetFitOptVerbose() { return fFitOptVerbose; };
Int_t GetFitOptMinos() { return fFitOptMinos; };
Int_t GetFitOptErrors1() { return fFitOptErrors1; };
Int_t GetFitOptIntegral() { return fFitOptIntegral; };
Int_t GetFitOptNoDraw() { return fFitOptNoDraw; };
Int_t GetFitOptAddAll() { return fFitOptAddAll; };
Int_t GetFitPrintCovariance() { return fFitPrintCovariance; };
void CRButtonPressed(Int_t, Int_t, TObject *){};
void Check4Reselect();
ClassDef(FitOneDimDialog,0)
};
#endif