How to properly call ROOT "Print" using C++?

Hello,

I am writing a C++ code, compiling in g++, and calling ROOT libraries in my program. I am using ROOT 5.30/04.

I am able to open files, do statistics on them, histogram, and output to a file perfectly…if I am under a certain number of data files. However, if I go over a certain number of files, the program runs fine up until

N1->Print(“Filename.Filetype”);

at which point it crashes, and returns these errors:

[color=#BF0000]Error in TApplication::ExecuteFile: /usr/share/root/plugins/TFile/P120_TNetFile.C no such file
Error in TApplication::ExecuteFile: /usr/share/root/plugins/TArchiveFile/P010_TZIPFile.C no such file
Error in TApplication::ExecuteFile: /usr/share/root/plugins/TVirtualStreamerInfo/P010_TStreamerInfo.C no such file
Error in TPluginManager::FindHandler: Cannot find plugin handler for TVirtualStreamerInfo! Does $ROOTSYS/etc/plugins/TVirtualStreamerInfo exist?[/color]

Again, this all works perfectly for my files under a certain number of them. It’s only when I increase the total number of files analyzed at once that the program crashes, and then it’s only at the “Print” call.

I would like to be able to write to an output file, so I don’t necessarily need to use “Print” to do that, but I don’t know a better way to accomplish this. What is causing these errors? How can I efficiently output my Canvas to a ROOT file without causing errors?

Hi,

I’m only guessing, a stripped down version of your code would help to better understand what you’re doing. So I’d guess that you might not be properly closing the files you open? The error message
"Error in TApplication::ExecuteFile: /usr/share/root/plugins/TFile/P120_TNetFile.C no such file"
could mean that the TNetFile plugin being invoked here can’t be opened because you already have 1k files open?

Also note that the root version you’re using is pretty old.

Regards,
Hans

[quote=“peter_pan”]Hi,

I’m only guessing, a stripped down version of your code would help to better understand what you’re doing. So I’d guess that you might not be properly closing the files you open? The error message
"Error in TApplication::ExecuteFile: /usr/share/root/plugins/TFile/P120_TNetFile.C no such file"
could mean that the TNetFile plugin being invoked here can’t be opened because you already have 1k files open?

Also note that the root version you’re using is pretty old.

Regards,
Hans[/quote]

Hello,

The server is not mine, so I can’t upgrade the ROOT version. I have requested that, though.

I am not sure what a TNetFile plugin is. My code crashes on the Print statement at the very end of the file, and only if I have opened more than 167 files. What is the 1k limitation you refer to?

The basic code is that I loop over this command

t1->GetEntry(n);

do some cuts and histogram the data, and then try to print. Is there some kind of “Close” command for entries?

It does seem like some kind of memory limitation is being hit, but I have no clue what it is. After retrieving an entry and reading it into the program, how do you close it?