Performance of TTree in Object Mode

I have a question about how branches are accessed in a TTree. As I understand it there are 2 “modes” in which branches can be read. One mode is to read the branches in a tree by setting the branch addresses of the written objects by class. In other words we read entire class objects. The other mode allows us to do a partial read of branches. Here we can read select data members of the classes that are written to the tree.

These modes are set by,

tree->SetMakeClass(0); // Object Mode: This is the default and recommended.
tree->SetMakeClass(1); // Partial Read Mode:

Which method yields the best performance? If you have a class with many data members (maybe a few large arrays) and a lot of chained files is it faster to read the tree or chain by accessing the branches you want individually or by reading the entire object? It seems to me that there should be a large performance increase in this case but if this is true what is the advantage of using the default object mode?

Additionally, is it ok to have a tree written in a mixed way? Can I create some branches using the class method and some branches that are simple data types?

Hi,

[quote]Additionally, is it ok to have a tree written in a mixed way? Can I create some branches using the class method and some branches that are simple data types?[/quote]Yes you can.

[quote]One mode is to read the branches in a tree by setting the branch addresses of the written objects by class. In other words we read entire class objects. [/quote]The “object mode” allows you to read the whole object and call member function on it, however it does not requires it. Even in "object mode’, you can partially read the objects.

[quote]The other mode allows us to do a partial read of branches. Here we can read select data members of the classes that are written to the tree. [/quote]No, the other mode is not about being able to read partially the object (see above paragraph). You can read select data members in both mode. The point of the other method is to be able to read the information even though you have not loaded the C++ code from your class. This modes makes senses only in conjunction with the result of MakeClass which create a skeleton that somewhat replicate your objects but degrade them into the int and floats (and double, etc.).
In that mode you can only access the data members (individually or not) and can not call any member functions.

[quote]Which method yields the best performance?[/quote]In other word, the difference is not in the performance but only in the access pattern. (Also MakeClass is not superseeded by MakeProxy which does not use the SetMakeClass(1) mode and give you both easy access to the data member and to the object (if the library is loaded).

Cheers,
Philippe.