Anton,
This result is correct. GetEntry returns the number of bytes read from the
file. In case you read the same entry again, Root does not have to do any
I/O unless the branch addresses have changed. In this case GetEntry
returns 1 (I cannot return 0 because many people uses 0 to assume that
an error has occured during reading).
Rene Brun
On Mon, 5 Mar 2001, Anton Fokin wrote:
> Hi Rene,
>
> I've got the following strange result. The piece of code is (I simply read
> the same entry three times)
>
> ---
>
> Index = 4;
>
> Int_t NBytes = fTradeIndexTree->GetEntry(Index);
>
> printf("NBytes = %d\n", NBytes);
>
> NBytes = fTradeIndexTree->GetEntry(Index);
>
> printf("NBytes = %d\n", NBytes);
>
> NBytes = fTradeIndexTree->GetEntry(Index);
>
> printf("NBytes = %d\n", NBytes);
>
> ---
>
> the output:
>
> NBytes = 4
> NBytes = 1
> NBytes = 1
>
> I also see that I fill my fTradeIndex in the first read only.
>
> If I insert
>
> fTradeIndexTree->SetBranchAddress("TradeIndex", &fTradeIndex);
>
> before every GetEntry(), I get right result.
>
> fTradeIndexTree is simple:
>
> UInt_t TradeIndex = 0;
> TradeIndexTree->Branch("TradeIndex", &TradeIndex, "TradeIndex/i", 16*1024);
>
>
> Any ideas how it can happen in principle? Any hints to trace the problem
> down?
>
> Root3.05 on win98
>
> Regards,
> Anton
>
> http://www.smartquant.com
>
>
>
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:38 MET