Hello,
my problem is following. I have root file with histogram and canvas where histogram is draw. I open root file with “UPDATE” option to fit histogram and redraw it on canvas. I have no problem with getting histogram, fiting it and saving back to file. Problem is with canvas. After getting it from file, object exists, I can even print list of primitives from it, but when I want to get access to pad to change color then my app crash: segmentation violation.
Here is what i see (I can reproduce this phenomena in CINT). After using Get on gDirectory my canvas exists but pointer to subpad is NULL. List of Primitives shows only histogram. But after using Draw on canvas pointer to subpad is not NULL and list of primitives is bigger.
root [0]
Attaching file Export/output.root as _file0...
root [1] TCanvas * can = (TCanvas *)gDirectory->Get("c_InvMass")
root [2] can->cd()
(class TVirtualPad*)0x0
root [3] can->GetListOfPrimitives()->Print()
Collection name='TList', class='TList', size=1
TH1.Print Name = h_InvMass, Entries= 1991107, Total sum= 1.00072e+06
root [4] can->Draw()
root [5] can->cd()
(class TVirtualPad*)0x12acbc0
root [6] can->GetListOfPrimitives()->Print()
Collection name='TList', class='TList', size=3
TFrame X1=1070.000000 Y1=0.000000 X2=1200.000000 Y2=40482.750000 FillColor=600 FillStyle=1001
TH1.Print Name = h_InvMass, Entries= 1991107, Total sum= 1.00072e+06
TPaveText X1=1115.216856 Y1=42506.888032 X2=1154.783144 Y2=45290.077177
Collection name='TList', class='TList', size=1
Text X=0.000000 Y=0.000000 Text=InvMass A&B Font=0 Size=0.000000 Color=0 Align=0
As far as I understand after using Get the object is not fully fetched from disk, right? Is there any way to avoid calling dummy Draw (my app doesn’t draw any histograms) and get full object to memory?
Greetings,
Rafal