I cannot reproduce your problem with any version of ROOT (I tried
5.22,5.25 and 5.26).
The result of your 2 commands = tree.Print gives
root [0] TTree* Tree = new TTree( "Test", "Test" ); root [1] Long64_t RetVal = Tree->ReadFile( "Array1.txt" ); root [2] Tree.Print() ****************************************************************************** *Tree :Test : Test * *Entries : 3 : Total = 1621 bytes File Size = 0 * * : : Tree compression factor = 1.00 * ****************************************************************************** *Br 0 :Len : Len/I * *Entries : 3 : Total Size= 634 bytes One basket in memory * *Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 * *............................................................................* *Br 1 :Array[2] : Array[2]/D * *Entries : 3 : Total Size= 705 bytes One basket in memory * *Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 * *............................................................................*
and if you do, eg
root [3] Tree.Show(0)
======> EVENT:0
Len = 2 Array = 1.1, 2.1
Rene Brun
Thomas Lauf wrote:
> Hello,
>
> if I apply this little script
>
> {
> TTree* Tree = new TTree( "Test", "Test" );
> Long64_t RetVal = Tree->ReadFile( "Array1.txt" );
> gROOT->ProcessLine("Tree->Print(\"toponly\"); > Array3.dat");
> }
>
> on the file Array1.txt which looks like this
>
> Len/I:Array[2]/D
> 2 1.1 2.1
> 2 3.1 4.1
> 2 5.1 6.1
>
> I would expect the resulting tree to have 2 branches named 'Len' and
> 'Array' of which the second one is an array of doubles with length 2
> and the file Array3.dat should look like this:
>
> ************************************************************************
> *Tree :Test : Test *
> *Entries : 3 : Total = 1601 bytes File Size = 0 *
> * : : Tree compression factor = 1.00 *
> ************************************************************************
> branch: Len 0
> branch: Array 0
>
> The script passes with no errors but the branch containing the array
> does not have the expected name, it is named 'Array[2]' as one can see
> in the real output:
>
> ************************************************************************
> *Tree :Test : Test *
> *Entries : 3 : Total = 1601 bytes File Size = 0 *
> * : : Tree compression factor = 1.00 *
> ************************************************************************
> branch: Len 0
> branch: Array[2] 0
>
> What went wrong? How can I get ROOT to name the branch 'Array'?
> My research in the documentation so far was futile...
>
> I am using ROOT 5.20/00 on linux. I have tested this example also under
> ROOT 5.25/02, but it failed there too.
>
> Thanks for any advice
>
> Thomas
>
Received on Tue Jan 12 2010 - 12:43:36 CET
This archive was generated by hypermail 2.2.0 : Tue Jan 12 2010 - 17:50:01 CET