RE: [ROOT] How to recognize corrupted files ?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Oct 11 2002 - 17:24:33 MEST


Hi Frank,

In the CVS version today, I have added the possibility to detect
if the file has been recovered or not
  TFile myfile("myfile.root");
  if (file.IsZombie()) {
     //something very wrong, cannot use this file, exit
  }
  if (myfile.TestBit(TFile::kRecovered)) {
     //the Recover procedure has been run when opening the file
    //and the Recover was successful
  } else {
    all OK
  }

Rene Brun



On Fri, 11 Oct 2002, Frank Laue wrote:

> Hi Rene:
> 
> 
> But if ROOT would recover the file, the file would not be a zombie.
> How do I realized whether the file was recovered or opened without
> problems in the first place.
> 
> Thanks.
> 
> Cheers,
> 	Frank
> 
> > -----Original Message-----
> > From: Rene Brun [mailto:brun@pcbrun.cern.ch] 
> > Sent: Thursday, October 10, 2002 4:22 PM
> > To: Frank Laue
> > Cc: roottalk@pcroot.cern.ch
> > Subject: Re: [ROOT] How to recognize corrupted files ?
> > 
> > 
> > Hi Frank,
> > 
> > You can do:
> > 
> > TFile *file = TFile::Open(...);
> > if (file->IsZombie()) {
> >   //file is overwritten, invalid, etc
> > }
> > 
> > Rene Brun
> > 
> > On Thu, 10 Oct 2002, Frank Laue wrote:
> > 
> > > Hi:
> > > 
> > > When opening a corrupted file (maybe not closed properly) with
> > > TFile::Open(...) ROOT does open the file and prints some 
> > warnings on the
> > > screen. Is there any other means to identify that files as bad.
> > > 
> > > Is there a return value or a flag that one can easily check on in a
> > > program ?
> > > 
> > > Thanks.
> > > 
> > > Cheers,
> > > 	Frank
> > > 
> > > 
> > > 
> > > > -----Original Message-----
> > > > From: owner-roottalk@pcroot.cern.ch 
> > > > [mailto:owner-roottalk@pcroot.cern.ch] On Behalf Of Rene Brun
> > > > Sent: Thursday, October 10, 2002 11:16 AM
> > > > To: Avdhesh Chandra
> > > > Cc: roottalk@pcroot.cern.ch
> > > > Subject: Re: [ROOT] graph array problem
> > > > 
> > > > 
> > > > Hi,
> > > > 
> > > > I do not understand if what you try to do is:
> > > >   - an array of TGraphErrors
> > > >   - or one single TGraphErrors build with an array of points
> > > >     and associated errors.
> > > > 
> > > > Please clarify by sending a complete running script.
> > > > 
> > > > Rene Brun
> > > > 
> > > > 
> > > > 
> > > > On Thu, 10 Oct 2002, Avdhesh Chandra wrote:
> > > > 
> > > > > 
> > > > > Hi,
> > > > >     I am trying to make graph array, so i can use it.
> > > > > 
> > > > >  programe looks like(where i am defining graph array)
> > > > > 
> > > > >  for(int i = 0 ; i < nent ; i++)
> > > > >    {
> > > > >      cout << "  Col[i]  " << Col[i] << endl;
> > > > >      gr[i] = new TGraphErrors(n,Z,Ent[i],Ez,Eent[i]);
> > > > >      gr[i]->SetMarkerColor(Col[i]);
> > > > >      gr[i]->SetMarkerStyle(Sty[i]);
> > > > >    }
> > > > > 
> > > > > when i am running my code  i am getting following message
> > > > > 
> > > > > ---------------------------------------------------
> > > > >   Col[i]  7
> > > > >   Col[i]  6
> > > > > Error: Array index out of range gr -> [1]  valid upto 
> > gr FILE:test.C
> > > > > LINE:156
> > > > > 
> > > > >  *** Break *** segmentation violation
> > > > > ---------------------------------------------------
> > > > > 
> > > > > 
> > > > > Which shows that when it goes secound time in the loop it 
> > > > having problem.
> > > > > Please let me know what i am doing worng.
> > > > > 
> > > > > Thanks for any help
> > > > > Avdhesh
> > > > > 
> > > > 
> > > 
> > 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:14 MET