Ignore:
Timestamp:
02/11/09 12:08:23 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc

    r9302 r9315  
    291291        // Delete the file. This'll also close the file (if open)
    292292        //
     293        *fLog << inf3 << "Closing file " << fOut->GetName() << "." << endl;
    293294        delete fOut;
    294295
     
    299300        // - Branches are automatically deleted by the tree destructor
    300301        //
    301         *fLog << inf << "Output File closed and object deleted." << endl;
    302302    }
    303303
     
    325325    *fLog << all << underline << "File: " << GetFileName() << dec << endl;
    326326
    327     if (fTrees.GetEntries()==0)
    328     {
    329         *fLog << "  No contents." << endl;
    330         return;
    331     }
     327    Bool_t cont = kFALSE;
    332328
    333329    TObject *obj;
     
    347343
    348344        *fLog << " + " << name.Strip(TString::kTrailing, '.') << ": \t" << (ULong_t)branch->GetEntries() << " entries." << endl;
     345        cont = kTRUE;
    349346    }
    350347
     
    353350    while ((t=(TTree*)NextTree()))
    354351        if (t->TestBit(kIsNewTree))
     352        {
    355353            *fLog << " + " << t->GetName() << ": \t" << (ULong_t)t->GetEntries() << " entries." << endl;
     354            cont = kTRUE;
     355        }
    356356
    357357    TIter NextKey(fOut->GetList());
     358   
    358359    while ((obj=NextKey()))
    359360    {
     
    365366
    366367        *fLog << " - " << obj->GetName() << ": \t" << (ULong_t)((TTree*)obj)->GetEntries() << " entries." << endl;
    367     }
     368        cont = kTRUE;
     369    }
     370
     371    if (!cont)
     372        *fLog << "  No contents." << endl;
     373
    368374    *fLog << endl;
    369375}
     
    822828
    823829    // Close/delete the old file (keys already written above)
     830    *fLog << inf3 << "Closing file " << fOut->GetName() << "." << endl;
    824831    delete fOut;
    825 
     832 
    826833    // Replace current with new file
    827834    fOut = newfile;
     
    912919    *fLog << inf << out << flush;
    913920
    914     TTree *clone=t.CloneTree();
    915     clone->Write();
    916     delete clone;
     921    // When a new file has been opened the old clone (if existing) has
     922    // been moved to the new file. We could now use CopyTree but then
     923    // we would have to unpack all data and repack it. Instead
     924    // we delete the moved old tree.
     925    //  FIXME: In priciple we could delete a "wrong" tree with the same name.
     926    //         Should we flag the clones and delete them in ChangeFile?
     927    TObject *old = fOut->GetList()->Remove(fOut->GetList()->FindObject(t.GetName()));
     928    delete old;
     929
     930    // Now we clone the tree without unpacking and repacking.
     931    // When it has not been moved it will be deleted in the TFile destructor
     932    /*TTree *clone =*/ t.CloneTree(-1, "fast");
     933    //clone->Write();
     934    //delete clone;
    917935
    918936    *fLog << "done." << endl;
Note: See TracChangeset for help on using the changeset viewer.