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