TTree::ReadFile: how to disable "Ignore trailing..." warning

Dear ROOT community,

I am developing a program to read-in and plot data from txt data files. The quantities to plot are always in the first three columns, but the number of columns after that is variable and intended to be variable. Everything works great, the only nuisance is countless warnings of the kind:

Warning in <TTree::ReadStream>: Ignoring trailing "     1.6490E+2" while reading line 396

While I generally understand the justification and necessity of such a warning, in my case I can exclude that this warning would hint at crucial data non-integrity. I would like to disable it or maybe only print it once to notify the user. Is there a way to get rid of the warning or tell TTree:ReadFile() to collect all trailing fields into one?

Best regards,

Dear Andreas,

What do you use as branch descriptor?
What happens if you add a generic :astring/C at the end (intended to collect all the trailing excess)?

G Ganis

Adding your suggestion I use this:


It has no effect though. Did I misunderstand something? Using this


I get these warnings:

Warning in <TTree::ReadStream>: Ignoring trailing "     199.993 4654.603        22.8    43.7    -1.0000E+6      0.0000E+0       1.3507E+4       1.1547E-1       -9.8126E-1      1.1547E-6       1.9589E+2       2.8353E+2" while reading line 3993

PS: all the ":no"s are in place to suppress the warning for a specific input file.

Ok, so you have to raise locally the level of ignore to kError (so that everything below Error is ignored):

// Silence warnings during TTree::ReadFile
Int_t currentIgnoreLevel = gErrorIgnoreLevel;
gErrorIgnoreLevel = kError;
// Read the file
// Restore previous settings
gErrorIgnoreLevel = currentIgnoreLevel;

G Ganis

That works great, thank you! :sunny:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.