Segmentation violation on second run

I have used h2root to create a .root file from a .hbook file. When I run a script I’ have written in ROOT it works, except that some plots seems to be wrong. However, if I try to run it again (after a small change or no change) I get an error message: Break segmentation violation. The same thing happens if I try to quit ROOT or use the command gROOT->Reset(). After that, if I try a third time nothing seems to happen at all and I have to abort.

I have tried several ROOT versions and run in linux and windows, and with different .root files (from different .hbook files). The error messages are different in different versions, and sometimes even the first run fail, but it never works completely.

Please send the shortest possible set reproducing this problem

Rene

Here (problem.cxx and below) is some code that generate the problem when using the .root file in the attachment (example216708.root). SetBranchAddress is probably not needed here, but I want to use it in the real code.

{
gROOT->Reset();
TFile f1(“example216708.root”);
Float_t adc, dac;
h2406->SetBranchAddress(“adc”,&adc);
h2406->SetBranchAddress(“dac”,&dac);
histogram1 = new TProfile(“histogram1”,“TProfile adc:dac”,100,-200.,2200.,0.,4000.,"");
h2406->Project(“histogram1”,“adc:dac”);
histogram1->Draw();
}
problem.cxx (300 Bytes)
example216708.root (650 KB)

Your branches adc and dac hold arrays adc[11] and dac[11].
Instead of
Float_t adc, dac;
you should declare
Float_t adc[11],dac[11]
h2406->SetBranchAddress(“adc”,adc);
h2406->SetBranchAddress(“dac”,dac);
or
remove the 3 lines
Float_t adc, dac;
h2406->SetBranchAddress(“adc”,&adc);
h2406->SetBranchAddress(“dac”,&dac);

Rene

Thank you. I think dac should be an Int_t rather than a Float_t (another mistake I made). With that change your solution works perfectly.