I am using Loop() method running over some input files and filling a new tree in a root file.
I notice that for a particular event where
nb = fChain->GetEntry(jentry);
is very large my code give seg. fault at the following line:
outfile->cd(); //<–here outfile is my output root file
Few cout statments are given below for the value of nb :
nb =29809 //<----for this value it breaks at outfile->cd();
Any Idea how I can avoid this breaking without throwing away this entry? Is there a limit on nb when we are reading from a file??
with best regards,
we cannot help you without seeing your actual code nor the backtrace you get nor the error message you get. The number of bytes read is not the issue by itself.
The file is here:
The seg fault is this:
*** Break *** segmentation violation
Attaching to program: /proc/32707/exe, process 32707
[Thread debugging using libthread_db enabled]
0xffffe405 in __kernel_vsyscall ()
#1 0x005dd713 in __waitpid_nocancel () from /lib/libc.so.6
#2 0x0058207b in do_system () from /lib/libc.so.6
#3 0x006b4ead in system () from /lib/libpthread.so.0
#4 0xf6220b0d in TUnixSystem::Exec(char const*) ()
#5 0xf6225fab in TUnixSystem::StackTrace() ()
#6 0xf6226d7d in TUnixSystem::DispatchSignals(ESignals) ()
#7 0xf6226e7d in SigHandler(ESignals) ()
#8 0xf621d782 in sighandler(int) ()
#10 0x0805e7f1 in myCuts::Loop() ()
#11 0x080699cf in main ()
A debugging session is active.
Inferior 1 [process 32707] will be detached.
Quit anyway? (y or n) [answered Y; input not from terminal]
Detaching from program: /proc/32707/exe, process 32707
Note: I do outfile->cd() insdie the event loop before filling the tree beacuse I read two other trees to get some informaiton and then close them.
i also check the input file and its not currepted etc… There are some other file related to this code at the same web-link.
My guess is that some of your files have more than 100 elements in their array. Update the declaration to be larger arrays. (You can also try to run valgrind on your example to see what the issue really is).
You mean the element I am writing in the output tree or the one I am reading???
For writing to output file i have array size 100 but I write only first two elemnts!!
just found in one element the entries were more than declared.
Code is working now.
Thanks a lot for your help.