Hi,
check that your TVector fills at least two baskets in the tree!
/Anton
Inkyu.Park@cern.ch wrote:
> Hi Anton,
>
> I quickly tested your macro with a change of your class TTrade to TVector.
> And it works just fine! See what I did.
>
> I can test with more complex class if you wish.
>
> Cheers,
> Inkyu
>
> Write.C
> {
> gROOT->Reset();
>
> TFile *File = new TFile("anton.root","RECREATE");
>
> TVector *Vector = new TVector();
> TTree *Tree = new TTree("VectorTree", "");
> VectorTree ->Branch("Vector", "TVector", &Vector, 4*1024, 1);
> VectorTree ->Write();
>
> for(Int_t i=0;i<20000;i++) {
> Int_t N = VectorTree->GetEntries();
> if (N) {
> VectorTree->GetEntry(0);
> VectorTree->GetEntry(N-1);
> }
> //Vector->Set(i,i,i,i);
> VectorTree->Fill();
> }
> Tree->AutoSave();
> delete Tree;
> delete File;
> }
>
> Read.C
> {
> gROOT->Reset();
>
> TFile *File = new TFile("anton.root", "UPDATE");
>
> TVector *Vector = new TVector();
> TTree *Tree = (TTree*)File.Get("VectorTree");
> Tree->SetBranchAddress("Vector", &Vector);
> Tree->Print();
>
> Int_t N = Tree->GetEntries();
> for(Int_t i=0;i<N;i++) {
> Tree->GetEntry(i);
> Vector->Print();
> }
> //Vector->Set(0,0,0,0);
> printf("Printing second time ... \n");
>
> for(Int_t i=0;i<10;i++) {
> Tree->GetEntry(i);
> Vector->Print();
> }
> }
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:43 MET