Rev 269 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 269 | Rev 270 | ||
|---|---|---|---|
| Line 32... | Line 32... | ||
| 32 | 32 | ||
| 33 | int th1fit(Double_t *data, const char *name, const char *title, int xbins, double xmin, double xmax, double min=0, double max=1,const char *func=NULL, const char *pars=NULL){ |
33 | int th1fit(Double_t *data, const char *name, const char *title, int xbins, double xmin, double xmax, double min=0, double max=1,const char *func=NULL, const char *pars=NULL){ |
| 34 | 34 | ||
| 35 | TH1F *h = new TH1F(name,title,xbins, xmin,xmax); |
35 | TH1F *h = new TH1F(name,title,xbins, xmin,xmax); |
| 36 | for (int i=0;i<xbins+2;i++) h->SetBinContent(i,data[i]); |
36 | for (int i=0;i<xbins+2;i++) h->SetBinContent(i,data[i]); |
| 37 | - | ||
| 38 | gStyle->SetOptFit(1111); |
- | |
| 39 | TF1 *f = new TF1("f",func,min,max); |
37 | TF1 *f = new TF1("f",func,min,max); |
| 40 | 38 | ||
| 41 | char *s = (char *)pars; |
39 | char *s = (char *)pars; |
| 42 | 40 | ||
| 43 | int cntr=0; |
41 | int cntr=0; |
| Line 63... | Line 61... | ||
| 63 | //printf("----[0x] %s\n",s); |
61 | //printf("----[0x] %s\n",s); |
| 64 | } |
62 | } |
| 65 | 63 | ||
| 66 | 64 | ||
| 67 | h->Fit(f,"RQ"); |
65 | h->Fit(f,"RQ"); |
| 68 | h->Draw(); |
- | |
| 69 | 66 | ||
| 70 | send_message(1,TBufferJSON::ConvertToJSON(h),0 ); |
67 | send_message(1,TBufferJSON::ConvertToJSON(h),0 ); |
| 71 | return 0; |
68 | return 0; |
| 72 | } |
69 | } |