Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
webdemo.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_geom
3/// Web-based GUI to draw the geometry shapes.
4/// Using functionality of web geometry viewer
5/// Based on original geodemo.C macro
6///
7/// \macro_code
8///
9/// \author Andrei Gheata
10/// \author Sergey Linev
11
12#include <vector>
13#include <string>
14
15#include "TMath.h"
16#include "TRandom.h"
17#include "TROOT.h"
18#include "TGeoManager.h"
19#include "TGeoNode.h"
20#include "TGeoBBox.h"
21#include "TGeoPara.h"
22#include "TGeoTube.h"
23#include "TGeoCone.h"
24#include "TGeoEltu.h"
25#include "TGeoSphere.h"
26#include "TGeoTorus.h"
27#include "TGeoTrd1.h"
28#include "TGeoTrd2.h"
29#include "TGeoParaboloid.h"
30#include "TGeoHype.h"
31#include "TGeoPcon.h"
32#include "TGeoPgon.h"
33#include "TGeoArb8.h"
34#include "TGeoXtru.h"
35#include "TGeoCompositeShape.h"
36#include "TGeoTessellated.h"
37#include "TGeoPhysicalNode.h"
38
39#include <ROOT/RWebWindow.hxx>
41
42Bool_t comments = kTRUE;
43Bool_t grotate = kFALSE;
44Bool_t axis = kTRUE;
45
46std::string getOptions()
47{
48 std::string opt;
49 if (grotate) opt.append("rotate;");
50 if (axis) opt.append("axis;");
51 return opt;
52}
53
54// create here to keep it in memory
55auto geomViewer = std::make_shared<ROOT::Experimental::REveGeomViewer>();
56
58
60
61void display()
62{
63 geomViewer->SetShowHierarchy(false);
64 geomViewer->SetGeometry(gGeoManager);
65 geomViewer->Show({600, 600, 160, 0});
66}
67
68//______________________________________________________________________________
69void autorotate()
70{
71 grotate = !grotate;
72 geomViewer->SetDrawOptions(getOptions());
73}
74
75//______________________________________________________________________________
76void axes()
77{
78 axis = !axis;
79 geomViewer->SetDrawOptions(getOptions());
80}
81
82//______________________________________________________________________________
83void gcomments()
84{
85 comments = !comments;
86 if (!comments)
87 helpWindow->CloseConnections();
88}
89
90//______________________________________________________________________________
91void SavePicture(const char *name, TObject *objcanvas, TObject *objvol, Int_t iaxis, Double_t step)
92{
93 // TDOD: provide in geom viewer
94}
95
96//______________________________________________________________________________
97Int_t randomColor()
98{
99 Double_t color = 7.*gRandom->Rndm();
100 return (1+Int_t(color));
101}
102
103//______________________________________________________________________________
104std::string AddDbl(const char *datamember, Double_t value, const char *comment)
105{
106 return TString::Format("%10s = %5.2f => %s", datamember, value, comment).Data();
107}
108
109//______________________________________________________________________________
110std::string AddInt(const char *datamember, Int_t value, const char *comment)
111{
112 return TString::Format("%10s = %5d => %s", datamember, value, comment).Data();
113}
114
115//______________________________________________________________________________
116void help(const std::vector<std::string> &info = {}, TGeoVolume *fvol = nullptr, Int_t iaxis = 0, const std::vector<std::string> &info2 = {})
117{
118 if (!info.empty() && !comments)
119 return;
120
121 std::vector<std::string> lines({
122 " >>>>>>> web geometry viewer <<<<<< ",
123 " Demo for building TGeo basic shapes and simple geometry. Shape parameters are",
124 " displayed in the right pad",
125 "- Click left mouse button to execute one demo",
126 "- While pointing the mouse to the pad containing the geometry, do:",
127 "- .... click-and-move to rotate",
128 "- .... use mouse wheel for zooming",
129 "- .... double click for reset position",
130 "- Execute box(1,8) to divide a box in 8 equal slices along X",
131 "- Most shapes can be divided on X,Y,Z,Rxy or Phi :",
132 "- .... root[0] <shape>(IAXIS, NDIV, START, STEP);",
133 " .... IAXIS = 1,2,3 meaning (X,Y,Z) or (Rxy, Phi, Z)",
134 " .... NDIV = number of slices",
135 " .... START = start slicing position",
136 " .... STEP = division step",
137 "- Click Comments ON/OFF to toggle comments",
138 "- Click Ideal/Align geometry to see how alignment works"
139 });
140
141 helpWindow->SetDefaultPage("file:webhelp.html");
142
143 unsigned connid = helpWindow->GetDisplayConnection();
144
145 if (!info.empty()) {
146 lines = info;
147 TGeoPatternFinder *finder = (fvol && (iaxis > 0) && (iaxis < 4)) ? fvol->GetFinder() : nullptr;
148 if (finder) {
149 TGeoVolume *volume = finder->GetVolume();
150 TGeoShape *sh = volume->GetShape();
151 lines.emplace_back(Form("Division of %s on axis %d (%s)", volume->GetName(), iaxis, sh->GetAxisName(iaxis)));
152 lines.emplace_back(AddInt("fNdiv",finder->GetNdiv(),"number of divisions"));
153 lines.emplace_back(AddDbl("fStart",finder->GetStart(),"start divisioning position"));
154 lines.emplace_back(AddDbl("fStep",finder->GetStep(),"division step"));
155 }
156 if (!info2.empty())
157 lines.insert(lines.end(), info2.begin(), info2.end());
158 }
159 int height = 200;
160 if (lines.size() > 10) height = 50 + lines.size()*20;
161
162 if (!connid) connid = helpWindow->Show({600, height, 160, 650});
163
164 std::string msg = "";
165 bool first = true;
166 for (auto &line : lines) {
167 if (line.empty()) continue;
168 std::string style = "", p = "<p style='";
169 if (first) { style = "font-size:150%;color:red"; first = false; }
170 else if (line.find("----")==0) { style = "color:red"; }
171 else if (line.find("Execute")==0) { style = "color:blue"; }
172 else if (line.find("Division")==0) { style = "font-size:120%;color:green"; }
173 if (style.empty()) p = "<p>"; else { p.append(style); p.append("'>"); }
174 p.append(line);
175 p.append("</p>");
176 msg.append(p);
177 }
178
179 if (msg.empty())
180 helpWindow->Send(connid, "Initial text");
181 else
182 helpWindow->Send(connid, msg);
183}
184
185//______________________________________________________________________________
186void box(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
187{
188 if (iaxis<0 || iaxis>3) {
189 printf("Wrong division axis. Range is 1-3.\n");
190 return;
191 }
192
193 if (gGeoManager) delete gGeoManager;
194 new TGeoManager("box", "poza1");
195 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
196 TGeoMedium *med = new TGeoMedium("MED",1,mat);
197 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
199 TGeoVolume *vol = gGeoManager->MakeBox("BOX",med, 20,30,40);
200 vol->SetLineColor(randomColor());
201 vol->SetLineWidth(2);
202 top->AddNode(vol,1);
203 if (iaxis) {
204 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
205 if (!slice) return;
206 slice->SetLineColor(randomColor());
207 }
209
210 display();
211
212 TGeoBBox *bbox = (TGeoBBox*)(vol->GetShape());
213
214 help({"TGeoBBox - box class",
215 AddDbl("fDX",bbox->GetDX(),"half length in X"),
216 AddDbl("fDY",bbox->GetDY(),"half length in Y"),
217 AddDbl("fDZ",bbox->GetDZ(),"half length in Z"),
218 AddDbl("fOrigin[0]",(bbox->GetOrigin())[0],"box origin on X"),
219 AddDbl("fOrigin[1]",(bbox->GetOrigin())[1],"box origin on Y"),
220 AddDbl("fOrigin[2]",(bbox->GetOrigin())[2],"box origin on Z")},
221 vol, iaxis,
222 {"Execute: box(iaxis, ndiv, start, step) to divide this.",
223 "----- IAXIS can be 1, 2 or 3 (X, Y, Z)",
224 "----- NDIV must be a positive integer",
225 "----- START must be a valid axis offset within shape range on divided axis",
226 "----- STEP is the division step. START+NDIV*STEP must be in range also",
227 "----- If START and STEP are omitted, all range of the axis will be divided"});
228}
229
230//______________________________________________________________________________
231void para(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
232{
233 if (iaxis<0 || iaxis>3) {
234 printf("Wrong division axis. Range is 1-3.\n");
235 return;
236 }
237 if (gGeoManager) delete gGeoManager;
238 new TGeoManager("para", "poza1");
239 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
240 TGeoMedium *med = new TGeoMedium("MED",1,mat);
241 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
243 TGeoVolume *vol = gGeoManager->MakePara("PARA",med, 20,30,40,30,15,30);
244 vol->SetLineColor(randomColor());
245 vol->SetLineWidth(2);
246 top->AddNode(vol,1);
247 if (iaxis) {
248 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
249 if (!slice) return;
250 slice->SetLineColor(randomColor());
251 }
254
255 display();
256
257 TGeoPara *para = (TGeoPara*)(vol->GetShape());
258
259 help({"TGeoPara - parallelepiped class",
260 AddDbl("fX", para->GetX(), "half length in X"),
261 AddDbl("fY", para->GetY(), "half length in Y"),
262 AddDbl("fZ", para->GetZ(), "half length in Z"),
263 AddDbl("fAlpha", para->GetAlpha(), "angle about Y of the Z bases"),
264 AddDbl("fTheta", para->GetTheta(), "inclination of para axis about Z"),
265 AddDbl("fPhi", para->GetPhi(), "phi angle of para axis")},
266 vol, iaxis,
267 {"Execute: para(iaxis, ndiv, start, step) to divide this.",
268 "----- IAXIS can be 1, 2 or 3 (X, Y, Z)", "----- NDIV must be a positive integer",
269 "----- START must be a valid axis offset within shape range on divided axis",
270 "----- STEP is the division step. START+NDIV*STEP must be in range also",
271 "----- If START and STEP are omitted, all range of the axis will be divided"});
272 // SavePicture("para",c,vol,iaxis,step);
273}
274
275//______________________________________________________________________________
276void tube(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
277{
278 if (iaxis<0 || iaxis>3) {
279 printf("Wrong division axis. Range is 1-3.\n");
280 return;
281 }
282
283 if (gGeoManager) delete gGeoManager;
284 new TGeoManager("tube", "poza2");
285 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
286 TGeoMedium *med = new TGeoMedium("MED",1,mat);
287 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
289 TGeoVolume *vol = gGeoManager->MakeTube("TUBE",med, 20,30,40);
290 vol->SetLineColor(randomColor());
291 vol->SetLineWidth(2);
292 top->AddNode(vol,1);
293 if (iaxis) {
294 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
295 if (!slice) return;
296 slice->SetLineColor(randomColor());
297 }
300
301 display();
302
303 TGeoTube *tube = (TGeoTube*)(vol->GetShape());
304 help({"TGeoTube - tube class",
305 AddDbl("fRmin",tube->GetRmin(),"minimum radius"),
306 AddDbl("fRmax",tube->GetRmax(),"maximum radius"),
307 AddDbl("fDZ", tube->GetDZ(), "half length in Z")},
308 vol, iaxis,
309 {"Execute: tube(iaxis, ndiv, start, step) to divide this.",
310 "----- IAXIS can be 1, 2 or 3 (Rxy, Phi, Z)",
311 "----- NDIV must be a positive integer",
312 "----- START must be a valid axis offset within shape range on divided axis",
313 "----- STEP is the division step. START+NDIV*STEP must be in range also",
314 "----- If START and STEP are omitted, all range of the axis will be divided"});
315
316// SavePicture("tube",c,vol,iaxis,step);
317}
318
319//______________________________________________________________________________
320void tubeseg(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
321{
322 if (iaxis<0 || iaxis>3) {
323 printf("Wrong division axis. Range is 1-3.\n");
324 return;
325 }
326
327 if (gGeoManager) delete gGeoManager;
328 new TGeoManager("tubeseg", "poza3");
329 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
330 TGeoMedium *med = new TGeoMedium("MED",1,mat);
331 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
333 TGeoVolume *vol = gGeoManager->MakeTubs("TUBESEG",med, 20,30,40,-30,270);
334 vol->SetLineColor(randomColor());
335 if (iaxis) {
336 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
337 if (!slice) return;
338 slice->SetLineColor(randomColor());
339 }
340 vol->SetLineWidth(2);
341 top->AddNode(vol,1);
343// gGeoManager->SetNsegments(40);
345
346 display();
347
348 TGeoTubeSeg *tubeseg = (TGeoTubeSeg*)(vol->GetShape());
349
350 help({ "TGeoTubeSeg - tube segment class",
351 AddDbl("fRmin",tubeseg->GetRmin(),"minimum radius"),
352 AddDbl("fRmax",tubeseg->GetRmax(),"maximum radius"),
353 AddDbl("fDZ", tubeseg->GetDZ(), "half length in Z"),
354 AddDbl("fPhi1",tubeseg->GetPhi1(),"first phi limit"),
355 AddDbl("fPhi2",tubeseg->GetPhi2(),"second phi limit")},
356 vol, iaxis,
357 {"Execute: tubeseg(iaxis, ndiv, start, step) to divide this.",
358 "----- IAXIS can be 1, 2 or 3 (Rxy, Phi, Z)",
359 "----- NDIV must be a positive integer",
360 "----- START must be a valid axis offset within shape range on divided axis",
361 "----- STEP is the division step. START+NDIV*STEP must be in range also",
362 "----- If START and STEP are omitted, all range of the axis will be divided"});
363// SavePicture("tubeseg",c,vol,iaxis,step);
364}
365
366//______________________________________________________________________________
367void ctub(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
368{
369 if (iaxis<0 || iaxis>2) {
370 printf("Wrong division axis. Range is 1-2.\n");
371 return;
372 }
373
374 if (gGeoManager) delete gGeoManager;
375 new TGeoManager("ctub", "poza3");
376 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
377 TGeoMedium *med = new TGeoMedium("MED",1,mat);
378 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
380 Double_t theta = 160.*TMath::Pi()/180.;
381 Double_t phi = 30.*TMath::Pi()/180.;
382 Double_t nlow[3];
383 nlow[0] = TMath::Sin(theta)*TMath::Cos(phi);
384 nlow[1] = TMath::Sin(theta)*TMath::Sin(phi);
385 nlow[2] = TMath::Cos(theta);
386 theta = 20.*TMath::Pi()/180.;
387 phi = 60.*TMath::Pi()/180.;
388 Double_t nhi[3];
389 nhi[0] = TMath::Sin(theta)*TMath::Cos(phi);
390 nhi[1] = TMath::Sin(theta)*TMath::Sin(phi);
391 nhi[2] = TMath::Cos(theta);
392 TGeoVolume *vol = gGeoManager->MakeCtub("CTUB",med, 20,30,40,-30,250, nlow[0], nlow[1], nlow[2], nhi[0],nhi[1],nhi[2]);
393 vol->SetLineColor(randomColor());
394 if (iaxis) {
395 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
396 if (!slice) return;
397 slice->SetLineColor(randomColor());
398 }
399 vol->SetLineWidth(2);
400 top->AddNode(vol,1);
402// gGeoManager->SetNsegments(40);
404
405 display();
406
407 TGeoTubeSeg *tubeseg = (TGeoTubeSeg*)(vol->GetShape());
408
409 help({ "TGeoTubeSeg - tube segment class",
410 AddDbl("fRmin",tubeseg->GetRmin(),"minimum radius"),
411 AddDbl("fRmax",tubeseg->GetRmax(),"maximum radius"),
412 AddDbl("fDZ", tubeseg->GetDZ(), "half length in Z"),
413 AddDbl("fPhi1",tubeseg->GetPhi1(),"first phi limit"),
414 AddDbl("fPhi2",tubeseg->GetPhi2(),"second phi limit")},
415 vol, iaxis);
416// SavePicture("tubeseg",c,vol,iaxis,step);
417}
418
419//______________________________________________________________________________
420void cone(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
421{
422 if (iaxis<0 || iaxis>3) {
423 printf("Wrong division axis. Range is 1-3.\n");
424 return;
425 } else if (iaxis==1) {
426 printf("cannot divide cone on Rxy\n");
427 return;
428 }
429
430 if (gGeoManager) delete gGeoManager;
431 new TGeoManager("cone", "poza4");
432 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
433 TGeoMedium *med = new TGeoMedium("MED",1,mat);
434 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
436 TGeoVolume *vol = gGeoManager->MakeCone("CONE",med, 40,10,20,35,45);
437 vol->SetLineColor(randomColor());
438 vol->SetLineWidth(2);
439 if (iaxis) {
440 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
441 if (!slice) return;
442 slice->SetLineColor(randomColor());
443 }
444 top->AddNode(vol,1);
447
448 display();
449
450 TGeoCone *cone = (TGeoCone*)(vol->GetShape());
451
452 help({ "TGeoCone - cone class",
453 AddDbl("fDZ", cone->GetDZ(), "half length in Z"),
454 AddDbl("fRmin1",cone->GetRmin1(),"inner radius at -dz"),
455 AddDbl("fRmax1",cone->GetRmax1(),"outer radius at -dz"),
456 AddDbl("fRmin2",cone->GetRmin2(),"inner radius at +dz"),
457 AddDbl("fRmax2",cone->GetRmax2(),"outer radius at +dz")},
458 vol, iaxis,
459 {"Execute: cone(iaxis, ndiv, start, step) to divide this.",
460 "----- IAXIS can be 2 or 3 (Phi, Z)",
461 "----- NDIV must be a positive integer",
462 "----- START must be a valid axis offset within shape range on divided axis",
463 "----- STEP is the division step. START+NDIV*STEP must be in range also",
464 "----- If START and STEP are omitted, all range of the axis will be divided"});
465// SavePicture("cone",c,vol,iaxis,step);
466}
467
468//______________________________________________________________________________
469void coneseg(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
470{
471 if (iaxis<0 || iaxis>3) {
472 printf("Wrong division axis. Range is 1-3.\n");
473 return;
474 }
475
476 if (gGeoManager) delete gGeoManager;
477 new TGeoManager("coneseg", "poza5");
478 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
479 TGeoMedium *med = new TGeoMedium("MED",1,mat);
480 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
482 TGeoVolume *vol = gGeoManager->MakeCons("CONESEG",med, 40,30,40,10,20,-30,250);
483 vol->SetLineColor(randomColor());
484// vol->SetLineWidth(2);
485 top->AddNode(vol,1);
486 if (iaxis) {
487 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
488 if (!slice) return;
489 slice->SetLineColor(randomColor());
490 }
493
494 display();
495
496 TGeoConeSeg *coneseg = (TGeoConeSeg*)(vol->GetShape());
497
498 help({ "TGeoConeSeg - coneseg class",
499 AddDbl("fDZ", coneseg->GetDZ(), "half length in Z"),
500 AddDbl("fRmin1",coneseg->GetRmin1(),"inner radius at -dz"),
501 AddDbl("fRmax1",coneseg->GetRmax1(),"outer radius at -dz"),
502 AddDbl("fRmin2",coneseg->GetRmin1(),"inner radius at +dz"),
503 AddDbl("fRmax2",coneseg->GetRmax1(),"outer radius at +dz"),
504 AddDbl("fPhi1",coneseg->GetPhi1(),"first phi limit"),
505 AddDbl("fPhi2",coneseg->GetPhi2(),"second phi limit")},
506 vol, iaxis,
507 {"Execute: coneseg(iaxis, ndiv, start, step) to divide this.",
508 "----- IAXIS can be 2 or 3 (Phi, Z)",
509 "----- NDIV must be a positive integer",
510 "----- START must be a valid axis offset within shape range on divided axis",
511 "----- STEP is the division step. START+NDIV*STEP must be in range also",
512 "----- If START and STEP are omitted, all range of the axis will be divided"});
513// SavePicture("coneseg",c,vol,iaxis,step);
514}
515
516//______________________________________________________________________________
517void eltu(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
518{
519 if (gGeoManager) delete gGeoManager;
520 new TGeoManager("eltu", "poza6");
521 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
522 TGeoMedium *med = new TGeoMedium("MED",1,mat);
523 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
525 TGeoVolume *vol = gGeoManager->MakeEltu("ELTU",med, 30,10,40);
526 vol->SetLineColor(randomColor());
527// vol->SetLineWidth(2);
528 top->AddNode(vol,1);
529 if (iaxis) {
530 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
531 if (!slice) return;
532 slice->SetLineColor(randomColor());
533 }
536
537 display();
538
539 TGeoEltu *eltu = (TGeoEltu*)(vol->GetShape());
540
541 help({ "TGeoEltu - eltu class",
542 AddDbl("fA",eltu->GetA(), "semi-axis along x"),
543 AddDbl("fB",eltu->GetB(), "semi-axis along y"),
544 AddDbl("fDZ", eltu->GetDZ(), "half length in Z")},
545 vol, iaxis,
546 {"Execute: eltu(iaxis, ndiv, start, step) to divide this.",
547 "----- IAXIS can be 2 or 3 (Phi, Z)",
548 "----- NDIV must be a positive integer",
549 "----- START must be a valid axis offset within shape range on divided axis",
550 "----- STEP is the division step. START+NDIV*STEP must be in range also",
551 "----- If START and STEP are omitted, all range of the axis will be divided"});
552// SavePicture("eltu",c,vol,iaxis,step);
553}
554
555//______________________________________________________________________________
556void sphere(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
557{
558 if (iaxis!=0) {
559 printf("Cannot divide spheres\n");
560 return;
561 }
562
563 if (gGeoManager) delete gGeoManager;
564 new TGeoManager("sphere", "poza7");
565 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
566 TGeoMedium *med = new TGeoMedium("MED",1,mat);
567 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
569 TGeoVolume *vol = gGeoManager->MakeSphere("SPHERE",med, 30,40,60,120,30,240);
570 vol->SetLineColor(randomColor());
571 vol->SetLineWidth(2);
572 top->AddNode(vol,1);
573 if (iaxis) {
574 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
575 if (!slice) return;
576 slice->SetLineColor(randomColor());
577 }
580
581 display();
582
583 TGeoSphere *sphere = (TGeoSphere*)(vol->GetShape());
584
585 help({ "TGeoSphere- sphere class",
586 AddDbl("fRmin",sphere->GetRmin(),"inner radius"),
587 AddDbl("fRmax",sphere->GetRmax(),"outer radius"),
588 AddDbl("fTheta1",sphere->GetTheta1(),"lower theta limit"),
589 AddDbl("fTheta2",sphere->GetTheta2(),"higher theta limit"),
590 AddDbl("fPhi1",sphere->GetPhi1(),"lower phi limit"),
591 AddDbl("fPhi2",sphere->GetPhi2(),"higher phi limit")},
592 vol, iaxis);
593// SavePicture("sphere",c,vol,iaxis,step);
594}
595
596//______________________________________________________________________________
597void torus(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
598{
599 if (iaxis!=0) {
600 printf("Cannot divide a torus\n");
601 return;
602 }
603
604 if (gGeoManager) delete gGeoManager;
605 new TGeoManager("torus", "poza2");
606 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
607 TGeoMedium *med = new TGeoMedium("MED",1,mat);
608 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
610 TGeoVolume *vol = gGeoManager->MakeTorus("TORUS",med, 40,20,25,0,270);
611 vol->SetLineColor(randomColor());
612 top->AddNode(vol,1);
613 if (iaxis) {
614 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
615 if (!slice) return;
616 slice->SetLineColor(2);
617 }
620
621 display();
622
623 TGeoTorus *tor = (TGeoTorus*)(vol->GetShape());
624
625 help({ "TGeoTorus - torus class",
626 AddDbl("fR",tor->GetR(),"radius of the ring"),
627 AddDbl("fRmin",tor->GetRmin(),"minimum radius"),
628 AddDbl("fRmax",tor->GetRmax(),"maximum radius"),
629 AddDbl("fPhi1", tor->GetPhi1(), "starting phi angle"),
630 AddDbl("fDphi", tor->GetDphi(), "phi range")},
631 vol, iaxis);
632}
633
634//______________________________________________________________________________
635void trd1(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
636{
637 if (iaxis<0 || iaxis>3) {
638 printf("Wrong division axis. Range is 1-3.\n");
639 return;
640 } else if (iaxis==1) {
641 printf("Cannot divide trd1 on X axis\n");
642 return;
643 }
644
645
646 if (gGeoManager) delete gGeoManager;
647 new TGeoManager("trd1", "poza8");
648 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
649 TGeoMedium *med = new TGeoMedium("MED",1,mat);
650 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
652 TGeoVolume *vol = gGeoManager->MakeTrd1("Trd1",med, 10,20,30,40);
653 vol->SetLineColor(randomColor());
654 vol->SetLineWidth(2);
655 top->AddNode(vol,1);
656 if (iaxis) {
657 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
658 if (!slice) return;
659 slice->SetLineColor(randomColor());
660 }
663
664 display();
665
666 TGeoTrd1 *trd1 = (TGeoTrd1*)(vol->GetShape());
667
668 help({ "TGeoTrd1 - Trd1 class",
669 AddDbl("fDx1",trd1->GetDx1(),"half length in X at lower Z surface(-dz)"),
670 AddDbl("fDx2",trd1->GetDx2(),"half length in X at higher Z surface(+dz)"),
671 AddDbl("fDy",trd1->GetDy(),"half length in Y"),
672 AddDbl("fDz",trd1->GetDz(),"half length in Z")},
673 vol, iaxis,
674 {"Execute: trd1(iaxis, ndiv, start, step) to divide this.",
675 "----- IAXIS can be 2 or 3 (Y, Z)",
676 "----- NDIV must be a positive integer",
677 "----- START must be a valid axis offset within shape range on divided axis",
678 "----- STEP is the division step. START+NDIV*STEP must be in range also",
679 "----- If START and STEP are omitted, all range of the axis will be divided"});
680// SavePicture("trd1",c,vol,iaxis,step);
681 }
682
683//______________________________________________________________________________
684void parab()
685{
686 if (gGeoManager) delete gGeoManager;
687 new TGeoManager("parab", "paraboloid");
688 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
689 TGeoMedium *med = new TGeoMedium("MED",1,mat);
690 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
692 TGeoVolume *vol = gGeoManager->MakeParaboloid("PARAB",med,0, 40, 50);
693 TGeoParaboloid *par = (TGeoParaboloid*)vol->GetShape();
694 vol->SetLineColor(randomColor());
695 vol->SetLineWidth(2);
696 top->AddNode(vol,1);
699
700 display();
701
702 help({ "TGeoParaboloid - Paraboloid class",
703 AddDbl("fRlo",par->GetRlo(),"radius at Z=-dz"),
704 AddDbl("fRhi",par->GetRhi(),"radius at Z=+dz"),
705 AddDbl("fDz",par->GetDz(),"half-length on Z axis"),
706 "----- A paraboloid is described by the equation:",
707 "----- z = a*r*r + b; where: r = x*x + y*y",
708 "----- Create with: TGeoParaboloid *parab = new TGeoParaboloid(rlo, rhi, dz);",
709 "----- dz: half-length in Z (range from -dz to +dz",
710 "----- rlo: radius at z=-dz given by: -dz = a*rlo*rlo + b",
711 "----- rhi: radius at z=+dz given by: dz = a*rhi*rhi + b",
712 "----- rlo != rhi; both >= 0"});
713}
714
715//______________________________________________________________________________
716void hype()
717{
718 if (gGeoManager) delete gGeoManager;
719 new TGeoManager("hype", "hyperboloid");
720 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
721 TGeoMedium *med = new TGeoMedium("MED",1,mat);
722 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
724 TGeoVolume *vol = gGeoManager->MakeHype("HYPE",med,10, 45 ,20,45,40);
725 TGeoHype *hype = (TGeoHype*)vol->GetShape();
726 vol->SetLineColor(randomColor());
727 vol->SetLineWidth(2);
728 top->AddNode(vol,1);
731
732 display();
733
734 help({ "TGeoHype - Hyperboloid class",
735 AddDbl("fRmin",hype->GetRmin(),"minimum inner radius"),
736 AddDbl("fStIn",hype->GetStIn(),"inner surface stereo angle [deg]"),
737 AddDbl("fRmax",hype->GetRmax(),"minimum outer radius"),
738 AddDbl("fStOut",hype->GetStOut(),"outer surface stereo angle [deg]"),
739 AddDbl("fDz",hype->GetDz(),"half-length on Z axis"),
740 "----- A hyperboloid is described by the equation:",
741 "----- r^2 - (tan(stereo)*z)^2 = rmin^2; where: r = x*x + y*y",
742 "----- Create with: TGeoHype *hype = new TGeoHype(rin, stin, rout, stout, dz);",
743 "----- rin < rout; rout > 0",
744 "----- rin = 0; stin > 0 => inner surface conical",
745 "----- stin/stout = 0 => corresponding surface cylindrical"});
746}
747
748//______________________________________________________________________________
749void pcon(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
750{
751 if (iaxis<0 || iaxis>3) {
752 printf("Wrong division axis. Range is 1-3.\n");
753 return;
754 } else if (iaxis==1) {
755 printf("Cannot divide pcon on Rxy\n");
756 return;
757 }
758
759 if (gGeoManager) delete gGeoManager;
760 new TGeoManager("pcon", "poza10");
761 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
762 TGeoMedium *med = new TGeoMedium("MED",1,mat);
763 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
765 TGeoVolume *vol = gGeoManager->MakePcon("PCON",med, -30.0,300,4);
766 TGeoPcon *pcon = (TGeoPcon*)(vol->GetShape());
767 pcon->DefineSection(0,0,15,20);
768 pcon->DefineSection(1,20,15,20);
769 pcon->DefineSection(2,20,15,25);
770 pcon->DefineSection(3,50,15,20);
771 vol->SetLineColor(randomColor());
772 vol->SetLineWidth(2);
773 top->AddNode(vol,1);
774 if (iaxis) {
775 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
776 if (!slice) return;
777 slice->SetLineColor(randomColor());
778 }
781
782 display();
783
784 std::vector<std::string> lines = { "TGeoPcon - pcon class",
785 AddDbl("fPhi1",pcon->GetPhi1(),"lower phi limit"),
786 AddDbl("fDphi",pcon->GetDphi(),"phi range"),
787 AddDbl("fNz",pcon->GetNz(),"number of z planes")};
788
789 for (Int_t j=0; j<pcon->GetNz(); j++)
790 lines.emplace_back(Form("fZ[%i]=%5.2f fRmin[%i]=%5.2f fRmax[%i]=%5.2f",
791 j,pcon->GetZ()[j],j,pcon->GetRmin()[j],j,pcon->GetRmax()[j]));
792
793 help(lines, vol, iaxis,
794 {"Execute: pcon(iaxis, ndiv, start, step) to divide this.",
795 "----- IAXIS can be 2 or 3 (Phi, Z)",
796 "----- NDIV must be a positive integer",
797 "----- START must be a valid axis offset within shape range on divided axis",
798 "----- STEP is the division step. START+NDIV*STEP must be in range also",
799 "----- If START and STEP are omitted, all range of the axis will be divided"});
800// SavePicture("pcon",c,vol,iaxis,step);
801}
802
803//______________________________________________________________________________
804void pgon(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
805{
806 if (iaxis<0 || iaxis>3) {
807 printf("Wrong division axis. Range is 1-3.\n");
808 return;
809 } else if (iaxis==1) {
810 printf("Cannot divide pgon on Rxy\n");
811 return;
812 }
813
814 if (gGeoManager) delete gGeoManager;
815 new TGeoManager("pgon", "poza11");
816 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
817 TGeoMedium *med = new TGeoMedium("MED",1,mat);
818 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,150,150,100);
820 TGeoVolume *vol = gGeoManager->MakePgon("PGON",med, -45.0,270.0,4,4);
821 TGeoPgon *pgon = (TGeoPgon*)(vol->GetShape());
822 pgon->DefineSection(0,-70,45,50);
823 pgon->DefineSection(1,0,35,40);
824 pgon->DefineSection(2,0,30,35);
825 pgon->DefineSection(3,70,90,100);
826 vol->SetLineColor(randomColor());
827 vol->SetLineWidth(2);
828 top->AddNode(vol,1);
829 if (iaxis) {
830 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
831 if (!slice) return;
832 slice->SetLineColor(randomColor());
833 }
836
837 display();
838
839 std::vector<std::string> lines({ "TGeoPgon - pgon class",
840 AddDbl("fPhi1",pgon->GetPhi1(),"lower phi limit"),
841 AddDbl("fDphi",pgon->GetDphi(),"phi range"),
842 AddDbl("fNedges",pgon->GetNedges(),"number of edges"),
843 AddDbl("fNz",pgon->GetNz(),"number of z planes")});
844
845 for (Int_t j=0; j<pgon->GetNz(); j++)
846 lines.emplace_back(Form("fZ[%i]=%5.2f fRmin[%i]=%5.2f fRmax[%i]=%5.2f",
847 j,pgon->GetZ()[j],j,pgon->GetRmin()[j],j,pgon->GetRmax()[j]));
848
849 help(lines, vol, iaxis,
850 {"Execute: pgon(iaxis, ndiv, start, step) to divide this.",
851 "----- IAXIS can be 2 or 3 (Phi, Z)",
852 "----- NDIV must be a positive integer",
853 "----- START must be a valid axis offset within shape range on divided axis",
854 "----- STEP is the division step. START+NDIV*STEP must be in range also",
855 "----- If START and STEP are omitted, all range of the axis will be divided"});
856
857 // SavePicture("pgon",c,vol,iaxis,step);
858}
859
860//______________________________________________________________________________
861void arb8(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
862{
863 if (iaxis!=0) {
864 printf("Cannot divide arb8\n");
865 return;
866 }
867
868 if (gGeoManager) delete gGeoManager;
869 new TGeoManager("arb8", "poza12");
870 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
871 TGeoMedium *med = new TGeoMedium("MED",1,mat);
872 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
874 TGeoArb8 *arb = new TGeoArb8(20);
875 arb->SetVertex(0,-30,-25);
876 arb->SetVertex(1,-25,25);
877 arb->SetVertex(2,5,25);
878 arb->SetVertex(3,25,-25);
879 arb->SetVertex(4,-28,-23);
880 arb->SetVertex(5,-23,27);
881 arb->SetVertex(6,-23,27);
882 arb->SetVertex(7,13,-27);
883 TGeoVolume *vol = new TGeoVolume("ARB8",arb,med);
884 vol->SetLineColor(randomColor());
885 vol->SetLineWidth(2);
886 top->AddNode(vol,1);
887 if (iaxis) {
888 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
889 if (!slice) return;
890 slice->SetLineColor(randomColor());
891 }
894
895 display();
896
897 std::vector<std::string> lines({"TGeoArb8 - arb8 class",
898 AddDbl("fDz",arb->GetDz(),"Z half length"),
899 "Vertices on lower Z plane:"});
900
901 Double_t *vert = arb->GetVertices();
902 for (Int_t i=0; i<8; i++) {
903 if (i==4) lines.emplace_back("Vertices on higher Z plane:");
904 lines.emplace_back(Form(" fXY[%d] = (%5.2f, %5.2f)", i, vert[2*i], vert[2*i+1]));
905 }
906
907 help(lines, vol, iaxis);
908// SavePicture("arb8",c,vol,iaxis,step);
909}
910
911//______________________________________________________________________________
912void trd2(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
913{
914 if (iaxis && iaxis!=3) {
915 printf("Wrong division axis. trd2 can divide only in Z (3)\n");
916 return;
917 }
918
919 if (gGeoManager) delete gGeoManager;
920 new TGeoManager("trd2", "poza9");
921 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
922 TGeoMedium *med = new TGeoMedium("MED",1,mat);
923 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
925 TGeoVolume *vol = gGeoManager->MakeTrd2("Trd2",med, 10,20,30,10,40);
926 vol->SetLineColor(randomColor());
927 vol->SetLineWidth(2);
928 top->AddNode(vol,1);
929 if (iaxis) {
930 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
931 if (!slice) return;
932 slice->SetLineColor(randomColor());
933 }
936
937 display();
938
939 TGeoTrd2 *trd2 = (TGeoTrd2*)(vol->GetShape());
940
941 help({ "TGeoTrd2 - Trd2 class",
942 AddDbl("fDx1",trd2->GetDx1(),"half length in X at lower Z surface(-dz)"),
943 AddDbl("fDx2",trd2->GetDx2(),"half length in X at higher Z surface(+dz)"),
944 AddDbl("fDy1",trd2->GetDy1(),"half length in Y at lower Z surface(-dz)"),
945 AddDbl("fDy2",trd2->GetDy2(),"half length in Y at higher Z surface(-dz)"),
946 AddDbl("fDz",trd2->GetDz(),"half length in Z")},
947 vol, iaxis,
948 {"Execute: trd2(iaxis, ndiv, start, step) to divide this.",
949 "----- IAXIS can be only 3 (Z)",
950 "----- NDIV must be a positive integer",
951 "----- START must be a valid axis offset within shape range on divided axis",
952 "----- STEP is the division step. START+NDIV*STEP must be in range also",
953 "----- If START and STEP are omitted, all range of the axis will be divided"});
954// SavePicture("trd2",c,vol,iaxis,step);
955}
956
957//______________________________________________________________________________
958void trap(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
959{
960 if (iaxis && iaxis!=3) {
961 printf("Wrong division axis. Can divide only in Z (3)\n");
962 return;
963 }
964
965 if (gGeoManager) delete gGeoManager;
966 new TGeoManager("trap", "poza10");
967 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
968 TGeoMedium *med = new TGeoMedium("MED",1,mat);
969 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
971 TGeoVolume *vol = gGeoManager->MakeTrap("Trap",med, 30,15,30,20,10,15,0,20,10,15,0);
972 vol->SetLineColor(randomColor());
973 vol->SetLineWidth(2);
974 top->AddNode(vol,1);
975 if (iaxis) {
976 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
977 if (!slice) return;
978 slice->SetLineColor(randomColor());
979 }
982
983 display();
984
985 TGeoTrap *trap = (TGeoTrap*)(vol->GetShape());
986
987 help({ "TGeoTrap - Trapezoid class",
988 AddDbl("fDz",trap->GetDz(),"half length in Z"),
989 AddDbl("fTheta",trap->GetTheta(),"theta angle of trapezoid axis"),
990 AddDbl("fPhi",trap->GetPhi(),"phi angle of trapezoid axis"),
991 AddDbl("fH1",trap->GetH1(),"half length in y at -fDz"),
992 AddDbl("fAlpha1",trap->GetAlpha1(),"angle between centers of x edges and y axis at -fDz"),
993 AddDbl("fBl1",trap->GetBl1(),"half length in x at -dZ and y=-fH1"),
994 AddDbl("fTl1",trap->GetTl1(),"half length in x at -dZ and y=+fH1"),
995 AddDbl("fH2",trap->GetH2(),"half length in y at +fDz"),
996 AddDbl("fBl2",trap->GetBl2(),"half length in x at +dZ and y=-fH1"),
997 AddDbl("fTl2",trap->GetTl2(),"half length in x at +dZ and y=+fH1"),
998 AddDbl("fAlpha2",trap->GetAlpha2(),"angle between centers of x edges and y axis at +fDz")},
999 vol, iaxis,
1000 {"Execute: trap(iaxis, ndiv, start, step) to divide this.",
1001 "----- IAXIS can be only 3 (Z)",
1002 "----- NDIV must be a positive integer",
1003 "----- START must be a valid axis offset within shape range on divided axis",
1004 "----- STEP is the division step. START+NDIV*STEP must be in range also",
1005 "----- If START and STEP are omitted, all range of the axis will be divided"});
1006// SavePicture("trap",c,vol,iaxis,step);
1007}
1008
1009//______________________________________________________________________________
1010void gtra(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
1011{
1012 if (iaxis && iaxis!=3) {
1013 printf("Wrong division axis. Can divide only in Z (3)\n");
1014 return;
1015 }
1016
1017 if (gGeoManager) delete gGeoManager;
1018 new TGeoManager("gtra", "poza11");
1019 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
1020 TGeoMedium *med = new TGeoMedium("MED",1,mat);
1021 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
1023 TGeoVolume *vol = gGeoManager->MakeGtra("Gtra",med, 30,15,30,30,20,10,15,0,20,10,15,0);
1024 vol->SetLineColor(randomColor());
1025 vol->SetLineWidth(2);
1026 top->AddNode(vol,1);
1027 if (iaxis) {
1028 TGeoVolume *slice = vol->Divide("SLICE",iaxis,ndiv,start,step);
1029 if (!slice) return;
1030 slice->SetLineColor(randomColor());
1031 }
1034
1035 display();
1036
1037 TGeoGtra *trap = (TGeoGtra*)(vol->GetShape());
1038
1039 help({ "TGeoGtra - Twisted trapezoid class",
1040 AddDbl("fDz",trap->GetDz(),"half length in Z"),
1041 AddDbl("fTheta",trap->GetTheta(),"theta angle of trapezoid axis"),
1042 AddDbl("fPhi",trap->GetPhi(),"phi angle of trapezoid axis"),
1043 AddDbl("fTwist",trap->GetTwistAngle(), "twist angle"),
1044 AddDbl("fH1",trap->GetH1(),"half length in y at -fDz"),
1045 AddDbl("fAlpha1",trap->GetAlpha1(),"angle between centers of x edges and y axis at -fDz"),
1046 AddDbl("fBl1",trap->GetBl1(),"half length in x at -dZ and y=-fH1"),
1047 AddDbl("fTl1",trap->GetTl1(),"half length in x at -dZ and y=+fH1"),
1048 AddDbl("fH2",trap->GetH2(),"half length in y at +fDz"),
1049 AddDbl("fBl2",trap->GetBl2(),"half length in x at +dZ and y=-fH1"),
1050 AddDbl("fTl2",trap->GetTl2(),"half length in x at +dZ and y=+fH1"),
1051 AddDbl("fAlpha2",trap->GetAlpha2(),"angle between centers of x edges and y axis at +fDz")},
1052 vol, iaxis,
1053 {"Execute: gtra(iaxis, ndiv, start, step) to divide this.",
1054 "----- IAXIS can be only 3 (Z)",
1055 "----- NDIV must be a positive integer",
1056 "----- START must be a valid axis offset within shape range on divided axis",
1057 "----- STEP is the division step. START+NDIV*STEP must be in range also",
1058 "----- If START and STEP are omitted, all range of the axis will be divided"});
1059// SavePicture("gtra",c,vol,iaxis,step);
1060}
1061
1062//______________________________________________________________________________
1063void xtru()
1064{
1065 if (gGeoManager) delete gGeoManager;
1066 new TGeoManager("xtru", "poza12");
1067 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
1068 TGeoMedium *med = new TGeoMedium("MED",1,mat);
1069 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
1071 TGeoVolume *vol = gGeoManager->MakeXtru("XTRU",med,4);
1072 TGeoXtru *xtru = (TGeoXtru*)vol->GetShape();
1073 Double_t x[8] = {-30,-30,30,30,15,15,-15,-15};
1074 Double_t y[8] = {-30,30,30,-30,-30,15,15,-30};
1075 xtru->DefinePolygon(8,x,y);
1076 xtru->DefineSection(0,-40, -20., 10., 1.5);
1077 xtru->DefineSection(1, 10, 0., 0., 0.5);
1078 xtru->DefineSection(2, 10, 0., 0., 0.7);
1079 xtru->DefineSection(3, 40, 10., 20., 0.9);
1080 vol->SetLineColor(randomColor());
1081 vol->SetLineWidth(2);
1082 top->AddNode(vol,1);
1085
1086 display();
1087
1088 help({ "TGeoXtru - Polygonal extrusion class",
1089 AddDbl("fNvert",xtru->GetNvert(),"number of polygone vertices"),
1090 AddDbl("fNz",xtru->GetNz(),"number of Z sections"),
1091 "----- Any Z section is an arbitrary polygone",
1092 "----- The shape can have an arbitrary number of Z sections, as for pcon/pgon",
1093 "----- Create with: TGeoXtru *xtru = new TGeoXtru(nz);",
1094 "----- Define the blueprint polygon :",
1095 "----- Double_t x[8] = {-30,-30,30,30,15,15,-15,-15};",
1096 "----- Double_t y[8] = {-30,30,30,-30,-30,15,15,-30};",
1097 "----- xtru->DefinePolygon(8,x,y);",
1098 "----- Define translations/scales of the blueprint for Z sections :",
1099 "----- xtru->DefineSection(i, Zsection, x0, y0, scale);",
1100 "----- Sections have to be defined in increasing Z order",
1101 "----- 2 sections can be defined at same Z (not for first/last sections)"});
1102}
1103
1104
1105//______________________________________________________________________________
1106void tessellated()
1107{
1108 if (gGeoManager) delete gGeoManager;
1109 new TGeoManager("tessellated", "tessellated");
1110 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
1111 TGeoMedium *med = new TGeoMedium("MED",1,mat);
1112 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,10,10,10);
1114 TGeoTessellated *tsl = new TGeoTessellated("triaconthaedron", 30);
1115 const Double_t sqrt5 = TMath::Sqrt(5.);
1116 std::vector<Tessellated::Vertex_t> vert;
1117 vert.reserve(120);
1118 vert.emplace_back(0, 0.5 * (1 + sqrt5), -1); vert.emplace_back(0, 0.5 * (-1 + sqrt5), 0.5 * (-1 - sqrt5)); vert.emplace_back(-1, 0, 0.5 * (-1 - sqrt5)); vert.emplace_back(-1, 1, -1);
1119 vert.emplace_back(1, 1, -1); vert.emplace_back(0, 0.5 * (1 + sqrt5), -1); vert.emplace_back(0, 0.5 * (-1 + sqrt5), 0.5 * (-1 - sqrt5)); vert.emplace_back(1, 0, 0.5 * (-1 - sqrt5));
1120 vert.emplace_back(1, 1, -1); vert.emplace_back(0, 0.5 * (1 + sqrt5), -1); vert.emplace_back(0.5 * (-1 + sqrt5), 0.5 * (1 + sqrt5), 0); vert.emplace_back(0.5 * (1 + sqrt5), 1, 0);
1121 vert.emplace_back(0.5 * (1 - sqrt5), 0.5 * (1 + sqrt5), 0); vert.emplace_back(0, 0.5 * (1 + sqrt5), -1); vert.emplace_back(0.5 * (-1 + sqrt5), 0.5 * (1 + sqrt5), 0); vert.emplace_back(0, 0.5 * (1 + sqrt5), 1);
1122 vert.emplace_back(0.5 * (1 - sqrt5), 0.5 * (1 + sqrt5), 0); vert.emplace_back(0, 0.5 * (1 + sqrt5), -1); vert.emplace_back(-1, 1, -1); vert.emplace_back(0.5 * (-1 - sqrt5), 1, 0);
1123 vert.emplace_back(1, 1, -1); vert.emplace_back(0.5 * (1 + sqrt5), 1, 0); vert.emplace_back(0.5 * (1 + sqrt5), 0, 0.5 * (1 - sqrt5)); vert.emplace_back(1, 0, 0.5 * (-1 - sqrt5));
1124 vert.emplace_back(0.5 * (1 + sqrt5), 0, 0.5 * (1 - sqrt5)); vert.emplace_back(0.5 * (1 + sqrt5), -1, 0); vert.emplace_back(1, -1, -1); vert.emplace_back(1, 0, 0.5 * (-1 - sqrt5));
1125 vert.emplace_back(1, -1, -1); vert.emplace_back(0, 0.5 * (-1 - sqrt5), -1); vert.emplace_back(0, 0.5 * (1 - sqrt5), 0.5 * (-1 - sqrt5)); vert.emplace_back(1, 0, 0.5 * (-1 - sqrt5));
1126 vert.emplace_back(1, 0, 0.5 * (-1 - sqrt5)); vert.emplace_back(0, 0.5 * (-1 + sqrt5), 0.5 * (-1 - sqrt5)); vert.emplace_back(-1, 0, 0.5 * (-1 - sqrt5)); vert.emplace_back(0, 0.5 * (1 - sqrt5), 0.5 * (-1 - sqrt5));
1127 vert.emplace_back(0.5 * (-1 + sqrt5), 0.5 * (1 + sqrt5), 0); vert.emplace_back(0.5 * (1 + sqrt5), 1, 0); vert.emplace_back(1, 1, 1); vert.emplace_back(0, 0.5 * (1 + sqrt5), 1);
1128 vert.emplace_back(0.5 * (1 + sqrt5), 1, 0); vert.emplace_back(1, 1, 1); vert.emplace_back(1, 0, 0.5 * (1 + sqrt5)); vert.emplace_back(0.5 * (1 + sqrt5), 0, 0.5 * (-1 + sqrt5));
1129 vert.emplace_back(0.5 * (1 + sqrt5), 0, 0.5 * (1 - sqrt5)); vert.emplace_back(0.5 * (1 + sqrt5), 1, 0); vert.emplace_back(0.5 * (1 + sqrt5), 0, 0.5 * (-1 + sqrt5)); vert.emplace_back(0.5 * (1 + sqrt5), -1, 0);
1130 vert.emplace_back(0.5 * (1 - sqrt5), 0.5 * (1 + sqrt5), 0); vert.emplace_back(0, 0.5 * (1 + sqrt5), 1); vert.emplace_back(-1, 1, 1); vert.emplace_back(0.5 * (-1 - sqrt5), 1, 0);
1131 vert.emplace_back(0, 0.5 * (1 + sqrt5), 1); vert.emplace_back(0, 0.5 * (-1 + sqrt5), 0.5 * (1 + sqrt5)); vert.emplace_back(-1, 0, 0.5 * (1 + sqrt5)); vert.emplace_back(-1, 1, 1);
1132 vert.emplace_back(1, 1, 1); vert.emplace_back(0, 0.5 * (1 + sqrt5), 1); vert.emplace_back(0, 0.5 * (-1 + sqrt5), 0.5 * (1 + sqrt5)); vert.emplace_back(1, 0, 0.5 * (1 + sqrt5));
1133 vert.emplace_back(0, 0.5 * (1 - sqrt5), 0.5 * (1 + sqrt5)); vert.emplace_back(-1, 0, 0.5 * (1 + sqrt5)); vert.emplace_back(0, 0.5 * (-1 + sqrt5), 0.5 * (1 + sqrt5)); vert.emplace_back(1, 0, 0.5 * (1 + sqrt5));
1134 vert.emplace_back(0, 0.5 * (1 - sqrt5), 0.5 * (1 + sqrt5)); vert.emplace_back(1, 0, 0.5 * (1 + sqrt5)); vert.emplace_back(1, -1, 1); vert.emplace_back(0, 0.5 * (-1 - sqrt5), 1);
1135 vert.emplace_back(0.5 * (1 + sqrt5), 0, 0.5 * (-1 + sqrt5)); vert.emplace_back(0.5 * (1 + sqrt5), -1, 0); vert.emplace_back(1, -1, 1); vert.emplace_back(1, 0, 0.5 * (1 + sqrt5));
1136 vert.emplace_back(-1, 0, 0.5 * (1 + sqrt5)); vert.emplace_back(-1, 1, 1); vert.emplace_back(0.5 * (-1 - sqrt5), 1, 0); vert.emplace_back(0.5 * (-1 - sqrt5), 0, 0.5 * (-1 + sqrt5));
1137 vert.emplace_back(-1, -1, 1); vert.emplace_back(-1, 0, 0.5 * (1 + sqrt5)); vert.emplace_back(0.5 * (-1 - sqrt5), 0, 0.5 * (-1 + sqrt5)); vert.emplace_back(0.5 * (-1 - sqrt5), -1, 0);
1138 vert.emplace_back(0, 0.5 * (1 - sqrt5), 0.5 * (1 + sqrt5)); vert.emplace_back(-1, 0, 0.5 * (1 + sqrt5)); vert.emplace_back(-1, -1, 1); vert.emplace_back(0, 0.5 * (-1 - sqrt5), 1);
1139 vert.emplace_back(0.5 * (-1 - sqrt5), -1, 0); vert.emplace_back(0.5 * (-1 - sqrt5), 0, 0.5 * (1 - sqrt5)); vert.emplace_back(0.5 * (-1 - sqrt5), 1, 0); vert.emplace_back(0.5 * (-1 - sqrt5), 0, 0.5 * (-1 + sqrt5));
1140 vert.emplace_back(0.5 * (-1 - sqrt5), -1, 0); vert.emplace_back(0.5 * (-1 - sqrt5), 0, 0.5 * (1 - sqrt5)); vert.emplace_back(-1, 0, 0.5 * (-1 - sqrt5)); vert.emplace_back(-1, -1, -1);
1141 vert.emplace_back(0, 0.5 * (-1 - sqrt5), -1); vert.emplace_back(0.5 * (1 - sqrt5), 0.5 * (-1 - sqrt5), 0); vert.emplace_back(0.5 * (-1 - sqrt5), -1, 0); vert.emplace_back(-1, -1, -1);
1142 vert.emplace_back(0.5 * (1 - sqrt5), 0.5 * (-1 - sqrt5), 0); vert.emplace_back(0.5 * (-1 - sqrt5), -1, 0); vert.emplace_back(-1, -1, 1); vert.emplace_back(0, 0.5 * (-1 - sqrt5), 1);
1143 vert.emplace_back(-1, 1, -1); vert.emplace_back(-1, 0, 0.5 * (-1 - sqrt5)); vert.emplace_back(0.5 * (-1 - sqrt5), 0, 0.5 * (1 - sqrt5)); vert.emplace_back(0.5 * (-1 - sqrt5), 1, 0);
1144 vert.emplace_back(0, 0.5 * (-1 - sqrt5), -1); vert.emplace_back(0, 0.5 * (1 - sqrt5), 0.5 * (-1 - sqrt5)); vert.emplace_back(-1, 0, 0.5 * (-1 - sqrt5)); vert.emplace_back(-1, -1, -1);
1145 vert.emplace_back(0, 0.5 * (-1 - sqrt5), -1); vert.emplace_back(0.5 * (1 - sqrt5), 0.5 * (-1 - sqrt5), 0); vert.emplace_back(0, 0.5 * (-1 - sqrt5), 1); vert.emplace_back(0.5 * (-1 + sqrt5), 0.5 * (-1 - sqrt5), 0);
1146 vert.emplace_back(1, -1, -1); vert.emplace_back(0.5 * (1 + sqrt5), -1, 0); vert.emplace_back(0.5 * (-1 + sqrt5), 0.5 * (-1 - sqrt5), 0); vert.emplace_back(0, 0.5 * (-1 - sqrt5), -1);
1147 vert.emplace_back(0.5 * (1 + sqrt5), -1, 0); vert.emplace_back(1, -1, 1); vert.emplace_back(0, 0.5 * (-1 - sqrt5), 1); vert.emplace_back(0.5 * (-1 + sqrt5), 0.5 * (-1 - sqrt5), 0);
1148
1149 tsl->AddFacet(vert[0], vert[1], vert[2], vert[3]);
1150 tsl->AddFacet(vert[4], vert[7], vert[6], vert[5]);
1151 tsl->AddFacet(vert[8], vert[9], vert[10], vert[11]);
1152 tsl->AddFacet(vert[12], vert[15], vert[14], vert[13]);
1153 tsl->AddFacet(vert[16], vert[17], vert[18], vert[19]);
1154 tsl->AddFacet(vert[20], vert[21], vert[22], vert[23]);
1155 tsl->AddFacet(vert[24], vert[25], vert[26], vert[27]);
1156 tsl->AddFacet(vert[28], vert[29], vert[30], vert[31]);
1157 tsl->AddFacet(vert[32], vert[35], vert[34], vert[33]);
1158 tsl->AddFacet(vert[36], vert[39], vert[38], vert[37]);
1159 tsl->AddFacet(vert[40], vert[41], vert[42], vert[43]);
1160 tsl->AddFacet(vert[44], vert[45], vert[46], vert[47]);
1161 tsl->AddFacet(vert[48], vert[51], vert[50], vert[49]);
1162 tsl->AddFacet(vert[52], vert[55], vert[54], vert[53]);
1163 tsl->AddFacet(vert[56], vert[57], vert[58], vert[59]);
1164 tsl->AddFacet(vert[60], vert[63], vert[62], vert[61]);
1165 tsl->AddFacet(vert[64], vert[67], vert[66], vert[65]);
1166 tsl->AddFacet(vert[68], vert[71], vert[70], vert[69]);
1167 tsl->AddFacet(vert[72], vert[73], vert[74], vert[75]);
1168 tsl->AddFacet(vert[76], vert[77], vert[78], vert[79]);
1169 tsl->AddFacet(vert[80], vert[81], vert[82], vert[83]);
1170 tsl->AddFacet(vert[84], vert[87], vert[86], vert[85]);
1171 tsl->AddFacet(vert[88], vert[89], vert[90], vert[91]);
1172 tsl->AddFacet(vert[92], vert[93], vert[94], vert[95]);
1173 tsl->AddFacet(vert[96], vert[99], vert[98], vert[97]);
1174 tsl->AddFacet(vert[100], vert[101], vert[102], vert[103]);
1175 tsl->AddFacet(vert[104], vert[107], vert[106], vert[105]);
1176 tsl->AddFacet(vert[108], vert[111], vert[110], vert[109]);
1177 tsl->AddFacet(vert[112], vert[113], vert[114], vert[115]);
1178 tsl->AddFacet(vert[116], vert[117], vert[118], vert[119]);
1179
1180 TGeoVolume *vol = new TGeoVolume("TRIACONTHAEDRON", tsl, med);
1181 vol->SetLineColor(randomColor());
1182 vol->SetLineWidth(2);
1183 top->AddNode(vol,1);
1185
1186 display();
1187
1188 help( {"TGeoTessellated - Tessellated shape class",
1189 AddInt("fNfacets",tsl->GetNfacets(),"number of facets"),
1190 AddInt("fNvertices",tsl->GetNvertices(),"number of vertices"),
1191 "----- A tessellated shape is defined by the number of facets",
1192 "----- facets can be added using AddFacet",
1193 "----- Create with: TGeoTessellated *tsl = new TGeoTessellated(nfacets);"});
1194}
1195
1196//______________________________________________________________________________
1197void composite()
1198{
1199
1200 if (gGeoManager) delete gGeoManager;
1201 new TGeoManager("xtru", "poza12");
1202 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
1203 TGeoMedium *med = new TGeoMedium("MED",1,mat);
1204 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100);
1206
1207 // define shape components with names
1208 TGeoPgon *pgon = new TGeoPgon("pg",0.,360.,6,2);
1209 pgon->DefineSection(0,0,0,20);
1210 pgon->DefineSection(1, 30,0,20);
1211
1212 new TGeoSphere("sph", 40., 45.);
1213 // define named geometrical transformations with names
1214 TGeoTranslation *tr = new TGeoTranslation(0., 0., 45.);
1215 tr->SetName("tr");
1216 // register all used transformations
1217 tr->RegisterYourself();
1218 // create the composite shape based on a Boolean expression
1219 TGeoCompositeShape *cs = new TGeoCompositeShape("mir", "sph:tr*pg");
1220
1221 TGeoVolume *vol = new TGeoVolume("COMP",cs);
1222 vol->SetLineColor(randomColor());
1223 top->AddNode(vol,1);
1226
1227 display();
1228
1229 help({ "TGeoCompositeShape - composite shape class",
1230 "----- Define the shape components and don't forget to name them",
1231 "----- Define geometrical transformations that apply to shape components",
1232 "----- Name all transformations and register them",
1233 "----- Define the composite shape based on a Boolean expression",
1234 " TGeoCompositeShape(\"someName\", \"expression\")",
1235 "----- Expression is made of <shapeName:transfName> components related by Boolean operators",
1236 "----- Boolean operators can be: (+) union, (-) subtraction and (*) intersection",
1237 "----- Use parenthesis in the expression to force precedence"});
1238}
1239
1240//______________________________________________________________________________
1241void ideal()
1242{
1243// This is an ideal geometry. In real life, some geometry pieces are moved/rotated
1244// with respect to their ideal positions. This is called alignment. Alignment
1245// operations can be handled by TGeo starting from a CLOSED geometry (applied a posteriori)
1246// Alignment is handled by PHYSICAL NODES, representing an unique object in geometry.
1247//
1248// Creating physical nodes:
1249// 1. TGeoPhysicalNode *node = gGeoManager->MakePhysicalNode(const char *path)
1250// - creates a physical node represented by path
1251// - path can be : TOP_1/A_2/B_3
1252// - B_3 is the 'final node' e.g. the logical node represented by this physical node
1253// 2. TGeoPhysicalNode *node = gGeoManager->MakePhysicalNode()
1254// - creates a physical node representing the current modeller state
1255
1256// Setting visualisation options for TGeoPhysicalNode *node:
1257// 1. node->SetVisibility(Bool_t flag); // set node visible(*) or invisible
1258// 2. node->SetIsVolAtt(Bool_t flag); // set line attributes to match the ones of the volumes in the branch
1259// - default - TRUE
1260// - when called with FALSE - the attributes defined for the physical node will be taken
1261// node->SetLineColor(color);
1262// node->SetLineWidth(width);
1263// node->SetLineStyle(style);
1264// 3. node->SetVisibleFull(Bool_t flag); // not only last node in the branch is visible (default)
1265//
1266// Activating/deactivating physical nodes drawing - not needed in case of alignment
1267
1268// Aligning physical nodes
1269//==========================
1270// node->Align(TGeoMatrix *newmat, TGeoShape *newshape, Bool_t check=kFALSE);
1271// newmat = new matrix to replace final node LOCAL matrix
1272// newshape = new shape to replace final node shape
1273// check = optional check if the new aligned node is overlapping
1274// gGeoManager->SetDrawExtraPaths(Bool_t flag)
1275
1276 if (gGeoManager) delete gGeoManager;
1277 new TGeoManager("alignment", "Ideal geometry");
1278 TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
1279 TGeoMedium *med = new TGeoMedium("MED",1,mat);
1280 TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,10);
1282 TGeoVolume *slicex = top->Divide("SX",1,10,-100,10);
1283 TGeoVolume *slicey = slicex->Divide("SY",2,10,-100,10);
1284 TGeoVolume *vol = gGeoManager->MakePgon("CELL",med,0.,360.,6,2);
1285 TGeoPgon *pgon = (TGeoPgon*)(vol->GetShape());
1286 pgon->DefineSection(0,-5,0.,2.);
1287 pgon->DefineSection(1,5,0.,2.);
1288 vol->SetLineColor(randomColor());
1289 slicey->AddNode(vol,1);
1292
1293 display();
1294
1295 help({ "Ideal / Aligned geometry",
1296 "-- Create physical nodes for the objects you want to align",
1297 "-- You must start from a valid CLOSED geometry",
1298 " TGeoPhysicalNode *node = gGeoManager->MakePhysicalNode(const char *path)",
1299 " + creates a physical node represented by path, e.g. TOP_1/A_2/B_3",
1300 " node->Align(TGeoMatrix *newmat, TGeoShape *newshape, Bool_t check=kFALSE)",
1301 " + newmat = new matrix to replace final node LOCAL matrix",
1302 " + newshape = new shape to replace final node shape",
1303 " + check = optional check if the new aligned node is overlapping"});
1304}
1305
1306//______________________________________________________________________________
1307void align()
1308{
1309 if (!gGeoManager) return;
1310 if (strcmp(gGeoManager->GetName(),"alignment")) {
1311 printf("Click: <Ideal geometry> first\n");
1312 return;
1313 }
1314 char name[30];
1316 TGeoPhysicalNode *node;
1317 TGeoTranslation *tr;
1318 for (Int_t i=1; i<=10; i++) {
1319 for (Int_t j=1; j<=10; j++) {
1320 node = 0;
1321 sprintf(name, "TOP_1/SX_%d/SY_%d/CELL_1",i,j);
1322 if (list) node = (TGeoPhysicalNode*)list->At(10*(i-1)+j-1);
1323 if (!node) node = gGeoManager->MakePhysicalNode(name);
1324 if (node->IsAligned()) {
1325 tr = (TGeoTranslation*)node->GetNode()->GetMatrix();
1326 tr->SetTranslation(2.*gRandom->Rndm(), 2.*gRandom->Rndm(),0.);
1327 } else {
1328 tr = new TGeoTranslation(2.*gRandom->Rndm(), 2.*gRandom->Rndm(),0.);
1329 }
1330 node->Align(tr);
1331 }
1332 }
1333
1334 display();
1335}
1336
1337//______________________________________________________________________________
1338void quit()
1339{
1340 mainWindow->TerminateROOT();
1341}
1342
1343//______________________________________________________________________________
1344void webdemo ()
1345{
1346 // configure default html page
1347 // either HTML code can be specified or just name of file after 'file:' prefix
1348 mainWindow->SetDefaultPage("file:webdemo.html");
1349
1350 // this is call-back, invoked when message received from client
1351 mainWindow->SetDataCallBack([](unsigned connid, const std::string &arg) {
1352 gROOT->ProcessLine(arg.c_str());
1353 });
1354
1355 mainWindow->Show({150,750, 0,0});
1356
1357 geomViewer->SetDrawOptions(getOptions());
1358}
int Int_t
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:92
bool Bool_t
Definition RtypesCore.h:63
double Double_t
Definition RtypesCore.h:59
const Bool_t kTRUE
Definition RtypesCore.h:91
char name[80]
Definition TGX11.cxx:110
R__EXTERN TGeoManager * gGeoManager
#define gROOT
Definition TROOT.h:406
R__EXTERN TRandom * gRandom
Definition TRandom.h:62
char * Form(const char *fmt,...)
static std::shared_ptr< RWebWindow > Create()
Create new RWebWindow Using default RWebWindowsManager.
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.
Double_t GetDz() const
Definition TGeoArb8.h:65
Double_t * GetVertices()
Definition TGeoArb8.h:69
Box class.
Definition TGeoBBox.h:18
virtual const Double_t * GetOrigin() const
Definition TGeoBBox.h:73
virtual Double_t GetDX() const
Definition TGeoBBox.h:70
virtual Double_t GetDZ() const
Definition TGeoBBox.h:72
virtual Double_t GetDY() const
Definition TGeoBBox.h:71
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:146
Double_t GetTwistAngle() const
Definition TGeoArb8.h:168
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:45
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.
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()
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.
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: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:81
Double_t GetDphi() const
Definition TGeoPcon.h:76
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:571
Double_t * GetZ() const
Definition TGeoPcon.h:83
Int_t GetNz() const
Definition TGeoPcon.h:77
Double_t * GetRmin() const
Definition TGeoPcon.h:79
Double_t GetPhi1() const
Definition TGeoPcon.h:75
A polygone.
Definition TGeoPgon.h:21
Int_t GetNedges() const
Definition TGeoPgon.h:83
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
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
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.
TRAP is a general trapezoid, i.e.
Definition TGeoArb8.h:92
Double_t GetTl1() const
Definition TGeoArb8.h:130
Double_t GetPhi() const
Definition TGeoArb8.h:127
Double_t GetAlpha2() const
Definition TGeoArb8.h:135
Double_t GetTheta() const
Definition TGeoArb8.h:126
Double_t GetAlpha1() const
Definition TGeoArb8.h:131
Double_t GetBl2() const
Definition TGeoArb8.h:133
Double_t GetTl2() const
Definition TGeoArb8.h:134
Double_t GetH1() const
Definition TGeoArb8.h:128
Double_t GetH2() const
Definition TGeoArb8.h:132
Double_t GetBl1() const
Definition TGeoArb8.h:129
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:49
virtual TGeoNode * AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=0, Option_t *option="")
Add a TGeoNode to the list of nodes.
TGeoPatternFinder * GetFinder() const
Definition TGeoVolume.h:176
TGeoShape * GetShape() const
Definition TGeoVolume.h:189
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.
An extrusion with fixed outline shape in x-y and a sequence of z extents (segments).
Definition TGeoXtru.h:23
Int_t GetNvert() const
Definition TGeoXtru.h:95
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:657
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:690
Int_t GetNz() const
Definition TGeoXtru.h:94
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:166
Mother of all ROOT objects.
Definition TObject.h:37
virtual Double_t Rndm()
Machine independent random number generator.
Definition TRandom.cxx:552
const char * Data() const
Definition TString.h:369
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:2331
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)
Definition TMath.h:691
Double_t Cos(Double_t)
Definition TMath.h:643
constexpr Double_t Pi()
Definition TMath.h:37
Double_t Sin(Double_t)
Definition TMath.h:639
Definition first.py:1
TCanvas * style()
Definition style.C:1