hi there,
I have upgraded my code to the latest 6.34/04
ROOT version.
All my tests are passing, except for one: scanning a TTree with 2D arrays of various (builtin) types.
More specifically, with 6.32/xx
, the ROOT file available here, would display:
$> root ./arrays-2d.root
[root] auto t = (TTree*)_file0->Get("mytree");
[root] t->Scan("ArrI8:ArrU8:ArrF32")
***********************************************************
* Row * Instance * ArrI8 * ArrU8 * ArrF32 *
***********************************************************
* 0 * 0 * abcde * 0 * 0 *
* 0 * 1 * abcde * 1 * 1 *
* 0 * 2 * abcde * 2 * 2 *
* 0 * 3 * abcde * 3 * 3 *
* 0 * 4 * abcde * 4 * 4 *
* 0 * 5 * abcde * 5 * 5 *
* 1 * 0 * bcdef * 1 * 1 *
* 1 * 1 * bcdef * 2 * 2 *
* 1 * 2 * bcdef * 3 * 3 *
* 1 * 3 * bcdef * 4 * 4 *
* 1 * 4 * bcdef * 5 * 5 *
* 1 * 5 * bcdef * 6 * 6 *
* 2 * 0 * cdefg * 2 * 2 *
* 2 * 1 * cdefg * 3 * 3 *
* 2 * 2 * cdefg * 4 * 4 *
* 2 * 3 * cdefg * 5 * 5 *
* 2 * 4 * cdefg * 6 * 6 *
* 2 * 5 * cdefg * 7 * 7 *
* 3 * 0 * defgh * 3 * 3 *
* 3 * 1 * defgh * 4 * 4 *
* 3 * 2 * defgh * 5 * 5 *
* 3 * 3 * defgh * 6 * 6 *
* 3 * 4 * defgh * 7 * 7 *
* 3 * 5 * defgh * 8 * 8 *
* 4 * 0 * efghi * 4 * 4 *
Type <CR> to continue or q to quit ==> q
***********************************************************
while with 6.34/04
, I now get:
$> root ./arrays-2d.root
[root] auto t = (TTree*)_file0->Get("mytree");
[root] t->Scan("ArrI8:ArrU8:ArrF32")
***********************************************************
* Row * Instance * ArrI8 * ArrU8 * ArrF32 *
***********************************************************
* 0 * 0 * abcde * 0 * 0 *
* 0 * 1 * abcde * 1 * 1 *
* 0 * 2 * * 2 * 2 *
* 0 * 3 * * 3 * 3 *
* 0 * 4 * * 4 * 4 *
* 0 * 5 * * 5 * 5 *
* 1 * 0 * bcdef * 1 * 1 *
* 1 * 1 * bcdef * 2 * 2 *
* 1 * 2 * * 3 * 3 *
* 1 * 3 * * 4 * 4 *
* 1 * 4 * * 5 * 5 *
* 1 * 5 * * 6 * 6 *
* 2 * 0 * cdefg * 2 * 2 *
* 2 * 1 * cdefg * 3 * 3 *
* 2 * 2 * * 4 * 4 *
* 2 * 3 * * 5 * 5 *
* 2 * 4 * * 6 * 6 *
* 2 * 5 * * 7 * 7 *
* 3 * 0 * defgh * 3 * 3 *
* 3 * 1 * defgh * 4 * 4 *
* 3 * 2 * * 5 * 5 *
* 3 * 3 * * 6 * 6 *
* 3 * 4 * * 7 * 7 *
* 3 * 5 * * 8 * 8 *
* 4 * 0 * efghi * 4 * 4 *
Type <CR> to continue or q to quit ==> q
***********************************************************
of course, none of the 2 outputs are actually a correct representation of the underlying data which should be actually:
$> root ./arrays-2d.root
Attaching file ./arrays-2d.root as _file0...
(TFile *) 0x62e6b1633d40
root [1] auto t = (TTree*)_file0->Get("mytree");
root [2] int8_t arr[6];
root [3] t->SetBranchAddress("ArrI8", &arr);
root [4] t->GetEntries()
(long long) 5
root [5] t->GetEntry(0); arr
(int8_t[6]) { 'a', 'b', 'c', 'd', 'e', '0x00' }
root [6] t->GetEntry(1); arr
(int8_t[6]) { 'b', 'c', 'd', 'e', 'f', '0x00' }
ie:
t->Scan("ArrI8:ArrU8:ArrF32")
***********************************************************
* Row * Instance * ArrI8 * ArrU8 * ArrF32 *
***********************************************************
* 0 * 0 * a * 0 * 0 *
* 0 * 1 * b * 1 * 1 *
* 0 * 2 * c * 2 * 2 *
* 0 * 3 * d * 3 * 3 *
* 0 * 4 * e * 4 * 4 *
* 0 * 5 * '\0' * 5 * 5 *
* 1 * 0 * b * 1 * 1 *
* 1 * 1 * c * 2 * 2 *
* 1 * 2 * d * 3 * 3 *
* 1 * 3 * e * 4 * 4 *
* 1 * 4 * f * 5 * 5 *
* 1 * 5 * '\0' * 6 * 6 *
* 2 * 0 * c * 2 * 2 *
* 2 * 1 * d * 3 * 3 *
* 2 * 2 * e * 4 * 4 *
* 2 * 3 * f * 5 * 5 *
* 2 * 4 * g * 6 * 6 *
* 2 * 5 * '\0' * 7 * 7 *
* 3 * 0 * d * 3 * 3 *
* 3 * 1 * e * 4 * 4 *
* 3 * 2 * f * 5 * 5 *
* 3 * 3 * g * 6 * 6 *
* 3 * 4 * h * 7 * 7 *
* 3 * 5 * '\0' * 8 * 8 *
* 4 * 0 * e * 4 * 4 *
Type <CR> to continue or q to quit ==> q
***********************************************************
Could this be fixed?
(as the underlying data is correctly interpreted by ROOT/C++
via a handwritten for-loop, I suppose the issue lies under TTree::Scan
)
if not, could we have at least a stable output of TTree::Scan
across versions ?
thanks a lot.
Please read tips for efficient and successful posting and posting code
Please fill also the fields below. Note that root -b -q
will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug
from the ROOT prompt to pre-populate a topic.
ROOT Version: 6.34.04
Platform: linuxx8664gcc
Compiler: c++ (GCC) 14.2.1 20250207