Well,it seems to me that it is an issue with the copy constructor function, too.Maybe it has called some static object?
As for the "special reason", I do not quite get your meaning.
If you referred that I use an object h1 instead of a pointer that directly get the return value of TFile::Get, well, there's no special reason. I just did it....
But I had to do Get before I can use the hisgram, as it is not visible even if I do an TFile::cd(). To be honest, I am quite confused with the scope concept in ROOT and Cint.......
- 原邮件 -----
从: Fons Rademakers <Fons.Rademakers_at_cern.ch>
日期: 星期五, 八月 3日, 2007 下午6:14
主题: Re: [ROOT] TFile::Get problem
> 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 - 13:23:52 CEST