Problem displaying TString in TBrowser. Also possible C++17 related bug?

Dear ROOT experts,

I have the following ROOT file forum.root (792.7 KB) which contains a TTree with the following structure:

root [1] EventTree->Print()
******************************************************************************
*Tree    :EventTree : Event Tree                                             *
*Entries :     1000 : Total =         2431957 bytes  File  Size =     790896 *
*        :          : Tree compression factor =   3.07                       *
******************************************************************************
*Branch  :fEvent                                                             *
*Entries :     1000 : BranchElement (see below)                              *
*............................................................................*
*Br    0 :fEventID  : Int_t                                                  *
*Entries :     1000 : Total  Size=       4581 bytes  File Size  =       1523 *
*Baskets :        1 : Basket Size=      32000 bytes  Compression=   2.68     *
*............................................................................*
*Br    1 :fSubEventID : Int_t                                                *
*Entries :     1000 : Total  Size=       4596 bytes  File Size  =        133 *
*Baskets :        1 : Basket Size=      32000 bytes  Compression=  30.70     *
*............................................................................*
*Br    2 :fInfo     : TString                                                *
*Entries :     1000 : Total  Size=       5574 bytes  File Size  =       1544 *
*Baskets :        1 : Basket Size=      32000 bytes  Compression=   3.29     *
*............................................................................*
*Br    3 :fTracks   : Int_t fTracks_                                         *
*Entries :     1000 : Total  Size=      17178 bytes  File Size  =       2662 *
*Baskets :        1 : Basket Size=      32000 bytes  Compression=   3.04     *
*............................................................................*
*Br    4 :fTracks.fTrackID : Int_t fTrackID[fTracks_]                        *
*Entries :     1000 : Total  Size=      48273 bytes  File Size  =       6261 *
*Baskets :        2 : Basket Size=      32000 bytes  Compression=   7.61     *
*............................................................................*
*Br    5 :fTracks.fParentID : Int_t fParentID[fTracks_]                      *
*Entries :     1000 : Total  Size=      48279 bytes  File Size  =       6057 *
*Baskets :        2 : Basket Size=      32000 bytes  Compression=   7.87     *
*............................................................................*
*Br    6 :fTracks.fSteps.fStepID : vector<int> fStepID[fTracks_]             *
*Entries :     1000 : Total  Size=     117531 bytes  File Size  =      14736 *
*Baskets :        4 : Basket Size=      32000 bytes  Compression=   7.93     *
*............................................................................*
*Br    7 :fTracks.fSteps.fPosition : vector<TVector3> fPosition[fTracks_]    *
*Entries :     1000 : Total  Size=     686967 bytes  File Size  =     337256 *
*Baskets :       22 : Basket Size=      32000 bytes  Compression=   2.03     *
*............................................................................*
*Br    8 :fTracks.fSteps.fMomentum : vector<TVector3> fMomentum[fTracks_]    *
*Entries :     1000 : Total  Size=     686967 bytes  File Size  =     200968 *
*Baskets :       22 : Basket Size=      32000 bytes  Compression=   3.41     *
*............................................................................*
*Br    9 :fTracks.fSteps.fTimeGlobal : vector<double> fTimeGlobal[fTracks_]  *
*Entries :     1000 : Total  Size=     180807 bytes  File Size  =     133531 *
*Baskets :        6 : Basket Size=      32000 bytes  Compression=   1.35     *
*............................................................................*
*Br   10 :fTracks.fSteps.fSensitive : vector<bool> fSensitive[fTracks_]      *
*Entries :     1000 : Total  Size=      70176 bytes  File Size  =      12017 *
*Baskets :        3 : Basket Size=      32000 bytes  Compression=   5.79     *
*............................................................................*
*Br   11 :fTracks.fSteps.fVolumeName : vector<TString> fVolumeName[fTracks_] *
*Entries :     1000 : Total  Size=     217773 bytes  File Size  =      17121 *
*Baskets :        7 : Basket Size=      32000 bytes  Compression=  12.68     *
*............................................................................*
*Br   12 :fTracks.fSteps.fVolumeNameTransportationFrom :                     *
*         | vector<TString> fVolumeNameTransportationFrom[fTracks_]          *
*Entries :     1000 : Total  Size=      70309 bytes  File Size  =      12090 *
*Baskets :        3 : Basket Size=      32000 bytes  Compression=   5.76     *
*............................................................................*
*Br   13 :fTracks.fSteps.fProcessName :                                      *
*         | vector<TString> fProcessName[fTracks_]                           *
*Entries :     1000 : Total  Size=     140066 bytes  File Size  =      17974 *
*Baskets :        5 : Basket Size=      32000 bytes  Compression=   7.76     *
*............................................................................*
*Br   14 :fTracks.fSteps.fProcessType :                                      *
*         | vector<TString> fProcessType[fTracks_]                           *
*Entries :     1000 : Total  Size=      70190 bytes  File Size  =      12025 *
*Baskets :        3 : Basket Size=      32000 bytes  Compression=   5.78     *
*............................................................................*
*Br   15 :fTracks.fSteps.fProcessSubType :                                   *
*         | vector<TString> fProcessSubType[fTracks_]                        *
*Entries :     1000 : Total  Size=      70211 bytes  File Size  =      12041 *
*Baskets :        3 : Basket Size=      32000 bytes  Compression=   5.78     *
*............................................................................*
root [2]

As you can see the file contains some TString to store information for things such as process names, volume name etc. (instead of using an integer ID since ROOT will compress the file I think this is a good decision, but please comment on this if you can).

I am having some problems with the TString though. The file seems to be OK but I cannot find a consistent way to visualize the contents of the file using the Tree Viewer (EventTree->StartViewer()) or the TBrowser. Maybe its not worth it to work with strings in ROOT but most likely I am doing something wrong.

If I open the file with ROOT 6.22/08 compiled with C++11

I can see the string values, but the number of entries is not correct. It shows 10867 which should be 15758. 10867 corresponds to the first entry of fTracks.fSteps.fVolumeName, which is a std::vector. If you plot any other member such as SizeOf you get the correct value:

Ploting the same via the tree viewer I get the same incorrect result:

Also, if I do all this via my other ROOT installation compiled with C++17 (version 6.24/02) I get the same result for the tree viewer, but I cannot display the strings in the TBrowser, I get the following:

This is most probably due to the commit 56cfece84, fixing the issue ROOT-9260. One should not rely on browsing (or drawing) class methods

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