Re: [ROOT] writing trees

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Jan 10 2003 - 13:22:11 MET


Hi Daniel,

I had a quick look to your code.
You have an error in your Book function. You are redeclaring members f and
t1.
Replace the lines
   TFile *f=new TFile("OSCAR.root","recreate");
   TTree *t1=new TTree("t1","M0' OSCAR Reconstruction");
by
   f=new TFile("OSCAR.root","recreate");
   t1=new TTree("t1","M0' OSCAR Reconstruction");

Rene Brun

On Thu, 9 Jan 2003, Daniel Holmes wrote:

> Hi,
> 
> I have followed Rene's advice and am trying to write out a root tree from
> within some c++ code.. The class i have written can be found under:
> 
> /afs/cern.ch/user/d/dholmes/public/rootTree.cc 
> /afs/cern.ch/user/d/dholmes/public/rootTree.h
> 
> I run my methods in the order:
> costructor..opens the tree (successful)
> BeamParamsFill ..ok??!
> EvtFill ..crashes..
> 
> The problem comes at line 28 of the .cc file, in short i don't seem to be
> able to message the tree ptr t1 that i set up and tested in a previous
> method??  I don't know if my mistake is root or c++ based so apologies if
> its the latter..  Any thoughts/advice is much appreciated.
> 
> cheers,
> 
> Dan.
> 
> 
> 
> CMS-Bristol
> http://cern.ch/dan.holmes
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:08 MET