Re: Putting objects in a root file [newbie]

From: Roland Kuhn <rkuhn_at_e18.physik.tu-muenchen.de>
Date: Wed, 28 Sep 2005 10:05:34 +0200


Hi Roger!

On 27 Sep 2005, at 17:03, Roger Mason wrote:

[snip]
>
> const Int_t nlines = 1850;
> Float_t wn[nlines],shift[nlines],signal[nlines];
> TNtuple *ntuple = new TNtuple("ntuple","data from ascii
> file","wn:shift:signal");
>

[snip]
>
> TFile f("MySpectrum.root","RECREATE");
>
> f->Write();
> f.Close();
> }
>

Instead of writing everything which was created when TFile*f was the current directory (as has been pointed out by Sue Kasahara) you can also use ntuple->Write() after opening the output file. Writing individual objects gives you more control over what is written.

Ciao,

                     Roland

--
TU Muenchen, Physik-Department E18, James-Franck-Str. 85747 Garching
Telefon 089/289-12592; Telefax 089/289-12570
--
A mouse is a device used to point at
the xterm you want to type in.
Kim Alm on a.s.r.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GS/CS/M/MU d-(++) s:+ a-> C+++ UL++++ P-(+) L+++ E(+) W+ !N K- w--- M 
+ !V Y+
PGP++ t+(++) 5 R+ tv-- b+ DI++ e+++>++++ h---- y+++
------END GEEK CODE BLOCK------



Received on Wed Sep 28 2005 - 10:05:40 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:12 MET