ROOT » HIST » SPECTRUMPAINTER » TSpectrum2Painter

class TSpectrum2Painter: public TNamed


 Two-dimensional graphics function

 TSpectrum2Painter is a set of graphical functions developed by Miroslav
 Morhac to paint 2D-histograms in three dimensions. This package is accessed
 via THistPainter in a transparent way. For the ROOT user it is enough to use
 the "SPEC" option to draw a 2D-Histogram. This option offers many
 functionalities detailed in the header of the PaintSpectrum function.

 Reference:
 Morhac M., Kliman J., Matousek V., Turzo I.: Sophisticated visualization
 algorithms for analysis of multidimensional experimental nuclear data. Acta
 Pysica Slovaca Vol. 54/ 4 (2004), pp. 385-400.

Function Members (Methods)

public:
virtual~TSpectrum2Painter()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
voidGetAngles(Int_t& alpha, Int_t& beta, Int_t& view)
voidGetBezier(Int_t& bezier)
voidGetChanGrid(Int_t& enable, Int_t& color)
voidGetChanMarks(Int_t& enable, Int_t& color, Int_t& width, Int_t& height, Int_t& style)
voidGetColorAlgorithm(Int_t& colorAlgorithm)
voidGetColorIncrements(Double_t& r, Double_t& g, Double_t& b)
voidGetContourWidth(Int_t& width)
voidGetDisplayMode(Int_t& modeGroup, Int_t& displayMode)
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
voidGetLightHeightWeight(Double_t& weight)
voidGetLightPosition(Int_t& x, Int_t& y, Int_t& z)
virtual const char*TNamed::GetName() const
voidGetNodes(Int_t& nodesx, Int_t& nodesy)
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
voidGetPenAttr(Int_t& color, Int_t& style, Int_t& width)
voidGetShading(Int_t& shading, Int_t& shadow)
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
voidGetZScale(Int_t& scale)
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
virtual voidPaint(Option_t* option)
static voidPaintSpectrum(TH2* h2, Option_t* option = "", Int_t bs = 1600)
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidSetAngles(Int_t alpha, Int_t beta, Int_t view)
voidSetBezier(Int_t bezier)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetChanGrid(Int_t enable, Int_t color)
voidSetChanMarks(Int_t enable, Int_t color, Int_t width, Int_t height, Int_t style)
voidSetColorAlgorithm(Int_t colorAlgorithm)
voidSetColorIncrements(Double_t r, Double_t g, Double_t b)
voidSetContourWidth(Int_t width)
voidSetDisplayMode(Int_t modeGroup, Int_t displayMode)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidSetLightHeightWeight(Double_t weight)
voidSetLightPosition(Int_t x, Int_t y, Int_t z)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
voidSetNodes(Int_t nodesx, Int_t nodesy)
static voidTObject::SetObjectStat(Bool_t stat)
voidSetPenAttr(Int_t color, Int_t style, Int_t width)
voidSetShading(Int_t shading, Int_t shadow)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
voidSetZScale(Int_t scale)
virtual voidShowMembers(TMemberInspector& insp) const
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
TSpectrum2Painter(TH2* h2, Int_t bs)
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
Int_tBezC(Int_t i)
Double_tBezierBlend(Int_t i, Double_t bezf)
voidBezierSmoothing(Double_t bezf)
Double_tColorCalculation(Double_t dx1, Double_t dy1, Double_t z1, Double_t dx2, Double_t dy2, Double_t z2, Double_t dx3, Double_t dy3, Double_t z3)
voidColorModel(unsigned int ui, unsigned int ui1, unsigned int ui2, unsigned int ui3)
voidCopyEnvelope(Double_t xr, Double_t xs, Double_t yr, Double_t ys)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidDrawMarker(Int_t x, Int_t y, Int_t w, Int_t h, Int_t type)
voidEnvelope(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
voidEnvelopeBars(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
voidTObject::MakeZombie()
Double_tShadowColorCalculation(Double_t xtaz, Double_t ytaz, Double_t ztaz, Double_t shad_noise)
voidSlice(Double_t xr, Double_t yr, Double_t xs, Double_t ys, TLine* line)
voidTransform(Int_t it, Int_t jt, Int_t zmt)

Data Members

public:
static TSpectrum2Painter::(anonymous)kBezierInterpol
static TObject::(anonymous)TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static TSpectrum2Painter::(anonymous)kChannelGridDrawn
static TSpectrum2Painter::(anonymous)kChannelGridNotDrawn
static TSpectrum2Painter::(anonymous)kChannelMarksDrawn
static TSpectrum2Painter::(anonymous)kChannelMarksNotDrawn
static TSpectrum2Painter::(anonymous)kChannelMarksStyleCross
static TSpectrum2Painter::(anonymous)kChannelMarksStyleDiamond
static TSpectrum2Painter::(anonymous)kChannelMarksStyleDot
static TSpectrum2Painter::(anonymous)kChannelMarksStyleRectangle
static TSpectrum2Painter::(anonymous)kChannelMarksStyleStar
static TSpectrum2Painter::(anonymous)kChannelMarksStyleTriangle
static TSpectrum2Painter::(anonymous)kChannelMarksStyleX
static TSpectrum2Painter::(anonymous)kColorAlgCieModulo
static TSpectrum2Painter::(anonymous)kColorAlgCieSmooth
static TSpectrum2Painter::(anonymous)kColorAlgCmyModulo
static TSpectrum2Painter::(anonymous)kColorAlgCmySmooth
static TSpectrum2Painter::(anonymous)kColorAlgHvsModulo
static TSpectrum2Painter::(anonymous)kColorAlgHvsSmooth
static TSpectrum2Painter::(anonymous)kColorAlgRgbModulo
static TSpectrum2Painter::(anonymous)kColorAlgRgbSmooth
static TSpectrum2Painter::(anonymous)kColorAlgYiqModulo
static TSpectrum2Painter::(anonymous)kColorAlgYiqSmooth
static TSpectrum2Painter::(anonymous)kDisplayModeBars
static TSpectrum2Painter::(anonymous)kDisplayModeBarsX
static TSpectrum2Painter::(anonymous)kDisplayModeBarsY
static TSpectrum2Painter::(anonymous)kDisplayModeContours
static TSpectrum2Painter::(anonymous)kDisplayModeGrid
static TSpectrum2Painter::(anonymous)kDisplayModeLinesX
static TSpectrum2Painter::(anonymous)kDisplayModeLinesY
static TSpectrum2Painter::(anonymous)kDisplayModeNeedles
static TSpectrum2Painter::(anonymous)kDisplayModePoints
static TSpectrum2Painter::(anonymous)kDisplayModeSurface
static TSpectrum2Painter::(anonymous)kDisplayModeTriangles
static TObject::EStatusBitsTObject::kHasUUID
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::(anonymous)TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TSpectrum2Painter::(anonymous)kModeGroupHeight
static TSpectrum2Painter::(anonymous)kModeGroupLight
static TSpectrum2Painter::(anonymous)kModeGroupLightHeight
static TSpectrum2Painter::(anonymous)kModeGroupSimple
static TObject::EStatusBitsTObject::kMustCleanup
static TSpectrum2Painter::(anonymous)kNoBezierInterpol
static TObject::EStatusBitsTObject::kNoContextMenu
static TObject::(anonymous)TObject::kNotDeleted
static TSpectrum2Painter::(anonymous)kNotShaded
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::(anonymous)TObject::kOverwrite
static TSpectrum2Painter::(anonymous)kPenStyleDash
static TSpectrum2Painter::(anonymous)kPenStyleDashDot
static TSpectrum2Painter::(anonymous)kPenStyleDot
static TSpectrum2Painter::(anonymous)kPenStyleSolid
static TSpectrum2Painter::(anonymous)kShaded
static TSpectrum2Painter::(anonymous)kShadowsNotPainted
static TSpectrum2Painter::(anonymous)kShadowsPainted
static TObject::(anonymous)TObject::kSingleKey
static TObject::(anonymous)TObject::kWriteDelete
static TSpectrum2Painter::(anonymous)kZScaleLinear
static TSpectrum2Painter::(anonymous)kZScaleLog
static TSpectrum2Painter::(anonymous)kZScaleSqrt
static TObject::(anonymous)TObject::kZombie
protected:
Int_tfAlphaangles of display,alfa+beta must be less or equal to 90, alpha- angle between base line of Canvas and right lower edge of picture base plane
Int_tfBetaangle between base line of Canvas and left lower edge of picture base plane
Int_tfBezierdetermines Bezier interpolation (applies only for simple display modes group for grid, x_lines, y_lines display modes)
Int_tfBx1positon of picture on Canvas, min x
Int_tfBx2positon of picture on Canvas, max x
Int_tfBy1positon of picture on Canvas, min y
Int_tfBy2positon of picture on Canvas, max y
Int_tfBzX[4]
Int_tfBzY[4]
Int_tfChanlineColorcolor of channel lines (grid)
Int_tfChanlineEnDisdecides whether the channel lines (grid) are shown
Int_tfChanmarkColorcolor of channel marks
Int_tfChanmarkEnDisdecides whether the channel marks are shown
Int_tfChanmarkHeightheight of channel marks
Int_tfChanmarkStylestyle of channel marks
Int_tfChanmarkWidthwidth of channel marks
Int_tfColorAlgapplies only for rainbowed display modes (rgb smooth alorithm, rgb modulo color component, cmy smooth alorithm, cmy modulo color component, cie smooth alorithm, cie modulo color component, yiq smooth alorithm, yiq modulo color component, hsv smooth alorithm, hsv modulo color component, it does not apply for simple display modes algorithm group
Int_tfContWidthwidth between contours, applies only for contours display mode
Int_tfDisplayModespectrum display mode (points, grid, contours, bars, x_lines, y_lines, bars_x, bars_y, needles, surface, triangles)
Double_tfDxspline
Double_tfDyspline
Short_t*fEnvelope!
Short_t*fEnvelopeContour!
Double_tfGbezx
Double_tfGbezy
TH2*fH2pointer to 2D histogram TH2
Double_tfKx
Double_tfKy
Double_tfLHweightweight between shading according to fictive light source and according to channels counts, applies only for kModeGroupLightHeight modes group
Int_tfLevels# of color levels for rainbowed display modes, it does not apply for simple display modes algorithm group
Int_tfLine
Int_tfMaximumXScreenResolution!buffers' size
Int_tfModeGroupdisplay mode algorithm group (simple modes-kModeGroupSimple, modes with shading according to light-kModeGroupLight, modes with shading according to channels counts-kModeGroupHeight, modes of combination of shading according to light and to channels counts-kModeGroupLightHeight)
Double_tfMxx
Double_tfMxy
Double_tfMyx
Double_tfMyy
TStringTNamed::fNameobject identifier
TColor*fNewColor!
Int_tfNewColorIndex
Int_tfNodesxnumber of nodes in x dimension of grid
Int_tfNodesynumber of nodes in y dimension of grid
Double_tfNuSli
Int_tfPenColorcolor of spectrum
Int_tfPenDashstyle of pen
Int_tfPenWidthwidth of line
Double_tfRainbow1Stepdetermines the first component step for neighbouring color levels, applies only for rainbowed display modes, it does not apply for simple display modes algorithm group
Double_tfRainbow2Stepdetermines the second component step for neighbouring color levels, applies only for rainbowed display modes, it does not apply for simple display modes algorithm group
Double_tfRainbow3Stepdetermines the third component step for neighbouring color levels, applies only for rainbowed display modes, it does not apply for simple display modes algorithm group
Int_tfShadingdetermines whether the picture will shaded, smoothed (no shading, shading), for rainbowed display modes only
Int_tfShadowdetermines whether shadow will be drawn (no shadow, shadow), for rainbowed display modes with shading according to light
TStringTNamed::fTitleobject title
Double_tfTxx
Double_tfTxy
Double_tfTyx
Double_tfTyy
Double_tfTyz
Int_tfViewAnglerotation angle of the view, it can be 0, 90, 180, 270 degrees
Double_tfVx
Double_tfVy
Int_tfXe
Int_tfXlightx position of fictive light source, applies only for rainbowed display modes with shading according to light
Int_tfXmaxx-end channel of spectrum
Int_tfXminx-starting channel of spectrum
Int_tfXs
Int_tfXt
Int_tfYe
Int_tfYlighty position of fictive light source, applies only for rainbowed display modes with shading according to light
Int_tfYmaxy-end channel of spectrum
Int_tfYminy-starting channel of spectrum
Int_tfYs
Int_tfYt
Double_tfZ
Double_tfZPresetValue
Double_tfZeq
Int_tfZlightz position of fictive light source, applies only for rainbowed display modes with shading according to light
Double_tfZmaxcounts full scale
Double_tfZminbase counts
Int_tfZscalez scale (linear, log, sqrt)

Class Charts

Inheritance Chart:
TObject
TNamed
TSpectrum2Painter

Function documentation

TSpectrum2Painter(TH2* h2, Int_t bs)
 TSpectrum2Painter normal constructor
~TSpectrum2Painter()
 TSpectrum2Painter destructor
void Transform(Int_t it, Int_t jt, Int_t zmt)
 Reads out the value from histogram and calculates screen coordinates

 Parameters:
    -it - node in x- direction
    -jt - node in y- direction
    -zmt - control variable
Double_t ColorCalculation(Double_t dx1, Double_t dy1, Double_t z1, Double_t dx2, Double_t dy2, Double_t z2, Double_t dx3, Double_t dy3, Double_t z3)
 Calculates and returns color value for the surface triangle
 given by function parameters:
    -dx1,dy1,z1 coordinates of the first point in 3d space
    -dx2,dy2,z2 coordinates of the second point in 3d space
    -dx3,dy3,z3 coordinates of the third point in 3d space
Double_t ShadowColorCalculation(Double_t xtaz, Double_t ytaz, Double_t ztaz, Double_t shad_noise)
 Determines whether the center of the triangle in 3-d space
 given by function parameters:
   -xtaz,ytaz,ztaz
   is in shadow or not. If yes it return 1 otherwise it returns 0.
void ColorModel(unsigned int ui, unsigned int ui1, unsigned int ui2, unsigned int ui3)
 This function calculates color for one palette entry
 given by function parameter ui. Other parameters
    -ui1,ui2,ui3
    represent r, g, b color components of the basic pen color.
Int_t BezC(Int_t i)
 This function is called from BezierBlend function.
Double_t BezierBlend(Int_t i, Double_t bezf)
 This function calculates Bezier approximation.
void BezierSmoothing(Double_t bezf)
 Calculates screen coordinates of the smoothed point.
 Parameter bezf changes within the interval 0 to 1 in 0.1 steps.
void Envelope(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
 Ensures hidden surface removal.
void EnvelopeBars(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
 Ensures hidden surfuce removal for Bars, BarsX and BarsY
 display modes.
void DrawMarker(Int_t x, Int_t y, Int_t w, Int_t h, Int_t type)
 Draws channel mark at the screen coordinates x, y. Width of
 the mark is w, height is h and the type of the mark is determined by the
 parameter type.
void Slice(Double_t xr, Double_t yr, Double_t xs, Double_t ys, TLine* line)
 Calculates screen coordinates of the line given by two
 nodes for contours display mode. The line is given by two points
 xr, yr, xs, ys. Finally it draws the line.
void CopyEnvelope(Double_t xr, Double_t xs, Double_t yr, Double_t ys)
 Copies envelope vector, which ensures hidden surface removal for the
 contours display mode.
void Paint(Option_t* option)
 Paints histogram according to preset parameters.

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:

  • kModeGroupSimple - it covers simple display modes using one color only

  • kModeGroupLight - in this group the shading is carried out according to the position of the fictive light source

  • kModeGroupHeight - in this group the shading is carried out according to the channel contents

  • kModeGroupLightHeight - combination of two previous shading algorithms. One can control the weight between both algorithms.

Display modes:

  • kDisplayModePoints,

  • kDisplayModeGrid,

  • kDisplayModeContours,

  • kDisplayModeBars,

  • kDisplayModeLinesX,

  • kDisplayModeLinesY,

  • kDisplayModeBarsX,

  • kDisplayModeBarsY,

  • kDisplayModeNeedles,

  • kDisplayModeSurface,

  • kDisplayModeTriangles.
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:

  • modeGroup = kModeGroupLightHeight

  • displayMode = kDisplayModeSurface

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:

  • kPenStyleSolid,

  • kPenStyleDash,

  • kPenStyleDot,

  • kPenStyleDashDot.

Default values:

  • color = kBlack

  • style = kPenStyleSolid

  • width = 1

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:

  • nodesx = Xmax-Xmin+1

  • nodesy = Ymax-Ymin+1

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:

  • alpha = 20

  • beta = 60

  • view = 0

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:

  • kZScaleLinear

  • kZScaleLog

  • kZScaleSqrt

Default value is:

  • scale = kZScaleLinear

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

Function:

TSpectrum2Painter::SetColorIncrements(Double_t r,Double_t g,Double_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:

  • kColorAlgRgbSmooth

  • kColorAlgRgbModulo

  • kColorAlgCmySmooth

  • kColorAlgCmyModulo

  • kColorAlgCieSmooth

  • kColorAlgCieModulo

  • kColorAlgYiqSmooth

  • kColorAlgYiqModulo

  • kColorAlgHvsSmooth

  • kColorAlgHvsModulo

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

  • colorAlgorithm = kColorAlgRgbSmooth

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:

  • kNotShaded

  • kShaded.

Possible values for shadow are:

  • kShadowsNotPainted

  • kShadowsPainted

Default values:

  • shading = kShaded

  • shadow = kShadowsNotPainted

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:

  • kNoBezierInterpol

  • kBezierInterpol

Default value is:

  • bezier = kNoBezierInterpol.

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(Double_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:

  • kChannelMarksNotDrawn

  • kChannelMarksDrawn.
The possible styles can be chosen from the set:

  • kChannelMarksStyleDot

  • kChannelMarksStyleCross

  • kChannelMarksStyleStar

  • kChannelMarksStyleRectangle

  • kChannelMarksStyleX

  • kChannelMarksStyleDiamond

  • kChannelMarksStyleTriangle.

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:

  • kChannelGridNotDrawn

  • kChannelGridDrawn.

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");
}
void SetDisplayMode(Int_t modeGroup, Int_t displayMode)
 Sets display group mode and display mode:
    -modeGroup - the following group modes can be set: simple modes-kPicture2ModeGroupSimple, modes with shading according to light-kPicture2ModeGroupLight, modes with shading according to channels counts-kPicture2ModeGroupHeight, modes of combination of shading according to light and to channels counts-kPicture2ModeGroupLightHeight
    -displayMode - posible display modes are: points, grid, contours, bars, x_lines, y_lines, bars_x, bars_y, needles, surface, triangles
void SetPenAttr(Int_t color, Int_t style, Int_t width)
 Sets pen attributes:
    -color - color of spectrum
    -style - style of pen (solid, dash, dot, dash-dot)
    -width - width of pen in pixels
void SetNodes(Int_t nodesx, Int_t nodesy)
 Sets nodes in both directions:
    -nodesx, nodesy, only the bins at the nodes points are displayed
void SetAngles(Int_t alpha, Int_t beta, Int_t view)
 Sets angles of the view:
    -alpha - angles of display,alpha+beta must be less or equal to 90, alpha- angle between base line of Canvas and right lower edge of picture base plane
    -beta - angle between base line of Canvas and left lower edge of picture base plane
    -view - rotation angle of the view, it can be 0, 90, 180, 270 degrees
void SetZScale(Int_t scale)
 Sets z-axis scale:
    -scale - linear, sqrt or log
void SetColorAlgorithm(Int_t colorAlgorithm)
 Sets shading color algorithm:
    -colorAlgorithm - applies only for rainbowed display modes
    (rgb smooth alorithm, rgb modulo color component, cmy smooth alorithm,
    cmy modulo color component, cie smooth alorithm,
    cie modulo color component, yiq smooth alorithm,
    yiq modulo color component, hsv smooth alorithm,
    hsv modulo color component, it does not apply for simple display modes
    algorithm group
void SetColorIncrements(Double_t r, Double_t g, Double_t b)
 Sets color increments between two color levels for r, g, b components:
    -r, g, b - color increments between two color levels
void SetLightPosition(Int_t x, Int_t y, Int_t z)
 Sets position of fictive light source in 3D space:
    -x, y, z
void SetShading(Int_t shading, Int_t shadow)
 Sets on/off shading and shadow switches:
    -shading - determines whether the picture will shaded, smoothed (no shading, shading), for rainbowed display modes only
    -shadow - determines whether shadow will be drawn, for rainbowed display modes with shading according to light
void SetBezier(Int_t bezier)
 Sets on/off Bezier smoothing:
    -bezier - determines Bezier interpolation (applies only for simple
    display modes group for grid, x_lines, y_lines display modes)
void SetContourWidth(Int_t width)
 Sets width between horizontal slices:
    -width - width between contours, applies only for contours display mode
void SetLightHeightWeight(Double_t weight)
 Sets weight between shading according to fictive light source and according to channels counts:
    -weight - weight between shading according to fictive light source and according to channels counts, applies only for kPicture2ModeGroupLightHeight modes group
void SetChanMarks(Int_t enable, Int_t color, Int_t width, Int_t height, Int_t style)
 Sets enables/disables drawing of channel marks and sets their attributes:
    -enable - decides whether the channel marks are shown or not
    -color - color of channel marks
    -width - width of channel marks in pixels
    -height - height of channel marks in pixels
    -style - style of channel marks (dot, cross, star, rectangle, X, diamond, triangle)
void SetChanGrid(Int_t enable, Int_t color)
   This function sets enables/disables drawing of channel grid and sets its color:
         -enable - decides whether the channel grid is shown or not
         -color - color of channel grid
void GetDisplayMode(Int_t& modeGroup, Int_t& displayMode)
 Gets display group mode and display mode:
    -modeGroup - the following group modes might have been set: simple modes-kPicture2ModeGroupSimple, modes with shading according to light-kPicture2ModeGroupLight, modes with shading according to channels counts-kPicture2ModeGroupHeight, modes of combination of shading according to light and to channels counts-kPicture2ModeGroupLightHeight
    -displayMode - display modes that might have been set: points, grid, contours, bars, x_lines, y_lines, bars_x, bars_y, needles, surface, triangles
void GetPenAttr(Int_t& color, Int_t& style, Int_t& width)
 Gets pen attributes:
    -color - color of spectrum
    -style - style of pen (solid, dash, dot, dash-dot)
    -width - width of pen in pixels
void GetNodes(Int_t& nodesx, Int_t& nodesy)
 Gets nodes in both directions:
    -nodesx, nodesy, only the bins at the nodes points are displayed
void GetAngles(Int_t& alpha, Int_t& beta, Int_t& view)
 Gets angles of the view:
    -alpha - angle between base line of Canvas and right lower edge of picture base plane
    -beta - angle between base line of Canvas and left lower edge of picture base plane
    -view - rotation angle of the view, it can be 0, 90, 180, 270 degrees
void GetZScale(Int_t& scale)
 Gets z-axis scale:
    -scale - it can be linear, sqrt or log
void GetColorAlgorithm(Int_t& colorAlgorithm)
 Gets shading color algorithm:
    -colorAlgorithm - rgb smooth alorithm, rgb modulo color component, cmy smooth alorithm, cmy modulo color component, cie smooth alorithm, cie modulo color component, yiq smooth alorithm, yiq modulo color component, hsv smooth alorithm, hsv modulo algorithm
void GetColorIncrements(Double_t& r, Double_t& g, Double_t& b)
 Gets color increments between two color levels for r, g, b components:
    -r, g, b - color increments between two color levels
void GetLightPosition(Int_t& x, Int_t& y, Int_t& z)
 Gets position of fictive light source in 3D space:
    -x, y, z
void GetShading(Int_t& shading, Int_t& shadow)
 Gets shading and shadow switches:
    -shading - determines whether the picture will shaded, smoothed (no shading, shading), for rainbowed display modes only
    -shadow - determines whether shadow will be drawn, for rainbowed display modes with shading according to light
void GetBezier(Int_t& bezier)
 Gets Bezier smoothing switch:
    -bezier - determines Bezier interpolation (applies only for simple display modes group for grid, x_lines, y_lines display modes)
void GetContourWidth(Int_t& width)
 Gets width between horizontal slices:
    -width - width between contours, applies only for contours display mode
void GetLightHeightWeight(Double_t& weight)
 Gets weight between shading according to fictive light source and according to channels counts:
    -weight - weight between shading according to fictive light source and according to channels counts, applies only for kPicture2ModeGroupLightHeight modes group
void GetChanMarks(Int_t& enable, Int_t& color, Int_t& width, Int_t& height, Int_t& style)
 Gets drawing attributes for channel marks:
    -enable - decides whether the channel marks are shown or not
    -color - color of channel marks
    -width - width of channel marks in pixels
    -height - height of channel marks in pixels
    -style - style of channel marks (dot, cross, star, rectangle, X, diamond, triangle)
void GetChanGrid(Int_t& enable, Int_t& color)
 This function gets attributes for drawing channel:
    -enable - decides whether the channel grid is shown or not
    -color - color of channel grid
void PaintSpectrum(TH2* h2, Option_t* option = "", Int_t bs = 1600)
 This function allows to set all the possible options available in
 TSpectrum2Painter and paint "h2".

 TSpectrum2Painter offers a large set of options/attributes. In the
 "option" parameter each of them can be set to specific values via
 "operators" in the option itself. for instance on can do:

  h2->Draw("SPEC a(30,30,0)");

 to draw h2 with TSpectrum2Painter using all the default attributes except
 the viewing angles. The operators' names are case unsensitive (one can use
 "a" or "A"). Operators parameters are seperated by ",". The operators can
 be put is any order in the option. Operators must be serparated by " ".
 No " " characters should be put in an operator. This help page describes
 all the available operators.

                               * * *

 The way "h2" will be painted is controled with 2 parameters the "Display
 modes groups" and the "Display Modes".

   "Display modes groups" can take the following values:

   0 = Simple      - it covers simple display modes using one color only
   1 = Light       - in this group the shading is carried out according to
                     the position of the fictive light source
   2 = Height      - in this group the shading is carried out according to
                     the channel contents
   3 = LightHeight - combination of two previous shading algorithms. One
                     can control the weight between both algorithms.

   "Display modes" can take the following values:

    1 = Points.
    2 = Grid.
    3 = Contours.
    4 = Bars.
    5 = LinesX.
    6 = LinesY.
    7 = BarsX.
    8 = BarsY.
    9 = Needles.
   10 = Surface.
   11 = Triangles.

 Using this function these parameters can be set using the "dm" operator
 in the option. Example:

   h2->Draw("SPEC dm(1,2)");

 will paint the 2D histogram h2 using the "Light Display mode group" and
 the "Grid Display mode". The following table summarizes all the possible
 combinations of the "Display modes groups" and the "Display modes".

                  +--------+-------+--------+--------------+
                  | Simple | Light | Height | Light-Height |
      +-----------+--------+-------+--------+--------------+
      | Points    |   X    |   X   |   X    |      X       |
      +-----------+--------+-------+--------+--------------+
      | Grid      |   X    |   X   |   X    |      X       |
      +-----------+--------+-------+--------+--------------+
      | Contours  |   X    |   -   |   X    |      -       |
      +-----------+--------+-------+--------+--------------+
      | Bars      |   X    |   -   |   X    |      -       |
      +-----------+--------+-------+--------+--------------+
      | LinesX    |   X    |   X   |   X    |      X       |
      +-----------+--------+-------+--------+--------------+
      | LinesY    |   X    |   X   |   X    |      X       |
      +-----------+--------+-------+--------+--------------+
      | BarsX     |   X    |   -   |   X    |      -       |
      +-----------+--------+-------+--------+--------------+
      | BarsY     |   X    |   -   |   X    |      -       |
      +-----------+--------+-------+--------+--------------+
      | Needles   |   X    |   -   |   -    |      -       |
      +-----------+--------+-------+--------+--------------+
      | Surface   |   -    |   X   |   X    |      X       |
      +-----------+--------+-------+--------+--------------+
      | Triangles |   X    |   X   |   X    |      X       |
      +-----------+--------+-------+--------+--------------+

                               * * *

 The Pen Attributes can be changed using pa(color, style, width). Example:

   h2->Draw("SPEC dm(1,2) pa(2,1,2)");

 sets the line color to 2, line type to 1 and line width to2. Note that if
 pa() is not specified, the histogram "h2" line attributes are used. Note
 also that operators for SPEC option can be cummulated and specified in
 any order.

                               * * *

 The buffer size can be change with bf(size). Example:

   h2->Draw("SPEC bf(8000)");

 The spectrum painter needs a buffer to paint the spectrum. By default the
 buffer size is set to 1600. In most cases this buffer size is enough. But
 if the canvas size is very big, for instance 8000x5000 this buffer size is
 too small. An error message is issued telling to use the option bf().

                               * * *

 The number of nodes can be change with n(nodesx, nodesy). Example:

   h2->Draw("SPEC n(40,40)");

 Sometimes the displayed region is rather large. When displaying all
 channels pictures become very dense and complicated. It is very difficult
 to understand the overall shape of data. "n(nx,ny)" allows to change the
 density of displayed channels. Only the channels coinciding with given
 nodes are displayed.

                               * * *

 The visualization angles can be changed with a(alpha, beta, view).
 Example:

   h2->Draw("SPEC n(40,40) dm(0,1) a(30,30,0)");

 Alpha 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.

                               * * *

 zs(scale) changes the scale of the Z-axis Possible values are:

   0 = Linear (default)
   1 = Log
   2 = Sqrt

 If gPad->SetLogz() has been set, log scale on Z-axis is set automatically.
 No need to use the zs() operator. Note that the X and Y axis are always
 linear.

                               * * *

 ci(r,g,b), were r,g and b are floats defines the colors increments.
 For sophisticated shading (Light, Height and LightHeight Display Modes
 Groups) the color palette starts from the basic pen color (see pa()
 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 dor the Simple Display Modes Group. The default values are:
 (1,1,1).

                               * * *

 ca(color_algorithm) allows to choose the Color Algorithm.
 To define the colors one can employ one of the following color algorithms
 (RGB, CMY, CIE, YIQ, HVS models). When the level of a component reaches
 the limit value one can choose either smooth transition (by decreasing
 the limit value) or a 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:

   0 = RGB Smooth
   1 = RGB Modulo
   2 = CMY Smooth
   3 = CMY Modulo
   4 = CIE Smooth
   5 = CIE Modulo
   6 = YIQ Smooth
   7 = YIQ Modulo
   8 = HVS Smooth
   9 = HVS Modulo

 This function does not apply on Simple display modes group. Default
 value is 0. Example:

   h2->Draw("SPEC c1(4) dm(0,1) a(30,30,0)");

 choose CMY Modulo to paint the "h2" histogram.

                               * * *

 lp(x,y,z) set the light position.
 In Light and LightHeight 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. This function does not apply for
 Simple and Height display modes groups. Default is:
 lp(1000,1000,100).

                               * * *

 s(shading,shadow) allows to set the shading.
 The picture's surface 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 Simple display modes group. The possible values for shading are:

   0 = Not Shaded
   1 = Shaded

 The possible values for shadow are:

   0 = Shadows are not painted
   1 = Shadows are painted

 Default values: s(1,0)

                               * * *

 b(bezier) set the Bezier smoothing.
 For Simple display modes group and for Grid, LinesX and LinesY 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:

   0 = No bezier smoothing
   1 = Bezier smoothing

 Default value is: b(0)

                               * * *

 cw(width) set the contour width.
 This function applies only for the Contours display mode. One can change
 the width between horizontal slices and thus their density.
 Default value: cw(50)

                               * * *

 lhw(weight) set the light height weight.
 For LightHeight display modes group one can change the weight between
 both shading algorithms. The function does not apply for other display
 modes groups. Default value is lhw(0.5).

                               * * *

 cm(enable,color,width,height,style) allows to draw a marker on each node.
 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

   0 =  Channel marks are not drawn
   1 =  Channel marks drawn

 The possible styles can be chosen from the set:

   1 = Dot
   2 = Cross
   3 = Star
   4 = Rectangle
   5 = X
   6 = Diamond
   7 = Triangle.

                               * * *

 cg(enable,color) channel grid.
 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:

   0 = Grid not drawn
   1 = Grid drawn

                               * * *

 See example in $ROOTSYS/tutorials/spectrum/spectrumpainter.C

/* */
TSpectrum2Painter(TH2* h2, Int_t bs)
TSpectrum2Painter& operator=(const TSpectrum2Painter& )