[1199] | 1 | #!/usr/bin/env python |
---|
| 2 | |
---|
| 3 | import os, sys |
---|
| 4 | from ROOT import gROOT, TFile, TCanvas, TGraph, Riostream |
---|
| 5 | |
---|
| 6 | gROOT.Reset() |
---|
| 7 | |
---|
| 8 | n = 1100 |
---|
| 9 | |
---|
| 10 | En, Y1, Y2, diff, pres = array( 'd' ), array( 'd' ), array( 'd' ), array( 'd' ), array( 'd' ), array( 'd' ) |
---|
| 11 | |
---|
| 12 | c1 = 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 | in = open('DEDX.hIoni.proton.asc_20bins_spl.out', 'r') |
---|
| 22 | #in = open('DEDX.eIoni.e-.asc_spl.out, 'r') |
---|
| 23 | |
---|
| 24 | lines = in.readlines() |
---|
| 25 | title = lines[0] |
---|
| 26 | |
---|
| 27 | for line in lines[1:]: |
---|
| 28 | En.append (line.split() [0]) |
---|
| 29 | Y1.append (line.split() [1]) |
---|
| 30 | Y2.append (line.split() [2]) |
---|
| 31 | diff.append (line.split() [3]) |
---|
| 32 | pres.append ((Y1/Y2 - 1)*100) |
---|
| 33 | |
---|
| 34 | gr = new TGraph(n,En,pres) |
---|
| 35 | gr.SetTitle('proton in Pb, table 100 pts / 20 pts_spl per order') |
---|
| 36 | gr.SetMarkerStyle(22) |
---|
| 37 | gr.SetMarkerSize(0.8) |
---|
| 38 | gr.GetYaxis()->SetLabelFont(132) |
---|
| 39 | gr.GetYaxis()->SetLabelSize(0.04) |
---|
| 40 | gr.GetXaxis()->SetLabelFont(132) |
---|
| 41 | gr.GetXaxis()->SetLabelSize(0.04) |
---|
| 42 | gr.GetXaxis()->SetTitle('E, MeV') |
---|
| 43 | gr.GetYaxis()->SetTitle('dE/dx: (100pts/20pts_spl - 1), %') |
---|
| 44 | gr.GetXaxis()->SetTitleOffset(1.2) |
---|
| 45 | gr.Draw('AP') |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | c1.Modified() |
---|
| 49 | c1.cd() |
---|