Re: [ROOT] Another Problem in tree->BuildIndex()

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Sep 06 2000 - 19:21:32 MEST


Hi HP,
Thanks for reporting this interesting case. Now fixed in the development
version.
The problem was due to the fact that your first entry had the majorname
and minorname both equal to 0.

Rene Brun

HP Wei wrote:
> 
> Rooters:
>   In this post, I describe a possible bug involved in BuildIndex
>   (or GetEntryWithIndex() ).
> 
>   I have a TFile with a tree:
> 
>   root [48] T->Print()
> 
> ******************************************************************************
> *Tree    :T         : ntic ndate close shsOstd                               *
> *Entries :  1002600 : Total =        24070746 bytes  File  Size =    2654646 *
> *        :          : Tree compression factor =   9.09                       *
> ******************************************************************************
> *Branch  :ntic      : ntic/I                                                 *
> *Entries :  1002600 : Total  Size=    3999500 bytes  File Size  =      32834 *
> *Baskets :      125 : Basket Size=      32000 bytes  Compression= 121.81     *
> *............................................................................*
> *Branch  :ndate     : ndate/I                                                *
> *Entries :  1002600 : Total  Size=    3999625 bytes  File Size  =      59317 *
> *Baskets :      125 : Basket Size=      32000 bytes  Compression=  67.43     *
> *............................................................................*
> *Branch  :close     : close/D                                                *
> *Entries :  1002600 : Total  Size=    8031247 bytes  File Size  =    1628450 *
> *Baskets :      251 : Basket Size=      32000 bytes  Compression=   4.93     *
> *............................................................................*
> *Branch  :shsOstd   : shsOstd/D                                              *
> *Entries :  1002600 : Total  Size=    8031749 bytes  File Size  =     925420 *
> *Baskets :      251 : Basket Size=      32000 bytes  Compression=   8.68     *
> *............................................................................*
> 
> Some of the entries look like this:
> 
> root [46] T.Scan("ntic:ndate:close", "ntic==8898 && ndate >100")
> ************************************************
> *    Row   *      ntic *     ndate *     close *
> ************************************************
> *   996101 *      8898 *       101 *    88.562 *
> *   996102 *      8898 *       102 *     76.75 *
> *   996103 *      8898 *       103 *    84.188 *
> *   996104 *      8898 *       104 *    87.344 *
> *   996105 *      8898 *       105 *        74 *
> *   996106 *      8898 *       106 *    86.125 *
> *   996107 *      8898 *       107 *    68.219 *
> *   996108 *      8898 *       108 *     73.75 *
> *   996109 *      8898 *       109 *     89.75 *
> *   996110 *      8898 *       110 *    89.531 *
> *   996111 *      8898 *       111 *   106.375 *
> *   996112 *      8898 *       112 *   216.344 *
> *   996113 *      8898 *       113 *   161.031 *
> *   996114 *      8898 *       114 *   159.688 *
> *   996115 *      8898 *       115 *   171.375 *
> *   996116 *      8898 *       116 *    130.25 *
> *   996117 *      8898 *       117 *   113.062 *
> *   996118 *      8898 *       118 *   123.875 *
> *   996119 *      8898 *       119 *   128.688 *
> ************************************************
> ==> 19 selected entries
> 
> Now, I build an index:
> 
> T.SetEstimate(1002600)
> T->BuildIndex("ntic", "ndate")
> 
> And let me extract the same series of ndate and close as shown above
> by using this index.
> 
> root [37] Double_t close;
> root [38] Double_t shsOstd;
> root [39] T->SetBranchAddress("close", &close);
> root [40] T->SetBranchAddress("shsOstd", &shsOstd);
> 
> root [47] { for(Int_t i=101; i<=119; ++i) {
> end with '}'> T->GetEntryWithIndex(8898, i);
> end with '}'> cout<<i<<" "<< close << endl;
> end with '}'> }
> end with '}'> }
> 
> 101 59.234
> 102 88.562
> 103 76.75
> 104 84.188
> 105 87.344
> 106 74
> 107 86.125
> 108 68.219
> 109 73.75
> 110 89.75
> 111 89.531
> 112 106.375
> 113 216.344
> 114 161.031
> 115 159.688
> 116 171.375
> 117 130.25
> 118 113.062
> 119 123.875
> 
> We see that the values for close has been shifted.
> Can you spot any thing wrong in my process??
> Or
> What went wrong in the extraction steps using the index
> built by BuildIndex() ????
> 
> HP



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:32 MET