Logo ROOT  
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
18class TH2;
19class TLine;
20class TColor;
21
22//////////////////////////////////////////////////////////////////////////
23// //
24// TSpectrum2Painter Algorithms //
25// //
26// 3D graphics representations package. //
27// //
28//////////////////////////////////////////////////////////////////////////
29
31
32public:
34 ~TSpectrum2Painter() override;
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);
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) override;
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);
55 void SetColorAlgorithm(Int_t colorAlgorithm);
58 void SetDisplayMode(Int_t modeGroup,Int_t displayMode);
59 void SetLightHeightWeight(Double_t weight);
61 void SetNodes(Int_t nodesx,Int_t nodesy);
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
120protected:
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
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
204public:
205 ClassDefOverride(TSpectrum2Painter,0) //TSpectrum 3d graphics package
206
207private:
210
211};
212
213#endif
#define h(i)
Definition: RSha256.hxx:106
short Short_t
Definition: RtypesCore.h:39
const char Option_t
Definition: RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t g
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t style
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char y1
The color creation and management class.
Definition: TColor.h:19
Service class for 2-D histogram classes.
Definition: TH2.h:30
Use the TLine constructor to create a simple line.
Definition: TLine.h:22
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
<div class="legacybox"><h2>Legacy Code</h2> TSpectrum2Painter is a legacy interface: it is not recomm...
void GetZScale(Int_t &scale)
Gets z-axis scale:
void SetColorIncrements(Double_t r, Double_t g, Double_t b)
Sets color increments between two color levels for r, g, b components:
void ColorModel(unsigned ui, unsigned ui1, unsigned ui2, unsigned ui3)
This function calculates color for one palette entry given by function parameter ui.
void GetLightPosition(Int_t &x, Int_t &y, Int_t &z)
Gets position of fictive light source in 3D space:
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.
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.
Int_t BezC(Int_t i)
This function is called from BezierBlend function.
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.
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,...
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 SetDisplayMode(Int_t modeGroup, Int_t displayMode)
Sets display group mode and display mode:
TSpectrum2Painter(TH2 *h2, Int_t bs)
TSpectrum2Painter normal constructor.
void GetContourWidth(Int_t &width)
Gets width between horizontal slices:
void SetLightPosition(Int_t x, Int_t y, Int_t z)
Sets position of fictive light source in 3D space:
Int_t fNewColorIndex
buffers' size
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 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,...
void GetBezier(Int_t &bezier)
Gets Bezier smoothing switch:
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 GetLightHeightWeight(Double_t &weight)
Gets weight between shading according to fictive light source and according to channels counts:
void SetAngles(Int_t alpha, Int_t beta, Int_t view)
Sets angles of the view:
void SetZScale(Int_t scale)
Sets z-axis scale:
void Paint(Option_t *option) override
Paints histogram according to preset 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 GetColorAlgorithm(Int_t &colorAlgorithm)
Gets shading color algorithm:
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".
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 GetChanGrid(Int_t &enable, Int_t &color)
This function gets attributes for drawing channel:
void SetLightHeightWeight(Double_t weight)
Sets weight between shading according to fictive light source and according to channels counts:
void SetContourWidth(Int_t width)
Sets width between horizontal slices:
void SetColorAlgorithm(Int_t colorAlgorithm)
Sets shading color algorithm:
void SetShading(Int_t shading, Int_t shadow)
Sets on/off shading and shadow switches:
void GetChanMarks(Int_t &enable, Int_t &color, Int_t &width, Int_t &height, Int_t &style)
Gets drawing attributes for channel marks:
void Envelope(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Ensures hidden surface removal.
void SetBezier(Int_t bezier)
Sets on/off Bezier smoothing:
void Transform(Int_t it, Int_t jt, Int_t zmt)
Reads out the value from histogram and calculates screen coordinates.
void GetColorIncrements(Double_t &r, Double_t &g, Double_t &b)
Gets color increments between two color levels for r, g, b components:
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 GetAngles(Int_t &alpha, Int_t &beta, Int_t &view)
Gets angles of the view:
~TSpectrum2Painter() override
TSpectrum2Painter destructor.
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 GetShading(Int_t &shading, Int_t &shadow)
Gets shading and shadow switches:
TLine * line
double beta(double x, double y)
Calculates the beta function.
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17