53 if (is_raytracing != raytracing) {
61void AddText(
TPaveText *pave,
const char *datamember,
Double_t value,
const char *comment)
64 for (
Int_t i=0; i<128; i++)
line[i] =
' ';
65 memcpy(&
line[0], datamember, strlen(datamember));
68 sprintf(number,
"%5.2f", value);
69 memcpy(&
line[12], number, strlen(number));
72 sprintf(&
line[30],
"%s",comment);
79void AddText(
TPaveText *pave,
const char *datamember,
Int_t value,
const char *comment)
82 for (
Int_t i=0; i<128; i++)
line[i] =
' ';
83 memcpy(&
line[0], datamember, strlen(datamember));
86 sprintf(number,
"%5i", value);
87 memcpy(&
line[12], number, strlen(number));
90 sprintf(&
line[30],
"%s",comment);
101 if (!pave || !pf)
return;
102 for (
Int_t i=0; i<128; i++)
line[i] =
' ';
109 AddText(pave,
"fNdiv",finder->
GetNdiv(),
"number of divisions");
110 AddText(pave,
"fStart",finder->
GetStart(),
"start divisioning position");
111 AddText(pave,
"fStep",finder->
GetStep(),
"division step");
119 if (!
c || !vol)
return;
124 sprintf(fname,
"t_%s.gif",
name);
137 return (1+
Int_t(color));
142 raytracing = !raytracing;
145 if (!painter)
return;
156 new TCanvas(
"chelp",
"Help to run demos",200,10,700,600);
159 welcome->
AddText(
"Welcome to the new geometry package");
168 hdemo->
AddText(
"- Demo for building TGeo basic shapes and simple geometry. Shape parameters are");
169 hdemo->
AddText(
" displayed in the right pad");
170 hdemo->
AddText(
"- Click left mouse button to execute one demo");
171 hdemo->
AddText(
"- While pointing the mouse to the pad containing the geometry, do:");
172 hdemo->
AddText(
"- .... click-and-move to rotate");
173 hdemo->
AddText(
"- .... press j/k to zoom/unzoom");
174 hdemo->
AddText(
"- .... press l/h/u/i to move the view center around");
175 hdemo->
AddText(
"- Click Ray-trace ON/OFF to toggle ray-tracing");
176 hdemo->
AddText(
"- Use <View with x3d> from the <View> menu to get an x3d view");
177 hdemo->
AddText(
"- .... same methods to rotate/zoom/move the view");
178 hdemo->
AddText(
"- Execute box(1,8) to divide a box in 8 equal slices along X");
179 hdemo->
AddText(
"- Most shapes can be divided on X,Y,Z,Rxy or Phi :");
180 hdemo->
AddText(
"- .... root[0] <shape>(IAXIS, NDIV, START, STEP);");
181 hdemo->
AddText(
" .... IAXIS = 1,2,3 meaning (X,Y,Z) or (Rxy, Phi, Z)");
182 hdemo->
AddText(
" .... NDIV = number of slices");
183 hdemo->
AddText(
" .... START = start slicing position");
184 hdemo->
AddText(
" .... STEP = division step");
185 hdemo->
AddText(
"- Click Comments ON/OFF to toggle comments");
186 hdemo->
AddText(
"- Click Ideal/Align geometry to see how alignment works");
214 bar->AddButton(
"How to run ",
"help()",
"Instructions for running this macro");
215 bar->AddButton(
"Arb8 ",
"arb8()",
"An arbitrary polyhedron defined by vertices (max 8) sitting on 2 parallel planes");
216 bar->AddButton(
"Box ",
"box()",
"A box shape.");
217 bar->AddButton(
"Composite ",
"composite()",
"A composite shape");
218 bar->AddButton(
"Cone ",
"cone()",
"A conical tube");
219 bar->AddButton(
"Cone segment",
"coneseg()",
"A conical segment");
220 bar->AddButton(
"Cut tube ",
"ctub()",
"A cut tube segment");
221 bar->AddButton(
"Elliptical tube",
"eltu()",
"An elliptical tube");
222 bar->AddButton(
"Extruded poly",
"xtru()",
"A general polygone extrusion");
223 bar->AddButton(
"Hyperboloid ",
"hype()",
"A hyperboloid");
224 bar->AddButton(
"Paraboloid ",
"parab()",
"A paraboloid");
225 bar->AddButton(
"Polycone ",
"pcon()",
"A polycone shape");
226 bar->AddButton(
"Polygone ",
"pgon()",
"A polygone");
227 bar->AddButton(
"Parallelepiped",
"para()",
"A parallelepiped shape");
228 bar->AddButton(
"Sphere ",
"sphere()",
"A spherical sector");
229 bar->AddButton(
"Trd1 ",
"trd1()",
"A trapezoid with dX varying with Z");
230 bar->AddButton(
"Trd2 ",
"trd2()",
"A trapezoid with both dX and dY varying with Z");
231 bar->AddButton(
"Trapezoid ",
"trap()",
"A general trapezoid");
232 bar->AddButton(
"Torus ",
"torus()",
"A toroidal segment");
233 bar->AddButton(
"Tube ",
"tube()",
"A tube with inner and outer radius");
234 bar->AddButton(
"Tube segment",
"tubeseg()",
"A tube segment");
235 bar->AddButton(
"Twisted trap",
"gtra()",
"A twisted trapezoid");
236 bar->AddButton(
"Aligned (ideal)",
"ideal()",
"An ideal (un-aligned) geometry");
237 bar->AddButton(
"Un-aligned",
"align()",
"Some alignment operation");
238 bar->AddButton(
"RAY-TRACE ON/OFF",
"raytrace()",
"Toggle ray-tracing mode");
239 bar->AddButton(
"COMMENTS ON/OFF",
"comments = !comments;",
"Toggle explanations pad ON/OFF");
240 bar->AddButton(
"AXES ON/OFF",
"axes()",
"Toggle axes ON/OFF");
241 bar->AddButton(
"AUTOROTATE ON/OFF",
"autorotate()",
"Toggle autorotation ON/OFF");
243 gROOT->SaveContext();
260 if (!painter)
return;
270 if (
gROOT->IsInterrupted())
break;
272 if (longit>360) longit -= 360.;
277 view =
gPad->GetView();
301 gROOT->GetListOfCanvases()->Delete();
302 if (iaxis<0 || iaxis>3) {
303 printf(
"Wrong division axis. Range is 1-3.\n");
310 gPad->SetPad(0,0,1,0.4);
312 gPad->SetPad(0,0.4,1,1);
333 if (!comments)
return;
340 AddText(
pt,
"fDX",
box->GetDX(),
"half length in X");
341 AddText(
pt,
"fDY",
box->GetDY(),
"half length in Y");
342 AddText(
pt,
"fDZ",
box->GetDZ(),
"half length in Z");
343 AddText(
pt,
"fOrigin[0]",(
box->GetOrigin())[0],
"box origin on X");
344 AddText(
pt,
"fOrigin[1]",(
box->GetOrigin())[1],
"box origin on Y");
345 AddText(
pt,
"fOrigin[2]",(
box->GetOrigin())[2],
"box origin on Z");
347 pt->
AddText(
"Execute: box(iaxis, ndiv, start, step) to divide this.");
348 pt->
AddText(
"----- IAXIS can be 1, 2 or 3 (X, Y, Z)");
349 pt->
AddText(
"----- NDIV must be a positive integer");
350 pt->
AddText(
"----- START must be a valid axis offset within shape range on divided axis");
351 pt->
AddText(
"----- STEP is the division step. START+NDIV*STEP must be in range also");
352 pt->
AddText(
"----- If START and STEP are omitted, all range of the axis will be divided");
369 gROOT->GetListOfCanvases()->Delete();
374 gPad->SetPad(0,0,1,0.4);
376 gPad->SetPad(0,0.4,1,1);
397 if (!comments)
return;
404 AddText(
pt,
"fX",para->
GetX(),
"half length in X");
405 AddText(
pt,
"fY",para->
GetY(),
"half length in Y");
406 AddText(
pt,
"fZ",para->
GetZ(),
"half length in Z");
407 AddText(
pt,
"fAlpha",para->
GetAlpha(),
"angle about Y of the Z bases");
408 AddText(
pt,
"fTheta",para->
GetTheta(),
"inclination of para axis about Z");
409 AddText(
pt,
"fPhi",para->
GetPhi(),
"phi angle of para axis");
411 pt->
AddText(
"Execute: para(iaxis, ndiv, start, step) to divide this.");
412 pt->
AddText(
"----- IAXIS can be 1, 2 or 3 (X, Y, Z)");
413 pt->
AddText(
"----- NDIV must be a positive integer");
414 pt->
AddText(
"----- START must be a valid axis offset within shape range on divided axis");
415 pt->
AddText(
"----- STEP is the division step. START+NDIV*STEP must be in range also");
416 pt->
AddText(
"----- If START and STEP are omitted, all range of the axis will be divided");
432 gROOT->GetListOfCanvases()->Delete();
433 if (iaxis<0 || iaxis>3) {
434 printf(
"Wrong division axis. Range is 1-3.\n");
441 gPad->SetPad(0,0,1,0.4);
443 gPad->SetPad(0,0.4,1,1);
465 if (!comments)
return;
472 AddText(
pt,
"fRmin",tube->
GetRmin(),
"minimum radius");
473 AddText(
pt,
"fRmax",tube->
GetRmax(),
"maximum radius");
474 AddText(
pt,
"fDZ", tube->
GetDZ(),
"half length in Z");
476 pt->
AddText(
"Execute: tube(iaxis, ndiv, start, step) to divide this.");
477 pt->
AddText(
"----- IAXIS can be 1, 2 or 3 (Rxy, Phi, Z)");
478 pt->
AddText(
"----- NDIV must be a positive integer");
479 pt->
AddText(
"----- START must be a valid axis offset within shape range on divided axis");
480 pt->
AddText(
"----- STEP is the division step. START+NDIV*STEP must be in range also");
481 pt->
AddText(
"----- If START and STEP are omitted, all range of the axis will be divided");
497 gROOT->GetListOfCanvases()->Delete();
498 if (iaxis<0 || iaxis>3) {
499 printf(
"Wrong division axis. Range is 1-3.\n");
502 TCanvas *
c =
new TCanvas(
"tubeseg shape",
"A tube segment ", 700,1000);
506 gPad->SetPad(0,0,1,0.4);
508 gPad->SetPad(0,0.4,1,1);
530 if (!comments)
return;
537 AddText(
pt,
"fRmin",tubeseg->
GetRmin(),
"minimum radius");
538 AddText(
pt,
"fRmax",tubeseg->
GetRmax(),
"maximum radius");
539 AddText(
pt,
"fDZ", tubeseg->
GetDZ(),
"half length in Z");
540 AddText(
pt,
"fPhi1",tubeseg->
GetPhi1(),
"first phi limit");
541 AddText(
pt,
"fPhi2",tubeseg->
GetPhi2(),
"second phi limit");
543 pt->
AddText(
"Execute: tubeseg(iaxis, ndiv, start, step) to divide this.");
544 pt->
AddText(
"----- IAXIS can be 1, 2 or 3 (Rxy, Phi, Z)");
545 pt->
AddText(
"----- NDIV must be a positive integer");
546 pt->
AddText(
"----- START must be a valid axis offset within shape range on divided axis");
547 pt->
AddText(
"----- STEP is the division step. START+NDIV*STEP must be in range also");
548 pt->
AddText(
"----- If START and STEP are omitted, all range of the axis will be divided");
564 gROOT->GetListOfCanvases()->Delete();
565 if (iaxis<0 || iaxis>2) {
566 printf(
"Wrong division axis. Range is 1-2.\n");
569 TCanvas *
c =
new TCanvas(
"ctub shape",
"A cut tube segment ", 700,1000);
573 gPad->SetPad(0,0,1,0.4);
575 gPad->SetPad(0,0.4,1,1);
595 TGeoVolume *vol =
gGeoManager->
MakeCtub(
"CTUB",med, 20,30,40,-30,250, nlow[0], nlow[1], nlow[2], nhi[0],nhi[1],nhi[2]);
609 if (!comments)
return;
616 AddText(
pt,
"fRmin",tubeseg->
GetRmin(),
"minimum radius");
617 AddText(
pt,
"fRmax",tubeseg->
GetRmax(),
"maximum radius");
618 AddText(
pt,
"fDZ", tubeseg->
GetDZ(),
"half length in Z");
619 AddText(
pt,
"fPhi1",tubeseg->
GetPhi1(),
"first phi limit");
620 AddText(
pt,
"fPhi2",tubeseg->
GetPhi2(),
"second phi limit");
633 gROOT->GetListOfCanvases()->Delete();
634 if (iaxis<0 || iaxis>3) {
635 printf(
"Wrong division axis. Range is 1-3.\n");
639 printf(
"cannot divide cone on Rxy\n");
646 gPad->SetPad(0,0,1,0.4);
648 gPad->SetPad(0,0.4,1,1);
669 if (!comments)
return;
676 AddText(
pt,
"fDZ", cone->
GetDZ(),
"half length in Z");
677 AddText(
pt,
"fRmin1",cone->
GetRmin1(),
"inner radius at -dz");
678 AddText(
pt,
"fRmax1",cone->
GetRmax1(),
"outer radius at -dz");
679 AddText(
pt,
"fRmin2",cone->
GetRmin2(),
"inner radius at +dz");
680 AddText(
pt,
"fRmax2",cone->
GetRmax2(),
"outer radius at +dz");
682 pt->
AddText(
"Execute: cone(iaxis, ndiv, start, step) to divide this.");
683 pt->
AddText(
"----- IAXIS can be 2 or 3 (Phi, Z)");
684 pt->
AddText(
"----- NDIV must be a positive integer");
685 pt->
AddText(
"----- START must be a valid axis offset within shape range on divided axis");
686 pt->
AddText(
"----- STEP is the division step. START+NDIV*STEP must be in range also");
687 pt->
AddText(
"----- If START and STEP are omitted, all range of the axis will be divided");
703 gROOT->GetListOfCanvases()->Delete();
704 if (iaxis<0 || iaxis>3) {
705 printf(
"Wrong division axis. Range is 1-3.\n");
712 gPad->SetPad(0,0,1,0.4);
714 gPad->SetPad(0,0.4,1,1);
735 if (!comments)
return;
742 AddText(
pt,
"fDZ", coneseg->
GetDZ(),
"half length in Z");
743 AddText(
pt,
"fRmin1",coneseg->
GetRmin1(),
"inner radius at -dz");
744 AddText(
pt,
"fRmax1",coneseg->
GetRmax1(),
"outer radius at -dz");
745 AddText(
pt,
"fRmin2",coneseg->
GetRmin1(),
"inner radius at +dz");
746 AddText(
pt,
"fRmax2",coneseg->
GetRmax1(),
"outer radius at +dz");
747 AddText(
pt,
"fPhi1",coneseg->
GetPhi1(),
"first phi limit");
748 AddText(
pt,
"fPhi2",coneseg->
GetPhi2(),
"second phi limit");
750 pt->
AddText(
"Execute: coneseg(iaxis, ndiv, start, step) to divide this.");
751 pt->
AddText(
"----- IAXIS can be 2 or 3 (Phi, Z)");
752 pt->
AddText(
"----- NDIV must be a positive integer");
753 pt->
AddText(
"----- START must be a valid axis offset within shape range on divided axis");
754 pt->
AddText(
"----- STEP is the division step. START+NDIV*STEP must be in range also");
755 pt->
AddText(
"----- If START and STEP are omitted, all range of the axis will be divided");
771 gROOT->GetListOfCanvases()->Delete();
772 TCanvas *
c =
new TCanvas(
"eltu shape",
"An Elliptical tube", 700,1000);
776 gPad->SetPad(0,0,1,0.4);
778 gPad->SetPad(0,0.4,1,1);
799 if (!comments)
return;
806 AddText(
pt,
"fA",eltu->
GetA(),
"semi-axis along x");
807 AddText(
pt,
"fB",eltu->
GetB(),
"semi-axis along y");
808 AddText(
pt,
"fDZ", eltu->
GetDZ(),
"half length in Z");
810 pt->
AddText(
"Execute: eltu(iaxis, ndiv, start, step) to divide this.");
811 pt->
AddText(
"----- IAXIS can be 2 or 3 (Phi, Z)");
812 pt->
AddText(
"----- NDIV must be a positive integer");
813 pt->
AddText(
"----- START must be a valid axis offset within shape range on divided axis");
814 pt->
AddText(
"----- STEP is the division step. START+NDIV*STEP must be in range also");
815 pt->
AddText(
"----- If START and STEP are omitted, all range of the axis will be divided");
831 gROOT->GetListOfCanvases()->Delete();
833 printf(
"Cannot divide spheres\n");
836 TCanvas *
c =
new TCanvas(
"Sphere shap",
"A spherical sector", 700,1000);
840 gPad->SetPad(0,0,1,0.4);
842 gPad->SetPad(0,0.4,1,1);
863 if (!comments)
return;
870 AddText(
pt,
"fRmin",sphere->
GetRmin(),
"inner radius");
871 AddText(
pt,
"fRmax",sphere->
GetRmax(),
"outer radius");
872 AddText(
pt,
"fTheta1",sphere->
GetTheta1(),
"lower theta limit");
873 AddText(
pt,
"fTheta2",sphere->
GetTheta2(),
"higher theta limit");
874 AddText(
pt,
"fPhi1",sphere->
GetPhi1(),
"lower phi limit");
875 AddText(
pt,
"fPhi2",sphere->
GetPhi2(),
"higher phi limit");
887 gROOT->GetListOfCanvases()->Delete();
889 printf(
"Cannot divide a torus\n");
892 TCanvas *
c =
new TCanvas(
"torus shape",
"A toroidal segment", 700,1000);
896 gPad->SetPad(0,0,1,0.4);
898 gPad->SetPad(0,0.4,1,1);
918 if (!comments)
return;
925 AddText(
pt,
"fR",tor->
GetR(),
"radius of the ring");
926 AddText(
pt,
"fRmin",tor->
GetRmin(),
"minimum radius");
927 AddText(
pt,
"fRmax",tor->
GetRmax(),
"maximum radius");
928 AddText(
pt,
"fPhi1", tor->
GetPhi1(),
"starting phi angle");
929 AddText(
pt,
"fDphi", tor->
GetDphi(),
"phi range");
940 gROOT->GetListOfCanvases()->Delete();
941 if (iaxis<0 || iaxis>3) {
942 printf(
"Wrong division axis. Range is 1-3.\n");
946 printf(
"Cannot divide trd1 on X axis\n");
950 TCanvas *
c =
new TCanvas(
"trd1 shape",
"A trapezoid with dX varying", 700,1000);
954 gPad->SetPad(0,0,1,0.4);
956 gPad->SetPad(0,0.4,1,1);
977 if (!comments)
return;
984 AddText(
pt,
"fDx1",trd1->
GetDx1(),
"half length in X at lower Z surface(-dz)");
985 AddText(
pt,
"fDx2",trd1->
GetDx2(),
"half length in X at higher Z surface(+dz)");
986 AddText(
pt,
"fDy",trd1->
GetDy(),
"half length in Y");
987 AddText(
pt,
"fDz",trd1->
GetDz(),
"half length in Z");
989 pt->
AddText(
"Execute: trd1(iaxis, ndiv, start, step) to divide this.");
990 pt->
AddText(
"----- IAXIS can be 2 or 3 (Y, Z)");
991 pt->
AddText(
"----- NDIV must be a positive integer");
992 pt->
AddText(
"----- START must be a valid axis offset within shape range on divided axis");
993 pt->
AddText(
"----- STEP is the division step. START+NDIV*STEP must be in range also");
994 pt->
AddText(
"----- If START and STEP are omitted, all range of the axis will be divided");
1010 gROOT->GetListOfCanvases()->Delete();
1011 TCanvas *
c =
new TCanvas(
"parab shape",
"A paraboloid segment", 700,1000);
1015 gPad->SetPad(0,0,1,0.4);
1017 gPad->SetPad(0,0.4,1,1);
1034 if (!comments)
return;
1040 AddText(
pt,
"fRlo",par->
GetRlo(),
"radius at Z=-dz");
1041 AddText(
pt,
"fRhi",par->
GetRhi(),
"radius at Z=+dz");
1042 AddText(
pt,
"fDz",par->
GetDz(),
"half-length on Z axis");
1043 pt->
AddText(
"----- A paraboloid is described by the equation:");
1044 pt->
AddText(
"----- z = a*r*r + b; where: r = x*x + y*y");
1045 pt->
AddText(
"----- Create with: TGeoParaboloid *parab = new TGeoParaboloid(rlo, rhi, dz);");
1046 pt->
AddText(
"----- dz: half-length in Z (range from -dz to +dz");
1047 pt->
AddText(
"----- rlo: radius at z=-dz given by: -dz = a*rlo*rlo + b");
1048 pt->
AddText(
"----- rhi: radius at z=+dz given by: dz = a*rhi*rhi + b");
1049 pt->
AddText(
"----- rlo != rhi; both >= 0");
1063 gROOT->GetListOfCanvases()->Delete();
1068 gPad->SetPad(0,0,1,0.4);
1070 gPad->SetPad(0,0.4,1,1);
1087 if (!comments)
return;
1093 AddText(
pt,
"fRmin",hype->
GetRmin(),
"minimum inner radius");
1094 AddText(
pt,
"fStIn",hype->
GetStIn(),
"inner surface stereo angle [deg]");
1095 AddText(
pt,
"fRmax",hype->
GetRmax(),
"minimum outer radius");
1096 AddText(
pt,
"fStOut",hype->
GetStOut(),
"outer surface stereo angle [deg]");
1097 AddText(
pt,
"fDz",hype->
GetDz(),
"half-length on Z axis");
1098 pt->
AddText(
"----- A hyperboloid is described by the equation:");
1099 pt->
AddText(
"----- r^2 - (tan(stereo)*z)^2 = rmin^2; where: r = x*x + y*y");
1100 pt->
AddText(
"----- Create with: TGeoHype *hype = new TGeoHype(rin, stin, rout, stout, dz);");
1101 pt->
AddText(
"----- rin < rout; rout > 0");
1102 pt->
AddText(
"----- rin = 0; stin > 0 => inner surface conical");
1103 pt->
AddText(
"----- stin/stout = 0 => corresponding surface cylindrical");
1116 gROOT->GetListOfCanvases()->Delete();
1117 if (iaxis<0 || iaxis>3) {
1118 printf(
"Wrong division axis. Range is 1-3.\n");
1122 printf(
"Cannot divide pcon on Rxy\n");
1129 gPad->SetPad(0,0,1,0.4);
1131 gPad->SetPad(0,0.4,1,1);
1157 if (!comments)
return;
1163 AddText(
pt,
"fPhi1",pcon->
GetPhi1(),
"lower phi limit");
1164 AddText(
pt,
"fDphi",pcon->
GetDphi(),
"phi range");
1165 AddText(
pt,
"fNz",pcon->
GetNz(),
"number of z planes");
1168 sprintf(
line,
"fZ[%i]=%5.2f fRmin[%i]=%5.2f fRmax[%i]=%5.2f",
1175 pt->
AddText(
"Execute: pcon(iaxis, ndiv, start, step) to divide this.");
1176 pt->
AddText(
"----- IAXIS can be 2 or 3 (Phi, Z)");
1177 pt->
AddText(
"----- NDIV must be a positive integer");
1178 pt->
AddText(
"----- START must be a valid axis offset within shape range on divided axis");
1179 pt->
AddText(
"----- STEP is the division step. START+NDIV*STEP must be in range also");
1180 pt->
AddText(
"----- If START and STEP are omitted, all range of the axis will be divided");
1196 gROOT->GetListOfCanvases()->Delete();
1197 if (iaxis<0 || iaxis>3) {
1198 printf(
"Wrong division axis. Range is 1-3.\n");
1202 printf(
"Cannot divide pgon on Rxy\n");
1209 gPad->SetPad(0,0,1,0.4);
1211 gPad->SetPad(0,0.4,1,1);
1237 if (!comments)
return;
1243 AddText(
pt,
"fPhi1",pgon->
GetPhi1(),
"lower phi limit");
1244 AddText(
pt,
"fDphi",pgon->
GetDphi(),
"phi range");
1245 AddText(
pt,
"fNedges",pgon->
GetNedges(),
"number of edges");
1246 AddText(
pt,
"fNz",pgon->
GetNz(),
"number of z planes");
1249 sprintf(
line,
"fZ[%i]=%5.2f fRmin[%i]=%5.2f fRmax[%i]=%5.2f",
1256 pt->
AddText(
"Execute: pgon(iaxis, ndiv, start, step) to divide this.");
1257 pt->
AddText(
"----- IAXIS can be 2 or 3 (Phi, Z)");
1258 pt->
AddText(
"----- NDIV must be a positive integer");
1259 pt->
AddText(
"----- START must be a valid axis offset within shape range on divided axis");
1260 pt->
AddText(
"----- STEP is the division step. START+NDIV*STEP must be in range also");
1261 pt->
AddText(
"----- If START and STEP are omitted, all range of the axis will be divided");
1278 gROOT->GetListOfCanvases()->Delete();
1280 printf(
"Cannot divide arb8\n");
1283 TCanvas *
c =
new TCanvas(
"arb8 shape",
"An arbitrary polyhedron", 700,1000);
1287 gPad->SetPad(0,0,1,0.4);
1289 gPad->SetPad(0,0.4,1,1);
1319 if (!comments)
return;
1325 AddText(
pt,
"fDz",arb->
GetDz(),
"Z half length");
1331 for (i=0; i<4; i++) {
1332 sprintf(
line,
" fXY[%d] = (%5.2f, %5.2f)", i, vert[2*i], vert[2*i+1]);
1339 for (i=4; i<8; i++) {
1340 sprintf(
line,
" fXY[%d] = (%5.2f, %5.2f)", i, vert[2*i], vert[2*i+1]);
1357 gROOT->GetListOfCanvases()->Delete();
1358 if (iaxis && iaxis!=3) {
1359 printf(
"Wrong division axis. Can divide only in Z (3)\n");
1362 TCanvas *
c =
new TCanvas(
"trd2 shape",
"A trapezoid with dX and dY varying with Z", 700,1000);
1366 gPad->SetPad(0,0,1,0.4);
1368 gPad->SetPad(0,0.4,1,1);
1389 if (!comments)
return;
1396 AddText(
pt,
"fDx1",trd2->
GetDx1(),
"half length in X at lower Z surface(-dz)");
1397 AddText(
pt,
"fDx2",trd2->
GetDx2(),
"half length in X at higher Z surface(+dz)");
1398 AddText(
pt,
"fDy1",trd2->
GetDy1(),
"half length in Y at lower Z surface(-dz)");
1399 AddText(
pt,
"fDy2",trd2->
GetDy2(),
"half length in Y at higher Z surface(-dz)");
1400 AddText(
pt,
"fDz",trd2->
GetDz(),
"half length in Z");
1402 pt->
AddText(
"Execute: trd2(iaxis, ndiv, start, step) to divide this.");
1403 pt->
AddText(
"----- IAXIS can be only 3 (Z)");
1404 pt->
AddText(
"----- NDIV must be a positive integer");
1405 pt->
AddText(
"----- START must be a valid axis offset within shape range on divided axis");
1406 pt->
AddText(
"----- STEP is the division step. START+NDIV*STEP must be in range also");
1407 pt->
AddText(
"----- If START and STEP are omitted, all range of the axis will be divided");
1423 gROOT->GetListOfCanvases()->Delete();
1424 if (iaxis && iaxis!=3) {
1425 printf(
"Wrong division axis. Can divide only in Z (3)\n");
1428 TCanvas *
c =
new TCanvas(
"trap shape",
"A more general trapezoid", 700,1000);
1432 gPad->SetPad(0,0,1,0.4);
1434 gPad->SetPad(0,0.4,1,1);
1442 TGeoVolume *vol =
gGeoManager->
MakeTrap(
"Trap",med, 30,15,30,20,10,15,0,20,10,15,0);
1455 if (!comments)
return;
1462 AddText(
pt,
"fDz",trap->
GetDz(),
"half length in Z");
1463 AddText(
pt,
"fTheta",trap->
GetTheta(),
"theta angle of trapezoid axis");
1464 AddText(
pt,
"fPhi",trap->
GetPhi(),
"phi angle of trapezoid axis");
1465 AddText(
pt,
"fH1",trap->
GetH1(),
"half length in y at -fDz");
1466 AddText(
pt,
"fAlpha1",trap->
GetAlpha1(),
"angle between centers of x edges and y axis at -fDz");
1467 AddText(
pt,
"fBl1",trap->
GetBl1(),
"half length in x at -dZ and y=-fH1");
1468 AddText(
pt,
"fTl1",trap->
GetTl1(),
"half length in x at -dZ and y=+fH1");
1469 AddText(
pt,
"fH2",trap->
GetH2(),
"half length in y at +fDz");
1470 AddText(
pt,
"fBl2",trap->
GetBl2(),
"half length in x at +dZ and y=-fH1");
1471 AddText(
pt,
"fTl2",trap->
GetTl2(),
"half length in x at +dZ and y=+fH1");
1472 AddText(
pt,
"fAlpha2",trap->
GetAlpha2(),
"angle between centers of x edges and y axis at +fDz");
1474 pt->
AddText(
"Execute: trap(iaxis, ndiv, start, step) to divide this.");
1475 pt->
AddText(
"----- IAXIS can be only 3 (Z)");
1476 pt->
AddText(
"----- NDIV must be a positive integer");
1477 pt->
AddText(
"----- START must be a valid axis offset within shape range on divided axis");
1478 pt->
AddText(
"----- STEP is the division step. START+NDIV*STEP must be in range also");
1479 pt->
AddText(
"----- If START and STEP are omitted, all range of the axis will be divided");
1495 gROOT->GetListOfCanvases()->Delete();
1496 if (iaxis && iaxis!=3) {
1497 printf(
"Wrong division axis. Can divide only in Z (3)\n");
1500 TCanvas *
c =
new TCanvas(
"gtra shape",
"A twisted trapezoid", 700,1000);
1504 gPad->SetPad(0,0,1,0.4);
1506 gPad->SetPad(0,0.4,1,1);
1514 TGeoVolume *vol =
gGeoManager->
MakeGtra(
"Gtra",med, 30,15,30,30,20,10,15,0,20,10,15,0);
1527 if (!comments)
return;
1534 AddText(
pt,
"fDz",trap->
GetDz(),
"half length in Z");
1535 AddText(
pt,
"fTheta",trap->
GetTheta(),
"theta angle of trapezoid axis");
1536 AddText(
pt,
"fPhi",trap->
GetPhi(),
"phi angle of trapezoid axis");
1538 AddText(
pt,
"fH1",trap->
GetH1(),
"half length in y at -fDz");
1539 AddText(
pt,
"fAlpha1",trap->
GetAlpha1(),
"angle between centers of x edges and y axis at -fDz");
1540 AddText(
pt,
"fBl1",trap->
GetBl1(),
"half length in x at -dZ and y=-fH1");
1541 AddText(
pt,
"fTl1",trap->
GetTl1(),
"half length in x at -dZ and y=+fH1");
1542 AddText(
pt,
"fH2",trap->
GetH2(),
"half length in y at +fDz");
1543 AddText(
pt,
"fBl2",trap->
GetBl2(),
"half length in x at +dZ and y=-fH1");
1544 AddText(
pt,
"fTl2",trap->
GetTl2(),
"half length in x at +dZ and y=+fH1");
1545 AddText(
pt,
"fAlpha2",trap->
GetAlpha2(),
"angle between centers of x edges and y axis at +fDz");
1547 pt->
AddText(
"Execute: gtra(iaxis, ndiv, start, step) to divide this.");
1548 pt->
AddText(
"----- IAXIS can be only 3 (Z)");
1549 pt->
AddText(
"----- NDIV must be a positive integer");
1550 pt->
AddText(
"----- START must be a valid axis offset within shape range on divided axis");
1551 pt->
AddText(
"----- STEP is the division step. START+NDIV*STEP must be in range also");
1552 pt->
AddText(
"----- If START and STEP are omitted, all range of the axis will be divided");
1568 gROOT->GetListOfCanvases()->Delete();
1569 TCanvas *
c =
new TCanvas(
"gtra shape",
"A twisted trapezoid", 700,1000);
1573 gPad->SetPad(0,0,1,0.4);
1575 gPad->SetPad(0,0.4,1,1);
1585 Double_t x[8] = {-30,-30,30,30,15,15,-15,-15};
1586 Double_t y[8] = {-30,30,30,-30,-30,15,15,-30};
1599 if (!comments)
return;
1605 AddText(
pt,
"fNvert",xtru->
GetNvert(),
"number of polygone vertices");
1606 AddText(
pt,
"fNz",xtru->
GetNz(),
"number of Z sections");
1607 pt->
AddText(
"----- Any Z section is an arbitrary polygone");
1608 pt->
AddText(
"----- The shape can have an arbitrary number of Z sections, as for pcon/pgon");
1609 pt->
AddText(
"----- Create with: TGeoXtru *xtru = new TGeoXtru(nz);");
1610 pt->
AddText(
"----- Define the blueprint polygon :");
1611 pt->
AddText(
"----- Double_t x[8] = {-30,-30,30,30,15,15,-15,-15};");
1612 pt->
AddText(
"----- Double_t y[8] = {-30,30,30,-30,-30,15,15,-30};");
1613 pt->
AddText(
"----- xtru->DefinePolygon(8,x,y);");
1614 pt->
AddText(
"----- Define translations/scales of the blueprint for Z sections :");
1615 pt->
AddText(
"----- xtru->DefineSection(i, Zsection, x0, y0, scale);");
1616 pt->
AddText(
"----- Sections have to be defined in increasing Z order");
1617 pt->
AddText(
"----- 2 sections can be defined at same Z (not for first/last sections)");
1631 gROOT->GetListOfCanvases()->Delete();
1632 TCanvas *
c =
new TCanvas(
"composite shape",
"A Boolean shape composition", 700,1000);
1636 gPad->SetPad(0,0,1,0.4);
1638 gPad->SetPad(0,0.4,1,1);
1668 if (!comments)
return;
1674 pt->
AddText(
"----- Define the shape components and don't forget to name them");
1675 pt->
AddText(
"----- Define geometrical transformations that apply to shape components");
1676 pt->
AddText(
"----- Name all transformations and register them");
1677 pt->
AddText(
"----- Define the composite shape based on a Boolean expression");
1678 pt->
AddText(
" TGeoCompositeShape(\"someName\", \"expression\")");
1679 pt->
AddText(
"----- Expression is made of <shapeName:transfName> components related by Boolean operators");
1680 pt->
AddText(
"----- Boolean operators can be: (+) union, (-) subtraction and (*) intersection");
1681 pt->
AddText(
"----- Use parenthesis in the expression to force precedence");
1727 gROOT->GetListOfCanvases()->Delete();
1728 TCanvas *
c =
new TCanvas(
"composite shape",
"A Boolean shape composition", 700,1000);
1732 gPad->SetPad(0,0,1,0.4);
1734 gPad->SetPad(0,0.4,1,1);
1754 if (!comments)
return;
1760 pt->
AddText(
"-- Create physical nodes for the objects you want to align");
1761 pt->
AddText(
"-- You must start from a valid CLOSED geometry");
1762 pt->
AddText(
" TGeoPhysicalNode *node = gGeoManager->MakePhysicalNode(const char *path)");
1763 pt->
AddText(
" + creates a physical node represented by path, e.g. TOP_1/A_2/B_3");
1764 pt->
AddText(
" node->Align(TGeoMatrix *newmat, TGeoShape *newshape, Bool_t check=kFALSE)");
1765 pt->
AddText(
" + newmat = new matrix to replace final node LOCAL matrix");
1766 pt->
AddText(
" + newshape = new shape to replace final node shape");
1767 pt->
AddText(
" + check = optional check if the new aligned node is overlapping");
1786 printf(
"Click: <Ideal geometry> first\n");
1793 for (
Int_t i=1; i<=10; i++) {
1794 for (
Int_t j=1; j<=10; j++) {
1796 sprintf(
name,
"TOP_1/SX_%d/SY_%d/CELL_1",i,j);
R__EXTERN TGeoManager * gGeoManager
R__EXTERN TRandom * gRandom
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
A Control Bar is a fully user configurable tool which provides fast access to frequently used operati...
An arbitrary trapezoid with less than 8 vertices standing on two parallel planes perpendicular to Z a...
virtual void SetVertex(Int_t vnum, Double_t x, Double_t y)
Set values for a given vertex.
virtual Double_t GetDZ() const
Class handling Boolean composition of shapes.
A phi segment of a conical tube.
virtual Double_t GetRmax2() const
virtual Double_t GetRmin2() const
virtual Double_t GetRmin1() const
virtual Double_t GetRmax1() const
virtual Double_t GetA() const
virtual Double_t GetB() const
Gtra is a twisted trapezoid.
Double_t GetTwistAngle() const
Hyperboloid class defined by 5 parameters.
Double_t GetStOut() const
The manager class for any TGeo geometry.
TGeoVolume * MakeCone(const char *name, TGeoMedium *medium, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
Make in one step a volume pointing to a cone shape with given medium.
TGeoVolume * MakeXtru(const char *name, TGeoMedium *medium, Int_t nz)
Make a TGeoXtru-shaped volume with nz planes.
TGeoVolume * MakePcon(const char *name, TGeoMedium *medium, Double_t phi, Double_t dphi, Int_t nz)
Make in one step a volume pointing to a polycone shape with given medium.
TGeoVolume * MakeTube(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
TGeoVolume * MakeCons(const char *name, TGeoMedium *medium, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Double_t phi1, Double_t phi2)
Make in one step a volume pointing to a cone segment shape with given medium.
TVirtualGeoPainter * GetGeomPainter()
Make a default painter if none present. Returns pointer to it.
TGeoVolume * MakePara(const char *name, TGeoMedium *medium, Double_t dx, Double_t dy, Double_t dz, Double_t alpha, Double_t theta, Double_t phi)
Make in one step a volume pointing to a parallelepiped shape with given medium.
TGeoVolume * MakeTorus(const char *name, TGeoMedium *medium, Double_t r, Double_t rmin, Double_t rmax, Double_t phi1=0, Double_t dphi=360)
Make in one step a volume pointing to a torus shape with given medium.
void CloseGeometry(Option_t *option="d")
Closing geometry implies checking the geometry validity, fixing shapes with negative parameters (run-...
TGeoVolume * MakeTrd2(const char *name, TGeoMedium *medium, Double_t dx1, Double_t dx2, Double_t dy1, Double_t dy2, Double_t dz)
Make in one step a volume pointing to a TGeoTrd2 shape with given medium.
TGeoVolume * MakeGtra(const char *name, TGeoMedium *medium, Double_t dz, Double_t theta, Double_t phi, Double_t twist, Double_t h1, Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, Double_t tl2, Double_t alpha2)
Make in one step a volume pointing to a twisted trapezoid shape with given medium.
TGeoVolume * MakeBox(const char *name, TGeoMedium *medium, Double_t dx, Double_t dy, Double_t dz)
Make in one step a volume pointing to a box shape with given medium.
TGeoVolume * MakeTrd1(const char *name, TGeoMedium *medium, Double_t dx1, Double_t dx2, Double_t dy, Double_t dz)
Make in one step a volume pointing to a TGeoTrd1 shape with given medium.
TGeoVolume * MakeSphere(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t themin=0, Double_t themax=180, Double_t phimin=0, Double_t phimax=360)
Make in one step a volume pointing to a sphere shape with given medium.
void SetTopVolume(TGeoVolume *vol)
Set the top volume and corresponding node as starting point of the geometry.
TGeoVolume * MakeCtub(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2, Double_t lx, Double_t ly, Double_t lz, Double_t tx, Double_t ty, Double_t tz)
Make in one step a volume pointing to a tube segment shape with given medium.
TGeoVolume * MakePgon(const char *name, TGeoMedium *medium, Double_t phi, Double_t dphi, Int_t nedges, Int_t nz)
Make in one step a volume pointing to a polygone shape with given medium.
TGeoVolume * MakeTrap(const char *name, TGeoMedium *medium, Double_t dz, Double_t theta, Double_t phi, Double_t h1, Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, Double_t tl2, Double_t alpha2)
Make in one step a volume pointing to a trapezoid shape with given medium.
void SetNsegments(Int_t nseg)
Set number of segments for approximating circles in drawing.
TGeoPhysicalNode * MakePhysicalNode(const char *path=0)
Makes a physical node corresponding to a path.
TObjArray * GetListOfPhysicalNodes()
TGeoVolume * MakeHype(const char *name, TGeoMedium *medium, Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
TGeoVolume * MakeParaboloid(const char *name, TGeoMedium *medium, Double_t rlo, Double_t rhi, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
TGeoVolume * MakeTubs(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2)
Make in one step a volume pointing to a tube segment shape with given medium.
TGeoVolume * MakeEltu(const char *name, TGeoMedium *medium, Double_t a, Double_t b, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
Base class describing materials.
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
Media are used to store properties related to tracking and which are useful only when using geometry ...
virtual TGeoMatrix * GetMatrix() const =0
Double_t GetAlpha() const
Double_t GetTheta() const
Base finder class for patterns.
TGeoVolume * GetVolume() const
Double_t GetStart() const
Double_t * GetRmax() const
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.
Double_t * GetRmin() const
Physical nodes are the actual 'touchable' objects in the geometry, representing a path of positioned ...
TGeoNode * GetNode(Int_t level=-1) const
Return node in branch at LEVEL. If not specified, return last leaf.
Bool_t Align(TGeoMatrix *newmat=0, TGeoShape *newshape=0, Bool_t check=kFALSE, Double_t ovlp=0.001)
Align a physical node with a new relative matrix/shape.
Base abstract class for all shapes.
virtual const char * GetAxisName(Int_t iaxis) const =0
virtual Double_t GetRmin() const
Double_t GetTheta2() const
virtual Double_t GetRmax() const
Double_t GetTheta1() const
Class describing translations.
void SetTranslation(Double_t dx, Double_t dy, Double_t dz)
Set translation components.
TRAP is a general trapezoid, i.e.
Double_t GetAlpha2() const
Double_t GetTheta() const
Double_t GetAlpha1() const
A trapezoid with only x length varying with z.
A trapezoid with both x and y lengths varying with z.
virtual Double_t GetRmin() const
virtual Double_t GetDz() const
virtual Double_t GetRmax() const
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
TGeoPatternFinder * GetFinder() const
TGeoShape * GetShape() const
virtual void Draw(Option_t *option="")
draw top volume according to option
virtual TGeoVolume * Divide(const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step, Int_t numed=0, Option_t *option="")
Division a la G3.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=0, Option_t *option="")
Add a TGeoNode to the list of nodes.
An extrusion with fixed outline shape in x-y and a sequence of z extents (segments).
Bool_t DefinePolygon(Int_t nvert, const Double_t *xv, const Double_t *yv)
Creates the polygon representing the blueprint of any Xtru section.
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.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * GetName() const
Returns name of object.
TObject * At(Int_t idx) const
Mother of all ROOT objects.
A Pave (see TPave) with text, lines or/and boxes inside.
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
virtual void SetAllWith(const char *text, Option_t *option, Double_t value)
Set attribute option for all lines containing string text.
Bool_t ProcessEvents()
Process events if timer did time out.
Random number generator class based on M.
virtual Double_t Rndm()
Machine independent random number generator.
Base class for several text objects.
virtual Double_t GetPsi()=0
virtual Double_t GetLongitude()=0
virtual void ShowAxis()=0
virtual Double_t GetLatitude()=0
virtual void SetView(Double_t longitude, Double_t latitude, Double_t psi, Int_t &irep)=0
Abstract class for geometry painters.
virtual Bool_t IsRaytracing() const =0
virtual void SetRaytracing(Bool_t flag=kTRUE)=0
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
static constexpr double bar