[ROOT] Writing histograms in subdirectories

From: Gernot Maier (maier@ik.fzk.de)
Date: Thu Aug 15 2002 - 08:54:42 MEST


Hi rooters,

I have problems in reading histograms from a subdirectory of a file.

Execute for example the following test macro:

void test()
{
   TFile *fT = new TFile( "test.root" , "RECREATE" );
   fT->mkdir( "AD" );
   fT->cd( "AD" );
   TH1D **his;
   his = new TH1D*[20];
   char hisname[100];
   for( int i = 0; i < 20; i++ )
   {
      sprintf( hisname, "his_%d", i );
      his[i] = new TH1D( hisname, hisname, 100., -10., 10. );
      for( int j = 0; j < 100; j++ ) his[i]->Fill( gRandom->Gaus() );
   }
   for( int i = 0; i < 20; i++ )
   {
      his[i]->Write();
   }
}

If I open the test.root and change the directory with file->cd("AD") I get
to following error messages:

Error in <TObjArray::At>: index -20454 out of bounds (size: 13, this: 0x0882d690)
Error in <TObjArray::AddAt>: out of bounds at -20454 in 882d690
Error in <TBuffer::CheckByteCount>: object of class TUUID read too few bytes: 18 instead of 195839724
Warning in <TBuffer::CheckByteCount>: TUUID::Streamer() not in sync with data on file, fix Streamer()

I obtain similar error messages while switching to a subdirectory in a root file,
which was converted by h2root and has about 1000 histograms in that subdirectory.

I'm using version 3.03/07 on linux and version 3.03/07 on alpha.

thank you,

Gernot

-----
Gernot Maier                    KASCADE Collaboration
Institut fuer Kernphysik        Tel. +49 (0) 7247 82-4174
Forschungszentrum Karlsruhe     gernot.maier@ik.fzk.de



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:04 MET