Hello!
I am fitting some plots and saving them to a root file with
TFile *fitDet;
fitDet = new TFile (“FitRate93.root”,“RECREATE”);
gROOT->GetListOfSpecials()->Add(result);
fitDet->WriteTObject(result);
But I also have a legend that shows the chi squared etc. In the macro that makes this root file, I declare this TLegend as
TLegend *leg71 = new TLegend(0.1,0.85,0.9,0.9);
So I want to save this TLegend also in the root file. For this I do :
gROOT->GetListOfSpecials()->Add(leg71);
fitDet->WriteTObject(leg71);
Looks like they both, the fitted histo and the legend, wrote to the root file FitRate93.root, but now how do I get the legend to draw?
If I open file FitRate93.root and double click graph with “ap” options it draws, now if I double click TPave with “same” option it doesn’t draw. Why is this?
Also it would be nice to give my legend a name. How do I give a TLegend a name so it would not appear as TPave in the root file and instead have a name?
Thank you!
- Sujeewa