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 **************************************************************************/
21 #include <TGeoManager.h>
23 #include <TGeoVolume.h>
24 #include <TGeoShape.h>
26 #include <TGeoMaterial.h>
27 #include <TGeoMedium.h>
29 #include <TControlBar.h>
35 #include "AliITSv11.h"
36 #include "DisplayITSv11.h"
38 ClassImp(DisplayITSv11)
39 //______________________________________________________________________
40 DisplayITSv11::DisplayITSv11(){
41 // Default Constructor.
47 // A Default constructed DispalyITSv11 class/task.
62 fRmin[0] = fRmin[1] = fRmin[2] = fRmax[0] = fRmax[1] = fRmax[2] = 0.0;
67 //______________________________________________________________________
68 DisplayITSv11::~DisplayITSv11(){
78 if(fClip) delete fClip;
83 //______________________________________________________________________
84 void DisplayITSv11::Exec(Option_t* opt){
85 // Main display routine
87 // Option_t * opt Not presently used.
94 gSystem->Load("libGeom");
96 if(gGeoManager) delete gGeoManager;
97 fmgr = gGeoManager = new TGeoManager("ITSGeometry",
98 " ITS Simulation Geometry Manager");
100 TGeoMaterial *vacmat = new TGeoMaterial("Vacume",0,0,0);
101 TGeoMedium *vacmed = new TGeoMedium("Vacume_med",1,vacmat);
105 for(i=0;i<3;i++) fRmin[i] = -fRmax[i];
106 fALICE = fmgr->MakeBox("ALIC",vacmed,fRmax[0],fRmax[1],fRmax[2]);
107 fmgr->SetTopVolume(fALICE);
109 AliITSv11 *fits = new AliITSv11();
110 fits->SetDebug(GetDebugITS());
111 fits->CreateMaterials();
112 fits->CreateGeometry();
114 fmgr->CloseGeometry();
115 fITS = fALICE->FindNode("ITSV_1")->GetVolume();
117 TControlBar *bar=new TControlBar("vertical","ITS Geometry Display",10,10);
118 bar->AddButton("Set ITS Debug level 1","SetITSdebugOn()","Debug on");
119 bar->AddButton("Set ITS Debug level 0","SetITSdebugOff()","Debug off");
120 bar->AddButton("Set ITS Theta,Phi cut on","SetCylindericalClipVolume()",
122 bar->AddButton("Set ITS Theta,Phi cut off","SetCylindericalCutOff()",
124 bar->AddButton("Set axis on","SetAxisOn()","Show Axis on");
125 bar->AddButton("Set axis off","SetAxisOff()","Show Axis off");
126 bar->AddButton("Set perspective on","SetPerspectiveOn()",
128 bar->AddButton("Set perspective off","SetPerspectiveOff()",
130 bar->AddButton("Draw volumes as Solid","SetSolid()","Solid Volumes");
131 bar->AddButton("Draw volumes as wire","SetWire()","Wire Volumes");
132 bar->AddButton("Set circle/80","SetCircleSegments(80)",
133 "circles ~ by 80 lines");
134 bar->AddButton("Check Overlaps","fmgr->CheckOverlaps()",
135 "Check for overlaps");
136 bar->AddButton("Display Geometry","Displayit()","Run Displayit");
137 bar->AddButton("Display SPD Thermal Sheald","EngineeringSPDThS()",
138 "Run EngineeringSPDThS");
139 bar->AddButton("Display SDD Cone","EngineeringSDDCone()",
140 "Run EngineeringSDDCone");
141 bar->AddButton("Display SDD Centeral Cylinder","EngineeringSDDCylinder()",
142 "Run EngineeringSDDCylinder");
143 bar->AddButton("Display SUP RB24 side","EngineeringSupRB24()",
144 "Run EngineeringSDDCylinder");
145 bar->AddButton("Display SUP RB26 side","EngineeringSupRB26()",
146 "Run EngineeringSupRB26");
147 bar->AddButton("Quit/Exit",".q","Exit");
149 gROOT->SaveContext();
152 //______________________________________________________________________
153 void DisplayITSv11::Displaying(TGeoVolume *v,TCanvas *c,Int_t ipad){
154 // Display Volume according to existing values
156 // TGeoVolume *v volume to be drawn.
157 // TCanvas *p Pad where drawing is to be done
158 // Int_t ipad subpad to draw on
171 if(!view){view = new TView(fRmin,fRmax,1);p->SetView(view);}
172 view->SetRange(fRmin,fRmax);
173 view->SetView(fLongitude,fLatitude,fPsi,irr);
174 if(fPerspective) view->SetPerspective();
175 else view->SetParralel();
176 if(fAxis) view->ShowAxis();
178 if(fClip) fmgr->SetClippingShape(fClip);
180 if(fSolid) v->Raytrace();
184 //----------------------------------------------------------------------
185 void DisplayITSv11::DisplayITS(){
186 // Display AliITSv11 Geometry
188 // const char* filename output file with the display in it
193 Double_t lon,lat,psi;
196 if(!(c1 = (TCanvas*)gROOT->FindObject("C1")))
197 c1 = new TCanvas("C1","ITS Simulation Geometry",900,900);
200 fmgr->SetNsegments(fNsegments);
202 fmgr->SetVisLevel(6);
203 fmgr->SetVisOption(0);
205 Displaying(fALICE,c1,2);
209 fLongitude = 270.0; // Front
212 Displaying(fALICE,c1,1);
213 fLongitude = 270.0; // Top
216 Displaying(fALICE,c1,3);
217 fLongitude = 0.0; // Side
220 Displaying(fALICE,c1,4);
226 //----------------------------------------------------------------------
227 void DisplayITSv11::EngineeringSPDThS(){
228 // Display SPD Thermal Sheald Geometry
235 Double_t lon,lat,psi;
239 if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
240 c4 = new TCanvas("C4","ITS SDD Cylinder Geometry",900,450);
242 TGeoVolume *SPDThS=0;
243 //TArrow *arrow=new TArrow();
245 node = fITS->FindNode("ITSspdThermalSheald_1");
246 SPDThS = node->GetVolume();
248 fmgr->SetNsegments(fNsegments);
250 fmgr->SetVisLevel(6);
251 fmgr->SetVisOption(0);
256 fLongitude = 270.0; // Front
259 Displaying(SPDThS,c4,1);
261 fLongitude = 270.0; // Top
264 Displaying(SPDThS,c4,2);
270 //----------------------------------------------------------------------
271 void DisplayITSv11::EngineeringSDDCone(){
272 // Display SDD Cone Geometry
279 Double_t lon,lat,psi;
282 if(!(c2 = (TCanvas*)gROOT->FindObject("C2")))
283 c2 = new TCanvas("C2","ITS SDD Cone Geometry",900,450);
288 node = fITS->FindNode("ITSsddConeL_1");
289 SDD = node->GetVolume();
291 fmgr->SetNsegments(fNsegments);
293 fmgr->SetVisLevel(6);
294 fmgr->SetVisOption(0);
299 fLongitude = 270.0; // Front
302 Displaying(SDD,c2,1);
304 fLongitude = 270.0; // Top
307 Displaying(SDD,c2,2);
313 //----------------------------------------------------------------------
314 void DisplayITSv11::EngineeringSDDCylinder(){
315 // Display SDD Cylinder Geometry
322 Double_t lon,lat,psi;
325 if(!(c3 = (TCanvas*)gROOT->FindObject("C3")))
326 c3 = new TCanvas("C3","ITS SDD Cylinder Geometry",900,450);
330 TArrow *arrow=new TArrow();
332 node = fITS->FindNode("ITSsddCentCylCF_1");
333 SDD = node->GetVolume();
334 Double_t Rmin = ((TGeoTube*)(SDD->GetShape()))->GetRmin();
335 Double_t Rmax = ((TGeoTube*)(SDD->GetShape()))->GetRmax();
336 Double_t Dz = ((TGeoTube*)(SDD->GetShape()))->GetDz();
338 fmgr->SetNsegments(fNsegments);
340 fmgr->SetVisLevel(6);
341 fmgr->SetVisOption(0);
346 fLongitude = 270.0; // Front
349 Displaying(SDD,c3,1);
350 arrow->DrawArrow(1.01*Rmax,-Dz,1.01*Rmax,+Dz);
352 fLongitude = 270.0; // Top
355 Displaying(SDD,c3,2);
356 arrow->DrawArrow(Rmax,0.0,Rmax,0.0);
357 Double_t s = TMath::Sin(0.7),c = TMath::Cos(0.7);
358 arrow->DrawArrow(-Rmin*c,-Rmin*s,Rmin*c,Rmin*s);
364 //----------------------------------------------------------------------
365 void DisplayITSv11::EngineeringSupRB24(){
366 // Display SDD Cylinder Geometry
373 Double_t lon,lat,psi;
376 if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
377 c4 = new TCanvas("C4","ITS SDD Cylinder Geometry",900,450);
379 TGeoVolume *SUPRB24=0;
381 //TArrow *arrow=new TArrow();
383 node = fITS->FindNode("ITSsupFrameM24_1");
384 SUPRB24 = node->GetVolume();
386 fmgr->SetNsegments(fNsegments);
388 fmgr->SetVisLevel(6);
389 fmgr->SetVisOption(0);
394 fLongitude = 270.0; // Front
397 Displaying(SUPRB24,c4,1);
399 fLongitude = 270.0; // Top
402 Displaying(SUPRB24,c4,2);
409 //----------------------------------------------------------------------
410 void DisplayITSv11::EngineeringSupRB26(){
411 // Display SDD Cylinder Geometry
418 Double_t lon,lat,psi;
421 if(!(c5 = (TCanvas*)gROOT->FindObject("C5")))
422 c5 = new TCanvas("C5","ITS SDD Cylinder Geometry",900,450);
424 TGeoVolume *SUPRB26=0;
426 //TArrow *arrow=new TArrow();
428 node = fITS->FindNode("ITSsupFrameM26_1");
429 SUPRB26 = node->GetVolume();
431 fmgr->SetNsegments(fNsegments);
433 fmgr->SetVisLevel(6);
434 fmgr->SetVisOption(0);
439 fLongitude = 270.0; // Front
442 Displaying(SUPRB26,c5,1);
444 fLongitude = 270.0; // Top
447 Displaying(SUPRB26,c5,2);