Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TAxis3D.cxx
Go to the documentation of this file.
1// @(#)root/g3d:$Id$
2// Author: Valery Fine(fine@mail.cern.ch) 07/01/2000
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include <cctype>
13#include <cassert>
14#include <iostream>
15
16#include "TMath.h"
17#include "TList.h"
18#include "TAxis3D.h"
19#include "TClass.h"
20#include "TPad.h"
21#include "TGaxis.h"
22#include "TView.h"
23#include "TBrowser.h"
24#include "TStyle.h"
25#include "strlcpy.h"
26
27/** \class TAxis3D
28\ingroup g3d
29
30The 3D axis painter class
31
32This class provide up to 3 axes to any 3D ROOT plot and "ZOOM" service.
33ExecuteEvent() method does provide zooming and moving a projection
343D object within TPad client area. With Zoom mode on the user can access
35TAxis3D context menu and set /change the attributes of axes all together
36or separately.
37
38To add the 3D rulers to any 3D view one has to create
39an instance of this class and Draw it.
40
41~~~ {.cpp}
42 TAxis3D rulers;
43 rulers.Draw();
44~~~
45
46One can use a static method to create ruler and attach it to the current gPad
47
48~~~ {.cpp}
49 TAxis3D::ToggleRulers(); // Brings the 3D axes up
50 TAxis3D::ToggleRulers(); // next calls remove the rulers from the TPad etc
51~~~
52
53To activate Zoomer one may call
54
55~~~ {.cpp}
56 TAxis3D::ToggleZoom();
57~~~
58
59each time one needs move or zoom the image. Then the user can:
60
61 - move:
62\image html g3d_axis3d_01.png
63 - zoom:
64\image html g3d_axis3d_02.png
65
66its 3D view with <left-mouse button> press / move.
67The "Zoom" deactivates itself just the user release the <left-mouse button>
68
69To change attributes of the rulers attached to the current Pad, one may
70query its pointer first:
71
72~~~ {.cpp}
73TAxis3D *axis = TAxis3D::GetPadAxis(); // Ask axis pointer
74if (axis) {
75 TAxis3D::ToggleRulers() // To pop axes down
76 axis->SetLabelColor(kBlue); // Paint the axes labels with blue color
77 axis->SetAxisColor(kRed); // Paint the axes itself with blue color
78 TAxis3D::ToggleRulers() // To pop axes up
79}
80~~~
81
82The attributes of the created axes are affected by the current style
83(see TStyle class ) and Set... methods of this class
84
85For example:
86~~~ {.cpp}
87 gStyle->SetAxisColor(kYellow,"X");
88 gStyle->SetAxisColor(kYellow,"Y");
89 gStyle->SetAxisColor(kYellow,"Z");
90
91 gStyle->SetLabelColor(kYellow,"X");
92 gStyle->SetLabelColor(kYellow,"Y");
93 gStyle->SetLabelColor(kYellow,"Z");
94
95 TAxis3D::ToggleRulers();
96 TAxis3D::ToggleRulers();
97~~~
98
99will draw all axes and labels with yellow color.
100*/
101
102const Char_t *TAxis3D::fgRulerName = "axis3druler";
103
104////////////////////////////////////////////////////////////////////////////////
105/// Normal constructor.
106
107TAxis3D::TAxis3D() : TNamed(TAxis3D::fgRulerName,"ruler")
108{
109 fSelected = nullptr;
112 InitSet();
113}
114
115////////////////////////////////////////////////////////////////////////////////
116/// Normal constructor.
117
118TAxis3D::TAxis3D(Option_t *) : TNamed(TAxis3D::fgRulerName,"ruler")
119{
120 fSelected = nullptr;
121 InitSet();
124}
125
126////////////////////////////////////////////////////////////////////////////////
127/// Copy constructor.
128
129TAxis3D::TAxis3D(const TAxis3D &axis) : TNamed(axis)
130{
131 axis.TAxis3D::Copy(*this);
132}
133
134////////////////////////////////////////////////////////////////////////////////
135/// Copy axis3d
136
137void TAxis3D::Copy(TObject &obj) const
138{
139 TNamed::Copy(obj);
140 for (Int_t i = 0; i < 3; i++)
141 fAxis[i].Copy(((TAxis3D &)obj).fAxis[i]);
142}
143
144////////////////////////////////////////////////////////////////////////////////
145/// Initialization.
146
148{
149 fAxis[0].SetName("xaxis");
150 fAxis[1].SetName("yaxis");
151 fAxis[2].SetName("zaxis");
152
153 fAxis[0].Set(1,0.,1.);
154 fAxis[1].Set(1,0.,1.);
155 fAxis[2].Set(1,0.,1.);
157}
158
159////////////////////////////////////////////////////////////////////////////////
160/// Add all 3 axes to the TBrowser
161
163{
164 for (Int_t i=0;i<3;i++) b->Add(&fAxis[i],fAxis[i].GetTitle());
165}
166
167////////////////////////////////////////////////////////////////////////////////
168/// Compute distance from point px,py to a line.
169
171{
172 Int_t dist = 9;
173 for (int i = 0; i < 3; i++) {
174 Int_t axDist = fAxis[i].DistancetoPrimitive(px, py);
175 if (dist > axDist) {
176 dist = axDist;
177 fSelected = &fAxis[i];
178 }
179 }
180
181 return fZoomMode ? 0 : dist;
182}
183
185 public:
186 Double_t x0 = 0, y0 = 0, x1 = 0, y1 = 0;
187 Int_t px0 = 0, py0 = 0;
188
190 {
191 px0 = px;
192 py0 = py;
193 x0 = parent.AbsPixeltoX(px);
194 y0 = parent.AbsPixeltoY(py);
195 }
196
197 void MoveCursor(TVirtualPad &parent, Int_t px, Int_t py)
198 {
199 x1 = parent.AbsPixeltoX(px);
200 y1 = parent.AbsPixeltoY(py);
201 parent.PaintBox(x0, y0, x1, y1, "ilaxis3d");
202 parent.UpdateAsync();
203 }
204
205};
206
207////////////////////////////////////////////////////////////////////////////////
208/// Execute action corresponding to one event.
209///
210/// This member function is called when an axis is clicked with the locator
211
213{
214 if (!gPad) return;
215
216 if (fSelected)
217 fSelected->ExecuteEvent(event, px, py);
218
219 if (!fZoomMode)
220 return;
221
222 auto &parent = *gPad;
223
224 auto view = parent.GetView();
225 if (!view)
226 return; // no 3D view yet
227
228 parent.SetCursor(kCross);
229
230 switch (event) {
231
232 case kButton1Down:
233 parent.MakeInteractive<TAxis3DInteractive>(this, parent, px, py);
234 break;
235
236 case kButton1Motion:
237 if (auto inter = parent.GetInteractive<TAxis3DInteractive>(this))
238 inter->MoveCursor(parent, px, py);
239 break;
240
241 case kButton1Up: {
242 auto inter = parent.GetInteractive<TAxis3DInteractive>(this);
243 if (!inter)
244 break;
245
246 Double_t min[3], max[3], viewCenter[3], viewCenterNDC[3];
247
248 view->GetRange(min, max);
249 for (Int_t i = 0; i < 3; i++)
250 viewCenter[i] = (max[i] + min[i]) / 2;
251 view->WCtoNDC(viewCenter, viewCenterNDC);
252 // Define the center
253 Double_t center[3], pointNDC[3], size[3], oldSize[3];
254 pointNDC[0] = (inter->x0 + inter->x1) / 2;
255 pointNDC[1] = (inter->y0 + inter->y1) / 2;
256 pointNDC[2] = viewCenterNDC[2];
257 view->NDCtoWC(pointNDC, center);
258
259 for (Int_t i = 0; i < 3; i++)
260 oldSize[i] = size[i] = (max[i] - min[i]) / 2;
261
262 // If there was a small motion, move the center only, do not change a scale
263 if (TMath::Abs(px - inter->px0) + TMath::Abs(py - inter->py0) > 4) {
264 Double_t newEdge[3];
265 for (Int_t i = 0; i < 3; i++)
266 size[i] = -1;
267
268 pointNDC[0] = inter->x0;
269 pointNDC[1] = inter->y0;
270
271 view->NDCtoWC(pointNDC, newEdge);
272 for (Int_t i = 0; i < 3; i++) {
273 Double_t newSize = TMath::Abs(newEdge[i] - center[i]);
274 if (newSize / oldSize[i] > 0.002)
275 size[i] = TMath::Max(size[i], newSize);
276 else
277 size[i] = oldSize[i];
278 }
279
280 pointNDC[0] = inter->x1;
281 pointNDC[1] = inter->y1;
282
283 view->NDCtoWC(pointNDC, newEdge);
284 for (Int_t i = 0; i < 3; i++) {
285 Double_t newSize = TMath::Abs(newEdge[i] - center[i]);
286 if (newSize / oldSize[i] > 0.002)
287 size[i] = TMath::Max(size[i], newSize);
288 else
289 size[i] = oldSize[i];
290 }
291 }
292 for (Int_t i = 0; i < 3; i++) {
293 max[i] = center[i] + size[i];
294 min[i] = center[i] - size[i];
295 }
296 view->SetRange(min, max);
297
298 if (!fStickyZoom)
299 SwitchZoom();
300
301 parent.FreeInteractive(this);
302 parent.Modified();
303 parent.UpdateAsync();
304 break;
305 }
306 }
307}
308
309////////////////////////////////////////////////////////////////////////////////
310/// Dummy method
311/// returns the const char * to "axis3d"
312
314{
315 return (char*)"axis3d";
316}
317
318////////////////////////////////////////////////////////////////////////////////
319/// Paint axis over 3D view on the TPad
320
322{
323 TGaxis axis;
324 PaintAxis(&axis, 90);
325}
326
327////////////////////////////////////////////////////////////////////////////////
328/// Draw the axis for TView object.
329///
330/// The original idea belongs:
331///
332/// void THistPainter::PaintLegoAxis(TGaxis *axis, Double_t ang)
333
335{
336 static Double_t epsil = 0.001;
337
338 Double_t cosa, sina;
339 Double_t bmin, bmax;
340 Double_t r[24] /* was [3][8] */;
341 Int_t ndiv, i;
342 Double_t x1[3], x2[3], y1[3], y2[3], z1[3], z2[3], av[24] /* was [3][8] */;
343 char chopax[10];
344 Int_t ix1, ix2, iy1, iy2, iz1, iz2;
345 Double_t rad;
346
347 TView *view = gPad->GetView();
348 if (!view) {
349 Error("PaintAxis", "no TView in current pad");
350 return;
351 }
352
353 rad = TMath::ATan(1.) * 4. / 180.;
354 cosa = TMath::Cos(ang*rad);
355 sina = TMath::Sin(ang*rad);
356
357 view->AxisVertex(ang, av, ix1, ix2, iy1, iy2, iz1, iz2);
358 for (i = 1; i <= 8; ++i) {
359 r[i*3 - 3] = av[i*3 - 3] + av[i*3 - 2]*cosa;
360 r[i*3 - 2] = av[i*3 - 2]*sina;
361 r[i*3 - 1] = av[i*3 - 1];
362 }
363
364 view->WCtoNDC(&r[ix1*3 - 3], x1);
365 view->WCtoNDC(&r[ix2*3 - 3], x2);
366 view->WCtoNDC(&r[iy1*3 - 3], y1);
367 view->WCtoNDC(&r[iy2*3 - 3], y2);
368 view->WCtoNDC(&r[iz1*3 - 3], z1);
369 view->WCtoNDC(&r[iz2*3 - 3], z2);
370
371 view->SetAxisNDC(x1, x2, y1, y2, z1, z2);
372
373 Double_t *rmin = view->GetRmin();
374 Double_t *rmax = view->GetRmax();
375
376 axis->SetLineWidth(1);
377
378 for (i=0;i<3;i++) {
379
380 // X axis drawing
381 Double_t ax[2], ay[2];
382 Bool_t logAx = kFALSE;
383 memset(chopax,0,sizeof(chopax));
384 switch (i) {
385 case 0 :
386 ax[0] = x1[0]; ax[1] = x2[0];
387 ay[0] = x1[1]; ay[1] = x2[1];
388 logAx = gPad->GetLogx();
389 break;
390 case 1 :
391 if (TMath::Abs(y1[0] - y2[0]) < epsil) y2[0] = y1[0];
392 ax[0] = y1[0]; ax[1] = y2[0];
393 ay[0] = y1[1]; ay[1] = y2[1];
394 logAx = gPad->GetLogy();
395 break;
396 case 2 :
397 ax[0] = z1[0]; ax[1] = z2[0];
398 ay[0] = z1[1]; ay[1] = z2[1];
399 strlcpy(chopax, "SDH+=",10);
400 logAx = gPad->GetLogz();
401 break;
402 default:
403 assert(0);
404 continue;
405 };
406
407 // If the axis is too short - skip it
408 if ( ( TMath::Abs(ax[0] - ax[1]) + TMath::Abs(ay[0] - ay[1])) < epsil ) continue;
409
410 if (i != 2 ) {
411 if (ax[0] > ax[1]) strlcpy(chopax, "SDHV=+",10);
412 else strlcpy(chopax, "SDHV=-",10);
413 }
414
415 if (i==1 && (TMath::Abs(z1[0] - z2[0]) + TMath::Abs(z1[1] - z2[1])) < epsil)
416 strlcpy(chopax, "SDH+=",10);
417
418 // Initialize the axis options
419 if (logAx) {
420 strlcat(chopax,"G",10);
421 bmin = TMath::Power(10, rmin[i]);
422 bmax = TMath::Power(10, rmax[i]);
423 } else {
424 bmin = rmin[i];
425 bmax = rmax[i];
426 }
427
428 axis->SetLineColor( fAxis[i].GetAxisColor());
429 axis->SetTextFont( fAxis[i].GetTitleFont());
430 axis->SetTextColor( fAxis[i].GetTitleColor());
431 axis->SetTickSize( fAxis[i].GetTickLength());
432 axis->SetLabelColor( fAxis[i].GetLabelColor());
433 axis->SetLabelFont( fAxis[i].GetLabelFont());
435 axis->SetLabelSize( fAxis[i].GetLabelSize());
436 axis->SetTitle( fAxis[i].GetTitle());
438 axis->SetTitleSize( fAxis[i].GetTitleSize());
439 enum { kCenterTitle = BIT(12) }; // to be removed with the last version of ROOT
440 axis->SetBit(kCenterTitle, fAxis[i].TestBit(kCenterTitle));
441
442 //*-*- Initialize the number of divisions. If the
443 //*-*- number of divisions is negative, option 'N' is required.
444 ndiv = fAxis[i].GetNdivisions();
445 if (ndiv < 0) {
446 ndiv = -ndiv;
447 chopax[6] = 'N';
448 }
449
450 // Option time display is required ?
451 if (fAxis[i].GetTimeDisplay()) {
452 strlcat(chopax,"t",10);
453 if (strlen(fAxis[i].GetTimeFormatOnly()) == 0) {
454 axis->SetTimeFormat(fAxis[i].ChooseTimeFormat(bmax-bmin));
455 } else {
456 axis->SetTimeFormat(fAxis[i].GetTimeFormat());
457 }
458 }
459 axis->SetOption(chopax);
460 axis->PaintAxis(ax[0], ay[0], ax[1], ay[1], bmin, bmax, ndiv, chopax);
461 }
462}
463
464////////////////////////////////////////////////////////////////////////////////
465/// Convert "screen pixel" coordinates to some center of 3D WC coordinate
466/// if view and gPad present
467
469{
470 Double_t *thisPoint = nullptr;
471 if (!view && gPad) view = gPad->GetView();
472 if (view) {
473 Double_t x[3] = {px,py,0.5}; // ((TPad *)thisPad)->AbsPixeltoXY(px,py,x[0],x[1]);
474 Double_t min[3], max[3];
475 view->GetRange(min,max);
476 Int_t i;
477 for (i =0; i<3;i++) min[i] = (max[i]+min[i])/2;
478 view->WCtoNDC(min,max);
479 min[0] = x[0]; min[1] = x[1];
480 min[2] = max[2];
481 view->NDCtoWC(min, x);
482 for (i=0;i<3;i++) point3D[i] = x[i];
483 thisPoint = point3D;
484 }
485 return thisPoint;
486}
487
488////////////////////////////////////////////////////////////////////////////////
489/// Save primitive as a C++ statement(s) on output stream out
490
491void TAxis3D::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
492{
493 fAxis[0].SaveAttributes(out,GetName(),"->GetXaxis()");
494 fAxis[1].SaveAttributes(out,GetName(),"->GetYaxis()");
495 fAxis[2].SaveAttributes(out,GetName(),"->GetZaxis()");
496}
497
498////////////////////////////////////////////////////////////////////////////////
499/// Replace current attributes by current style.
500
502{
503 if (gStyle->IsReading()) {
504 fAxis[0].ResetAttAxis("X");
505 fAxis[1].ResetAttAxis("Y");
506 fAxis[2].ResetAttAxis("Z");
507
508 fAxis[0].SetTitle("x");
512 } else {
521 gStyle->SetTitleSize (fAxis[0].GetTitleSize(), "x");
522 gStyle->SetTitleColor (fAxis[0].GetTitleColor(), "x");
523 gStyle->SetTitleFont (fAxis[0].GetTitleFont(), "x");
524
533 gStyle->SetTitleSize (fAxis[1].GetTitleSize(), "y");
534 gStyle->SetTitleColor (fAxis[1].GetTitleColor(), "y");
535 gStyle->SetTitleFont (fAxis[1].GetTitleFont(), "y");
536
545 gStyle->SetTitleSize (fAxis[2].GetTitleSize(), "z");
546 gStyle->SetTitleColor (fAxis[2].GetTitleColor(), "z");
547 gStyle->SetTitleFont (fAxis[2].GetTitleFont(), "z");
548 }
549}
550
551////////////////////////////////////////////////////////////////////////////////
552/// Return the axis index by its name
553
555{
556 char achoice = toupper(axis[0]);
557 if (achoice == 'X') return 0;
558 if (achoice == 'Y') return 1;
559 if (achoice == 'Z') return 2;
560 return -1;
561}
562
563////////////////////////////////////////////////////////////////////////////////
564/// Get number of divisions.
565
567{
568 Int_t ax = AxisChoice(axis);
569 if (ax < 0) return 0;
570 return fAxis[ax].GetNdivisions();
571}
572
573////////////////////////////////////////////////////////////////////////////////
574/// Get axis color.
575
577{
578 Int_t ax = AxisChoice(axis);
579 if (ax < 0) return 0;
580 return fAxis[ax].GetAxisColor();
581}
582
583////////////////////////////////////////////////////////////////////////////////
584/// Get label color.
585
587{
588 Int_t ax = AxisChoice(axis);
589 if (ax < 0) return 0;
590 return fAxis[ax].GetLabelColor();
591}
592
593////////////////////////////////////////////////////////////////////////////////
594/// Get label font.
595
597{
598 Int_t ax = AxisChoice(axis);
599 if (ax < 0) return 0;
600 return fAxis[ax].GetLabelFont();
601}
602
603////////////////////////////////////////////////////////////////////////////////
604/// Get label offset.
605
607{
608 Int_t ax = AxisChoice(axis);
609 if (ax < 0) return 0;
610 return fAxis[ax].GetLabelOffset();
611}
612
613////////////////////////////////////////////////////////////////////////////////
614/// Get label size.
615
617{
618 Int_t ax = AxisChoice(axis);
619 if (ax < 0) return 0;
620 return fAxis[ax].GetLabelSize();
621}
622
623////////////////////////////////////////////////////////////////////////////////
624/// Get tick mark length.
625
627{
628 Int_t ax = AxisChoice(axis);
629 if (ax < 0) return 0;
630 return fAxis[ax].GetTickLength();
631}
632
633////////////////////////////////////////////////////////////////////////////////
634/// Get title offset.
635
637{
638 Int_t ax = AxisChoice(axis);
639 if (ax < 0) return 0;
640 return fAxis[ax].GetTitleOffset();
641}
642
643////////////////////////////////////////////////////////////////////////////////
644
645#define AXISCHOICE \
646 Int_t i = AxisChoice(axis); \
647 Int_t nax = 1; \
648 if (i == -1) { i = 0; nax = 3;}\
649 for (Int_t ax=i;ax<nax+i;ax++)
650
651////////////////////////////////////////////////////////////////////////////////
652/// Set number of divisions.
653
658
659////////////////////////////////////////////////////////////////////////////////
660/// Set axis color.
661
663{
664 AXISCHOICE {fAxis[ax].SetAxisColor(color);}
665}
666
667////////////////////////////////////////////////////////////////////////////////
668/// Set axis range.
669
671{
672 Int_t ax = AxisChoice(axis);
673 if (ax < 0) return;
674 TAxis *theAxis = &fAxis[ax];
675 Int_t bin1 = theAxis->FindBin(xmin);
676 Int_t bin2 = theAxis->FindBin(xmax);
677 theAxis->SetRange(bin1, bin2);
678}
679
680////////////////////////////////////////////////////////////////////////////////
681/// Set label color.
682
684{
685 AXISCHOICE { fAxis[ax].SetLabelColor(color); }
686}
687
688////////////////////////////////////////////////////////////////////////////////
689/// Set label font.
690
692{
693 AXISCHOICE { fAxis[ax].SetLabelFont(font); }
694}
695
696////////////////////////////////////////////////////////////////////////////////
697/// Set label offset.
698
703
704////////////////////////////////////////////////////////////////////////////////
705/// Set label size.
706
711
712////////////////////////////////////////////////////////////////////////////////
713/// Set tick mark length.
714
719
720////////////////////////////////////////////////////////////////////////////////
721/// Set title offset.
722
727#undef AXISCHOICE
728
729////////////////////////////////////////////////////////////////////////////////
730/// Returns the "pad" Axis3D object pointer if any.
731
733{
734 TObject *obj = nullptr;
735 TVirtualPad *thisPad=pad;
736 if (!thisPad) thisPad = gPad;
737 if (thisPad) {
738 // Find axis in the current thisPad
739 obj = thisPad->FindObject(TAxis3D::fgRulerName);
740 if (!(obj && obj->InheritsFrom(Class()->GetName()))) obj = nullptr;
741 }
742 return (TAxis3D *)obj;
743}
744
745////////////////////////////////////////////////////////////////////////////////
746/// Turn ON / OFF the "Ruler", TAxis3D object attached
747/// to the current pad
748
750{
751 TAxis3D *ax = nullptr;
752 TVirtualPad *thisPad=pad;
753 if (!thisPad) thisPad = gPad;
754 if (thisPad && thisPad->GetView() ) {
755 TAxis3D *a = GetPadAxis(pad);
756 if (a) delete a;
757 else {
758 ax = new TAxis3D;
759 ax->SetBit(kCanDelete);
760 ax->Draw();
761 }
762 thisPad->Modified();
763 thisPad->Update();
764 }
765 return ax;
766}
767
768////////////////////////////////////////////////////////////////////////////////
769/// Turn ON / OFF the "Ruler" and "zoom mode" of the TAxis3D object attached
770/// to the current pad (if pad = 0; gPad is used "by default")
771///
772/// User is given a chance to either:
773/// 1. move the center of the 3D scene at the cursor position
774/// 2. zoom view with mouse "drugging" the bounder rectangle with "left" mouse
775/// 3. Change the axis attributes via TContextMenu with "right mouse button click"
776
778{
779 TAxis3D *ax = nullptr;
780 TVirtualPad *thisPad=pad;
781 if (!thisPad) thisPad = gPad;
782 if (thisPad && thisPad->GetView()) {
783 // Find axis in the current thisPad
784 TList *l = thisPad->GetListOfPrimitives();
786 if (o && o->InheritsFrom(Class()->GetName())) { // Find axis
787 if (o != l->Last()) { // make sure the TAxis3D is the last object of the Pad.
788 l->Remove(o);
789 l->AddLast(o);
790 }
791 ax = (TAxis3D *)o;
792 } else { // There is no
793 ax = new TAxis3D;
794 ax->SetBit(kCanDelete);
795 ax->Draw();
796 }
797 ax->SwitchZoom();
798 }
799 return ax;
800}
@ kButton1Motion
Definition Buttons.h:20
@ kButton1Up
Definition Buttons.h:19
@ kButton1Down
Definition Buttons.h:17
@ kCross
Definition GuiTypes.h:375
#define b(i)
Definition RSha256.hxx:100
#define a(i)
Definition RSha256.hxx:99
cudaEvent_t event
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
short Style_t
Style number (short)
Definition RtypesCore.h:97
short Color_t
Color number (short)
Definition RtypesCore.h:100
char Char_t
Character 1 byte (char)
Definition RtypesCore.h:52
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
#define BIT(n)
Definition Rtypes.h:90
@ kRed
Definition Rtypes.h:66
@ kGreen
Definition Rtypes.h:66
@ kBlue
Definition Rtypes.h:66
#define AXISCHOICE
Definition TAxis3D.cxx:645
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
float xmin
float xmax
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
#define gPad
virtual Color_t GetLabelColor() const
Definition TAttAxis.h:39
virtual Int_t GetNdivisions() const
Definition TAttAxis.h:37
virtual Color_t GetAxisColor() const
Definition TAttAxis.h:38
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
Definition TAttAxis.cxx:279
virtual Float_t GetLabelOffset() const
Definition TAttAxis.h:41
virtual void SetAxisColor(Color_t color=1, Float_t alpha=1.)
Set color of the line axis and tick marks.
Definition TAttAxis.cxx:141
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
Definition TAttAxis.cxx:184
virtual Style_t GetLabelFont() const
Definition TAttAxis.h:40
virtual void SetLabelOffset(Float_t offset=0.005)
Set distance between the axis and the labels.
Definition TAttAxis.cxx:172
virtual void SetLabelFont(Style_t font=62)
Set labels' font.
Definition TAttAxis.cxx:161
virtual Float_t GetLabelSize() const
Definition TAttAxis.h:42
virtual Float_t GetTickLength() const
Definition TAttAxis.h:46
virtual void ResetAttAxis(Option_t *option="")
Reset axis attributes.
Definition TAttAxis.cxx:78
virtual Float_t GetTitleOffset() const
Definition TAttAxis.h:44
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length.
Definition TAttAxis.cxx:265
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
Definition TAttAxis.cxx:214
virtual void SetLabelColor(Color_t color=1, Float_t alpha=1.)
Set color of labels.
Definition TAttAxis.cxx:151
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:47
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:44
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Definition TAttText.h:50
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
Definition TAttText.h:52
void MoveCursor(TVirtualPad &parent, Int_t px, Int_t py)
Definition TAxis3D.cxx:197
TAxis3DInteractive(TVirtualPad &parent, Int_t px, Int_t py)
Definition TAxis3D.cxx:189
The 3D axis painter class.
Definition TAxis3D.h:31
static TAxis3D * ToggleRulers(TVirtualPad *pad=nullptr)
Turn ON / OFF the "Ruler", TAxis3D object attached to the current pad.
Definition TAxis3D.cxx:749
virtual Float_t GetLabelSize(Option_t *axis="X") const
Get label size.
Definition TAxis3D.cxx:616
Bool_t SwitchZoom()
Definition TAxis3D.h:113
virtual void SetNdivisions(Int_t n=510, Option_t *axis="*")
Set number of divisions.
Definition TAxis3D.cxx:654
void UseCurrentStyle() override
Replace current attributes by current style.
Definition TAxis3D.cxx:501
void Paint(Option_t *option="") override
Paint axis over 3D view on the TPad.
Definition TAxis3D.cxx:321
void PaintAxis(TGaxis *axis, Float_t ang)
Draw the axis for TView object.
Definition TAxis3D.cxx:334
virtual void SetLabelOffset(Float_t offset=0.005, Option_t *axis="*")
Set label offset.
Definition TAxis3D.cxx:699
void Browse(TBrowser *b) override
Add all 3 axes to the TBrowser.
Definition TAxis3D.cxx:162
virtual void SetLabelFont(Style_t font=62, Option_t *axis="*")
Set label font.
Definition TAxis3D.cxx:691
TAxis fAxis[3]
Definition TAxis3D.h:38
virtual Style_t GetLabelFont(Option_t *axis="X") const
Get label font.
Definition TAxis3D.cxx:596
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
Definition TAxis3D.cxx:491
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition TAxis3D.cxx:212
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a line.
Definition TAxis3D.cxx:170
virtual Float_t GetLabelOffset(Option_t *axis="X") const
Get label offset.
Definition TAxis3D.cxx:606
virtual void SetAxisRange(Double_t xmin, Double_t xmax, Option_t *axis="*")
Set axis range.
Definition TAxis3D.cxx:670
virtual Float_t GetTickLength(Option_t *axis="X") const
Get tick mark length.
Definition TAxis3D.cxx:626
virtual void SetLabelSize(Float_t size=0.02, Option_t *axis="*")
Set label size.
Definition TAxis3D.cxx:707
Int_t AxisChoice(Option_t *axis) const
Return the axis index by its name.
Definition TAxis3D.cxx:554
static TClass * Class()
static TAxis3D * GetPadAxis(TVirtualPad *pad=nullptr)
Returns the "pad" Axis3D object pointer if any.
Definition TAxis3D.cxx:732
virtual Color_t GetAxisColor(Option_t *axis="X") const
Get axis color.
Definition TAxis3D.cxx:576
virtual void SetAxisColor(Color_t color=1, Option_t *axis="*")
Set axis color.
Definition TAxis3D.cxx:662
char * GetObjectInfo(Int_t px, Int_t py) const override
Dummy method returns the const char * to "axis3d".
Definition TAxis3D.cxx:313
virtual Color_t GetLabelColor(Option_t *axis="X") const
Get label color.
Definition TAxis3D.cxx:586
Bool_t fZoomMode
Definition TAxis3D.h:42
virtual Float_t GetTitleOffset(Option_t *axis="X") const
Get title offset.
Definition TAxis3D.cxx:636
static TAxis3D * ToggleZoom(TVirtualPad *pad=nullptr)
Turn ON / OFF the "Ruler" and "zoom mode" of the TAxis3D object attached to the current pad (if pad =...
Definition TAxis3D.cxx:777
void InitSet()
Initialization.
Definition TAxis3D.cxx:147
virtual Int_t GetNdivisions(Option_t *axis="X") const
Get number of divisions.
Definition TAxis3D.cxx:566
void Copy(TObject &hnew) const override
Copy axis3d.
Definition TAxis3D.cxx:137
static const char * fgRulerName
Definition TAxis3D.h:40
virtual void SetTickLength(Float_t length=0.02, Option_t *axis="*")
Set tick mark length.
Definition TAxis3D.cxx:715
virtual void SetLabelColor(Color_t color=1, Option_t *axis="*")
Set label color.
Definition TAxis3D.cxx:683
Bool_t fStickyZoom
Definition TAxis3D.h:43
TAxis3D()
Normal constructor.
Definition TAxis3D.cxx:107
static Double_t * PixeltoXYZ(Double_t px, Double_t py, Double_t *point3D, TView *view=nullptr)
Convert "screen pixel" coordinates to some center of 3D WC coordinate if view and gPad present.
Definition TAxis3D.cxx:468
virtual void SetTitleOffset(Float_t offset=1, Option_t *axis="*")
Set title offset.
Definition TAxis3D.cxx:723
TAxis * fSelected
! The selected axis to play with
Definition TAxis3D.h:41
Class to manage histogram axis.
Definition TAxis.h:32
const char * GetTitle() const override
Returns title of object.
Definition TAxis.h:137
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to an axis.
Definition TAxis.cxx:260
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition TAxis.cxx:276
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
Definition TAxis.cxx:293
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax)
Initialize axis with fix bins.
Definition TAxis.cxx:790
void SaveAttributes(std::ostream &out, const char *name, const char *subname) override
Save axis attributes as C++ statement(s) on output stream out.
Definition TAxis.cxx:715
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis using bin numbers.
Definition TAxis.cxx:1061
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
The axis painter class.
Definition TGaxis.h:26
void SetTimeFormat(const char *tformat)
Change the format used for time plotting.
Definition TGaxis.cxx:2937
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.
Definition TGaxis.cxx:1006
void SetTitleOffset(Float_t titleoffset=1)
Definition TGaxis.h:130
void SetLabelFont(Int_t labelfont)
Definition TGaxis.h:107
void SetTitleSize(Float_t titlesize)
Definition TGaxis.h:131
virtual void SetTitle(const char *title="")
Change the title of the axis.
Definition TGaxis.cxx:2910
void SetLabelOffset(Float_t labeloffset)
Definition TGaxis.h:108
void SetLabelColor(Int_t labelcolor)
Definition TGaxis.h:106
void SetTickSize(Float_t ticksize)
Definition TGaxis.h:124
void SetLabelSize(Float_t labelsize)
Definition TGaxis.h:109
void SetOption(Option_t *option="")
To set axis options.
Definition TGaxis.cxx:2902
A doubly linked list.
Definition TList.h:38
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
void Copy(TObject &named) const override
Copy this to obj.
Definition TNamed.cxx:93
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:173
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:149
Mother of all ROOT objects.
Definition TObject.h:42
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:204
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition TObject.cxx:424
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:886
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:548
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1096
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:292
@ kCanDelete
if object in a list can be deleted
Definition TObject.h:71
void SetAxisColor(Color_t color=1, Option_t *axis="X")
Set color to draw the axis line and tick marks.
Definition TStyle.cxx:1324
Bool_t IsReading() const
Definition TStyle.h:300
void SetTitleFont(Style_t font=62, Option_t *axis="X")
Definition TStyle.cxx:1776
void SetTitleOffset(Float_t offset=1, Option_t *axis="X")
Specify a parameter offset to control the distance between the axis and the axis title.
Definition TStyle.cxx:1799
void SetTitleColor(Color_t color=1, Option_t *axis="X")
Definition TStyle.cxx:1755
void SetLabelFont(Style_t font=62, Option_t *axis="X")
Set font number used to draw axis labels.
Definition TStyle.cxx:1414
void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X")
Set offset between axis and axis labels.
Definition TStyle.cxx:1430
void SetTitleSize(Float_t size=0.02, Option_t *axis="X")
Definition TStyle.cxx:1818
void SetTickLength(Float_t length=0.03, Option_t *axis="X")
Set the tick marks length for an axis.
Definition TStyle.cxx:1736
void SetNdivisions(Int_t n=510, Option_t *axis="X")
Set the number of divisions to draw an axis.
Definition TStyle.cxx:1310
void SetLabelColor(Color_t color=1, Option_t *axis="X")
Set axis labels color.
Definition TStyle.cxx:1394
void SetLabelSize(Float_t size=0.04, Option_t *axis="X")
Set size of axis labels.
Definition TStyle.cxx:1445
See TView3D.
Definition TView.h:25
virtual Double_t * GetRmax()=0
virtual void SetAxisNDC(const Double_t *x1, const Double_t *x2, const Double_t *y1, const Double_t *y2, const Double_t *z1, const Double_t *z2)=0
virtual Double_t * GetRmin()=0
virtual void WCtoNDC(const Float_t *pw, Float_t *pn)=0
virtual void NDCtoWC(const Float_t *pn, Float_t *pw)=0
virtual void GetRange(Float_t *min, Float_t *max)=0
virtual void AxisVertex(Double_t ang, Double_t *av, Int_t &ix1, Int_t &ix2, Int_t &iy1, Int_t &iy2, Int_t &iz1, Int_t &iz2)=0
Helper class to store interactive parameters for individual objects Should be used via gPad->Interact...
Definition TVirtualPad.h:77
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:53
virtual void Modified(Bool_t flag=1)=0
virtual TList * GetListOfPrimitives() const =0
virtual void UpdateAsync()=0
virtual Double_t AbsPixeltoX(Double_t px)=0
virtual void Update()=0
virtual void PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="")=0
virtual Double_t AbsPixeltoY(Double_t py)=0
virtual TView * GetView() const =0
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:249
Double_t ATan(Double_t)
Returns the principal value of the arc tangent of x, expressed in radians.
Definition TMath.h:653
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Definition TMath.h:734
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:607
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:601
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:122
TLine l
Definition textangle.C:4