florian
November 24, 2008, 5:14am
1
hi
I try to create a polar plot, but the setminradial and setmaxradial commands do not work. Can anybody tell me what i am doing wrong in the following small program?
#include <math.h>
void polar2(){
gROOT->SetStyle("Plain");
gStyle->SetOptStat(kFALSE);
const int num = 1000000;
double dist[num], dec[num], alpha[num], x[num], y[num], z[num];
int n = 0;
double dummy = 0;
ifstream widthfile("simul2.list");
while((widthfile >> dummy >> dec[n] >> alpha[n] >> x[n] >> y[n] >> z[n])){
dummy = sqrt(pow(x[n],2)+pow(y[n],2));
dist[n] = dummy;
n++;
}
widthfile.close();
TCanvas *CPol = new TCanvas("CPol","TGraphPolar Examples",600,600);
TGraphPolar * grP1 = new TGraphPolar(n-1,alpha,dist);
grP1->SetTitle("");
grP1->SetMinRadial(0);
grP1->SetMaxRadial(300);
grP1->Draw("AOP");
}
thanks and best regards
florian
couet
November 24, 2008, 10:49am
3
can you send the data file also ?
thanks.
florian
November 25, 2008, 1:44am
4
sorry I am not able to attach any file in this forum??? Therefore I put the file on my webpage. You can download it
rzuser.uni-heidelberg.de/~fb … =downloads
The name is simul2.list
thanks a lot for your help
best regards
florian
couet
November 25, 2008, 2:10pm
5
It seems there is a typo on your page “dimul” instead of “simul” . Can you email me that file at Olivier.Couet@cern.ch ?
I corrected the typo on my webpage…
rzuser.uni-heidelberg.de/~fb … =downloads
you e-mail address is not working?
Furthermore I realized, that I can’t use any function in TGraphPolargram…
SetRadialLabelSize is also not working?
reagrds
florian
couet
December 2, 2008, 9:20am
7
void polar2(){
gROOT->SetStyle("Plain");
gStyle->SetOptStat(kFALSE);
const int num = 1000000;
double dist[num], dec[num], alpha[num], x[num], y[num], z[num];
int n = 0;
double dummy = 0;
ifstream widthfile("simul2.list");
while((widthfile >> dummy >> dec[n] >> alpha[n] >> x[n] >> y[n] >> z[n])){
dummy = sqrt(pow(x[n],2)+pow(y[n],2));
dist[n] = dummy;
n++;
}
widthfile.close();
TCanvas *CPol = new TCanvas("CPol","TGraphPolar Examples",600,600);
TGraphPolar * grP1 = new TGraphPolar(n-1,alpha,dist);
grP1->SetTitle("");
grP1->Draw("AOP");
gPad->Update();
grP1->GetPolargram()->SetRangeRadial(0,300);
}