Re: Finding corrupted root files

From: Avdhesh Chandra <avdhesh_at_fnal.gov>
Date: Fri, 14 Jan 2005 01:01:20 -0600 (CST)

Hi,

    I have a different type of problem now.
>From some dir., I am chaining using *
like



TChain *p3 = new TChain("TMBTree","chain q"); p3->Add("./TMBTREEROOTFILES/recoT*.root"); TTree* mytreec = (TTree*)p3;

What I can do so it reject bad files for chaining? and it will be better if can tell me which files it is rejecting.

Thanks,
Avdhesh

>>You can detect if a file is corrupted or correctly open with:
>> -case A
>> ======
>> TFile *f = new TFile("myfile.root");
>> if (f->IsZombie()) {
>> cout << "Error opening file" << endl;
>> }
>>
>> -case B
>> ======
>> TFile *f = TFile::Open("myfile.root");
>> if (!f) {
>> cout << "Error opening file" << endl;
>> }
>>
>> -case C
>> ======
>> TFile *f = new TFile("myfile.root");
>> if (f->TestBit(TFile::kRecovered)) {
>> cout << "file has been recovered" << endl;
>> }
>>
>>
>>When building a TChain, you can force TChain::Add to check
>>if the file is valid by specifying the second argument negative.
>>In case of failure the bad file is not added to the list of files.
>>
>>Rene Brun
>>
>>
>>Avdhesh Chandra wrote:
>>>
>>> Hi,
>>> I am having more then 2000 root files, after chaining them I read file
>>> content using macro. It goes smoothly for some events but its coming out
>>> without any error mesg.
>>> >root -l input_files*.root
>>> is not showing any error mesg like any file is not closed etc.
>>>
>>> It seems to me that root is able to read the file, but when it tries to
>>> open the file its not able to read the file content, as file is corrupt.
>>> Is there is any way which can tell me which file is corrupt?
>>>
>>> Thanks,
>>> Avdhesh
>>
Received on Fri Jan 14 2005 - 08:01:32 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:04 MET