gROOT->Reset();Should only be used in a unnamed macro (and never inside a function).
you probably meantTTree *tree = (TTree*)chain->CloneTree(0);
[quote]I can remove the … loop and still the new tree is filled. Any idea what is going on here?[/quote]I don’t see why this would be (unless there is somehow an ambiguity on which code you actually are using).
I noted:if ( selectionfunction() ) tree->Fill(); From the portion of code you provide I don’t see how selectionfunction can give a result that depends on the content of the entry … thus I assume that the code you copied is only a summary of what you do … and that you likely removed the portion that causes the problem.
If you can provide a running example showing your issue, I would be able to help you track it down.
When I run your code on the first file I get an output file containing only 63630 entries instead of 120893 entries. How do you assert that the entire chain is copied?
Anyway most likely this is a numerical error issue, you wrote
and Bdev0 is a float with value 0 or 1. If you any reason you machine assign/think that the value slightly less than 1, it will be rounded to 0.
In your case you should guarantee yourself the correct result by doing:
Hi,
It looks like it was the sorting function after all! And there was me thinking that I’d debugged that bit. I now have code functionaling as expected.