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