Re: [ROOT] SetContour

From: Olivier Couet (Olivier.Couet@cern.ch)
Date: Fri May 09 2003 - 11:16:15 MEST


Hi Caius,

I just tried this macro with ROOT 3.05/05:

{
   TH2F *h = new TH2F("h","test contours",60,-3,3,60,-3,3);
   for (Int_t i=0;i<100000;i++) {
      double x,y;
      gRandom->Rannor(x,y);
      h->Fill(x,y);
   }

   Double_t max = h->GetMaximum();

   double contours[3];
   contours[0] = 0.1*max;
   contours[1] = 0.2*max;
   contours[2] = 0.7*max;
   printf("%g %g %g \n",contours[0], contours[1], contours[2]);

   h->SetContour(3,contours);
   h->Draw("cont0");   

   double levels[3];
   h->GetContour(levels); 
   printf("%g %g %g \n",levels[0], levels[1], levels[2]);
}

For me it works fine.

 Cheers,        Olivier



On Fri, 9 May 2003, Caius Howcroft wrote:

> 
> 
> Hi, I have been using root  3.04/02 and am having problems with 
> TH2F::SetContour.
> 
> I want one contour on my plot(LnL) at z=2.3 so I do:
> root [25] Double_t ilevel[1]={2.3}                                                           
> root [26] LnL->SetContour(1, ilevel)
> root [31] LnL->GetContour(ilevel)   
> (Int_t)1
> root [32] ilevel[0]              
> (Double_t)2.29999999999999982e+00
> root [33] LnL->Draw("cont0")
> //// This produces an empty plot.
> ///also 
> root [37] LnL->GetContour(ilevel)
> (Int_t)1
> root [38] ilevel[0]              
> (Double_t)0.00000000000000000e+00
> 
> 
> Drawing seems to reset the contonur levels
> 
> I also tried using several different contour levels:
> Double_t ilevel[3]={0.0, 2.3, 5.0}
> root [26] LnL->SetContour(3, ilevel)
> 
> I draws 3 contours at what looks like equally spaced z values.
> 
> Cheers
> Caius
> 
> ________________________________________
> -           CAIUS HOWCROFT             -
> -  +44 (0)1223 764 128      UK(office) -
> ========================================
> 
> 

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910      
E-Mail: Olivier.Couet@cern.ch                            Phone:   +41 22 7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22 7677155



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET