-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathHistos.py
More file actions
60 lines (42 loc) · 1.03 KB
/
Histos.py
File metadata and controls
60 lines (42 loc) · 1.03 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import ROOT as ROOT
import sys
import getopt
from DataFormats.FWLite import Events, Handle
from Muon import Muon
from readTTree import readTTree
#from Selector import Selector
from ROOT import gROOT, TH1F, TGraph
import matplotlib as plt
import numpy
#def main():
#class Histos(object)
# """
# Draw Histograms
# """
#
class Histos(object):
def __init__(self):
file=ROOT.TFile("histos.root","read")
Gfile=ROOT.TFile("histos_good.root", "read")
#### bins and bounds?????
#def drawHisto(self, variable, bins, x_min, x_max):
def drawHisto(self, *variable)
for i in variable:
if variable="pt":
histo=file.Get('h_pt')
createCanvas(histo)
if variable="eta":
histo=file.Get('h_eta')
def createCanvas(self, histo):
ROOT.TCanvas.__init__._creates = False
canvas = ROOT.TCanvas()
ROOT.SetOwnership(canvas, False)
canvas.cd()
histo.Draw()
plot = {'canvas': canvas}
canvas.Update()
canvas.Draw()
canvas.SaveAs(histo.name()+".png")
ROOT.gApplication.Run()
#if __name__=="__main__":
# main()