54 :
TNamed (
"Spectrum Painter2",
"Miroslav Morhac Painter")
58 gPad->Range(0, 0, 1 ,1);
60 fXmax = h2->GetNbinsX() - 1;
62 fYmax = h2->GetNbinsY() - 1;
66 for (i = 0;i <=
fXmax; i++) {
68 val = h2->GetBinContent(i + 1,
j + 1);
179 for (
int i=0; i<256; i++) {
214 if (
zf>=1.0)
zf = log(
zf);
247 Double_t da,
db,
dc=0,dd,
dl,dm,
dn,
xtaz,
ytaz,
ztaz,
v=0,
v1;
252 if (
z1>900)
z1 = 900;
254 if (
z2>900)
z2 = 900;
256 if (
z3>900)
z3 = 900;
267 if ((i==1)||(i==3)) {
482 else if (
iv>255)
iv = 255;
755 for (
j=i+1;
j<=3;
j++)
a =
a*
j;
756 for (
j=1;
j<=3-i;
j++)
a =
a/
j;
1085 Int_t krok,xi,
yi,
xj,
yj,
a,
b,as,
bs,
pr,
ae,
be;
1149 for (
a=xi;
a<=
xj;
a++) {
1155 for (
a=
xj;
a<=xi;
a++) {
1586 Int_t q1=0,
q2=0,
qv=0,
smer=0,
flag=0,i=0,
j=0,
x1=0,
y1=0,
x2=0,
y2=0,
x3=0,
y3=0,
x4=0,
y4=0,
uhl=0,
xp1=0,
yp1=0,
xp2=0,
yp2=0;
1587 Int_t ix5,
iy5,
x6,
y6,
x7,
y7,
y8,
x1d,
y1d,
x2d=0,
y2d=0;
1590 Double_t dx1,
dx2,
dx3,
dx4,
dy1,
dy2,
dy3,
dy4,
z1,
z2,
z3,
z4,
zl,
zh;
1593 Int_t iv=0,
ekv,
stvor,
sx1,
sx2,
sx3,
sx4,
sx5,
sy1,
sy2,
sy3,
sy4,
sy5;
1598 Double_t v1=0,
v2=0,
v3=0,
v4=0,
dxr1,
dxr2,
dyr1,
dyr2,
zr1,
zr2,
bezf;
1599 Double_t dcount_reg,
z1l,
z2l,
z3l,
z4l,
sdx2p,
sdy2p,
dap,
dbp,
dcp,
ddp;
1619 printf(
"The canvas size exceed the maximum X screen resolution.\n");
1620 printf(
"Use the option bf() to increase the buffer size (it should be greater than %d).\n",
fBx2);
1656 beta = (
fBeta*3.1415927)/180;
1689 mz =
mz/((zmax-zmin)*(cos(
alfa)+cos(beta)));
1697 if (zmin>=1) zmin = log(zmin);
1699 if (zmax>=1) zmax = log(zmax);
1701 if ((zmax-zmin)<0.000001) zmax = zmin+0.000001;
1703 mz =
mz/((zmax-zmin)*(cos(
alfa)+cos(beta)));
1711 if (zmin>=1) zmin = sqrt(zmin);
1713 if (zmax>=1) zmax = sqrt(zmax);
1715 if ((zmax-zmin)<0.000001) zmax = zmin+0.000001;
1717 mz =
mz/((zmax-zmin)*(cos(
alfa)+cos(beta)));
1789 nbins, binWidth,
" ");
1790 for (i = 0; i < nbins + 1; i++) {
1813 nbins, binWidth,
" ");
1814 for (i = 0; i < nbins + 1; i++) {
1837 nbins, binWidth,
" ");
1838 for (i = 0; i < nbins + 1; i++) {
1861 nbins, binWidth,
" ");
1862 for (i = 0; i < nbins + 1; i++) {
3165 if (
fZ>=1.0)
fZ = log(
fZ);
5098 box->SetFillStyle(1001);
6853 static char chopt[10] =
"";
6891 a1->SetLabelOffset(
a1->GetLabelOffset()-
a1->GetTickSize());
6941 a1->SetLabelOffset(
a1->GetLabelOffset()-
a1->GetTickSize());
6991 a1->SetLabelOffset(
a1->GetLabelOffset()-
a1->GetTickSize());
7041 a1->SetLabelOffset(
a1->GetLabelOffset()-
a1->GetTickSize());
7176 if (
x>=0&&
y>=0&&z>=0) {
7229 if (weight>=0&&weight<=1)
fLHweight = weight;
7679 sp.SetPenAttr(h2->GetLineColor(), h2->GetLineStyle(), h2->GetLineWidth());
7687 while (opt.
Tokenize(token, from,
"[ (]")) {
7693 printf(
"PaintSpectrum: Display modes groups should be in the [0,3] range\n");
7698 printf(
"PaintSpectrum: Display modes should be in the [1,11] range\n");
7701 sp.SetDisplayMode(
i1,
i2);
7704 }
else if (token==
"pa") {
7711 }
else if (token==
"n") {
7717 }
else if (token==
"ca") {
7720 printf(
"PaintSpectrum: Color Algorithm should be in the [0,9] range\n");
7723 sp.SetColorAlgorithm(
i1);
7726 }
else if (token==
"zs") {
7729 printf(
"PaintSpectrum: Z-Scale should be in the [0,2] range\n");
7735 }
else if (token==
"ci") {
7739 sp.SetColorIncrements(
f1, f2, f3);
7742 }
else if (token==
"lhw") {
7744 sp.SetLightHeightWeight(
f1);
7747 }
else if (token==
"lp") {
7754 }
else if (token==
"cw") {
7756 sp.SetContourWidth(
i1);
7759 }
else if (token==
"b") {
7762 printf(
"PaintSpectrum: Bezier should be in the [0,1] range\n");
7768 }
else if (token==
"s") {
7771 printf(
"PaintSpectrum: Shading should be in the [0,1] range\n");
7776 printf(
"PaintSpectrum: Shadow should be in the [0,1] range\n");
7782 }
else if (token==
"cm") {
7791 }
else if (token==
"cg") {
7797 }
else if (token==
"a" || token==
"a=") {
7804 }
else if (token==
"bf") {
7812 printf(
"Unknown option \"%s\"\n",token.
Data());
int Int_t
Signed integer 4 bytes (int)
short Short_t
Signed Short integer 2 bytes (short)
double Double_t
Double 8 bytes.
const char Option_t
Option string (const char)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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 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 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 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 mx
Option_t Option_t TPoint TPoint const char y1
virtual Int_t GetNdivisions() const
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void ResetAttLine(Option_t *option="")
Reset this line attributes to default values.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Int_t GetLast() const
Return last bin on the axis i.e.
Int_t GetFirst() const
Return first bin on the axis i.e.
The color creation and management class.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
virtual void PaintAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, Double_t &wmin, Double_t &wmax, Int_t &ndiv, Option_t *chopt="", Double_t gridlength=0, Bool_t drawGridOnly=kFALSE)
Control function to draw an axis.
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
virtual Double_t GetMinimum(Double_t minval=-FLT_MAX) const
Return minimum value larger than minval of bins in the range, unless the value has been overridden by...
Service class for 2-D histogram classes.
Double_t GetBinContent(Int_t binx, Int_t biny) const override
static void Optimize(Double_t A1, Double_t A2, Int_t nold, Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BWID, Option_t *option="")
Static function to compute reasonable axis limits.
Use the TLine constructor to create a simple line.
virtual void PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
The TNamed class is the base class for all named ROOT classes.
<div class="legacybox"><h2>Legacy Code</h2> TSpectrum2Painter is a legacy interface: there will be no...
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:
@ kChannelMarksStyleCross
@ kChannelMarksStyleTriangle
@ kChannelMarksStyleDiamond
@ kChannelMarksStyleRectangle
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".
Short_t * fEnvelopeContour
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.
Int_t fMaximumXScreenResolution
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:
Int_t Atoi() const
Return integer value of string.
Double_t Atof() const
Return floating-point value contained in string.
const char * Data() const
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.