-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmakeModule.py
More file actions
45 lines (34 loc) · 967 Bytes
/
makeModule.py
File metadata and controls
45 lines (34 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import sys
from ROOT import *
def rotatehist(hist):
hnew = hist.Clone()
nbinsx = hist.GetNbinsX()
nbinsy = hist.GetNbinsY()
for x in range(1,nbinsx+1):
for y in range(1,nbinsy+1):
hist.SetBinContent(x,y, hnew.GetBinContent( nbinsx - x + 1, nbinsy - y + 1 ))
rootfile = TFile(sys.argv[1])
histname = sys.argv[2]
output = sys.argv[3]
print 'Opening ROOT File:',sys.argv[1]
print 'Grabbing hists:', histname
c1 = TCanvas('c1','',416*2,160*2)
c1.Divide(8,2,0.0,0.0)
gStyle.SetOptStat(0)
hists = {}
for num in range(0,5):
hist = histname.split('#')[0]+str(num)+histname.split('#')[1]
if num < 8:
padnum = num + 9
c1.cd(padnum)
#rootfile.Get(hist).Draw('Acol')
rootfile.Get(hist).Draw()
else:
padnum = 16 - num
hists[padnum] = rootfile.Get(hist).Clone()
rotatehist(hists[padnum])
c1.cd(padnum)
#hists[padnum].Draw('Acol')
hist[padnum].Draw()
print 'Saving to:', output
c1.SaveAs(output)