26#include "TGLIncludes.h"
41 fXOZSlice(
"XOZ", (
TH3 *)hist, coord, &fBackBox,
TGLTH3Slice::kXOZ),
42 fYOZSlice(
"YOZ", (
TH3 *)hist, coord, &fBackBox,
TGLTH3Slice::kYOZ),
43 fXOYSlice(
"XOY", (
TH3 *)hist, coord, &fBackBox,
TGLTH3Slice::kXOY),
56 fXOZSlice(
"XOZ", (
TH3 *)hist, coord, &fBackBox,
TGLTH3Slice::kXOZ),
57 fYOZSlice(
"YOZ", (
TH3 *)hist, coord, &fBackBox,
TGLTH3Slice::kYOZ),
58 fXOYSlice(
"XOY", (
TH3 *)hist, coord, &fBackBox,
TGLTH3Slice::kXOY),
83 fPlotInfo.
Form(
"(binx = %d; biny = %d; binz = %d; binc = %f)", binI, binJ, binK,
86 fPlotInfo =
"Switch to true color mode to get correct info";
129 for (
unsigned i = 0; i <
fPMPoints.size(); i += 3) {
210 if (boxPos + 3 <
option.Length() && isdigit(
option[boxPos + 3]))
229 gROOT->ProcessLineFast(
Form(
"((TGLPlotPainter *)0x%zx)->Paint()", (
size_t)
this));
234 Info(
"ProcessEvent",
"Switch to true color mode to use box cut");
247 glEnable(GL_DEPTH_TEST);
248 glEnable(GL_LIGHTING);
251 glEnable(GL_CULL_FACE);
254 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,
GL_TRUE);
262 glDisable(GL_DEPTH_TEST);
263 glDisable(GL_LIGHTING);
264 glDisable(GL_LIGHT0);
265 glDisable(GL_CULL_FACE);
266 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,
GL_FALSE);
280 const Double_t ratio = onSphere ? 0.4 : 0.15;
281 const Double_t leftX = xMin + ratio * (xMax - xMin), rightX = xMax - ratio * (xMax - xMin);
282 const Double_t leftY = yMin + ratio * (yMax - yMin), rightY = yMax - ratio * (yMax - yMin);
283 const Double_t lowZ = zMin / 2. + zMax / 2. - 0.1 * (zMax - zMin);
284 const Double_t upZ = zMin / 2. + zMax / 2. + 0.1 * (zMax - zMin);
287 const Double_t minusVerts[][3] = {{xMin, leftY, lowZ}, {xMin, leftY, upZ}, {xMin, rightY, upZ}, {xMin, rightY, lowZ},
288 {leftX, yMin, lowZ}, {rightX, yMin, lowZ}, {rightX, yMin, upZ}, {leftX, yMin, upZ},
289 {xMax, leftY, lowZ}, {xMax, rightY, lowZ}, {xMax, rightY, upZ}, {xMax, leftY, upZ},
290 {rightX, yMax, lowZ}, {leftX, yMax, lowZ}, {leftX, yMax, upZ}, {rightX, yMax, upZ}};
291 const Int_t minusQuads[][4] = {{0, 1, 2, 3}, {4, 5, 6, 7}, {8, 9, 10, 11}, {12, 13, 14, 15}};
295 glColor3d(1., 0., 0.);
297 const Int_t frontPlanes[][2] = {{0, 1}, {1, 2}, {2, 3}, {3, 0}};
298 const Int_t *verts = minusQuads[frontPlanes[fp][0]];
301 glVertex3dv(minusVerts[verts[0]]);
302 glVertex3dv(minusVerts[verts[1]]);
303 glVertex3dv(minusVerts[verts[2]]);
304 glVertex3dv(minusVerts[verts[3]]);
307 verts = minusQuads[frontPlanes[fp][1]];
310 glVertex3dv(minusVerts[verts[0]]);
311 glVertex3dv(minusVerts[verts[1]]);
312 glVertex3dv(minusVerts[verts[2]]);
313 glVertex3dv(minusVerts[verts[3]]);
316 const Float_t nullEmission[] = {0.f, 0.f, 0.f, 1.f};
317 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, nullEmission);
318 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, nullEmission);
320 glColor4d(0., 0., 0., 0.25);
321 glPolygonMode(GL_FRONT, GL_LINE);
325 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
328 glEnable(GL_LINE_SMOOTH);
329 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
331 verts = minusQuads[frontPlanes[fp][0]];
334 glVertex3dv(minusVerts[verts[0]]);
335 glVertex3dv(minusVerts[verts[1]]);
336 glVertex3dv(minusVerts[verts[2]]);
337 glVertex3dv(minusVerts[verts[3]]);
340 verts = minusQuads[frontPlanes[fp][1]];
343 glVertex3dv(minusVerts[verts[0]]);
344 glVertex3dv(minusVerts[verts[1]]);
345 glVertex3dv(minusVerts[verts[2]]);
346 glVertex3dv(minusVerts[verts[3]]);
349 glPolygonMode(GL_FRONT, GL_FILL);
370 glDisable(GL_CULL_FACE);
372 glEnable(GL_CULL_FACE);
375 glEnable(GL_POLYGON_OFFSET_FILL);
376 glPolygonOffset(1.f, 1.f);
381 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
395 const Int_t addI = frontPoint == 2 || frontPoint == 1 ? 1 : (iInit = nX - 1, irInit =
fCoord->
GetLastXBin(), -1);
396 const Int_t addJ = frontPoint == 2 || frontPoint == 3 ? 1 : (jInit = nY - 1, jrInit =
fCoord->
GetLastYBin(), -1);
418 for(
Int_t ir = irInit, i = iInit; addI > 0 ? i < nX : i >= 0; ir += addI, i += addI) {
419 for(
Int_t jr = jrInit, j = jInit; addJ > 0 ? j < nY : j >= 0; jr += addJ, j += addJ) {
420 for(
Int_t kr = krInit, k = kInit; addK > 0 ? k < nZ : k >= 0; kr += addK, k += addK) {
422 if (binContent <
wmin)
continue;
423 if (binContent >
wmax) binContent =
wmax;
465 glDisable(GL_POLYGON_OFFSET_FILL);
467 glColor4d(0., 0., 0., 0.25);
468 glPolygonMode(GL_FRONT, GL_LINE);
471 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
473 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
475 for(
Int_t ir = irInit, i = iInit; addI > 0 ? i < nX : i >= 0; ir += addI, i += addI) {
476 for(
Int_t jr = jrInit, j = jInit; addJ > 0 ? j < nY : j >= 0; jr += addJ, j += addJ) {
477 for(
Int_t kr = krInit, k = kInit; addK > 0 ? k < nZ : k >= 0; kr += addK, k += addK) {
479 if (binContent <
wmin)
continue;
480 if (binContent >
wmax) binContent =
wmax;
500 glPolygonMode(GL_FRONT, GL_FILL);
521 glDisable(GL_LIGHTING);
524 const Double_t dX = (bb[1].
X() - bb[0].
X()) / 40.;
525 const Double_t dY = (bb[3].
Y() - bb[0].
Y()) / 40.;
526 const Double_t dZ = (bb[4].
Z() - bb[0].
Z()) / 40.;
530 glEnable(GL_LIGHTING);
538 Float_t diffColor[] = {0.8f, 0.8f, 0.8f, 0.05f};
547 c->GetRGB(diffColor[0], diffColor[1], diffColor[2]);
550 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffColor);
551 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
552 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
553 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 70.f);
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t wmin
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t wmax
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
virtual Color_t GetFillColor() const
Return the fill area color.
Class to manage histogram axis.
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
The color creation and management class.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
void MoveBox(Int_t px, Int_t py, Int_t axisID)
Move box cut along selected direction.
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.
void StartMovement(Int_t px, Int_t py)
Start cut's movement.
Paints TH3 histograms by rendering variable-sized boxes matching the bin contents.
const TPolyMarker3D * fPolymarker
void DrawPlot() const override
Bool_t HasSections() const
Check, if any section exists.
void DrawSectionYOZ() const override
Draw YOZ parallel section.
Bool_t InitGeometry() override
Set ranges, find min and max bin content.
void Pan(Int_t px, Int_t py) override
User's moving mouse cursor, with middle mouse button pressed (for pad).
void DeInitGL() const override
Return back some gl state variables.
void AddOption(const TString &stringOption) override
Box1 == spheres.
void DrawSectionXOZ() const override
Draw XOZ parallel section.
void InitGL() const override
Initialize some gl state variables.
void StartPan(Int_t px, Int_t py) override
User clicks right mouse button (in a pad).
std::vector< Double_t > fPMPoints
void DrawPaletteAxis() const override
Draw. Palette. Axis.
void SetPlotColor() const
Set boxes color.
TGLBoxPainter(const TGLBoxPainter &)
void DrawCloud() const
Draw a frame and a polymarker inside.
void DrawSectionXOY() const override
Draw XOY parallel section.
void ProcessEvent(Int_t event, Int_t px, Int_t py) override
Remove sections.
void DrawPalette() const
Draw.
char * GetPlotInfo(Int_t px, Int_t py) override
Show box info (i, j, k, binContent).
Int_t GetPaletteSize() const
Get. Palette. Size.
void SetPlotBox(const Rgl::Range_t &xRange, const Rgl::Range_t &yRange, const Rgl::Range_t &zRange)
Set up a frame box.
const TGLVertex3 * Get3DBox() const
Get 3D box.
const TGLVertex3 * Get2DBox() const
Get 2D box.
void DrawBox(Int_t selectedPart, Bool_t selectionPass, const std::vector< Double_t > &zLevels, Bool_t highColor) const
Draw back box for a plot.
Int_t GetFrontPoint() const
The nearest point.
Camera for TGLPlotPainter and sub-classes.
void StartPan(Int_t px, Int_t py)
User clicks somewhere (px, py).
void Apply(Double_t phi, Double_t theta) const
Applies rotations and translations before drawing.
void SetCamera() const
Viewport and projection.
void Pan(Int_t px, Int_t py)
Pan camera.
Int_t GetHeight() const
viewport[3]
void SetViewVolume(const TGLVertex3 *box)
'box' is the TGLPlotPainter's back box's coordinates.
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
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.
Double_t GetYScale() const
const Rgl::Range_t & GetXRangeScaled() const
Scaled range.
Int_t GetFirstXBin() const
Int_t GetFirstYBin() const
const Rgl::Range_t & GetYRangeScaled() const
Scaled range.
void ResetModified()
Reset modified.
Bool_t GetZLog() const
Get Z log.
Bool_t Modified() const
Modified.
Double_t GetXScale() const
Double_t GetZScale() const
Int_t GetLastZBin() const
Int_t GetNXBins() const
Number of X bins.
Int_t GetFirstZBin() const
const Rgl::Range_t & GetZRangeScaled() const
Scaled range.
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.
Int_t GetLastYBin() const
Int_t GetNYBins() const
Number of Y bins.
Int_t GetLastXBin() const
EGLCoordType GetCoordType() const
Get coordinates type.
Int_t GetNZBins() const
Number of Z bins.
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms,...
void DrawSections() const
Draw sections (if any).
const Float_t * fPhysicalShapeColor
std::vector< Double_t > fZLevels
void RestoreModelviewMatrix() const
TGLPlotCoordinates * fCoord
void Paint() override
Draw lego/surf/whatever you can.
void SaveProjectionMatrix() const
void SaveModelviewMatrix() const
void MoveSection(Int_t px, Int_t py)
Create dynamic profile using selected plane.
void RestoreProjectionMatrix() const
const TGLLevelPalette & GetPalette() const
void SetMinMax(const Rgl::Range_t &newRange)
void DrawSlice(Double_t pos) const
Draw slice.
static void RenderPolyMarkers(const TAttMarker &marker, Char_t transp, Float_t *p, Int_t n, Int_t pick_radius=0, Bool_t selection=kFALSE, Bool_t sec_selection=kFALSE)
Render polymarkers at points specified by p-array.
3 component (x/y/z) vertex class.
TH1 is the base class of all histogram classes in ROOT.
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual Double_t GetMinimum(Double_t minval=-FLT_MAX) const
Return minimum value larger than minval of bins in the range, unless the value has been overridden by...
The 3-D histogram classes derived from the 1-D histogram classes.
const char * GetName() const override
Returns name of object.
virtual Int_t GetN() const
virtual Float_t * GetP() const
const char * Data() const
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
const Float_t gNullEmission[]
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
void DrawPalette(const TGLPlotCamera *camera, const TGLLevelPalette &palette)
Draw. Palette.
void DrawPaletteAxis(const TGLPlotCamera *camera, const Range_t &minMax, Bool_t logZ)
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.
void DrawSphere(TGLQuadric *quadric, Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
Cylinder for lego3.
const Float_t gOrangeEmission[]
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.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.