59 for (
Int_t i=0; i<128; i++) line[i] =
' ';
60 memcpy(&line[0], datamember, strlen(datamember));
63 sprintf(number,
"%5.2f", value);
64 memcpy(&line[12], number, strlen(number));
67 sprintf(&line[30],
"%s",comment);
77 for (
Int_t i=0; i<128; i++) line[i] =
' ';
78 memcpy(&line[0], datamember, strlen(datamember));
81 sprintf(number,
"%5i", value);
82 memcpy(&line[12], number, strlen(number));
85 sprintf(&line[30],
"%s",comment);
96 if (!pave || !pf)
return;
97 for (
Int_t i=0; i<128; i++) line[i] =
' ';
100 sprintf(line,
"Division of %s on axis %d (%s)", volume->
GetName(), iaxis,sh->
GetAxisName(iaxis));
103 text->SetTextAlign(12);
105 AddText(pave,
"fStart",finder->
GetStart(),
"start divisioning position");
114 if (!c || !vol)
return;
119 sprintf(fname,
"t_%s.gif",name);
132 return (1+
Int_t(color));
140 if (!painter)
return;
151 new TCanvas(
"chelp",
"Help to run demos",200,10,700,600);
154 welcome->
AddText(
"Welcome to the new geometry package");
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");
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");
238 gROOT->SaveContext();
255 if (!painter)
return;
265 if (
gROOT->IsInterrupted())
break;
267 if (longit>360) longit -= 360.;
272 view =
gPad->GetView();
296 gROOT->GetListOfCanvases()->Delete();
297 if (iaxis<0 || iaxis>3) {
298 printf(
"Wrong division axis. Range is 1-3.\n");
305 gPad->SetPad(0,0,1,0.4);
307 gPad->SetPad(0,0.4,1,1);
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");
364 gROOT->GetListOfCanvases()->Delete();
369 gPad->SetPad(0,0,1,0.4);
371 gPad->SetPad(0,0.4,1,1);
403 AddText(pt,
"fTheta",para->
GetTheta(),
"inclination of para axis about Z");
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");
427 gROOT->GetListOfCanvases()->Delete();
428 if (iaxis<0 || iaxis>3) {
429 printf(
"Wrong division axis. Range is 1-3.\n");
436 gPad->SetPad(0,0,1,0.4);
438 gPad->SetPad(0,0.4,1,1);
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");
492 gROOT->GetListOfCanvases()->Delete();
493 if (iaxis<0 || iaxis>3) {
494 printf(
"Wrong division axis. Range is 1-3.\n");
497 TCanvas *
c =
new TCanvas(
"tubeseg shape",
"A tube segment ", 700,1000);
501 gPad->SetPad(0,0,1,0.4);
503 gPad->SetPad(0,0.4,1,1);
534 AddText(pt,
"fDZ", tubeseg->
GetDZ(),
"half length in Z");
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");
559 gROOT->GetListOfCanvases()->Delete();
560 if (iaxis<0 || iaxis>2) {
561 printf(
"Wrong division axis. Range is 1-2.\n");
564 TCanvas *
c =
new TCanvas(
"ctub shape",
"A cut tube segment ", 700,1000);
568 gPad->SetPad(0,0,1,0.4);
570 gPad->SetPad(0,0.4,1,1);
590 TGeoVolume *vol =
gGeoManager->
MakeCtub(
"CTUB",med, 20,30,40,-30,250, nlow[0], nlow[1], nlow[2], nhi[0],nhi[1],nhi[2]);
613 AddText(pt,
"fDZ", tubeseg->
GetDZ(),
"half length in Z");
628 gROOT->GetListOfCanvases()->Delete();
629 if (iaxis<0 || iaxis>3) {
630 printf(
"Wrong division axis. Range is 1-3.\n");
634 printf(
"cannot divide cone on Rxy\n");
641 gPad->SetPad(0,0,1,0.4);
643 gPad->SetPad(0,0.4,1,1);
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");
698 gROOT->GetListOfCanvases()->Delete();
699 if (iaxis<0 || iaxis>3) {
700 printf(
"Wrong division axis. Range is 1-3.\n");
707 gPad->SetPad(0,0,1,0.4);
709 gPad->SetPad(0,0.4,1,1);
737 AddText(pt,
"fDZ", coneseg->
GetDZ(),
"half length in Z");
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");
766 gROOT->GetListOfCanvases()->Delete();
767 TCanvas *
c =
new TCanvas(
"eltu shape",
"An Elliptical tube", 700,1000);
771 gPad->SetPad(0,0,1,0.4);
773 gPad->SetPad(0,0.4,1,1);
801 AddText(pt,
"fA",eltu->
GetA(),
"semi-axis along x");
802 AddText(pt,
"fB",eltu->
GetB(),
"semi-axis along y");
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");
826 gROOT->GetListOfCanvases()->Delete();
828 printf(
"Cannot divide spheres\n");
831 TCanvas *
c =
new TCanvas(
"Sphere shap",
"A spherical sector", 700,1000);
835 gPad->SetPad(0,0,1,0.4);
837 gPad->SetPad(0,0.4,1,1);
882 gROOT->GetListOfCanvases()->Delete();
884 printf(
"Cannot divide a torus\n");
887 TCanvas *
c =
new TCanvas(
"torus shape",
"A toroidal segment", 700,1000);
891 gPad->SetPad(0,0,1,0.4);
893 gPad->SetPad(0,0.4,1,1);
935 gROOT->GetListOfCanvases()->Delete();
936 if (iaxis<0 || iaxis>3) {
937 printf(
"Wrong division axis. Range is 1-3.\n");
941 printf(
"Cannot divide trd1 on X axis\n");
945 TCanvas *
c =
new TCanvas(
"trd1 shape",
"A trapezoid with dX varying", 700,1000);
949 gPad->SetPad(0,0,1,0.4);
951 gPad->SetPad(0,0.4,1,1);
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)");
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");
1005 gROOT->GetListOfCanvases()->Delete();
1006 TCanvas *
c =
new TCanvas(
"parab shape",
"A paraboloid segment", 700,1000);
1010 gPad->SetPad(0,0,1,0.4);
1012 gPad->SetPad(0,0.4,1,1);
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");
1058 gROOT->GetListOfCanvases()->Delete();
1063 gPad->SetPad(0,0,1,0.4);
1065 gPad->SetPad(0,0.4,1,1);
1089 AddText(pt,
"fStIn",hype->
GetStIn(),
"inner surface stereo angle [deg]");
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");
1111 gROOT->GetListOfCanvases()->Delete();
1112 if (iaxis<0 || iaxis>3) {
1113 printf(
"Wrong division axis. Range is 1-3.\n");
1117 printf(
"Cannot divide pcon on Rxy\n");
1124 gPad->SetPad(0,0,1,0.4);
1126 gPad->SetPad(0,0.4,1,1);
1163 sprintf(line,
"fZ[%i]=%5.2f fRmin[%i]=%5.2f fRmax[%i]=%5.2f",
1167 text->SetTextAlign(12);
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");
1191 gROOT->GetListOfCanvases()->Delete();
1192 if (iaxis<0 || iaxis>3) {
1193 printf(
"Wrong division axis. Range is 1-3.\n");
1197 printf(
"Cannot divide pgon on Rxy\n");
1204 gPad->SetPad(0,0,1,0.4);
1206 gPad->SetPad(0,0.4,1,1);
1244 sprintf(line,
"fZ[%i]=%5.2f fRmin[%i]=%5.2f fRmax[%i]=%5.2f",
1248 text->SetTextAlign(12);
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");
1273 gROOT->GetListOfCanvases()->Delete();
1275 printf(
"Cannot divide arb8\n");
1278 TCanvas *
c =
new TCanvas(
"arb8 shape",
"An arbitrary polyedron", 700,1000);
1282 gPad->SetPad(0,0,1,0.4);
1284 gPad->SetPad(0,0.4,1,1);
1323 text = pt->
AddText(
"Vertices on lower Z plane:");
1326 for (i=0; i<4; i++) {
1327 sprintf(line,
" fXY[%d] = (%5.2f, %5.2f)", i, vert[2*i], vert[2*i+1]);
1332 text = pt->
AddText(
"Vertices on higher Z plane:");
1334 for (i=4; i<8; i++) {
1335 sprintf(line,
" fXY[%d] = (%5.2f, %5.2f)", i, vert[2*i], vert[2*i+1]);
1352 gROOT->GetListOfCanvases()->Delete();
1353 if (iaxis && iaxis!=3) {
1354 printf(
"Wrong division axis. Can divide only in Z (3)\n");
1357 TCanvas *
c =
new TCanvas(
"trd2 shape",
"A trapezoid with dX and dY varying with Z", 700,1000);
1361 gPad->SetPad(0,0,1,0.4);
1363 gPad->SetPad(0,0.4,1,1);
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)");
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");
1418 gROOT->GetListOfCanvases()->Delete();
1419 if (iaxis && iaxis!=3) {
1420 printf(
"Wrong division axis. Can divide only in Z (3)\n");
1423 TCanvas *
c =
new TCanvas(
"trap shape",
"A more general trapezoid", 700,1000);
1427 gPad->SetPad(0,0,1,0.4);
1429 gPad->SetPad(0,0.4,1,1);
1437 TGeoVolume *vol =
gGeoManager->
MakeTrap(
"Trap",med, 30,15,30,20,10,15,0,20,10,15,0);
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");
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");
1490 gROOT->GetListOfCanvases()->Delete();
1491 if (iaxis && iaxis!=3) {
1492 printf(
"Wrong division axis. Can divide only in Z (3)\n");
1495 TCanvas *
c =
new TCanvas(
"gtra shape",
"A twisted trapezoid", 700,1000);
1499 gPad->SetPad(0,0,1,0.4);
1501 gPad->SetPad(0,0.4,1,1);
1509 TGeoVolume *vol =
gGeoManager->
MakeGtra(
"Gtra",med, 30,15,30,30,20,10,15,0,20,10,15,0);
1530 AddText(pt,
"fTheta",trap->
GetTheta(),
"theta angle of trapezoid axis");
1531 AddText(pt,
"fPhi",trap->
GetPhi(),
"phi angle of trapezoid axis");
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");
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");
1563 gROOT->GetListOfCanvases()->Delete();
1564 TCanvas *
c =
new TCanvas(
"gtra shape",
"A twisted trapezoid", 700,1000);
1568 gPad->SetPad(0,0,1,0.4);
1570 gPad->SetPad(0,0.4,1,1);
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};
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)");
1626 gROOT->GetListOfCanvases()->Delete();
1627 TCanvas *
c =
new TCanvas(
"composite shape",
"A Boolean shape composition", 700,1000);
1631 gPad->SetPad(0,0,1,0.4);
1633 gPad->SetPad(0,0.4,1,1);
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");
1722 gROOT->GetListOfCanvases()->Delete();
1723 TCanvas *
c =
new TCanvas(
"composite shape",
"A Boolean shape composition", 700,1000);
1727 gPad->SetPad(0,0,1,0.4);
1729 gPad->SetPad(0,0.4,1,1);
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");
1782 printf(
"Click: <Ideal geometry> first\n");
1789 for (
Int_t i=1; i<=10; i++) {
1790 for (
Int_t j=1; j<=10; j++) {
1792 sprintf(name,
"TOP_1/SX_%d/SY_%d/CELL_1",i,j);
void Show()
Show control bar.
Double_t GetStOut() const
void AddButton(TControlBarButton *button)
Add button.
void arb8(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
Double_t GetStart() const
void para(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
A Control Bar is a fully user configurable tool which provides fast access to frequently used operati...
TGeoPhysicalNode * MakePhysicalNode(const char *path=0)
Makes a physical node corresponding to a path.
Random number generator class based on M.
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
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.
virtual Double_t GetRmin1() const
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)
void coneseg(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
virtual Double_t Rndm(Int_t i=0)
Machine independent random number generator.
TGeoPatternFinder * GetFinder() const
virtual Double_t GetRmax2() const
virtual Double_t GetLatitude()=0
virtual void SetName(const char *name)
Change (i.e.
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
void SavePicture(const char *name, TObject *objcanvas, TObject *objvol, Int_t iaxis, Double_t step)
virtual void Draw(Option_t *option="")
draw top volume according to option
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 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.
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.
void gtra(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
void trap(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
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
virtual void Print(const char *filename="") const
Save Pad contents in a file in one of various formats.
virtual Double_t GetDZ() const
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.
virtual Double_t GetRmax1() const
virtual void SetTextFont(Font_t tfont=62)
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.
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.
virtual Double_t GetA() const
Double_t GetAlpha() const
virtual Double_t GetRmax() const
TGeoVolume * MakeXtru(const char *name, TGeoMedium *medium, Int_t nz)
Make a TGeoXtru-shaped volume with nz planes.
virtual void SetVertex(Int_t vnum, Double_t x, Double_t y)
Set values for a given vertex.
Double_t GetTwistAngle() const
Base class for several text objects.
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 GetTheta() const
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.
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
virtual void SetView(Double_t longitude, Double_t latitude, Double_t psi, Int_t &irep)=0
virtual void SetTextAlign(Short_t align=11)
void AddText(TPaveText *pave, const char *datamember, Double_t value, const char *comment)
Double_t GetAlpha2() const
virtual void AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=0, Option_t *option="")
Add a TGeoNode to the list of nodes.
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)
void eltu(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
virtual void SetLineColor(Color_t lcolor)
virtual Double_t GetDX() const
void pcon(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
virtual Double_t GetRmin2() const
R__EXTERN TSystem * gSystem
virtual void SetFillColor(Color_t fcolor)
void tube(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
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)
virtual Double_t GetRmin() const
Double_t GetTheta2() const
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
void pgon(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
virtual void ShowAxis()=0
virtual const char * GetName() const
Returns name of object.
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 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)
R__EXTERN TRandom * gRandom
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
virtual Double_t GetLongitude()=0
virtual const char * GetAxisName(Int_t iaxis) const =0
TGeoNode * GetNode(Int_t level=-1) const
Return node in branch at LEVEL. If not specified, return last leaf.
void trd2(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
Double_t * GetRmin() const
TGeoShape * GetShape() const
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.
R__EXTERN TGeoManager * gGeoManager
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
Double_t GetTheta1() const
TObjArray * GetListOfPhysicalNodes()
void trd1(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Double_t GetTheta() const
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)
Mother of all ROOT objects.
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.
virtual Bool_t IsRaytracing() const =0
Double_t * GetRmax() const
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.
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
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.
void box(Int_t iaxis=0, Int_t ndiv=8, Double_t start=0, Double_t step=0)
virtual Double_t GetDz() const
virtual void SetTextColor(Color_t tcolor=1)
virtual void SetTextSize(Float_t tsize=1)
TObject * At(Int_t idx) const
TVirtualGeoPainter * GetGeomPainter()
Make a default painter if none present. Returns pointer to it.
void SetTranslation(Double_t dx, Double_t dy, Double_t dz)
Set translation components.
virtual void SetAllWith(const char *text, Option_t *option, Double_t value)
Set attribute option for all lines containing string text.
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 Double_t GetRmax() const
virtual Double_t GetB() const