I have an histogram as a TBranch element in a TTree (“Detector_PV_Detector_PV_depositedEnergy”), this histogram (or the TBranch) is called “depositedEnergy” and I would like to clone it, the following code doesn’t work, It gives me a segmentation error meaning it didn’t find my histogram and I don’t know how to correct it :
Just to make sure I understand correctly: you have not just one histogram in the ROOT file but a histogram for every entry of the tree, right?
In this case, I’d suggest to use a TTreeReader to get the histogram(s). You can construct the TTreeReader directly with the tree, like TTreeReader reader(T);
I think I made a mistake : In my ROOT file, I have TTrees which contain TBranch. So basically it’s not a histogram, is that it ?
I made the mistake because when I double clicked on it, I get a plotted histogram, hence my confusion…
It’s more of a beginner vocabulary question but It will help me to read clearly the root documentation.
It’s a bit of a simplification but assuming your data is a table, the table rows are the “entries” or “events” and the table columns are the “branches”. A tree often has numerical branches. For instance it may have a branch of type float called “missingEnergy”, meaning a column of floats, one float per event. You can use TTree::Print() to get an overview of the branches and their types.
In the ROOT browser, if you double click on a numerical branch, it will show you a histogram of all the values in that branch. That’s a convenience feature of the browser.