Separate import of standard macros into a special function so that
[u/mrichter/AliRoot.git] / EVE / macros / reve_quad_test.C
CommitLineData
5a5a1232 1// $Header$
2
355c4728 3Reve::QuadSet* reve_quad_test(Float_t x=0, Float_t y=0, Float_t z=0,
40bd4501 4 Int_t num=100, Bool_t register=kTRUE)
5a5a1232 5{
becafd4b 6 TRandom r(0);
7
8 gStyle->SetPalette(1, 0);
9
3137f823 10 Reve::RGBAPalette* pal = new Reve::RGBAPalette(0, 130);
11
7ec0cf74 12 Reve::QuadSet* q = new Reve::QuadSet("RectangleXY");
3137f823 13 q->SetPalette(pal);
04416fc7 14 q->Reset(Reve::QuadSet::QT_RectangleXY, kFALSE, 32);
355c4728 15 for (Int_t i=0; i<num; ++i) {
becafd4b 16 q->AddQuad(r.Uniform(-10, 10), r.Uniform(-10, 10), r.Uniform(-10, 10),
04416fc7 17 r.Uniform(0.2, 1), r.Uniform(0.2, 1));
becafd4b 18 q->QuadValue(r.Uniform(0, 130));
19 }
20 q->RefitPlex();
21
adabd949 22 Reve::ZTrans& t = q->RefHMTrans();
23 t.SetPos(x, y, z);
24
40bd4501 25 if (register)
26 {
27 gReve->AddRenderElement(q);
28 gReve->Redraw3D();
29 }
adabd949 30
31 return q;
32}
33
7b7207d6 34Reve::QuadSet* reve_quad_test_emc(Float_t x=0, Float_t y=0, Float_t z=0,
35 Int_t num=100)
36{
37 TRandom r(0);
38
39 gStyle->SetPalette(1, 0);
40
41 Reve::QuadSet* q = new Reve::QuadSet("EMC Supermodule");
42 q->SetOwnIds(kTRUE);
43 q->Reset(Reve::QuadSet::QT_RectangleXZFixedDimY, kFALSE, 32);
44 q->SetDefWidth(8);
45 q->SetDefHeight(8);
46
47 for (Int_t i=0; i<num; ++i) {
48 q->AddQuad(r.Uniform(-100, 100), r.Uniform(-100, 100));
49 q->QuadValue(r.Uniform(0, 130));
50 q->AddId(new TNamed(Form("Cell %d", i)));
51 }
52 q->RefitPlex();
53
54 Reve::ZTrans& t = q->RefHMTrans();
55 t.SetPos(x, y, z);
56
57 gReve->AddRenderElement(q);
58 gReve->Redraw3D();
59
60 return q;
61}
62
adabd949 63Reve::QuadSet* reve_quad_test_circ()
64{
65 TRandom r(0);
66
67 gStyle->SetPalette(1, 0);
68
69 Reve::QuadSet* q = new Reve::QuadSet("Pepe");
04416fc7 70 q->Reset(Reve::QuadSet::QT_RectangleXY, kFALSE, 32);
adabd949 71
72 Float_t R = 10, dW = 1, dH = .5;
73 for (Int_t i=0; i<12; ++i) {
74 Float_t x = R * TMath::Cos(TMath::TwoPi()*i/12);
75 Float_t y = R * TMath::Sin(TMath::TwoPi()*i/12);
76 q->AddQuad(x-dW, y-dH, r.Uniform(-1, 1), 2*dW, 2*dH);
77 q->QuadValue(r.Uniform(0, 130));
78 }
79 q->RefitPlex();
80
81 Reve::ZTrans& t = q->RefHMTrans();
82 t.SetPos(0, 0, 300);
83
becafd4b 84 gReve->AddRenderElement(q);
85 gReve->Redraw3D();
adabd949 86
87 return q;
5a5a1232 88}
7ec0cf74 89
355c4728 90Reve::QuadSet* reve_quad_test_hex(Float_t x=0, Float_t y=0, Float_t z=0,
40bd4501 91 Int_t num=100, Bool_t register=kTRUE)
7ec0cf74 92{
93 TRandom r(0);
94
95 gStyle->SetPalette(1, 0);
96
97 {
98 Reve::QuadSet* q = new Reve::QuadSet("HexagonXY");
99 q->Reset(Reve::QuadSet::QT_HexagonXY, kFALSE, 32);
355c4728 100 for (Int_t i=0; i<num; ++i) {
7ec0cf74 101 q->AddHexagon(r.Uniform(-10, 10), r.Uniform(-10, 10), r.Uniform(-10, 10),
102 r.Uniform(0.2, 1));
103 q->QuadValue(r.Uniform(0, 120));
104 }
105 q->RefitPlex();
106
107 Reve::ZTrans& t = q->RefHMTrans();
108 t.SetPos(x, y, z);
109
40bd4501 110 if (register)
111 {
112 gReve->AddRenderElement(q);
113 gReve->Redraw3D();
114 }
7ec0cf74 115 }
116
117 {
118 Reve::QuadSet* q = new Reve::QuadSet("HexagonYX");
119 q->Reset(Reve::QuadSet::QT_HexagonYX, kFALSE, 32);
355c4728 120 for (Int_t i=0; i<num; ++i) {
7ec0cf74 121 q->AddHexagon(r.Uniform(-10, 10), r.Uniform(-10, 10), r.Uniform(-10, 10),
122 r.Uniform(0.2, 1));
123 q->QuadValue(r.Uniform(0, 120));
124 }
125 q->RefitPlex();
126
127 Reve::ZTrans& t = q->RefHMTrans();
128 t.SetPos(x, y, z);
129
40bd4501 130 if (register)
131 {
132 gReve->AddRenderElement(q);
133 gReve->Redraw3D();
134 }
7ec0cf74 135 }
136
137 return q;
138}
bba4310b 139
140Reve::QuadSet* reve_quad_test_hexid(Float_t x=0, Float_t y=0, Float_t z=0,
babf7b28 141 Int_t num=100, Bool_t register=kTRUE)
bba4310b 142{
143 TRandom r(0);
144
145 gStyle->SetPalette(1, 0);
146
147 {
148 Reve::QuadSet* q = new Reve::QuadSet("HexagonXY");
149 q->SetOwnIds(kTRUE);
150 q->Reset(Reve::QuadSet::QT_HexagonXY, kFALSE, 32);
151 for (Int_t i=0; i<num; ++i) {
152 q->AddHexagon(r.Uniform(-10, 10), r.Uniform(-10, 10), r.Uniform(-10, 10),
153 r.Uniform(0.2, 1));
154 q->QuadValue(r.Uniform(0, 120));
155 q->QuadId(new TNamed(Form("Quad with idx=%d", i), "This title is not confusing."));
156 }
157 q->RefitPlex();
158
159 Reve::ZTrans& t = q->RefHMTrans();
160 t.SetPos(x, y, z);
161
babf7b28 162 if (register)
163 {
164 gReve->AddRenderElement(q);
165 gReve->Redraw3D();
166 }
bba4310b 167 }
168
169 return q;
170}
babf7b28 171
172void reve_quad_test_hierarchy(Int_t n=4)
173{
174 gStyle->SetPalette(1, 0);
175
7b7207d6 176 Reve::RGBAPalette* pal = new Reve::RGBAPalette(20, 100);
babf7b28 177 pal->SetLimits(0, 120);
178
7b7207d6 179 Reve::FrameBox* box = new Reve::FrameBox();
babf7b28 180 box->SetAABox(-10, -10, -10, 20, 20, 20);
181 box->SetFrameColor((Color_t) 33);
182
183 Reve::RenderElementList* l = new Reve::RenderElementList("Parent/Dir");
184 l->SetTitle("Tooltip");
185 // l->SetMainColor((Color_t)3);
186 gReve->AddRenderElement(l);
187
188 // PMD: obtain digit-tree from run-loader, loop over entries.
189
190 for (Int_t i=0; i<n; ++i)
191 {
192 Reve::QuadSet* qs = reve_quad_test_hexid(0, 0, 50*i, 50, kFALSE);
193 // PMD: loop over clones-array, create hexagons above threshold.
194 qs->SetPalette(pal);
195 qs->SetFrame(box);
32e219c2 196 gReve->AddRenderElement(qs, l);
babf7b28 197 }
198
199 gReve->Redraw3D();
200}