43 fXOZSlice("XOZ", (
TH3 *)hist, coord, &fBackBox,
TGLTH3Slice::kXOZ),
44 fYOZSlice("YOZ", (
TH3 *)hist, coord, &fBackBox,
TGLTH3Slice::kYOZ),
45 fXOYSlice("XOY", (
TH3 *)hist, coord, &fBackBox,
TGLTH3Slice::kXOY),
58 fXOZSlice(
"XOZ", (
TH3 *)hist, coord, &fBackBox,
TGLTH3Slice::kXOZ),
59 fYOZSlice(
"YOZ", (
TH3 *)hist, coord, &fBackBox,
TGLTH3Slice::kYOZ),
60 fXOYSlice(
"XOY", (
TH3 *)hist, coord, &fBackBox,
TGLTH3Slice::kXOY),
85 fPlotInfo.
Form(
"(binx = %d; biny = %d; binz = %d; binc = %f)", binI, binJ, binK,
88 fPlotInfo =
"Switch to true color mode to get correct info";
131 for (
unsigned i = 0; i <
fPMPoints.size(); i += 3) {
212 if (boxPos + 3 < option.
Length() && isdigit(option[boxPos + 3]))
231 gROOT->ProcessLineFast(
Form(
"((TGLPlotPainter *)0x%lx)->Paint()", (
ULong_t)
this));
236 Info(
"ProcessEvent",
"Switch to true color mode to use box cut");
249 glEnable(GL_DEPTH_TEST);
250 glEnable(GL_LIGHTING);
253 glEnable(GL_CULL_FACE);
256 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
264 glDisable(GL_DEPTH_TEST);
265 glDisable(GL_LIGHTING);
266 glDisable(GL_LIGHT0);
267 glDisable(GL_CULL_FACE);
268 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
282 const Double_t ratio = onSphere ? 0.4 : 0.15;
283 const Double_t leftX = xMin + ratio * (xMax - xMin), rightX = xMax - ratio * (xMax - xMin);
284 const Double_t leftY = yMin + ratio * (yMax - yMin), rightY = yMax - ratio * (yMax - yMin);
285 const Double_t lowZ = zMin / 2. + zMax / 2. - 0.1 * (zMax - zMin);
286 const Double_t upZ = zMin / 2. + zMax / 2. + 0.1 * (zMax - zMin);
289 const Double_t minusVerts[][3] = {{xMin, leftY, lowZ}, {xMin, leftY, upZ}, {xMin, rightY, upZ}, {xMin, rightY, lowZ},
290 {leftX, yMin, lowZ}, {rightX, yMin, lowZ}, {rightX, yMin, upZ}, {leftX, yMin, upZ},
291 {xMax, leftY, lowZ}, {xMax, rightY, lowZ}, {xMax, rightY, upZ}, {xMax, leftY, upZ},
292 {rightX, yMax, lowZ}, {leftX, yMax, lowZ}, {leftX, yMax, upZ}, {rightX, yMax, upZ}};
293 const Int_t minusQuads[][4] = {{0, 1, 2, 3}, {4, 5, 6, 7}, {8, 9, 10, 11}, {12, 13, 14, 15}};
297 glColor3d(1., 0., 0.);
299 const Int_t frontPlanes[][2] = {{0, 1}, {1, 2}, {2, 3}, {3, 0}};
300 const Int_t *verts = minusQuads[frontPlanes[fp][0]];
303 glVertex3dv(minusVerts[verts[0]]);
304 glVertex3dv(minusVerts[verts[1]]);
305 glVertex3dv(minusVerts[verts[2]]);
306 glVertex3dv(minusVerts[verts[3]]);
309 verts = minusQuads[frontPlanes[fp][1]];
312 glVertex3dv(minusVerts[verts[0]]);
313 glVertex3dv(minusVerts[verts[1]]);
314 glVertex3dv(minusVerts[verts[2]]);
315 glVertex3dv(minusVerts[verts[3]]);
318 const Float_t nullEmission[] = {0.f, 0.f, 0.f, 1.f};
319 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, nullEmission);
320 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, nullEmission);
322 glColor4d(0., 0., 0., 0.25);
323 glPolygonMode(GL_FRONT, GL_LINE);
327 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
330 glEnable(GL_LINE_SMOOTH);
331 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
333 verts = minusQuads[frontPlanes[fp][0]];
336 glVertex3dv(minusVerts[verts[0]]);
337 glVertex3dv(minusVerts[verts[1]]);
338 glVertex3dv(minusVerts[verts[2]]);
339 glVertex3dv(minusVerts[verts[3]]);
342 verts = minusQuads[frontPlanes[fp][1]];
345 glVertex3dv(minusVerts[verts[0]]);
346 glVertex3dv(minusVerts[verts[1]]);
347 glVertex3dv(minusVerts[verts[2]]);
348 glVertex3dv(minusVerts[verts[3]]);
351 glPolygonMode(GL_FRONT, GL_FILL);
372 glDisable(GL_CULL_FACE);
374 glEnable(GL_CULL_FACE);
377 glEnable(GL_POLYGON_OFFSET_FILL);
378 glPolygonOffset(1.
f, 1.
f);
383 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
397 const Int_t addI = frontPoint == 2 || frontPoint == 1 ? 1 : (iInit = nX - 1, irInit =
fCoord->
GetLastXBin(), -1);
398 const Int_t addJ = frontPoint == 2 || frontPoint == 3 ? 1 : (jInit = nY - 1, jrInit =
fCoord->
GetLastYBin(), -1);
415 for(
Int_t ir = irInit, i = iInit; addI > 0 ? i < nX : i >= 0; ir += addI, i += addI) {
416 for(
Int_t jr = jrInit, j = jInit; addJ > 0 ? j < nY : j >= 0; jr += addJ, j += addJ) {
417 for(
Int_t kr = krInit, k = kInit; addK > 0 ? k < nZ : k >= 0; kr += addK, k += addK) {
459 glDisable(GL_POLYGON_OFFSET_FILL);
461 glColor4d(0., 0., 0., 0.25);
462 glPolygonMode(GL_FRONT, GL_LINE);
465 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
467 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
469 for(
Int_t ir = irInit, i = iInit; addI > 0 ? i < nX : i >= 0; ir += addI, i += addI) {
470 for(
Int_t jr = jrInit, j = jInit; addJ > 0 ? j < nY : j >= 0; jr += addJ, j += addJ) {
471 for(
Int_t kr = krInit, k = kInit; addK > 0 ? k < nZ : k >= 0; kr += addK, k += addK) {
492 glPolygonMode(GL_FRONT, GL_FILL);
513 glDisable(GL_LIGHTING);
516 const Double_t dX = (bb[1].
X() - bb[0].
X()) / 40.;
517 const Double_t dY = (bb[3].
Y() - bb[0].
Y()) / 40.;
518 const Double_t dZ = (bb[4].
Z() - bb[0].
Z()) / 40.;
522 glEnable(GL_LIGHTING);
530 Float_t diffColor[] = {0.8f, 0.8f, 0.8f, 0.05f};
539 c->GetRGB(diffColor[0], diffColor[1], diffColor[2]);
542 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffColor);
543 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
544 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
545 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 70.
f);
virtual const char * GetName() const
Returns name of object.
void DrawBox(Bool_t selectionPass, Int_t selected) const
Draw cut as a semi-transparent box.
Int_t GetFrontPoint() const
The nearest point.
void RestoreModelviewMatrix() const
Camera for TGLPlotPainter and sub-classes.
Int_t GetFirstXBin() const
Int_t GetNYBins() const
Number of Y bins.
void MoveBox(Int_t px, Int_t py, Int_t axisID)
Move box cut along selected direction.
const Float_t gNullEmission[]
Bool_t GetZLog() const
Get Z log.
TGLBoxPainter(const TGLBoxPainter &)
void StartPan(Int_t px, Int_t py)
User clicks right mouse button (in a pad).
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
EGLCoordType GetCoordType() const
Get coordinates type.
void DrawSections() const
Draw sections (if any).
void StartPan(Int_t px, Int_t py)
User clicks somewhere (px, py).
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Int_t GetPaletteSize() const
Get. Palette. Size.
const TGLVertex3 * Get3DBox() const
Get 3D box.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Int_t GetNXBins() const
Number of X bins.
void DrawCloud() const
Draw a frame and a polymarker inside.
Short_t Min(Short_t a, Short_t b)
void TurnOnOff()
Turn the box cut on/off.
void DrawSectionXOZ() const
Draw XOZ parallel section.
void DrawPalette(const TGLPlotCamera *camera, const TGLLevelPalette &palette)
Draw. Palette.
void DrawPaletteAxis(const TGLPlotCamera *camera, const Range_t &minMax, Bool_t logZ)
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.
void SetMinMax(const Rgl::Range_t &newRange)
std::vector< Double_t > fPMPoints
void DrawPalette() const
Draw.
Paints TH3 histograms by rendering variable-sized boxes matching the bin contents.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Int_t GetNZBins() const
Number of Z bins.
void Apply(Double_t phi, Double_t theta) const
Applies rotations and translations before drawing.
void ProcessEvent(Int_t event, Int_t px, Int_t py)
Remove sections.
3 component (x/y/z) vertex class.
Bool_t InitGeometry()
Set ranges, find min and max bin content.
void Info(const char *location, const char *msgfmt,...)
void SetCamera() const
Viewport and projection.
Int_t GetFirstYBin() const
void SetYLog(Bool_t yLog)
If log changed, sections must be reset, set fModified.
void AddOption(const TString &stringOption)
Box1 == spheres.
void SetViewVolume(const TGLVertex3 *box)
'box' is the TGLPlotPainter's back box's coordinates.
The 3-D histogram classes derived from the 1-D histogram classes.
void DrawSectionXOY() const
Draw XOY parallel section.
const TPolyMarker3D * fPolymarker
void DrawPaletteAxis() const
Draw. Palette. Axis.
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
const Rgl::Range_t & GetZRangeScaled() const
Scaled range.
void RestoreProjectionMatrix() const
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.
Int_t GetLastYBin() const
Class to manage histogram axis.
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
void ResetModified()
Reset modified.
void Pan(Int_t px, Int_t py)
Pan camera.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
void DrawSectionYOZ() const
Draw YOZ parallel section.
char * Form(const char *fmt,...)
void DrawSlice(Double_t pos) const
Draw slice.
void SetXLog(Bool_t xLog)
If log changed, sections must be reset, set fModified.
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms, functions and parametric surfaces.
char * GetPlotInfo(Int_t px, Int_t py)
Show box info (i, j, k, binContent).
std::vector< Double_t > fZLevels
void DrawBox(Int_t selectedPart, Bool_t selectionPass, const std::vector< Double_t > &zLevels, Bool_t highColor) const
Draw back box for a plot.
void DeInitGL() const
Return back some gl state variables.
Double_t GetYScale() const
void Pan(Int_t px, Int_t py)
User's moving mouse cursor, with middle mouse button pressed (for pad).
void InitGL() const
Initialize some gl state variables.
Bool_t Modified() const
Modified.
void SetPlotColor() const
Set boxes color.
virtual Color_t GetFillColor() const
Return the fill area color.
void SaveProjectionMatrix() const
The color creation and management class.
Int_t GetFirstZBin() const
Bool_t SetRanges(const TH1 *hist, Bool_t errors=kFALSE, Bool_t zBins=kFALSE)
Set bin ranges, ranges.
const Rgl::Range_t & GetYRangeScaled() const
Scaled range.
Int_t GetLastXBin() const
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.
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
const Float_t * fPhysicalShapeColor
void SetZLog(Bool_t zLog)
If log changed, sections must be reset, set fModified.
virtual Int_t GetN() const
void StartMovement(Int_t px, Int_t py)
Start cut's movement.
void MoveSection(Int_t px, Int_t py)
Create dynamic profile using selected plane.
Short_t Max(Short_t a, Short_t b)
void SetPlotBox(const Rgl::Range_t &xRange, const Rgl::Range_t &yRange, const Rgl::Range_t &zRange)
Set up a frame box.
virtual Float_t * GetP() const
const Rgl::Range_t & GetXRangeScaled() const
Scaled range.
Bool_t HasSections() const
Check, if any section exists.
Int_t GetLastZBin() const
Int_t GetHeight() const
viewport[3]
void SaveModelviewMatrix() const
TGLPlotCoordinates * fCoord
virtual void Paint()
Draw lego/surf/whatever you can.
const Float_t gOrangeEmission[]
Double_t GetZScale() const
Double_t GetXScale() const
const TGLLevelPalette & GetPalette() const
const char * Data() const
const TGLVertex3 * Get2DBox() const
Get 2D box.
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.