Problems to read Double_t arrays in TTree (object of class TMeas read too few bytes)

Hi

I have saved a tree in disk. The contents that I am dumping are consistent. However, when opening it, I get:

root [1] TTree *tree=(TTree*) _file0->Get("edge") ;
Error in <TClass::Load>: dictionary of class TMeasHeader not found
root [2] tree->Draw("volt")
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
Warning in <TLeafObject::ReadBasket>: TMeas::Streamer not available, using TClass::ReadBuffer instead
Error in <TBufferFile::CheckByteCount>: object of class TMeas read too few bytes: 127 instead of 508

The first line I understand it and I know how to fix it, by loading the “TMeasHeader_cpp.so”. The error in the second line I can’t figure it out yet. I can always query the tree and get the value of any scalars, but it segments if I try to display the arrays.

I searched for the streamer in the Dictionary, and it is there:

void TMeas::Streamer(TBuffer &R__b)
{
   // Stream an object of class TMeas.
...
      R__b.WriteFastArray(volt,Nt);
      R__b.WriteFastArray(time,Nt);
      R__b.WriteFastArray(Qt,Nt);
      R__b.SetByteCount(R__c, kTRUE);
 

The arrays have been defined in a header file with the syntax:

     Int_t      Nt       ;        //Number of bins in scope                 
     Double_t   *volt    ;        //[Nt]
     Double_t   *time    ;        //[Nt]

I attach the root file and the stack trace output from root session.
We use Ubuntu 14.04, root 6.06.06, gcc 4.8

Thank you very much for any help!

P.S. I checked some other messages in the forum:

  1. We have TApplication included like:
TApplication theApp("DoTRACSFit", 0, 0);
  1. We linked against:
-lCore -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -pthread -lm -ldl -rdynamic -lTreePlayer -lTreeViewer -lHistPainter -lQtCore -lTable -lFFTW -lFITSIO -lGX11TTF -lPyROOT -lMinuit2 -lMathMore -lCling -lRooFit -lRooFitCore -lMatrix -lTMeasHeader -lTMeas -lTWaveform

output.root (8.38 KB)
ERROR.txt (3.98 KB)

The second error should also disappear when you load the library.

[quote]I can always query the tree and get the value of any scalars, but it segments if I try to display the arrays.
I searched for the streamer in the Dictionary, and it is there:[/quote]From the snippet of Streamer, the streamer-based I/O was (likely inadvertently) requested; one of the consequence is that the library is required to read the data (in that class).

To Solve the problem you will need to rewrite the file after updating your LinkDef file to read:

#pragma link C++ class TMeas+;where the trailing plus sign is the important part (to request the StreamerInfo based I/O).

Cheers,
Philippe.

Awesome !!! Thank you very much. Solved!