1 | { |
---|
2 | gROOT->Reset(); |
---|
3 | #include "Riostream.h" |
---|
4 | #include "TSystem.h" |
---|
5 | |
---|
6 | Char_t buffer[256]; |
---|
7 | |
---|
8 | const Int_t n = 1100; |
---|
9 | |
---|
10 | Double_t En[n], Y1[n], Y2[n], diff[n], pres[n]; |
---|
11 | |
---|
12 | TCanvas *c1 = new TCanvas("c1", "c1",6,6,800,600); |
---|
13 | gStyle->SetOptStat(0); |
---|
14 | c1->SetLogx(); |
---|
15 | c1->SetFillColor(0); |
---|
16 | c1->SetBorderMode(0); |
---|
17 | c1->SetBorderSize(0); |
---|
18 | c1->SetFrameBorderMode(0); |
---|
19 | |
---|
20 | |
---|
21 | ifstream in; |
---|
22 | |
---|
23 | in.open("DEDX.hIoni.proton.asc_7bins_spl.out"); |
---|
24 | // in.open("DEDX.eIoni.e-.asc_spl.out"); |
---|
25 | if (!in.good()) break; |
---|
26 | |
---|
27 | // Ignore first blank line |
---|
28 | |
---|
29 | in.getline(buffer,256); |
---|
30 | |
---|
31 | for (Int_t i=0; i<n; i++) { |
---|
32 | in >> En[i] >> Y1[i] >> Y2[i] >> diff[i]; |
---|
33 | if (!in.good()) break; |
---|
34 | pres[i] = (Y1[i]/Y2[i] - 1)*100; |
---|
35 | } |
---|
36 | |
---|
37 | |
---|
38 | /* Int_t n = 0; |
---|
39 | while(!(in.eof())) { |
---|
40 | n++; |
---|
41 | in >> En[n] >> Y1[n] >> Y2[n] >> diff[n]; |
---|
42 | pres[n] = (Y1[n]/Y2[n] - 1)*100; |
---|
43 | } |
---|
44 | */ |
---|
45 | gr = new TGraph(n,En,pres); |
---|
46 | gr->SetTitle("proton in Pb, table 100 pts / 7 pts_spl per order"); |
---|
47 | gr->SetMarkerStyle(22); |
---|
48 | gr->SetMarkerSize(0.8); |
---|
49 | gr->GetYaxis()->SetLabelFont(132); |
---|
50 | gr->GetYaxis()->SetLabelSize(0.04); |
---|
51 | gr->GetXaxis()->SetLabelFont(132); |
---|
52 | gr->GetXaxis()->SetLabelSize(0.04); |
---|
53 | gr->GetXaxis()->SetTitle("E, MeV"); |
---|
54 | gr->GetYaxis()->SetTitle("dE/dx: (100pts/7pts_spl - 1), %"); |
---|
55 | gr->GetXaxis()->SetTitleOffset(1.2); |
---|
56 | gr->Draw("AP"); |
---|
57 | |
---|
58 | // draw the legend |
---|
59 | /* TLegend *leg = new TLegend(0.2,0.65,0.61,0.86); |
---|
60 | leg->SetTextFont(52); |
---|
61 | leg->SetTextSize(0.035); |
---|
62 | leg->SetLineColor(1); |
---|
63 | leg->SetLineStyle(1); |
---|
64 | leg->SetLineWidth(1); |
---|
65 | leg->SetFillStyle(0); |
---|
66 | leg->SetMargin(0.4); |
---|
67 | leg->SetBorderSize(1); |
---|
68 | TLegendEntry *entry=leg->AddEntry("NULL","p (110 MeV) in H_{2}O","h"); |
---|
69 | |
---|
70 | entry->SetTextAlign(22); |
---|
71 | entry=leg->AddEntry("NULL","Geant 4.9.1ref01","l"); |
---|
72 | entry->SetLineColor(1); |
---|
73 | entry->SetLineStyle(1); |
---|
74 | entry->SetLineWidth(1); |
---|
75 | entry->SetTextAlign(22); |
---|
76 | entry->SetTextColor(1); |
---|
77 | entry=leg->AddEntry(gr,"exp. data","p"); |
---|
78 | leg->Draw(); |
---|
79 | */ |
---|
80 | c1->Modified(); |
---|
81 | c1->cd(); |
---|
82 | } |
---|