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.
Definition at line 30 of file TSpectrum2Painter.h.
Public Member Functions | |
TSpectrum2Painter (TH2 *h2, Int_t bs) | |
TSpectrum2Painter normal constructor. | |
~TSpectrum2Painter () override | |
TSpectrum2Painter destructor. | |
void | GetAngles (Int_t &alpha, Int_t &beta, Int_t &view) |
Gets angles of the view: | |
void | GetBezier (Int_t &bezier) |
Gets Bezier smoothing switch: | |
void | GetChanGrid (Int_t &enable, Int_t &color) |
This function gets attributes for drawing channel: | |
void | GetChanMarks (Int_t &enable, Int_t &color, Int_t &width, Int_t &height, Int_t &style) |
Gets drawing attributes for channel marks: | |
void | GetColorAlgorithm (Int_t &colorAlgorithm) |
Gets shading color algorithm: | |
void | GetColorIncrements (Double_t &r, Double_t &g, Double_t &b) |
Gets color increments between two color levels for r, g, b components: | |
void | GetContourWidth (Int_t &width) |
Gets width between horizontal slices: | |
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 | GetLightHeightWeight (Double_t &weight) |
Gets weight between shading according to fictive light source and according to channels counts: | |
void | GetLightPosition (Int_t &x, Int_t &y, Int_t &z) |
Gets position of fictive light source in 3D space: | |
void | GetNodes (Int_t &nodesx, Int_t &nodesy) |
Gets nodes in both directions: | |
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 | GetShading (Int_t &shading, Int_t &shadow) |
Gets shading and shadow switches: | |
void | GetZScale (Int_t &scale) |
Gets z-axis scale: | |
TClass * | IsA () const override |
void | Paint (Option_t *option) override |
Paints histogram according to preset parameters. | |
void | SetAngles (Int_t alpha, Int_t beta, Int_t view) |
Sets angles of the view: | |
void | SetBezier (Int_t bezier) |
Sets on/off Bezier smoothing: | |
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 | 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: | |
void | SetColorAlgorithm (Int_t colorAlgorithm) |
Sets shading color algorithm: | |
void | SetColorIncrements (Double_t r, Double_t g, Double_t b) |
Sets color increments between two color levels for r, g, b components: | |
void | SetContourWidth (Int_t width) |
Sets width between horizontal slices: | |
void | SetDisplayMode (Int_t modeGroup, Int_t displayMode) |
Sets display group mode and display mode: | |
void | SetLightHeightWeight (Double_t weight) |
Sets weight between shading according to fictive light source and according to channels counts: | |
void | SetLightPosition (Int_t x, Int_t y, Int_t z) |
Sets position of fictive light source in 3D space: | |
void | SetNodes (Int_t nodesx, Int_t nodesy) |
Sets nodes in both directions: | |
void | SetPenAttr (Int_t color, Int_t style, Int_t width) |
Sets pen attributes: | |
void | SetShading (Int_t shading, Int_t shadow) |
Sets on/off shading and shadow switches: | |
void | SetZScale (Int_t scale) |
Sets z-axis scale: | |
void | Streamer (TBuffer &) override |
Stream an object of class TObject. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
![]() | |
TNamed () | |
TNamed (const char *name, const char *title) | |
TNamed (const TNamed &named) | |
TNamed copy ctor. | |
TNamed (const TString &name, const TString &title) | |
virtual | ~TNamed () |
TNamed destructor. | |
void | Clear (Option_t *option="") override |
Set name and title to empty strings (""). | |
TObject * | Clone (const char *newname="") const override |
Make a clone of an object using the Streamer facility. | |
Int_t | Compare (const TObject *obj) const override |
Compare two TNamed objects. | |
void | Copy (TObject &named) const override |
Copy this to obj. | |
virtual void | FillBuffer (char *&buffer) |
Encode TNamed into output buffer. | |
const char * | GetName () const override |
Returns name of object. | |
const char * | GetTitle () const override |
Returns title of object. | |
ULong_t | Hash () const override |
Return hash value for this object. | |
Bool_t | IsSortable () const override |
void | ls (Option_t *option="") const override |
List TNamed name and title. | |
TNamed & | operator= (const TNamed &rhs) |
TNamed assignment operator. | |
void | Print (Option_t *option="") const override |
Print TNamed name and title. | |
virtual void | SetName (const char *name) |
Set the name of the TNamed. | |
virtual void | SetNameTitle (const char *name, const char *title) |
Set all the TNamed parameters (name and title). | |
virtual void | SetTitle (const char *title="") |
Set the title of the TNamed. | |
virtual Int_t | Sizeof () const |
Return size of the TNamed part of the TObject. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
![]() | |
TObject () | |
TObject constructor. | |
TObject (const TObject &object) | |
TObject copy ctor. | |
virtual | ~TObject () |
TObject destructor. | |
void | AbstractMethod (const char *method) const |
Use this method to implement an "abstract" method that you don't want to leave purely abstract. | |
virtual void | AppendPad (Option_t *option="") |
Append graphics object to current pad. | |
virtual void | Browse (TBrowser *b) |
Browse object. May be overridden for another default action. | |
ULong_t | CheckedHash () |
Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. | |
virtual const char * | ClassName () const |
Returns name of class to which the object belongs. | |
virtual void | Delete (Option_t *option="") |
Delete this object. | |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
Computes distance from point (px,py) to the object. | |
virtual void | Draw (Option_t *option="") |
Default Draw method for all objects. | |
virtual void | DrawClass () const |
Draw class inheritance tree of the class to which this object belongs. | |
virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1) . | |
virtual void | Dump () const |
Dump contents of object on stdout. | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. | |
virtual void | Execute (const char *method, const char *params, Int_t *error=nullptr) |
Execute method on this object with the given parameter string, e.g. | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr) |
Execute method on this object with parameters stored in the TObjArray. | |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
Execute action corresponding to an event at (px,py). | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. | |
virtual TObject * | FindObject (const char *name) const |
Must be redefined in derived classes. | |
virtual TObject * | FindObject (const TObject *obj) const |
Must be redefined in derived classes. | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. | |
virtual const char * | GetIconName () const |
Returns mime type name of object. | |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Returns string containing info about the object at position (px,py). | |
virtual Option_t * | GetOption () const |
virtual UInt_t | GetUniqueID () const |
Return the unique object id. | |
virtual Bool_t | HandleTimer (TTimer *timer) |
Execute action in response of a timer timing out. | |
Bool_t | HasInconsistentHash () const |
Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e. | |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. | |
virtual Bool_t | InheritsFrom (const char *classname) const |
Returns kTRUE if object inherits from class "classname". | |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
Returns kTRUE if object inherits from TClass cl. | |
virtual void | Inspect () const |
Dump contents of this object in a graphics canvas. | |
void | InvertBit (UInt_t f) |
Bool_t | IsDestructed () const |
IsDestructed. | |
virtual Bool_t | IsEqual (const TObject *obj) const |
Default equal comparison (objects are equal if they have the same address in memory). | |
virtual Bool_t | IsFolder () const |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). | |
R__ALWAYS_INLINE Bool_t | IsOnHeap () const |
R__ALWAYS_INLINE Bool_t | IsZombie () const |
void | MayNotUse (const char *method) const |
Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). | |
virtual Bool_t | Notify () |
This method must be overridden to handle object notification. | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. | |
void | operator delete (void *ptr) |
Operator delete. | |
void | operator delete[] (void *ptr) |
Operator delete []. | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz) |
void * | operator new[] (size_t sz, void *vp) |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. | |
virtual void | Pop () |
Pop on object drawn in a pad to the top of the display list. | |
virtual Int_t | Read (const char *name) |
Read contents of object with specified name from the current directory. | |
virtual void | RecursiveRemove (TObject *obj) |
Recursively remove this object from a list. | |
void | ResetBit (UInt_t f) |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
Save this object in the file specified by filename. | |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
Save a primitive as a C++ statement(s) on output stream "out". | |
void | SetBit (UInt_t f) |
void | SetBit (UInt_t f, Bool_t set) |
Set or unset the user status bits as specified in f. | |
virtual void | SetDrawOption (Option_t *option="") |
Set drawing option for object. | |
virtual void | SetUniqueID (UInt_t uid) |
Set the unique object id. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. | |
R__ALWAYS_INLINE Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
virtual void | UseCurrentStyle () |
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. | |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. | |
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) |
Write this object to the current directory. | |
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const |
Write this object to the current directory. | |
Static Public Member Functions | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static 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". | |
![]() | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
![]() | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static Longptr_t | GetDtorOnly () |
Return destructor only flag. | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. | |
Protected Member Functions | |
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. | |
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. | |
void | ColorModel (unsigned ui, unsigned ui1, unsigned ui2, unsigned ui3) |
This function calculates color for one palette entry given by function parameter ui. | |
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 | 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. | |
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 surface removal for Bars, BarsX and BarsY display modes. | |
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: | |
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. | |
void | Transform (Int_t it, Int_t jt, Int_t zmt) |
Reads out the value from histogram and calculates screen coordinates. | |
![]() | |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
Interface to ErrorHandler (protected). | |
void | MakeZombie () |
Private Member Functions | |
TSpectrum2Painter (const TSpectrum2Painter &) | |
TSpectrum2Painter & | operator= (const TSpectrum2Painter &) |
Additional Inherited Members | |
![]() | |
enum | { kOnlyPrepStep = (1ULL << ( 3 )) } |
#include <TSpectrum2Painter.h>
anonymous enum |
Definition at line 68 of file TSpectrum2Painter.h.
TSpectrum2Painter normal constructor.
Definition at line 55 of file TSpectrum2Painter.cxx.
|
override |
TSpectrum2Painter destructor.
Definition at line 178 of file TSpectrum2Painter.cxx.
|
private |
This function is called from BezierBlend function.
Definition at line 753 of file TSpectrum2Painter.cxx.
This function calculates Bezier approximation.
Definition at line 766 of file TSpectrum2Painter.cxx.
|
protected |
Calculates screen coordinates of the smoothed point.
Parameter bezf changes within the interval 0 to 1 in 0.1 steps.
Definition at line 781 of file TSpectrum2Painter.cxx.
|
static |
|
inlinestaticconstexpr |
Definition at line 205 of file TSpectrum2Painter.h.
|
protected |
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.
Definition at line 244 of file TSpectrum2Painter.cxx.
|
protected |
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.
Definition at line 476 of file TSpectrum2Painter.cxx.
|
protected |
Copies envelope vector, which ensures hidden surface removal for the contours display mode.
Definition at line 1144 of file TSpectrum2Painter.cxx.
|
inlinestatic |
Definition at line 205 of file TSpectrum2Painter.h.
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.
Definition at line 1001 of file TSpectrum2Painter.cxx.
Ensures hidden surface removal.
Definition at line 799 of file TSpectrum2Painter.cxx.
Ensures hidden surface removal for Bars, BarsX and BarsY display modes.
Definition at line 912 of file TSpectrum2Painter.cxx.
Gets angles of the view:
Definition at line 7325 of file TSpectrum2Painter.cxx.
void TSpectrum2Painter::GetBezier | ( | Int_t & | bezier | ) |
Gets Bezier smoothing switch:
Definition at line 7393 of file TSpectrum2Painter.cxx.
This function gets attributes for drawing channel:
Definition at line 7439 of file TSpectrum2Painter.cxx.
void TSpectrum2Painter::GetChanMarks | ( | Int_t & | enable, |
Int_t & | color, | ||
Int_t & | width, | ||
Int_t & | height, | ||
Int_t & | style | ||
) |
Gets drawing attributes for channel marks:
Definition at line 7427 of file TSpectrum2Painter.cxx.
void TSpectrum2Painter::GetColorAlgorithm | ( | Int_t & | colorAlgorithm | ) |
Gets shading color algorithm:
Definition at line 7347 of file TSpectrum2Painter.cxx.
Gets color increments between two color levels for r, g, b components:
Definition at line 7357 of file TSpectrum2Painter.cxx.
void TSpectrum2Painter::GetContourWidth | ( | Int_t & | width | ) |
Gets width between horizontal slices:
Definition at line 7403 of file TSpectrum2Painter.cxx.
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.
Definition at line 7287 of file TSpectrum2Painter.cxx.
void TSpectrum2Painter::GetLightHeightWeight | ( | Double_t & | weight | ) |
Gets weight between shading according to fictive light source and according to channels counts:
Definition at line 7413 of file TSpectrum2Painter.cxx.
Gets position of fictive light source in 3D space:
Definition at line 7369 of file TSpectrum2Painter.cxx.
Gets nodes in both directions:
Definition at line 7312 of file TSpectrum2Painter.cxx.
Gets pen attributes: -color - color of spectrum -style - style of pen (solid, dash, dot, dash-dot) -width - width of pen in pixels.
Definition at line 7300 of file TSpectrum2Painter.cxx.
Gets shading and shadow switches:
Definition at line 7382 of file TSpectrum2Painter.cxx.
void TSpectrum2Painter::GetZScale | ( | Int_t & | scale | ) |
Gets z-axis scale:
Definition at line 7337 of file TSpectrum2Painter.cxx.
|
inlineoverridevirtual |
Reimplemented from TNamed.
Definition at line 205 of file TSpectrum2Painter.h.
|
private |
|
overridevirtual |
Paints histogram according to preset parameters.
This package has several display mode groups and display modes, which can be employed for the presentation of 2-dimensional histograms
kModeGroupSimple
- it covers simple display modes using one color onlykModeGroupLight
- in this group the shading is carried out according to the position of the fictive light sourcekModeGroupHeight
- in this group the shading is carried out according to the channel contentskModeGroupLightHeight
- combination of two previous shading algorithms. One can control the weight between both algorithms.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.
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 |
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.
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.
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.
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.
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.
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 neighbouring 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.
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.
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.
Surface of the picture is composed of triangles. If desired the edges of the neighbouring 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.
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.
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.
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.
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).
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.
[1] Morhac M., Kliman J., Matouoek 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.
Example to draw source spectrum (class TSpectrum2Painter). To execute this example, do:
Reimplemented from TObject.
Definition at line 1583 of file TSpectrum2Painter.cxx.
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 insensitive (one can use "a" or "A"). Operators parameters are separated by ",". The operators can be put is any order in the option. Operators must be separated by " ". No " " characters should be put in an operator. This help page describes all the available operators.
The way "h2" will be painted is controlled with 2 parameters the "Display modes groups" and the "Display Modes".
"Display modes groups" can take the following values:
"Display modes" can take the following values:
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 summarises 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 cumulated 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:
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 neighbouring 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:
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 neighbouring 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:
The possible values for shadow are:
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:
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
The possible styles can be chosen from the set:
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:
See example spectrumpainter.C
Definition at line 7674 of file TSpectrum2Painter.cxx.
Sets angles of the view:
Definition at line 7117 of file TSpectrum2Painter.cxx.
void TSpectrum2Painter::SetBezier | ( | Int_t | bezier | ) |
Sets on/off Bezier smoothing:
Definition at line 7205 of file TSpectrum2Painter.cxx.
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.
Definition at line 7271 of file TSpectrum2Painter.cxx.
void TSpectrum2Painter::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:
Definition at line 7244 of file TSpectrum2Painter.cxx.
void TSpectrum2Painter::SetColorAlgorithm | ( | Int_t | colorAlgorithm | ) |
Sets shading color algorithm:
Definition at line 7150 of file TSpectrum2Painter.cxx.
Sets color increments between two color levels for r, g, b components:
Definition at line 7162 of file TSpectrum2Painter.cxx.
void TSpectrum2Painter::SetContourWidth | ( | Int_t | width | ) |
Sets width between horizontal slices:
Definition at line 7218 of file TSpectrum2Painter.cxx.
Sets display group mode and display mode:
Definition at line 7071 of file TSpectrum2Painter.cxx.
void TSpectrum2Painter::SetLightHeightWeight | ( | Double_t | weight | ) |
Sets weight between shading according to fictive light source and according to channels counts:
Definition at line 7228 of file TSpectrum2Painter.cxx.
Sets position of fictive light source in 3D space:
Definition at line 7176 of file TSpectrum2Painter.cxx.
Sets nodes in both directions:
Definition at line 7102 of file TSpectrum2Painter.cxx.
Sets pen attributes:
Definition at line 7088 of file TSpectrum2Painter.cxx.
Sets on/off shading and shadow switches:
Definition at line 7191 of file TSpectrum2Painter.cxx.
void TSpectrum2Painter::SetZScale | ( | Int_t | scale | ) |
Sets z-axis scale:
Definition at line 7132 of file TSpectrum2Painter.cxx.
|
protected |
Determines whether the center of the triangle in 3-d space given by function parameters:
Definition at line 387 of file TSpectrum2Painter.cxx.
|
protected |
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.
Definition at line 1084 of file TSpectrum2Painter.cxx.
|
overridevirtual |
|
inline |
Definition at line 205 of file TSpectrum2Painter.h.
Reads out the value from histogram and calculates screen coordinates.
Parameters:
Definition at line 198 of file TSpectrum2Painter.cxx.
|
protected |
Definition at line 141 of file TSpectrum2Painter.h.
|
protected |
Definition at line 142 of file TSpectrum2Painter.h.
|
protected |
Definition at line 155 of file TSpectrum2Painter.h.
|
protected |
Definition at line 128 of file TSpectrum2Painter.h.
|
protected |
Definition at line 129 of file TSpectrum2Painter.h.
|
protected |
Definition at line 130 of file TSpectrum2Painter.h.
|
protected |
Definition at line 131 of file TSpectrum2Painter.h.
|
protected |
Definition at line 188 of file TSpectrum2Painter.h.
|
protected |
Definition at line 189 of file TSpectrum2Painter.h.
|
protected |
Definition at line 162 of file TSpectrum2Painter.h.
|
protected |
Definition at line 161 of file TSpectrum2Painter.h.
|
protected |
Definition at line 160 of file TSpectrum2Painter.h.
|
protected |
Definition at line 156 of file TSpectrum2Painter.h.
|
protected |
Definition at line 159 of file TSpectrum2Painter.h.
|
protected |
Definition at line 157 of file TSpectrum2Painter.h.
|
protected |
Definition at line 158 of file TSpectrum2Painter.h.
|
protected |
Definition at line 148 of file TSpectrum2Painter.h.
|
protected |
Definition at line 140 of file TSpectrum2Painter.h.
|
protected |
Definition at line 136 of file TSpectrum2Painter.h.
|
protected |
Definition at line 181 of file TSpectrum2Painter.h.
|
protected |
Definition at line 181 of file TSpectrum2Painter.h.
|
protected |
Definition at line 183 of file TSpectrum2Painter.h.
|
protected |
Definition at line 184 of file TSpectrum2Painter.h.
|
protected |
Definition at line 181 of file TSpectrum2Painter.h.
|
protected |
Definition at line 181 of file TSpectrum2Painter.h.
|
protected |
Definition at line 121 of file TSpectrum2Painter.h.
|
protected |
Definition at line 165 of file TSpectrum2Painter.h.
|
protected |
Definition at line 166 of file TSpectrum2Painter.h.
|
protected |
Definition at line 144 of file TSpectrum2Painter.h.
|
protected |
Definition at line 149 of file TSpectrum2Painter.h.
|
protected |
Definition at line 182 of file TSpectrum2Painter.h.
|
protected |
Definition at line 186 of file TSpectrum2Painter.h.
|
protected |
Definition at line 135 of file TSpectrum2Painter.h.
|
protected |
Definition at line 167 of file TSpectrum2Painter.h.
|
protected |
Definition at line 168 of file TSpectrum2Painter.h.
|
protected |
Definition at line 169 of file TSpectrum2Painter.h.
|
protected |
Definition at line 170 of file TSpectrum2Painter.h.
|
protected |
Definition at line 185 of file TSpectrum2Painter.h.
|
protected |
buffers' size
Definition at line 187 of file TSpectrum2Painter.h.
|
protected |
Definition at line 138 of file TSpectrum2Painter.h.
|
protected |
Definition at line 139 of file TSpectrum2Painter.h.
|
protected |
Definition at line 178 of file TSpectrum2Painter.h.
|
protected |
Definition at line 132 of file TSpectrum2Painter.h.
|
protected |
Definition at line 133 of file TSpectrum2Painter.h.
|
protected |
Definition at line 134 of file TSpectrum2Painter.h.
|
protected |
Definition at line 145 of file TSpectrum2Painter.h.
|
protected |
Definition at line 146 of file TSpectrum2Painter.h.
|
protected |
Definition at line 147 of file TSpectrum2Painter.h.
|
protected |
Definition at line 154 of file TSpectrum2Painter.h.
|
protected |
Definition at line 153 of file TSpectrum2Painter.h.
|
protected |
Definition at line 171 of file TSpectrum2Painter.h.
|
protected |
Definition at line 172 of file TSpectrum2Painter.h.
|
protected |
Definition at line 173 of file TSpectrum2Painter.h.
|
protected |
Definition at line 174 of file TSpectrum2Painter.h.
|
protected |
Definition at line 175 of file TSpectrum2Painter.h.
|
protected |
Definition at line 143 of file TSpectrum2Painter.h.
|
protected |
Definition at line 176 of file TSpectrum2Painter.h.
|
protected |
Definition at line 177 of file TSpectrum2Painter.h.
|
protected |
Definition at line 182 of file TSpectrum2Painter.h.
|
protected |
Definition at line 150 of file TSpectrum2Painter.h.
|
protected |
Definition at line 123 of file TSpectrum2Painter.h.
|
protected |
Definition at line 122 of file TSpectrum2Painter.h.
|
protected |
Definition at line 182 of file TSpectrum2Painter.h.
|
protected |
Definition at line 182 of file TSpectrum2Painter.h.
|
protected |
Definition at line 182 of file TSpectrum2Painter.h.
|
protected |
Definition at line 151 of file TSpectrum2Painter.h.
|
protected |
Definition at line 125 of file TSpectrum2Painter.h.
|
protected |
Definition at line 124 of file TSpectrum2Painter.h.
|
protected |
Definition at line 182 of file TSpectrum2Painter.h.
|
protected |
Definition at line 182 of file TSpectrum2Painter.h.
|
protected |
Definition at line 181 of file TSpectrum2Painter.h.
|
protected |
Definition at line 181 of file TSpectrum2Painter.h.
|
protected |
Definition at line 152 of file TSpectrum2Painter.h.
|
protected |
Definition at line 127 of file TSpectrum2Painter.h.
|
protected |
Definition at line 126 of file TSpectrum2Painter.h.
|
protected |
Definition at line 181 of file TSpectrum2Painter.h.
|
protected |
Definition at line 137 of file TSpectrum2Painter.h.