TH2D in polar coords

From: Jakub Čermák <jakub_at_jcermak.cz>
Date: Mon, 13 Jul 2009 16:26:01 +0200


Hello rooters,
I'm trying to make an 2D histogram in polar coordinates (I wanna visualize the sky - the azimuth and elevation angles). According to manual x should be angle and y radius (length?). But I can't just get it to work. Is there any HOW-TO?
My code:

	TH2D *hist=new TH2D("hist","hist", 90, -90, 90, 90, -90, 90);
	for(int i=0; i<10000;++i)
	{
		double y=gRandom->Uniform(90);
		double x=gRandom->Uniform(M_PI*2);
		hist->Fill(x,y);
	}
	hist->Draw("COLZ POL");

And it makes histogram like http://dl.jcermak.cz/rootpolar.png although I think it should make a circle 180 in diameter and in center in (0,0). Can you please tell me what I'm doing wrong?

Best regards,
Jakub Cermak  

__________ Informace od ESET NOD32 Antivirus, verze databaze 4238 (20090713)


Tuto zpravu proveril ESET NOD32 Antivirus.

http://www.eset.cz   Received on Mon Jul 13 2009 - 16:26:12 CEST

This archive was generated by hypermail 2.2.0 : Mon Jul 13 2009 - 17:50:01 CEST