I am reading a root file whose structure looks like:
$ root -l Residual_Position_iter_99_R1869.root
.lroot [0]
Attaching file Residual_Position_iter_99_R1869.root as _file0...
s
Warning in <TClass::TClass>: no dictionary for class TF1Parameters is available
root [1] .ls
TFile** Residual_Position_iter_99_R1869.root
TFile* Residual_Position_iter_99_R1869.root
KEY: TH1F Pos_g3xcl_100;1
KEY: TH1F Pos_g3ycl_100;1
KEY: TH1F Pos_g2xcl_100;1
KEY: TH1F Pos_g2ycl_100;1
KEY: TH1F Pos_g1xcl_100;1
KEY: TH1F residual_g1xcl_100;1
KEY: TH1F residual_g1ycl_100;1
KEY: TH1F residual_g2xcl_100;1
KEY: TH1F residual_g2ycl_100;1
KEY: TH1F residual_g3xcl_100;1
KEY: TH1F residual_g3ycl_100;1
To read this I wrote a macro :
import ROOT
from ROOT import TFile, TH1F, TObject
ROOT.gROOT.SetBatch(True) # This will prevent histogram to show
c=ROOT.TCanvas("c","c",800,600)
f1=ROOT.TFile("Residual_Position_iter_99_R1869.root","READ")
h1x=f1.Get("Pos_g1xcl_100"); c.cd(); h1x.Draw()
c.Print("plots/residual.pdf")
This code is working fine. But its fine only for branches of like Pos*. But if I replace
h1x=f1.Get("Pos_g1xcl_100");
with
h1x=f1.Get("residual_g1xcl_100");
then I am getting the segmentation fault[1]. The difference between Pos_g1xcl_100 & residual_g1xcl_100 is that one is simple histogram while later one is histogram along with its fit.
[1]
TClass::TClass:0: RuntimeWarning: no dictionary for class TF1Parameters is available TStreamerInfo::BuildOld:0: RuntimeWarning: Cannot convert TF1::fParErrors from type:vector to type:Double_t*, skip element TStreamerInfo::BuildOld:0: RuntimeWarning: Cannot convert TF1::fParMin from type:vector to type:Double_t*, skip element TStreamerInfo::BuildOld:0: RuntimeWarning: Cannot convert TF1::fParMax from type:vector to type:Double_t*, skip element TStreamerInfo::BuildOld:0: RuntimeWarning: Cannot convert TF1::fSave from type:vector to type:Double_t*, skip element TStreamerInfo::BuildOld:0: RuntimeWarning: Cannot convert TF1::fParams from type:TF1Parameters* to type:Double_t*, skip element
* Break * segmentation violation