--- TBranch.cxx 2008-04-16 13:50:09.000000000 -0400 +++ TBranch.cxx 2008-04-16 13:44:15.000000000 -0400 @@ -562,6 +562,54 @@ } //______________________________________________________________________________ +void TBranch::DeleteBaskets(Option_t* option) +{ + // Loop on all branch baskets. If the file where branch buffers reside is + // writable, free the disk space associated to the baskets of the branch, + // then call Reset(). If the option contains "all", delete also the baskets + // for the subbranches. + + Bool_t all = kFALSE; + TString opt = option; + opt.ToLower(); + if (opt.Contains("all")) + all = kTRUE; + TFile *file = GetFile(0); + + if(fDirectory && (fDirectory != gROOT) && fDirectory->IsWritable()) { + TBasket *basket; + + for(Int_t i=0; iSetBit(TBufferFile::kNotDecompressed); + basket->SetBranch(this); + if (fBasketBytes[i] == 0) { + fBasketBytes[i] = basket->ReadBasketBytes(fBasketSeek[i],file); + } + Int_t badread = basket->ReadBasketBuffers(fBasketSeek[i],fBasketBytes[i],file); + if (badread || basket->GetSeekKey() != fBasketSeek[i]) { + Error("DeleteBaskets","File: %s at byte:%lld, branch:%s, entry:%d, badread=%d",file->GetName(),basket->GetSeekKey(),GetName(),fReadEntry,badread); + } else { + basket->Delete(); + } + delete basket; + } + Reset(); + } + + // process subbranches + if (all) { + TObjArray *lb = GetListOfBranches(); + Int_t nb = lb->GetEntriesFast(); + for (Int_t j = 0; j < nb; j++) { + TBranch* branch = (TBranch*) lb->UncheckedAt(j); + if (!branch) continue; + branch->DeleteBaskets("all"); + } + } +} + +//______________________________________________________________________________ void TBranch::DropBaskets(Option_t* option) { // Loop on all branch baskets. Drop all except readbasket.