How to close the files in castor after being used

Hello all,

I have some root file in castor area and I want to put them in a chain.

TChain mychain = (TChain *)new TChain("myEvent"); mychain->Add("rfio:/castor/cern.ch/user/s/shilpi/file1.root"); mychain->Add("rfio:/castor/cern.ch/user/s/shilpi/file2.root"); mychain->Add("rfio:/castor/cern.ch/user/s/shilpi/file3.root");
Is there a way to close these files after I have used all of them?
I am asking this because I was doing it this way and after using this code
five-six times on the rootfiles I am getting this :

So I was thinking if this error is coming because the files are not getting closed after being used.

Thanks & Regards,
Shilpi

Hi,

Do you mean that the first few time you run on the set of files there is no errors, while on the 5th time, with the exact same set of files, there is an error?

[quote]So I was thinking if this error is coming because the files are not getting closed after being used.[/quote]Probably not. Since you open the file read only, ROOT does NOT modify the file, so the only possible explanation is that rfio/castor is not always delivering you the same set of bytes for the same files …
(well unless there is yet another problem in the C++ code where there is some memory over-write or memory corruption or double delete … but you should be able to exclude those by using valgrind).

Cheers,
Philippe.

Hi Philippe,

Thanks a lot.
I also tried loading the root files from the terminal by doing :

and it was still giving the same error . So probably there is some problem with the castor
itself.
I think then I should post it in the cern castor specific forum.

Thanks & Regards,
Shilpi

[quote]I also tried loading the root files from the terminal by doing :[/quote]Is the error happening all the time for this file or only some of the time for this file?

Philippe.

Hi Philippe,

This is happening for all time. Is it because of the size of the file?
This size ~ 0.938GB

Thanks & Regards,
Shilpi

Hi,

Since it is happening all the time, the file might be corrupted. To check that it is the case, try to copy the file out of castor to your local disk (outside of ROOT) and try to open the local file from ROOT. If the local file fails then the file is corrupted and thus unusable (i.e. somewhere between it’s production and its storage in the mass storage system some the bytes were scrambled).

Cheers,
Philippe.

Hi Philippe,

I did as you suggested and again I am getting the same error.
So it seems that the file is corrupted.
One thing I would like to add is that at the end it says :

(if I try loading it directly from castor or locally, it recovers)
So I guess then its usable?

Thanks & Regards,
Shilpi

[quote](if I try loading it directly from castor or locally, it recovers)
So I guess then its usable?[/quote]I might be, at least partially … depending what this keys represents and what you need.

Cheers,
Philippe.