Subversion Repositories f9daq

Rev

Rev 268 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 268 Rev 269
Line 3... Line 3...
3
#include <TH1F.h>
3
#include <TH1F.h>
4
#include <TCanvas.h>
4
#include <TCanvas.h>
5
#include <TF1.h>
5
#include <TF1.h>
6
#include <TStyle.h>
6
#include <TStyle.h>
7
#include <TBufferJSON.h>
7
#include <TBufferJSON.h>
-
 
8
#include <TString.h>
-
 
9
#include <TObjString.h>
-
 
10
#include <string.h>
8
//#include <TBufferXML.h>
11
//#include <TBufferXML.h>
9
class Hdr{
12
class Hdr{
10
public:
13
public:
11
  int id;
14
  int id;
12
  int len;
15
  int len;
Line 32... Line 35...
32
TH1F *h = new TH1F(name,title,xbins, xmin,xmax);
35
TH1F *h = new TH1F(name,title,xbins, xmin,xmax);
33
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]);
34
 
37
 
35
gStyle->SetOptFit(1111);
38
gStyle->SetOptFit(1111);
36
TF1 *f  = new TF1("f",func,min,max);
39
TF1 *f  = new TF1("f",func,min,max);
-
 
40
 
-
 
41
char *s = (char *)pars;
-
 
42
 
-
 
43
int cntr=0;
-
 
44
char *p = strchr(s,',');
-
 
45
if (p!=NULL){
-
 
46
  do {
-
 
47
    char tok[0xFF];
-
 
48
    strncpy(tok, s, p-s);
-
 
49
    tok[p-s]=0;
-
 
50
   
-
 
51
    if (strlen(tok)) {
-
 
52
      //printf("*");
-
 
53
      f->SetParameter(cntr,atof(tok));
-
 
54
    }
-
 
55
    //printf("-----[%d] length=%d  %s\n", cntr, strlen(tok),tok);
-
 
56
    s = p + 1;
-
 
57
    cntr++;
-
 
58
    p = strchr(s,',');
-
 
59
  } while (p!=NULL);
-
 
60
}
-
 
61
if (strlen(s)>0) {
-
 
62
    f->SetParameter(cntr,atof(s));
37
//TCanvas *v =new TCanvas();
63
    //printf("----[0x] %s\n",s);
-
 
64
}
-
 
65
 
-
 
66
 
38
h->Fit(f,"RQ");
67
h->Fit(f,"RQ");
39
h->Draw();
68
h->Draw();
40
//v->Modified();
-
 
41
//v->Update();
69
 
42
send_message(1,TBufferJSON::ConvertToJSON(h),0 );
70
send_message(1,TBufferJSON::ConvertToJSON(h),0 );
43
return 0;
71
return 0;
44
}
72
}