Re: TF2 on a TH3 with SURF option

From: Olivier Couet <couet_at_mail.cern.ch>
Date: Wed, 26 Jan 2005 11:24:56 +0100 (CET)

Hi,

 Yes you are right this kind over overlapping are not implemented right now. The following works:

cont2()
{

   gROOT->Reset();

   int NBins = 50;
   double d = 2;

   TH2F* h2 = new TH2F("h2", "h2", NBins, -d, d, NBins, -d, d);    for (int bx = 1; bx <= NBins; ++bx) {

     for (int by = 1;  by <= NBins; ++by) {
       double x = h2->GetXaxis()->GetBinCenter(bx);
       double y = h2->GetYaxis()->GetBinCenter(by);
       h2->SetBinContent(bx, by, exp(-x*x)*exp(-y*y));
     }

   }

   TCanvas *c1=new TCanvas("c1","c1",600,600);    h2->Draw("surf4");
   h2->Draw("CONT1 SAME");

   c1->Update();
}

On Tue, 25 Jan 2005, Chris Roat wrote:

> Hi,
>
> While it is possible to draw a TF2 on a TH2 as a contour plot, it
> seems it is not possible to draw a TF2 on a TH3 with the SURF option.
>
> c1= new TCanvas("c1");
> c1->Divide(2,1);
>
> c1->cd(1);
> TH2* h1= new TH2F("h1","h1",1,0,20,1,0,20);
> h1->Draw();
> TF2* f1= new TF2("f1","2*x",0,10,0,10);
> f1->Draw("SAME");
>
> c1->cd(2);
> TH3* h2= new TH3F("h2","h2",1,0,20,1,0,20,1,0,20);
> h2->Draw();
> TF2* f2= new TF2("f2","2*x",0,10,0,10);
> f2->Draw("SURF2 SAME");
>
> My goal is to be able to draw several TF2's on the same plot, each
> with slightly different, but possible overlapping, ranges. In fact, I
> see now that plotting with SURF SAME does not seem to work:
>
> TF2* f2= new TF2("f2","3*x",0,20,0,20);
> f2->Draw("SURF");
> TF2* f= new TF2("f","2*x",0,20,0,20);
> f->Draw("SAME SURF");
>
> I'm using ROOT 4.02/00 on Debian.
>
> Cheers,
> Chris
>
>

-- 
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 Wed Jan 26 2005 - 11:25:01 MET

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