Cloned tree smaller

Dear All,

I’d like to “filter” an existing tree cloning it. The new one will be filled if some conditions match.
Before apply the conditions I wanna be sure my cloned tree is exactly the same as the original one.
Comparing some variables, nentries, etc, etc … everything looks fine. The only thing I was not expecting is that the conned tree is much smaller than the original one (10%). Is it the expected behavior?
I’m running ROOT 5.32 and KUbuntu 11.10 64bit.
Cheers,
Sergio

[quote]The only thing I was not expecting is that the conned tree is much smaller than the original one (10%). Is it the expected behavior?[/quote]If you filter some of the entries by definition there will be less data in the output.

Cheers,
Philippe.

Hi Philippe,

Even if you just do a loop over all entries end call “CloneTree->Fill();” in all of them?
Why we should have less data (for clarification)? I thought it would be like doing
$ cp tree.root clone_tree.root

Cheers,
Sergio

Hi Sergio,

[quote]Even if you just do a loop over all entries end call “CloneTree->Fill();” in all of them?[/quote]No (assuming there is also a call to inputTree->GetEntry(…) ), in this case, it should be same data. However there could be 2 sources of difference. One is if there is other object (like historgrams or other TTree) in the input file, unless they are explicitly copied, they will not be found in the output file. The other is depending of the version of ROOT, the end compression might be different. To understand this later case, look at the result on TTree::Print on the input and output file.

Cheers,
Philippe.

Hi Philippe,

Thank you again for your answer.

The data is the same (as I said in my original post). I do have, indeed, inputTree->GetEntry(…) as you can see below. I’ve checked carefully and I’ve exactly the same data. The difference is in size of the ROOT file: 8.1M the original file and 7.7M the cloned one.

    for (Int_t i=0;i<nevents;i++) {
      t4->GetEntry(i);
      CloneTree->Fill();
    }
    fclone.Write();

No, I don’t have any other object.

Both ROOT files were produced with the same ROOT version and in the same machine (ROOT 5.32 and KUbuntu 11.10, both 64bit). I’ve attached here the two results of TTree::Print on the input (print_original.txt) and output (print_clone.txt) file. Well, they are very different. Sometimes 10 times more in the compression. Is it OK?

Cheers,
Sergio
print_clone.txt (20.5 KB)
print_original.txt (20.5 KB)

Hi,

A priori yes, it is normal (well … you can always verify the data is still the same for a sample of the branches). The issue is that the original file was stored very inefficiently (75 baskets per branches instead of just 3 in the output), I am guessing that when creating the input file there was an excess number of call to TTree::AutoSave or TTree::FlushBasket.

Cheers,
Philippe.

Hi Philippe,

Thanks for the prompt response and for the explanation.

All the best,
Sergio