Re: [ROOT] un-closed TTree files

From: Susan Kasahara (schubert@physics.umn.edu)
Date: Tue May 20 2003 - 19:01:03 MEST


Hi Mark,
Root provides an TTree::AutoSave mechanism to save a tree to file at regular intervals so that
you can recover in the event of crashes such as the one that you experienced.  By default, this
autosave interval is set to something like every 10 Mbytes filled to the tree, but you can adjust
this parameter to save your tree to the file more frequently.   You can also explicitly invoke AutoSave
to save the tree every nth event, e.g.
if ( nth event ) {
    TDirectory* savedir = gDirectory;
    tfile->cd();
    ttree->AutoSave(); // save tree to file
    tfile->SaveSelf();  // save file directory containing this tree
    savedir->cd();
}
In the case of your latest crash, it looks like AutoSave was invoked at least once for the CrystalTree tree.  This
tree will be intact up to the last entry filled to this tree just before the last AutoSave.  Your job may have
gone on to fill entries into the tree after this AutoSave, but those entries will have been lost.
As far  as permanent recovery, I think I remember reading something that if you open your file in Update mode,
root will clean it up so that on the next open you won't see the warning messages.
Regards,
-Sue

mark.winkler@philips.com wrote:

>
> Hello all,
>
> I am using root 3.05/02 with Geant4.4.1.p01.  In an exercise of poor judgement I hope not to repeat, I was running a simulation with many
> tens of millions of events and without saving my data in the interim.  The bad news is that a power loss occurred during a run; the good
> news is that the root file was in the process of being written.  When I viewed the file, root had to "recover" the file:
>
> TFile f("simset75.root")
> Warning in <TFile::Init>: file simset75.root probably not closed, trying to recover
> Info in <TFile::Recover>: recovered key TList:StreamerInfo at address 64132996
> Info in <TFile::Recover>: recovered key TTree:CrystalTree at address 897651719
> Warning in <TFile::Init>: successfully recovered 2 keys
>
> I then view the file in a TBrowser, and all appears well.  I was hoping someone out there might be able to help me with these questions:
> What did the recovery program do and are there any unexpected repercussions?  If i should run into this in the future, is there a
> permanent recovery function? or should I write a function to extract the data and write a new TTree (so it does not have to recover the
> file each time)?
> Cheers!
> Mark
>
>



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET