Re: Saving histos in different TFiles

From: Olivier Couet <couet_at_mail.cern.ch>
Date: Fri, 11 Mar 2005 15:15:44 +0100 (CET)

Something like that:

{
  TFile *f1 = new TFile("f1.root","CREATE","f1");   TFile *f2 = new TFile("f2.root","CREATE","f2");

  TH1F *h1 = new TH1F("h1","h1",100,-1,1);   TH1F *h2 = new TH1F("h2","h2",100,-1,1);

  f1->cd();
  h1->Write();
  f2->cd();
  h2->Write();

}

Olivier

On Fri, 11 Mar 2005, Julien Bolmont wrote:

>
> Hi rooters,
>
> I'd like to save two histograms in two different root files so I open the two
> files :
>
> TFile *f1 = new ....
> TFile *f2 = new ....
>
> and I declare the two histograms :
>
> TH1 *h1 = new...
> // I fill h1 here
> TH1 *h2 = new...
> // I fill h2 here
>
>
> My question is :
> How to tell root to write h1 in f1 and h2 in f2 ?
>
> Thanks !
>
>
>
> ------------------------------------------------------------------------
> ----------
> Julien Bolmont
> Ingeneer - PhD Student
> AMS Collaboration
> LPTA - Laboratoire de Physique Théorique et Astroparticules
>
>

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910      
E-Mail: Olivier.Couet_at_cern.ch                            Phone:   +41 22 7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22 7670300
Received on Fri Mar 11 2005 - 15:15:48 MET

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