ROOT  6.06/09
Reference Guide
TSpectrum2Painter.h
Go to the documentation of this file.
1 // @(#)root/spectrumpainter:$Id: TSpectrum2Painter.h,v 1.0
2 // Author: Miroslav Morhac 29/09/06
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TSpectrum2Painter
13 #define ROOT_TSpectrum2Painter
14 
15 
16 #ifndef ROOT_TNamed
17 #include "TNamed.h"
18 #endif
19 
20 class TH2;
21 class TLine;
22 class TColor;
23 
24 //////////////////////////////////////////////////////////////////////////
25 // //
26 // TSpectrum2Painter Algorithms //
27 // //
28 // 3D graphics representations package. //
29 // //
30 //////////////////////////////////////////////////////////////////////////
31 
32 class TSpectrum2Painter: public TNamed {
33 
34 public:
35  TSpectrum2Painter(TH2* h2, Int_t bs);
36  virtual ~TSpectrum2Painter();
37 
38  void GetAngles(Int_t &alpha,Int_t &beta,Int_t &view);
39  void GetBezier(Int_t &bezier);
40  void GetChanGrid(Int_t &enable,Int_t &color);
41  void GetChanMarks(Int_t &enable,Int_t &color,Int_t &width,Int_t &height,Int_t &style);
42  void GetColorAlgorithm(Int_t &colorAlgorithm);
44  void GetContourWidth(Int_t &width);
45  void GetDisplayMode(Int_t &modeGroup,Int_t &displayMode);
46  void GetLightHeightWeight(Double_t &weight);
47  void GetLightPosition(Int_t &x,Int_t &y,Int_t &z);
48  void GetNodes(Int_t &nodesx,Int_t &nodesy);
49  void GetPenAttr(Int_t &color, Int_t &style, Int_t &width);
50  void GetShading(Int_t &shading,Int_t &shadow);
51  void GetZScale(Int_t &scale);
52  void Paint(Option_t *option);
53  void SetAngles(Int_t alpha,Int_t beta,Int_t view);
54  void SetBezier(Int_t bezier);
55  void SetChanGrid(Int_t enable,Int_t color);
56  void SetChanMarks(Int_t enable,Int_t color,Int_t width,Int_t height,Int_t style);
57  void SetColorAlgorithm(Int_t colorAlgorithm);
59  void SetContourWidth(Int_t width);
60  void SetDisplayMode(Int_t modeGroup,Int_t displayMode);
61  void SetLightHeightWeight(Double_t weight);
62  void SetLightPosition(Int_t x,Int_t y,Int_t z);
63  void SetNodes(Int_t nodesx,Int_t nodesy);
64  void SetPenAttr(Int_t color,Int_t style,Int_t width);
65  void SetShading(Int_t shading,Int_t shadow);
66  void SetZScale(Int_t scale);
67 
68  static void PaintSpectrum(TH2* h2, Option_t *option="",Int_t bs=1600);
69 
70  enum {
120  };
121 
122 protected:
123  TH2 *fH2; //pointer to 2D histogram TH2
124  Int_t fXmin; //x-starting channel of spectrum
125  Int_t fXmax; //x-end channel of spectrum
126  Int_t fYmin; //y-starting channel of spectrum
127  Int_t fYmax; //y-end channel of spectrum
128  Double_t fZmin; //base counts
129  Double_t fZmax; //counts full scale
130  Int_t fBx1; //positon of picture on Canvas, min x
131  Int_t fBx2; //positon of picture on Canvas, max x
132  Int_t fBy1; //positon of picture on Canvas, min y
133  Int_t fBy2; //positon of picture on Canvas, max y
134  Int_t fPenColor; //color of spectrum
135  Int_t fPenDash; //style of pen
136  Int_t fPenWidth; //width of line
137  Int_t fModeGroup; //display 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)
138  Int_t fDisplayMode; //spectrum display mode (points, grid, contours, bars, x_lines, y_lines, bars_x, bars_y, needles, surface, triangles)
139  Int_t fZscale; //z scale (linear, log, sqrt)
140  Int_t fNodesx; //number of nodes in x dimension of grid
141  Int_t fNodesy; //number of nodes in y dimension of grid
142  Int_t fContWidth; //width between contours, applies only for contours display mode
143  Int_t fAlpha; //angles 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
144  Int_t fBeta; //angle between base line of Canvas and left lower edge of picture base plane
145  Int_t fViewAngle; //rotation angle of the view, it can be 0, 90, 180, 270 degrees
146  Int_t fLevels; //# of color levels for rainbowed display modes, it does not apply for simple display modes algorithm group
147  Double_t fRainbow1Step; //determines the first component step for neighbouring color levels, applies only for rainbowed display modes, it does not apply for simple display modes algorithm group
148  Double_t fRainbow2Step; //determines the second component step for neighbouring color levels, applies only for rainbowed display modes, it does not apply for simple display modes algorithm group
149  Double_t fRainbow3Step; //determines the third component step for neighbouring color levels, applies only for rainbowed display modes, it does not apply for simple display modes algorithm group
150  Int_t fColorAlg; //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
151  Double_t fLHweight; //weight between shading according to fictive light source and according to channels counts, applies only for kModeGroupLightHeight modes group
152  Int_t fXlight; //x position of fictive light source, applies only for rainbowed display modes with shading according to light
153  Int_t fYlight; //y position of fictive light source, applies only for rainbowed display modes with shading according to light
154  Int_t fZlight; //z position of fictive light source, applies only for rainbowed display modes with shading according to light
155  Int_t fShadow; //determines whether shadow will be drawn (no shadow, shadow), for rainbowed display modes with shading according to light
156  Int_t fShading; //determines whether the picture will shaded, smoothed (no shading, shading), for rainbowed display modes only
157  Int_t fBezier; //determines Bezier interpolation (applies only for simple display modes group for grid, x_lines, y_lines display modes)
158  Int_t fChanmarkEnDis; //decides whether the channel marks are shown
159  Int_t fChanmarkStyle; //style of channel marks
160  Int_t fChanmarkWidth; //width of channel marks
161  Int_t fChanmarkHeight;//height of channel marks
162  Int_t fChanmarkColor; //color of channel marks
163  Int_t fChanlineEnDis; //decides whether the channel lines (grid) are shown
164  Int_t fChanlineColor; //color of channel lines (grid)
165 
166  //auxiliary variables,transformation coeffitients for internal use only
181 
182  //auxiliary internal variables, working place
190  Int_t fBzX[4];
191  Int_t fBzY[4];
192 
193  Int_t BezC(Int_t i);
195  void BezierSmoothing(Double_t bezf);
196  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);//calculation of new color
197  void ColorModel(unsigned ui,unsigned ui1,unsigned ui2,unsigned ui3);//calculation of color according to chosen algorithm
198  void CopyEnvelope(Double_t xr,Double_t xs,Double_t yr,Double_t ys);
199  void DrawMarker(Int_t x,Int_t y,Int_t w,Int_t h,Int_t type);
200  void Envelope(Int_t x1,Int_t y1,Int_t x2,Int_t y2);
201  void EnvelopeBars(Int_t x1,Int_t y1,Int_t x2,Int_t y2);
202  Double_t ShadowColorCalculation(Double_t xtaz,Double_t ytaz,Double_t ztaz,Double_t shad_noise);//shadow color
203  void Slice(Double_t xr,Double_t yr,Double_t xs,Double_t ys,TLine *line);
204  void Transform(Int_t it,Int_t jt,Int_t zmt);//transform function
205 
206 public:
207  ClassDef(TSpectrum2Painter,0) //TSpectrum 3d graphics package
208 
209 private:
210  TSpectrum2Painter (const TSpectrum2Painter&);
211  TSpectrum2Painter& operator=(const TSpectrum2Painter&);
212 
213 };
214 
215 #endif
void SetDisplayMode(Int_t modeGroup, Int_t displayMode)
Sets display group mode and display mode: -modeGroup - the following group modes can be set: simple m...
void GetDisplayMode(Int_t &modeGroup, Int_t &displayMode)
Gets display group mode and display mode: -modeGroup - the following group modes might have been set:...
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...
Double_t BezierBlend(Int_t i, Double_t bezf)
This function calculates Bezier approximation.
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 SetBezier(Int_t bezier)
Sets on/off Bezier smoothing: -bezier - determines Bezier interpolation (applies only for simple disp...
void SetShading(Int_t shading, Int_t shadow)
Sets on/off shading and shadow switches: -shading - determines whether the picture will shaded...
void Envelope(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Ensures hidden surface removal.
TLine * line
const char Option_t
Definition: RtypesCore.h:62
TH1 * h
Definition: legend2.C:5
void GetColorAlgorithm(Int_t &colorAlgorithm)
Gets shading color algorithm: -colorAlgorithm - rgb smooth alorithm, rgb modulo color component...
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...
int Int_t
Definition: RtypesCore.h:41
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.
Int_t fNewColorIndex
buffers' size
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 const double x2[5]
#define ClassDef(name, id)
Definition: Rtypes.h:254
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 b...
void ColorModel(unsigned ui, unsigned ui1, unsigned ui2, unsigned ui3)
This function calculates color for one palette entry given by function parameter ui.
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
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 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 SetContourWidth(Int_t width)
Sets width between horizontal slices: -width - width between contours, applies only for contours disp...
void GetLightHeightWeight(Double_t &weight)
Gets weight between shading according to fictive light source and according to channels counts: -weig...
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 t...
void GetContourWidth(Int_t &width)
Gets width between horizontal slices: -width - width between contours, applies only for contours disp...
void BezierSmoothing(Double_t bezf)
Calculates screen coordinates of the smoothed point.
Service class for 2-Dim histogram classes.
Definition: TH2.h:36
TSpectrum2Painter(TH2 *h2, Int_t bs)
void Transform(Int_t it, Int_t jt, Int_t zmt)
Reads out the value from histogram and calculates screen coordinates.
virtual ~TSpectrum2Painter()
TSpectrum2Painter destructor.
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 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 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 be...
A simple line.
Definition: TLine.h:41
short Short_t
Definition: RtypesCore.h:35
void GetChanGrid(Int_t &enable, Int_t &color)
This function gets attributes for drawing channel: -enable - decides whether the channel grid is show...
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 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 n...
void GetLightPosition(Int_t &x, Int_t &y, Int_t &z)
Gets position of fictive light source in 3D space: -x, y, z.
static const double x1[5]
double Double_t
Definition: RtypesCore.h:55
int type
Definition: TGX11.cxx:120
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...
The color creation and management class.
Definition: TColor.h:23
void SetChanGrid(Int_t enable, Int_t color)
This function sets enables/disables drawing of channel grid and sets its color: -enable - decides whe...
void GetBezier(Int_t &bezier)
Gets Bezier smoothing switch: -bezier - determines Bezier interpolation (applies only for simple disp...
void SetLightHeightWeight(Double_t weight)
Sets weight between shading according to fictive light source and according to channels counts: -weig...
void Paint(Option_t *option)
Paints histogram according to preset parameters.
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 be...
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 SetLightPosition(Int_t x, Int_t y, Int_t z)
Sets position of fictive light source in 3D space: -x, y, z.
void SetColorAlgorithm(Int_t colorAlgorithm)
Sets shading color algorithm: -colorAlgorithm - applies only for rainbowed display modes (rgb smooth ...
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 GetZScale(Int_t &scale)
Gets z-axis scale: -scale - it can be linear, sqrt or log.
Int_t BezC(Int_t i)
This function is called from BezierBlend function.
void SetZScale(Int_t scale)
Sets z-axis scale: -scale - linear, sqrt or log.