1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
20 #include <AliMUONTUBE.h>
22 #include "TVirtualPad.h"
25 AliMUONTUBE::AliMUONTUBE():TTUBE()
28 //_____________________________________________________________________________
30 AliMUONTUBE::AliMUONTUBE(Text_t *name, Text_t *title, Text_t *material, Float_t rmin,
31 Float_t rmax, Float_t dz,Float_t aspect):
32 TTUBE(name, title, material, rmin, rmax, dz, aspect)
35 //______________________________________________________________________________
36 AliMUONTUBE::AliMUONTUBE(Text_t *name, Text_t *title, Text_t *material, Float_t rmax,
38 : TTUBE(name, title, material, rmax, dz)
42 //______________________________________________________________________________
43 void AliMUONTUBE::Paint(Option_t *option)
45 //*-*-*-*-*-*-*-*Paint this 3-D shape with its current attributes*-*-*-*-*-*-*-*
46 //*-* ================================================
49 Int_t n = GetNumberOfDivisions();
50 const Int_t numpoints = 4*n;
52 //*-* Allocate memory for points *-*
54 Float_t *points = new Float_t[3*numpoints];
59 if (gPad->GetView3D()) PaintGLPoints(points);
61 //== for (i = 0; i < numpoints; i++)
62 //== gNode->Local2Master(&points[3*i],&points[3*i]);
64 X3DBuffer *buff = new X3DBuffer;
66 buff->numPoints = numpoints;
68 if (strstr(option, "x3d")) buff->numSegs = n*8;
72 //*-* Allocate memory for points *-*
74 buff->points = points;
76 Int_t c = ((GetLineColor() % 8) - 1) * 4; // Basic colors: 0, 1, ... 7
79 //*-* Allocate memory for segments *-*
81 buff->segs = new Int_t[buff->numSegs*3];
83 for (i = 0; i < 4; i++) {
84 for (j = 0; j < n; j++) {
85 buff->segs[(i*n+j)*3 ] = c;
86 buff->segs[(i*n+j)*3+1] = i*n+j;
87 buff->segs[(i*n+j)*3+2] = i*n+j+1;
89 buff->segs[(i*n+j-1)*3+2] = i*n;
91 for (i = 4; i < 6; i++) {
92 for (j = 0; j < n; j++) {
93 buff->segs[(i*n+j)*3 ] = c+1;
94 buff->segs[(i*n+j)*3+1] = (i-4)*n+j;
95 buff->segs[(i*n+j)*3+2] = (i-2)*n+j;
98 if (strstr(option, "x3d"))
100 for (i = 6; i < 8; i++) {
101 for (j = 0; j < n; j++) {
102 buff->segs[(i*n+j)*3 ] = c;
103 buff->segs[(i*n+j)*3+1] = 2*(i-6)*n+j;
104 buff->segs[(i*n+j)*3+2] = (2*(i-6)+1)*n+j;
109 //*-* Allocate memory for polygons *-*
113 buff->polys = new Int_t[buff->numPolys*6];
115 for (i = 0; i < 2; i++) {
116 for (j = 0; j < n; j++) {
118 buff->polys[indx ] = c;
119 buff->polys[indx+1] = 4;
120 buff->polys[indx+2] = i*n+j;
121 buff->polys[indx+3] = (4+i)*n+j;
122 buff->polys[indx+4] = (2+i)*n+j;
123 buff->polys[indx+5] = (4+i)*n+j+1;
125 buff->polys[indx+5] = (4+i)*n;
127 for (i = 2; i < 4; i++) {
128 for (j = 0; j < n; j++) {
130 buff->polys[indx ] = c+(i-2)*2+1;
131 buff->polys[indx+1] = 4;
132 buff->polys[indx+2] = (i-2)*2*n+j;
133 buff->polys[indx+3] = (4+i)*n+j;
134 buff->polys[indx+4] = ((i-2)*2+1)*n+j;
135 buff->polys[indx+5] = (4+i)*n+j+1;
137 buff->polys[indx+5] = (4+i)*n;
141 //*-* Paint in the pad
142 Bool_t rangeView = strcmp(option,"range")==0 ? kTRUE : kFALSE;
143 PaintShape(buff,rangeView);
145 if (strstr(option, "x3d")) {
146 if(buff && buff->points && buff->segs)
149 gSize3D.numPoints -= buff->numPoints;
150 gSize3D.numSegs -= buff->numSegs;
151 gSize3D.numPolys -= buff->numPolys;
155 if (buff->points) delete [] buff->points;
156 if (buff->segs) delete [] buff->segs;
157 if (buff->polys) delete [] buff->polys;
158 if (buff) delete buff;