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
root [0]
Attaching file ROOTfiles/ntuple_ana.root as _file0...
root [1] new TCanvas
(class TCanvas*)0x1b87ae0
root [2] Effi_BIL_2A05->DrawClonePad()
(class TObject*)0x0
root [3] 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.
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:
new TCanvas("c2");
//create your subpad and cd to it
Effi_BIL_2A05->DrawClonePad();
Rene
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