]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/DisplayITSv11.cxx
Removed some coding violations.
[u/mrichter/AliRoot.git] / ITS / DisplayITSv11.cxx
CommitLineData
e884b829 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$Id$
18*/
b4a4a5e6 19#include <Riostream.h>
e884b829 20#include <TSystem.h>
21#include <TROOT.h>
22#include <TGeoManager.h>
23#include <TGeoNode.h>
24#include <TGeoVolume.h>
25#include <TGeoShape.h>
26#include <TGeoTube.h>
27#include <TGeoMaterial.h>
28#include <TGeoMedium.h>
29#include <TCanvas.h>
30#include <TControlBar.h>
31#include <TArrow.h>
32#include <TPad.h>
33#include <TView.h>
34
35#include "AliITS.h"
36#include "AliITSv11.h"
37#include "DisplayITSv11.h"
38
39ClassImp(DisplayITSv11)
40//______________________________________________________________________
41DisplayITSv11::DisplayITSv11(){
42 // Default Constructor.
43 // Inputs:
44 // none.
45 // Outputs:
46 // none.
47 // Return:
48 // A Default constructed DispalyITSv11 class/task.
49
50 fmgr = 0;
51 fits = 0;
52 fALICE = 0;
53 fITS = 0;
54 fClip = 0;
55 fITSdebug = 0;
56 fNsegments = 80;
57 fCut = 0;
58 fAxis = 1;
59 fPerspective = 0;
60 fSolid = 0;
61 fPhimincut = 0.0;
62 fPhimaxcut = 180.0;
63 fRmin[0] = fRmin[1] = fRmin[2] = fRmax[0] = fRmax[1] = fRmax[2] = 0.0;
64 fLongitude = 90.0;
65 fLatitude = 0.0;
66 fPsi = 0.0;
67}
68//______________________________________________________________________
69DisplayITSv11::~DisplayITSv11(){
70 // Destructor.
71 // Inputs:
72 // none.
73 // Outputs:
74 // none.
75 // Return:
76 // none..
77
78 if(fits) delete fits;
79 if(fClip) delete fClip;
80 fITS = 0;
81 fALICE = 0;
82 fmgr = 0;
83}
84//______________________________________________________________________
85void DisplayITSv11::Exec(Option_t* opt){
86 // Main display routine
87 // Inputs:
88 // Option_t * opt Not presently used.
89 // Outputs:
90 // none.
91 // Return:
92 // none.
93 Int_t i;
94
b4a4a5e6 95 if(strstr(opt,"debug")) fits->SetDebug();
e884b829 96 gSystem->Load("libGeom");
97 //
98 if(gGeoManager) delete gGeoManager;
99 fmgr = gGeoManager = new TGeoManager("ITSGeometry",
100 " ITS Simulation Geometry Manager");
101 //
102 TGeoMaterial *vacmat = new TGeoMaterial("Vacume",0,0,0);
103 TGeoMedium *vacmed = new TGeoMedium("Vacume_med",1,vacmat);
104 fRmax[0] = 100.;
105 fRmax[1] = 100.;
106 fRmax[2] = 200.;
107 for(i=0;i<3;i++) fRmin[i] = -fRmax[i];
108 fALICE = fmgr->MakeBox("ALIC",vacmed,fRmax[0],fRmax[1],fRmax[2]);
109 fmgr->SetTopVolume(fALICE);
110 //
111 AliITSv11 *fits = new AliITSv11();
112 fits->SetDebug(GetDebugITS());
113 fits->CreateMaterials();
114 fits->CreateGeometry();
115 //
116 fmgr->CloseGeometry();
117 fITS = fALICE->FindNode("ITSV_1")->GetVolume();
118 //
119 TControlBar *bar=new TControlBar("vertical","ITS Geometry Display",10,10);
120 bar->AddButton("Set ITS Debug level 1","SetITSdebugOn()","Debug on");
121 bar->AddButton("Set ITS Debug level 0","SetITSdebugOff()","Debug off");
122 bar->AddButton("Set ITS Theta,Phi cut on","SetCylindericalClipVolume()",
123 "Cut on");
124 bar->AddButton("Set ITS Theta,Phi cut off","SetCylindericalCutOff()",
125 "Cut off");
126 bar->AddButton("Set axis on","SetAxisOn()","Show Axis on");
127 bar->AddButton("Set axis off","SetAxisOff()","Show Axis off");
128 bar->AddButton("Set perspective on","SetPerspectiveOn()",
129 "Perspective on");
130 bar->AddButton("Set perspective off","SetPerspectiveOff()",
131 "Perspective off");
132 bar->AddButton("Draw volumes as Solid","SetSolid()","Solid Volumes");
133 bar->AddButton("Draw volumes as wire","SetWire()","Wire Volumes");
134 bar->AddButton("Set circle/80","SetCircleSegments(80)",
135 "circles ~ by 80 lines");
136 bar->AddButton("Check Overlaps","fmgr->CheckOverlaps()",
137 "Check for overlaps");
138 bar->AddButton("Display Geometry","Displayit()","Run Displayit");
139 bar->AddButton("Display SPD Thermal Sheald","EngineeringSPDThS()",
140 "Run EngineeringSPDThS");
141 bar->AddButton("Display SDD Cone","EngineeringSDDCone()",
142 "Run EngineeringSDDCone");
143 bar->AddButton("Display SDD Centeral Cylinder","EngineeringSDDCylinder()",
144 "Run EngineeringSDDCylinder");
145 bar->AddButton("Display SUP RB24 side","EngineeringSupRB24()",
146 "Run EngineeringSDDCylinder");
147 bar->AddButton("Display SUP RB26 side","EngineeringSupRB26()",
148 "Run EngineeringSupRB26");
149 bar->AddButton("Quit/Exit",".q","Exit");
150 bar->Show();
151 gROOT->SaveContext();
152 //Displayit();
153}
154//______________________________________________________________________
155void DisplayITSv11::Displaying(TGeoVolume *v,TCanvas *c,Int_t ipad){
156 // Display Volume according to existing values
157 // Inputs:
158 // TGeoVolume *v volume to be drawn.
159 // TCanvas *p Pad where drawing is to be done
160 // Int_t ipad subpad to draw on
161 // Outputs:
162 // none.
163 // Return:
164 // none.
165 Int_t irr;
166 TVirtualPad *p = 0;
167 TView *view=0;
168
169 c->cd(ipad);
170 p = c->GetPad(ipad);
171 if(!p) return;
172 view = p->GetView();
173 if(!view){view = new TView(fRmin,fRmax,1);p->SetView(view);}
174 view->SetRange(fRmin,fRmax);
175 view->SetView(fLongitude,fLatitude,fPsi,irr);
176 if(fPerspective) view->SetPerspective();
177 else view->SetParralel();
178 if(fAxis) view->ShowAxis();
179 //
180 if(fClip) fmgr->SetClippingShape(fClip);
181 v->Draw();
182 if(fSolid) v->Raytrace();
183 p->Modified(1);
184 p->Update();
185}
186//----------------------------------------------------------------------
187void DisplayITSv11::DisplayITS(){
188 // Display AliITSv11 Geometry
189 // Inputs:
190 // const char* filename output file with the display in it
191 // Outputs:
192 // none.
193 // Retrurn:
194 // none.
195 Double_t lon,lat,psi;
196 //
197 TCanvas *c1;
198 if(!(c1 = (TCanvas*)gROOT->FindObject("C1")))
199 c1 = new TCanvas("C1","ITS Simulation Geometry",900,900);
200 c1->Divide(2,2);
201 //
202 fmgr->SetNsegments(fNsegments);
203 //
204 fmgr->SetVisLevel(6);
205 fmgr->SetVisOption(0);
206 // Perspective
207 Displaying(fALICE,c1,2);
208 lon = fLongitude;
209 lat = fLatitude;
210 psi = fPsi;
211 fLongitude = 270.0; // Front
212 fLatitude = 90.0;
213 fPsi = 0.0;
214 Displaying(fALICE,c1,1);
215 fLongitude = 270.0; // Top
216 fLatitude = 0.0;
217 fPsi = 0.0;
218 Displaying(fALICE,c1,3);
219 fLongitude = 0.0; // Side
220 fLatitude = 90.0;
221 fPsi = 0.0;
222 Displaying(fALICE,c1,4);
223 fLongitude = lon;
224 fLatitude = lat;
225 fPsi = psi;
226 //
227}
228//----------------------------------------------------------------------
229void DisplayITSv11::EngineeringSPDThS(){
230 // Display SPD Thermal Sheald Geometry
231 // Inputs:
232 // none.
233 // Outputs:
234 // none.
235 // Retrurn:
236 // none.
237 Double_t lon,lat,psi;
238 //
239 TCanvas *c4;
240 TGeoNode *node;
241 if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
242 c4 = new TCanvas("C4","ITS SDD Cylinder Geometry",900,450);
243 c4->Divide(2,1);
244 TGeoVolume *SPDThS=0;
245 //TArrow *arrow=new TArrow();
246 //
247 node = fITS->FindNode("ITSspdThermalSheald_1");
248 SPDThS = node->GetVolume();
249 //
250 fmgr->SetNsegments(fNsegments);
251 //
252 fmgr->SetVisLevel(6);
253 fmgr->SetVisOption(0);
254 //
255 lon = fLongitude;
256 lat = fLatitude;
257 psi = fPsi;
258 fLongitude = 270.0; // Front
259 fLatitude = 90.0;
260 fPsi = 0.0;
261 Displaying(SPDThS,c4,1);
262 //
263 fLongitude = 270.0; // Top
264 fLatitude = 0.0;
265 fPsi = 0.0;
266 Displaying(SPDThS,c4,2);
267 //
268 fLongitude = lon;
269 fLatitude = lat;
270 fPsi = psi;
271}
272//----------------------------------------------------------------------
273void DisplayITSv11::EngineeringSDDCone(){
274 // Display SDD Cone Geometry
275 // Inputs:
276 // none.
277 // Outputs:
278 // none.
279 // Retrurn:
280 // none.
281 Double_t lon,lat,psi;
282 //
283 TCanvas *c2;
284 if(!(c2 = (TCanvas*)gROOT->FindObject("C2")))
285 c2 = new TCanvas("C2","ITS SDD Cone Geometry",900,450);
286 c2->Divide(2,1);
287 TGeoVolume *SDD=0;
288 TGeoNode *node;
289 //
290 node = fITS->FindNode("ITSsddConeL_1");
291 SDD = node->GetVolume();
292 //
293 fmgr->SetNsegments(fNsegments);
294 //
295 fmgr->SetVisLevel(6);
296 fmgr->SetVisOption(0);
297 //
298 lon = fLongitude;
299 lat = fLatitude;
300 psi = fPsi;
301 fLongitude = 270.0; // Front
302 fLatitude = 90.0;
303 fPsi = 0.0;
304 Displaying(SDD,c2,1);
305 //
306 fLongitude = 270.0; // Top
307 fLatitude = 0.0;
308 fPsi = 0.0;
309 Displaying(SDD,c2,2);
310 //
311 fLongitude = lon;
312 fLatitude = lat;
313 fPsi = psi;
314}
315//----------------------------------------------------------------------
316void DisplayITSv11::EngineeringSDDCylinder(){
317 // Display SDD Cylinder Geometry
318 // Inputs:
319 // none.
320 // Outputs:
321 // none.
322 // Retrurn:
323 // none.
324 Double_t lon,lat,psi;
325 //
326 TCanvas *c3;
327 if(!(c3 = (TCanvas*)gROOT->FindObject("C3")))
328 c3 = new TCanvas("C3","ITS SDD Cylinder Geometry",900,450);
329 c3->Divide(2,1);
330 TGeoVolume *SDD=0;
331 TGeoNode *node;
332 TArrow *arrow=new TArrow();
333 //
334 node = fITS->FindNode("ITSsddCentCylCF_1");
335 SDD = node->GetVolume();
336 Double_t Rmin = ((TGeoTube*)(SDD->GetShape()))->GetRmin();
337 Double_t Rmax = ((TGeoTube*)(SDD->GetShape()))->GetRmax();
338 Double_t Dz = ((TGeoTube*)(SDD->GetShape()))->GetDz();
339 //
340 fmgr->SetNsegments(fNsegments);
341 //
342 fmgr->SetVisLevel(6);
343 fmgr->SetVisOption(0);
344 //
345 lon = fLongitude;
346 lat = fLatitude;
347 psi = fPsi;
348 fLongitude = 270.0; // Front
349 fLatitude = 90.0;
350 fPsi = 0.0;
351 Displaying(SDD,c3,1);
352 arrow->DrawArrow(1.01*Rmax,-Dz,1.01*Rmax,+Dz);
353 //
354 fLongitude = 270.0; // Top
355 fLatitude = 0.0;
356 fPsi = 0.0;
357 Displaying(SDD,c3,2);
358 arrow->DrawArrow(Rmax,0.0,Rmax,0.0);
359 Double_t s = TMath::Sin(0.7),c = TMath::Cos(0.7);
360 arrow->DrawArrow(-Rmin*c,-Rmin*s,Rmin*c,Rmin*s);
361 //
362 fLongitude = lon;
363 fLatitude = lat;
364 fPsi = psi;
365}
366//----------------------------------------------------------------------
367void DisplayITSv11::EngineeringSupRB24(){
368 // Display SDD Cylinder Geometry
369 // Inputs:
370 // none.
371 // Outputs:
372 // none.
373 // Retrurn:
374 // none.
375 Double_t lon,lat,psi;
376 //
377 TCanvas *c4;
378 if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
379 c4 = new TCanvas("C4","ITS SDD Cylinder Geometry",900,450);
380 c4->Divide(2,1);
381 TGeoVolume *SUPRB24=0;
382 TGeoNode *node;
383 //TArrow *arrow=new TArrow();
384 //
385 node = fITS->FindNode("ITSsupFrameM24_1");
386 SUPRB24 = node->GetVolume();
387 //
388 fmgr->SetNsegments(fNsegments);
389 //
390 fmgr->SetVisLevel(6);
391 fmgr->SetVisOption(0);
392 //
393 lon = fLongitude;
394 lat = fLatitude;
395 psi = fPsi;
396 fLongitude = 270.0; // Front
397 fLatitude = 90.0;
398 fPsi = 0.0;
399 Displaying(SUPRB24,c4,1);
400 //
401 fLongitude = 270.0; // Top
402 fLatitude = 0.0;
403 fPsi = 0.0;
404 Displaying(SUPRB24,c4,2);
405 //
406 fLongitude = lon;
407 fLatitude = lat;
408 fPsi = psi;
409}
410
411//----------------------------------------------------------------------
412void DisplayITSv11::EngineeringSupRB26(){
413 // Display SDD Cylinder Geometry
414 // Inputs:
415 // none.
416 // Outputs:
417 // none.
418 // Retrurn:
419 // none.
420 Double_t lon,lat,psi;
421 //
422 TCanvas *c5;
423 if(!(c5 = (TCanvas*)gROOT->FindObject("C5")))
424 c5 = new TCanvas("C5","ITS SDD Cylinder Geometry",900,450);
425 c5->Divide(2,1);
426 TGeoVolume *SUPRB26=0;
427 TGeoNode *node;
428 //TArrow *arrow=new TArrow();
429 //
430 node = fITS->FindNode("ITSsupFrameM26_1");
431 SUPRB26 = node->GetVolume();
432 //
433 fmgr->SetNsegments(fNsegments);
434 //
435 fmgr->SetVisLevel(6);
436 fmgr->SetVisOption(0);
437 //
438 lon = fLongitude;
439 lat = fLatitude;
440 psi = fPsi;
441 fLongitude = 270.0; // Front
442 fLatitude = 90.0;
443 fPsi = 0.0;
444 Displaying(SUPRB26,c5,1);
445 //
446 fLongitude = 270.0; // Top
447 fLatitude = 0.0;
448 fPsi = 0.0;
449 Displaying(SUPRB26,c5,2);
450 //
451 fLongitude = lon;
452 fLatitude = lat;
453 fPsi = psi;
454}