Changeset 9315 for trunk/MagicSoft/Mars/mfileio
- Timestamp:
- 02/11/09 12:08:23 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
r9302 r9315 291 291 // Delete the file. This'll also close the file (if open) 292 292 // 293 *fLog << inf3 << "Closing file " << fOut->GetName() << "." << endl; 293 294 delete fOut; 294 295 … … 299 300 // - Branches are automatically deleted by the tree destructor 300 301 // 301 *fLog << inf << "Output File closed and object deleted." << endl;302 302 } 303 303 … … 325 325 *fLog << all << underline << "File: " << GetFileName() << dec << endl; 326 326 327 if (fTrees.GetEntries()==0) 328 { 329 *fLog << " No contents." << endl; 330 return; 331 } 327 Bool_t cont = kFALSE; 332 328 333 329 TObject *obj; … … 347 343 348 344 *fLog << " + " << name.Strip(TString::kTrailing, '.') << ": \t" << (ULong_t)branch->GetEntries() << " entries." << endl; 345 cont = kTRUE; 349 346 } 350 347 … … 353 350 while ((t=(TTree*)NextTree())) 354 351 if (t->TestBit(kIsNewTree)) 352 { 355 353 *fLog << " + " << t->GetName() << ": \t" << (ULong_t)t->GetEntries() << " entries." << endl; 354 cont = kTRUE; 355 } 356 356 357 357 TIter NextKey(fOut->GetList()); 358 358 359 while ((obj=NextKey())) 359 360 { … … 365 366 366 367 *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 368 374 *fLog << endl; 369 375 } … … 822 828 823 829 // Close/delete the old file (keys already written above) 830 *fLog << inf3 << "Closing file " << fOut->GetName() << "." << endl; 824 831 delete fOut; 825 832 826 833 // Replace current with new file 827 834 fOut = newfile; … … 912 919 *fLog << inf << out << flush; 913 920 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; 917 935 918 936 *fLog << "done." << endl;
Note:
See TracChangeset
for help on using the changeset viewer.