ROOT
v6-24
Reference Guide
Loading...
Searching...
No Matches
fillpatterns.C
Go to the documentation of this file.
1
void
box
(
Int_t
pat,
Double_t
x1
,
Double_t
y1,
Double_t
x2
,
Double_t
y2)
2
{
3
// Draw an box using the fill pattern "pat" with the "pat" value
4
// written on top.
5
6
TBox
b
;
7
b
.
SetFillColor
(1);
8
b
.SetFillStyle(pat);
b
.DrawBox(
x1
,y1,
x2
,y2);
9
b
.SetFillStyle(0) ;
b
.DrawBox(
x1
,y1,
x2
,y2);
10
b
.SetFillColor(0) ;
b
.SetFillStyle(1000) ;
11
Double_t
dx = (
x2
-
x1
)/3;
12
Double_t
dy = (y2-y1)/3;
13
Double_t
h
= (y2-y1)/2.5;
14
b
.DrawBox(
x1
+dx, y1+dy,
x2
-dx, y2-dy);
15
b
.SetFillStyle(0);
16
b
.DrawBox(
x1
+dx, y1+dy,
x2
-dx, y2-dy);
17
18
TLatex
l
;
19
l
.
SetTextAlign
(22);
l
.SetTextSize(
h
);
20
l
.DrawLatex((
x1
+
x2
)/2, (y1+y2)/2,
Form
(
"%d"
,pat));
21
}
22
23
TCanvas
*
fillpatterns
(
int
w=500,
int
h
=700)
24
{
25
// Fill patterns example. This macro shows the available fill patterns.
26
// The first table displays the 25 fixed patterns. They cannot be
27
// customized unlike the hatches displayed in the second table which be
28
// cutomized using:
29
// - gStyle->SetHatchesSpacing() to define the spacing between hatches.
30
// - gStyle->SetHatchesLineWidth() to define the hatches line width.
31
//
32
// Author: Olivier Couet.
33
34
TCanvas
*Pat =
new
TCanvas
(
"Fill Patterns"
,
""
,0,0,w,
h
);
35
Pat->
Range
(0,0,1,1);
36
Pat->
SetBorderSize
(2);
37
Pat->
SetFrameFillColor
(0);
38
Double_t
bh = 0.059;
39
Double_t
db = 0.01;
40
Double_t
y
= 0.995;
41
Int_t
i,j=3001;
42
43
// Fixed patterns.
44
for
(i=1; i<=5; i++) {
45
box
(j++, 0.01,
y
-bh, 0.19,
y
);
46
box
(j++, 0.21,
y
-bh, 0.39,
y
);
47
box
(j++, 0.41,
y
-bh, 0.59,
y
);
48
box
(j++, 0.61,
y
-bh, 0.79,
y
);
49
box
(j++, 0.81,
y
-bh, 0.99,
y
);
50
y
=
y
-bh-db;
51
}
52
53
// Hatches
54
y
=
y
-3*db;
55
gStyle
->
SetHatchesSpacing
(2.0);
56
gStyle
->
SetHatchesLineWidth
(1);
57
Int_t
j1 = 3144;
58
Int_t
j2 = 3305;
59
Int_t
j3 = 3350;
60
Int_t
j4 = 3490;
61
Int_t
j5 = 3609;
62
for
(i=1; i<=9; i++) {
63
if
(i==6) {j2 += 10; j3 += 1; j4 += 1; j5 += 10;}
64
if
(i==5) {j4 -= 10; j5 -= 1;}
65
box
(j1, 0.01,
y
-bh, 0.19,
y
);
66
box
(j2, 0.21,
y
-bh, 0.39,
y
);
67
box
(j3, 0.41,
y
-bh, 0.59,
y
);
68
box
(j4, 0.61,
y
-bh, 0.79,
y
);
69
box
(j5, 0.81,
y
-bh, 0.99,
y
);
70
j1 += 100;
71
j2 += 10;
72
j3 += 1;
73
j4 -= 9;
74
j5 += 9;
75
y
=
y
-bh-db;
76
}
77
return
Pat;
78
}
b
#define b(i)
Definition
RSha256.hxx:100
h
#define h(i)
Definition
RSha256.hxx:106
x2
static const double x2[5]
Definition
RooGaussKronrodIntegrator1D.cxx:364
x1
static const double x1[5]
Definition
RooGaussKronrodIntegrator1D.cxx:346
Int_t
int Int_t
Definition
RtypesCore.h:45
Double_t
double Double_t
Definition
RtypesCore.h:59
Form
char * Form(const char *fmt,...)
gStyle
R__EXTERN TStyle * gStyle
Definition
TStyle.h:412
TAttFill::SetFillColor
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition
TAttFill.h:37
TAttPad::SetFrameFillColor
void SetFrameFillColor(Color_t color=1)
Definition
TAttPad.h:73
TAttText::SetTextAlign
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition
TAttText.h:41
TBox
Create a Box.
Definition
TBox.h:22
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TLatex
To draw Mathematical Formula.
Definition
TLatex.h:18
TPad::SetBorderSize
void SetBorderSize(Short_t bordersize) override
Definition
TPad.h:318
TPad::Range
void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Set world coordinate system for the pad.
Definition
TPad.cxx:5200
TStyle::SetHatchesSpacing
void SetHatchesSpacing(Double_t h)
Definition
TStyle.h:290
TStyle::SetHatchesLineWidth
void SetHatchesLineWidth(Int_t l)
Definition
TStyle.h:289
box
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition
fillpatterns.C:1
fillpatterns
TCanvas * fillpatterns(int w=500, int h=700)
Definition
fillpatterns.C:23
y
Double_t y[n]
Definition
legend1.C:17
l
auto * l
Definition
textangle.C:4
core
base
doc
macros
fillpatterns.C
ROOT v6-24 - Reference Guide Generated on Tue Aug 22 2023 03:06:12 (GVA Time) using Doxygen 1.9.8