Hallo everyone,
I have a TTree with double and float branches. And it is necessary in my program to jump on the tree and read the entry values. I noticed that the computing time with GetEntry(int) is dependent on the distance that I jumped. Is it true, or I messed up with my tree.
To explain my question more clearly, here is a example.
TTree* tr = [i]file[/i].Get("[i]channel000[/i]");
double time;
float value;
tr->SetBranchAddress("time",&time);
tr->SetBranchAddress("value",&value);
for (int k =0; k<1000;i++)
{
tr->GetEntry(k*1000);
}
The code above need more time than the following:
TTree* tr = [i]file[/i].Get("[i]channel000[/i]");
double time;
float value;
tr->SetBranchAddress("time",&time);
tr->SetBranchAddress("value",&value);
for (int k =0; k<1000;i++)
{
tr->GetEntry(k*10);
}
The question is: is the observation true?
And for more information, I post the output of TTree::Print() here too.
[code]root [52] tr->Print()
*Tree :chan000 : Data *
*Entries : 32859024 : Total = 395588267 bytes File Size = 211012486 *
-
: : Tree compression factor = 1.87 *
*Br 0 :time : time/D *
*Entries : 32859024 : Total Size= 263711748 bytes File Size = 170853170 *
*Baskets : 8235 : Basket Size= 32000 bytes Compression= 1.54 *
…
*Br 1 :value : value/F *
*Entries : 32859024 : Total Size= 131876209 bytes File Size = 40012817 *
*Baskets : 4117 : Basket Size= 32000 bytes Compression= 3.29 *
…
[/code]
This became really a problem of mine. For some reason I have to jump on the tree collecting values. And then return to the beginning position. And repeat the jumping collecting route for hundred times. This tree is only a test tree. The actual one will be much larger the this one. And now this procedure is already time consuming. I am afraid the program is really going to have performance problem afterwards. It would be really nice if someone could help me.
Thanks!
Simon