As the subject line says, I’m attempting to draw a TCanvas that was saved within a TFile, in the current pad of a new canvas.
Using the TCanvas::DrawClonePad() gives me this error (and crash):
> root ROOTfiles/ntuple_ana.root
Attaching file ROOTfiles/ntuple_ana.root as _file0...
root  new TCanvas
root  Effi_BIL_2A05->DrawClonePad()
root  Warning in <TCanvas::ResizePad>: Effi_BIL_2A05 width changed from 32000 to 10
Warning in <TCanvas::ResizePad>: Effi_BIL_2A05 width changed from 32000 to 10
Error in <RootX11ErrorHandler>: BadAlloc (insufficient resources for operation) (XID: 50331918, XREQ: 53)
Is there a better (or correct) way to do this? I’d like to incorporate this type of feature into a more involved code where I draw multiple TCanvas (from a TFile) on the same (newly created) TCanvas.
Maybe this is silly… and I shouldn’t do it.
November 4, 2007, 7:00am
By default a new canvas is named “c1”. It is likely that the canvas in the file is also named “c1”. In this case drawing the old canvas will clear the current canvas (ie internal pad) before drawing itself. Try the following:
//create your subpad and cd to it
Using the “c2” in the TCanvas constructor, I still get the same error message and crash.
Maybe this was fixed in a later release? I’ve tried this on 5.14/00b and 5.14/00e.
Using TCanvas::DrawClonePad() is the way to get my desired result, right?
November 4, 2007, 7:00pm
I cannot reproduce this problem with 5.14. Could you send me a script reproducing the problem? + the file with the canvas.
Attached are both.
ntuple_ana.root (1.89 MB)
try.C (386 Bytes)
November 4, 2007, 8:58pm
OK problem understood. Due to the Draw option used when generating the original canvas with the markers.
This problem was fixed in January. Simply move to 5.16 or 5.17