Problem reading data with root in cygwin


I hope you can help me with this.

I have a root tuple that was produced using root v4.04/00 compiled in linux. I am running root v4.04/02g compiled in cigwin using the win32gcc flag. I can display the contents, for example of the variable representing the invariant mass, using TBrowser. However, when I use MakeClass and then add the simple line “cout<<mass<<endl;” to the “Loop” function and compile the class using “.L Data.C+”, when I run the “Loop” function I get first zeros, then crazy numbers of order of 1e-236, etcetera. I believe is a problem with the interaction root<->compiler (g++(GCC) 3.3.3) since when I do not compile the class, I mean, when I use just “.L Data.C”, I do not have that problem. I would like to be able to read the data from this root tuple in a compiled program, since my original problem was with using information from this root tuple in a C++ code using root classes.

Any suggestion is welcome!!! (changing compiler version of course has been one of my first ideas).


Could you post your Data.C file as well as a small data.root file
that we can use to understand your problem?



I attached my file Data.C created using MakeClass. Also I attached a small root tuple. I tested it before posting it and I have the same problem using this code with this root tuple.

Root_Output_File_0.root (129 KB)
Data.C (1.48 KB)


The issue comes from the fact have branches like:[code]*Br 2 :L0 : nvtx/I:id/I:collinearity/D:mass/D:dl/D:dlError/D: *

  •     | lifetime/D:lifetimeError/D:chi2/D:pt/D:eta/D:phi/D:z1/D:zerr1/D: *
  •     | pt1/D:eta1/D:phi1/D:chisq1/D:q1/D:smt1/I:cft1/I:z2/D:zerr2/D:    *
  •     | pt2/D:eta2/D:phi2/D:chisq2/D:q2/D:smt2/I:cft2/I                  *

*Entries : 735 : Total Size= 194159 bytes File Size = 29171 *
*Baskets : 5 : Basket Size= 32000 bytes Compression= 5.45 *[/code]Unfortunately, the type of branches is very sensitive to align issue and other weirdness. (i.e. TTree makes some assumptions/guess on how the data is going to be layout in your ‘Data’ class. However these guesses are sometimes unavoidably wrong).
The best/easiest recommendation is, when writing your tree, to:
[ul][color=red]- Use a class and a dictionary to create the TTree[/color]

  • if this is not possible, have only one variable per branch
  • if this is not possible, have only one type of variable per branch
  • if this is not possible, order the variables from large size to smaller.[/ul]

Note that the latest combinations of cygwin and gcc are pretty bad.
If you run on Windows, I strongly suggest to use the win32gdk version
instead of win32gcc.