Re: [ROOT] Problem with TH1F::Divide

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Dec 17 2004 - 08:42:37 MET


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");
    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  
   

"Dmitry A. Shtol" wrote:
> 
> Hi!
> I have done the following operations (just an example):
> root [0] ff1=new TFile("/home/botov/work/snd2k/R002-003/work/rootntuple/eeElastic_10deg.$
> (class TFile*)0x8f2fb48
> root [1] h1->Draw("Simth[0]>>htmp")
> <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
> root [2] h1->Draw("Simth[0]>>htmp1","Simth[1]>20")
> (Int_t)2384
> root [3] htmp1->Divide(htmp)
> root [4] htmp1->Divide(htmp)
> Error: Symbol htmp is not defined in current scope  FILE:(tmpfile) LINE:1
> *** Interpreter error recovered ***
> 
> Why first Divide works normally, but second Divide can't find an object htmp
> .ls finds it:
> root [5] .ls
> TFile**
> /home/botov/work/snd2k/R002-003/work/rootntuple/eeElastic_10deg.rootntupleHBOOK
> file: eeElastic_10deg.hbook converted to ROOT
>  TFile*
> /home/botov/work/snd2k/R002-003/work/rootntuple/eeElastic_10deg.rootntupleHBOOK
> file: eeElastic_10deg.hbook converted to ROOT
> OBJ: TTree    h1      tup1 : 0 at: 0x9051f70
> OBJ: TH1F     htmp    Simth[0] : 0 at: 0x924b560
> OBJ: TH1F     htmp1   Simth[0] {Simth[1]>20} : 0 at: 0x925a818
> KEY: TTree    h1;1    tup1
> 
> I can use name htmp. For example
> root [6] htmp->Draw()
> 
> works normally. Why it can't be used as function argument?
> Thank you for advance.
> 
> --
> Dmitry A. Shtol                        (SND group)
> Budker Institute of Nuclear Physics



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