Hello ROOTers,
Could anyone tell me how to get a primitive from a sub pad of a saved TCanvas, please? When I try to do it without drawing the canvas, I cannot access to the pointer of a sub pad. I am using the SVN trunk on OS X 10.6.8.
If I draw the canvas before accessing a sub pad, I can get a primitive from the sub pad. But I have thousands of ROOT files, I do not want to draw each TCanvas.
Step 1: Save a TCanvas in a TFile
$ root
root [0] TCanvas* can = new TCanvas("can", "can") root [1] can->Divide(2, 1) root [2] can->cd(1)
root [3] TH1D* hist = new TH1D("hist", "hist", 100, 0, 1) root [4] hist->Draw() root [5] can->SaveAs("can.root")
Step 2: Access to the sub pad 1
$ root
root [0] TFile f("can.root") root [1] TCanvas* can = (TCanvas*)f.Get("can") root [2] can // OK
Regards,
-- OKUMURA, Akira oxon@{astro.isas.jaxa.jp,stanford.edu} Institute of Space and Astronautical Science (ISAS/JAXA) Now at KIPAC/SLAC/Stanford Varian Physics #306, 382 Via Pueblo Mall, MC 4060 Stanford, CA 94305-4060 TEL 650-736-0971/FAX 650-724-5065 Skype : okumura.akiraReceived on Mon Jul 11 2011 - 02:37:01 CEST
This archive was generated by hypermail 2.2.0 : Mon Jul 11 2011 - 11:50:01 CEST