Visualization

Goal: to present 2-dimensional spectra in suitable visual form

This package has several display mode groups and display modes, which can be employed for the presentation of 2-dimensional histograms

Display modes groups:

Display modes:

one can combine the above given modes groups and display modes. The meaningful combinations (denoted by x) are given in the next table.

SimpleLightHeightLight-Height
Points XXXX
Grid XXXX
Contours X-X-
Bars X-X-
LinesX XXXX
LinesY XXXX
BarsX X-X-
BarsY X-X-
Needles X---
Surface -XXX
TrianglesXXXX

Function:

void TSpectrum2Painter::SetDisplayMode (Int_t modeGroup, Int_t displayMode)

This function controls the display mode group and display mode of the histogram drawing. To illustrate the possible effects of the various display modes we introduce a set of examples. Default values:

Simple modes group, display mode = points, 256 x 256 channels.

Simple modes group, display mode = grid, 64 x 64 channels.

Simple modes group, display mode = contours, 64 x 64 channels.

Simple modes group, display mode = bars, 64 x 64 channels.

Simple modes group, display mode = linesX, 64 x 64 channels.

Simple modes group, display mode = linesY, 64 x 64 channels.

Simple modes group, display mode = barsX, 64 x 64 channels.

Simple modes group, display mode = barsY, 64 x 64 channels.

Simple modes group, display mode = needles, 64 x 64 channels.

Simple modes group, display mode = triangles, 64 x 64 channels.

Light modes group, display mode = points, 256 x 256 channels.

Light modes group, display mode = grid, 256 x 256 channels.

Light modes group, display mode = surface, 64 x 64 channels.

Light modes group, display mode = triangles, 64 x 64 channels.

Height modes group, display mode = points, 256 x 256 channels.

Height modes group, display mode = grid, 256 x 256 channels.

Height modes group, display mode = contours, 64 x 64 channels.

Height modes group, display mode = bars, 64 x 64 channels.

Height modes group, display mode = surface, 64 x 64 channels.

Height modes group, display mode = triangles, 64 x 64 channels.

Light - height modes group, display mode = surface, 64 x 64 channels. The weight between both shading algorithms is set to 0.5. One can observe the influence of both shadings.

Function:

TSpectrum2Painter::SetPenAttr(Int_t color,Int_t style,Int_t width)

Using this function one can change pen color, pen style and pen width. Possible pen styles are:

Default values:

Simple modes group, display mode = linesX, 64 x 64 channels. Pen width = 3.

Function:

TSpectrum2Painter::SetNodes(Int_t nodesx,Int_t nodesy)

Sometimes the displayed region is rather large. When displaying all channels pictures become very dense and complicated. It is very difficult to understand overall shape of the data. Therefore in the package we have implemented the possibility to change the density of displayed channels. Only channels coinciding with given nodes are displayed. In the next figure we introduce the example of the above presented spectrum with number of nodes set to 64x64.

Default values:

Simple modes group, display mode = grid, 256 x 256 channels. Number of nodes is 64x64.

Function:

void TSpectrum2Painter::SetAngles (Int_t alpha,Int_t beta, Int_t view)

One can change the angles of the position of 3-d space and to rotate the space. Alpha parameter defines the angle between bottom horizontal screen line and the displayed space on the right side of the picture and beta on the left side, respectively. One can rotate the 3-d space around vertical axis going through the center of it employing the view parameter. Allowed values are 0, 90, 180 and 270 degrees respectively.

Default values:

Light modes group, display mode = surface, 256 x 256 channels. Angles are set as follows: alpha=40, beta=30, view=0.

Light modes group, display mode = surface, 256 x 256 channels. Angles are set as follows: alpha=30, beta=30, view=90.

Function:

TSpectrum2Painter::SetZScale(Int_t scale)

One can change the scale of z-axis. Possible values are:

Default value is:

Height modes group, display mode = surface, 64 x 64 channels, log scale.

Function:

TSpectrum2Painter::SetColorIncrements(Float_t r,Float_t g,Float_t b);

For sophisticated shading (in kModeGroupLight, kModeGroupHeight and kModeGroupLightHeight display modes groups) the color palette starts from the basic pen color (see SetPenAttr function). There is a predefined number of color levels (256). Color in every level is calculated by adding the increments of the r, g, b components to the previous level. Using this function one can change the color increments between two neighboring color levels. The function does not apply for kModeGroupSimple display modes group. Default values: r=1, g=1, b=1;

Light modes group, display mode = surface, 64 x 64 channels, color increments r=1, g=2, b=3.

Light modes group, display mode = surface, 64 x 64 channels, color increments r=4, g=2, b=1.

Function:

