Hi,
I am new to root. I know how to save a histogram but how to save the canvas in the tree or in the root file.
Thanks.
Hi,
I am new to root. I know how to save a histogram but how to save the canvas in the tree or in the root file.
Thanks.
You save it in a root file the same way you save a histogram, canvas->Write()
Hi @dastudillo,
Your solution worked, thanks.
I am just curious to know if it is possible to save the canvas or histogram in a tree. I mean currently, I am writing the canvas (or histogram) directly in a root file, without creating a tree. Here is the pseudo-code of what I am doing,
TFile *f1 = new TFile("test.root", "RECREATE");
TCanvas *can = new TCanvas("can", "can", 750, 500);
// Add histogram to the canvas
can -> Write();
As you can notice, there is no TTree
in the code. It would be more organized if I can save this canvas in different branches of a tree.
Please suggest something. Because my analysis involves a lot of plots.
Thanks,
Divyang.