Can't read the data in rootfile under Windows

Hi all
I was developing a Qt program and it works well under Linux. While I turn into windows, a strange problem appears: both ‘TTreereader method’ and ‘SetBranchAddress method’ don’t work. ‘TTreeReader’ can’t ‘Next()’, its ‘GetCurrentEntry()’ always return -1. ‘SetBranchAddress’ can read some data while they misaligned i.e. some data are missed and some ‘non data’ are read…


ROOT Version: preview Windows Visual Studio 2017
_Platform:windows
_Compiler:MSVC2015 32bit


The codes and rootfile is in https://drive.google.com/open?id=17YRnWFNel4Ri4Xz5DHo5BjDbn7m_zLL8

It’s nearly empty qt project with some test code…

Hi,

I’ll take a look, but it might well be that you hit a “not working yet” part of ROOT 6 on Windows… As you know, it is still a preview version…

Cheers, Bertrand.

FYI, groot manages to correctly read your data file:

$> root-ls -t ./Testrun1.root 
=== [./Testrun1.root] ===
version: 61404
  TTree            RAWData            RAWData (entries=1067)
    EventNumber    "EventNumber/I"    TBranch
    number_of_hits "number_of_hits/I" TBranch
    TDC_channel    "TDC_channel"      TBranchElement
    TDC_TimeStamp  "TDC_TimeStamp"    TBranchElement
    TDC_StyleStamp "TDC_StyleStamp"   TBranchElement
$> root-dump ./Testrun1.root  | head
>>> file[./Testrun1.root]
key[000]: RAWData;1 "RAWData" (TTree)
[000][EventNumber]: 1
[000][number_of_hits]: 16
[000][TDC_channel]: [4 8 29 5 8 30 6 31 7 29 4 30 5 31 6 7]
[000][TDC_TimeStamp]: [701.2 694.5 697.8 699.6 714.8 690.6 693.8 696.8 692.4 719.3 717.5 742.5 716.1 719.1 747.8 728.1]
[000][TDC_StyleStamp]: [1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0]
[001][EventNumber]: 2
[001][number_of_hits]: 12
[001][TDC_channel]: [4 29 5 30 6 29 7 30 4 5 6 7]

(I tested it on Linux, but groot also works (the same) on Windows.)

Hi,

Well, which version are you using exactly? Here is what I got with ROOT v6.14.06:

C:\rootdev\readtest>release\mainwindow_1.exe
Warning in <TClassTable::Add>: class ROOT::Detail::TTypedIter<class TEnumConstant> already in TClassTable
16
12
6
45
46
12
47
15
47
33
*****************
1067
0
1
2
3
4
5
6
7
8
9

C:\rootdev\readtest>

EDIT: Make sure to build with the same configuration (debug/release) than the one used to build ROOT, otherwise it will not work properly. This is most probably the origin of your problem!

Cheers, Bertrand.

Hi,

I am using 6.14.06(root_v6.14.06.win32.vc15.exe). You’re exactly right, this problem disappear when the project is built in release mode…

I am a quite newcomer with the ‘release’ and ‘debug’ things, could you explain somehow about this?

Thanks very much!

The compiler produces code which is different in debug and release mode (debug contains debug - and possibly more - information), and they are not compatible. This is very specific to Microsoft (I think)…