TSpectrum2Painter::SetColorAlgorithm(Int_t colorAlgorithm)

To define the colors one can employ one of the following color algorithms (rgb, cmy, cie, yiq, hvs models [1], [2]). When the level of a component achieves the limit value one can choose either smooth transition (by decreasing the limit value) or sharp - modulo transition (continuing with 0 value). This makes possible to realize various visual effects. One can choose from the following set of the algorithms:

The function does not apply for kModeGroupSimple display modes group. Default value is:

Light modes group, display mode = surface, 64 x 64 channels, color algorithm is cmy smooth.

Light modes group, display mode = surface, 64 x 64 channels, color algorithm is hvs smooth.

Light modes group, display mode = surface, 64 x 64 channels, color algorithm is yiq smooth.

Light modes group, display mode = surface, 64 x 64 channels, color algorithm is rgb modulo.

Height modes group, display mode = surface, 256 x 256 channels, color algorithm is rgb modulo, increments r=5, g=5, b=5, angles alpha=0, beta=90, view=0.

Function:

TSpectrum2Painter::SetLightPosition(Int_t x, Int_t y, Int_t z)

In kModeGroupLight and kModeGroupLightHeight display modes groups the color palette is calculated according to the fictive light source position in 3-d space. Using this function one can change the position of the source and thus to achieve various graphical effects. The function does not apply for kModeGroupSimple and kModeGroupHeight display modes groups. Default values are: x=1000, y=1000, z=1000.

Light modes group, display mode = surface, 64 x 64 channels. Position of the light source was set to x=0, y=1000, z=1000.

Function:

TSpectrum2Painter::SetShading(Int_t shading,Int_t shadow)

Surface of the picture is composed of triangles. If desired the edges of the neighboring triangles can be smoothed (shaded). If desired the display of the shadow can be painted as well. The function does not apply for kModeGroupSimple display modes group.

Possible values for shading are:

Possible values for shadow are:

Default values:

Light modes group, display mode = surface, 64 x 64 channels, not shaded.

Light modes group, display mode = surface, 64 x 64 channels, shaded, with shadow.

Function:

TSpectrum2Painter::SetBezier(Int_t bezier)

For kModeGroupSimple display modes group and for kDisplayModeGrid, kDisplayModeLinesX >and kDisplayModeLinesY display modes one can smooth data using Bezier smoothing algorithm. The function does not apply for other display modes groups and display modes. Possible values are:

Default value is:

Simple modes group, display mode = linesX, 64 x 64 channels with Bezier smoothing.

Function:

TSpectrum2Painter::SetContourWidth(Int_t width)

This function applies only for kDisplayModeContours display mode. One can change the width between horizontal slices and thus their density. Default value: width=50.

Simple modes group, display mode = contours, 64 x 64 channels. Width between slices was set to 30.

Function:

TSpectrum2Painter::SetLightHeightWeight(Float_t weight)

For kModeGroupLightHeight display modes group one can change the weight between both shading algorithm. The function does not apply for other display modes groups. Default value is: weight=0.5.

Light - height modes group, display mode = surface, 64 x 64 channels. The weight between both shading algorithms is set to 0.7.

Function:

TSpectrum2Painter::SetChanMarks(Int_t enable,Int_t color,Int_t width,Int_t height,Int_t style)

In addition to the surface drawn using any above given algorithm one can display channel marks. One can control the color as well as the width, height (in pixels) and the style of the marks. The parameter enable can be set to: The possible styles can be chosen from the set:

Light modes group, display mode = surface, 64 x 64 channels, with marks (red circles).

Function:

TSpectrum2Painter::SetChanGrid(Int_t enable,Int_t color)

In addition to the surface drawn using any above given algorithm one can display grid using the color parameter. The parameter enable can be set to:

Height modes group, display mode = surface, 64 x 64 channels, with blue grid.

Height modes group, display mode = surface, 64 x 64 channels, with marks (red circles) and blue grid.

References:

[1] Morháč M., Kliman J., Matoušek V., Turzo I., Sophisticated visualization algorithms for analysis of multidimensional experimental nuclear data, Acta Physica Slovaca 54 (2004) 385.

[2] D. Hearn, M. P. Baker: Computer Graphics, Prentice Hall International, Inc. 1994.

Script:

// Example to draw source spectrum (class TSpectrum2Painter).
// To execute this example, do
// root > .x VisA.C
#include "TSpectrum2Painter.h"

void VisA() {
   TFile *f = new TFile("TSpectrum2.root");
   TH2F *graph=(TH2F*) f->Get("graph2;1");
   TCanvas *Graph2 = new TCanvas("Graph2","Illustration of 2D graphics",10,10,1000,700);
   graph->Draw("SPEC");
}