I was wondering if this piece of code is correct or if I’m missing something.
I have two root files and I retrieve an histogram from them.
Then, I want to save these two histos in a ROOT file with one tree and two branches. Each branch is an histogram.
To do this, I wrote this piece of code:
(histos are called h1 and h2)
//CREATE A TREE TO SAVE BOTH HISTOGRAMS//
TTree* tree = new TTree(“tree”,“final_tree”);
I am not sure to fully understand your question.
Do you want somehow create a 2D histogram (e.g. TH2D) from two 1D histograms (e.g TH1D)
If this is the case, it isn’t possible.
You could go from one 2D histogram to two 1D histograms, but not the other way.
Passing from 2D to 1D you lost informations that cannot be retrieved.
Look the post below, there is an example explaining why you could not do it