LoadTree crushes in routine compiled with Make

Hello.

I am having a problem with a TTree filled with vectors.
It crushes when I use LoadEntry in sub.c
Could anyone give a look, please?
The files are in attachment. To compile digit make (after renaming Makefile.c to Makefile) and to run ./analyze

analysis.c (17.6 KB)
analysis.h (1.2 KB)
decoding.h (2.9 KB)
subr.c (7.3 KB)
Makefile.c (398 Bytes)

The root file Pedestal_1_1.root is on google drive at

Could anyone tell me what do wrong, please?
Thanks,
regards,
Francesca

With the following file it does not crashes anymore.
analysis.cxx (1.2 KB)
subr.cxx (2.7 KB)

Makefie:

CXX = g++
CFLAGS = -O2
LDFLAGS = `root-config --glibs` -lm
ROOTFLAGS = `root-config --cflags`

all: analyze

analyze: analysis.o subr.o
	$(CXX) $(CFLAGS)  analysis.o subr.o -o analyze $(LDFLAGS) $(ROOTFLAGS)

analysis.o: analysis.cxx
	$(CXX) $(CFLAGS) $(ROOTFLAGS) -c analysis.cxx -o analysis.o

subr.o: subr.cxx
	$(CXX) $(CFLAGS) $(ROOTFLAGS) -c subr.cxx -o subr.o

clean:
	rm -f *.o
	rm -f analyze

Hello.

Thanks. I can not spot out what was the problem…
What was it, pls?

Regards,
Francesca

don’t know whether this is what @couet fixed but looking at the ROOT file, I see:

root [3] t->Print()
******************************************************************************
*Tree    :DataTree  : faster to tree root test : group2tree.C                *
*Entries :    59873 : Total =        33157296 bytes  File  Size =    7083357 *
*        :          : Tree compression factor =   4.68                       *
******************************************************************************
*Br    0 :time      : time/D                                                 *
*Entries :    59873 : Total  Size=     480802 bytes  File Size  =     305935 *
*Baskets :       16 : Basket Size=      32000 bytes  Compression=   1.57     *
*............................................................................*
*Br    1 :card      : card/I                                                 *
*Entries :    59873 : Total  Size=     240562 bytes  File Size  =       2218 *
*Baskets :        8 : Basket Size=      32000 bytes  Compression= 108.25     *
*............................................................................*
*Br    2 :Q         : vector<double>                                         *
*Entries :    59873 : Total  Size=   16217692 bytes  File Size  =    6355791 *
*Baskets :      517 : Basket Size=      32000 bytes  Compression=   2.55     *
*............................................................................*
*Br    3 :S         : vector<double>                                         *
*Entries :    59873 : Total  Size=   16217692 bytes  File Size  =     411997 *
*Baskets :      517 : Basket Size=      32000 bytes  Compression=  39.34     *
*............................................................................*

ie S is supposed to be a std::vector<double> (at least, it seems it has been written out like so) but you read it back as a std::vector<int> in your subr.c file.
if int isn’t 64bits on your machine, on top of getting possibly garbage, you may get also a crash…

I got a crash with your original files. My compiler on Mac told me that the .c extension is not anymore allowed for C++ programs. I changed the extensions to.cxx and the crash disappeared.

Hello.

Thanks a lot.I fixed the vecotornow. And also the cxx extension.
But I have just realized the LoadTree is missing from the file I had sent.

In attachment is file crushing.

subr.c (3.1 KB)

Could you please give a look again?

Hera are all other files (unchanged)
analysis.cxx (1.2 KB)
analysis.h (1.2 KB)
decoding.h (2.9 KB)

Thanks,
Francesca

Hello.

I re-upload all files as starting the post from scratch so that no already pointed out mistake is present.

subr.cxx (3.4 KB)
analysis.h (1.2 KB)
decoding.h (2.9 KB)
Makefile.c (406 Bytes)
subr.cxx (3.4 KB)

and the root file is at this link:

Could anyone give a look at why, when
" charge_p->GetEntry(tentry_p);
saturation_p->GetEntry(tentry_p);"
is added, the routine crushes, please?

Thanks,
regards,
Francesca

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.