How to plot skymaps with ROOT?

Hi,

Does anyone know how to plot a skymap with root ? I mean, I am aware of the AITOFF drawing option, but the grid doesn’t fit to the skymap, for instance…

I would like to plot some maps using slalib coordinates transformation. Do I need something else in addition to ROOT ? I had a look to AstroROOT website, but there is no information whether it does it or not, and as I’m not sure if I need to be root to do the make global_install (which I can’t), I didn’t try to install it.

So, how do you guys do such a plot ?

Thanks.

Edit : Correlated question : will it be possible to plot a TGraph on such a map ? I’d like to draw a trajectory…

Do you have some little macro showing what you are doing ? That would help …
The AITOFF option applies on TH2 drawing you are using a TH2 ? yes in principle you can draw a graph on top of it…
A small example would help…

Well, when I posted the original post I had no example at all. Finally I installed AstroROOT, which installation didn’t need to be root, but there is no documentation about how to create input files or tables (the tf_container doc explain how to convert fits/root/asro files from one to another, but not how to create them from nothing).

So I decided to make a function with some standard TGraphs drawing longitude and latitude references (using hammer-aitoff coordinates transformation) on an empty TH2F. I superimpose my trajectory graphs on this blank skymap. The TH2F may not be the best solution, however it is sufficient for now. I’ll format the display (axis and cie) in the future.

If it can be helpful to someone in the same case, here is the function :

[code]// Blank map ----------------------------------------------------------------------------//
void drawmap()
{
TH2F *skymap=new TH2F(“Blank skymap”,“Blank skymap”,40,-200,200,20,-100,100);

gStyle->SetOptStat(0000);	
float conv=3.1415926/180; // I am also aware of TMath::DegToRad() and TMath::Pi() which could be used there...
	
const int Nl=19; // Number of drawn latitudes
const int NL=19; // Number of drawn longitudes
int M=30;

TGraph	*latitudes[Nl];
TGraph	*longitudes[NL];

for(int j=0;j<Nl;++j)
{
	latitudes[j]=new TGraph();
	float la=-90+180/(Nl-1)*j;
	
	for(int i=0;i<M+1;++i)
	{
		float lo= -180+360/M*i;
		float z = sqrt(1+cos(la*conv)*cos(lo*conv/2));
		float x = 180*cos(la*conv)*sin(lo*conv/2)/z;
		float y = 90*sin(la*conv)/z;
		latitudes[j]->SetPoint(i,x,y);
	}
}  

for(int j=0;j<NL;++j)
{
	longitudes[j]=new TGraph();
	float lo=-180+360/(NL-1)*j;
	
	for(int i=0;i<M+1;++i)
	{
		float la= -90+180/M*i;
		float z = sqrt(1+cos(la*conv)*cos(lo*conv/2));
		float x = 180*cos(la*conv)*sin(lo*conv/2)/z;
		float y = 90*sin(la*conv)/z;
		longitudes[j]->SetPoint(i,x,y);
	}
}
skymap->Draw(/*"aitoff"*/);
for(int j=0;j<Nl;++j) latitudes[j]->Draw("c");
for(int j=0;j<NL;++j) longitudes[j]->Draw("c");

}// End of drawmap[/code]