70 return fPainter->DistancetoPrimitive(px, py);
78 fPainter->ExecuteEvent(event, px, py);
87 static char message[] =
"TH3 composition";
127 static char message[] =
"TH3 composition";
243 gROOT->ProcessLineFast(
Form(
"((TGLPlotPainter *)0x%lx)->Paint()", (
ULong_t)
this));
248 Info(
"ProcessEvent",
"Switch to true color mode to use box cut");
261 glEnable(GL_DEPTH_TEST);
262 glEnable(GL_LIGHTING);
264 glEnable(GL_CULL_FACE);
267 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
275 glDisable(GL_DEPTH_TEST);
276 glDisable(GL_LIGHTING);
277 glDisable(GL_LIGHT0);
278 glDisable(GL_CULL_FACE);
279 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
293 glEnable(GL_POLYGON_OFFSET_FILL);
294 glPolygonOffset(1.
f, 1.
f);
308 const Int_t addI = frontPoint == 2 || frontPoint == 1 ? 1 : (iInit = nX - 1, irInit =
fCoord->
GetLastXBin(), -1);
309 const Int_t addJ = frontPoint == 2 || frontPoint == 3 ? 1 : (jInit = nY - 1, jrInit =
fCoord->
GetLastYBin(), -1);
328 for(
Int_t ir = irInit, i = iInit; addI > 0 ? i < nX : i >= 0; ir += addI, i += addI) {
329 for(
Int_t jr = jrInit, j = jInit; addJ > 0 ? j < nY : j >= 0; jr += addJ, j += addJ) {
330 for(
Int_t kr = krInit, k = kInit; addK > 0 ? k < nZ : k >= 0; kr += addK, k += addK) {
358 glDisable(GL_POLYGON_OFFSET_FILL);
360 glColor4d(0., 0., 0., 0.25);
361 glPolygonMode(GL_FRONT, GL_LINE);
364 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
366 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
374 for(
Int_t ir = irInit, i = iInit; addI > 0 ? i < nX : i >= 0; ir += addI, i += addI) {
375 for(
Int_t jr = jrInit, j = jInit; addJ > 0 ? j < nY : j >= 0; jr += addJ, j += addJ) {
376 for(
Int_t kr = krInit, k = kInit; addK > 0 ? k < nZ : k >= 0; kr += addK, k += addK) {
397 glPolygonMode(GL_FRONT, GL_FILL);
405 Float_t diffColor[] = {0.8f, 0.8f, 0.8f, 0.05f};
409 c->GetRGB(diffColor[0], diffColor[1], diffColor[2]);
411 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffColor);
412 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
413 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
414 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 70.
f);
421 void AxisError(
const TString & errorMsg)
423 Error(
"TGLTH3Composition::AddTH3",
"%s", errorMsg.
Data());
424 throw std::runtime_error(errorMsg.
Data());
433 AxisError(
"New hist has different number of bins along " + axisName);
439 if (firstBin1 != firstBin2)
440 AxisError(
"New hist has different first bin along " + axisName);
442 if (lastBin1 != lastBin2)
443 AxisError(
"New hist has different last bin along " + axisName);
448 AxisError(
"New hist has different low edge along " + axisName);
450 AxisError(
"New hist has different low edge along " + axisName);
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.
TGLTH3Composition * fData
Int_t GetFirstXBin() const
void Pan(Int_t px, Int_t py)
User's moving mouse cursor, with middle mouse button pressed (for pad).
Int_t GetFirst() const
Return first bin on the axis i.e.
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.
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
TAxis fYaxis
Y axis descriptor.
std::unique_ptr< TGLHistPainter > fPainter
void StartPan(Int_t px, Int_t py)
User clicks somewhere (px, py).
const TGLVertex3 * Get3DBox() const
Get 3D box.
virtual Int_t GetNbinsZ() const
Int_t GetNXBins() const
Number of X bins.
Short_t Min(Short_t a, Short_t b)
void TurnOnOff()
Turn the box cut on/off.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
void DeInitGL() const
Return back some gl state variables.
TAxis fZaxis
Z axis descriptor.
void ProcessEvent(Int_t event, Int_t px, Int_t py)
Switch on/off box cut.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Int_t DistancetoPrimitive(Int_t px, Int_t py)
Check if "this" is under cursor.
Int_t GetNZBins() const
Number of Z bins.
void StartPan(Int_t px, Int_t py)
Move plot or box cut.
void DrawPlot() const
Draw composition of TH3s.
void Apply(Double_t phi, Double_t theta) const
Applies rotations and translations before drawing.
void Info(const char *location, const char *msgfmt,...)
void SetCamera() const
Viewport and projection.
char * GetObjectInfo(Int_t px, Int_t py) const
I cannot show bin content in a status bar - since there can be several bins in one.
Int_t GetFirstYBin() const
void SetYLog(Bool_t yLog)
If log changed, sections must be reset, set fModified.
void Error(const char *location, const char *msgfmt,...)
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 Paint(Option_t *option)
Paint a composition of 3d hists.
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
Int_t GetLast() const
Return last bin on the axis i.e.
Class to manage histogram axis.
TGLTH3Composition()
I have to define it, since explicit copy ctor was declared.
std::pair< Double_t, Double_t > fMinMaxVal
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.
char * Form(const char *fmt,...)
void SetXLog(Bool_t xLog)
If log changed, sections must be reset, set fModified.
std::vector< TH3Pair_t > fHists
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms, functions and parametric surfaces.
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.
Double_t GetYScale() const
std::pair< const TH3 *, ETH3BinShape > TH3Pair_t
void SetColor(Int_t color) const
Set material.
Bool_t Modified() const
Modified.
virtual Color_t GetFillColor() const
Return the fill area color.
void SaveProjectionMatrix() const
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
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.
The histogram painter class using OpenGL.
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Mouse and keyboard events.
void InitGL() const
Initialize some gl state variables.
void AddOption(const TString &option)
No options for composition.
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
char * GetPlotInfo(Int_t px, Int_t py)
Will be never called from TPad.
void SetZLog(Bool_t zLog)
If log changed, sections must be reset, set fModified.
void StartMovement(Int_t px, Int_t py)
Start cut's movement.
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.
void AddTH3(const TH3 *hist, ETH3BinShape shape=kBox)
Add TH3 into collection.
const Rgl::Range_t & GetXRangeScaled() const
Scaled range.
TAxis fXaxis
X axis descriptor.
virtual Int_t GetNbinsX() const
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax)
Initialize axis with fix bins.
Int_t GetLastZBin() const
Int_t GetHeight() const
viewport[3]
void SaveModelviewMatrix() const
TGLPlotCoordinates * fCoord
virtual void Paint()
Draw lego/surf/whatever you can.
Double_t GetZScale() const
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
TGLTH3CompositionPainter(TGLTH3Composition *data, TGLPlotCamera *camera, TGLPlotCoordinates *coord)
Ctor.
Double_t GetXScale() const
virtual Int_t GetNbinsY() 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.