source: trunk/MagicSoft/Cosy/analse.C@ 4300

Last change on this file since 4300 was 1751, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 1.4 KB
Line 
1
2Int_t fBending(Int_t zd)
3{
4 return zd-1592;
5}
6
7Int_t GetSePos(Int_t p0, Int_t p1)
8{
9 return (p0-p1)/2;
10}
11
12void analse()
13{
14 TH2F hist1("Diff", "Difference of SE values", 201, -90, 110, 25, -12, 12);
15 hist1.SetXTitle("ZA [\\circ]");
16 hist1.SetYTitle("\\Delta SE");
17
18 // ifstream fin("log/shaftencoder_slow_singleside.log");
19 //ifstream fin("log/shaftencoder_fast.log");
20 ifstream fin("log/shaftencoder.log");
21
22 Int_t offset = 999999;
23
24 Int_t turn[2], pos[2]={999999, 999999};
25 while (!fin.eof())
26 {
27 Int_t id;
28 fin >> id;
29
30 fin >> turn[id-4] >> pos[id-4];
31
32 if (offset==999999 && pos[0]!=999999 && pos[1]!=999999)
33 offset = pos[1]+pos[0];
34
35 if (offset==999999)
36 continue;
37
38 hist1.Fill(fBending(GetSePos(pos[0], pos[1]))*360/16384,
39 pos[0]+pos[1]-offset);
40 }
41
42 TCanvas *c=new TCanvas("c1", "", 1000, 1000);
43 c->Divide(1,2);
44
45 c->cd(1);
46 TH2 *h=hist1.DrawCopy();
47
48 TProfile *p = h->ProfileX("_pfx", -1, 9999, "s");
49 p->SetLineColor(kBlue);
50 p->Draw("same");
51 p->SetBit(kCanDelete);
52
53 c->cd(2);
54 TH1F p2("spread", "Spread of the differences", hist1.GetNbinsX(), hist1.GetBinLowEdge(1),
55 hist1.GetBinLowEdge(hist1.GetNbinsX()+1));
56 p2.SetXTitle("ZA [\\circ]");
57 for (int i=0; i<hist1.GetNbinsX(); i++)
58 p2.SetBinError(i, p->GetBinError(i));
59 p2.SetLineColor(kRed);
60 p2.SetStats(0);
61 p2.DrawCopy();
62}
Note: See TracBrowser for help on using the repository browser.