This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| root:pyroot_th1 [2017/06/22 12:10] – [Filling a histogram from a tree] iwn | root:pyroot_th1 [2017/09/05 10:35] (current) – [Handling TH1 histograms] iwn | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | [[root: | ||
| + | |||
| ====== Handling TH1 histograms ====== | ====== Handling TH1 histograms ====== | ||
| - | To use '' | + | [[https:// |
| + | |||
| + | |||
| + | ===== Importing ROOT classes ===== | ||
| + | |||
| + | To use '' | ||
| <code python> | <code python> | ||
| from ROOT import TH1D | from ROOT import TH1D | ||
| hist = TH1D(" | hist = TH1D(" | ||
| </ | </ | ||
| - | or | + | or //all// classes: |
| <code python> | <code python> | ||
| from ROOT import * # loads all classes, and thus takes longer | from ROOT import * # loads all classes, and thus takes longer | ||
| hist = TH1D(" | hist = TH1D(" | ||
| </ | </ | ||
| - | or | + | or only the '' |
| <code python> | <code python> | ||
| import ROOT | import ROOT | ||
| Line 54: | Line 61: | ||
| tree.Draw(" | tree.Draw(" | ||
| tree.Draw(" | tree.Draw(" | ||
| + | </ | ||
| + | This also includes custom functions, which you can load into '' | ||
| + | <code python> | ||
| + | from ROOT import gROOT, ... | ||
| + | gROOT.Macro(" | ||
| + | ... | ||
| + | tree.Draw(" | ||
| + | tree.Draw(" | ||
| </ | </ | ||
| Line 90: | Line 105: | ||
| [2] tree-> | [2] tree-> | ||
| [3] tree-> | [3] tree-> | ||
| - | [4] tree-> | + | [4] tree-> |
| </ | </ | ||