Cost of Init() in TSelector

Hello,

I do some analysis on ATLAS ntuples which have around 2300 leaves, but where I need only a few branches.
I use either a TSelector a MakeClass, and each time I need to access a new branch I do
b_el_pt->GetEntry(entry);

The problem is that my TChain are made of numerous root files, each containing only a few thousands of events. That way the time needed whenever the tree in the chain changes, is much higher than the time needed to actually process the events of this tree.
This time is cut down when I comment out the lines
fChain->SetBranchAddress(“el_pt”, &el_pt, &b_el_pt);
in Init() corresponding to the leaves I don’t use.

But it is a pain, each time I need one variable more or less in my analysis, not to forget to go back to MyNtuple.h and comment/uncomment the relevant line.
Are there any tricks that could do the job ?

Nicolas

[quote]But it is a pain, each time I need one variable more or less in my analysis, not to forget to go back to MyNtuple.h and comment/uncomment the relevant line.
Are there any tricks that could do the job ?[/quote]I recommend that you look into using the result of MakeProxy rather than MakeSelector as the MakeProxy will automatically handle both the on demand setting of addresses and on demand loading of branches.

Cheers,
Philippe.