150 ((px-
gPad->XtoPixel(0))<0)) ||
152 ((px-
gPad->XtoPixel(0))>0))) {
158 ((py-
gPad->YtoPixel(0))>0)) ||
160 (py-
gPad->YtoPixel(0))<0)) {
197 static Int_t d1, d2, d3, px1, py1, px3, py3;
200 p2 = p3 = p4 = p5 = p6 = p7 = p8 =
kFALSE;
201 if (!
gPad->IsEditable())
return;
208 px2 =
gPad->XtoAbsPixel(-1);
209 py2 =
gPad->YtoAbsPixel(1);
211 px3 =
gPad->XtoAbsPixel(-1);
212 py3 =
gPad->YtoAbsPixel(-1);
220 if ( d2 < kMaxDiff) {
225 if ( d3 < kMaxDiff) {
243 px2 =
gPad->AbsPixeltoX(px);
244 py2 =
gPad->AbsPixeltoY(py);
245 if ( px2 < 0 && py2 < 0) {p2 =
kTRUE;};
246 if ( px2 < 0 && py2 > 0 ) {p3 =
kTRUE;};
247 if ( px2 > 0 && py2 > 0 ) {p4 =
kTRUE;};
248 if ( px2 > 0 && py2 < 0 ) {p5 =
kTRUE;};
282 while(angle < 0 || angle > 2*pi){
283 if(angle < 0) angle+=2*
pi;
284 if(angle > 2*pi) angle-=2*
pi;
287 if(angle > 0 && angle < pi/2)
return 11;
288 else if(angle > pi/2 && angle < pi)
return 31;
289 else if(angle > pi && angle < 3*pi/2)
return 33;
290 else if(angle > 3*pi/2 && angle < 2*pi)
return 13;
291 else if(angle == 0 || angle == 2*pi)
return 12;
292 else if(angle == pi/2)
return 21;
293 else if(angle == pi)
return 32;
294 else if(angle == 3*pi/2)
return 23;
298 if(angle >= 0 && angle <= pi/2)
return 12;
299 else if((angle > pi/2 && angle <= pi) || (angle > pi && angle <= 3*pi/2))
return 32;
300 else if(angle > 3*pi/2 && angle <= 2*pi)
return 12;
313 while(angle < 0 || angle > 2*pi){
314 if(angle < 0) angle+=2*
pi;
315 if(angle > 2*pi) angle-=2*
pi;
318 if(angle >= 0 && angle <= pi/2)
return angle*convraddeg;
319 else if(angle > pi/2 && angle <= pi)
return (angle + pi)*convraddeg;
320 else if(angle > pi && angle <= 3*pi/2)
return (angle - pi)*convraddeg;
321 else if(angle > 3*pi/2 && angle <= 2*pi)
return angle*convraddeg;
352 Int_t optionpoldiv, optionraddiv;
358 if(opt.
Contains(
'P')) optionpoldiv=1;
else optionpoldiv=0;
359 if(opt.
Contains(
'R')) optionraddiv=1;
else optionraddiv=0;
378 const Int_t np = 200;
393 for (i=0; i<=
n; i++) {
397 x[i] = x1 + dx*ct - dy*st;
398 y[i] = y1 + dx*st + dy*ct;
400 gPad->PaintPolyLine(n+1,x,y);
412 gPad->RangeAxis(-1,-1,1,1);
413 gPad->Range(-1.25,-1.25,1.25,1.25);
417 if (!
gPad->GetLogy()) {
418 for (i=0; i<ndivMajor; i++) {
432 const char* form = (
char *)
" ";
440 if (rnum == 0) form =
Form(
"%d",rnum);
441 if (rnum == 1 && rden == 1) form =
Form(
"#pi");
442 if (rnum == 1 && rden != 1) form =
Form(
"#frac{#pi}{%d}",rden);
443 if (rnum != 1 && rden == 1 && i !=0) form=
Form(
"%d#pi",rnum);
444 if (rnum != 1 && rden != 1) form =
Form(
"#frac{%d#pi}{%d}",rnum,rden);
451 form =
Form(
"%5.3g",txtval);
454 if (first != 0) s.
Remove(0, first);
472 if (rnum == 0) form =
Form(
"%d",rnum);
473 if (rnum == 1 && rden == 1) form =
Form(
"#pi");
474 if (rnum == 1 && rden != 1) form =
Form(
"#frac{#pi}{%d}",rden);
475 if (rnum != 1 && rden == 1 && i !=0) form =
Form(
"%d#pi",rnum);
476 if (rnum != 1 && rden != 1) form =
Form(
"#frac{%d#pi}{%d}",rnum,rden);
479 textangular->
PaintLatex(costhetas,corr+sinthetas,0,
483 form =
Form(
"%5.3g",txtval);
486 if (first != 0) s.
Remove(0, first);
502 if (issettickpolar) {
514 gPad->PaintLine(0.,0.,costheta,sintheta);
520 for (j=1; j<ndivMinor; j++) {
534 for (i=1; i<=test; i++) {
548 const char* form = (
char *)
" ";
554 form =
Form(
"%5.3g",txtval);
557 if (first != 0) s.
Remove(0, first);
571 form =
Form(
"%5.3g",txtval);
574 if (first != 0) s.
Remove(0, first);
589 if (issettickpolar) {
601 gPad->PaintLine(0.,0.,costheta,sintheta);
611 for (j=1; j<9; j++) {
628 static char chopt[8] =
"";
631 Int_t ndivMajor = ndiv%100;
632 Int_t ndivMinor = ndiv/100;
634 Double_t frwrmin = 0., frwrmax = 0., binWidth = 0;
637 frwrmax, ndivmajor,binWidth,
"");
640 if (!
gPad->GetLogx()) {
641 gPad->RangeAxis(-1,-1,1,1);
642 gPad->Range(-1.25,-1.25,1.25,1.25);
651 strncat(chopt,
"SDH", 3);
652 if (
fNdivRad < 0) strncat(chopt,
"N",1);
661 umin, umax, ndiv, chopt, 0.,
kFALSE);
669 Double_t frwrmini = 0., frwrmaxi = 0., binWidth2 =0;
671 frwrmaxi, ndivminor,binWidth2,
"");
674 for (i=1; i<=ndivmajor+2; i++) {
682 for (j=1; j<ndivminor+1; j++) {
683 if (rmajmin+j*dist2<=1)
PaintCircle(0.,0.,rmajmin+j*dist2,0.,360,0);
691 for (i=1; i<=ndivMajor; i++) {
698 for (j=1; j<ndivMinor; j++) {
701 PaintCircle(0.,0.,rmaj- j*1./(ndivMajor*ndivMinor),0.,360,0);
713 for (i=1; i<=test; i++) {
717 ecart = ((double) i)/ ((double) test);
725 for (j=1; j<9; j++) {
752 for (i=j; i > 1; i--) {
753 if ((a % i == 0) && (b % i == 0)) {
void SetToRadian()
The Polar circle is labelled using radian.
double dist(Rotation3D const &r1, Rotation3D const &r2)
void SetTickpolarSize(Double_t tickpolarsize=0.02)
Set polar ticks size.
Font_t fPolarLabelFont
Set font of angular labels.
void SetTwoPi()
Set range from 0 to 2*pi.
Color_t fPolarLabelColor
Set color of the angular labels.
Double_t fPolarOffset
Offset for Polar labels.
void Init()
Initialize some of the fields of TGraphPolargram.
static double p3(double t, double a, double b, double c, double d)
void SetRadialLabelSize(Double_t radialsize=0.035)
Set radial labels size.
void PaintCircle(Double_t x, Double_t y, Double_t r, Double_t phimin, Double_t phimax, Double_t theta)
This is simplified from TEllipse::PaintEllipse.
void SetToDegree()
The Polar circle is labelled using degree.
Bool_t TestBit(UInt_t f) const
void Draw(Option_t *options="")
Draw Polargram.
static void Optimize(Double_t A1, Double_t A2, Int_t nold, Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BWID, Option_t *option="")
static function to compute reasonable axis limits
void ToUpper()
Change string to upper case.
Double_t fTickpolarSize
Set size of Tickmarks.
Double_t GetPolarLabelSize()
Double_t GetRadialOffset()
Short_t Min(Short_t a, Short_t b)
virtual void Modify()
Change current line attributes if necessary.
Double_t fRwrmax
Maximal radial value (real world)
Int_t fNdivPol
Number of polar divisions.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Int_t FindAlign(Double_t angle)
Find the alignement rule to apply for TText::SetTextAlign(Short_t).
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Double_t fRadialOffset
Offset for radial labels.
void ChangeRangePolar(Double_t tmin, Double_t tmax)
Set the Polar range.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
virtual Style_t GetLineStyle() const
Return the line style.
void SetRadialLabelFont(Font_t tfontradial=62)
Set radial label font.
The TNamed class is the base class for all named ROOT classes.
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Indicate that there is something to click here.
To draw Mathematical Formula.
static double p2(double t, double a, double b, double c)
double pow(double, double)
void Paint(Option_t *options="")
Paint TGraphPolargram.
Int_t fCutRadial
if fCutRadial = 0, circles are cut by radial axis if fCutRadial = 1, circles are not cut ...
void PaintPolarDivisions(Bool_t noLabels)
Draw Polar divisions.
void SetPolarOffset(Double_t PolarOffset=0.04)
Set the labels offset.
virtual void PaintLatex(Double_t x, Double_t y, Double_t angle, Double_t size, const char *text)
Main drawing function.
void SetNdivRadial(Int_t Ndiv=508)
Set the number of radial divisions: enter a number ij with 0<i<99 and 0<j<99.
void SetAxisAngle(Double_t angle=0)
Set axis angle.
TGraphPolargram(const char *name, Double_t rmin, Double_t rmax, Double_t tmin, Double_t tmax)
TGraphPolargram Constructor.
void SetLabelSize(Float_t labelsize)
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Color_t fRadialLabelColor
Set color of the radial labels.
Int_t fNdivRad
Number of radial divisions.
Style_t fLineStyle
Line style.
virtual void PaintAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, Double_t &wmin, Double_t &wmax, Int_t &ndiv, Option_t *chopt="", Double_t gridlength=0, Bool_t drawGridOnly=kFALSE)
Control function to draw an axis.
void PaintRadialDivisions(Bool_t drawaxis)
Paint radial divisions.
void SetRangeRadial(Double_t rmin, Double_t rmax)
Set the radial range.
Double_t GetTickpolarSize()
void ReduceFraction(Int_t Num, Int_t Denom, Int_t &rnum, Int_t &rden)
Reduce fractions.
char * Form(const char *fmt,...)
Font_t GetPolarLabelFont()
static double p1(double t, double a, double b)
Double_t fRwtmin
Minimal angular value (real world)
void SetPolarLabelSize(Double_t angularsize=0.04)
Set angular labels size.
Double_t fPolarTextSize
Set Polar text size.
virtual ~TGraphPolargram()
TGraphPolargram destructor.
void SetPolarLabel(Int_t div, const TString &label)
Set some specified polar labels, used in the case of a spider plot.
TString * fPolarLabels
! [fNdivPol] Specified polar labels
TString & Remove(Ssiz_t pos)
Double_t fRwtmax
Minimal angular value (real world)
void SetLabelOffset(Float_t labeloffset)
static const double x1[5]
Double_t fAxisAngle
Set angle of the radial axis.
void SetLabelFont(Int_t labelfont)
Int_t DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
Compute distance from point px,py to a line.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Double_t fRwrmin
Minimal radial value (real world)
Int_t DistancetoPrimitive(Int_t px, Int_t py)
Everything within the circle belongs to the TGraphPolargram.
void SetToGrad()
The Polar circle is labelled using gradian.
void SetNdivPolar(Int_t Ndiv=508)
Set the number of Polar divisions: enter a number ij with 0<i<99 and 0<j<99.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
void SetLabelColor(Int_t labelcolor)
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
void SetPolarLabelColor(Color_t tcolorangular=1)
Set Polar labels color.
Color_t GetRadialColorLabel()
Double_t Sqrt(Double_t x)
Font_t fRadialLabelFont
Set font of radial labels.
void SetRadialOffset(Double_t RadialOffset=0.025)
Set the labels offset.
Color_t GetPolarColorLabel()
virtual void PaintText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
void SetRangePolar(Double_t tmin, Double_t tmax)
Allows to change range Polar.
void SetRadialLabelColor(Color_t tcolorradial=1)
Set radial labels color.
Double_t FindTextAngle(Double_t theta)
Determine the orientation of the polar labels according to their angle.
Font_t GetRadialLabelFont()
Double_t GetRadialLabelSize()
void LabelsLimits(const char *label, Int_t &first, Int_t &last)
Internal method to find first and last character of a label.
void SetPolarLabelFont(Font_t tfontangular=62)