Dear all,
I’m using PyROOT and met a strange problem. Here I post my test code.
bmass = RooRealVar('bmass', 'bmass', 0)
bpx = RooRealVar('bpx', 'bpx', 0)
bpy = RooRealVar('bpy', 'bpy', 0)
bpz = RooRealVar('bpz', 'bpz', 0)
bpe = RooRealVar('bpe', 'bpe', 0)
data = RooDataSet('data', 'data', RooArgSet(bmass, bpx, bpy, bpz, bpe), RooFit.ImportFromFile("file","Tree")
# This tree contains 5 branches named bmass,bpx,bpy,bpz,bpe
I ran these codes by
python3 -i test.py
At first I want to get a binned dataset, so I ran
data.binnedClone()
It threw me
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
cppyy.gbl.std.bad_alloc: RooDataHist* RooDataSet::binnedClone(const char* newName = 0, const char* newTitle = 0) =>
bad_alloc: std::bad_alloc
The same crash would also occure on ROOT, which seems due to too many branches. So I tried to reduce other variables and made a little mistake ( Used an improper method):
data.reduce(RooFit.SelectVars(bmass))
It threw me
# Preceding report has been omitted
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: none of the 5 overloaded methods succeeded. Full details:
RooAbsData* RooAbsData::reduce(const RooArgSet& varSubset, const RooFormulaVar& cutVar) =>
TypeError: takes at least 2 arguments (1 given)
RooAbsData* RooAbsData::reduce(const RooCmdArg& arg1, const RooCmdArg& arg2 = RooCmdArg(), const RooCmdArg& arg3 = RooCmdArg(), const RooCmdArg& arg4 = RooCmdArg(), const RooCmdArg& arg5 = RooCmdArg(), const RooCmdArg& arg6 = RooCmdArg(), const RooCmdArg& arg7 = RooCmdArg(), const RooCmdArg& arg8 = RooCmdArg()) =>
SegmentationViolation: segfault in C++; program state was reset
RooAbsData* RooAbsData::reduce(const RooFormulaVar& cutVar) =>
TypeError: could not convert argument 1
RooAbsData* RooAbsData::reduce(const char* cut) =>
TypeError: could not convert argument 1 (bad argument type for built-in operation)
RooAbsData* RooAbsData::reduce(const RooArgSet& varSubset, const char* cut = 0) =>
TypeError: could not convert argument 1
Although I finally got back to the right way ( Use RooDataSet() to create another single-variable dataset and make it binned), I’m confused why these happened ( Or whether I should report these?)
Thanks all!
ROOT Version: 6.22.02
Platform: Ubuntu 20.04