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 **************************************************************************/
19 #include <Riostream.h>
22 #include <TGeoManager.h>
24 #include <TGeoVolume.h>
25 #include <TGeoShape.h>
27 #include <TGeoMaterial.h>
28 #include <TGeoMedium.h>
30 #include <TControlBar.h>
36 #include "AliITSv11.h"
37 #include "DisplayITSv11.h"
39 ClassImp(DisplayITSv11)
40 //______________________________________________________________________
41 DisplayITSv11::DisplayITSv11(){
42 // Default Constructor.
48 // A Default constructed DispalyITSv11 class/task.
63 fRmin[0] = fRmin[1] = fRmin[2] = fRmax[0] = fRmax[1] = fRmax[2] = 0.0;
68 //______________________________________________________________________
69 DisplayITSv11::~DisplayITSv11(){
79 if(fClip) delete fClip;
84 //______________________________________________________________________
85 void DisplayITSv11::Exec(Option_t* opt){
86 // Main display routine
88 // Option_t * opt Not presently used.
95 if(strstr(opt,"debug")) fits->SetDebug();
96 gSystem->Load("libGeom");
98 if(gGeoManager) delete gGeoManager;
99 fmgr = gGeoManager = new TGeoManager("ITSGeometry",
100 " ITS Simulation Geometry Manager");
102 TGeoMaterial *vacmat = new TGeoMaterial("Vacume",0,0,0);
103 TGeoMedium *vacmed = new TGeoMedium("Vacume_med",1,vacmat);
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);
111 AliITSv11 *fits = new AliITSv11();
112 fits->SetDebug(GetDebugITS());
113 fits->CreateMaterials();
114 fits->CreateGeometry();
116 fmgr->CloseGeometry();
117 fITS = fALICE->FindNode("ITSV_1")->GetVolume();
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()",
124 bar->AddButton("Set ITS Theta,Phi cut off","SetCylindericalCutOff()",
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()",
130 bar->AddButton("Set perspective off","SetPerspectiveOff()",
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");
151 gROOT->SaveContext();
154 //______________________________________________________________________
155 void DisplayITSv11::Displaying(TGeoVolume *v,TCanvas *c,Int_t ipad){
156 // Display Volume according to existing values
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
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();
180 if(fClip) fmgr->SetClippingShape(fClip);
182 if(fSolid) v->Raytrace();
186 //----------------------------------------------------------------------
187 void DisplayITSv11::DisplayITS(){
188 // Display AliITSv11 Geometry
190 // const char* filename output file with the display in it
195 Double_t lon,lat,psi;
198 if(!(c1 = (TCanvas*)gROOT->FindObject("C1")))
199 c1 = new TCanvas("C1","ITS Simulation Geometry",900,900);
202 fmgr->SetNsegments(fNsegments);
204 fmgr->SetVisLevel(6);
205 fmgr->SetVisOption(0);
207 Displaying(fALICE,c1,2);
211 fLongitude = 270.0; // Front
214 Displaying(fALICE,c1,1);
215 fLongitude = 270.0; // Top
218 Displaying(fALICE,c1,3);
219 fLongitude = 0.0; // Side
222 Displaying(fALICE,c1,4);
228 //----------------------------------------------------------------------
229 void DisplayITSv11::EngineeringSPDThS(){
230 // Display SPD Thermal Sheald Geometry
237 Double_t lon,lat,psi;
241 if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
242 c4 = new TCanvas("C4","ITS SDD Cylinder Geometry",900,450);
244 TGeoVolume *SPDThS=0;
245 //TArrow *arrow=new TArrow();
247 node = fITS->FindNode("ITSspdThermalSheald_1");
248 SPDThS = node->GetVolume();
250 fmgr->SetNsegments(fNsegments);
252 fmgr->SetVisLevel(6);
253 fmgr->SetVisOption(0);
258 fLongitude = 270.0; // Front
261 Displaying(SPDThS,c4,1);
263 fLongitude = 270.0; // Top
266 Displaying(SPDThS,c4,2);
272 //----------------------------------------------------------------------
273 void DisplayITSv11::EngineeringSDDCone(){
274 // Display SDD Cone Geometry
281 Double_t lon,lat,psi;
284 if(!(c2 = (TCanvas*)gROOT->FindObject("C2")))
285 c2 = new TCanvas("C2","ITS SDD Cone Geometry",900,450);
290 node = fITS->FindNode("ITSsddConeL_1");
291 SDD = node->GetVolume();
293 fmgr->SetNsegments(fNsegments);
295 fmgr->SetVisLevel(6);
296 fmgr->SetVisOption(0);
301 fLongitude = 270.0; // Front
304 Displaying(SDD,c2,1);
306 fLongitude = 270.0; // Top
309 Displaying(SDD,c2,2);
315 //----------------------------------------------------------------------
316 void DisplayITSv11::EngineeringSDDCylinder(){
317 // Display SDD Cylinder Geometry
324 Double_t lon,lat,psi;
327 if(!(c3 = (TCanvas*)gROOT->FindObject("C3")))
328 c3 = new TCanvas("C3","ITS SDD Cylinder Geometry",900,450);
332 TArrow *arrow=new TArrow();
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();
340 fmgr->SetNsegments(fNsegments);
342 fmgr->SetVisLevel(6);
343 fmgr->SetVisOption(0);
348 fLongitude = 270.0; // Front
351 Displaying(SDD,c3,1);
352 arrow->DrawArrow(1.01*Rmax,-Dz,1.01*Rmax,+Dz);
354 fLongitude = 270.0; // Top
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);
366 //----------------------------------------------------------------------
367 void DisplayITSv11::EngineeringSupRB24(){
368 // Display SDD Cylinder Geometry
375 Double_t lon,lat,psi;
378 if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
379 c4 = new TCanvas("C4","ITS SDD Cylinder Geometry",900,450);
381 TGeoVolume *SUPRB24=0;
383 //TArrow *arrow=new TArrow();
385 node = fITS->FindNode("ITSsupFrameM24_1");
386 SUPRB24 = node->GetVolume();
388 fmgr->SetNsegments(fNsegments);
390 fmgr->SetVisLevel(6);
391 fmgr->SetVisOption(0);
396 fLongitude = 270.0; // Front
399 Displaying(SUPRB24,c4,1);
401 fLongitude = 270.0; // Top
404 Displaying(SUPRB24,c4,2);
411 //----------------------------------------------------------------------
412 void DisplayITSv11::EngineeringSupRB26(){
413 // Display SDD Cylinder Geometry
420 Double_t lon,lat,psi;
423 if(!(c5 = (TCanvas*)gROOT->FindObject("C5")))
424 c5 = new TCanvas("C5","ITS SDD Cylinder Geometry",900,450);
426 TGeoVolume *SUPRB26=0;
428 //TArrow *arrow=new TArrow();
430 node = fITS->FindNode("ITSsupFrameM26_1");
431 SUPRB26 = node->GetVolume();
433 fmgr->SetNsegments(fNsegments);
435 fmgr->SetVisLevel(6);
436 fmgr->SetVisOption(0);
441 fLongitude = 270.0; // Front
444 Displaying(SUPRB26,c5,1);
446 fLongitude = 270.0; // Top
449 Displaying(SUPRB26,c5,2);