Re: [ROOT] Problem with TH1F::Divide

From: Rene Brun (brun@pcbrun.cern.ch)
Date: Mon Dec 20 2004 - 09:43:35 MET


On Sun, 19 Dec 2004, Roland Kuhn wrote:

> Hi Rene!
> 
> On Dec 19, 2004, at 11:23 AM, Rene Brun wrote:
> 
> > Hi Roland,
> >
> > CINT shortcuts are interesting when you type one command at the CINT
> > prompt.
> > Do not use these shortcuts in a script. Use standard C++.
> >
> Sure. That's what I meant. CINT has its merits, but mostly for 
> interactive use. I just wanted to know if I can always expect "h1=h1" 
> to work like "TH1F*h1=(TH1F*)gDirectory->Get("h1")".

No, do not assume this unless (as I said) you type a command at the CINT 
prompt. In case you open a second file with an object having the same 
name, you will have problems. Use standard C++

Rene Brun

> > > Rene Brun
> >
> > On Sun, 19 Dec
> > 2004, Roland Kuhn wrote:
> >
> >> Hi Rene!
> >>
> >> On Dec 17, 2004, at 8:42 AM, Rene Brun wrote:
> >>
> >>> Hi Dmitry,
> >>>
> >>> You see a side-effect of using teh CINT short-cut of a pointer
> >>> automatically created when giving the object name.
> >>> You should do, eg:
> >>>
> >>>     ff1=new
> >>> TFile("/home/botov/work/snd2k/R002-003/work/rootntuple/
> >>> eeElastic_10deg.$
> >>>     TH1F *h1 = (TH1F*)ff1->Get("h1");
> >>
> >> I've seen "h1=h1" doing the same thing with much less typing. Is this
> >> intentional/supported/recommended?
> >>
> >>>     h1->Draw("Simth[0]>>htmp");
> >>>     TH1F *htmp = (TH1F*)ff1->Get("htmp");
> >>>     h1->Draw("Simth[0]>>htmp1","Simth[1]>20");
> >>>     TH1F *htmp1 = (TH1F*)ff1->Get("htmp1");
> >>>     htmp1->Divide(htmp);
> >>>     htmp1->Divide(htmp);
> >>>
> >>> Rene Brun
> >>
> >> 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.
> >>
> >
> >
> 
> 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.
> 



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET