Hi,
I observed a weird problem with TTree copying. In case of SetAutoFlush, the copied TTree size would be tripled or even more for ROOT version >= 5.30.00. I tried the following ROOT versions: 5.28.00g, 5.30.03, 5.30.05, 5.34.00-rc1. All except 5.28.00g have this problem. My OS is SL-5.3, and I ran 64-bit ROOT.
Input TTree size: 1,279,365,174 (unzipped), 507,542,203 (on disk)
Copied TTree size (SetAutoFlush): 3,398,279,716 (unzipped), 2,578,342,472 (on disk)
Copied TTree size (no SetAutoFlush): 1,279,083,457, 507,222,052 (on disk)
{
TTree::SetMaxTreeSize( 10 * 1024 * 1024 * 1024L );
TChain *chain = new TChain("qcd");
chain->Add("input.root");
TFile *newFile = TFile::Open("newFile.root","RECREATE");
TTree *newTree = chain->CloneTree(0);
newTree->SetAutoFlush();
Int_t nPrint = 200;
Long64_t nevts = chain->GetEntries();
cout << "nevts=" << nevts << endl;
for (Int_t ievt=0; ievt<nevts; ievt++) {
if (ievt%nPrint == 0) {
cout << "ievt=" <<ievt << endl;
cout.flush();
}
chain->GetEntry(ievt);
newTree->Fill();
}
newTree->Write();
newFile->Close();
}
–Shuwei