1 |
{ |
2 |
|
3 |
TString name1 = "../GoodParam/desaturation_position.txt"; |
4 |
ifstream fin1(name1); |
5 |
|
6 |
|
7 |
gROOT->SetStyle("Plain"); |
8 |
gStyle->SetOptStat(0); |
9 |
gStyle->SetOptFit(0); |
10 |
gStyle->SetFuncColor( kRed ); |
11 |
|
12 |
Float_t tp[48][4]; |
13 |
|
14 |
char *s = new char[1]; |
15 |
|
16 |
Int_t idummy; |
17 |
Float_t p0,p1,p2,p3; |
18 |
|
19 |
|
20 |
for (int i=0; i<48; i++) { |
21 |
fin1>>idummy>>p0>>p1>>p2>>p3; |
22 |
cout<<" "<<idummy<<" "<<p0<<" "<<p1<<" "<<p2<<" "<<p3<<endl; |
23 |
tp[i][0]=p0; |
24 |
tp[i][1]=p1; |
25 |
tp[i][2]=p2; |
26 |
tp[i][3]=p3; |
27 |
} |
28 |
fin1.close(); |
29 |
|
30 |
|
31 |
TCanvas *c = new TCanvas("c","histograms",800,600); |
32 |
|
33 |
TF1 *f1[48]; |
34 |
|
35 |
TGraph *gr[48]; |
36 |
|
37 |
|
38 |
for (Int_t i=0; i<48; i++) { |
39 |
|
40 |
cout<<"PMT "<<i<<endl; |
41 |
|
42 |
/* |
43 |
double ToFNaNuclei::f_pos( TArrayF &p, float x ) |
44 |
return |
45 |
p[0] + |
46 |
p[1]*x + |
47 |
p[2]*x*x + |
48 |
p[3]*x*x*x; |
49 |
*/ |
50 |
|
51 |
f1[i] = new TF1("f1","[0]+[1]*x+[2]*x*x+[3]*x*x*x",0,1000); |
52 |
f1[i].SetParameters(tp[i][0],tp[i][1],tp[i][2],tp[i][3]); |
53 |
f1[i]->SetLineColor(kRed); |
54 |
|
55 |
|
56 |
for (Int_t ii=1; ii<20; ii++) { |
57 |
Float_t xb = ii*20.; |
58 |
Float_t yhelp = f1[i]->Eval(xb); |
59 |
cout<<xb<<" "<<yhelp<<endl; |
60 |
} |
61 |
|
62 |
|
63 |
|
64 |
TH2F *hr = new TH2F("hr","",2,0,1000,2,0,1000); |
65 |
hr->SetXTitle("adccorr"); |
66 |
hr->SetYTitle("f_pos"); |
67 |
hr->Draw(); |
68 |
|
69 |
f1[i]->Draw("same"); |
70 |
|
71 |
//gPad->SetLogy(); |
72 |
gPad->SetGrid(); |
73 |
|
74 |
c->Update(); |
75 |
gets(s); |
76 |
|
77 |
} |
78 |
|
79 |
//========================================================================== |
80 |
//========================================================================== |
81 |
//========================================================================== |
82 |
|
83 |
TCanvas *c1 = new TCanvas("c1","histograms1",1100,800); |
84 |
c1->Divide(8,6); |
85 |
|
86 |
TF1 *f1[48]; |
87 |
|
88 |
for (Int_t i=0; i<48; i++) { |
89 |
|
90 |
cout<<"PMT "<<i<<endl; |
91 |
|
92 |
c1->cd(i+1); |
93 |
|
94 |
|
95 |
TH2F *hr = new TH2F("hr","",2,0,1000,2,0,1000); |
96 |
hr->SetXTitle("adccorr"); |
97 |
hr->SetYTitle("f_pos"); |
98 |
hr->Draw(); |
99 |
|
100 |
|
101 |
f1[i]->Draw("same"); |
102 |
|
103 |
//gPad->SetLogy(); |
104 |
gPad->SetGrid(); |
105 |
|
106 |
} |
107 |
|
108 |
|
109 |
} |
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
} |