]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TGeant3/AliDrawVolume.cxx
Coding convention rules obeyed
[u/mrichter/AliRoot.git] / TGeant3 / AliDrawVolume.cxx
CommitLineData
ef42d733 1/* *************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/*
17$Log$
18Revision 1.8 2000/07/12 08:56:32 fca
19Coding convention correction and warning removal
20
21Revision 1.7 2000/06/28 21:27:45 morsch
22Most coding rule violations corrected.
23Still to do: Split the file (on file per class) ? Avoid the global variables.
24Copy constructors and assignment operators (dummy ?)
25
26Revision 1.6 2000/04/14 11:07:46 morsch
27Correct volume to medium assignment in case several media are asigned to the
28same material.
29
30Revision 1.5 2000/03/20 15:11:03 fca
31Mods to make the code compile on HP
32
33Revision 1.4 2000/01/18 16:12:08 morsch
34Bug in calculation of number of volume divisions and number of positionings corrected
35Browser for Material and Media properties added
36
37Revision 1.3 1999/11/14 14:31:14 fca
38Correct small error and remove compilation warnings on HP
39
40Revision 1.2 1999/11/10 16:53:35 fca
41The new geometry viewer from A.Morsch
42
43*/
44
45/*
46 * Version: 0
47 * Written by Andreas Morsch
48 *
49 *
50 *
51 * For questions critics and suggestions to this part of the code
52 * contact andreas.morsch@cern.ch
53 *
54 **************************************************************************/
55
56#include "AliDrawVolume.h"
57
58ClassImp(AliDrawVolume)
59
60AliDrawVolume::AliDrawVolume(char* name)
61{
62// Constructor
63 fName = name;
64 fTheta = 30;
65 fPhi = 30;
66 fPsi = 0;
67 fU = 10;
68 fV = 10;
69 fUscale = 0.01;
70 fVscale = 0.01;
71 fHide=0;
72 fShadow=0;
73 fFill=1;
74 fSeen=1;
75 fClip=0;
76 fClipXmin=0.;
77 fClipXmax=2000.;
78 fClipYmin=0.;
79 fClipYmax=2000.;
80 fClipZmin=0.;
81 fClipZmax=2000.;
82}
83
84char* AliDrawVolume::Name()
85{
86//
87// Return volume name
88 return fName;
89}
90
91
92void AliDrawVolume::Streamer(TBuffer &)
93{
94// Dummy Streamer
95;
96}
97
98
99
100void AliDrawVolume::Draw(Option_t *)
101{
102// Wraps the geant Gdraw
103 gMC->Gsatt(fName,"seen", fSeen);
104
105 if (fHide) {
106 gMC->Gdopt("hide", "on");
107 } else {
108 gMC->Gdopt("hide", "off");
109 }
110
111 if (fShadow) {
112 gMC->Gdopt("shad", "on");
113 gMC->Gsatt("*", "fill", fFill);
114 } else {
115 gMC->Gdopt("shad", "off");
116 }
117
118 gMC->SetClipBox(".");
119 if (fClip) {
120 gMC->SetClipBox("*", fClipXmin, fClipXmax,
121 fClipYmin, fClipYmax, fClipZmin, fClipZmax);
122 } else {
123 gMC->SetClipBox(".");
124 }
125
126
127 gMC->Gdraw(fName, fTheta, fPhi, fPsi, fU, fV, fUscale, fVscale);
128 THIGZ *higz = (THIGZ*)gROOT->GetListOfCanvases()->FindObject("higz");
129 if (higz) higz->Update();
130}
131
132void AliDrawVolume::DrawSpec()
133{
134// Wraps the Geant DrawSpec
135 gMC->Gsatt(fName,"seen", fSeen);
136
137 if (fHide) {
138 gMC->Gdopt("hide", "on");
139 } else {
140 gMC->Gdopt("hide", "off");
141 }
142
143 if (fShadow) {
144 gMC->Gdopt("shad", "on");
145 gMC->Gsatt("*", "fill", fFill);
146 } else {
147 gMC->Gdopt("shad", "off");
148 }
149
150 gMC->SetClipBox(".");
151 if (fClip) {
152 gMC->SetClipBox("*", fClipXmin, fClipXmax, fClipYmin, fClipYmax, fClipZmin, fClipZmax);
153 } else {
154 gMC->SetClipBox(".");
155 }
156
157
158 ((TGeant3*) gMC)->DrawOneSpec(fName);
159 THIGZ *higz = (THIGZ*)gROOT->GetListOfCanvases()->FindObject("higz");
160 if (higz) higz->Update();
161}
162
163void AliDrawVolume::SetParam(Int_t ip, Float_t param)
164{
165// Set drawing parameters
166 switch (ip) {
167 case kTheta:
168 fTheta=param;
169 break;
170 case kPhi:
171 fPhi=param;
172 break;
173 case kPsi:
174 fPsi=param;
175 break;
176 case kU:
177 fU=param;
178 break;
179 case kV:
180 fV=param;
181 break;
182 case kUscale:
183 fUscale=param;
184 break;
185 case kVscale:
186 fVscale=param;
187 break;
188 case kHide:
189 fHide=Int_t(param);
190 break;
191 case kShadow:
192 fShadow=Int_t(param);
193 break;
194 case kFill:
195 fFill=Int_t(param);
196 break;
197 case kSeen:
198 fSeen=Int_t(param);
199 break;
200 case kClip:
201 fClip=Int_t(param);
202 break;
203 case kClipXmin:
204 fClipXmin=param;
205 break;
206 case kClipXmax:
207 fClipXmax=param;
208 break;
209 case kClipYmin:
210 fClipYmin=param;
211 break;
212 case kClipYmax:
213 fClipYmax=param;
214 break;
215 case kClipZmin:
216 fClipZmin=param;
217 break;
218 case kClipZmax:
219 fClipZmax=param;
220 break;
221 }
222}
223
224Float_t AliDrawVolume::GetParam(Int_t ip)
225{
226// Get drawing parameters
227 switch (ip) {
228 case kTheta:
229 return fTheta;
230 case kPhi:
231 return fPhi;
232 case kPsi:
233 return fPsi;
234 case kU:
235 return fU;
236 case kV:
237 return fV;
238 case kUscale:
239 return fUscale;
240 case kVscale:
241 return fVscale;
242 case kHide:
243 return Float_t(fHide);
244 case kShadow:
245 return Float_t(fShadow);
246 case kFill:
247 return Float_t(fFill);
248 case kSeen:
249 return Float_t(fSeen);
250 case kClip:
251 return Float_t(fClip);
252 case kClipXmin:
253 return fClipXmin;
254 case kClipXmax:
255 return fClipXmax;
256 case kClipYmin:
257 return fClipYmin;
258 case kClipYmax:
259 return fClipYmax;
260 case kClipZmin:
261 return fClipZmin;
262 case kClipZmax:
263 return fClipZmax;
264 default:
265 return 0.;
266 }
267 return 0.;
268}
269
270