Added function demonstrating use of per-quad object-ref.
[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,
4 Int_t num=100)
5a5a1232 5{
becafd4b 6 TRandom r(0);
7
8 gStyle->SetPalette(1, 0);
9
7ec0cf74 10 Reve::QuadSet* q = new Reve::QuadSet("RectangleXY");
04416fc7 11 q->Reset(Reve::QuadSet::QT_RectangleXY, kFALSE, 32);
355c4728 12 for (Int_t i=0; i<num; ++i) {
becafd4b 13 q->AddQuad(r.Uniform(-10, 10), r.Uniform(-10, 10), r.Uniform(-10, 10),
04416fc7 14 r.Uniform(0.2, 1), r.Uniform(0.2, 1));
becafd4b 15 q->QuadValue(r.Uniform(0, 130));
16 }
17 q->RefitPlex();
18
adabd949 19 Reve::ZTrans& t = q->RefHMTrans();
20 t.SetPos(x, y, z);
21
22 gReve->AddRenderElement(q);
23 gReve->Redraw3D();
24
25 return q;
26}
27
28Reve::QuadSet* reve_quad_test_circ()
29{
30 TRandom r(0);
31
32 gStyle->SetPalette(1, 0);
33
34 Reve::QuadSet* q = new Reve::QuadSet("Pepe");
04416fc7 35 q->Reset(Reve::QuadSet::QT_RectangleXY, kFALSE, 32);
adabd949 36
37 Float_t R = 10, dW = 1, dH = .5;
38 for (Int_t i=0; i<12; ++i) {
39 Float_t x = R * TMath::Cos(TMath::TwoPi()*i/12);
40 Float_t y = R * TMath::Sin(TMath::TwoPi()*i/12);
41 q->AddQuad(x-dW, y-dH, r.Uniform(-1, 1), 2*dW, 2*dH);
42 q->QuadValue(r.Uniform(0, 130));
43 }
44 q->RefitPlex();
45
46 Reve::ZTrans& t = q->RefHMTrans();
47 t.SetPos(0, 0, 300);
48
becafd4b 49 gReve->AddRenderElement(q);
50 gReve->Redraw3D();
adabd949 51
52 return q;
5a5a1232 53}
7ec0cf74 54
355c4728 55Reve::QuadSet* reve_quad_test_hex(Float_t x=0, Float_t y=0, Float_t z=0,
bba4310b 56 Int_t num=100)
7ec0cf74 57{
58 TRandom r(0);
59
60 gStyle->SetPalette(1, 0);
61
62 {
63 Reve::QuadSet* q = new Reve::QuadSet("HexagonXY");
64 q->Reset(Reve::QuadSet::QT_HexagonXY, kFALSE, 32);
355c4728 65 for (Int_t i=0; i<num; ++i) {
7ec0cf74 66 q->AddHexagon(r.Uniform(-10, 10), r.Uniform(-10, 10), r.Uniform(-10, 10),
67 r.Uniform(0.2, 1));
68 q->QuadValue(r.Uniform(0, 120));
69 }
70 q->RefitPlex();
71
72 Reve::ZTrans& t = q->RefHMTrans();
73 t.SetPos(x, y, z);
74
75 gReve->AddRenderElement(q);
76 gReve->Redraw3D();
77 }
78
79 {
80 Reve::QuadSet* q = new Reve::QuadSet("HexagonYX");
81 q->Reset(Reve::QuadSet::QT_HexagonYX, kFALSE, 32);
355c4728 82 for (Int_t i=0; i<num; ++i) {
7ec0cf74 83 q->AddHexagon(r.Uniform(-10, 10), r.Uniform(-10, 10), r.Uniform(-10, 10),
84 r.Uniform(0.2, 1));
85 q->QuadValue(r.Uniform(0, 120));
86 }
87 q->RefitPlex();
88
89 Reve::ZTrans& t = q->RefHMTrans();
90 t.SetPos(x, y, z);
91
92 gReve->AddRenderElement(q);
93 gReve->Redraw3D();
94 }
95
96 return q;
97}
bba4310b 98
99Reve::QuadSet* reve_quad_test_hexid(Float_t x=0, Float_t y=0, Float_t z=0,
100 Int_t num=100)
101{
102 TRandom r(0);
103
104 gStyle->SetPalette(1, 0);
105
106 {
107 Reve::QuadSet* q = new Reve::QuadSet("HexagonXY");
108 q->SetOwnIds(kTRUE);
109 q->Reset(Reve::QuadSet::QT_HexagonXY, kFALSE, 32);
110 for (Int_t i=0; i<num; ++i) {
111 q->AddHexagon(r.Uniform(-10, 10), r.Uniform(-10, 10), r.Uniform(-10, 10),
112 r.Uniform(0.2, 1));
113 q->QuadValue(r.Uniform(0, 120));
114 q->QuadId(new TNamed(Form("Quad with idx=%d", i), "This title is not confusing."));
115 }
116 q->RefitPlex();
117
118 Reve::ZTrans& t = q->RefHMTrans();
119 t.SetPos(x, y, z);
120
121 gReve->AddRenderElement(q);
122 gReve->Redraw3D();
123 }
124
125 return q;
126}