export1d
- coffea.hist.export1d(hist)[source]
Export a 1-dimensional
Hist
object to uprootThis allows one to write a coffea histogram into a ROOT file, via uproot.
- Parameters:
hist (Hist) – A 1-dimensional histogram object
- Returns:
A
uproot3_methods.classes.TH1
object- Return type:
out
Examples
Creating a coffea histogram, filling, and writing to a file:
import coffea, uproot3, numpy h = coffea.hist.Hist("Events", coffea.hist.Bin("var", "some variable", 20, 0, 1)) h.fill(var=numpy.random.normal(size=100)) fout = uproot3.create('output.root') fout['myhist'] = coffea.hist.export1d(h) fout.close()