Re: TFile::Get problem

From: Fons Rademakers <Fons.Rademakers_at_cern.ch>
Date: Fri, 03 Aug 2007 12:14:52 +0200


Hi,

   independent of a possible issue with the TH1 copy, is there a special reason you want to get an additional copy of the histograms?

Cheers, Fons.

杨苏立 wrote:
> When I use the following code:
> TFile f("somefile.root")
> TFile g("someotherfile.root")
> //open two different root file which contain different histograms with
> the same name
>
>
> TH1F h1=*(<dynamic_cast TH1F *>(f.Get("hisname")))
> TH1F h2=*(<dynamic_cast TH1F *>(g.Get("hisname")))
> //get two different histograms
>
> the I meet some problem:some data member of h2 has been overfilled with
> h1's data
>
> but if I do
> TH1F h2=*(<dynamic_cast TH1F *>(g.Get("hisname")))
> TH1F h1=*(<dynamic_cast TH1F *>(f.Get("hisname")))
> then it's OK
>
> who can tell me why?
>

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers_at_cern.ch              Phone: +41 22 7679248
WWW:    http://fons.rademakers.org           Fax:   +41 22 7669640
Received on Fri Aug 03 2007 - 12:15:05 CEST

This archive was generated by hypermail 2.2.0 : Fri Aug 03 2007 - 17:50:02 CEST