Re: Problem to read TFile

From: Valery Fine (fine@bnl.gov)
Date: Mon Mar 13 2000 - 01:37:40 MET


----- 


  Can you try to add

the statement: 

 gSystem->Load("Root_Tree");
 and see whether it helps.
If you want to disinguish whether you are running very Windows platform
you can use
    gSystem->GetName()
and check it you may try:

root [0] gSystem->GetName()
(Text_t* 0xa460b4)"WinNT"
root [1]

 The best way is to load "root_tree.dll from within your custom
"rootlogon.C" macro
 (see %ROOTSYS%\tutorials\rootlogon.C )

  Valery


> TFile *F = new TFile("buf.root","recreate");
> 
> TTree *T = new TTree("T","List of arrays");
> 
> TBranch *B = T->Branch("B",&buf,"s_buf[8192]/s");
> 
> for(i = 0; i < 100; ++i)
> {
> buf.s_buf[0] = i;
> buf.s_buf[i] = i;
> T->Fill();
> }
> T->Write();
> F->Close();
> }
> file://=== testr.cpp
> #include <TROOT.h>
> #include <TFile.h>
> #include <TTree.h>
> #include <stdio.h>
> #include <stdlib.h>
> 
> void main()
> {
> TROOT test("test","test to read file");
> int i,n;
> struct 
> {
> unsigned short s_buf[8192];
> } buf;
> 
> TFile *F = new TFile("buf.root","read");
> 
> TTree *T = (TTree*)F->Get("T");
> 
> if(T == 0)
> {
> printf("ERROR TO OPEN TREE \n");
> exit(-1);
> }
> 
> T->SetBranchAddress("B",&buf);
> 
> n = T->GetEntries();
> 
> printf("%i \n",n);
> 
> F->Close();
> }
> 
> 
> 
> -- 
> 
> 
> 
> *******************************************************
> * Andrei V. Daniel
> * Department of Physics & Astronomy, P.O. Box 1807-B 
> * Vanderbilt University             Tel: (615) 322 2646
> * Nashville, TN 37235, USA          Fax: (615) 343 7263
> *******************************************************
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:21 MET