tree->MakeClass

Hello
I have a question a bout
tree->MakeClass(“string”);
As I remember it produces two files string.h and string.C
in the string.h you find
fChain->SetBranchAddress(“MET_Final_ex”, &MET_Final_ex);
but now a days I get something strange
fChain->SetBranchAddress(“MET_Final_ex”, &MET_Final_ex, &b_MET_Final_ex);
the commant has two pointers.
what is that?
is it a new feature?

Hi,

tree->MakeClass("string"); Please use a different name :slight_smile:. It is too easy (for human and compiler alike) to confuse the result (string.h) which a compiler’s header!

fChain->SetBranchAddress("MET_Final_ex", &MET_Final_ex, &b_MET_Final_ex); [quote]is it a new feature?[/quote]Yes, it is a simplification and an optimization. Now each branch is being told in which location in memory you (well the MakeClass result) uses to cached the branch’s address. This branch address must be updated each time a TChain moves from one TTree to the next. The previous implementation was using a string lookup for each branch (at each time the TChain was moving from one TTree to next). The next method is faster and less error prone (can’t miss doing the update when needed).

Cheers,
Philippe.

1 Like