Hi,
I have a TTree with a branch named “time” which gives the time of an event in seconds. The type is double.
Now I would like to sort events by “time” using the TTreeIndex class. Here is what I did:
[code] // build index
eventtree->BuildIndex(“time*1000000”);
TTreeIndex index = (TTreeIndex)eventtree->GetTreeIndex();
Long64_t N = index->GetN();
// loop over events
for(int t=0; t<N; t++){
eventtree->GetEntry(index->GetIndex()[t]);
cout<<time<<endl;
}[/code]
As you can see I used the expression “time*1000000” to sort events at the level of the micro-second. However, this does not work. Events are not correctly sorted. What’s wrong with that? What should I do instead?
Thank you.