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