H2root - only zeros in integer branches after conversion

Dear ROOT Experts,

I am converting column-wise-ntuples from HBOOK files to ROOT with h2root. If worked fine with older versions of ROOT, then with 5.34/25 h2root was crashing (on several Ubuntu/Debian machines) - probably due to this issue:
sft.its.cern.ch/jira/si/jira.is … -6937.html

Indeed, in ROOT version 5.34/26 h2root does not crash anymore. However, the produced root tree is not correct. All tree branches whose type after conversion is UChar_t contain only zeros. The original ntuples contain correct values and they were converted correctly with h2root from older ROOT versions (for instance, 5.32/04).

The original columns of the ntuples are all of INTEGER type, but after conversion with h2root some of them are made UChar_t and some Int_t. The problem seems to concern all columns which were converted to UChar_t, but also some of those which became Int_t.

I believe this problem must be related to the change to ‘exchange mode’ described in the above link. Do you know what may be the reason for this behavior? Also, for a possible workaround it would be useful to know what are the rules for converting an integer ntuple column to either UChar_t or Int_t type. Is this described somewhere?

Thank you in advance!
Alek

Can you post a small hook file having this problem ?

I am sorry for the delay, but I finally managed to extract a minimal example of the problem.
The below program can be used to produce a HBOOK file containing a simple CWN with 3 REAL and 3 INTEGER columns. The columns are filled with non-zero values as the program shows.

      Program create
      REAL A,B,C
      INTEGER D,E,F
      INTEGER        Nhmax, Nrvar, i, Ista, ic
      Parameter (Nhmax = 100000)
      INTEGER  Hmemor(Nhmax)
      Common /Pawc/ Hmemor
      Common /P/   A,B,C,D,E,F
C     
      Call Hlimit(Nhmax)
C     
      Call Hropen(10,'P1','simple.ntu','N',1024,Ista)
C     
      Call Hbnt(1,'Test','D')
C     
C     float columns
      Call Hbname(1,'P1',A,'A:r')
      Call Hbname(1,'P1',B,'B:r')
      Call Hbname(1,'P1',C,'C:r')
C     integer columns
      Call Hbname(1,'P1',D,'D:i')
      Call Hbname(1,'P1',E,'E:i')
      Call Hbname(1,'P1',F,'F:i')
C     
      Do I=1,10
C     fill float columns
         A = Float(I)
         B = Float(10*I)
         C = Float(100*I)
C     fill integer columns
         D = I
         E = 10*I
         F = 100*I
C     
         Call Hfnt(1)
      EndDo
C     
      Call Hrout(0,IC,'')
C     
      Call Hrend('P1')
      Close(10)
C     
      End

The values in the HBOOK file investigated with PAW are correct. Now if simple.ntu is converted with h2root from ROOT 5.34/26 (on Linux x86_64, with gfortran 4.9.2), the float columns are fine, but the integer ones are filled with zeros only. Conversion on a machine with older ROOT 5.32/04 (Linux x86_64, gfortran 4.6.3) yields a .root file with all values correct.

I just converted your hbook file into a root file using h2root on Mac.

ROOT 5.34/26, 6.02/05, 6.03/03 give me:

root [3] h1->Scan()
************************************************************************************
*    Row   *         A *         B *         C *         D *         E *         F *
************************************************************************************
*        0 *         1 *        10 *       100 *         1 *        10 *       100 *
*        1 *         2 *        20 *       200 *         2 *        20 *       200 *
*        2 *         3 *        30 *       300 *         3 *        30 *       300 *
*        3 *         4 *        40 *       400 *         4 *        40 *       400 *
*        4 *         5 *        50 *       500 *         5 *        50 *       500 *
*        5 *         6 *        60 *       600 *         6 *        60 *       600 *
*        6 *         7 *        70 *       700 *         7 *        70 *       700 *
*        7 *         8 *        80 *       800 *         8 *        80 *       800 *
*        8 *         9 *        90 *       900 *         9 *        90 *       900 *
*        9 *        10 *       100 *      1000 *        10 *       100 *      1000 *
************************************************************************************

Thank you for checking this. May I ask which Fortran compiler you are using to build ROOT?

I believe that my issue must be related to the new gfortran compiler (similarly as the h2root crash from the link above). I have checked that h2root from ROOT 5.34/26 converts my ntuples correctly if I build it with gfortran 4.6 rather than 4.9 (which is now default in my distribution).

$ gfortran --version
GNU Fortran (GCC) 4.2.3
Copyright (C) 2007 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING