Creating a Histogram from a .root file


I have a 5-column .csv file, which I have converted to a .root file. I’m hoping to create a 1D histogram using the first two columns (the first column being the horizontal axis).

I have found the following example:,
but I’m having some trouble filling the histogram with my data. I was hoping someone could help, as I’m quite new to programming.

In short, the goal is to create a simple histogram from a .root file.

Thank you!

Hi maveir, you can find more macros and examples that you can also play with interactively at this link.

In particular the basic2.C tutorial shows how to read a CSV directly into a TTree using the TTree::ReadFile method (its documentation is in the ROOT reference guide as usual).

If those resources do not help, show us what you have so far and we can take it from there!

The example macro you suggested helped me debug my code, thank you very much!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.