source: old/WuerzburgSoft/Thomas/mphys/MFit.h@ 17689

Last change on this file since 17689 was 1462, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 1.9 KB
Line 
1#ifndef MARS_MFit
2#define MARS_Mfit
3
4/*
5#include <float.h>
6#include <iomanip.h>
7
8#include <TF1.h>
9#include <TH1.h>
10#include <TH2.h>
11#include <TLine.h>
12#include <TLeaf.h>
13#include <TChain.h>
14#include <TGaxis.h>
15#include <TStyle.h>
16#include <TCanvas.h>
17#include <TMinuit.h>
18#include <TPolyMarker.h>
19#include <TTreePlayer.h>
20
21#include "MH.h"
22#include "MBinning.h"
23
24#include "MPhoton.h"
25*/
26#ifndef ROOT_TString
27#include <TString.h>
28#endif
29#ifndef ROOT_TObject
30#include <TObject.h>
31#endif
32
33class TH1;
34class TF1;
35
36class TMinuit;
37
38class MFit : public TObject
39{
40private:
41 static void Func(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t flag);
42 static void FuncLog(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t flag);
43
44 static TF1 *fgFunc;
45 static TH1 *fgHist;
46
47 static Int_t fgBinMin;
48 static Int_t fgBinMax;
49
50private:
51 enum {
52 kIsOwner = BIT(14)
53 };
54
55 TH1 *fHist;
56 TF1 *fFunc;
57
58 TMinuit *fMinuit;
59
60 void DeleteF();
61 void DeleteH();
62
63public:
64 MFit() : fHist(NULL), fFunc(NULL), fMinuit(NULL)
65 {
66 }
67
68 MFit(TString formula, Double_t min=0, Double_t max=1) : fHist(NULL), fFunc(NULL), fMinuit(NULL)
69 {
70 SetFunc(formula, min, max);
71 }
72
73 ~MFit()
74 {
75 DeleteF();
76 DeleteH();
77 }
78
79 void SetFunc(TF1 *f);
80 void SetFunc(TString formula, Double_t min, Double_t max);
81 void SetHist(TH1 *h, Bool_t candelete=kFALSE);
82 void SetRange(Double_t lo, Double_t hi);
83
84 void Fit(Bool_t log=kFALSE);
85 void FitLog() { Fit(kTRUE); }
86
87 void Fit(TH1 *h) { SetHist(h); Fit(); }
88 void FitLog(TH1 *h) { SetHist(h); FitLog(); }
89
90 void Print(Option_t *opt="") const;
91 void SetParameter(Int_t n, TString name, Double_t start, Double_t min=0, Double_t max=0);
92
93 Double_t GetParameter(Int_t n) const;
94 Double_t GetParError(Int_t n) const;
95
96 Double_t operator[](Int_t n) const;
97
98 TF1 *DrawCopy(Option_t *o="") const;
99
100 ClassDef(MFit, 0)
101};
102
103#endif
Note: See TracBrowser for help on using the repository browser.