Home | News | Documentation | Download

Reading and manipulating dataset

Dear Root users,

I am having a few problems reading data into a tree. I’ve fed in some data by creating a tree by

TTree *test = new TTree(“TEST”,“TEST”)

Data is then fed into the tree from a file called “testdata.tab” which has 7 tab-delimited columns and lines which I would like to ignore have “#” put before them.

The data is structured in a simple tab-delimited table format as follows-
Column 1 Column 2 Column 3 … Column 7

Line 50 is as follows-
test50 20.4 80.2 basil 23.5
(There is no data entered in columns 6 and 7 for line 50)

The problem I have is once I command the compiler to read the file and store the data into the “test” tree, I get the following warning

Warning in TTree::ReadStream: Ignoring trailing 80.2 basil while reading line 50

This warning appears for most of the lines, not just line 50 (I’ve just put one line in for simplicity)
Initially, I did not receive this warning. However, after a few runs, it appeared. Once this warning appears, I cannot create any graphs. Is there a way to fix this?

Inspect line 50 (±1) of your “testdata.tab” file.

Hi, I’ve inspected this line and I can’t see any issues. I’ve edited the post to (hopefully) make my problem more clear by including an example of the data set and the corresponding warning line.

You do not write how you read this file but, if you use e.g. the TTree::ReadFile then the missing columns will generate a problem (there will be no data to fill the “missing” branches).