Write and read of double-arrays in TTrees

Dear all, dear Wim,

After your help on the RootTalk mailinglist ( root.cern.ch/root/roottalk/roottalk08/0976.html ) I was able to read the double-array from an already existing tree.

Now I want to create such a tree myself and read it afterwards.
I attach here the two “demo”-scripts I created for that.
As you can see, the output of the double-array is different for the two scripts.

Where is my mistake?

Cheers,
Dennis
testtree-write.py (501 Bytes)
testtree-read.py (635 Bytes)

Dennis,

sorry for the late reply, but I had to install numpy first. For me, your code simply works as it should …

Which versions of root/python/numpy are you running?

Cheers,
Wim

Dear Wim,

that is strange. Do you get the same output on the console for both scripts?
Here’s what I get:

For the testtree-write.py

[dpetsch@tcx040]~/scratch/Orsay_analysis.V1.0% python testtree-write.py
1                                                                      
[[1 1]                                                                 
 [1 1]]                                                                
2                                                                      
[[1 1]                                                                 
 [1 1]]                                                                
3                                                                      
[[1 1]                                                                 
 [1 1]]                                                                
4                                                                      
[[1 1]                                                                 
 [1 1]]                                                                
5                                                                      
[[1 1]                                                                 
 [1 1]]
6
[[1 1]
 [1 1]]
7
[[1 1]
 [1 1]]
8
[[1 1]
 [1 1]]
9
[[1 1]
 [1 1]]
10
[[1 1]
 [1 1]]

And for the testtree-read.py

[dpetsch@tcx040]~/scratch/Orsay_analysis.V1.0% python testtree-read.py
1
[[1 1]
 [0 0]]
2
[[1 1]
 [0 0]]
3
[[1 1]
 [0 0]]
4
[[1 1]
 [0 0]]
5
[[1 1]
 [0 0]]
6
[[1 1]
 [0 0]]
7
[[1 1]
 [0 0]]
8
[[1 1]
 [0 0]]
9
[[1 1]
 [0 0]]
10
[[1 1]
 [0 0]]

Shouldn’t this be the same output?

Here are the software versions I use:

Python 2.3.4
ROOT 5.20.00
numpy 1.0.4

Cheers,
Dennis

Dennis,

they should … and for me they are. At issue is likely that I’m running python 2.6.1, ROOT SVN HEAD, and numpy 1.2.1. I’m not sure which of the three the culprit is and it will take a little time to find out.

Later,
Wim

Dear Wim,

thanks for your support. I now use
ROOT 5.20.00
Python 2.5.2
numpy 1.1.1

and it works!

Thanks again,
Dennis