Hello,
I’ve just updated to the latest 6.02 pach release (6.02/12). I’m trying to execute the following code:
[code]#!/usr/bin/python
import ROOT
print ROOT.gROOT.GetVersion()
file = ROOT.TFile(“bug_hist.root”, “READ”)
tree = file.Get(“Event”)
tree.Draw(“Entries$>>tempHist”, “”, “goff”)
tempHist = ROOT.gDirectory.Get(“tempHist”)
entries = tempHist.Integral()
print “Integral=”, entries
print “Entries=”, tempHist.GetEntries()[/code]
But I’m getting a segfault. Here’s the output:
[quote]6.05/01
*** Break *** segmentation violation
Generating stack trace…
0x00007f1c65ae7be3 in PyObject_Call + 0x43 from /usr/lib64/libpython2.7.so.1.0
0x00007f1c65b79a8a in PyEval_EvalFrameEx + 0x399a from /usr/lib64/libpython2.7.so.1.0
0x00007f1c65b7c9b0 in PyEval_EvalCodeEx + 0x830 from /usr/lib64/libpython2.7.so.1.0
0x00007f1c65b7caa9 in PyEval_EvalCode + 0x19 from /usr/lib64/libpython2.7.so.1.0
0x00007f1c65b956ff in from /usr/lib64/libpython2.7.so.1.0
0x00007f1c65b96872 in PyRun_FileExFlags + 0x72 from /usr/lib64/libpython2.7.so.1.0
0x00007f1c65b97977 in PyRun_SimpleFileExFlags + 0xd7 from /usr/lib64/libpython2.7.so.1.0
0x00007f1c65ba89ca in Py_Main + 0xc3a from /usr/lib64/libpython2.7.so.1.0
0x00007f1c654ecfd0 in __libc_start_main + 0xf0 from /lib64/libc.so.6
0x000000000040073e in from python[/quote]
Testing line-by-line, it appears that the problem is due to “gDirectory.Get()”. And btw, why is the version 6.05/01? I followed the instructions here.
The code works fine under 5.34/20, yielding the following output:
[quote]5.34/20
Integral= 15818.0
Entries= 15818.0[/quote]
There is also no problem when executing the exact corresponding code in C++:
[code]{
TFile* myFile = new TFile(“bug_hist.root”,“READ”);
TTree* myTree = (TTree*) myFile->Get(“Event”);
myTree->Draw(“Entries$>>tempHist”, “”, “goff”);
TH1F* tempHist = (TH1F*) gDirectory->Get(“tempHist”);
double myEntries = tempHist->Integral();
cout << "Integral = " << myEntries << endl;
cout << "nEntries = " << tempHist->GetEntries() << endl;
delete tempHist;
tempHist = nullptr;
delete myFile;
myFile = nullptr;
}[/code]
I have also tried in the latest 6.04, where I get no segfault, but where the problem reported [url=https://root-forum.cern.ch/t/wrong-event-count-in-root-6-02-10/19335/1 is still present.
Yours,
Sébastien