Hi Rooters,
Who can explain what may be wrong when I move a simple
code from Alpha (digital unix) on PC (Windows NT4+SP4;
VC++6+SP3). The real code is large and it is not
interesting. I included here a small test, which
gives the same error. A week ago I asked the similar
question consernig interpreter and the code worked
but on practice it was necessary to translate the code.
On Alpha computer it writes and reads the TTree without
questions. On PC it writes the TTree, which can be read
on Alpha. But it can not read the same file on PC. I got
the next ERROR
TFile** buf.root
TFile* buf.root
KEY: TTree T;1 List of arrays
Error in <TKey::ReadObj>:Unknown class TTree
The first 3 lines comes from the F->ls();
the last comes from the TTree *T = (TTree*)F->Get("T")
In my case it is necessary to write file on Alpha and
to read it on PC. It is possible but it's not very suitable
to write and to read file on PC.
The codes are here.
Thanks in advance.
Andrei
//=== testw.cpp
#include <TROOT.h>
#include <TFile.h>
#include <TTree.h>
void main()
{
TROOT test("test","test of file");
int i;
struct
{
unsigned short s_buf[8192];
} buf;
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();
}
//=== 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