# How to read a tree file, and fill histogram with leaf

**URL:** <https://root-forum.cern.ch/t/how-to-read-a-tree-file-and-fill-histogram-with-leaf/41199>\
**Category:** Newbie\
**Tags:** tree, hist, root\
**Created:** [August 28, 2020, 6:35pm UTC](https://root-forum.cern.ch/t/how-to-read-a-tree-file-and-fill-histogram-with-leaf/41199 "2020-08-28T18:35:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SpookyCat23](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/9dc877/32.png) [@SpookyCat23](https://root-forum.cern.ch/u/SpookyCat23)\
**Post date:** [August 28, 2020, 6:35pm UTC](https://root-forum.cern.ch/t/how-to-read-a-tree-file-and-fill-histogram-with-leaf/41199/1 "2020-08-28T18:35:20Z")

</div>

I have a file named “WW” that contains a tree named “mini” that contains leaves with information.

I want to write a script that reads this file and then plots multiple leaves into a histogram.  
Thanks

---

<div class="post-metadata">

**Author:** ![StephanH](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@StephanH](https://root-forum.cern.ch/u/StephanH)\
**Post date:** [August 29, 2020, 6:23pm UTC](https://root-forum.cern.ch/t/how-to-read-a-tree-file-and-fill-histogram-with-leaf/41199/2 "2020-08-29T18:23:14Z")

</div>

Hi,

I would recommend [RDataFrame](https://root.cern/doc/master/classROOT_1_1RDataFrame.html) if you want to plot stuff. The action `Histo1D` creates histograms, and if you want to do some computations with the values in the branches, you can `Define` a quantity before you histogram it.

Check out this tutorial that demonstrates a few features:  
[https://root.cern/doc/master/df001\_\_introduction\_8C.html](https://root.cern/doc/master/df001__introduction_8C.html)

([All ROOT tutorials](https://root.cern/doc/master/group__Tutorials.html))
