Suppressing error messages Error in <TTree::SetBranchStat

Hi Root-ers
I am running over (with the same code) different sets of ntuples using complied c++ code with root and TSelector. Some of the ntuples have additional branches, and I ran TSelector on these ntuples to get my base class.

So when running on the reduced ntuple I get a lot of errors of the type
Error in TTree::SetBranchStatus: unknown branch
which are harmless as I set a flag in the run command not to use these branches in the main code for the ntuples which don’t have them (but they are used in the other ntuples, so I can’t remove the branches from the code entirely).
But the error messages are annoying as they blow up my log file and I can’t find the output easily which I want to see.
Is there a straightforward way to suppress these types of error message (for all ntuples whether they have the branches or not, so I don’t need to switch over the code every time)?

Hi Ellie,

two ways. Less good: set gErrorIgnoreLevel to kError (from TError.h) while these messages show up. Better: fix your base class TSelector:

if (tree->GetBranch(brname)) tree->SetBranchAddress(brname, brvar);
Cheers, Axel.