source: trunk/Cosy/tpoint/mag.C@ 12958

Last change on this file since 12958 was 7104, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 4.9 KB
Line 
1void mag()
2{
3 TGraph g;
4
5 // # --- 09.08.2004 --- 01:31:36.679
6 g.SetPoint(g.GetN(), 1.3, 1.495);
7 g.SetPoint(g.GetN(), 2.4, 2.343);
8 g.SetPoint(g.GetN(), 0.8, 1.316);
9 g.SetPoint(g.GetN(), 0.9, 2.079);
10 g.SetPoint(g.GetN(), 2.0, 2.065);
11
12 // # --- 09.08.2004 --- 02:40:08.798
13 g.SetPoint(g.GetN(), 0.0, 1.054);
14 g.SetPoint(g.GetN(), 2.9, 2.246);
15 g.SetPoint(g.GetN(), 1.2, 1.614);
16 g.SetPoint(g.GetN(), 2.4, 2.21);
17 g.SetPoint(g.GetN(), 3.0, 2.923);
18 g.SetPoint(g.GetN(), 2.9, 2.013);
19 g.SetPoint(g.GetN(), 3.0, 2.212);
20 g.SetPoint(g.GetN(), 3.2, 2.835);
21 g.SetPoint(g.GetN(), 3.8, 3.069);
22 g.SetPoint(g.GetN(), 2.9, 2.433);
23 g.SetPoint(g.GetN(), 1.9, 1.996);
24 g.SetPoint(g.GetN(), 2.4, 2.377);
25 g.SetPoint(g.GetN(), 2.3, 2.201);
26 g.SetPoint(g.GetN(), 2.9, 2.608);
27 g.SetPoint(g.GetN(), 3.2, 3.336);
28
29 // # --- 10.08.2004 --- 02:08:14.139
30 g.SetPoint(g.GetN(), 3.6, 3.267);
31 g.SetPoint(g.GetN(), 3.7, 3.445);
32 g.SetPoint(g.GetN(), 3.2, 2.918);
33 g.SetPoint(g.GetN(), 2.1, 2.179);
34 g.SetPoint(g.GetN(), 3.4, 2.633);
35 g.SetPoint(g.GetN(), 2.0, 2.098);
36 g.SetPoint(g.GetN(), 1.8, 2.105);
37 g.SetPoint(g.GetN(), 2.9, 2.765);
38 g.SetPoint(g.GetN(), 2.5, 2.380);
39 g.SetPoint(g.GetN(), 1.2, 1.598);
40 g.SetPoint(g.GetN(), 2.7, 2.849);
41 g.SetPoint(g.GetN(), 3.8, 3.398);
42 g.SetPoint(g.GetN(), 3.8, 3.374);
43 g.SetPoint(g.GetN(), 3.6, 3.388);
44 g.SetPoint(g.GetN(), 0.2, 1.274);
45 g.SetPoint(g.GetN(), 1.7, 2.055);
46
47 // # --- 11.08.2004 --- 02:44:17.277
48 g.SetPoint(g.GetN(), 1.8, 2.104);
49 g.SetPoint(g.GetN(), 1.3, 1.716);
50 g.SetPoint(g.GetN(), 0.8, 1.432);
51 g.SetPoint(g.GetN(), 1.2, 1.614);
52 g.SetPoint(g.GetN(), 2.9, 2.856);
53 g.SetPoint(g.GetN(), 0.0, 1.001);
54 g.SetPoint(g.GetN(), 2.4, 2.175);
55 g.SetPoint(g.GetN(), 3.0, 2.353);
56 g.SetPoint(g.GetN(), 3.7, 3.34 );
57 g.SetPoint(g.GetN(), 2.5, 2.132);
58 g.SetPoint(g.GetN(), 2.3, 2.322);
59 g.SetPoint(g.GetN(), 2.0, 1.963);
60 g.SetPoint(g.GetN(), 2.8, 2.568);
61 g.SetPoint(g.GetN(), 2.4, 2.502);
62 g.SetPoint(g.GetN(), 2.2, 2.126);
63
64 // # --- 12.08.2004 --- 03:24:01.355
65 g.SetPoint(g.GetN(), 3.2, 2.774);
66 g.SetPoint(g.GetN(), 0.8, 1.046);
67 g.SetPoint(g.GetN(), 3.8, 3.629);
68 g.SetPoint(g.GetN(), 2.4, 2.450);
69 g.SetPoint(g.GetN(), 1.3, 1.722);
70 g.SetPoint(g.GetN(), 3.1, 2.573);
71 g.SetPoint(g.GetN(), 2.1, 2.038);
72 g.SetPoint(g.GetN(), 1.8, 1.980);
73 g.SetPoint(g.GetN(), 0.5, 0.840);
74
75 // # --- 13.08.2004 --- 04:25:55.888
76 g.SetPoint(g.GetN(), 2.0, 1.944);
77 g.SetPoint(g.GetN(), 2.1, 2.042);
78 g.SetPoint(g.GetN(), 2.2, 2.140);
79 g.SetPoint(g.GetN(), 3.9, 3.688);
80 g.SetPoint(g.GetN(), 2.4, 2.362);
81 g.SetPoint(g.GetN(), 2.1, 1.780);
82
83 // # --- 19.08.2004 --- 21:14:23.126
84 g.SetPoint(g.GetN(), 0.8, 1.463);
85 g.SetPoint(g.GetN(), 3.9, 3.203);
86
87 // # --- 20.08.2004 --- 21:31:24.155
88 g.SetPoint(g.GetN(), 3.2, 3.091);
89 g.SetPoint(g.GetN(), 2.1, 2.353);
90
91 // # --- 21.08.2004 --- 21:18:42.724
92 g.SetPoint(g.GetN(), 2.8, 2.530);
93 g.SetPoint(g.GetN(), 2.8, 2.597);
94 g.SetPoint(g.GetN(), 2.2, 2.285);
95
96 // # --- 22.08.2004 --- 21:58:59.897
97 g.SetPoint(g.GetN(), 2.9, 2.936);
98 g.SetPoint(g.GetN(), 1.9, 2.125);
99 g.SetPoint(g.GetN(), 1.8, 2.172);
100 g.SetPoint(g.GetN(), 2.7, 2.588);
101 g.SetPoint(g.GetN(), 2.2, 2.637);
102
103 // # --- 23.08.2004 22:15:40.706 ---
104 g.SetPoint(g.GetN(), 2.5, 2.033);
105 g.SetPoint(g.GetN(), 2.9, 2.489);
106 g.SetPoint(g.GetN(), 1.3, 1.443);
107 g.SetPoint(g.GetN(), 3.2, 2.643);
108 g.SetPoint(g.GetN(), 3.7, 3.113);
109 g.SetPoint(g.GetN(), 3.1, 2.378);
110 g.SetPoint(g.GetN(), 3.2, 2.650);
111
112 // # --- 24.08.2004 --- 22:40:07.311
113 g.SetPoint(g.GetN(), 2.8, 2.439);
114 g.SetPoint(g.GetN(), 0.0, 0.863);
115 g.SetPoint(g.GetN(), 0.8, 1.225);
116 g.SetPoint(g.GetN(), 3.0, 2.870);
117 g.SetPoint(g.GetN(), 3.9, 3.576);
118 g.SetPoint(g.GetN(), 2.9, 2.478);
119
120
121 g.Fit("pol1");
122
123 TF1 *f = g.GetFunction("pol1");
124 Double_t t = f->GetParameter(0);
125 Double_t m = f->GetParameter(1);
126
127 cout << "y = " << m << " * x + " << t << endl;
128
129 TH1F dx("dx", "", 20, -2, 2);
130 TH1F dy("dy", "", 20, -2, 2);
131 //dx.SetLineColor(kRed);
132 dy.SetLineColor(kBlue);
133 dx.SetXTitle("dM");
134 dx.SetYTitle("Counts");
135 for (int i=0; i<g.GetN(); i++)
136 {
137 Double_t x = g.GetX()[i];
138 Double_t y = g.GetY()[i];
139 Double_t vy = m*x + t;
140 Double_t vx = (y-t)/m;
141 dx.Fill(x-vx);
142 dy.Fill(y-vy);
143 }
144
145 dx.SetMaximum(TMath::Max(dx.GetMaximum(), dy.GetMaximum())*1.05);
146 dy.SetMaximum(dx.GetMaximum());
147
148
149 TCanvas *c=new TCanvas;
150 c->Divide(1,2);
151 c->cd(1);
152 gPad->SetBorderMode(0);
153 gStyle->SetOptFit();
154 TGraph *g0 = (TGraph*)g.DrawClone("A*");
155 g0->GetHistogram()->SetXTitle("M");
156 g0->GetHistogram()->SetYTitle("M_{est}");
157 c->cd(2);
158 gPad->SetBorderMode(0);
159 gStyle->SetOptFit();
160 dx.Fit("gaus");
161 dx.DrawCopy();
162 dy.DrawCopy("same");
163}
Note: See TracBrowser for help on using the repository browser.