Re: [ROOT] Header in ascii file

From: Nicolas Produit (Nicolas.Produit@obs.unige.ch)
Date: Mon Oct 20 2003 - 09:02:20 MEST


Christian Holm Christensen wrote:
     
>  TTree* read(const string& filename, size_t skip=6) 
>  {
....
>     person p;
>     tree = new TTree("T", filename.c_str());
>     tree->Branch("staff",&p.category,
>                  "Category/I:Flag:Age:Service:Children:"
>                  "Grade:Step:Hrweek:Cost");

Hi,

your example will not work. You fall in the same trap I described in a mail to this
group.
When TTree* read(const string& filename, size_t skip=6) 
exits the variable 'person' don't exist anymore. As soon as you do anything
with the tree (like Scan or Draw) you will suffer random core dumps.
You have to have 'person' static or a global variable.

I still think that this scheme is wrong and that every method should
reestablish his local Branch variable and not assume it still exists.
Or at least this should be very clearly stated in the documentation.

See you


-- 
Nicolas Produit                 
INTEGRAL Science Data Center    Phone:  +41 22 950 91 40
16, Chemin d'Ecogia             Fax:    +41 22 950 91 33
CH-1290 Versoix                 www:    http://isdc.unige.ch/



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