I have a root file, compiled by the simulation program Garfield++, which contains an TH1D histogram. However, when I view the content of the root file by File.Ls(), it returns:
TFile** data/SingleGEM/time1.root TFile* data/SingleGEM/time1.root KEY: TCanvas c1;1 Signal
From the last line, it seems the histogram is saved as a Canvas object instead of an TH1D histogram.
Now I want to change this histogram (change title, axis, …), thus I load the histogram via:
TH1D *h1 = (TH1D*)File->Get("c1");
When I apply the histogram functions (h1->GetXaxis()->SetTitle(“test”), h1->GetEntries(), …), ROOT crashes (*** Break *** segmentation violation). It seems these functions does not apply on this type of histogram, loaded from the root file.
The problem is probably because the histogram is saved as a Canvas object. But is it possible to extract the histogram out of this canvas, and then apply the histogram functions on it?