Hi all,
I am trying to load multiple 2D histos in a root macro and using the function
TH2* Load2DHist(int det_ID) {
//File
char root_file[200];
sprintf (root_file, "/path/to/file_%d", det_ID); //Filename and path
TFile *file =TFile::Open(root_file);
TH2 *His = (TH2*)file -> Get(Form("gm_%d", det_ID -1)); //Extract the 2D histogram
//file->Close();
return His;
}
However, for a large number of files, this is causing memory issues…“too many files open at the moment”, however when I put the file->Close();
I get a segmentation fault.
Is it possible to close the file and still return the His
?
Thanks a lot