There are two ways to read an object from a file.
TShape *shape = (TShape*)f.Get(shape_name);
f.Get will create an object of class TShape with the following sequences of operations:
In case of an object with multiple cycles, one can return a cycle (a
la VMS) with f.Get(name;cycle).
TIter nextkey(f.GetListOfKeys()); TKey *key; while (key = (TKey*)nextkey()) { Event *event = (Event*)key->ReadObj(); event->Process(); {
In case a program does not terminate in a clean way, the file directory is may be not written at the end of the file. Next time you use the file, ROOT will automatically detect this situation and will recover the directory by scanning sequentially the list of keys in the file. If the file has been opened in UPDATE mode, the recovered directory will be automatically written to the file. This automatic recovery procedure is possible because of redundant information written to the file. In case you write large TTrees, you may have large buffers in memory. In case of a job crash, you may loose a lot of data. A mechanism has been foreseen for this case. See TTree::AutoSave.