Logo ROOT   6.10/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 #include "TNamed.h"
17 
18 class TH2;
19 class TLine;
20 class TColor;
21 
22 //////////////////////////////////////////////////////////////////////////
23 // //
24 // TSpectrum2Painter Algorithms //
25 // //
26 // 3D graphics representations package. //
27 // //
28 //////////////////////////////////////////////////////////////////////////
29 
30 class TSpectrum2Painter: public TNamed {
31 
32 public:
33  TSpectrum2Painter(TH2* h2, Int_t bs);
34  virtual ~TSpectrum2Painter();
35 
36  void GetAngles(Int_t &alpha,Int_t &beta,Int_t &view);
37  void GetBezier(Int_t &bezier);
38  void GetChanGrid(Int_t &enable,Int_t &color);
39  void GetChanMarks(Int_t &enable,Int_t &color,Int_t &width,Int_t &height,Int_t &style);
40  void GetColorAlgorithm(Int_t &colorAlgorithm);
42  void GetContourWidth(Int_t &width);
43  void GetDisplayMode(Int_t &modeGroup,Int_t &displayMode);
44  void GetLightHeightWeight(Double_t &weight);
46  void GetNodes(Int_t &nodesx,Int_t &nodesy);
47  void GetPenAttr(Int_t &color, Int_t &style, Int_t &width);
48  void GetShading(Int_t &shading,Int_t &shadow);
49  void GetZScale(Int_t &scale);
50  void Paint(Option_t *option);
51  void SetAngles(Int_t alpha,Int_t beta,Int_t view);
52  void SetBezier(Int_t bezier);
53  void SetChanGrid(Int_t enable,Int_t color);
54  void SetChanMarks(Int_t enable,Int_t color,Int_t width,Int_t height,Int_t style);
55  void SetColorAlgorithm(Int_t colorAlgorithm);
57  void SetContourWidth(Int_t width);
58  void SetDisplayMode(Int_t modeGroup,Int_t displayMode);
59  void SetLightHeightWeight(Double_t weight);
60  void SetLightPosition(Int_t x,Int_t y,Int_t z);
61  void SetNodes(Int_t nodesx,Int_t nodesy);
62  void SetPenAttr(Int_t color,Int_t style,Int_t width);
63  void SetShading(Int_t shading,Int_t shadow);
64  void SetZScale(Int_t scale);
65 
66  static void PaintSpectrum(TH2* h2, Option_t *option="",Int_t bs=1600);
67 
68  enum {
118  };
119 
120 protected:
121  TH2 *fH2; //pointer to 2D histogram TH2
122  Int_t fXmin; //x-starting channel of spectrum
123  Int_t fXmax; //x-end channel of spectrum
124  Int_t fYmin; //y-starting channel of spectrum
125  Int_t fYmax; //y-end channel of spectrum
126  Double_t fZmin; //base counts
127  Double_t fZmax; //counts full scale
128  Int_t fBx1; //positon of picture on Canvas, min x
129  Int_t fBx2; //positon of picture on Canvas, max x
130  Int_t fBy1; //positon of picture on Canvas, min y
131  Int_t fBy2; //positon of picture on Canvas, max y
132  Int_t fPenColor; //color of spectrum
133  Int_t fPenDash; //style of pen
134  Int_t fPenWidth; //width of line
135  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)
136  Int_t fDisplayMode; //spectrum display mode (points, grid, contours, bars, x_lines, y_lines, bars_x, bars_y, needles, surface, triangles)
137  Int_t fZscale; //z scale (linear, log, sqrt)
138  Int_t fNodesx; //number of nodes in x dimension of grid
139  Int_t fNodesy; //number of nodes in y dimension of grid
140  Int_t fContWidth; //width between contours, applies only for contours display mode
141  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
142  Int_t fBeta; //angle between base line of Canvas and left lower edge of picture base plane
143  Int_t fViewAngle; //rotation angle of the view, it can be 0, 90, 180, 270 degrees
144  Int_t fLevels; //# of color levels for rainbowed display modes, it does not apply for simple display modes algorithm group
145  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
146  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
147  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
148  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
149  Double_t fLHweight; //weight between shading according to fictive light source and according to channels counts, applies only for kModeGroupLightHeight modes group
150  Int_t fXlight; //x position of fictive light source, applies only for rainbowed display modes with shading according to light
151  Int_t fYlight; //y position of fictive light source, applies only for rainbowed display modes with shading according to light
152  Int_t fZlight; //z position of fictive light source, applies only for rainbowed display modes with shading according to light
153  Int_t fShadow; //determines whether shadow will be drawn (no shadow, shadow), for rainbowed display modes with shading according to light
154  Int_t fShading; //determines whether the picture will shaded, smoothed (no shading, shading), for rainbowed display modes only
155  Int_t fBezier; //determines Bezier interpolation (applies only for simple display modes group for grid, x_lines, y_lines display modes)
156  Int_t fChanmarkEnDis; //decides whether the channel marks are shown
157  Int_t fChanmarkStyle; //style of channel marks
158  Int_t fChanmarkWidth; //width of channel marks
159  Int_t fChanmarkHeight;//height of channel marks
160  Int_t fChanmarkColor; //color of channel marks
161  Int_t fChanlineEnDis; //decides whether the channel lines (grid) are shown
162  Int_t fChanlineColor; //color of channel lines (grid)
163 
164  //auxiliary variables,transformation coeffitients for internal use only
179 
180  //auxiliary internal variables, working place
190 
191  Int_t BezC(Int_t i);
193  void BezierSmoothing(Double_t bezf);
194  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
195  void ColorModel(unsigned ui,unsigned ui1,unsigned ui2,unsigned ui3);//calculation of color according to chosen algorithm
196  void CopyEnvelope(Double_t xr,Double_t xs,Double_t yr,Double_t ys);
197  void DrawMarker(Int_t x,Int_t y,Int_t w,Int_t h,Int_t type);
198  void Envelope(Int_t x1,Int_t y1,Int_t x2,Int_t y2);
199  void EnvelopeBars(Int_t x1,Int_t y1,Int_t x2,Int_t y2);
200  Double_t ShadowColorCalculation(Double_t xtaz,Double_t ytaz,Double_t ztaz,Double_t shad_noise);//shadow color
201  void Slice(Double_t xr,Double_t yr,Double_t xs,Double_t ys,TLine *line);
202  void Transform(Int_t it,Int_t jt,Int_t zmt);//transform function
203 
204 public:
205  ClassDef(TSpectrum2Painter,0) //TSpectrum 3d graphics package
206 
207 private:
209  TSpectrum2Painter& operator=(const TSpectrum2Painter&);
210 
211 };
212 
213 #endif
void SetDisplayMode(Int_t modeGroup, Int_t displayMode)
Sets display group mode and display mode:
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:
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:
void SetShading(Int_t shading, Int_t shadow)
Sets on/off shading and shadow switches:
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:
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:
Int_t fNewColorIndex
buffers' size
double beta(double x, double y)
Calculates the beta function.
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]
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:297
void GetAngles(Int_t &alpha, Int_t &beta, Int_t &view)
Gets angles of the view:
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:29
void GetNodes(Int_t &nodesx, Int_t &nodesy)
Gets nodes in both directions:
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.
void SetContourWidth(Int_t width)
Sets width between horizontal slices:
void GetLightHeightWeight(Double_t &weight)
Gets weight between shading according to fictive light source and according to channels counts: ...
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 GetContourWidth(Int_t &width)
Gets width between horizontal slices:
void BezierSmoothing(Double_t bezf)
Calculates screen coordinates of the smoothed point.
TRandom2 r(17)
Service class for 2-Dim histogram classes.
Definition: TH2.h:30
TSpectrum2Painter(TH2 *h2, Int_t bs)
TSpectrum2Painter normal constructor.
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:
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:
A simple line.
Definition: TLine.h:23
short Short_t
Definition: RtypesCore.h:35
void GetChanGrid(Int_t &enable, Int_t &color)
This function gets attributes for drawing channel:
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:
Two-dimensional graphics function.
void GetLightPosition(Int_t &x, Int_t &y, Int_t &z)
Gets position of fictive light source in 3D space:
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: ...
TCanvas * style()
Definition: style.C:1
Double_t y[n]
Definition: legend1.C:17
The color creation and management class.
Definition: TColor.h:19
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:
void SetLightHeightWeight(Double_t weight)
Sets weight between shading according to fictive light source and according to channels counts: ...
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
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:
void SetNodes(Int_t nodesx, Int_t nodesy)
Sets nodes in both directions:
void SetLightPosition(Int_t x, Int_t y, Int_t z)
Sets position of fictive light source in 3D space:
void SetColorAlgorithm(Int_t colorAlgorithm)
Sets shading color algorithm:
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
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:
Int_t BezC(Int_t i)
This function is called from BezierBlend function.
void SetZScale(Int_t scale)
Sets z-axis scale: