Logo ROOT   6.16/01
Reference Guide
geodemo.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_geom
3/// GUI to draw the geometry shapes.
4///
5/// \macro_code
6///
7/// \author Andrei Gheata
8
9#include "TMath.h"
10#include "TControlBar.h"
11#include "TRandom3.h"
12#include "TROOT.h"
13#include "TSystem.h"
14#include "TVirtualPad.h"
15#include "TCanvas.h"
16#include "TVirtualGeoPainter.h"
17#include "TGeoManager.h"
18#include "TGeoNode.h"
19#include "TView.h"
20#include "TPaveText.h"
21#include "TGeoBBox.h"
22#include "TGeoPara.h"
23#include "TGeoTube.h"
24#include "TGeoCone.h"
25#include "TGeoEltu.h"
26#include "TGeoSphere.h"
27#include "TGeoTorus.h"
28#include "TGeoTrd1.h"
29#include "TGeoTrd2.h"
30#include "TGeoParaboloid.h"
31#include "TGeoHype.h"
32#include "TGeoPcon.h"
33#include "TGeoPgon.h"
34#include "TGeoArb8.h"
35#include "TGeoXtru.h"
36#include "TGeoCompositeShape.h"
37#include "TGeoPhysicalNode.h"
38
39Bool_t comments = kTRUE;
40Bool_t raytracing = kFALSE;
41Bool_t grotate = kFALSE;
42Bool_t axis = kTRUE;
43void autorotate();
44//______________________________________________________________________________
45void MakePicture()
46{
47 TView *view = gPad->GetView();
48 if (view) {
49// view->RotateView(248,66);
50 if (axis) view->ShowAxis();
51 }
52 Bool_t is_raytracing = gGeoManager->GetGeomPainter()->IsRaytracing();
53 if (is_raytracing != raytracing) {
55 gPad->Modified();
56 gPad->Update();
57 }
58}
59
60//______________________________________________________________________________
61void AddText(TPaveText *pave, const char *datamember, Double_t value, const char *comment)
62{
63 char line[128];
64 for (Int_t i=0; i<128; i++) line[i] = ' ';
65 memcpy(&line[0], datamember, strlen(datamember));
66 line[10] = '=';
67 char number[20];
68 sprintf(number, "%5.2f", value);
69 memcpy(&line[12], number, strlen(number));
70 line[26] = '=';
71 line[27] = '>';
72 sprintf(&line[30], "%s",comment);
73 TText *text = pave->AddText(line);
74// text->SetTextColor(4);
75 text->SetTextAlign(12);//12
76}
77
78//______________________________________________________________________________
79void AddText(TPaveText *pave, const char *datamember, Int_t value, const char *comment)
80{
81 char line[128];
82 for (Int_t i=0; i<128; i++) line[i] = ' ';
83 memcpy(&line[0], datamember, strlen(datamember));
84 line[10] = '=';
85 char number[20];
86 sprintf(number, "%5i", value);
87 memcpy(&line[12], number, strlen(number));
88 line[26] = '=';
89 line[27] = '>';
90 sprintf(&line[30], "%s",comment);
91 TText *text = pave->AddText(line);
92// text->SetTextColor(4);
93 text->SetTextAlign(12);
94}
95
96//______________________________________________________________________________
97void AddText(TPaveText *pave, TObject *pf, Int_t iaxis)
98{
99 char line[128];
101 if (!pave || !pf) return;
102 for (Int_t i=0; i<128; i++) line[i] = ' ';
103 TGeoVolume *volume = finder->GetVolume();
104 TGeoShape *sh = volume->GetShape();
105 sprintf(line, "Division of %s on axis %d (%s)", volume->GetName(), iaxis,sh->GetAxisName(iaxis));
106 TText *text = pave->AddText(line);
107 text->SetTextColor(3);
108 text->SetTextAlign(12);
109 AddText(pave, "fNdiv",finder->GetNdiv(),"number of divisions");
110 AddText(pave, "fStart",finder->GetStart(),"start divisioning position");
111 AddText(pave, "fStep",finder->GetStep(),"division step");
112}
113
114//______________________________________________________________________________
115void SavePicture(const char *name, TObject *objcanvas, TObject *objvol, Int_t iaxis, Double_t step)
116{
117 TCanvas *c = (TCanvas*)objcanvas;
118 TGeoVolume *vol = (TGeoVolume*)objvol;
119 if (!c || !vol) return;
120 c->cd();
121 char fname[32];
122 switch (iaxis) {
123 case 0:
124 sprintf(fname,"t_%s.gif",name);
125 break;
126 default:
127 if (step==0) sprintf(fname,"t_%sdiv%s.gif", name,vol->GetShape()->GetAxisName(iaxis));
128 else sprintf(fname,"t_%sdivstep%s.gif", name,vol->GetShape()->GetAxisName(iaxis));
129 }
130 c->Print(fname);
131}
132
133//______________________________________________________________________________
134Int_t randomColor()
135{
136 Double_t color = 7.*gRandom->Rndm();
137 return (1+Int_t(color));
138}
139
140//______________________________________________________________________________
141void raytrace() {
142 raytracing = !raytracing;
143 if (!gGeoManager) return;
145 if (!painter) return;
146 painter->SetRaytracing(raytracing);
147 if (!gPad) return;
148 gPad->Modified();
149 gPad->Update();
150}
151
152//______________________________________________________________________________
153void help() {
154 //
155
156 new TCanvas("chelp","Help to run demos",200,10,700,600);
157
158 TPaveText *welcome = new TPaveText(.1,.8,.9,.97);
159 welcome->AddText("Welcome to the new geometry package");
160 welcome->SetTextFont(32);
161 welcome->SetTextColor(4);
162 welcome->SetFillColor(24);
163 welcome->Draw();
164
165 TPaveText *hdemo = new TPaveText(.05,.05,.95,.7);
166 hdemo->SetTextAlign(12);
167 hdemo->SetTextFont(52);
168 hdemo->AddText("- Demo for building TGeo basic shapes and simple geometry. Shape parameters are");
169 hdemo->AddText(" displayed in the right pad");
170 hdemo->AddText("- Click left mouse button to execute one demo");
171 hdemo->AddText("- While pointing the mouse to the pad containing the geometry, do:");
172 hdemo->AddText("- .... click-and-move to rotate");
173 hdemo->AddText("- .... press j/k to zoom/unzoom");
174 hdemo->AddText("- .... press l/h/u/i to move the view center around");
175 hdemo->AddText("- Click Ray-trace ON/OFF to toggle ray-tracing");
176 hdemo->AddText("- Use <View with x3d> from the <View> menu to get an x3d view");
177 hdemo->AddText("- .... same methods to rotate/zoom/move the view");
178 hdemo->AddText("- Execute box(1,8) to divide a box in 8 equal slices along X");
179 hdemo->AddText("- Most shapes can be divided on X,Y,Z,Rxy or Phi :");
180 hdemo->AddText("- .... root[0] <shape>(IAXIS, NDIV, START, STEP);");
181 hdemo->AddText(" .... IAXIS = 1,2,3 meaning (X,Y,Z) or (Rxy, Phi, Z)");
182 hdemo->AddText(" .... NDIV = number of slices");
183 hdemo->AddText(" .... START = start slicing position");
184 hdemo->AddText(" .... STEP = division step");
185 hdemo->AddText("- Click Comments ON/OFF to toggle comments");
186 hdemo->AddText("- Click Ideal/Align geometry to see how alignment works");
187 hdemo->AddText(" ");
188 hdemo->SetAllWith("....","color",2);
189 hdemo->SetAllWith("....","font",72);
190 hdemo->SetAllWith("....","size",0.03);
191
192 hdemo->Draw();
193}
194
195//______________________________________________________________________________
196void geodemo ()
197{
198// root[0] .x geodemo.C
199// root[1] box(); //draw a TGeoBBox with description
200//
201// The box can be divided on one axis.
202//
203// root[2] box(iaxis, ndiv, start, step);
204//
205// where: iaxis = 1,2 or 3, meaning (X,Y,Z) or (Rxy, phi, Z) depending on shape type
206// ndiv = number of slices
207// start = starting position (must be in shape range)
208// step = division step
209// If step=0, all range of a given axis will be divided
210//
211// The same can procedure can be performed for visualizing other shapes.
212// When drawing one shape after another, the old geometry/canvas will be deleted.
213 TControlBar *bar = new TControlBar("vertical", "TGeo shapes",10,10);
214 bar->AddButton("How to run ","help()","Instructions for running this macro");
215 bar->AddButton("Arb8 ","arb8()","An arbitrary polyhedron defined by vertices (max 8) sitting on 2 parallel planes");
216 bar->AddButton("Box ","box()","A box shape.");
217 bar->AddButton("Composite ","composite()","A composite shape");
218 bar->AddButton("Cone ","cone()","A conical tube");
219 bar->AddButton("Cone segment","coneseg()","A conical segment");
220 bar->AddButton("Cut tube ","ctub()","A cut tube segment");
221 bar->AddButton("Elliptical tube","eltu()","An elliptical tube");
222 bar->AddButton("Extruded poly","xtru()","A general polygone extrusion");
223 bar->AddButton("Hyperboloid ","hype()","A hyperboloid");
224 bar->AddButton("Paraboloid ","parab()","A paraboloid");
225 bar->AddButton("Polycone ","pcon()","A polycone shape");
226 bar->AddButton("Polygone ","pgon()","A polygone");
227 bar->AddButton("Parallelepiped","para()","A parallelepiped shape");
228 bar->AddButton("Sphere ","sphere()","A spherical sector");
229 bar->AddButton("Trd1 ","trd1()","A trapezoid with dX varying with Z");
230 bar->AddButton("Trd2 ","trd2()","A trapezoid with both dX and dY varying with Z");
231 bar->AddButton("Trapezoid ","trap()","A general trapezoid");
232 bar->AddButton("Torus ","torus()","A toroidal segment");
233 bar->AddButton("Tube ","tube()","A tube with inner and outer radius");
234 bar->AddButton("Tube segment","tubeseg()","A tube segment");
235 bar->AddButton("Twisted trap","gtra()","A twisted trapezoid");
236 bar->AddButton("Aligned (ideal)","ideal()","An ideal (un-aligned) geometry");
237 bar->AddButton("Un-aligned","align()","Some alignment operation");
238 bar->AddButton("RAY-TRACE ON/OFF","raytrace()","Toggle ray-tracing mode");
239 bar->AddButton("COMMENTS ON/OFF","comments = !comments;","Toggle explanations pad ON/OFF");
240 bar->AddButton("AXES ON/OFF","axes()","Toggle axes ON/OFF");
241 bar->AddButton("AUTOROTATE ON/OFF","autorotate()","Toggle autorotation ON/OFF");
242 bar->Show();
243 gROOT->SaveContext();
244 gRandom = new TRandom3();
245}
246
247//______________________________________________________________________________
248void autorotate()
249{
250 grotate = !grotate;
251 if (!grotate) {
252 gROOT->SetInterrupt(kTRUE);
253 return;
254 }
255 if (!gPad) return;
256 TView *view = gPad->GetView();
257 if (!view) return;
258 if (!gGeoManager) return;
260 if (!painter) return;
261 Double_t longit = view->GetLongitude();
262// Double_t lat = view->GetLatitude();
263// Double_t psi = view->GetPsi();
264 Double_t dphi = 1.;
265 Int_t irep;
267 gROOT->SetInterrupt(kFALSE);
268 while (grotate) {
269 if (timer->ProcessEvents()) break;
270 if (gROOT->IsInterrupted()) break;
271 longit += dphi;
272 if (longit>360) longit -= 360.;
273 if (!gPad) {
274 grotate = kFALSE;
275 return;
276 }
277 view = gPad->GetView();
278 if (!view) {
279 grotate = kFALSE;
280 return;
281 }
282 view->SetView(longit,view->GetLatitude(),view->GetPsi(),irep);
283 gPad->Modified();
284 gPad->Update();
285 }
286 delete timer;
287}
288
289//______________________________________________________________________________
290void axes()
291{
292 axis = !axis;
293 if (!gPad) return;
294 TView *view = gPad->GetView();
295 view->ShowAxis();
296}
297
298//______________________________________________________________________________
299void box(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
300{
301 gROOT->GetListOfCanvases()->Delete();
302 if (iaxis<0 || iaxis>3) {
303 printf("Wrong division axis. Range is 1-3.\n");
304 return;
305 }
306 TCanvas *c = new TCanvas("box shape", "A simple box", 700,1000);
307 if (comments) {
308 c->Divide(1,2,0,0);
309 c->cd(2);
310 gPad->SetPad(0,0,1,0.4);
311 c->cd(1);
312 gPad->SetPad(0,0.4,1,1);
313 }
314 if (gGeoManager) delete gGeoManager;
315 new TGeoManager("box", "poza1");
316 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
317 TGeoMedium *med = new TGeoMedium("MED",1,mat);
318 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
320 TGeoVolume *vol = gGeoManager->MakeBox("BOX",med, 20,30,40);
321 vol->SetLineColor(randomColor());
322 vol->SetLineWidth(2);
323 top->AddNode(vol,1);
324 if (iaxis) {
325 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
326 if (!slice) return;
327 slice->SetLineColor(randomColor());
328 }
331 top->Draw();
332 MakePicture();
333 if (!comments) return;
334 c->cd(2);
335 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
336 pt->SetLineColor(1);
337 TGeoBBox *box = (TGeoBBox*)(vol->GetShape());
338 TText *text = pt->AddText("TGeoBBox - box class");
339 text->SetTextColor(2);
340 AddText(pt,"fDX",box->GetDX(),"half length in X");
341 AddText(pt,"fDY",box->GetDY(),"half length in Y");
342 AddText(pt,"fDZ",box->GetDZ(),"half length in Z");
343 AddText(pt,"fOrigin[0]",(box->GetOrigin())[0],"box origin on X");
344 AddText(pt,"fOrigin[1]",(box->GetOrigin())[1],"box origin on Y");
345 AddText(pt,"fOrigin[2]",(box->GetOrigin())[2],"box origin on Z");
346 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
347 pt->AddText("Execute: box(iaxis, ndiv, start, step) to divide this.");
348 pt->AddText("----- IAXIS can be 1, 2 or 3 (X, Y, Z)");
349 pt->AddText("----- NDIV must be a positive integer");
350 pt->AddText("----- START must be a valid axis offset within shape range on divided axis");
351 pt->AddText("----- STEP is the division step. START+NDIV*STEP must be in range also");
352 pt->AddText("----- If START and STEP are omitted, all range of the axis will be divided");
353 pt->AddText(" ");
354 pt->SetTextSize(0.044);
355 pt->SetAllWith("-----","color",2);
356 pt->SetAllWith("-----","font",72);
357 pt->SetAllWith("-----","size",0.04);
358 pt->SetAllWith("Execute","color",4);
359 pt->SetTextAlign(12);
360 pt->Draw();
361// SavePicture("box",c,vol,iaxis,step);
362 c->cd(1);
363 gROOT->SetInterrupt(kTRUE);
364}
365
366//______________________________________________________________________________
367void para(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
368{
369 gROOT->GetListOfCanvases()->Delete();
370 TCanvas *c = new TCanvas("para shape", "A parallelepiped", 700,1000);
371 if (comments) {
372 c->Divide(1,2,0,0);
373 c->cd(2);
374 gPad->SetPad(0,0,1,0.4);
375 c->cd(1);
376 gPad->SetPad(0,0.4,1,1);
377 }
378 if (gGeoManager) delete gGeoManager;
379 new TGeoManager("para", "poza1");
380 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
381 TGeoMedium *med = new TGeoMedium("MED",1,mat);
382 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
384 TGeoVolume *vol = gGeoManager->MakePara("PARA",med, 20,30,40,30,15,30);
385 vol->SetLineColor(randomColor());
386 vol->SetLineWidth(2);
387 top->AddNode(vol,1);
388 if (iaxis) {
389 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
390 if (!slice) return;
391 slice->SetLineColor(randomColor());
392 }
395 top->Draw();
396 MakePicture();
397 if (!comments) return;
398 c->cd(2);
399 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
400 pt->SetLineColor(1);
401 TGeoPara *para = (TGeoPara*)(vol->GetShape());
402 TText *text = pt->AddText("TGeoPara - parallelepiped class");
403 text->SetTextColor(2);
404 AddText(pt,"fX",para->GetX(),"half length in X");
405 AddText(pt,"fY",para->GetY(),"half length in Y");
406 AddText(pt,"fZ",para->GetZ(),"half length in Z");
407 AddText(pt,"fAlpha",para->GetAlpha(),"angle about Y of the Z bases");
408 AddText(pt,"fTheta",para->GetTheta(),"inclination of para axis about Z");
409 AddText(pt,"fPhi",para->GetPhi(),"phi angle of para axis");
410 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
411 pt->AddText("Execute: para(iaxis, ndiv, start, step) to divide this.");
412 pt->AddText("----- IAXIS can be 1, 2 or 3 (X, Y, Z)");
413 pt->AddText("----- NDIV must be a positive integer");
414 pt->AddText("----- START must be a valid axis offset within shape range on divided axis");
415 pt->AddText("----- STEP is the division step. START+NDIV*STEP must be in range also");
416 pt->AddText("----- If START and STEP are omitted, all range of the axis will be divided");
417 pt->AddText(" ");
418 pt->SetTextSize(0.044);
419 pt->SetAllWith("-----","color",2);
420 pt->SetAllWith("-----","font",72);
421 pt->SetAllWith("-----","size",0.04);
422 pt->SetAllWith("Execute","color",4);
423 pt->SetTextAlign(12);
424 pt->Draw();
425 c->cd(1);
426// SavePicture("para",c,vol,iaxis,step);
427}
428
429//______________________________________________________________________________
430void tube(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
431{
432 gROOT->GetListOfCanvases()->Delete();
433 if (iaxis<0 || iaxis>3) {
434 printf("Wrong division axis. Range is 1-3.\n");
435 return;
436 }
437 TCanvas *c = new TCanvas("tube shape", "A tube", 700,1000);
438 if (comments) {
439 c->Divide(1,2,0,0);
440 c->cd(2);
441 gPad->SetPad(0,0,1,0.4);
442 c->cd(1);
443 gPad->SetPad(0,0.4,1,1);
444 }
445 if (gGeoManager) delete gGeoManager;
446 new TGeoManager("tube", "poza2");
447 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
448 TGeoMedium *med = new TGeoMedium("MED",1,mat);
449 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
451 TGeoVolume *vol = gGeoManager->MakeTube("TUBE",med, 20,30,40);
452 vol->SetLineColor(randomColor());
453 vol->SetLineWidth(2);
454 top->AddNode(vol,1);
455 if (iaxis) {
456 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
457 if (!slice) return;
458 slice->SetLineColor(randomColor());
459 }
461// gGeoManager->SetNsegments(40);
463 top->Draw();
464 MakePicture();
465 if (!comments) return;
466 c->cd(2);
467 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
468 pt->SetLineColor(1);
469 TGeoTube *tube = (TGeoTube*)(vol->GetShape());
470 TText *text = pt->AddText("TGeoTube - tube class");
471 text->SetTextColor(2);
472 AddText(pt,"fRmin",tube->GetRmin(),"minimum radius");
473 AddText(pt,"fRmax",tube->GetRmax(),"maximum radius");
474 AddText(pt,"fDZ", tube->GetDZ(), "half length in Z");
475 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
476 pt->AddText("Execute: tube(iaxis, ndiv, start, step) to divide this.");
477 pt->AddText("----- IAXIS can be 1, 2 or 3 (Rxy, Phi, Z)");
478 pt->AddText("----- NDIV must be a positive integer");
479 pt->AddText("----- START must be a valid axis offset within shape range on divided axis");
480 pt->AddText("----- STEP is the division step. START+NDIV*STEP must be in range also");
481 pt->AddText("----- If START and STEP are omitted, all range of the axis will be divided");
482 pt->AddText(" ");
483 pt->SetAllWith("-----","color",2);
484 pt->SetAllWith("-----","font",72);
485 pt->SetAllWith("-----","size",0.04);
486 pt->SetAllWith("Execute","color",4);
487 pt->SetTextAlign(12);
488 pt->SetTextSize(0.044);
489 pt->Draw();
490 c->cd(1);
491// SavePicture("tube",c,vol,iaxis,step);
492}
493
494//______________________________________________________________________________
495void tubeseg(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
496{
497 gROOT->GetListOfCanvases()->Delete();
498 if (iaxis<0 || iaxis>3) {
499 printf("Wrong division axis. Range is 1-3.\n");
500 return;
501 }
502 TCanvas *c = new TCanvas("tubeseg shape", "A tube segment ", 700,1000);
503 if (comments) {
504 c->Divide(1,2,0,0);
505 c->cd(2);
506 gPad->SetPad(0,0,1,0.4);
507 c->cd(1);
508 gPad->SetPad(0,0.4,1,1);
509 }
510 if (gGeoManager) delete gGeoManager;
511 new TGeoManager("tubeseg", "poza3");
512 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
513 TGeoMedium *med = new TGeoMedium("MED",1,mat);
514 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
516 TGeoVolume *vol = gGeoManager->MakeTubs("TUBESEG",med, 20,30,40,-30,270);
517 vol->SetLineColor(randomColor());
518 if (iaxis) {
519 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
520 if (!slice) return;
521 slice->SetLineColor(randomColor());
522 }
523 vol->SetLineWidth(2);
524 top->AddNode(vol,1);
526// gGeoManager->SetNsegments(40);
528 top->Draw();
529 MakePicture();
530 if (!comments) return;
531 c->cd(2);
532 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
533 pt->SetLineColor(1);
534 TGeoTubeSeg *tubeseg = (TGeoTubeSeg*)(vol->GetShape());
535 TText *text = pt->AddText("TGeoTubeSeg - tube segment class");
536 text->SetTextColor(2);
537 AddText(pt,"fRmin",tubeseg->GetRmin(),"minimum radius");
538 AddText(pt,"fRmax",tubeseg->GetRmax(),"maximum radius");
539 AddText(pt,"fDZ", tubeseg->GetDZ(), "half length in Z");
540 AddText(pt,"fPhi1",tubeseg->GetPhi1(),"first phi limit");
541 AddText(pt,"fPhi2",tubeseg->GetPhi2(),"second phi limit");
542 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
543 pt->AddText("Execute: tubeseg(iaxis, ndiv, start, step) to divide this.");
544 pt->AddText("----- IAXIS can be 1, 2 or 3 (Rxy, Phi, Z)");
545 pt->AddText("----- NDIV must be a positive integer");
546 pt->AddText("----- START must be a valid axis offset within shape range on divided axis");
547 pt->AddText("----- STEP is the division step. START+NDIV*STEP must be in range also");
548 pt->AddText("----- If START and STEP are omitted, all range of the axis will be divided");
549 pt->AddText(" ");
550 pt->SetAllWith("-----","color",2);
551 pt->SetAllWith("-----","font",72);
552 pt->SetAllWith("-----","size",0.04);
553 pt->SetAllWith("Execute","color",4);
554 pt->SetTextAlign(12);
555 pt->SetTextSize(0.044);
556 pt->Draw();
557 c->cd(1);
558// SavePicture("tubeseg",c,vol,iaxis,step);
559}
560
561//______________________________________________________________________________
562void ctub(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
563{
564 gROOT->GetListOfCanvases()->Delete();
565 if (iaxis<0 || iaxis>2) {
566 printf("Wrong division axis. Range is 1-2.\n");
567 return;
568 }
569 TCanvas *c = new TCanvas("ctub shape", "A cut tube segment ", 700,1000);
570 if (comments) {
571 c->Divide(1,2,0,0);
572 c->cd(2);
573 gPad->SetPad(0,0,1,0.4);
574 c->cd(1);
575 gPad->SetPad(0,0.4,1,1);
576 }
577 if (gGeoManager) delete gGeoManager;
578 new TGeoManager("ctub", "poza3");
579 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
580 TGeoMedium *med = new TGeoMedium("MED",1,mat);
581 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
583 Double_t theta = 160.*TMath::Pi()/180.;
584 Double_t phi = 30.*TMath::Pi()/180.;
585 Double_t nlow[3];
586 nlow[0] = TMath::Sin(theta)*TMath::Cos(phi);
587 nlow[1] = TMath::Sin(theta)*TMath::Sin(phi);
588 nlow[2] = TMath::Cos(theta);
589 theta = 20.*TMath::Pi()/180.;
590 phi = 60.*TMath::Pi()/180.;
591 Double_t nhi[3];
592 nhi[0] = TMath::Sin(theta)*TMath::Cos(phi);
593 nhi[1] = TMath::Sin(theta)*TMath::Sin(phi);
594 nhi[2] = TMath::Cos(theta);
595 TGeoVolume *vol = gGeoManager->MakeCtub("CTUB",med, 20,30,40,-30,250, nlow[0], nlow[1], nlow[2], nhi[0],nhi[1],nhi[2]);
596 vol->SetLineColor(randomColor());
597 if (iaxis) {
598 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
599 if (!slice) return;
600 slice->SetLineColor(randomColor());
601 }
602 vol->SetLineWidth(2);
603 top->AddNode(vol,1);
605// gGeoManager->SetNsegments(40);
607 top->Draw();
608 MakePicture();
609 if (!comments) return;
610 c->cd(2);
611 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
612 pt->SetLineColor(1);
613 TGeoTubeSeg *tubeseg = (TGeoTubeSeg*)(vol->GetShape());
614 TText *text = pt->AddText("TGeoTubeSeg - tube segment class");
615 text->SetTextColor(2);
616 AddText(pt,"fRmin",tubeseg->GetRmin(),"minimum radius");
617 AddText(pt,"fRmax",tubeseg->GetRmax(),"maximum radius");
618 AddText(pt,"fDZ", tubeseg->GetDZ(), "half length in Z");
619 AddText(pt,"fPhi1",tubeseg->GetPhi1(),"first phi limit");
620 AddText(pt,"fPhi2",tubeseg->GetPhi2(),"second phi limit");
621 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
622 pt->AddText(" ");
623 pt->SetTextAlign(12);
624 pt->SetTextSize(0.044);
625 pt->Draw();
626 c->cd(1);
627// SavePicture("tubeseg",c,vol,iaxis,step);
628}
629
630//______________________________________________________________________________
631void cone(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
632{
633 gROOT->GetListOfCanvases()->Delete();
634 if (iaxis<0 || iaxis>3) {
635 printf("Wrong division axis. Range is 1-3.\n");
636 return;
637 }
638 if (iaxis==1) {
639 printf("cannot divide cone on Rxy\n");
640 return;
641 }
642 TCanvas *c = new TCanvas("cone shape", "A cone", 700,1000);
643 if (comments) {
644 c->Divide(1,2,0,0);
645 c->cd(2);
646 gPad->SetPad(0,0,1,0.4);
647 c->cd(1);
648 gPad->SetPad(0,0.4,1,1);
649 }
650 if (gGeoManager) delete gGeoManager;
651 new TGeoManager("cone", "poza4");
652 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
653 TGeoMedium *med = new TGeoMedium("MED",1,mat);
654 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
656 TGeoVolume *vol = gGeoManager->MakeCone("CONE",med, 40,10,20,35,45);
657 vol->SetLineColor(randomColor());
658 vol->SetLineWidth(2);
659 if (iaxis) {
660 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
661 if (!slice) return;
662 slice->SetLineColor(randomColor());
663 }
664 top->AddNode(vol,1);
667 top->Draw();
668 MakePicture();
669 if (!comments) return;
670 c->cd(2);
671 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
672 pt->SetLineColor(1);
673 TGeoCone *cone = (TGeoCone*)(vol->GetShape());
674 TText *text = pt->AddText("TGeoCone - cone class");
675 text->SetTextColor(2);
676 AddText(pt,"fDZ", cone->GetDZ(), "half length in Z");
677 AddText(pt,"fRmin1",cone->GetRmin1(),"inner radius at -dz");
678 AddText(pt,"fRmax1",cone->GetRmax1(),"outer radius at -dz");
679 AddText(pt,"fRmin2",cone->GetRmin2(),"inner radius at +dz");
680 AddText(pt,"fRmax2",cone->GetRmax2(),"outer radius at +dz");
681 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
682 pt->AddText("Execute: cone(iaxis, ndiv, start, step) to divide this.");
683 pt->AddText("----- IAXIS can be 2 or 3 (Phi, Z)");
684 pt->AddText("----- NDIV must be a positive integer");
685 pt->AddText("----- START must be a valid axis offset within shape range on divided axis");
686 pt->AddText("----- STEP is the division step. START+NDIV*STEP must be in range also");
687 pt->AddText("----- If START and STEP are omitted, all range of the axis will be divided");
688 pt->AddText(" ");
689 pt->SetAllWith("-----","color",2);
690 pt->SetAllWith("-----","font",72);
691 pt->SetAllWith("-----","size",0.04);
692 pt->SetAllWith("Execute","color",4);
693 pt->SetTextAlign(12);
694 pt->SetTextSize(0.044);
695 pt->Draw();
696 c->cd(1);
697// SavePicture("cone",c,vol,iaxis,step);
698}
699
700//______________________________________________________________________________
701void coneseg(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
702{
703 gROOT->GetListOfCanvases()->Delete();
704 if (iaxis<0 || iaxis>3) {
705 printf("Wrong division axis. Range is 1-3.\n");
706 return;
707 }
708 TCanvas *c = new TCanvas("coneseg shape", "A cone segment", 700,1000);
709 if (comments) {
710 c->Divide(1,2,0,0);
711 c->cd(2);
712 gPad->SetPad(0,0,1,0.4);
713 c->cd(1);
714 gPad->SetPad(0,0.4,1,1);
715 }
716 if (gGeoManager) delete gGeoManager;
717 new TGeoManager("coneseg", "poza5");
718 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
719 TGeoMedium *med = new TGeoMedium("MED",1,mat);
720 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
722 TGeoVolume *vol = gGeoManager->MakeCons("CONESEG",med, 40,30,40,10,20,-30,250);
723 vol->SetLineColor(randomColor());
724// vol->SetLineWidth(2);
725 top->AddNode(vol,1);
726 if (iaxis) {
727 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
728 if (!slice) return;
729 slice->SetLineColor(randomColor());
730 }
733 top->Draw();
734 MakePicture();
735 if (!comments) return;
736 c->cd(2);
737 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
738 pt->SetLineColor(1);
739 TGeoConeSeg *coneseg = (TGeoConeSeg*)(vol->GetShape());
740 TText *text = pt->AddText("TGeoConeSeg - coneseg class");
741 text->SetTextColor(2);
742 AddText(pt,"fDZ", coneseg->GetDZ(), "half length in Z");
743 AddText(pt,"fRmin1",coneseg->GetRmin1(),"inner radius at -dz");
744 AddText(pt,"fRmax1",coneseg->GetRmax1(),"outer radius at -dz");
745 AddText(pt,"fRmin2",coneseg->GetRmin1(),"inner radius at +dz");
746 AddText(pt,"fRmax2",coneseg->GetRmax1(),"outer radius at +dz");
747 AddText(pt,"fPhi1",coneseg->GetPhi1(),"first phi limit");
748 AddText(pt,"fPhi2",coneseg->GetPhi2(),"second phi limit");
749 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
750 pt->AddText("Execute: coneseg(iaxis, ndiv, start, step) to divide this.");
751 pt->AddText("----- IAXIS can be 2 or 3 (Phi, Z)");
752 pt->AddText("----- NDIV must be a positive integer");
753 pt->AddText("----- START must be a valid axis offset within shape range on divided axis");
754 pt->AddText("----- STEP is the division step. START+NDIV*STEP must be in range also");
755 pt->AddText("----- If START and STEP are omitted, all range of the axis will be divided");
756 pt->AddText(" ");
757 pt->SetAllWith("-----","color",2);
758 pt->SetAllWith("-----","font",72);
759 pt->SetAllWith("-----","size",0.04);
760 pt->SetAllWith("Execute","color",4);
761 pt->SetTextAlign(12);
762 pt->SetTextSize(0.044);
763 pt->Draw();
764 c->cd(1);
765// SavePicture("coneseg",c,vol,iaxis,step);
766}
767
768//______________________________________________________________________________
769void eltu(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
770{
771 gROOT->GetListOfCanvases()->Delete();
772 TCanvas *c = new TCanvas("eltu shape", "An Elliptical tube", 700,1000);
773 if (comments) {
774 c->Divide(1,2,0,0);
775 c->cd(2);
776 gPad->SetPad(0,0,1,0.4);
777 c->cd(1);
778 gPad->SetPad(0,0.4,1,1);
779 }
780 if (gGeoManager) delete gGeoManager;
781 new TGeoManager("eltu", "poza6");
782 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
783 TGeoMedium *med = new TGeoMedium("MED",1,mat);
784 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
786 TGeoVolume *vol = gGeoManager->MakeEltu("ELTU",med, 30,10,40);
787 vol->SetLineColor(randomColor());
788// vol->SetLineWidth(2);
789 top->AddNode(vol,1);
790 if (iaxis) {
791 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
792 if (!slice) return;
793 slice->SetLineColor(randomColor());
794 }
797 top->Draw();
798 MakePicture();
799 if (!comments) return;
800 c->cd(2);
801 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
802 pt->SetLineColor(1);
803 TGeoEltu *eltu = (TGeoEltu*)(vol->GetShape());
804 TText *text = pt->AddText("TGeoEltu - eltu class");
805 text->SetTextColor(2);
806 AddText(pt,"fA",eltu->GetA(), "semi-axis along x");
807 AddText(pt,"fB",eltu->GetB(), "semi-axis along y");
808 AddText(pt,"fDZ", eltu->GetDZ(), "half length in Z");
809 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
810 pt->AddText("Execute: eltu(iaxis, ndiv, start, step) to divide this.");
811 pt->AddText("----- IAXIS can be 2 or 3 (Phi, Z)");
812 pt->AddText("----- NDIV must be a positive integer");
813 pt->AddText("----- START must be a valid axis offset within shape range on divided axis");
814 pt->AddText("----- STEP is the division step. START+NDIV*STEP must be in range also");
815 pt->AddText("----- If START and STEP are omitted, all range of the axis will be divided");
816 pt->AddText(" ");
817 pt->SetAllWith("-----","color",2);
818 pt->SetAllWith("-----","font",72);
819 pt->SetAllWith("-----","size",0.04);
820 pt->SetAllWith("Execute","color",4);
821 pt->SetTextAlign(12);
822 pt->SetTextSize(0.044);
823 pt->Draw();
824 c->cd(1);
825// SavePicture("eltu",c,vol,iaxis,step);
826}
827
828//______________________________________________________________________________
829void sphere(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
830{
831 gROOT->GetListOfCanvases()->Delete();
832 if (iaxis!=0) {
833 printf("Cannot divide spheres\n");
834 return;
835 }
836 TCanvas *c = new TCanvas("Sphere shap", "A spherical sector", 700,1000);
837 if (comments) {
838 c->Divide(1,2,0,0);
839 c->cd(2);
840 gPad->SetPad(0,0,1,0.4);
841 c->cd(1);
842 gPad->SetPad(0,0.4,1,1);
843 }
844 if (gGeoManager) delete gGeoManager;
845 new TGeoManager("sphere", "poza7");
846 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
847 TGeoMedium *med = new TGeoMedium("MED",1,mat);
848 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
850 TGeoVolume *vol = gGeoManager->MakeSphere("SPHERE",med, 30,40,60,120,30,240);
851 vol->SetLineColor(randomColor());
852 vol->SetLineWidth(2);
853 top->AddNode(vol,1);
854 if (iaxis) {
855 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
856 if (!slice) return;
857 slice->SetLineColor(randomColor());
858 }
861 top->Draw();
862 MakePicture();
863 if (!comments) return;
864 c->cd(2);
865 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
866 pt->SetLineColor(1);
867 TGeoSphere *sphere = (TGeoSphere*)(vol->GetShape());
868 TText *text = pt->AddText("TGeoSphere- sphere class");
869 text->SetTextColor(2);
870 AddText(pt,"fRmin",sphere->GetRmin(),"inner radius");
871 AddText(pt,"fRmax",sphere->GetRmax(),"outer radius");
872 AddText(pt,"fTheta1",sphere->GetTheta1(),"lower theta limit");
873 AddText(pt,"fTheta2",sphere->GetTheta2(),"higher theta limit");
874 AddText(pt,"fPhi1",sphere->GetPhi1(),"lower phi limit");
875 AddText(pt,"fPhi2",sphere->GetPhi2(),"higher phi limit");
876 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
877 pt->AddText(" ");
878 pt->SetTextSize(0.044);
879 pt->Draw();
880 c->cd(1);
881// SavePicture("sphere",c,vol,iaxis,step);
882}
883
884//______________________________________________________________________________
885void torus(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
886{
887 gROOT->GetListOfCanvases()->Delete();
888 if (iaxis!=0) {
889 printf("Cannot divide a torus\n");
890 return;
891 }
892 TCanvas *c = new TCanvas("torus shape", "A toroidal segment", 700,1000);
893 if (comments) {
894 c->Divide(1,2,0,0);
895 c->cd(2);
896 gPad->SetPad(0,0,1,0.4);
897 c->cd(1);
898 gPad->SetPad(0,0.4,1,1);
899 }
900 if (gGeoManager) delete gGeoManager;
901 new TGeoManager("torus", "poza2");
902 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
903 TGeoMedium *med = new TGeoMedium("MED",1,mat);
904 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
906 TGeoVolume *vol = gGeoManager->MakeTorus("TORUS",med, 40,20,25,0,270);
907 vol->SetLineColor(randomColor());
908 top->AddNode(vol,1);
909 if (iaxis) {
910 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
911 if (!slice) return;
912 slice->SetLineColor(2);
913 }
916 top->Draw();
917 MakePicture();
918 if (!comments) return;
919 c->cd(2);
920 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
921 pt->SetLineColor(1);
922 TGeoTorus *tor = (TGeoTorus*)(vol->GetShape());
923 TText *text = pt->AddText("TGeoTorus - torus class");
924 text->SetTextColor(2);
925 AddText(pt,"fR",tor->GetR(),"radius of the ring");
926 AddText(pt,"fRmin",tor->GetRmin(),"minimum radius");
927 AddText(pt,"fRmax",tor->GetRmax(),"maximum radius");
928 AddText(pt,"fPhi1", tor->GetPhi1(), "starting phi angle");
929 AddText(pt,"fDphi", tor->GetDphi(), "phi range");
930 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
931 pt->AddText(" ");
932 pt->SetTextSize(0.044);
933 pt->Draw();
934 c->cd(1);
935}
936
937//______________________________________________________________________________
938void trd1(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
939{
940 gROOT->GetListOfCanvases()->Delete();
941 if (iaxis<0 || iaxis>3) {
942 printf("Wrong division axis. Range is 1-3.\n");
943 return;
944 }
945 if (iaxis==1) {
946 printf("Cannot divide trd1 on X axis\n");
947 return;
948 }
949
950 TCanvas *c = new TCanvas("trd1 shape", "A trapezoid with dX varying", 700,1000);
951 if (comments) {
952 c->Divide(1,2,0,0);
953 c->cd(2);
954 gPad->SetPad(0,0,1,0.4);
955 c->cd(1);
956 gPad->SetPad(0,0.4,1,1);
957 }
958 if (gGeoManager) delete gGeoManager;
959 new TGeoManager("trd1", "poza8");
960 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
961 TGeoMedium *med = new TGeoMedium("MED",1,mat);
962 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
964 TGeoVolume *vol = gGeoManager->MakeTrd1("Trd1",med, 10,20,30,40);
965 vol->SetLineColor(randomColor());
966 vol->SetLineWidth(2);
967 top->AddNode(vol,1);
968 if (iaxis) {
969 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
970 if (!slice) return;
971 slice->SetLineColor(randomColor());
972 }
975 top->Draw();
976 MakePicture();
977 if (!comments) return;
978 c->cd(2);
979 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
980 pt->SetLineColor(1);
981 TGeoTrd1 *trd1 = (TGeoTrd1*)(vol->GetShape());
982 TText *text = pt->AddText("TGeoTrd1 - Trd1 class");
983 text->SetTextColor(2);
984 AddText(pt,"fDx1",trd1->GetDx1(),"half length in X at lower Z surface(-dz)");
985 AddText(pt,"fDx2",trd1->GetDx2(),"half length in X at higher Z surface(+dz)");
986 AddText(pt,"fDy",trd1->GetDy(),"half length in Y");
987 AddText(pt,"fDz",trd1->GetDz(),"half length in Z");
988 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
989 pt->AddText("Execute: trd1(iaxis, ndiv, start, step) to divide this.");
990 pt->AddText("----- IAXIS can be 2 or 3 (Y, Z)");
991 pt->AddText("----- NDIV must be a positive integer");
992 pt->AddText("----- START must be a valid axis offset within shape range on divided axis");
993 pt->AddText("----- STEP is the division step. START+NDIV*STEP must be in range also");
994 pt->AddText("----- If START and STEP are omitted, all range of the axis will be divided");
995 pt->AddText(" ");
996 pt->SetAllWith("-----","color",2);
997 pt->SetAllWith("-----","font",72);
998 pt->SetAllWith("-----","size",0.04);
999 pt->SetAllWith("Execute","color",4);
1000 pt->SetTextAlign(12);
1001 pt->SetTextSize(0.044);
1002 pt->Draw();
1003 c->cd(1);
1004// SavePicture("trd1",c,vol,iaxis,step);
1005}
1006
1007//______________________________________________________________________________
1008void parab()
1009{
1010 gROOT->GetListOfCanvases()->Delete();
1011 TCanvas *c = new TCanvas("parab shape", "A paraboloid segment", 700,1000);
1012 if (comments) {
1013 c->Divide(1,2,0,0);
1014 c->cd(2);
1015 gPad->SetPad(0,0,1,0.4);
1016 c->cd(1);
1017 gPad->SetPad(0,0.4,1,1);
1018 }
1019 if (gGeoManager) delete gGeoManager;
1020 new TGeoManager("parab", "paraboloid");
1021 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
1022 TGeoMedium *med = new TGeoMedium("MED",1,mat);
1023 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
1025 TGeoVolume *vol = gGeoManager->MakeParaboloid("PARAB",med,0, 40, 50);
1026 TGeoParaboloid *par = (TGeoParaboloid*)vol->GetShape();
1027 vol->SetLineColor(randomColor());
1028 vol->SetLineWidth(2);
1029 top->AddNode(vol,1);
1032 top->Draw();
1033 MakePicture();
1034 if (!comments) return;
1035 c->cd(2);
1036 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
1037 pt->SetLineColor(1);
1038 TText *text = pt->AddText("TGeoParaboloid - Paraboloid class");
1039 text->SetTextColor(2);
1040 AddText(pt,"fRlo",par->GetRlo(),"radius at Z=-dz");
1041 AddText(pt,"fRhi",par->GetRhi(),"radius at Z=+dz");
1042 AddText(pt,"fDz",par->GetDz(),"half-length on Z axis");
1043 pt->AddText("----- A paraboloid is described by the equation:");
1044 pt->AddText("----- z = a*r*r + b; where: r = x*x + y*y");
1045 pt->AddText("----- Create with: TGeoParaboloid *parab = new TGeoParaboloid(rlo, rhi, dz);");
1046 pt->AddText("----- dz: half-length in Z (range from -dz to +dz");
1047 pt->AddText("----- rlo: radius at z=-dz given by: -dz = a*rlo*rlo + b");
1048 pt->AddText("----- rhi: radius at z=+dz given by: dz = a*rhi*rhi + b");
1049 pt->AddText("----- rlo != rhi; both >= 0");
1050 pt->AddText(" ");
1051 pt->SetAllWith("-----","color",2);
1052 pt->SetAllWith("-----","font",72);
1053 pt->SetAllWith("-----","size",0.04);
1054 pt->SetTextAlign(12);
1055 pt->SetTextSize(0.044);
1056 pt->Draw();
1057 c->cd(1);
1058}
1059
1060//______________________________________________________________________________
1061void hype()
1062{
1063 gROOT->GetListOfCanvases()->Delete();
1064 TCanvas *c = new TCanvas("hype shape", "A hyperboloid", 700,1000);
1065 if (comments) {
1066 c->Divide(1,2,0,0);
1067 c->cd(2);
1068 gPad->SetPad(0,0,1,0.4);
1069 c->cd(1);
1070 gPad->SetPad(0,0.4,1,1);
1071 }
1072 if (gGeoManager) delete gGeoManager;
1073 new TGeoManager("hype", "hyperboloid");
1074 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
1075 TGeoMedium *med = new TGeoMedium("MED",1,mat);
1076 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
1078 TGeoVolume *vol = gGeoManager->MakeHype("HYPE",med,10, 45 ,20,45,40);
1079 TGeoHype *hype = (TGeoHype*)vol->GetShape();
1080 vol->SetLineColor(randomColor());
1081 vol->SetLineWidth(2);
1082 top->AddNode(vol,1);
1085 top->Draw();
1086 MakePicture();
1087 if (!comments) return;
1088 c->cd(2);
1089 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
1090 pt->SetLineColor(1);
1091 TText *text = pt->AddText("TGeoHype - Hyperboloid class");
1092 text->SetTextColor(2);
1093 AddText(pt,"fRmin",hype->GetRmin(),"minimum inner radius");
1094 AddText(pt,"fStIn",hype->GetStIn(),"inner surface stereo angle [deg]");
1095 AddText(pt,"fRmax",hype->GetRmax(),"minimum outer radius");
1096 AddText(pt,"fStOut",hype->GetStOut(),"outer surface stereo angle [deg]");
1097 AddText(pt,"fDz",hype->GetDz(),"half-length on Z axis");
1098 pt->AddText("----- A hyperboloid is described by the equation:");
1099 pt->AddText("----- r^2 - (tan(stereo)*z)^2 = rmin^2; where: r = x*x + y*y");
1100 pt->AddText("----- Create with: TGeoHype *hype = new TGeoHype(rin, stin, rout, stout, dz);");
1101 pt->AddText("----- rin < rout; rout > 0");
1102 pt->AddText("----- rin = 0; stin > 0 => inner surface conical");
1103 pt->AddText("----- stin/stout = 0 => corresponding surface cylindrical");
1104 pt->AddText(" ");
1105 pt->SetAllWith("-----","color",2);
1106 pt->SetAllWith("-----","font",72);
1107 pt->SetAllWith("-----","size",0.04);
1108 pt->SetTextAlign(12);
1109 pt->SetTextSize(0.044);
1110 pt->Draw();
1111 c->cd(1);
1112}
1113//______________________________________________________________________________
1114void pcon(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
1115{
1116 gROOT->GetListOfCanvases()->Delete();
1117 if (iaxis<0 || iaxis>3) {
1118 printf("Wrong division axis. Range is 1-3.\n");
1119 return;
1120 }
1121 if (iaxis==1) {
1122 printf("Cannot divide pcon on Rxy\n");
1123 return;
1124 }
1125 TCanvas *c = new TCanvas("pcon shape", "A polycone", 700,1000);
1126 if (comments) {
1127 c->Divide(1,2,0,0);
1128 c->cd(2);
1129 gPad->SetPad(0,0,1,0.4);
1130 c->cd(1);
1131 gPad->SetPad(0,0.4,1,1);
1132 }
1133 if (gGeoManager) delete gGeoManager;
1134 new TGeoManager("pcon", "poza10");
1135 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
1136 TGeoMedium *med = new TGeoMedium("MED",1,mat);
1137 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
1139 TGeoVolume *vol = gGeoManager->MakePcon("PCON",med, -30.0,300,4);
1140 TGeoPcon *pcon = (TGeoPcon*)(vol->GetShape());
1141 pcon->DefineSection(0,0,15,20);
1142 pcon->DefineSection(1,20,15,20);
1143 pcon->DefineSection(2,20,15,25);
1144 pcon->DefineSection(3,50,15,20);
1145 vol->SetLineColor(randomColor());
1146 vol->SetLineWidth(2);
1147 top->AddNode(vol,1);
1148 if (iaxis) {
1149 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
1150 if (!slice) return;
1151 slice->SetLineColor(randomColor());
1152 }
1155 top->Draw();
1156 MakePicture();
1157 if (!comments) return;
1158 c->cd(2);
1159 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
1160 pt->SetLineColor(1);
1161 TText *text = pt->AddText("TGeoPcon - pcon class");
1162 text->SetTextColor(2);
1163 AddText(pt,"fPhi1",pcon->GetPhi1(),"lower phi limit");
1164 AddText(pt,"fDphi",pcon->GetDphi(),"phi range");
1165 AddText(pt,"fNz",pcon->GetNz(),"number of z planes");
1166 for (Int_t j=0; j<pcon->GetNz(); j++) {
1167 char line[128];
1168 sprintf(line, "fZ[%i]=%5.2f fRmin[%i]=%5.2f fRmax[%i]=%5.2f",
1169 j,pcon->GetZ()[j],j,pcon->GetRmin()[j],j,pcon->GetRmax()[j]);
1170 text = pt->AddText(line);
1171 text->SetTextColor(4);
1172 text->SetTextAlign(12);
1173 }
1174 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
1175 pt->AddText("Execute: pcon(iaxis, ndiv, start, step) to divide this.");
1176 pt->AddText("----- IAXIS can be 2 or 3 (Phi, Z)");
1177 pt->AddText("----- NDIV must be a positive integer");
1178 pt->AddText("----- START must be a valid axis offset within shape range on divided axis");
1179 pt->AddText("----- STEP is the division step. START+NDIV*STEP must be in range also");
1180 pt->AddText("----- If START and STEP are omitted, all range of the axis will be divided");
1181 pt->AddText(" ");
1182 pt->SetAllWith("-----","color",2);
1183 pt->SetAllWith("-----","font",72);
1184 pt->SetAllWith("-----","size",0.04);
1185 pt->SetAllWith("Execute","color",4);
1186 pt->SetTextAlign(12);
1187 pt->SetTextSize(0.044);
1188 pt->Draw();
1189 c->cd(1);
1190// SavePicture("pcon",c,vol,iaxis,step);
1191}
1192
1193//______________________________________________________________________________
1194void pgon(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
1195{
1196 gROOT->GetListOfCanvases()->Delete();
1197 if (iaxis<0 || iaxis>3) {
1198 printf("Wrong division axis. Range is 1-3.\n");
1199 return;
1200 }
1201 if (iaxis==1) {
1202 printf("Cannot divide pgon on Rxy\n");
1203 return;
1204 }
1205 TCanvas *c = new TCanvas("pgon shape", "A polygone", 700,1000);
1206 if (comments) {
1207 c->Divide(1,2,0,0);
1208 c->cd(2);
1209 gPad->SetPad(0,0,1,0.4);
1210 c->cd(1);
1211 gPad->SetPad(0,0.4,1,1);
1212 }
1213 if (gGeoManager) delete gGeoManager;
1214 new TGeoManager("pgon", "poza11");
1215 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
1216 TGeoMedium *med = new TGeoMedium("MED",1,mat);
1217 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,150,150,100);
1219 TGeoVolume *vol = gGeoManager->MakePgon("PGON",med, -45.0,270.0,4,4);
1220 TGeoPgon *pgon = (TGeoPgon*)(vol->GetShape());
1221 pgon->DefineSection(0,-70,45,50);
1222 pgon->DefineSection(1,0,35,40);
1223 pgon->DefineSection(2,0,30,35);
1224 pgon->DefineSection(3,70,90,100);
1225 vol->SetLineColor(randomColor());
1226 vol->SetLineWidth(2);
1227 top->AddNode(vol,1);
1228 if (iaxis) {
1229 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
1230 if (!slice) return;
1231 slice->SetLineColor(randomColor());
1232 }
1235 top->Draw();
1236 MakePicture();
1237 if (!comments) return;
1238 c->cd(2);
1239 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
1240 pt->SetLineColor(1);
1241 TText *text = pt->AddText("TGeoPgon - pgon class");
1242 text->SetTextColor(2);
1243 AddText(pt,"fPhi1",pgon->GetPhi1(),"lower phi limit");
1244 AddText(pt,"fDphi",pgon->GetDphi(),"phi range");
1245 AddText(pt,"fNedges",pgon->GetNedges(),"number of edges");
1246 AddText(pt,"fNz",pgon->GetNz(),"number of z planes");
1247 for (Int_t j=0; j<pgon->GetNz(); j++) {
1248 char line[128];
1249 sprintf(line, "fZ[%i]=%5.2f fRmin[%i]=%5.2f fRmax[%i]=%5.2f",
1250 j,pgon->GetZ()[j],j,pgon->GetRmin()[j],j,pgon->GetRmax()[j]);
1251 text = pt->AddText(line);
1252 text->SetTextColor(4);
1253 text->SetTextAlign(12);
1254 }
1255 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
1256 pt->AddText("Execute: pgon(iaxis, ndiv, start, step) to divide this.");
1257 pt->AddText("----- IAXIS can be 2 or 3 (Phi, Z)");
1258 pt->AddText("----- NDIV must be a positive integer");
1259 pt->AddText("----- START must be a valid axis offset within shape range on divided axis");
1260 pt->AddText("----- STEP is the division step. START+NDIV*STEP must be in range also");
1261 pt->AddText("----- If START and STEP are omitted, all range of the axis will be divided");
1262 pt->AddText(" ");
1263 pt->SetAllWith("-----","color",2);
1264 pt->SetAllWith("-----","font",72);
1265 pt->SetAllWith("-----","size",0.04);
1266 pt->SetAllWith("Execute","color",4);
1267 pt->SetTextAlign(12);
1268 pt->SetTextSize(0.044);
1269 pt->SetTextSize(0.044);
1270 pt->Draw();
1271 c->cd(1);
1272// SavePicture("pgon",c,vol,iaxis,step);
1273}
1274
1275//______________________________________________________________________________
1276void arb8(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
1277{
1278 gROOT->GetListOfCanvases()->Delete();
1279 if (iaxis!=0) {
1280 printf("Cannot divide arb8\n");
1281 return;
1282 }
1283 TCanvas *c = new TCanvas("arb8 shape", "An arbitrary polyhedron", 700,1000);
1284 if (comments) {
1285 c->Divide(1,2,0,0);
1286 c->cd(2);
1287 gPad->SetPad(0,0,1,0.4);
1288 c->cd(1);
1289 gPad->SetPad(0,0.4,1,1);
1290 }
1291 if (gGeoManager) delete gGeoManager;
1292 new TGeoManager("arb8", "poza12");
1293 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
1294 TGeoMedium *med = new TGeoMedium("MED",1,mat);
1295 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
1297 TGeoArb8 *arb = new TGeoArb8(20);
1298 arb->SetVertex(0,-30,-25);
1299 arb->SetVertex(1,-25,25);
1300 arb->SetVertex(2,5,25);
1301 arb->SetVertex(3,25,-25);
1302 arb->SetVertex(4,-28,-23);
1303 arb->SetVertex(5,-23,27);
1304 arb->SetVertex(6,-23,27);
1305 arb->SetVertex(7,13,-27);
1306 TGeoVolume *vol = new TGeoVolume("ARB8",arb,med);
1307 vol->SetLineColor(randomColor());
1308 vol->SetLineWidth(2);
1309 top->AddNode(vol,1);
1310 if (iaxis) {
1311 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
1312 if (!slice) return;
1313 slice->SetLineColor(randomColor());
1314 }
1317 top->Draw();
1318 MakePicture();
1319 if (!comments) return;
1320 c->cd(2);
1321 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
1322 pt->SetLineColor(1);
1323 TText *text = pt->AddText("TGeoArb8 - arb8 class");
1324 text->SetTextColor(2);
1325 AddText(pt,"fDz",arb->GetDz(),"Z half length");
1326 char line[128];
1327 Double_t *vert = arb->GetVertices();
1328 text = pt->AddText("Vertices on lower Z plane:");
1329 text->SetTextColor(3);
1330 Int_t i;
1331 for (i=0; i<4; i++) {
1332 sprintf(line," fXY[%d] = (%5.2f, %5.2f)", i, vert[2*i], vert[2*i+1]);
1333 text = pt->AddText(line);
1334 text->SetTextSize(0.043);
1335 text->SetTextColor(4);
1336 }
1337 text = pt->AddText("Vertices on higher Z plane:");
1338 text->SetTextColor(3);
1339 for (i=4; i<8; i++) {
1340 sprintf(line," fXY[%d] = (%5.2f, %5.2f)", i, vert[2*i], vert[2*i+1]);
1341 text = pt->AddText(line);
1342 text->SetTextSize(0.043);
1343 text->SetTextColor(4);
1344 }
1345
1346 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
1347 pt->AddText(" ");
1348 pt->SetTextSize(0.043);
1349 pt->Draw();
1350 c->cd(1);
1351// SavePicture("arb8",c,vol,iaxis,step);
1352}
1353
1354//______________________________________________________________________________
1355void trd2(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
1356{
1357 gROOT->GetListOfCanvases()->Delete();
1358 if (iaxis && iaxis!=3) {
1359 printf("Wrong division axis. Can divide only in Z (3)\n");
1360 return;
1361 }
1362 TCanvas *c = new TCanvas("trd2 shape", "A trapezoid with dX and dY varying with Z", 700,1000);
1363 if (comments) {
1364 c->Divide(1,2,0,0);
1365 c->cd(2);
1366 gPad->SetPad(0,0,1,0.4);
1367 c->cd(1);
1368 gPad->SetPad(0,0.4,1,1);
1369 }
1370 if (gGeoManager) delete gGeoManager;
1371 new TGeoManager("trd2", "poza9");
1372 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
1373 TGeoMedium *med = new TGeoMedium("MED",1,mat);
1374 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
1376 TGeoVolume *vol = gGeoManager->MakeTrd2("Trd2",med, 10,20,30,10,40);
1377 vol->SetLineColor(randomColor());
1378 vol->SetLineWidth(2);
1379 top->AddNode(vol,1);
1380 if (iaxis) {
1381 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
1382 if (!slice) return;
1383 slice->SetLineColor(randomColor());
1384 }
1387 top->Draw();
1388 MakePicture();
1389 if (!comments) return;
1390 c->cd(2);
1391 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
1392 pt->SetLineColor(1);
1393 TGeoTrd2 *trd2 = (TGeoTrd2*)(vol->GetShape());
1394 TText *text = pt->AddText("TGeoTrd2 - Trd2 class");
1395 text->SetTextColor(2);
1396 AddText(pt,"fDx1",trd2->GetDx1(),"half length in X at lower Z surface(-dz)");
1397 AddText(pt,"fDx2",trd2->GetDx2(),"half length in X at higher Z surface(+dz)");
1398 AddText(pt,"fDy1",trd2->GetDy1(),"half length in Y at lower Z surface(-dz)");
1399 AddText(pt,"fDy2",trd2->GetDy2(),"half length in Y at higher Z surface(-dz)");
1400 AddText(pt,"fDz",trd2->GetDz(),"half length in Z");
1401 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
1402 pt->AddText("Execute: trd2(iaxis, ndiv, start, step) to divide this.");
1403 pt->AddText("----- IAXIS can be only 3 (Z)");
1404 pt->AddText("----- NDIV must be a positive integer");
1405 pt->AddText("----- START must be a valid axis offset within shape range on divided axis");
1406 pt->AddText("----- STEP is the division step. START+NDIV*STEP must be in range also");
1407 pt->AddText("----- If START and STEP are omitted, all range of the axis will be divided");
1408 pt->AddText(" ");
1409 pt->SetAllWith("-----","color",2);
1410 pt->SetAllWith("-----","font",72);
1411 pt->SetAllWith("-----","size",0.04);
1412 pt->SetAllWith("Execute","color",4);
1413 pt->SetTextAlign(12);
1414 pt->SetTextSize(0.044);
1415 pt->Draw();
1416 c->cd(1);
1417// SavePicture("trd2",c,vol,iaxis,step);
1418}
1419
1420//______________________________________________________________________________
1421void trap(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
1422{
1423 gROOT->GetListOfCanvases()->Delete();
1424 if (iaxis && iaxis!=3) {
1425 printf("Wrong division axis. Can divide only in Z (3)\n");
1426 return;
1427 }
1428 TCanvas *c = new TCanvas("trap shape", "A more general trapezoid", 700,1000);
1429 if (comments) {
1430 c->Divide(1,2,0,0);
1431 c->cd(2);
1432 gPad->SetPad(0,0,1,0.4);
1433 c->cd(1);
1434 gPad->SetPad(0,0.4,1,1);
1435 }
1436 if (gGeoManager) delete gGeoManager;
1437 new TGeoManager("trap", "poza10");
1438 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
1439 TGeoMedium *med = new TGeoMedium("MED",1,mat);
1440 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
1442 TGeoVolume *vol = gGeoManager->MakeTrap("Trap",med, 30,15,30,20,10,15,0,20,10,15,0);
1443 vol->SetLineColor(randomColor());
1444 vol->SetLineWidth(2);
1445 top->AddNode(vol,1);
1446 if (iaxis) {
1447 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
1448 if (!slice) return;
1449 slice->SetLineColor(randomColor());
1450 }
1453 top->Draw();
1454 MakePicture();
1455 if (!comments) return;
1456 c->cd(2);
1457 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
1458 pt->SetLineColor(1);
1459 TGeoTrap *trap = (TGeoTrap*)(vol->GetShape());
1460 TText *text = pt->AddText("TGeoTrap - Trapezoid class");
1461 text->SetTextColor(2);
1462 AddText(pt,"fDz",trap->GetDz(),"half length in Z");
1463 AddText(pt,"fTheta",trap->GetTheta(),"theta angle of trapezoid axis");
1464 AddText(pt,"fPhi",trap->GetPhi(),"phi angle of trapezoid axis");
1465 AddText(pt,"fH1",trap->GetH1(),"half length in y at -fDz");
1466 AddText(pt,"fAlpha1",trap->GetAlpha1(),"angle between centers of x edges and y axis at -fDz");
1467 AddText(pt,"fBl1",trap->GetBl1(),"half length in x at -dZ and y=-fH1");
1468 AddText(pt,"fTl1",trap->GetTl1(),"half length in x at -dZ and y=+fH1");
1469 AddText(pt,"fH2",trap->GetH2(),"half length in y at +fDz");
1470 AddText(pt,"fBl2",trap->GetBl2(),"half length in x at +dZ and y=-fH1");
1471 AddText(pt,"fTl2",trap->GetTl2(),"half length in x at +dZ and y=+fH1");
1472 AddText(pt,"fAlpha2",trap->GetAlpha2(),"angle between centers of x edges and y axis at +fDz");
1473 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
1474 pt->AddText("Execute: trap(iaxis, ndiv, start, step) to divide this.");
1475 pt->AddText("----- IAXIS can be only 3 (Z)");
1476 pt->AddText("----- NDIV must be a positive integer");
1477 pt->AddText("----- START must be a valid axis offset within shape range on divided axis");
1478 pt->AddText("----- STEP is the division step. START+NDIV*STEP must be in range also");
1479 pt->AddText("----- If START and STEP are omitted, all range of the axis will be divided");
1480 pt->AddText(" ");
1481 pt->SetAllWith("-----","color",2);
1482 pt->SetAllWith("-----","font",72);
1483 pt->SetAllWith("-----","size",0.04);
1484 pt->SetAllWith("Execute","color",4);
1485 pt->SetTextAlign(12);
1486 pt->SetTextSize(0.044);
1487 pt->Draw();
1488 c->cd(1);
1489// SavePicture("trap",c,vol,iaxis,step);
1490}
1491
1492//______________________________________________________________________________
1493void gtra(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
1494{
1495 gROOT->GetListOfCanvases()->Delete();
1496 if (iaxis && iaxis!=3) {
1497 printf("Wrong division axis. Can divide only in Z (3)\n");
1498 return;
1499 }
1500 TCanvas *c = new TCanvas("gtra shape", "A twisted trapezoid", 700,1000);
1501 if (comments) {
1502 c->Divide(1,2,0,0);
1503 c->cd(2);
1504 gPad->SetPad(0,0,1,0.4);
1505 c->cd(1);
1506 gPad->SetPad(0,0.4,1,1);
1507 }
1508 if (gGeoManager) delete gGeoManager;
1509 new TGeoManager("gtra", "poza11");
1510 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
1511 TGeoMedium *med = new TGeoMedium("MED",1,mat);
1512 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
1514 TGeoVolume *vol = gGeoManager->MakeGtra("Gtra",med, 30,15,30,30,20,10,15,0,20,10,15,0);
1515 vol->SetLineColor(randomColor());
1516 vol->SetLineWidth(2);
1517 top->AddNode(vol,1);
1518 if (iaxis) {
1519 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
1520 if (!slice) return;
1521 slice->SetLineColor(randomColor());
1522 }
1525 top->Draw();
1526 MakePicture();
1527 if (!comments) return;
1528 c->cd(2);
1529 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
1530 pt->SetLineColor(1);
1531 TGeoGtra *trap = (TGeoGtra*)(vol->GetShape());
1532 TText *text = pt->AddText("TGeoGtra - Twisted trapezoid class");
1533 text->SetTextColor(2);
1534 AddText(pt,"fDz",trap->GetDz(),"half length in Z");
1535 AddText(pt,"fTheta",trap->GetTheta(),"theta angle of trapezoid axis");
1536 AddText(pt,"fPhi",trap->GetPhi(),"phi angle of trapezoid axis");
1537 AddText(pt,"fTwist",trap->GetTwistAngle(), "twist angle");
1538 AddText(pt,"fH1",trap->GetH1(),"half length in y at -fDz");
1539 AddText(pt,"fAlpha1",trap->GetAlpha1(),"angle between centers of x edges and y axis at -fDz");
1540 AddText(pt,"fBl1",trap->GetBl1(),"half length in x at -dZ and y=-fH1");
1541 AddText(pt,"fTl1",trap->GetTl1(),"half length in x at -dZ and y=+fH1");
1542 AddText(pt,"fH2",trap->GetH2(),"half length in y at +fDz");
1543 AddText(pt,"fBl2",trap->GetBl2(),"half length in x at +dZ and y=-fH1");
1544 AddText(pt,"fTl2",trap->GetTl2(),"half length in x at +dZ and y=+fH1");
1545 AddText(pt,"fAlpha2",trap->GetAlpha2(),"angle between centers of x edges and y axis at +fDz");
1546 if (iaxis) AddText(pt, vol->GetFinder(), iaxis);
1547 pt->AddText("Execute: gtra(iaxis, ndiv, start, step) to divide this.");
1548 pt->AddText("----- IAXIS can be only 3 (Z)");
1549 pt->AddText("----- NDIV must be a positive integer");
1550 pt->AddText("----- START must be a valid axis offset within shape range on divided axis");
1551 pt->AddText("----- STEP is the division step. START+NDIV*STEP must be in range also");
1552 pt->AddText("----- If START and STEP are omitted, all range of the axis will be divided");
1553 pt->AddText(" ");
1554 pt->SetAllWith("-----","color",2);
1555 pt->SetAllWith("-----","font",72);
1556 pt->SetAllWith("-----","size",0.04);
1557 pt->SetAllWith("Execute","color",4);
1558 pt->SetTextAlign(12);
1559 pt->SetTextSize(0.044);
1560 pt->Draw();
1561 c->cd(1);
1562// SavePicture("gtra",c,vol,iaxis,step);
1563}
1564
1565//______________________________________________________________________________
1566void xtru()
1567{
1568 gROOT->GetListOfCanvases()->Delete();
1569 TCanvas *c = new TCanvas("gtra shape", "A twisted trapezoid", 700,1000);
1570 if (comments) {
1571 c->Divide(1,2,0,0);
1572 c->cd(2);
1573 gPad->SetPad(0,0,1,0.4);
1574 c->cd(1);
1575 gPad->SetPad(0,0.4,1,1);
1576 }
1577 if (gGeoManager) delete gGeoManager;
1578 new TGeoManager("xtru", "poza12");
1579 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
1580 TGeoMedium *med = new TGeoMedium("MED",1,mat);
1581 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
1583 TGeoVolume *vol = gGeoManager->MakeXtru("XTRU",med,4);
1584 TGeoXtru *xtru = (TGeoXtru*)vol->GetShape();
1585 Double_t x[8] = {-30,-30,30,30,15,15,-15,-15};
1586 Double_t y[8] = {-30,30,30,-30,-30,15,15,-30};
1587 xtru->DefinePolygon(8,x,y);
1588 xtru->DefineSection(0,-40, -20., 10., 1.5);
1589 xtru->DefineSection(1, 10, 0., 0., 0.5);
1590 xtru->DefineSection(2, 10, 0., 0., 0.7);
1591 xtru->DefineSection(3, 40, 10., 20., 0.9);
1592 vol->SetLineColor(randomColor());
1593 vol->SetLineWidth(2);
1594 top->AddNode(vol,1);
1597 top->Draw();
1598 MakePicture();
1599 if (!comments) return;
1600 c->cd(2);
1601 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
1602 pt->SetLineColor(1);
1603 TText *text = pt->AddText("TGeoXtru - Polygonal extrusion class");
1604 text->SetTextColor(2);
1605 AddText(pt,"fNvert",xtru->GetNvert(),"number of polygone vertices");
1606 AddText(pt,"fNz",xtru->GetNz(),"number of Z sections");
1607 pt->AddText("----- Any Z section is an arbitrary polygone");
1608 pt->AddText("----- The shape can have an arbitrary number of Z sections, as for pcon/pgon");
1609 pt->AddText("----- Create with: TGeoXtru *xtru = new TGeoXtru(nz);");
1610 pt->AddText("----- Define the blueprint polygon :");
1611 pt->AddText("----- Double_t x[8] = {-30,-30,30,30,15,15,-15,-15};");
1612 pt->AddText("----- Double_t y[8] = {-30,30,30,-30,-30,15,15,-30};");
1613 pt->AddText("----- xtru->DefinePolygon(8,x,y);");
1614 pt->AddText("----- Define translations/scales of the blueprint for Z sections :");
1615 pt->AddText("----- xtru->DefineSection(i, Zsection, x0, y0, scale);");
1616 pt->AddText("----- Sections have to be defined in increasing Z order");
1617 pt->AddText("----- 2 sections can be defined at same Z (not for first/last sections)");
1618 pt->AddText(" ");
1619 pt->SetAllWith("-----","color",2);
1620 pt->SetAllWith("-----","font",72);
1621 pt->SetAllWith("-----","size",0.04);
1622 pt->SetTextAlign(12);
1623 pt->SetTextSize(0.044);
1624 pt->Draw();
1625 c->cd(1);
1626}
1627
1628//______________________________________________________________________________
1629void composite()
1630{
1631 gROOT->GetListOfCanvases()->Delete();
1632 TCanvas *c = new TCanvas("composite shape", "A Boolean shape composition", 700,1000);
1633 if (comments) {
1634 c->Divide(1,2,0,0);
1635 c->cd(2);
1636 gPad->SetPad(0,0,1,0.4);
1637 c->cd(1);
1638 gPad->SetPad(0,0.4,1,1);
1639 }
1640 if (gGeoManager) delete gGeoManager;
1641 new TGeoManager("xtru", "poza12");
1642 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
1643 TGeoMedium *med = new TGeoMedium("MED",1,mat);
1644 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
1646
1647 // define shape components with names
1648 TGeoPgon *pgon = new TGeoPgon("pg",0.,360.,6,2);
1649 pgon->DefineSection(0,0,0,20);
1650 pgon->DefineSection(1, 30,0,20);
1651
1652 new TGeoSphere("sph", 40., 45.);
1653 // define named geometrical transformations with names
1654 TGeoTranslation *tr = new TGeoTranslation(0., 0., 45.);
1655 tr->SetName("tr");
1656 // register all used transformations
1657 tr->RegisterYourself();
1658 // create the composite shape based on a Boolean expression
1659 TGeoCompositeShape *cs = new TGeoCompositeShape("mir", "sph:tr*pg");
1660
1661 TGeoVolume *vol = new TGeoVolume("COMP",cs);
1662 vol->SetLineColor(randomColor());
1663 top->AddNode(vol,1);
1666 top->Draw();
1667 MakePicture();
1668 if (!comments) return;
1669 c->cd(2);
1670 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
1671 pt->SetLineColor(1);
1672 TText *text = pt->AddText("TGeoCompositeShape - composite shape class");
1673 text->SetTextColor(2);
1674 pt->AddText("----- Define the shape components and don't forget to name them");
1675 pt->AddText("----- Define geometrical transformations that apply to shape components");
1676 pt->AddText("----- Name all transformations and register them");
1677 pt->AddText("----- Define the composite shape based on a Boolean expression");
1678 pt->AddText(" TGeoCompositeShape(\"someName\", \"expression\")");
1679 pt->AddText("----- Expression is made of <shapeName:transfName> components related by Boolean operators");
1680 pt->AddText("----- Boolean operators can be: (+) union, (-) subtraction and (*) intersection");
1681 pt->AddText("----- Use parenthesis in the expression to force precedence");
1682 pt->AddText(" ");
1683 pt->SetAllWith("-----","color",4);
1684 pt->SetAllWith("-----","font",72);
1685 pt->SetAllWith("-----","size",0.04);
1686 pt->SetTextAlign(12);
1687 pt->SetTextSize(0.044);
1688 pt->Draw();
1689 c->cd(1);
1690}
1691
1692//______________________________________________________________________________
1693void ideal()
1694{
1695// This is an ideal geometry. In real life, some geometry pieces are moved/rotated
1696// with respect to their ideal positions. This is called alignment. Alignment
1697// operations can be handled by TGeo starting from a CLOSED geometry (applied a posteriori)
1698// Alignment is handled by PHYSICAL NODES, representing an unique object in geometry.
1699//
1700// Creating physical nodes:
1701// 1. TGeoPhysicalNode *node = gGeoManager->MakePhysicalNode(const char *path)
1702// - creates a physical node represented by path
1703// - path can be : TOP_1/A_2/B_3
1704// - B_3 is the 'final node' e.g. the logical node represented by this physical node
1705// 2. TGeoPhysicalNode *node = gGeoManager->MakePhysicalNode()
1706// - creates a physical node representing the current modeller state
1707
1708// Setting visualisation options for TGeoPhysicalNode *node:
1709// 1. node->SetVisibility(Bool_t flag); // set node visible(*) or invisible
1710// 2. node->SetIsVolAtt(Bool_t flag); // set line attributes to match the ones of the volumes in the branch
1711// - default - TRUE
1712// - when called with FALSE - the attributes defined for the physical node will be taken
1713// node->SetLineColor(color);
1714// node->SetLineWidth(width);
1715// node->SetLineStyle(style);
1716// 3. node->SetVisibleFull(Bool_t flag); // not only last node in the branch is visible (default)
1717//
1718// Activating/deactivating physical nodes drawing - not needed in case of alignment
1719
1720// Aligning physical nodes
1721//==========================
1722// node->Align(TGeoMatrix *newmat, TGeoShape *newshape, Bool_t check=kFALSE);
1723// newmat = new matrix to replace final node LOCAL matrix
1724// newshape = new shape to replace final node shape
1725// check = optional check if the new aligned node is overlapping
1726// gGeoManager->SetDrawExtraPaths(Bool_t flag)
1727 gROOT->GetListOfCanvases()->Delete();
1728 TCanvas *c = new TCanvas("composite shape", "A Boolean shape composition", 700,1000);
1729 if (comments) {
1730 c->Divide(1,2,0,0);
1731 c->cd(2);
1732 gPad->SetPad(0,0,1,0.4);
1733 c->cd(1);
1734 gPad->SetPad(0,0.4,1,1);
1735 }
1736 if (gGeoManager) delete gGeoManager;
1737 new TGeoManager("alignment", "Ideal geometry");
1738 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
1739 TGeoMedium *med = new TGeoMedium("MED",1,mat);
1740 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,10);
1742 TGeoVolume *slicex = top->Divide("SX",1,10,-100,10);
1743 TGeoVolume *slicey = slicex->Divide("SY",2,10,-100,10);
1744 TGeoVolume *vol = gGeoManager->MakePgon("CELL",med,0.,360.,6,2);
1745 TGeoPgon *pgon = (TGeoPgon*)(vol->GetShape());
1746 pgon->DefineSection(0,-5,0.,2.);
1747 pgon->DefineSection(1,5,0.,2.);
1748 vol->SetLineColor(randomColor());
1749 slicey->AddNode(vol,1);
1752 top->Draw();
1753 MakePicture();
1754 if (!comments) return;
1755 c->cd(2);
1756 TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99);
1757 pt->SetLineColor(1);
1758 TText *text = pt->AddText("Ideal / Aligned geometry");
1759 text->SetTextColor(2);
1760 pt->AddText("-- Create physical nodes for the objects you want to align");
1761 pt->AddText("-- You must start from a valid CLOSED geometry");
1762 pt->AddText(" TGeoPhysicalNode *node = gGeoManager->MakePhysicalNode(const char *path)");
1763 pt->AddText(" + creates a physical node represented by path, e.g. TOP_1/A_2/B_3");
1764 pt->AddText(" node->Align(TGeoMatrix *newmat, TGeoShape *newshape, Bool_t check=kFALSE)");
1765 pt->AddText(" + newmat = new matrix to replace final node LOCAL matrix");
1766 pt->AddText(" + newshape = new shape to replace final node shape");
1767 pt->AddText(" + check = optional check if the new aligned node is overlapping");
1768 pt->AddText(" ");
1769 pt->SetAllWith("--","color",4);
1770 pt->SetAllWith("--","font",72);
1771 pt->SetAllWith("--","size",0.04);
1772 pt->SetAllWith("+","color",2);
1773 pt->SetAllWith("+","font",72);
1774 pt->SetAllWith("+","size",0.04);
1775 pt->SetTextAlign(12);
1776 pt->SetTextSize(0.044);
1777 pt->Draw();
1778 c->cd(1);
1779}
1780
1781//______________________________________________________________________________
1782void align()
1783{
1784 if (!gGeoManager) return;
1785 if (strcmp(gGeoManager->GetName(),"alignment")) {
1786 printf("Click: <Ideal geometry> first\n");
1787 return;
1788 }
1789 char name[30];
1791 TGeoPhysicalNode *node;
1792 TGeoTranslation *tr;
1793 for (Int_t i=1; i<=10; i++) {
1794 for (Int_t j=1; j<=10; j++) {
1795 node = 0;
1796 sprintf(name, "TOP_1/SX_%d/SY_%d/CELL_1",i,j);
1797 if (list) node = (TGeoPhysicalNode*)list->At(10*(i-1)+j-1);
1798 if (!node) node = gGeoManager->MakePhysicalNode(name);
1799 if (node->IsAligned()) {
1800 tr = (TGeoTranslation*)node->GetNode()->GetMatrix();
1801 tr->SetTranslation(2.*gRandom->Rndm(), 2.*gRandom->Rndm(),0.);
1802 } else {
1803 tr = new TGeoTranslation(2.*gRandom->Rndm(), 2.*gRandom->Rndm(),0.);
1804 }
1805 node->Align(tr);
1806 }
1807 }
1808 if (gPad) {
1809 gPad->Modified();
1810 gPad->Update();
1811 }
1812}
#define c(i)
Definition: RSha256.hxx:101
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:572
#define gROOT
Definition: TROOT.h:410
R__EXTERN TRandom * gRandom
Definition: TRandom.h:62
#define gPad
Definition: TVirtualPad.h:286
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:37
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition: TAttText.h:41
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Definition: TAttText.h:43
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
Definition: TAttText.h:45
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition: TAttText.h:46
The Canvas class.
Definition: TCanvas.h:31
A Control Bar is a fully user configurable tool which provides fast access to frequently used operati...
Definition: TControlBar.h:22
An arbitrary trapezoid with less than 8 vertices standing on two parallel planes perpendicular to Z a...
Definition: TGeoArb8.h:18
virtual void SetVertex(Int_t vnum, Double_t x, Double_t y)
Set values for a given vertex.
Definition: TGeoArb8.cxx:1248
Double_t GetDz() const
Definition: TGeoArb8.h:63
Double_t * GetVertices()
Definition: TGeoArb8.h:67
Box class.
Definition: TGeoBBox.h:18
virtual Double_t GetDZ() const
Definition: TGeoBBox.h:72
Class handling Boolean composition of shapes.
A phi segment of a conical tube.
Definition: TGeoCone.h:99
Double_t GetPhi1() const
Definition: TGeoCone.h:160
Double_t GetPhi2() const
Definition: TGeoCone.h:161
Conical tube class.
Definition: TGeoCone.h:18
virtual Double_t GetRmax2() const
Definition: TGeoCone.h:76
virtual Double_t GetRmin2() const
Definition: TGeoCone.h:75
virtual Double_t GetRmin1() const
Definition: TGeoCone.h:73
virtual Double_t GetRmax1() const
Definition: TGeoCone.h:74
Elliptical tube class.
Definition: TGeoEltu.h:18
virtual Double_t GetA() const
Definition: TGeoEltu.h:43
virtual Double_t GetB() const
Definition: TGeoEltu.h:44
Gtra is a twisted trapezoid.
Definition: TGeoArb8.h:144
Double_t GetTwistAngle() const
Definition: TGeoArb8.h:166
Hyperboloid class defined by 5 parameters.
Definition: TGeoHype.h:18
Double_t GetStIn() const
Definition: TGeoHype.h:68
Double_t GetStOut() const
Definition: TGeoHype.h:69
The manager class for any TGeo geometry.
Definition: TGeoManager.h:39
TGeoVolume * MakeCone(const char *name, TGeoMedium *medium, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
Make in one step a volume pointing to a cone shape with given medium.
TGeoVolume * MakeXtru(const char *name, TGeoMedium *medium, Int_t nz)
Make a TGeoXtru-shaped volume with nz planes.
TGeoVolume * MakePcon(const char *name, TGeoMedium *medium, Double_t phi, Double_t dphi, Int_t nz)
Make in one step a volume pointing to a polycone shape with given medium.
TGeoVolume * MakeTube(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
TGeoVolume * MakeCons(const char *name, TGeoMedium *medium, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Double_t phi1, Double_t phi2)
Make in one step a volume pointing to a cone segment shape with given medium.
TVirtualGeoPainter * GetGeomPainter()
Make a default painter if none present. Returns pointer to it.
TGeoVolume * MakePara(const char *name, TGeoMedium *medium, Double_t dx, Double_t dy, Double_t dz, Double_t alpha, Double_t theta, Double_t phi)
Make in one step a volume pointing to a parallelepiped shape with given medium.
TGeoVolume * MakeTorus(const char *name, TGeoMedium *medium, Double_t r, Double_t rmin, Double_t rmax, Double_t phi1=0, Double_t dphi=360)
Make in one step a volume pointing to a torus shape with given medium.
void CloseGeometry(Option_t *option="d")
Closing geometry implies checking the geometry validity, fixing shapes with negative parameters (run-...
TGeoVolume * MakeTrd2(const char *name, TGeoMedium *medium, Double_t dx1, Double_t dx2, Double_t dy1, Double_t dy2, Double_t dz)
Make in one step a volume pointing to a TGeoTrd2 shape with given medium.
TGeoVolume * MakeGtra(const char *name, TGeoMedium *medium, Double_t dz, Double_t theta, Double_t phi, Double_t twist, Double_t h1, Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, Double_t tl2, Double_t alpha2)
Make in one step a volume pointing to a twisted trapezoid shape with given medium.
TGeoVolume * MakeBox(const char *name, TGeoMedium *medium, Double_t dx, Double_t dy, Double_t dz)
Make in one step a volume pointing to a box shape with given medium.
TGeoVolume * MakeTrd1(const char *name, TGeoMedium *medium, Double_t dx1, Double_t dx2, Double_t dy, Double_t dz)
Make in one step a volume pointing to a TGeoTrd1 shape with given medium.
TGeoVolume * MakeSphere(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t themin=0, Double_t themax=180, Double_t phimin=0, Double_t phimax=360)
Make in one step a volume pointing to a sphere shape with given medium.
void SetTopVolume(TGeoVolume *vol)
Set the top volume and corresponding node as starting point of the geometry.
TGeoVolume * MakeCtub(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2, Double_t lx, Double_t ly, Double_t lz, Double_t tx, Double_t ty, Double_t tz)
Make in one step a volume pointing to a tube segment shape with given medium.
TGeoVolume * MakePgon(const char *name, TGeoMedium *medium, Double_t phi, Double_t dphi, Int_t nedges, Int_t nz)
Make in one step a volume pointing to a polygone shape with given medium.
TGeoVolume * MakeTrap(const char *name, TGeoMedium *medium, Double_t dz, Double_t theta, Double_t phi, Double_t h1, Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, Double_t tl2, Double_t alpha2)
Make in one step a volume pointing to a trapezoid shape with given medium.
void SetNsegments(Int_t nseg)
Set number of segments for approximating circles in drawing.
TGeoPhysicalNode * MakePhysicalNode(const char *path=0)
Makes a physical node corresponding to a path.
TObjArray * GetListOfPhysicalNodes()
Definition: TGeoManager.h:473
TGeoVolume * MakeHype(const char *name, TGeoMedium *medium, Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
TGeoVolume * MakeParaboloid(const char *name, TGeoMedium *medium, Double_t rlo, Double_t rhi, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
TGeoVolume * MakeTubs(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2)
Make in one step a volume pointing to a tube segment shape with given medium.
TGeoVolume * MakeEltu(const char *name, TGeoMedium *medium, Double_t a, Double_t b, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
Base class describing materials.
Definition: TGeoMaterial.h:31
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
Definition: TGeoMatrix.cxx:526
Media are used to store properties related to tracking and which are useful only when using geometry ...
Definition: TGeoMedium.h:24
virtual TGeoMatrix * GetMatrix() const =0
Parallelepiped class.
Definition: TGeoPara.h:18
Double_t GetZ() const
Definition: TGeoPara.h:63
Double_t GetPhi() const
Definition: TGeoPara.h:66
Double_t GetAlpha() const
Definition: TGeoPara.h:64
Double_t GetX() const
Definition: TGeoPara.h:61
Double_t GetY() const
Definition: TGeoPara.h:62
Double_t GetTheta() const
Definition: TGeoPara.h:65
Paraboloid class.
Double_t GetDz() const
Double_t GetRhi() const
Double_t GetRlo() const
Base finder class for patterns.
Int_t GetNdiv() const
TGeoVolume * GetVolume() const
Double_t GetStep() const
Double_t GetStart() const
A polycone.
Definition: TGeoPcon.h:18
Double_t * GetRmax() const
Definition: TGeoPcon.h:77
Double_t GetDphi() const
Definition: TGeoPcon.h:72
virtual void DefineSection(Int_t snum, Double_t z, Double_t rmin, Double_t rmax)
Defines z position of a section plane, rmin and rmax at this z.
Definition: TGeoPcon.cxx:618
Double_t * GetZ() const
Definition: TGeoPcon.h:79
Int_t GetNz() const
Definition: TGeoPcon.h:73
Double_t * GetRmin() const
Definition: TGeoPcon.h:75
Double_t GetPhi1() const
Definition: TGeoPcon.h:71
A polygone.
Definition: TGeoPgon.h:20
Int_t GetNedges() const
Definition: TGeoPgon.h:81
Physical nodes are the actual 'touchable' objects in the geometry, representing a path of positioned ...
Bool_t IsAligned() const
TGeoNode * GetNode(Int_t level=-1) const
Return node in branch at LEVEL. If not specified, return last leaf.
Bool_t Align(TGeoMatrix *newmat=0, TGeoShape *newshape=0, Bool_t check=kFALSE, Double_t ovlp=0.001)
Align a physical node with a new relative matrix/shape.
Base abstract class for all shapes.
Definition: TGeoShape.h:26
virtual const char * GetAxisName(Int_t iaxis) const =0
Spherical shell class.
Definition: TGeoSphere.h:18
Double_t GetPhi1() const
Definition: TGeoSphere.h:71
Double_t GetPhi2() const
Definition: TGeoSphere.h:72
virtual Double_t GetRmin() const
Definition: TGeoSphere.h:67
Double_t GetTheta2() const
Definition: TGeoSphere.h:70
virtual Double_t GetRmax() const
Definition: TGeoSphere.h:68
Double_t GetTheta1() const
Definition: TGeoSphere.h:69
Torus segment class.
Definition: TGeoTorus.h:18
Double_t GetRmax() const
Definition: TGeoTorus.h:71
Double_t GetRmin() const
Definition: TGeoTorus.h:70
Double_t GetR() const
Definition: TGeoTorus.h:69
Double_t GetPhi1() const
Definition: TGeoTorus.h:72
Double_t GetDphi() const
Definition: TGeoTorus.h:73
Class describing translations.
Definition: TGeoMatrix.h:122
void SetTranslation(Double_t dx, Double_t dy, Double_t dz)
Set translation components.
Definition: TGeoMatrix.cxx:750
TRAP is a general trapezoid, i.e.
Definition: TGeoArb8.h:90
Double_t GetTl1() const
Definition: TGeoArb8.h:128
Double_t GetPhi() const
Definition: TGeoArb8.h:125
Double_t GetAlpha2() const
Definition: TGeoArb8.h:133
Double_t GetTheta() const
Definition: TGeoArb8.h:124
Double_t GetAlpha1() const
Definition: TGeoArb8.h:129
Double_t GetBl2() const
Definition: TGeoArb8.h:131
Double_t GetTl2() const
Definition: TGeoArb8.h:132
Double_t GetH1() const
Definition: TGeoArb8.h:126
Double_t GetH2() const
Definition: TGeoArb8.h:130
Double_t GetBl1() const
Definition: TGeoArb8.h:127
A trapezoid with only x length varying with z.
Definition: TGeoTrd1.h:18
Double_t GetDy() const
Definition: TGeoTrd1.h:57
Double_t GetDx2() const
Definition: TGeoTrd1.h:56
Double_t GetDz() const
Definition: TGeoTrd1.h:58
Double_t GetDx1() const
Definition: TGeoTrd1.h:55
A trapezoid with both x and y lengths varying with z.
Definition: TGeoTrd2.h:18
Double_t GetDy2() const
Definition: TGeoTrd2.h:59
Double_t GetDy1() const
Definition: TGeoTrd2.h:58
Double_t GetDx2() const
Definition: TGeoTrd2.h:57
Double_t GetDz() const
Definition: TGeoTrd2.h:60
Double_t GetDx1() const
Definition: TGeoTrd2.h:56
A phi segment of a tube.
Definition: TGeoTube.h:89
Double_t GetPhi2() const
Definition: TGeoTube.h:149
Double_t GetPhi1() const
Definition: TGeoTube.h:148
Cylindrical tube class.
Definition: TGeoTube.h:18
virtual Double_t GetRmin() const
Definition: TGeoTube.h:66
virtual Double_t GetDz() const
Definition: TGeoTube.h:68
virtual Double_t GetRmax() const
Definition: TGeoTube.h:67
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:53
TGeoPatternFinder * GetFinder() const
Definition: TGeoVolume.h:178
TGeoShape * GetShape() const
Definition: TGeoVolume.h:191
virtual void Draw(Option_t *option="")
draw top volume according to option
virtual TGeoVolume * Divide(const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step, Int_t numed=0, Option_t *option="")
Division a la G3.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=0, Option_t *option="")
Add a TGeoNode to the list of nodes.
Definition: TGeoVolume.cxx:984
An extrusion with fixed outline shape in x-y and a sequence of z extents (segments).
Definition: TGeoXtru.h:22
Int_t GetNvert() const
Definition: TGeoXtru.h:94
Bool_t DefinePolygon(Int_t nvert, const Double_t *xv, const Double_t *yv)
Creates the polygon representing the blueprint of any Xtru section.
Definition: TGeoXtru.cxx:698
virtual void DefineSection(Int_t snum, Double_t z, Double_t x0=0., Double_t y0=0., Double_t scale=1.)
defines z position of a section plane, rmin and rmax at this z.
Definition: TGeoXtru.cxx:731
Int_t GetNz() const
Definition: TGeoXtru.h:93
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
An array of TObjects.
Definition: TObjArray.h:37
TObject * At(Int_t idx) const
Definition: TObjArray.h:165
Mother of all ROOT objects.
Definition: TObject.h:37
A Pave (see TPave) with text, lines or/and boxes inside.
Definition: TPaveText.h:21
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
Definition: TPaveText.cxx:182
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
Definition: TPaveText.cxx:233
virtual void SetAllWith(const char *text, Option_t *option, Double_t value)
Set attribute option for all lines containing string text.
Definition: TPaveText.cxx:879
Bool_t ProcessEvents()
Process events if timer did time out.
Definition: TSystem.cxx:86
Random number generator class based on M.
Definition: TRandom3.h:27
virtual Double_t Rndm()
Machine independent random number generator.
Definition: TRandom.cxx:533
Base class for several text objects.
Definition: TText.h:23
See TView3D.
Definition: TView.h:25
virtual Double_t GetPsi()=0
virtual Double_t GetLongitude()=0
virtual void ShowAxis()=0
virtual Double_t GetLatitude()=0
virtual void SetView(Double_t longitude, Double_t latitude, Double_t psi, Int_t &irep)=0
Abstract class for geometry painters.
virtual Bool_t IsRaytracing() const =0
virtual void SetRaytracing(Bool_t flag=kTRUE)=0
TPaveText * pt
TText * text
TLine * line
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
static constexpr double bar
Double_t Cos(Double_t)
Definition: TMath.h:629
constexpr Double_t Pi()
Definition: TMath.h:38
Double_t Sin(Double_t)
Definition: TMath.h:625