32#include "TGLIncludes.h"
53 fPhysicalShapeColor(nullptr),
57 fXAxis(hist->GetXaxis()),
58 fYAxis(hist->GetYaxis()),
59 fZAxis(hist->GetZaxis()),
62 fUpdateSelection(
kTRUE),
71 fSelectionBase(kTrueColorSelectionBase),
86 fPhysicalShapeColor(nullptr),
90 fXAxis(
data->GetXAxis()),
91 fYAxis(
data->GetYAxis()),
92 fZAxis(
data->GetZAxis()),
95 fUpdateSelection(
kTRUE),
104 fSelectionBase(kTrueColorSelectionBase),
118 : fPadColor(nullptr),
119 fPhysicalShapeColor(nullptr),
128 fUpdateSelection(
kTRUE),
137 fSelectionBase(kTrueColorSelectionBase),
177 const Float_t pos[] = {0.f, 0.f, 0.f, 1.f};
238 Error(
"TGLPlotPainter::PrintPlot",
"Could not (re)open ps file for GL output");
910 Error(
"TGLPlotCoordinates::SetRangesCartesian",
"Cannot set X axis to log scale");
917 Error(
"TGLPlotCoordinates::SetRangesCartesian",
"Cannot set Y axis to log scale");
927 Error(
"TGLPlotCoordinates::SetRangesCartesian",
"Cannot set Z axis to log scale");
931 Error(
"TGLPlotCoordinates::SetRangesCartesian",
932 "Log scale is requested for Z, but maximum less or equal 0. (%f)",
zRange.second);
941 if (!
x || !
y || !z) {
942 Error(
"TGLPlotCoordinates::SetRangesCartesian",
"Zero axis range.");
997 if (!
x || !
y || !z) {
998 Error(
"TGLPlotCoordinates::SetRanges",
"Zero axis range.");
1049 if (!
x || !
y || !z) {
1050 Error(
"TGLPlotCoordinates::SetRangesCartesian",
"Zero axis range.");
1089 Error(
"TGLPlotCoordinates::SetRangesPolar",
"To many PHI sectors");
1102 Error(
"TGLPlotCoordinates::SetRangesPolar",
1103 "Log scale is requested for Z, but maximum less or equal 0. (%f)",
zRange.second);
1109 Error(
"TGLPlotCoordinates::SetRangesPolar",
"Zero axis range.");
1147 Error(
"TGLPlotCoordinates::SetRangesCylindrical",
"To many PHI sectors");
1151 Error(
"TGLPlotCoordinates::SetRangesCylindrical",
"Cannot set Y axis to log scale");
1160 if (!
x || !
y || !z) {
1161 Error(
"TGLPlotCoordinates::SetRangesCylindrical",
"Zero axis range.");
1196 Error(
"TGLPlotCoordinates::SetRangesSpherical",
"To many PHI sectors");
1204 Error(
"TGLPlotCoordinates::SetRangesSpherical",
"To many THETA sectors");
1273 if (
range.second <= 0.)
1278 if (
range.first <= 0.) {
1281 if (bin > bins.second)
1286 if (bin > bins.second)
1338 if (!factor) factor = 1.;
1340 Warning(
"TGLPlotPainter::ExtractAxisZInfo",
1341 "Negative factor, negative ranges - possible incorrect behavior");
1378 Error(
"FindAxisRange",
"TH2Poly returned empty list of bins");
1390 Error(
"FindAxisRange",
"Failed to switch Z axis to logarithmic scale");
1476 (
box[0].Z() +
box[4].Z()) / 2);
1752 if (pos >=
fAxis->GetBinLowEdge(i) && pos <=
fAxis->GetBinUpEdge(i)) {
1764 low =
fAxis->GetFirst();
1864 for (
Int_t level = low; level <
up; ++ level)
1865 val +=
fHist->GetBinContent(i, level,
j);
1889 for (
Int_t level = low; level <
up; ++ level)
1890 val +=
fHist->GetBinContent(level, i,
j);
1914 for (
Int_t level = low; level <
up; ++ level)
1915 val +=
fHist->GetBinContent(i,
j, level);
2089 (
box[0].Y() +
box[2].Y()) / 2,
2090 (
box[0].Z() +
box[4].Z()) / 2};
2100 fPainter->RestoreModelviewMatrix();
2137 glColor4ub(color[0], color[1], color[2], 150);
2164 const std::vector<Double_t> &
levels)
2192 glColor4ub(color[0], color[1], color[2], opacity);
2234 +
gPad->GetYlowNDC() *
gPad->GetWh())));
2236 +
gPad->GetYlowNDC() *
gPad->GetWh())));
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
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 Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
R__EXTERN TVirtualMutex * gROOTMutex
R__EXTERN TStyle * gStyle
#define R__LOCKGUARD(mutex)
R__EXTERN TVirtualPS * gVirtualPS
const TGLPlotPainter * fPainter
PlotTranslation(const TGLPlotPainter *painter)
Class to manage histogram axis.
Bool_t IsVariableBinSize() const
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
virtual Int_t FindFixBin(Double_t x) const
Find bin number corresponding to abscissa x.
Int_t GetLast() const
Return last bin on the axis i.e.
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Int_t GetFirst() const
Return first bin on the axis i.e.
virtual Int_t GetEntries() const
The color creation and management class.
A 3-Dim function with parameters.
Used by plot-painters to determine the area of the plot that is cut away.
void MoveBox(Int_t px, Int_t py, Int_t axisID)
Move box cut along selected direction.
void AdjustBox()
Box cut is limited by plot's sizes.
Bool_t IsInCut(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax) const
Check, if box defined by xmin/xmax etc. is in cut.
void DrawBox(Bool_t selectionPass, Int_t selected) const
Draw cut as a semi-transparent box.
void TurnOnOff()
Turn the box cut on/off.
const TGLPlotBox *const fPlotBox
void StartMovement(Int_t px, Int_t py)
Start cut's movement.
virtual ~TGLBoxCut()
Destructor.
void SetActive(Bool_t a)
Turn the box cut on/off.
void ResetBoxGeometry()
Set geometry using plot's back box.
TGLBoxCut(const TGLPlotBox *plotBox)
Constructor.
void DisableTexture() const
Disable 1D texture.
Double_t GetTexCoord(Double_t z) const
Get tex coordinate.
Bool_t GeneratePalette(UInt_t paletteSize, const Rgl::Range_t &zRange, Bool_t checkSize=kTRUE)
Try to find colors for palette.
void EnableTexture(Int_t mode) const
Enable 1D texture.
static void CloseEmbeddedPS()
this function used by gl-in-pad Restore the gVirtualPS output stream
static void StartEmbeddedPS()
this function used by gl-in-pad
Implementation of a box around a histogram/function for plot-painters.
Int_t FindFrontPoint() const
Convert 3d points into window coordinate system and find the nearest.
const TGLVertex3 * Get3DBox() const
Get 3D box.
const TGLVertex3 * Get2DBox() const
Get 2D box.
void SetFrameColor(const TColor *color)
Back box color.
Int_t GetFrontPoint() const
The nearest point.
Camera for TGLPlotPainter and sub-classes.
Int_t GetY() const
viewport[1]
void Apply(Double_t phi, Double_t theta) const
Applies rotations and translations before drawing.
Int_t GetX() const
viewport[0]
void SetCamera() const
Viewport and projection.
Int_t GetWidth() const
viewport[2]
Int_t GetHeight() const
viewport[3]
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
Double_t GetZLength() const
Z length.
void SetXLog(Bool_t xLog)
If log changed, sections must be reset, set fModified.
Bool_t SetRanges(const TH1 *hist, Bool_t errors=kFALSE, Bool_t zBins=kFALSE)
Set bin ranges, ranges.
const Rgl::Range_t & GetXRangeScaled() const
Scaled range.
const Rgl::BinRange_t & GetZBins() const
Z bins range.
Rgl::Range_t fZRangeScaled
Bool_t GetXLog() const
Get X log.
const Rgl::BinRange_t & GetXBins() const
X bins range.
const Rgl::Range_t & GetZRange() const
Z range.
virtual ~TGLPlotCoordinates()
Destructor.
Bool_t SetRangesPolar(const TH1 *hist)
Set bin ranges, ranges, etc.
const Rgl::Range_t & GetYRangeScaled() const
Scaled range.
Bool_t SetRangesCartesian(const TH1 *hist, Bool_t errors=kFALSE, Bool_t zBins=kFALSE)
Set bin ranges, ranges, etc.
void SetCoordType(EGLCoordType type)
If coord type was changed, plot must reset sections (if any), set fModified.
void ResetModified()
Reset modified.
TGLPlotCoordinates()
Constructor.
Bool_t SetRangesCylindrical(const TH1 *hist)
Set ranges cylindrical.
Bool_t GetYLog() const
Get Y log.
Bool_t GetZLog() const
Get Z log.
Bool_t Modified() const
Modified.
Int_t GetNXBins() const
Number of X bins.
const Rgl::Range_t & GetZRangeScaled() const
Scaled range.
const Rgl::Range_t & GetYRange() const
Y range.
Double_t GetXLength() const
X length.
void SetZLog(Bool_t zLog)
If log changed, sections must be reset, set fModified.
void SetYLog(Bool_t yLog)
If log changed, sections must be reset, set fModified.
Bool_t SetRangesSpherical(const TH1 *hist)
Set ranges spherical.
const Rgl::Range_t & GetXRange() const
X range.
Int_t GetNYBins() const
Number of Y bins.
Rgl::Range_t fYRangeScaled
EGLCoordType GetCoordType() const
Get coordinates type.
Rgl::Range_t fXRangeScaled
const Rgl::BinRange_t & GetYBins() const
Y bins range.
Int_t GetNZBins() const
Number of Z bins.
Double_t GetYLength() const
Y length.
Double_t GetFactor() const
Get factor.
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms,...
void InvalidateSelection()
Selection must be updated.
void DrawSections() const
Draw sections (if any).
TGLPlotPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord, Bool_t xoySelectable, Bool_t xozSelectable, Bool_t yozSelectable)
TGLPlotPainter's ctor.
std::vector< Double_t > fZLevels
virtual void SetFrameColor(const TColor *frameColor)
Set plot's back box color.
TGLSelectionBuffer fSelection
void RestoreModelviewMatrix() const
virtual void DrawPaletteAxis() const
Draw. Palette. Axis.
@ kTrueColorSelectionBase
@ kHighColorSelectionBase
void SetPadColor(const TColor *color)
Used in a pad.
const TColor * GetPadColor() const
Get pad color.
virtual void DrawPlot() const =0
void PrintPlot() const
Generate PS using gl2ps.
virtual void InitGL() const =0
TGLPlotCoordinates * fCoord
void Paint() override
Draw lego/surf/whatever you can.
virtual void DrawSectionXOY() const =0
Bool_t PlotSelected(Int_t px, Int_t py) override
Read color buffer content to find selected object.
void SaveProjectionMatrix() const
virtual void DrawSectionYOZ() const =0
void SaveModelviewMatrix() const
void MoveSection(Int_t px, Int_t py)
Create dynamic profile using selected plane.
virtual void DeInitGL() const =0
void RestoreProjectionMatrix() const
virtual void ClearBuffers() const
virtual void DrawSectionXOZ() const =0
const UChar_t * GetPixelColor(Int_t px, Int_t py) const
Get pixel color.
void ReadColorBuffer(Int_t width, Int_t height)
Read color buffer.
void FindMinMax(Int_t sliceBegin, Int_t sliceEnd) const
Find minimum and maximum for slice.
void DrawSliceFrame(Int_t low, Int_t up) const
Draw slice frame.
Bool_t PreparePalette() const
Initialize color palette.
const TGLPlotCoordinates * fCoord
void PrepareTexCoords(Double_t pos, Int_t sliceBegin, Int_t sliceEnd) const
Prepare TexCoords.
void DrawSlice(Double_t pos) const
Draw slice.
TGLTH3Slice(const TString &sliceName, const TH3 *hist, const TGLPlotCoordinates *coord, const TGLPlotBox *box, ESliceAxis axis)
Constructor.
void SetSliceWidth(Int_t width=1)
Set Slice width.
void DrawSliceTextured(Double_t pos) const
Draw slice textured.
TGL2DArray< Double_t > fTexCoords
static void InitializeIfNeeded()
Initialize globals that require other libraries to be initialized.
static Float_t GetScreenScalingFactor()
Returns scaling factor between screen points and GL viewport pixels.
3 component (x/y/z) vector class.
3 component (x/y/z) vertex class.
@ kClipFrame
Clip to the frame boundary.
TH1 is the base class of all histogram classes in ROOT.
virtual Double_t GetMinimumStored() const
virtual Double_t GetNormFactor() const
virtual Int_t GetBin(Int_t binx, Int_t biny=0, Int_t binz=0) const
Return Global bin number corresponding to binx,y,z.
virtual Double_t GetCellError(Int_t binx, Int_t biny) const
virtual Double_t GetMaximumStored() const
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
2D Histogram with Polygonal Bins
TList * GetBins()
Returns the TList of all bins in the histogram.
Double_t GetMinimum() const
Returns the minimum value of the histogram.
Double_t GetMaximum() const
Returns the maximum value of the histogram.
The 3-D histogram classes derived from the 1-D histogram classes.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
Bool_t GetHistMinimumZero() const
Double_t GetHistTopMargin() const
Int_t GetNumberContours() const
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
void DrawQuadFilled(const TGLVertex3 &v0, const TGLVertex3 &v1, const TGLVertex3 &v2, const TGLVertex3 &v3, const TGLVector3 &normal)
Draw quad face.
const Float_t gNullEmission[]
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
const Float_t gBlueEmission[]
void DrawPalette(const TGLPlotCamera *camera, const TGLLevelPalette &palette)
Draw. Palette.
void DrawPaletteAxis(const TGLPlotCamera *camera, const Range_t &minMax, Bool_t logZ)
std::pair< Int_t, Int_t > BinRange_t
std::pair< Double_t, Double_t > Range_t
void DrawBoxFront(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax, Int_t fp)
Draws lego's bar as a 3d box.
const Double_t gH2PolyScaleXY
Int_t ColorToObjectID(const UChar_t *color, Bool_t highColor)
void DrawAxes(Int_t frontPoint, const Int_t *viewport, const TGLVertex3 *box2D, const TGLPlotCoordinates *plotCoord, TAxis *xAxis, TAxis *yAxis, TAxis *zAxis)
Using front point, find, where to draw axes and which labels to use for them gVirtualX->SelectWindow(...
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
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 Log10(Double_t x)
Returns the common (base-10) logarithm of x.