Skip to content
This repository was archived by the owner on Jan 27, 2023. It is now read-only.

Commit 3361945

Browse files
committed
added TH1.new to create bare histograms
1 parent 9ba0f91 commit 3361945

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

uproot_methods/classes/TH1.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,25 @@
3434

3535
import uproot_methods.base
3636

37+
def new(numbins, low, high, title="", classname="TH1D"):
38+
class TH1(Methods, list):
39+
pass
40+
41+
class TAxis(object):
42+
def __init__(self, fNbins, fXmin, fXmax):
43+
self._fNbins = fNbins
44+
self._fXmin = fXmin
45+
self._fXmax = fXmax
46+
self._fLabels = None
47+
48+
out = TH1.__new__(TH1)
49+
out._fXaxis = TAxis(numbins, low, high)
50+
out._fName = None
51+
out._fTitle = title
52+
out._classname = classname
53+
out.extend([0] * (numbins + 2))
54+
return out
55+
3756
class Methods(uproot_methods.base.ROOTMethods):
3857
def __repr__(self):
3958
if self._fName is None:

0 commit comments

Comments
 (0)