Suppress error printout

Dear ROOTers,

when I load a TTree in memory ROOT complains about missing TBranches:

Error in TTree::SetBranchAddress: unknown branch -> trig_EF_el_EF_e10_tight

I know that this behavior is not dangerous for my analysis, but the output is overflown by these error messages. I can’t change the structure of the ntuples. All the ntuples share common “core” branches that I want to read, others can vary. Is there a way to tell ROOT not to print out these messages?

Thanks,
Riccardo

The problem is on your side. You are calling SetBranchAddress for an unknown branch.

Rene

Dear Rene, I know it, and I can’t avoid it. I just want to suppress the output which seems unnecessary, at least in this case.

The ntuples that I have to read are very large and their content had changed over time. I just need to read few branches that are always present and some more (e.g. monte carlo informations) that are not there with real data.

Thanks,
Riccardo

Hi Riccardo,

What about using something like this for the ones that are not there with real data?:

if (tree->GetBranch("trig_EF_el_EF_e10_tight")) tree->SetBranchAddress("trig_EF_el_EF_e10_tight", &fYourTrigClass);
Cheers, Bertrand.

I think it can work. The only problem is that I have kind of 300 branches and doing it by hand will be quite painful. I use to call MakeClass() and then wrap it for my purpouses.

Thanks for this suggestion. Anyway, I think that some kind of verbosity control in ROOT should be implemented. I happened to see other situations in which ROOT warns against run-time errors that, under some circumstances, are not dangerous. A simple switch like gSystem->SetOutputVerbosity(0) would solve the matter.

Well, you can also set the gErrorIgnoreLevel to kError (from TError.h) to suppress these errors while they show up (but this is not a very good solution).
Cheers, Bertrand.