Reading of rootfiles in a loop

Hi All,

I am facing problems when I read files in a for loop and
try to extract histograms from the files.
If I keep the files open, I am able to draw those histograms. If I close the file
in the loop, the code encounters segmentation violation while drawing those
histograms.

A simple example of this problem is attached to this email (.tar.gz).
I am using root version 5.27/06 on SL.

Any help would be highly appreciated.

Thanks
with best regards
Pawan
test.tar.gz (5.78 KB)

At the top of your script add the line
TH1::AddDirectory(kFALSE);
and read explanation in the chapter about Object Ownership in the Users Guide.

Rene

Hi Rene

Thanks for the solution.

with best regards
Pawan