Chrash in TH1::Rebin

Edit:

Fixxed. There was a unassigned boolian somewhere else in the code, which in some way caused a crash in the rebin function.

Hi all, sorry for bothering you, but I have a crash that I can’t explain.

I am trying to rebin to a variable bin size. Therefore I have a class binning, which creates an array. Then the rebin function is called:

histogram->Rebin(a.length()-1,“some_generic_name”,a.getArray());

a.length() is a int or const int. a.getArray() is a double* or a const double* array of size a.length().
At some point in my analysis, the entire program crashes down with an stack trace. The point of crash differs each time, it is not always with the same histogram and I already know that the Array boundaries match the boundaries of the histogram.

The crash is copy pasted below. Does anyone here have any clue what goes wrong, that would be really helpfull. The root version is Version 5.34/18, our calculation cluster doesn’t have an compiler with c++11 support (yet).

#7 0x00007fe63504aebb in toygenerator::GenerateToyExperiment(TString, TString) () from /users/student/jvamen/GSstat/toygenerator_C.so
#8 0x00007fe63504de3c in toygenerator::GenerateToys(int, TString) () from /users/student/jvamen/GSstat/toygenerator_C.so
#9 0x00007fe63504e380 in G__toygenerator_C_ACLiC_dict_3436_0_3(G__value*, char const*, G__param*, int) () from /users/student/jvamen/GSstat/toygenerator_C.so
#10 0x00007fe637007149 in Cint::G__ExceptionWrapper(int ()(G__value, char const*, G__param*, int), G__value*, char*, G__param*, int) () from /mnt/users2/student/jvamen/root/lib/libCint.so
#8 0x00007fe63504de3c in toygenerator::GenerateToys(int, TString) () from /users/student/jvamen/GSstat/toygenerator_C.so
#9 0x00007fe63504e380 in G__toygenerator_C_ACLiC_dict_3436_0_3(G__value*, char const*, G__param*, int) () from /users/student/jvamen/GSstat/toygenerator_C.so
#10 0x00007fe637007149 in Cint::G__ExceptionWrapper(int ()(G__value, char const*, G__param*, int), G__value*, char*, G__param*, int) () from /mnt/users2/student/jvamen/root/lib/libCint.so
groesbeek:/users/student/jvamen/GSstat> root -l -b -q ‘runtoyssignal_no_uncert.c(“0”,“Muon”,“minv”,“stop300”)’ > debugrebin.txt

*** Break *** segmentation violation

===========================================================
There was a crash.
This is the entire stack trace of all threads:

