Disabling "No Keys Found" Errors

I’m running over a bunch of files, some of which were created improperly and consequently have no keys. To prevent these files from being added to the analysis I added a quick check,

TFile f(input_name);

if(!f.GetListOfKeys()->IsEmpty())
{
chain.Add(input_name);
}

Everything works great, only when I input the file to check for the keys a warning is displayed at the prompt. When running over hundreds of files, these warnings start to clog the prompt and obfuscate the useful output messages elsewhere in the code. Is there any way to turn this warning off?

Thanks!

Before calling TFile, set

gErrorIgnoreLevel=9999; or any other level with the convention (see TError.h)

const Int_t kUnset = -1; const Int_t kInfo = 0; const Int_t kWarning = 1000; const Int_t kError = 2000; const Int_t kBreak = 3000; const Int_t kSysError = 4000; const Int_t kFatal = 5000;
and reset it to 0 after opening the file.

Rene

Perfect, thanks!