Geometry update.
[u/mrichter/AliRoot.git] / ITS / Displayv11.C
CommitLineData
541f7ba6 1//----------------------------------------------------------------------
2void Displayv11(const char* filename=""){
3 // Display AliITSv11 Geometry
4 // Inputs:
5 // const char* filename output file with the display in it
6 // Outputs:
7 // none.
8 // Retrurn:
9 // none.
10
11 gSystem->Load("libGeom");
12 //
541f7ba6 13 if(gGeoManager) delete gGeoManager;
d1a22f9a 14 mgr2 = gGeoManager = new TGeoManager("ITSGeometry",
15 " ITS Simulation Geometry Manager");
541f7ba6 16 //
17 TGeoMaterial *vacmat = new TGeoMaterial("Vacume",0,0,0);
18 TGeoMedium *vacmed = new TGeoMedium("Vacume_med",1,vacmat);
19 TGeoVolume *ALIC = mgr2->MakeBox("ALIC",vacmed,100.,100.,200.);
20 mgr2->SetTopVolume(ALIC);
21 //
541f7ba6 22 AliITSv11 *its = new AliITSv11();
d1a22f9a 23 its->SetDebug(ISetits(0,-1));
541f7ba6 24 its->CreateMaterials();
25 its->CreateGeometry();
541f7ba6 26 //
27 mgr2->CloseGeometry();
d1a22f9a 28 //
29 TControlBar *bar=new TControlBar("vertical","ITS Geometry Display",10,10);
30 bar->AddButton("Set ITS Debug level 1","ISetits(0,1)","Debug on");
31 bar->AddButton("Set ITS Debug level 0","ISetits(0,0)","Debug off");
32 bar->AddButton("Set ITS Theta,Phi cut on","ISetits(2,1)","Cut on");
33 bar->AddButton("Set ITS Theta,Phi cut off","ISetits(2,0)","Cut off");
34 bar->AddButton("Set axis on","ISetits(3,1)","Show Axis on");
35 bar->AddButton("Set axis off","ISetits(3,0)","Show Axis off");
36 bar->AddButton("Set perspective on","ISetits(4,1)","Perspective on");
37 bar->AddButton("Set perspective off","ISetits(4,0)","Perspective off");
38 bar->AddButton("Set circle/80","ISetits(1,80)","circles ~ by 80 lines");
39 bar->AddButton("Display Geometry","Displayit()","Run Displayit");
40 bar->AddButton("Display SDD Cone","EngineeringSDDCone()",
41 "Run EngineeringSDDCone");
42 bar->AddButton("Display SDD Centeral Cylinder","EngineeringSDDCylinder()",
43 "Run EngineeringSDDCylinder");
44 bar->AddButton("Display SUP RB24 side","EngineeringSupRB24()",
45 "Run EngineeringSDDCylinder");
46 bar->AddButton("Display SUP RB26 side","EngineeringSupRB26()",
47 "Run EngineeringSupRB26");
48 bar->AddButton("Quit/Exit",".q","Exit");
49 bar->Show();
50 gROOT->SaveContext();
51 //Displayit();
52}
53//----------------------------------------------------------------------
54Int_t ISetits(Int_t t,Int_t v){
55 static Int_t itsdebug=0,nsegments=80,cut=0,axis=1,perspective=0;
56
57 switch (t) {
58 case 0:
59 if(v<0) return itsdebug;
60 itsdebug = v;
61 break;
62 case 1:
63 if(v<0) return nsegments;
64 nsegments= v;
65 break;
66 case 2:
67 if(v<0) return cut;
68 cut = v;
69 break;
70 case 3:
71 if(v<0) return axis;
72 axis = v;
73 break;
74 case 4:
75 if(v<0) return perspective;
76 perspective = v;
77 break;
78 }// end switch
79 return 0;
80}
81//----------------------------------------------------------------------
82Double_t DSetits(Int_t t,Double_t v){
83 static Double_t phimincut=0.0,phimaxcut=180.0;
84 static Double_t longitude=90.0,latitude=0.0,psi=0.0;
85
86 switch (t) {
87 case 0:
88 if(v<0.) return phimincut;
89 phimincut = v;
90 break;
91 case 1:
92 if(v<0.) return phimaxcut;
93 phimaxcut = v;
94 break;
95 case 2:
96 if(v<0.) return longitude;
97 longitude = v;
98 break;
99 case 3:
100 if(v<0.) return latitude;
101 latitude = v;
102 break;
103 case 4:
104 if(v<0.) return latitude;
105 latitude = v;
106 break;
107 }// end switch
108 return 0;
109}
110//----------------------------------------------------------------------
111void Displayit(){
112 // Display AliITSv11 Geometry
113 // Inputs:
114 // const char* filename output file with the display in it
115 // Outputs:
116 // none.
117 // Retrurn:
118 // none.
119 Int_t irr;
120 //
121 TGeoManager *mgr2 = gGeoManager;
122 TGeoVolume *ALIC = mgr2->GetTopVolume();
123 TCanvas *c1;
124 if(!(c1 = (TCanvas*)gROOT->FindObject("C1")))
125 c1 = new TCanvas("C1","ITS Simulation Geometry",900,900);
126 c1->Divide(2,2);
127 //
128 mgr2->SetNsegments(ISetits(1,-1));
541f7ba6 129 //
171f3f35 130 mgr2->SetVisLevel(6);
cbd7b929 131 mgr2->SetVisOption(0);
171f3f35 132 //mgr2->CheckOverlaps(0.01);
133 //mgr2->PrintOverlaps();
d1a22f9a 134 if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
541f7ba6 135 //
171f3f35 136 c1->cd(1);
137 ALIC->Draw();
138 TPad *p1 = c1->GetPad(1);
139 TView *view1 = p1->GetView();
140 if(view1){
d1a22f9a 141 view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
142 if(irr) cout <<"error="<<irr<<endl;
143 if(ISetits(4,-1)==0) view1->SetParralel();
144 else view1->SetPerspective();
171f3f35 145 view1->Front();
d1a22f9a 146 if(ISetits(3,-1)!=0) view1->ShowAxis();
147 } // end if view1
171f3f35 148 c1->cd(2);
149 ALIC->Draw();
150 TPad *p2 = c1->GetPad(2);
151 TView *view2 = p2->GetView();
152 if(view2){
d1a22f9a 153 view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
154 if(irr) cout <<"error="<<irr<<endl;
155 if(ISetits(4,-1)==0) view2->SetParralel();
156 else view2->SetPerspective();
171f3f35 157 view2->RotateView(60.,30.);
d1a22f9a 158 if(ISetits(3,-1)!=0) view2->ShowAxis();
171f3f35 159 } // end if view2
160 c1->cd(3);
171f3f35 161 ALIC->Draw();
d1a22f9a 162 c1->SetPhi(90.0); c1->SetTheta(90.0);
171f3f35 163 TPad *p3 = c1->GetPad(3);
164 TView *view3 = p3->GetView();
165 if(view3){
d1a22f9a 166 view3->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
167 if(irr) cout <<"error="<<irr<<endl;
168 if(ISetits(4,-1)==0) view3->SetParralel();
169 else view3->SetPerspective();
171f3f35 170 view3->Top();
d1a22f9a 171 if(ISetits(3,-1)!=0) view3->ShowAxis();
171f3f35 172 } // end if view3
173 c1->cd(4);
541f7ba6 174 ALIC->Draw();
171f3f35 175 TPad *p4 = c1->GetPad(4);
176 TView *view4 = p4->GetView();
177 if(view4){
d1a22f9a 178 view4->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
179 if(irr) cout <<"error="<<irr<<endl;
180 if(ISetits(4,-1)==0) view4->SetParralel();
181 else view4->SetPerspective();
171f3f35 182 view4->Side();
d1a22f9a 183 if(ISetits(3,-1)!=0) view4->ShowAxis();
171f3f35 184 } // end if view4
541f7ba6 185 //
186}
d1a22f9a 187//----------------------------------------------------------------------
188void EngineeringSDDCone(){
189 // Display SDD Cone Geometry
190 // Inputs:
191 // none.
192 // Outputs:
193 // none.
194 // Retrurn:
195 // none.
196 Int_t irr;
197 //
198 TGeoManager *mgr2 = gGeoManager;
199 TGeoVolume *ALIC = mgr2->GetTopVolume();
200 TCanvas *c2;
201 if(!(c2 = (TCanvas*)gROOT->FindObject("C2")))
202 c2 = new TCanvas("C2","ITS SDD Cone Geometry",900,450);
203 c2->Divide(2,1);
204 TGeoVolume *ITS,*SDD=0;
205 TGeoNode *node;
206 //
207 node = ALIC->FindNode("ITSV_1");
208 ITS = node->GetVolume();
209 node = ITS->FindNode("ITSsddConeL_1");
210 SDD = node->GetVolume();
211 //
212 mgr2->SetNsegments(ISetits(1,-1));
213 //
214 mgr2->SetVisLevel(6);
215 mgr2->SetVisOption(0);
216 //mgr2->CheckOverlaps(0.01);
217 //mgr2->PrintOverlaps();
218 mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
219 if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
220 //
221 c2->cd(1);
222 SDD->Draw();
223 TPad *p1 = c2->GetPad(1);
224 TView *view1 = p1->GetView();
225 if(view1){
226 view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
227 if(irr) cout <<"error="<<irr<<endl;
228 if(ISetits(4,-1)==0) view1->SetParralel();
229 else view1->SetPerspective();
230 view1->Front();
231 if(ISetits(3,-1)!=0) view1->ShowAxis();
232 } // end if view1
233 //
234 c2->cd(2);
235 SDD->Draw();
236 TPad *p2 = c2->GetPad(2);
237 TView *view2 = p2->GetView();
238 if(view2){
239 view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
240 if(irr) cout <<"error="<<irr<<endl;
241 if(ISetits(4,-1)==0) view2->SetParralel();
242 else view2->SetPerspective();
243 view2->Top();
244 if(ISetits(3,-1)!=0) view2->ShowAxis();
245 } // end if view1
246 //
247}
248//----------------------------------------------------------------------
249void EngineeringSDDCylinder(){
250 // Display SDD Cylinder Geometry
251 // Inputs:
252 // none.
253 // Outputs:
254 // none.
255 // Retrurn:
256 // none.
257 Int_t irr;
258 //
259 TGeoManager *mgr2 = gGeoManager;
260 TGeoVolume *ALIC = mgr2->GetTopVolume();
261 TCanvas *c3;
262 if(!(c3 = (TCanvas*)gROOT->FindObject("C3")))
263 c3 = new TCanvas("C3","ITS SDD Cylinder Geometry",900,450);
264 c3->Divide(2,1);
265 TGeoVolume *ITS,*SDD=0;
266 TGeoNode *node;
267 TArrow *arrow=new TArrow();
268 //
269 node = ALIC->FindNode("ITSV_1");
270 ITS = node->GetVolume();
271 node = ITS->FindNode("ITSsddCentCylCF_1");
272 SDD = node->GetVolume();
273 Double_t Rmin = ((TGeoTube*)(SDD->GetShape()))->GetRmin();
274 Double_t Rmax = ((TGeoTube*)(SDD->GetShape()))->GetRmax();
275 Double_t Dz = ((TGeoTube*)(SDD->GetShape()))->GetDz();
276 //
277 mgr2->SetNsegments(ISetits(1,-1));
278 //
279 mgr2->SetVisLevel(6);
280 mgr2->SetVisOption(0);
281 //mgr2->CheckOverlaps(0.01);
282 //mgr2->PrintOverlaps();
283 mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
284 if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
285 //
286 c3->cd(1);
287 SDD->Draw();
288 TPad *p1 = c3->GetPad(1);
289 TView *view1 = p1->GetView();
290 if(view1){
291 view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
292 if(irr) cout <<"error="<<irr<<endl;
293 if(ISetits(4,-1)==0) view1->SetParralel();
294 else view1->SetPerspective();
295 view1->Front();
296 if(ISetits(3,-1)!=0) view1->ShowAxis();
297 } // end if view1
298 arrow->DrawArrow(1.01*Rmax,-Dz,1.01*Rmax,+Dz);
299 //
300 c3->cd(2);
301 SDD->Draw();
302 TPad *p2 = c3->GetPad(2);
303 TView *view2 = p2->GetView();
304 if(view2){
305 view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
306 if(irr) cout <<"error="<<irr<<endl;
307 if(ISetits(4,-1)==0) view2->SetParralel();
308 else view2->SetPerspective();
309 view2->Top();
310 if(ISetits(3,-1)!=0) view2->ShowAxis();
311 } // end if view2
312 arrow->DrawArrow(Rmax,0.0,Rmax,0.0);
313 Double_t s = TMath::Sin(0.7),c = TMath::Cos(0.7);
314 arrow->DrawArrow(-Rmin*c,-Rmin*s,Rmin*c,Rmin*s);
315 //
316}
317//----------------------------------------------------------------------
318void EngineeringSupRB24(){
319 // Display SDD Cylinder Geometry
320 // Inputs:
321 // none.
322 // Outputs:
323 // none.
324 // Retrurn:
325 // none.
326 Int_t irr;
327 //
328 TGeoManager *mgr2 = gGeoManager;
329 TGeoVolume *ALIC = mgr2->GetTopVolume();
330 TCanvas *c4;
331 if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
332 c4 = new TCanvas("C4","ITS SDD Cylinder Geometry",900,450);
333 c4->Divide(2,1);
334 TGeoVolume *ITS,*SUPRB24=0;
335 TGeoNode *node;
336 TArrow *arrow=new TArrow();
337 //
338 node = ALIC->FindNode("ITSV_1");
339 ITS = node->GetVolume();
340 node = ITS->FindNode("ITSsupFrameM24_1");
341 SUPRB24 = node->GetVolume();
342 //
343 mgr2->SetNsegments(ISetits(1,-1));
344 //
345 mgr2->SetVisLevel(6);
346 mgr2->SetVisOption(0);
347 //mgr2->CheckOverlaps(0.01);
348 //mgr2->PrintOverlaps();
349 mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
350 if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
351 //
352 c4->cd(1);
353 SUPRB24->Draw();
354 TPad *p1 = c4->GetPad(1);
355 TView *view1 = p1->GetView();
356 if(view1){
357 view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
358 if(irr) cout <<"error="<<irr<<endl;
359 if(ISetits(4,-1)==0) view1->SetParralel();
360 else view1->SetPerspective();
361 view1->Front();
362 if(ISetits(3,-1)!=0) view1->ShowAxis();
363 } // end if view1
364 //
365 c4->cd(2);
366 SUPRB24->Draw();
367 TPad *p2 = c4->GetPad(2);
368 TView *view2 = p2->GetView();
369 if(view2){
370 view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
371 if(irr) cout <<"error="<<irr<<endl;
372 if(ISetits(4,-1)==0) view2->SetParralel();
373 else view2->SetPerspective();
374 view2->Top();
375 if(ISetits(3,-1)!=0) view2->ShowAxis();
376 } // end if view2
377 //
378}
379
380//----------------------------------------------------------------------
381void EngineeringSupRB26(){
382 // Display SDD Cylinder Geometry
383 // Inputs:
384 // none.
385 // Outputs:
386 // none.
387 // Retrurn:
388 // none.
389 Int_t irr;
390 //
391 TGeoManager *mgr2 = gGeoManager;
392 TGeoVolume *ALIC = mgr2->GetTopVolume();
393 TCanvas *c5;
394 if(!(c5 = (TCanvas*)gROOT->FindObject("C5")))
395 c5 = new TCanvas("C5","ITS SDD Cylinder Geometry",900,450);
396 c5->Divide(2,1);
397 TGeoVolume *ITS,*SUPRB26=0;
398 TGeoNode *node;
399 TArrow *arrow=new TArrow();
400 //
401 node = ALIC->FindNode("ITSV_1");
402 ITS = node->GetVolume();
403 node = ITS->FindNode("ITSsupFrameM26_1");
404 SUPRB26 = node->GetVolume();
405 //
406 mgr2->SetNsegments(ISetits(1,-1));
407 //
408 mgr2->SetVisLevel(6);
409 mgr2->SetVisOption(0);
410 //mgr2->CheckOverlaps(0.01);
411 //mgr2->PrintOverlaps();
412 mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
413 if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
414 //
415 c5->cd(1);
416 SUPRB26->Draw();
417 TPad *p1 = c5->GetPad(1);
418 TView *view1 = p1->GetView();
419 if(view1){
420 view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
421 if(irr) cout <<"error="<<irr<<endl;
422 if(ISetits(4,-1)==0) view1->SetParralel();
423 else view1->SetPerspective();
424 view1->Front();
425 if(ISetits(3,-1)!=0) view1->ShowAxis();
426 } // end if view1
427 //
428 c5->cd(2);
429 SUPRB26->Draw();
430 TPad *p2 = c5->GetPad(2);
431 TView *view2 = p2->GetView();
432 if(view2){
433 view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
434 if(irr) cout <<"error="<<irr<<endl;
435 if(ISetits(4,-1)==0) view2->SetParralel();
436 else view2->SetPerspective();
437 view2->Top();
438 if(ISetits(3,-1)!=0) view2->ShowAxis();
439 } // end if view2
440 //
441}