#0 0x000000322f0ac5de in waitpid () from /lib64/libc.so.6
#1 0x000000322f03e619 in do_system () from /lib64/libc.so.6
#2 0x00007f88e08db5a8 in TUnixSystem::StackTrace() () from /mnt/users2/student/jvamen/root/lib/libCore.so
#3 0x00007f88e08da0a3 in TUnixSystem::DispatchSignals(ESignals) () from /mnt/users2/student/jvamen/root/lib/libCore.so
#4
#5 0x00007f88de2fd59a in TH1::Rebin(int, char const*, double const*) () from /mnt/users2/student/jvamen/root/lib/libHist.so
#6 0x00007f88ddb2c5db in toygenerator::rebin_histogram(TString, TH1F*&) () from /users/student/jvamen/GSstat/toygenerator_C.so
#7 0x00007f88ddb33f1b in toygenerator::GenerateToyExperiment(TString, TString) () from /users/student/jvamen/GSstat/toygenerator_C.so
#8 0x00007f88ddb36e9c in toygenerator::GenerateToys(int, TString) () from /users/student/jvamen/GSstat/toygenerator_C.so
#9 0x00007f88ddb373e0 in G__toygenerator_C_ACLiC_dict_3436_0_3(G__value*, char const*, G__param*, int) () from /users/student/jvamen/GSstat/toygenerator_C.so
#10 0x00007f88dfaf0149 in Cint::G__ExceptionWrapper(int ()(G__value, char const*, G__param*, int), G__value*, char*, G__param*, int) () from /mnt/users2/student/jvamen/root/lib/libCint.so
#11 0x00007f88dfb943d1 in G__execute_call () from /mnt/users2/student/jvamen/root/lib/libCint.so
#12 0x00007f88dfb95212 in G__call_cppfunc () from /mnt/users2/student/jvamen/root/lib/libCint.so
#13 0x00007f88dfb71308 in G__interpret_func () from /mnt/users2/student/jvamen/root/lib/libCint.so
#14 0x00007f88dfb5f05c in G__getfunction () from /mnt/users2/student/jvamen/root/lib/libCint.so
#15 0x00007f88dfc5015a in G__getstructmem(int, G__FastAllocString&, char*, int, char*, int*, G__var_array*, int) () from /mnt/users2/student/jvamen/root/lib/libCint.so
#16 0x00007f88dfc452a7 in G__getvariable () from /mnt/users2/student/jvamen/root/lib/libCint.so
#17 0x00007f88dfb3c3dd in G__getitem () from /mnt/users2/student/jvamen/root/lib/libCint.so
#18 0x00007f88dfb416d8 in G__getexpr () from /mnt/users2/student/jvamen/root/lib/libCint.so
#19 0x00007f88dfbc0f57 in G__exec_statement () from /mnt/users2/student/jvamen/root/lib/libCint.so
#20 0x00007f88dfb726d5 in G__interpret_func () from /mnt/users2/student/jvamen/root/lib/libCint.so
#21 0x00007f88dfb5f0bb in G__getfunction () from /mnt/users2/student/jvamen/root/lib/libCint.so
#22 0x00007f88dfb3cb5e in G__getitem () from /mnt/users2/student/jvamen/root/lib/libCint.so
#23 0x00007f88dfb416d8 in G__getexpr () from /mnt/users2/student/jvamen/root/lib/libCint.so
#24 0x00007f88dfb4abe8 in G__calc_internal () from /mnt/users2/student/jvamen/root/lib/libCint.so
#25 0x00007f88dfbd0583 in G__process_cmd () from /mnt/users2/student/jvamen/root/lib/libCint.so
#26 0x00007f88e089e1b6 in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /mnt/users2/student/jvamen/root/lib/libCore.so
#27 0x00007f88e089d673 in TCint::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) () from /mnt/users2/student/jvamen/root/lib/libCore.so
#28 0x00007f88e0807968 in TApplication::ExecuteFile(char const*, int*, bool) () from /mnt/users2/student/jvamen/root/lib/libCore.so
#29 0x00007f88e0805983 in TApplication::ProcessLine(char const*, bool, int*) () from /mnt/users2/student/jvamen/root/lib/libCore.so
#30 0x00007f88e045b448 in TRint::Run(bool) () from /mnt/users2/student/jvamen/root/lib/libRint.so
#31 0x000000000040103c in main ()

The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.

#5 0x00007f88de2fd59a in TH1::Rebin(int, char const*, double const*) () from /mnt/users2/student/jvamen/root/lib/libHist.so
#6 0x00007f88ddb2c5db in toygenerator::rebin_histogram(TString, TH1F*&) () from /users/student/jvamen/GSstat/toygenerator_C.so
#7 0x00007f88ddb33f1b in toygenerator::GenerateToyExperiment(TString, TString) () from /users/student/jvamen/GSstat/toygenerator_C.so
#8 0x00007f88ddb36e9c in toygenerator::GenerateToys(int, TString) () from /users/student/jvamen/GSstat/toygenerator_C.so

I believe the “newname” should not be empty if you set “xbins” -> see the TH1::Rebin(Int_t ngroup, const char *newname, const Double_t *xbins) method description.

So to specify, Do i need to allocate a new histogram to use Xbins? No way to just rebin the current histogram?

Well, okay. That did not help. When setting a name for it, the same crash would occur after a couple of rebins. Any other suggestions what might be going on here? I’m totally clueluess and I’ve looked everywhere.