Error in <TFile::ReadBuffer>:

Dear all,
when I run my code, I obtain the following error:

Error in TFile::ReadBuffer: error reading all requested bytes from file /home/irfulx157/mnt/fbelloni/workspace/XYMG/ROUTINES/run13520_0_s2.raw.finished, got 0 of 16

 I checked the link [root.cern.ch/root/roottalk/roottalk03/1792.html](http://root.cern.ch/root/roottalk/roottalk03/1792.html),

but

  1. the error occurs just when I analyze some runs.
  2. as to me, it looks to create first the root file and then the TTree.

The part of code in discussion is the subroutine in attachment.
Could anyone help me, please?

Thanks,
Francesca
Test.C (538 Bytes)

Dear all,
the mistake was in another subroutine :blush: and dealt with the TBuffer and TFile.

Thanks,
regards,
Francesca

Hi,

As a side note:[code]void trial(TTree*t, Int_t nsegm){
data_tree_new data;
t->SetBranchAddress(“segment”,&data.segment);
t->SetBranchAddress(“X_amp”,data.X_amp);

//for(int i=0;i<XYSTRIPS)

}[/code]When setting the branch addresses to the address of stack variable, you must call t->ResetBranchAddresses() at the end of the routine, otherwise the TTree will continue to use those (now ‘illegal’) addresses after the end of the function.

Cheers,
Philippe.

Thanks a lot!

Regards,
Francesca