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