Re: [ROOT] filling a file.

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jan 23 2001 - 15:02:15 MET


Hi Alexander,

The list of objects in any ROOT container *xxx (TList, TObjArray, etc) can be
written to a file with xxx->Write();

In case of histograms created directly in RINT, you can do the following, eg:

root
Root > TH1F *h1=new TH1F("h1","h1 test",100,-3,3);
Root > TH1F *h2=new TH1F("h2","h2 test",100,-3,3);
Root > TH1F *h3=new TH1F("h3","h3 test",100,-3,3);
Root > TFile f("junk.root","recreate");
Root > gROOT.GetList()->Write();
Root > f.ls(); // will show the following
TFile**         junk.root
 TFile*         junk.root
  KEY: TH1F     h1;1    h1 test
  KEY: TH1F     h2;1    h2 test
  KEY: TH1F     h3;1    h3 test


Rene Brun


Alexander Cherlin wrote:
> 
>         Dear rooters,
> I have the following question. I create and fill some histograms in usual
> root directory, Rint. Later, I want to create a file and to save there all
> those histograms.
> 
> Thanks everybody for the help in advance,
> Alexander.
> 
> ************************************************************************
> *   Alexander Cherlin                    |    Home:                    *
> *   Department of Particle Physics       |    Pinsker str., 50/15      *
> *   Weizmann Institute of Science        |    Rishon le-Zion 75910     *
> *   Rehovot 76100 ISRAEL                 |    ISRAEL                   *
> *   PHONE : 972 8 9343372                |    PHONE: 972 3 9560344     *
> *   FAX   : 972 8 9466253                |    CELLULAR                 *
> *                                        |    PHONE: 972 54 629228     *
> *                                        |    FAX: 972 15154 629228    *
> *----------------------------------------------------------------------*
> *   E-mail: cherlin@wicc.weizmann.ac.il                                *
> *           Alexander.Cherlin@cern.ch                                  *
> *   URL   : http://www.weizmann.ac.il/home/cherlin                     *
> ************************************************************************



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:34 MET