Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
plotfiles Namespace Reference

Functions

def plot_1_file
 
def plot_2_files
 

Function Documentation

def plotfiles.plot_1_file (   file)

Definition at line 6 of file plotfiles.py.

6 
7 def plot_1_file (file):
8  gROOT.Reset()
9  input_file_1=TFile(file+'.root','READ')
10  h1 = input_file_1.Get("histo/1")
11  h2 = input_file_1.Get("histo/2")
12  h3 = input_file_1.Get("histo/3")
13  h4 = input_file_1.Get("histo/4")
14  h5 = input_file_1.Get("histo/5")
15  h6 = input_file_1.Get("histo/6")
16 
17  c1 = TCanvas('c1', file, 200, 10, 700, 900)
18  c1.Divide(2,3)
19 
20  c1.cd(1)
21  h1.Draw()
22  c1.cd(2)
23  h2.Draw()
24  c1.cd(3)
25  h3.Draw()
26  c1.cd(4)
27  h4.Draw()
28  c1.cd(5)
29  h5.Draw()
30  c1.cd(6)
31  h6.Draw()
32  c1.Update()
33  c1.Print("./"+file+".png")
34 
35  input_file_1.Close()
36 
37 # h_gam.SetLineColor(2)
def plot_1_file
Definition: plotfiles.py:6
def plotfiles.plot_2_files (   file)

Definition at line 38 of file plotfiles.py.

38 
39 def plot_2_files (file):
40  gROOT.Reset()
41 
42  input_file_1=TFile(file+'a.root','READ')
43  input_file_2=TFile(file+'b.root','READ')
44 
45 #input_file_1.cd()
46 #h_1_1 = input_file_1.Get("h16")
47 
48  c1 = TCanvas('c1', file, 200, 10, 700, 500)
49  c1.SetGridx()
50  c1.SetGridy()
51  c1.SetLogx()
52  c1.SetLogy()
53 
54 # histogram for energy spectra
55  n = 41
56  bin = array( 'f' )
57 
58  for i in range( n ):
59  bin.append(pow(10,(-2+0.1*i)))
60 #
61  h_1 = TH1F('unbiased','Source Spectrum',40,bin)
62  h_2 = TH1F('biased','Source Spectrum',40,bin)
63 
64 #
65  input_file_1.cd()
66 # get the tuple t1
67  t1 = input_file_1.Get('ntuple/MyTuple')
68  print t1
69  for i in range(t1.GetEntries()):
70  t1.GetEntry(i)
71  h_1.Fill(t1.Ekin,t1.weight)
72 
73  input_file_2.cd()
74 # get the tuple t1
75  t2 = input_file_2.Get('ntuple/MyTuple')
76  for i in range(t2.GetEntries()):
77  t2.GetEntry(i)
78  h_2.Fill(t2.Ekin,t2.weight)
79 
80  h_2.SetLineStyle(kDashed);
81  h_2.SetLineColor(kBlue);
82  h_2.Draw();
83  h_1.Draw("same") ;
84  c1.Update()
85  c1.Print("./"+file+".png")
86 
87  input_file_1.Close()
88  input_file_2.Close()
89 
def plot_2_files
Definition: plotfiles.py:38