65 fPolarLabels =
nullptr;
97 fPolarLabels =
nullptr;
131 if (!
gPad)
return 9999;
166 ((px-
gPad->XtoPixel(0))<0)) ||
168 ((px-
gPad->XtoPixel(0))>0))) {
174 ((py-
gPad->YtoPixel(0))>0)) ||
176 (py-
gPad->YtoPixel(0))<0)) {
213 static Int_t d1, d2, d3, px1, py1, px3, py3;
214 static Bool_t p1, p2, p3, p4, p5, p6, p7, p8;
216 p2 = p3 = p4 = p5 = p6 = p7 = p8 =
kFALSE;
217 if (!
gPad->IsEditable())
return;
224 px2 =
gPad->XtoAbsPixel(-1);
225 py2 =
gPad->YtoAbsPixel(1);
227 px3 =
gPad->XtoAbsPixel(-1);
228 py3 =
gPad->YtoAbsPixel(-1);
236 if ( d2 < kMaxDiff) {
241 if ( d3 < kMaxDiff) {
259 px2 =
gPad->AbsPixeltoX(px);
260 py2 =
gPad->AbsPixeltoY(py);
261 if ( px2 < 0 && py2 < 0) {p2 =
kTRUE;};
262 if ( px2 < 0 && py2 > 0 ) {p3 =
kTRUE;};
263 if ( px2 > 0 && py2 > 0 ) {p4 =
kTRUE;};
264 if ( px2 > 0 && py2 < 0 ) {p5 =
kTRUE;};
298 while(angle < 0 || angle > 2*pi){
299 if(angle < 0) angle+=2*pi;
300 if(angle > 2*pi) angle-=2*pi;
303 if(angle > 0 && angle < pi/2)
return 11;
304 else if(angle > pi/2 && angle < pi)
return 31;
305 else if(angle > pi && angle < 3*pi/2)
return 33;
306 else if(angle > 3*pi/2 && angle < 2*pi)
return 13;
307 else if(angle == 0 || angle == 2*pi)
return 12;
308 else if(angle == pi/2)
return 21;
309 else if(angle == pi)
return 32;
310 else if(angle == 3*pi/2)
return 23;
314 if(angle >= 0 && angle <= pi/2)
return 12;
315 else if((angle > pi/2 && angle <= pi) || (angle > pi && angle <= 3*pi/2))
return 32;
316 else if(angle > 3*pi/2 && angle <= 2*pi)
return 12;
329 while(angle < 0 || angle > 2*pi){
330 if(angle < 0) angle+=2*pi;
331 if(angle > 2*pi) angle-=2*pi;
334 if(angle >= 0 && angle <= pi/2)
return angle*convraddeg;
335 else if(angle > pi/2 && angle <= pi)
return (angle + pi)*convraddeg;
336 else if(angle > pi && angle <= 3*pi/2)
return (angle - pi)*convraddeg;
337 else if(angle > 3*pi/2 && angle <= 2*pi)
return angle*convraddeg;
375 if (!optionpoldiv && !optionraddiv)
376 optionpoldiv = optionraddiv =
kTRUE;
395 const Int_t np = 200;
410 for (i=0; i<=
n; i++) {
427 Int_t i, j, rnum, rden, first, last;
429 gPad->RangeAxis(-1,-1,1,1);
430 gPad->Range(-1.25,-1.25,1.25,1.25);
434 if (!
gPad->GetLogy()) {
435 for (i=0; i<ndivMajor; i++) {
457 if (rnum == 0) form.
Form(
"%d",rnum);
458 if (rnum == 1 && rden == 1) form =
"#pi";
459 if (rnum == 1 && rden != 1) form.
Form(
"#frac{#pi}{%d}",rden);
460 if (rnum != 1 && rden == 1 && i !=0) form.
Form(
"%d#pi",rnum);
461 if (rnum != 1 && rden != 1) form.
Form(
"#frac{%d#pi}{%d}",rnum,rden);
468 form.
Form(
"%5.3g",txtval);
471 if (first != 0) s.
Remove(0, first);
489 if (rnum == 0) form.
Form(
"%d",rnum);
490 if (rnum == 1 && rden == 1) form =
"#pi";
491 if (rnum == 1 && rden != 1) form.
Form(
"#frac{#pi}{%d}",rden);
492 if (rnum != 1 && rden == 1 && i !=0) form.
Form(
"%d#pi",rnum);
493 if (rnum != 1 && rden != 1) form.
Form(
"#frac{%d#pi}{%d}",rnum,rden);
496 textangular.
PaintLatex(costhetas,corr+sinthetas,0,
500 form.
Form(
"%5.3g",txtval);
503 if (first != 0) s.
Remove(0, first);
519 if (issettickpolar) {
531 gPad->PaintLine(0.,0.,costheta,sintheta);
536 for (j=1; j<ndivMinor; j++) {
550 for (i=1; i<=test; i++) {
570 form.
Form(
"%5.3g",txtval);
573 if (first != 0) s.
Remove(0, first);
587 form.
Form(
"%5.3g",txtval);
590 if (first != 0) s.
Remove(0, first);
605 if (issettickpolar) {
617 gPad->PaintLine(0.,0.,costheta,sintheta);
626 for (j=1; j<9; j++) {
645 static char chopt[8] =
"";
648 Int_t ndivMajor = ndiv%100;
649 Int_t ndivMinor = ndiv/100;
651 Double_t frwrmin = 0., frwrmax = 0., binWidth = 0;
654 frwrmax, ndivmajor,binWidth,
"");
656 if (!
gPad->GetLogx()) {
657 gPad->RangeAxis(-1,-1,1,1);
658 gPad->Range(-1.25,-1.25,1.25,1.25);
667 strncat(chopt,
"SDH", 4);
668 if (
fNdivRad < 0) strncat(chopt,
"N",2);
677 umin, umax, ndiv, chopt, 0.,
kFALSE);
685 Double_t frwrmini = 0., frwrmaxi = 0., binWidth2 =0;
687 frwrmaxi, ndivminor,binWidth2,
"");
690 for (i=1; i<=ndivmajor+2; i++) {
698 for (j=1; j<ndivminor+1; j++) {
699 if (rmajmin+j*dist2<=1)
PaintCircle(0.,0.,rmajmin+j*dist2,0.,360,0);
707 for (i=1; i<=ndivMajor; i++) {
714 for (j=1; j<ndivMinor; j++) {
717 PaintCircle(0.,0.,rmaj- j*1./(ndivMajor*ndivMinor),0.,360,0);
729 for (i=1; i<=test; i++) {
733 ecart = ((double) i)/ ((
double) test);
741 for (j=1; j<9; j++) {
768 for (i=j; i > 1; i--) {
769 if ((
a % i == 0) && (
b % i == 0)) {
974 if (!option || strcmp(option,
"nodraw"))
984 out,
Class(),
"polargram",
985 TString::Format(
"\"%s\", %g, %g, %g, %g, \"%s\"",
GetName(),
fRwrmin,
fRwrmax,
fRwtmin,
fRwtmax, opt.
Data()));
991 out <<
" polargram->SetAxisAngle(" << std::to_string((
int)(
fAxisAngle /
TMath::Pi() * 180)).c_str() <<
");\n";
994 out <<
" polargram->SetNdivPolar(" << std::to_string(
fNdivPol).c_str() <<
");\n";
996 out <<
" polargram->SetPolarLabelFont(" << std::to_string(
fPolarLabelFont).c_str() <<
");\n";
997 out <<
" polargram->SetPolarLabelSize(" << std::to_string(
fPolarTextSize).c_str() <<
");\n";
999 out <<
" polargram->SetPolarOffset(" << std::to_string(
fPolarOffset).c_str() <<
");\n";
1000 out <<
" polargram->SetTickpolarSize(" << std::to_string(
fTickpolarSize).c_str() <<
");\n";
1004 out <<
" polargram->SetPolarLabel(\"" <<
fPolarLabels[
n] <<
"\");\n";
1007 out <<
" polargram->SetNdivRadial(" << std::to_string(
fNdivRad).c_str() <<
");\n";
1009 out <<
" polargram->SetRadialLabelFont(" << std::to_string(
fRadialLabelFont).c_str() <<
");\n";
1010 out <<
" polargram->SetRadialLabelSize(" << std::to_string(
fRadialTextSize).c_str() <<
");\n";
1012 out <<
" polargram->SetRadialOffset(" << std::to_string(
fRadialOffset).c_str() <<
");\n";
const Int_t kMaxPixel
Max value for an int.
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
short Font_t
Font number (short).
double Double_t
Double 8 bytes.
short Color_t
Color number (short).
const char Option_t
Option string (const char).
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
virtual Style_t GetLineStyle() const
Return the line style.
Style_t fLineStyle
Line style.
Int_t DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
virtual void SaveTextAttributes(std::ostream &out, const char *name, Int_t alidef=12, Float_t angdef=0, Int_t coldef=1, Int_t fondef=61, Float_t sizdef=1)
static TString SavePrimitiveColor(Int_t ci)
void SetLabelFont(Int_t labelfont)
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)
void SetLabelOffset(Float_t labeloffset)
void SetLabelColor(Int_t labelcolor)
void SetLabelSize(Float_t labelsize)
void LabelsLimits(const char *label, Int_t &first, Int_t &last)
Double_t fRwrmin
Minimal radial value (real world).
void ReduceFraction(Int_t Num, Int_t Denom, Int_t &rnum, Int_t &rden)
Double_t GetPolarLabelSize()
Color_t fRadialLabelColor
Set color of the radial labels.
void SetPolarLabelColor(Color_t tcolorangular=1)
void PaintPolarDivisions(Bool_t noLabels)
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Computes distance from point (px,py) to the object.
void SetRangePolar(Double_t tmin, Double_t tmax)
Double_t fPolarTextSize
Set Polar text size.
Double_t fRwtmin
Minimal angular value (real world).
Double_t GetRadialOffset()
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to an event at (px,py).
TGraphPolargram(const char *name="")
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Double_t GetTickpolarSize()
void SetPolarOffset(Double_t PolarOffset=0.04)
Double_t FindTextAngle(Double_t theta)
void SetRadialLabelColor(Color_t tcolorradial=1)
void PaintCircle(Double_t x, Double_t y, Double_t r, Double_t phimin, Double_t phimax, Double_t theta)
void SetRangeRadial(Double_t rmin, Double_t rmax)
void SetTickpolarSize(Double_t tickpolarsize=0.02)
void SetAxisAngle(Double_t angle=0)
void SetNdivPolar(Int_t Ndiv=508)
Int_t fNdivRad
Number of radial divisions.
Font_t GetPolarLabelFont()
void Draw(Option_t *options="") override
Default Draw method for all objects.
Double_t fTickpolarSize
Set size of Tickmarks.
void SetRadialLabelSize(Double_t radialsize=0.035)
Font_t fPolarLabelFont
Set font of angular labels.
TString * fPolarLabels
! [fNdivPol] Specified polar labels
void PaintRadialDivisions(Bool_t drawaxis)
~TGraphPolargram() override
void ChangeRangePolar(Double_t tmin, Double_t tmax)
void SetPolarLabelSize(Double_t angularsize=0.04)
void SetRadialLabelFont(Font_t tfontradial=62)
Double_t fAxisAngle
Set angle of the radial axis.
Double_t fRwtmax
Minimal angular value (real world).
Double_t fRwrmax
Maximal radial value (real world).
void SetPolarLabel(Int_t div, const TString &label)
Font_t fRadialLabelFont
Set font of radial labels.
Int_t fNdivPol
Number of polar divisions.
Font_t GetRadialLabelFont()
Int_t fCutRadial
if fCutRadial = 0, circles are cut by radial axis if fCutRadial = 1, circles are not cut
Color_t fPolarLabelColor
Set color of the angular labels.
Double_t fPolarOffset
Offset for Polar labels.
void Paint(Option_t *options="") override
This method must be overridden if a class wants to paint itself.
void SetPolarLabelFont(Font_t tfontangular=62)
void SetRadialOffset(Double_t RadialOffset=0.025)
Color_t GetRadialColorLabel()
Int_t FindAlign(Double_t angle)
void SetNdivRadial(Int_t Ndiv=508)
Double_t GetRadialLabelSize()
Color_t GetPolarColorLabel()
Double_t fRadialOffset
Offset for radial labels.
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.
virtual void PaintLatex(Double_t x, Double_t y, Double_t angle, Double_t size, const char *text)
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
Bool_t TestBit(UInt_t f) const
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
static void SavePrimitiveConstructor(std::ostream &out, TClass *cl, const char *variable_name, const char *constructor_agrs="", Bool_t empty_line=kTRUE)
Save object constructor in the output stream "out".
const char * Data() const
void ToUpper()
Change string to upper case.
TString & Remove(Ssiz_t pos)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual void PaintText(Double_t x, Double_t y, const char *text)
RVec< PromoteTypes< T0, T1 > > pow(const T0 &x, const RVec< T1 > &v)
double dist(Rotation3D const &r1, Rotation3D const &r2)
void Init(TClassEdit::TInterpreterLookupHelper *helper)
Double_t ACos(Double_t)
Returns the principal value of the arc cosine of x, expressed in radians.
Double_t ASin(Double_t)
Returns the principal value of the arc sine of x, expressed in radians.
constexpr Double_t PiOver2()
Double_t Log(Double_t x)
Returns the natural logarithm of x.
Double_t Sqrt(Double_t x)
Returns the square root of x.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Double_t Tan(Double_t)
Returns the tangent of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.