Functions
plotfiles Namespace Reference

Functions

def plot_1_file (file)
 
def plot_2_files (file)
 

Function Documentation

def plotfiles.plot_1_file (   file)

Definition at line 6 of file plotfiles.py.

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

Definition at line 38 of file plotfiles.py.

References cet.pow(), and PandAna.Demos.demo1.range.

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