MakeClass and MakeSelector SetBranchStatus("*", 0) in Init

I’d like to propose that a single line is added in the “Init” method generated by the “MakeClass” and “MakeSelector”:

[code]// …
fChain->SetBranchStatus("*", 0); // this line added

// …[/code]
Note: every following “fChain->SetBranchAddress(…);” call will set the branch status to 1 for the branch that it uses. Afterwards, branches which were not explicitly mentioned/defined will have status 0 (thank to the added line).


The default is also to have a SetBranchAddress for each branches so the net effect would be moot (until the user removes some of the SetBranchAddress). In addition, I would rather not encourage the use of SetBranchStatus (that is somewhat awkward and is less efficient than directly requesting the needed branches).


No need to “remove some of the SetBranchAddress”.
Just imagine that you get a new set of ROOT files with a new set of trees.
And somebody decided that he/she needs additional branches in some of them.
You don’t use these new branches at all - you don’t even know they were added.
Well, you simply get segmentation violations when you reuse your analysis code (which is not aware of any newcomers).
It makes no sense to run “MakeClass” and/or “MakeSelector” each time a new set of ROOT files is there and create a whole bunch of “almost equal” source code versions (each of them needs maintenance afterwards, of course).
I think the simple solution is … protect the code against new/undefined/unused branches in the “Init”.
Then, the same source code will be able to work with the "old’ and the “new” tree layouts.
That’s why I am asking for this modification.
As you say, in “normal situations” it will not change anything but it will also do not harm.