Help! Create a histogram using a TNtuple file/TTree/TLeaf

Hello I am currently trying to create a histogram that contains the data from a TNtuple file but I am unsure how to start the process. I have been given a root file that contains the data but am unsure how to call on it inside of my new macro. I have tried to find information on roots website and look at examples but I have not been able to find anything. If anyone has performed this before or knows a good example can you help!? Thank you

welcome to the forum! We get these kind of questions a lot, you can search the forum for specific problems you might encounter.
I think this question could be a good start.


ROOT Primer
ROOT Tutorials

I found this Online. Will this be a good place to start. I have found a lot of information and examples but I am unsure which to use for my case. I also have a basic understanding of c++ and it is difficult to translate the examples.
When creating the histogram am I calling upon the leaf or the tree? Does it make a difference? I can upload what I have if that helps.

The question I linked offers an overview of the different ways you can loop over root data and fill an histogram, with snippets and links to examples. Wile’s link to the ROOT primer should also be able to help.

You have to decide which of the different ways to reach your goal best suits your use-case, and that will require a solid grasp of c++ basics. The tutorial you linked (hsimpleReader) is certainly a possible, good starting point.

If you have specific ROOT issues/problems/doubts that the ROOT primer and the ROOT tutorials do not cover, do not hesitate to ask here!

In my humble opinion an hands on approach would work best: research, try out things and learn from your mistakes – come back here when you hit a ROOT roadblock, make use of or other such platforms when c++ starts making little sense.

1 Like

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