Reading Histogram from a Root File : Error in <TBufferFile::ReadClassBuffer> ; Error in <TBufferFile::CheckByteCount>

Hi rooters,
I’m simply trying to read a histogram of a root file:

   TFile *f = new TFile("/minerva/app/users/gianfred/cmtuser/Minerva_v21r1p1_NX/AnalysisFramework/External/GENIEXSecExtract/cmt/XSec_TEST_actual.root");
  if(f->IsOpen()) printf ("File opened succesfully\n");

   TH2D* u_2DxsecHist = (TH2D*)f->Get("iron_x_vs_Q2Exp_full_dis2D_xsec");
   u_2DxsecHist->Draw();

but it’s not displaying the histogram and I get these errors:

File opened succesfully
Error in <TBufferFile::ReadClassBuffer>: Could not find the StreamerInfo for version 4 of the class TH1, object skipped at offset 95
Error in <TBufferFile::CheckByteCount>: object of class TH1 read too few bytes: 2 instead of 26855

I’m using:
ROOT Version 5.34/36
Platform, compiler gcc version 4.9.3 (GCC)

Any will help will be appreciated.

Hi,

This is odd and usually indicates that the file is somehow corrupted (might not have been closed properly). The file would also be quite old since v5-08-00 is the first release with v5 of TH1 (So the file/data has been written with a ROOT released before 2005.

Cheers,
Philippe

Try:

rootls -l /minerva/app/users/gianfred/cmtuser/Minerva_v21r1p1_NX/AnalysisFramework/External/GENIEXSecExtract/cmt/XSec_TEST_actual.root | grep iron_x_vs_Q2Exp_full_dis2D_xsec

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.