62 #ifdef G4MULTITHREADED
88 "WARNING: For some reason, possibly mentioned above, it has not been"
89 "\n possible to add to the scene."
98 fpCommand -> SetGuidance (
"Adds arrow to current scene.");
113 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
134 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
141 std::istringstream is(newValue);
142 is >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> unitString;
144 x1 *= unit; y1 *= unit; z1 *= unit;
145 x2 *= unit; y2 *= unit; z2 *= unit;
153 (x1, y1, z1, x2, y2, z2,
156 const G4String& currentSceneName = pScene -> GetName ();
157 G4bool successful = pScene -> AddRunDurationModel (model, warn);
160 G4cout <<
"Arrow has been added to scene \""
161 << currentSceneName <<
"\"."
173 fpCommand -> SetGuidance (
"Adds 2D arrow to current scene.");
202 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
208 std::istringstream is(newValue);
209 is >> x1 >> y1 >> x2 >> y2;
218 const G4String& currentSceneName = pScene -> GetName ();
219 G4bool successful = pScene -> AddRunDurationModel (model, warn);
222 G4cout <<
"A 2D arrow has been added to scene \""
223 << currentSceneName <<
"\"."
235 fWidth(width), fColour(colour)
237 fShaftPolyline.push_back(
G4Point3D(x1,y1,0));
238 fShaftPolyline.push_back(
G4Point3D(x2,y2,0));
240 G4Vector3D arrowPointLeftDirection(arrowDirection);
241 arrowPointLeftDirection.rotateZ(150.*
deg);
242 G4Vector3D arrowPointRightDirection(arrowDirection);
243 arrowPointRightDirection.rotateZ(-150.*
deg);
244 fHeadPolyline.push_back(
G4Point3D(x2,y2,0)+0.04*arrowPointLeftDirection);
245 fHeadPolyline.push_back(
G4Point3D(x2,y2,0));
246 fHeadPolyline.push_back(
G4Point3D(x2,y2,0)+0.04*arrowPointRightDirection);
250 fShaftPolyline.SetVisAttributes(va);
251 fHeadPolyline.SetVisAttributes(va);
254 void G4VisCommandSceneAddArrow2D::Arrow2D::operator()
270 (
"Draws axes at (x0, y0, z0) of given length and colour.");
272 (
"If \"unitcolour\" is \"auto\", x, y and z will be red, green and blue"
273 "\n respectively. Otherwise choose from the pre-defined text-specified"
274 "\n colours - see information printed by the vis manager at start-up or"
275 "\n use \"/vis/list\".");
277 (
"If \"length\" is negative, it is set to about 25% of scene extent.");
279 (
"If \"showtext\" is false, annotations are suppressed.");
290 parameter =
new G4UIparameter (
"length",
'd', omitable =
true);
293 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
296 parameter =
new G4UIparameter (
"unitcolour",
's', omitable =
true);
299 parameter =
new G4UIparameter (
"showtext",
'b', omitable =
true);
320 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
327 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
334 G4String unitString, colourString, showTextString;
336 std::istringstream is (newValue);
337 is >> x0 >> y0 >> z0 >> length >> unitString
338 >> colourString >> showTextString;
343 x0 *= unit; y0 *= unit; z0 *= unit;
347 const G4double intLog10Length = std::floor(std::log10(lengthMax));
348 length = std::pow(10,intLog10Length);
349 if (5.*length < lengthMax) length *= 5.;
350 else if (2.*length < lengthMax) length *= 2.;
359 if (arrowWidth > length/50.) arrowWidth = length/50.;
362 (x0, y0, z0, length, arrowWidth, colourString, newValue,
365 G4bool successful = pScene -> AddRunDurationModel (model, warn);
366 const G4String& currentSceneName = pScene -> GetName ();
370 <<
"have been added to scene \"" << currentSceneName <<
"\"."
383 fpCommand -> SetGuidance (
"Adds date to current scene.");
385 (
"If \"date\"is omitted, the current date and time is drawn."
386 "\nOtherwise, the string, including the rest of the line, is drawn.");
388 parameter =
new G4UIparameter (
"size",
'i', omitable =
true);
389 parameter -> SetGuidance (
"Screen size of text in pixels.");
390 parameter -> SetDefaultValue (18);
392 parameter =
new G4UIparameter (
"x-position",
'd', omitable =
true);
393 parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
394 parameter -> SetDefaultValue (0.95);
396 parameter =
new G4UIparameter (
"y-position",
'd', omitable =
true);
397 parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
398 parameter -> SetDefaultValue (0.9);
400 parameter =
new G4UIparameter (
"layout",
's', omitable =
true);
401 parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
402 parameter -> SetDefaultValue (
"right");
404 parameter =
new G4UIparameter (
"date",
's', omitable =
true);
405 parameter -> SetDefaultValue (
"-");
425 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
433 std::istringstream is(newValue);
434 is >> size >> x >> y >> layoutString >> dateString;
436 const size_t NREMAINDER = 100;
437 char remainder[NREMAINDER];
439 is.getline(remainder, NREMAINDER);
440 dateString += remainder;
452 const G4String& currentSceneName = pScene -> GetName ();
453 G4bool successful = pScene -> AddRunDurationModel (model, warn);
456 G4cout <<
"Date has been added to scene \""
457 << currentSceneName <<
"\"."
465 void G4VisCommandSceneAddDate::Date::operator()
470 time = fTimer.GetClockTime();
475 std::string::size_type i = time.rfind(
'\n');
476 if (i != std::string::npos) time.erase(i);
491 fpCommand -> SetGuidance (
"Adds digis to current scene.");
493 (
"Digis are drawn at end of event when the scene in which"
494 "\nthey are added is current.");
513 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
519 const G4String& currentSceneName = pScene -> GetName ();
520 G4bool successful = pScene -> AddEndOfEventModel (model, warn);
523 G4cout <<
"Digis, if any, will be drawn at end of run in scene \""
524 << currentSceneName <<
"\"."
537 fpCommand -> SetGuidance (
"Adds eventID to current scene.");
539 (
"Run and event numbers are drawn at end of event or run when"
540 "\n the scene in which they are added is current.");
542 parameter =
new G4UIparameter (
"size",
'i', omitable =
true);
543 parameter -> SetGuidance (
"Screen size of text in pixels.");
544 parameter -> SetDefaultValue (18);
546 parameter =
new G4UIparameter (
"x-position",
'd', omitable =
true);
547 parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
548 parameter -> SetDefaultValue (-0.95);
550 parameter =
new G4UIparameter (
"y-position",
'd', omitable =
true);
551 parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
552 parameter -> SetDefaultValue (0.9);
554 parameter =
new G4UIparameter (
"layout",
's', omitable =
true);
555 parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
556 parameter -> SetDefaultValue (
"left");
576 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
584 std::istringstream is(newValue);
585 is >> size >> x >> y >> layoutString;
598 const G4String& currentSceneName = pScene -> GetName ();
599 G4bool successful = pScene -> AddEndOfEventModel (model, warn);
602 G4cout <<
"EventID has been added to scene \""
603 << currentSceneName <<
"\"."
611 void G4VisCommandSceneAddEventID::EventID::operator()
614 const G4Run* currentRun = 0;
616 #ifdef G4MULTITHREADED
623 G4VModel* model = fpVisManager->GetCurrentSceneHandler()->GetModel();
625 const G4Event* currentEvent = 0;
632 G4cerr <<
"ERROR: No model defined for this SceneHandler : "
633 << fpVisManager->GetCurrentSceneHandler()->GetName()
637 if (currentRun && currentEvent) {
640 std::ostringstream oss;
641 if (fpVisManager->GetCurrentScene()->GetRefreshAtEndOfEvent()) {
642 oss <<
"Run " << runID <<
" Event " << eventID;
645 #ifdef G4MULTITHREADED
657 const std::vector<const G4Event*>* events =
659 if (events) nEvents = events->size();
661 #ifndef G4MULTITHREADED
666 if (eventID < nEvents - 1)
return;
668 oss <<
"Run " << runID <<
" (" << nEvents <<
" event";
669 if (nEvents != 1) oss <<
's';
674 text.SetLayout(fLayout);
676 text.SetVisAttributes(textAtts);
688 (
"Adds a dummy model with given extent to the current scene."
689 "\nRequires the limits: xmin, xmax, ymin, ymax, zmin, zmax unit."
690 "\nThis can be used to provide an extent to the scene even if"
691 "\nno other models with extent are available. For example,"
692 "\neven if there is no geometry. In that case, for example:"
694 "\n /vis/scene/create"
695 "\n /vis/scene/add/extent -300 300 -300 300 -300 300 cm"
696 "\n /vis/sceneHandler/attach");
699 parameter =
new G4UIparameter (
"xmin",
'd', omitable =
true);
700 parameter -> SetDefaultValue (0.);
702 parameter =
new G4UIparameter (
"xmax",
'd', omitable =
true);
703 parameter -> SetDefaultValue (0.);
705 parameter =
new G4UIparameter (
"ymin",
'd', omitable =
true);
706 parameter -> SetDefaultValue (0.);
708 parameter =
new G4UIparameter (
"ymax",
'd', omitable =
true);
709 parameter -> SetDefaultValue (0.);
711 parameter =
new G4UIparameter (
"zmin",
'd', omitable =
true);
712 parameter -> SetDefaultValue (0.);
714 parameter =
new G4UIparameter (
"zmax",
'd', omitable =
true);
715 parameter -> SetDefaultValue (0.);
717 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
718 parameter -> SetDefaultValue (
"m");
738 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
743 G4double xmin, xmax, ymin, ymax, zmin, zmax;
745 std::istringstream is(newValue);
746 is >> xmin >> xmax >> ymin >> ymax >> zmin >> zmax >> unitString;
748 xmin *= unit; xmax *= unit;
749 ymin *= unit; ymax *= unit;
750 zmin *= unit; zmax *= unit;
752 G4VisExtent visExtent(xmin, xmax, ymin, ymax, zmin, zmax);
753 Extent* extent =
new Extent(xmin, xmax, ymin, ymax, zmin, zmax);
760 const G4String& currentSceneName = pScene -> GetName ();
761 G4bool successful = pScene -> AddRunDurationModel (model, warn);
764 G4cout <<
"A benign model with extent "
766 <<
" has been added to scene \""
767 << currentSceneName <<
"\"."
779 fExtent(xmin,xmax,ymin,ymax,zmin,zmax)
782 void G4VisCommandSceneAddExtent::Extent::operator()
790 fpCommand -> SetGuidance (
"Adds frame to current scene.");
793 parameter =
new G4UIparameter (
"size",
'd', omitable =
true);
794 parameter -> SetGuidance (
"Size of frame. 1 = full window.");
795 parameter -> SetParameterRange (
"size > 0 && size <=1");
796 parameter -> SetDefaultValue (0.97);
816 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
822 std::istringstream is(newValue);
831 const G4String& currentSceneName = pScene -> GetName ();
832 G4bool successful = pScene -> AddRunDurationModel (model, warn);
835 G4cout <<
"Frame has been added to scene \""
836 << currentSceneName <<
"\"."
844 void G4VisCommandSceneAddFrame::Frame::operator()
848 frame.push_back(
G4Point3D( fSize, fSize, 0.));
849 frame.push_back(
G4Point3D(-fSize, fSize, 0.));
850 frame.push_back(
G4Point3D(-fSize, -fSize, 0.));
851 frame.push_back(
G4Point3D( fSize, -fSize, 0.));
852 frame.push_back(
G4Point3D( fSize, fSize, 0.));
866 fpCommand -> SetGuidance (
"Adds hits to current scene.");
868 (
"Hits are drawn at end of event when the scene in which"
869 "\nthey are added is current.");
888 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
894 const G4String& currentSceneName = pScene -> GetName ();
895 G4bool successful = pScene -> AddEndOfEventModel (model, warn);
898 G4cout <<
"Hits, if any, will be drawn at end of run in scene \""
899 << currentSceneName <<
"\"."
911 fpCommand -> SetGuidance (
"Adds line to current scene.");
926 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
947 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
954 std::istringstream is(newValue);
955 is >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> unitString;
957 x1 *= unit; y1 *= unit; z1 *= unit;
958 x2 *= unit; y2 *= unit; z2 *= unit;
960 Line* line =
new Line(x1, y1, z1, x2, y2, z2,
967 const G4String& currentSceneName = pScene -> GetName ();
968 G4bool successful = pScene -> AddRunDurationModel (model, warn);
971 G4cout <<
"Line has been added to scene \""
972 << currentSceneName <<
"\"."
984 fWidth(width), fColour(colour)
986 fPolyline.push_back(
G4Point3D(x1,y1,z1));
987 fPolyline.push_back(
G4Point3D(x2,y2,z2));
991 fPolyline.SetVisAttributes(va);
994 void G4VisCommandSceneAddLine::Line::operator()
1006 fpCommand -> SetGuidance (
"Adds 2D line to current scene.");
1009 parameter =
new G4UIparameter (
"x1",
'd', omitable =
false);
1011 parameter =
new G4UIparameter (
"y1",
'd', omitable =
false);
1013 parameter =
new G4UIparameter (
"x2",
'd', omitable =
false);
1015 parameter =
new G4UIparameter (
"y2",
'd', omitable =
false);
1035 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1041 std::istringstream is(newValue);
1042 is >> x1 >> y1 >> x2 >> y2;
1051 const G4String& currentSceneName = pScene -> GetName ();
1052 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1055 G4cout <<
"A 2D line has been added to scene \""
1056 << currentSceneName <<
"\"."
1068 fWidth(width), fColour(colour)
1070 fPolyline.push_back(
G4Point3D(x1,y1,0));
1071 fPolyline.push_back(
G4Point3D(x2,y2,0));
1075 fPolyline.SetVisAttributes(va);
1078 void G4VisCommandSceneAddLine2D::Line2D::operator()
1091 fpCommand -> SetGuidance (
"Adds a logical volume to the current scene,");
1093 (
"Shows boolean components (if any), voxels (if any) and readout geometry"
1094 "\n(if any). Note: voxels are not constructed until start of run -"
1095 "\n \"/run/beamOn\". (For voxels without a run, \"/run/beamOn 0\".)");
1097 parameter =
new G4UIparameter (
"logical-volume-name",
's', omitable =
false);
1099 parameter =
new G4UIparameter (
"depth-of-descent",
'i', omitable =
true);
1100 parameter -> SetGuidance (
"Depth of descent of geometry hierarchy.");
1101 parameter -> SetDefaultValue (1);
1103 parameter =
new G4UIparameter (
"booleans-flag",
'b', omitable =
true);
1104 parameter -> SetDefaultValue (
true);
1106 parameter =
new G4UIparameter (
"voxels-flag",
'b', omitable =
true);
1107 parameter -> SetDefaultValue (
true);
1109 parameter =
new G4UIparameter (
"readout-flag",
'b', omitable =
true);
1110 parameter -> SetDefaultValue (
true);
1112 parameter =
new G4UIparameter (
"axes-flag",
'b', omitable =
true);
1113 parameter -> SetDefaultValue (
true);
1114 parameter -> SetGuidance (
"Set \"false\" to suppress axes.");
1135 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1141 G4int requestedDepthOfDescent;
1142 G4String booleansString, voxelsString, readoutString, axesString;
1143 std::istringstream is (newValue);
1144 is >> name >> requestedDepthOfDescent
1145 >> booleansString >> voxelsString >> readoutString >> axesString;
1152 int nLV = pLVStore -> size ();
1155 for (iLV = 0; iLV < nLV; iLV++ ) {
1156 pLV = (*pLVStore) [iLV];
1157 if (pLV -> GetName () == name)
break;
1161 G4cerr <<
"ERROR: Logical volume " << name
1162 <<
" not found in logical volume store." <<
G4endl;
1167 const std::vector<G4Scene::Model>& rdModelList =
1168 pScene -> GetRunDurationModelList();
1169 std::vector<G4Scene::Model>::const_iterator i;
1170 for (i = rdModelList.begin(); i != rdModelList.end(); ++i) {
1171 if (i->fpModel->GetGlobalDescription().find(
"Volume") != std::string::npos)
break;
1173 if (i != rdModelList.end()) {
1175 G4cout <<
"There is already a volume, \""
1176 << i->fpModel->GetGlobalDescription()
1177 <<
"\",\n in the run-duration model list of scene \""
1178 << pScene -> GetName()
1179 <<
"\".\n Your logical volume must be the only volume in the scene."
1180 <<
"\n Create a new scene and try again:"
1181 <<
"\n /vis/specify " << name
1183 <<
"\n /vis/scene/create"
1184 <<
"\n /vis/scene/add/logicalVolume " << name
1185 <<
"\n /vis/sceneHandler/attach"
1186 <<
"\n (and also, if necessary, /vis/viewer/flush)"
1193 (pLV, requestedDepthOfDescent, booleans, voxels, readout);
1194 const G4String& currentSceneName = pScene -> GetName ();
1195 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1199 G4bool axesSuccessful =
false;
1202 const G4double axisLengthMax = radius / 2.;
1203 const G4double intLog10Length = std::floor(std::log10(axisLengthMax));
1204 G4double axisLength = std::pow(10,intLog10Length);
1205 if (5.*axisLength < axisLengthMax) axisLength *= 5.;
1206 else if (2.*axisLength < axisLengthMax) axisLength *= 2.;
1207 const G4double axisWidth = axisLength / 20.;
1209 axesSuccessful = pScene -> AddRunDurationModel (axesModel, warn);
1220 G4cout <<
"Logical volume \"" << pLV -> GetName ()
1221 <<
" with requested depth of descent "
1222 << requestedDepthOfDescent
1224 if (!booleans)
G4cout <<
"out";
1225 G4cout <<
" boolean components, with";
1226 if (!voxels)
G4cout <<
"out";
1227 G4cout <<
" voxels and with";
1228 if (!readout)
G4cout <<
"out";
1229 G4cout <<
" readout geometry,"
1230 <<
"\n has been added to scene \"" << currentSceneName <<
"\".";
1232 if (axesSuccessful) {
1234 "\n Axes have also been added at the origin of local cooordinates.";
1237 "\n Axes have not been added for some reason possibly stated above.";
1257 fpCommand -> SetGuidance (
"Adds a G4 logo to the current scene.");
1259 (
"If \"unit\" is \"auto\", height is roughly one tenth of scene extent.");
1261 (
"\"direction\" is that of outward-facing normal to front face of logo."
1262 "\nIf \"direction\" is \"auto\", logo faces the user in the current viewer.");
1264 (
"\nIf \"placement\" is \"auto\", logo is placed at bottom right of screen"
1265 "\n when viewed from logo direction.");
1267 parameter =
new G4UIparameter (
"height",
'd', omitable =
true);
1270 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1273 parameter =
new G4UIparameter (
"direction",
's', omitable =
true);
1277 parameter =
new G4UIparameter (
"red",
'd', omitable =
true);
1280 parameter =
new G4UIparameter (
"green",
'd', omitable =
true);
1283 parameter =
new G4UIparameter (
"blue",
'd', omitable =
true);
1286 parameter =
new G4UIparameter (
"placement",
's', omitable =
true);
1287 parameter -> SetParameterCandidates(
"auto manual");
1290 parameter =
new G4UIparameter (
"xmid",
'd', omitable =
true);
1293 parameter =
new G4UIparameter (
"ymid",
'd', omitable =
true);
1296 parameter =
new G4UIparameter (
"zmid",
'd', omitable =
true);
1299 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1320 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1327 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
1338 "ERROR: G4VisCommandSceneAddLogo::SetNewValue: no viewer."
1339 "\n Auto direction needs a viewer."
1346 G4String userHeightUnit, direction, auto_manual, positionUnit;
1347 std::istringstream is (newValue);
1348 is >> userHeight >> userHeightUnit >> direction
1349 >> red >> green >> blue
1351 >> xmid >> ymid >> zmid >> positionUnit;
1355 if (userHeightUnit ==
"auto") {
1362 xmid *= unit; ymid *= unit; zmid *= unit;
1365 if (direction ==
"auto") {
1369 if (vp.x() > vp.y() && vp.x() > vp.z()) logoDirection =
X;
1370 else if (vp.x() < vp.y() && vp.x() < vp.z()) logoDirection =
minusX;
1371 else if (vp.y() > vp.x() && vp.y() > vp.z()) logoDirection =
Y;
1372 else if (vp.y() < vp.x() && vp.y() < vp.z()) logoDirection =
minusY;
1373 else if (vp.z() > vp.x() && vp.z() > vp.y()) logoDirection =
Z;
1374 else if (vp.z() < vp.x() && vp.z() < vp.y()) logoDirection =
minusZ;
1376 else if (direction(0) ==
'x') logoDirection =
X;
1377 else if (direction(0) ==
'y') logoDirection =
Y;
1378 else if (direction(0) ==
'z') logoDirection =
Z;
1379 else if (direction(0) ==
'-') {
1380 if (direction(1) ==
'x') logoDirection =
minusX;
1381 else if (direction(1) ==
'y') logoDirection =
minusY;
1382 else if (direction(1) ==
'z') logoDirection =
minusZ;
1385 G4cerr <<
"ERROR: Unrecogniseed direction: \""
1386 << direction <<
"\"." <<
G4endl;
1391 G4bool autoPlacing =
false;
if (auto_manual ==
"auto") autoPlacing =
true;
1408 "WARNING: Existing scene does not yet have any extent."
1409 "\n Maybe you have not yet added any geometrical object."
1415 const G4double halfHeight(height / 2.);
1417 const G4double freeHeightFraction (1. + 2. * comfort);
1421 switch (logoDirection) {
1424 if (freeHeightFraction * (xmax - xmin) < height) room =
false;
1428 if (freeHeightFraction * (ymax - ymin) < height) room =
false;
1432 if (freeHeightFraction * (zmax - zmin) < height) room =
false;
1439 "WARNING: Not enough room in existing scene. Maybe logo is too large."
1446 "WARNING: The logo you have asked for is bigger than the existing"
1447 "\n scene. Maybe you have added it too soon. It is recommended that"
1448 "\n you add the logo last so that it can be correctly auto-positioned"
1449 "\n so as not to be obscured by any existing object and so that the"
1450 "\n view parameters can be correctly recalculated."
1455 G4double sxmid(xmid), symid(ymid), szmid(zmid);
1459 const G4double xComfort = comfort * (xmax - xmin);
1460 const G4double yComfort = comfort * (ymax - ymin);
1461 const G4double zComfort = comfort * (zmax - zmin);
1462 switch (logoDirection) {
1464 sxmid = xmax + halfHeight + xComfort;
1465 symid = ymin - yComfort;
1466 szmid = zmin - zComfort;
1469 sxmid = xmin - halfHeight - xComfort;
1470 symid = ymin - yComfort;
1471 szmid = zmax + zComfort;
1474 sxmid = xmin - xComfort;
1475 symid = ymax + halfHeight + yComfort;
1476 szmid = zmin - zComfort;
1479 sxmid = xmax + xComfort;
1480 symid = ymin - halfHeight - yComfort;
1481 szmid = zmin - zComfort;
1484 sxmid = xmax + xComfort;
1485 symid = ymin - yComfort;
1486 szmid = zmax + halfHeight + zComfort;
1489 sxmid = xmin - xComfort;
1490 symid = ymin - yComfort;
1491 szmid = zmin - halfHeight - zComfort;
1497 switch (logoDirection) {
1537 const G4String& currentSceneName = pScene -> GetName ();
1538 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1541 G4cout <<
"G4 Logo of height " << userHeight <<
' ' << userHeightUnit
1542 <<
", " << direction <<
"-direction, added to scene \""
1543 << currentSceneName <<
"\"";
1545 G4cout <<
"\n with extent " << extent
1546 <<
"\n at " << transform.getRotation()
1547 << transform.getTranslation();
1573 const G4double dx = xt - xb, dy = yt - yb;
1576 rm.rotateZ(angle*
rad);
1577 const G4double d = std::sqrt(dx * dx + dy * dy);
1580 const G4double x8 = ((-ss * d - dx * (yt - y8)) / dy) + xt;
1582 G4double x9 = ((-(ss -
w) * d - dx * (yt - y8)) / dy) + xt;
1585 x9 += xtr; y9 += ytr;
1589 G4Box bG(
"bG",w2,ro2,d2);
1597 G4Box bS(
"bS",ss,ss,d2+e);
1598 G4Box bS2(
"bS2",ss,ss,d2+2.*e);
1607 fp4 = logo4.CreatePolyhedron();
1616 fp4->SetVisAttributes(&fVisAtts);
1625 void G4VisCommandSceneAddLogo::G4Logo::operator()
1638 fpCommand -> SetGuidance (
"Adds 2D logo to current scene.");
1640 parameter =
new G4UIparameter (
"size",
'i', omitable =
true);
1641 parameter -> SetGuidance (
"Screen size of text in pixels.");
1642 parameter -> SetDefaultValue (48);
1644 parameter =
new G4UIparameter (
"x-position",
'd', omitable =
true);
1645 parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
1646 parameter -> SetDefaultValue (-0.9);
1648 parameter =
new G4UIparameter (
"y-position",
'd', omitable =
true);
1649 parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
1650 parameter -> SetDefaultValue (-0.9);
1652 parameter =
new G4UIparameter (
"layout",
's', omitable =
true);
1653 parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
1654 parameter -> SetDefaultValue (
"left");
1674 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1682 std::istringstream is(newValue);
1683 is >> size >> x >> y >> layoutString;
1695 const G4String& currentSceneName = pScene -> GetName ();
1696 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1699 G4cout <<
"2D logo has been added to scene \""
1700 << currentSceneName <<
"\"."
1708 void G4VisCommandSceneAddLogo2D::Logo2D::operator()
1727 (
"Adds magnetic field representation to current scene.");
1729 (
"The first parameter is no. of data points per half scene. So, possibly, at"
1730 "\nmaximum, the number of data points sampled is (2*n+1)^3, which can grow"
1731 "\nlarge--be warned!"
1732 "\nYou might find that your scene is cluttered by thousands of arrows for"
1733 "\nthe default number of data points, so try reducing to 2 or 3, e.g:"
1734 "\n /vis/scene/add/magneticField 3"
1735 "\nor, if only a small part of the scene has a field:"
1736 "\n /vis/scene/add/magneticField 50 # or more");
1738 (
"In the arrow representation, the length of the arrow is proportional"
1739 "\nto the magnitude of the field and the colour is mapped onto the range"
1740 "\nas a fraction of the maximum magnitude: 0->0.5->1 is blue->green->red.");
1742 parameter =
new G4UIparameter (
"nDataPointsPerHalfScene",
'i', omitable =
true);
1743 parameter -> SetDefaultValue (10);
1745 parameter =
new G4UIparameter (
"representation",
's', omitable =
true);
1746 parameter -> SetParameterCandidates(
"fullArrow lightArrow");
1747 parameter -> SetDefaultValue (
"fullArrow");
1768 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1773 G4int nDataPointsPerHalfScene;
1775 std::istringstream iss(newValue);
1776 iss >> nDataPointsPerHalfScene >> representation;
1779 if (representation ==
"lightArrow") {
1784 const G4String& currentSceneName = pScene -> GetName ();
1785 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1788 G4cout <<
"Magnetic field, if any, will be drawn in scene \""
1791 << nDataPointsPerHalfScene
1792 <<
" data points per half scene and with representation \""
1808 (
"Adds Primitive Scorer Hits (PSHits) to current scene.");
1810 (
"PSHits are drawn at end of run when the scene in which"
1811 "\nthey are added is current.");
1813 (
"Optional parameter specifies name of scoring map. By default all"
1814 "\nscoring maps registered with the G4ScoringManager are drawn.");
1815 fpCommand -> SetParameterName (
"mapname", omitable =
true);
1836 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1842 const G4String& currentSceneName = pScene -> GetName ();
1843 G4bool successful = pScene -> AddEndOfRunModel (model, warn);
1846 if (newValue ==
"all") {
1847 G4cout <<
"All Primitive Scorer hits";
1849 G4cout <<
"Hits of Primitive Scorer \"" << newValue <<
'"';
1851 G4cout <<
" will be drawn at end of run in scene \""
1852 << currentSceneName <<
"\"."
1866 (
"Adds an annotated scale line to the current scene.");
1868 (
"If \"unit\" is \"auto\", length is roughly one tenth of the scene extent.");
1870 (
"If \"direction\" is \"auto\", scale is roughly in the plane of the current view.");
1872 (
"If \"placement\" is \"auto\", scale is placed at bottom left of current view."
1873 "\n Otherwise placed at (xmid,ymid,zmid).");
1876 parameter =
new G4UIparameter (
"length",
'd', omitable =
true);
1879 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1882 parameter =
new G4UIparameter (
"direction",
's', omitable =
true);
1886 parameter =
new G4UIparameter (
"red",
'd', omitable =
true);
1889 parameter =
new G4UIparameter (
"green",
'd', omitable =
true);
1892 parameter =
new G4UIparameter (
"blue",
'd', omitable =
true);
1895 parameter =
new G4UIparameter (
"placement",
's', omitable =
true);
1896 parameter -> SetParameterCandidates(
"auto manual");
1899 parameter =
new G4UIparameter (
"xmid",
'd', omitable =
true);
1902 parameter =
new G4UIparameter (
"ymid",
'd', omitable =
true);
1905 parameter =
new G4UIparameter (
"zmid",
'd', omitable =
true);
1908 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1929 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1936 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
1944 G4String userLengthUnit, direction, auto_manual, positionUnit;
1945 std::istringstream is (newValue);
1946 is >> userLength >> userLengthUnit >> direction
1947 >> red >> green >> blue
1949 >> xmid >> ymid >> zmid >> positionUnit;
1953 if (userLengthUnit ==
"auto") {
1955 const G4double intLog10Length = std::floor(std::log10(lengthMax));
1956 length = std::pow(10,intLog10Length);
1957 if (5.*length < lengthMax) length *= 5.;
1958 else if (2.*length < lengthMax) length *= 2.;
1965 xmid *= unit; ymid *= unit; zmid *= unit;
1968 if (direction(0) ==
'y') scaleDirection =
G4Scale::y;
1969 if (direction(0) ==
'z') scaleDirection =
G4Scale::z;
1975 "ERROR: G4VisCommandSceneAddScale::SetNewValue: no viewer."
1976 "\n Auto direction needs a viewer."
1987 if (direction ==
"auto") {
1988 if (std::abs(vp.x()) > std::abs(vp.y()) &&
1989 std::abs(vp.x()) > std::abs(vp.z())) {
1990 if (std::abs(up.y()) > std::abs(up.z())) scaleDirection =
G4Scale::z;
1993 else if (std::abs(vp.y()) > std::abs(vp.x()) &&
1994 std::abs(vp.y()) > std::abs(vp.z())) {
1995 if (std::abs(up.x()) > std::abs(up.z())) scaleDirection =
G4Scale::z;
1998 else if (std::abs(vp.z()) > std::abs(vp.x()) &&
1999 std::abs(vp.z()) > std::abs(vp.y())) {
2000 if (std::abs(up.y()) > std::abs(up.x())) scaleDirection =
G4Scale::x;
2005 G4bool autoPlacing =
false;
if (auto_manual ==
"auto") autoPlacing =
true;
2009 const G4double halfLength(length / 2.);
2011 const G4double freeLengthFraction (1. + 2. * comfort);
2026 "WARNING: Existing scene does not yet have any extent."
2027 "\n Maybe you have not yet added any geometrical object."
2033 switch (scaleDirection) {
2035 if (freeLengthFraction * (xmax - xmin) < length) room =
false;
2038 if (freeLengthFraction * (ymax - ymin) < length) room =
false;
2041 if (freeLengthFraction * (zmax - zmin) < length) room =
false;
2048 "WARNING: Not enough room in existing scene. Maybe scale is too long."
2055 "WARNING: The scale you have asked for is bigger than the existing"
2056 "\n scene. Maybe you have added it too soon. It is recommended that"
2057 "\n you add the scale last so that it can be correctly auto-positioned"
2058 "\n so as not to be obscured by any existing object and so that the"
2059 "\n view parameters can be correctly recalculated."
2066 G4Scale scale(length, annotation, scaleDirection,
2067 false, xmid, ymid, zmid,
2073 globalDescription +=
" (" + newValue +
")";
2103 G4double sxmid(xmid), symid(ymid), szmid(zmid);
2107 const G4double xComfort = comfort * (xmax - xmin);
2108 const G4double yComfort = comfort * (ymax - ymin);
2109 const G4double zComfort = comfort * (zmax - zmin);
2110 switch (scaleDirection) {
2113 sxmid = xmax + xComfort;
2114 symid = ymin - yComfort;
2115 szmid = zmin - zComfort;
2117 sxmid = xmin - xComfort;
2118 symid = ymin - yComfort;
2119 szmid = zmax + zComfort;
2124 sxmid = xmin - xComfort;
2125 symid = ymax + yComfort;
2126 szmid = zmin - zComfort;
2128 sxmid = xmax + xComfort;
2129 symid = ymin - yComfort;
2130 szmid = zmin - zComfort;
2135 sxmid = xmax + xComfort;
2136 symid = ymin - yComfort;
2137 szmid = zmax + zComfort;
2139 sxmid = xmin - xComfort;
2140 symid = ymin - yComfort;
2141 szmid = zmax + zComfort;
2197 switch (scaleDirection) {
2199 scaleExtent =
G4VisExtent(-halfLength,halfLength,0,0,0,0);
2203 scaleExtent =
G4VisExtent(0,0,-halfLength,halfLength,0,0);
2207 scaleExtent =
G4VisExtent(0,0,0,0,-halfLength,halfLength);
2221 const G4String& currentSceneName = pScene -> GetName ();
2222 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2225 G4cout <<
"Scale of " << annotation
2226 <<
" added to scene \"" << currentSceneName <<
"\".";
2228 G4cout <<
"\n with extent " << scaleExtent
2229 <<
"\n at " << transform.getRotation()
2230 << transform.getTranslation();
2245 fpCommand -> SetGuidance (
"Adds text to current scene.");
2247 (
"Use \"/vis/set/textColour\" to set colour.");
2249 (
"Use \"/vis/set/textLayout\" to set layout:");
2260 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
2263 parameter =
new G4UIparameter (
"font_size",
'd', omitable =
true);
2267 parameter =
new G4UIparameter (
"x_offset",
'd', omitable =
true);
2271 parameter =
new G4UIparameter (
"y_offset",
'd', omitable =
true);
2275 parameter =
new G4UIparameter (
"text",
's', omitable =
true);
2276 parameter->
SetGuidance (
"The rest of the line is text.");
2297 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2313 x *= unit; y *= unit; z *= unit;
2322 const G4String& currentSceneName = pScene -> GetName ();
2323 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2326 G4cout <<
"Text \"" << text
2327 <<
"\" has been added to scene \"" << currentSceneName <<
"\"."
2341 fpCommand -> SetGuidance (
"Adds 2D text to current scene.");
2343 (
"Use \"/vis/set/textColour\" to set colour.");
2345 (
"Use \"/vis/set/textLayout\" to set layout:");
2353 parameter =
new G4UIparameter (
"font_size",
'd', omitable =
true);
2357 parameter =
new G4UIparameter (
"x_offset",
'd', omitable =
true);
2361 parameter =
new G4UIparameter (
"y_offset",
'd', omitable =
true);
2365 parameter =
new G4UIparameter (
"text",
's', omitable =
true);
2366 parameter->
SetGuidance (
"The rest of the line is text.");
2387 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2412 const G4String& currentSceneName = pScene -> GetName ();
2413 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2416 G4cout <<
"2D text \"" << text
2417 <<
"\" has been added to scene \"" << currentSceneName <<
"\"."
2429 void G4VisCommandSceneAddText2D::G4Text2D::operator()
2442 (
"/vis/scene/add/trajectories",
this);
2444 (
"Adds trajectories to current scene.");
2446 (
"Causes trajectories, if any, to be drawn at the end of processing an"
2447 "\nevent. Switches on trajectory storing and sets the"
2448 "\ndefault trajectory type.");
2450 (
"The command line parameter list determines the default trajectory type."
2451 "\nIf it contains the string \"smooth\", auxiliary inter-step points will"
2452 "\nbe inserted to improve the smoothness of the drawing of a curved"
2454 "\nIf it contains the string \"rich\", significant extra information will"
2455 "\nbe stored in the trajectory (G4RichTrajectory) amenable to modeling"
2456 "\nand filtering with \"/vis/modeling/trajectories/create/drawByAttribute\""
2457 "\nand \"/vis/filtering/trajectories/create/attributeFilter\" commands."
2458 "\nIt may contain both strings in any order.");
2460 (
"\nTo switch off trajectory storing: \"/tracking/storeTrajectory 0\"."
2461 "\nSee also \"/vis/scene/endOfEventAction\".");
2463 (
"Note: This only sets the default. Independently of the result of this"
2464 "\ncommand, a user may instantiate a trajectory that overrides this default"
2465 "\nin PreUserTrackingAction.");
2466 fpCommand -> SetParameterName (
"default-trajectory-type", omitable =
true);
2487 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2494 if (newValue.find(
"smooth") != std::string::npos) smooth =
true;
2495 if (newValue.find(
"rich") != std::string::npos) rich =
true;
2496 if (newValue.size() && !(rich || smooth)) {
2498 G4cerr <<
"ERROR: Unrecognised parameter \"" << newValue <<
"\""
2499 "\n No action taken."
2507 G4int newVerbose = 2;
2510 if (smooth && rich) {
2511 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 4");
2512 defaultTrajectoryType =
"G4RichTrajectory configured for smooth steps";
2513 }
else if (smooth) {
2514 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 2");
2515 defaultTrajectoryType =
"G4SmoothTrajectory";
2517 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 3");
2518 defaultTrajectoryType =
"G4RichTrajectory";
2520 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 1");
2521 defaultTrajectoryType =
"G4Trajectory";
2527 "Attributes available for modeling and filtering with"
2528 "\n \"/vis/modeling/trajectories/create/drawByAttribute\" and"
2529 "\n \"/vis/filtering/trajectories/create/attributeFilter\" commands:"
2535 }
else if (smooth) {
2545 const G4String& currentSceneName = pScene -> GetName ();
2546 pScene -> AddEndOfEventModel (model, warn);
2549 G4cout <<
"Default trajectory type " << defaultTrajectoryType
2550 <<
"\n will be used to store trajectories for scene \""
2551 << currentSceneName <<
"\"."
2557 "WARNING: Trajectory storing has been requested. This action may be"
2558 "\n reversed with \"/tracking/storeTrajectory 0\"."
2570 (
"Add named Vis User Action to current scene.");
2572 (
"Attempts to match search string to name of action - use unique sub-string.");
2574 (
"(Use /vis/list to see names of registered actions.)");
2576 (
"If name == \"all\" (default), all actions are added.");
2577 fpCommand -> SetParameterName(
"action-name", omitable =
true);
2597 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2604 const std::vector<G4VisManager::UserVisAction>& runDurationUserVisActions =
2606 for (
size_t i = 0; i < runDurationUserVisActions.size(); i++) {
2607 const G4String&
name = runDurationUserVisActions[i].fName;
2608 G4VUserVisAction* visAction = runDurationUserVisActions[i].fpUserVisAction;
2609 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2611 AddVisAction(name,visAction,pScene,runDuration,verbosity);
2615 const std::vector<G4VisManager::UserVisAction>& endOfEventUserVisActions =
2617 for (
size_t i = 0; i < endOfEventUserVisActions.size(); i++) {
2618 const G4String&
name = endOfEventUserVisActions[i].fName;
2620 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2622 AddVisAction(name,visAction,pScene,endOfEvent,verbosity);
2626 const std::vector<G4VisManager::UserVisAction>& endOfRunUserVisActions =
2628 for (
size_t i = 0; i < endOfRunUserVisActions.size(); i++) {
2629 const G4String&
name = endOfRunUserVisActions[i].fName;
2631 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2633 AddVisAction(name,visAction,pScene,endOfRun,verbosity);
2639 G4cout <<
"WARNING: No User Vis Action registered." <<
G4endl;
2644 const G4String& currentSceneName = pScene -> GetName ();
2657 const std::map<G4VUserVisAction*,G4VisExtent>& visExtentMap =
2660 std::map<G4VUserVisAction*,G4VisExtent>::const_iterator i =
2661 visExtentMap.find(visAction);
2662 if (i != visExtentMap.end()) extent = i->second;
2665 G4cout <<
"WARNING: User Vis Action extent is null." <<
G4endl;
2670 model->
SetType(
"User Vis Action");
2674 G4bool successful =
false;;
2677 successful = pScene -> AddRunDurationModel (model, warn);
2680 successful = pScene -> AddEndOfEventModel (model, warn);
2683 successful = pScene -> AddEndOfRunModel (model, warn);
2687 const G4String& currentSceneName = pScene -> GetName ();
2688 G4cout <<
"User Vis Action added to scene \""
2689 << currentSceneName <<
"\"";
2691 G4cout <<
"\n with extent " << extent;
2704 (
"Adds a physical volume to current scene, with optional clipping volume.");
2706 (
"If physical-volume-name is \"world\" (the default), the top of the"
2707 "\nmain geometry tree (material world) is added. If \"worlds\", the"
2708 "\ntop of all worlds - material world and parallel worlds, if any - are"
2709 "\nadded. Otherwise a search of all worlds is made, taking the first"
2710 "\nmatching occurence only. To see a representation of the geometry"
2711 "\nhierarchy of the worlds, try \"/vis/drawTree [worlds]\" or one of the"
2712 "\ndriver/browser combinations that have the required functionality, e.g., HepRep.");
2714 (
"If clip-volume-type is specified, the subsequent parameters are used to"
2715 "\nto define a clipping volume. For example,"
2716 "\n\"/vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1\" will draw the world"
2717 "\nwith the positive octant cut away. (If the Boolean Processor issues"
2718 "\nwarnings try replacing 0 by 0.000000001 or something.)");
2720 (
"If clip-volume-type is prepended with '-', the clip-volume is subtracted"
2721 "\n(cutaway). (This is the default if there is no prepended character.)"
2722 "\nIf '*' is prepended, the intersection of the physical-volume and the"
2723 "\nclip-volume is made. (You can make a section/DCUT with a thin box, for"
2726 (
"For \"box\", the parameters are xmin,xmax,ymin,ymax,zmin,zmax."
2727 "\nOnly \"box\" is programmed at present.");
2729 parameter =
new G4UIparameter (
"physical-volume-name",
's', omitable =
true);
2730 parameter -> SetDefaultValue (
"world");
2732 parameter =
new G4UIparameter (
"copy-no",
'i', omitable =
true);
2733 parameter -> SetGuidance
2734 (
"If negative, matches any copy no. First name match is taken.");
2735 parameter -> SetDefaultValue (-1);
2737 parameter =
new G4UIparameter (
"depth-of-descent",
'i', omitable =
true);
2738 parameter -> SetGuidance
2739 (
"Depth of descent of geometry hierarchy. Default = unlimited depth.");
2742 parameter =
new G4UIparameter (
"clip-volume-type",
's', omitable =
true);
2743 parameter -> SetParameterCandidates(
"none box -box *box");
2744 parameter -> SetDefaultValue (
"none");
2745 parameter -> SetGuidance(
"[-|*]type. See general guidance.");
2747 parameter =
new G4UIparameter (
"parameter-unit",
's', omitable =
true);
2748 parameter -> SetDefaultValue (
"m");
2750 parameter =
new G4UIparameter (
"parameter-1",
'd', omitable =
true);
2751 parameter -> SetDefaultValue (0.);
2753 parameter =
new G4UIparameter (
"parameter-2",
'd', omitable =
true);
2754 parameter -> SetDefaultValue (0.);
2756 parameter =
new G4UIparameter (
"parameter-3",
'd', omitable =
true);
2757 parameter -> SetDefaultValue (0.);
2759 parameter =
new G4UIparameter (
"parameter-4",
'd', omitable =
true);
2760 parameter -> SetDefaultValue (0.);
2762 parameter =
new G4UIparameter (
"parameter-5",
'd', omitable =
true);
2763 parameter -> SetDefaultValue (0.);
2765 parameter =
new G4UIparameter (
"parameter-6",
'd', omitable =
true);
2766 parameter -> SetDefaultValue (0.);
2775 return "world 0 -1";
2787 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2793 G4int copyNo, requestedDepthOfDescent;
2794 G4double param1, param2, param3, param4, param5, param6;
2795 std::istringstream is (newValue);
2796 is >> name >> copyNo >> requestedDepthOfDescent
2797 >> clipVolumeType >> parameterUnit
2798 >> param1 >> param2 >> param3 >> param4 >> param5 >> param6;
2801 if (clipVolumeType[
size_t(0)] ==
'-') {
2802 clipVolumeType = clipVolumeType.substr(1);
2803 }
else if (clipVolumeType[
size_t(0)] ==
'*') {
2805 clipVolumeType = clipVolumeType.substr(1);
2808 param1 *= unit; param2 *= unit; param3 *= unit;
2809 param4 *= unit; param5 *= unit; param6 *= unit;
2814 size_t nWorlds = transportationManager->
GetNoWorlds();
2817 static G4bool warned =
false;
2818 if (!warned && name !=
"worlds") {
2820 "WARNING: Parallel worlds in operation. To visualise, specify"
2821 "\n \"worlds\" or the parallel world volume or sub-volume name"
2822 "\n and control visibility with /vis/geometry."
2824 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2826 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2827 G4cout <<
" World " << i <<
": " << (*iterWorld)->GetName()
2840 "ERROR: G4VisCommandSceneAddVolume::SetNewValue:"
2841 "\n No world. Maybe the geometry has not yet been defined."
2842 "\n Try \"/run/initialize\""
2848 const std::vector<G4Scene::Model>& rdModelList = pScene -> GetRunDurationModelList();
2849 std::vector<G4Scene::Model>::const_iterator it;
2850 for (it = rdModelList.begin(); it != rdModelList.end(); ++it) {
2851 if (it->fpModel->GetGlobalDescription().find(
"G4PhysicalVolumeModel")
2852 != std::string::npos) {
2856 if (it != rdModelList.end()) {
2858 G4cout <<
"WARNING: There is already a volume, \""
2859 << it -> fpModel -> GetGlobalDescription()
2860 <<
"\",\n in the run-duration model list of scene \""
2861 << pScene -> GetName()
2862 <<
"\".\n To get a clean scene:"
2863 <<
"\n /vis/drawVolume " << name
2865 <<
"\n /vis/scene/create"
2866 <<
"\n /vis/scene/add/volume " << name
2867 <<
"\n /vis/sceneHandler/attach"
2868 <<
"\n (and also, if necessary, /vis/viewer/flush)"
2874 std::vector<G4PhysicalVolumeModel*> models;
2875 std::vector<G4VPhysicalVolume*> foundVolumes;
2878 typedef std::vector<PVNodeID>
PVPath;
2879 PVPath foundFullPVPath;
2880 std::vector<G4int> foundDepths;
2881 std::vector<G4Transform3D> transformations;
2883 if (name ==
"world") {
2887 foundVolumes.push_back(world);
2888 foundDepths.push_back(0);
2891 }
else if (name ==
"worlds") {
2896 "WARNING: G4VisCommandSceneAddVolume::SetNewValue:"
2897 "\n Parallel worlds requested but none exist."
2898 "\n Just adding material world."
2902 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2904 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2907 foundVolumes.push_back(*iterWorld);
2908 foundDepths.push_back(0);
2914 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2916 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2924 foundWorld = *iterWorld;
2925 foundVolumes.push_back(foundVolume);
2933 if (foundVolumes.size()) {
2934 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2936 (foundVolumes[i], requestedDepthOfDescent, transformations[i]);
2937 foundFullPVPath.pop_back();
2939 models.push_back(foundPVModel);
2943 G4cerr <<
"ERROR: Volume \"" << name <<
"\"";
2945 G4cerr <<
", copy no. " << copyNo <<
",";
2953 if (clipVolumeType ==
"box") {
2954 const G4double dX = (param2 - param1) / 2.;
2955 const G4double dY = (param4 - param3) / 2.;
2956 const G4double dZ = (param6 - param5) / 2.;
2957 const G4double x0 = (param2 + param1) / 2.;
2958 const G4double y0 = (param4 + param3) / 2.;
2962 (
"_displaced_clipping_box",
2963 new G4Box(
"_clipping_box",dX,dY,dZ),
2965 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2966 models[i]->SetClippingSolid(clippingSolid);
2967 models[i]->SetClippingMode(clippingMode);
2971 const G4String& currentSceneName = pScene -> GetName ();
2973 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2974 G4bool successful = pScene -> AddRunDurationModel (models[i], warn);
2978 G4cout <<
"First occurrence of \""
2979 << foundVolumes[i] -> GetName ()
2982 G4cout <<
", copy no. " << copyNo <<
",";
2987 G4cout <<
"at depth " << foundDepths[i]
2988 <<
",\n with a requested depth of further descent of ";
2989 if (requestedDepthOfDescent < 0) {
2990 G4cout <<
"<0 (unlimited)";
2993 G4cout << requestedDepthOfDescent;
2995 G4cout <<
",\n has been added to scene \"" << currentSceneName <<
"\"."
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetParameter(G4UIparameter *const newParameter)
virtual ~G4VisCommandSceneAddDate()
G4String GetCurrentValue(G4UIcommand *command)
void SetColour(const G4Colour &)
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4Logo(G4double height, const G4VisAttributes &)
void SetGlobalTag(const G4String &)
void SetNewValue(G4UIcommand *command, G4String newValue)
static const double halfpi
virtual ~G4VisCommandSceneAddLine()
G4String GetCurrentValue(G4UIcommand *command)
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepRotation G4RotationMatrix
static G4Colour fCurrentColour
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
void UpdateVisManagerScene(const G4String &sceneName="")
G4String GetCurrentValue(G4UIcommand *command)
void SetLineWidth(G4double)
virtual ~G4VisCommandSceneAddLogicalVolume()
static G4Text::Layout fCurrentTextLayout
virtual ~G4VisCommandSceneAddPSHits()
Line(G4double x1, G4double y1, G4double z1, G4double x2, G4double y2, G4double z2, G4double width, const G4Colour &colour)
const G4ViewParameters & GetViewParameters() const
virtual ~G4VisCommandSceneAddMagneticField()
const G4double w[NPOINTSGL]
virtual ~G4VisCommandSceneAddHits()
const G4ModelingParameters * GetModelingParameters() const
G4VisCommandSceneAddText()
static G4double angle[DIM]
void SetDefaultValue(const char *theDefaultValue)
virtual void BeginPrimitives(const G4Transform3D &objectTransformation=G4Transform3D())=0
G4VisCommandSceneAddLine()
const std::vector< const G4Event * > * GetEventVector() const
G4VisCommandSceneAddTrajectories()
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
HepGeom::Point3D< G4double > G4Point3D
HepGeom::Vector3D< G4double > G4Vector3D
G4VisCommandSceneAddAxes()
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void SetForceSolid(G4bool)
void SetExtent(const G4VisExtent &)
const G4VisExtent & GetExtent() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4int GetVerboseLevel() const
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandSceneAddLogo2D()
static G4double fCurrentTextSize
virtual ~G4VisCommandSceneAddExtent()
void SetModelingParameters(const G4ModelingParameters *)
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
const G4Run * GetCurrentRun() const
G4VisCommandSceneAddFrame()
void SetVerboseLevel(G4int val)
virtual ~G4VisCommandSceneAddAxes()
G4VisCommandSceneAddUserAction()
void SetTransformation(const G4Transform3D &)
static void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
virtual void AddPrimitive(const G4Polyline &)=0
static G4UImanager * GetUIpointer()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
Line2D(G4double x1, G4double y1, G4double x2, G4double y2, G4double width, const G4Colour &colour)
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandSceneAddFrame()
static G4StateManager * GetStateManager()
void AddVisAction(const G4String &name, G4VUserVisAction *, G4Scene *, ActionType, G4VisManager::Verbosity)
G4double GetExtentRadius() const
G4VisCommandSceneAddText2D()
const G4Vector3D & GetViewpointDirection() const
void SetNewValue(G4UIcommand *command, G4String newValue)
G4GLOB_DLL std::ostream G4cout
const G4Event * GetEvent() const
void SetNewValue(G4UIcommand *command, G4String newValue)
const G4VisExtent & GetExtent() const
G4VisCommandSceneAddLogicalVolume()
G4VisCommandSceneAddDigis()
const G4String & GetGlobalDescription() const
const G4String & GetName() const
void SetNewValue(G4UIcommand *command, G4String newValue)
static G4bool ConvertToBool(const char *st)
virtual ~G4VisCommandSceneAddScale()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandSceneAddHits()
G4String GetCurrentValue(G4UIcommand *command)
G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID
G4Polyhedron * CreatePolyhedron() const
G4int GetFoundDepth() const
G4VisCommandSceneAddScale()
Extent(G4double xmin, G4double xmax, G4double ymin, G4double ymax, G4double zmin, G4double zmax)
G4String GetCurrentValue(G4UIcommand *command)
static G4MTRunManager * GetMasterRunManager()
void SetType(const G4String &)
static const G4String & GetGuidanceString()
static G4LogicalVolumeStore * GetInstance()
const std::vector< UserVisAction > & GetEndOfEventUserVisActions() const
virtual ~G4VisCommandSceneAddText2D()
G4VisCommandSceneAddLogo()
std::vector< PVNodeID > PVPath
G4ApplicationState GetCurrentState() const
const std::map< G4VUserVisAction *, G4VisExtent > & GetUserVisActionExtents() const
void SetBaseFullPVPath(const std::vector< G4PhysicalVolumeNodeID > &baseFullPVPath)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4bool IsMultithreadedApplication()
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
void SetVisAttributes(const G4VisAttributes *)
virtual ~G4VisCommandSceneAddLine2D()
virtual ~G4VisCommandSceneAddArrow2D()
const std::vector< UserVisAction > & GetRunDurationUserVisActions() const
static G4TransportationManager * GetTransportationManager()
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandSceneAddPSHits()
static G4RunManager * GetRunManager()
const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > & GetFoundFullPVPath() const
virtual void EndPrimitives2D()=0
virtual ~G4VisCommandSceneAddDigis()
G4String GetCurrentValue(G4UIcommand *command)
void SetOffset(double dx, double dy)
G4VisCommandSceneAddArrow()
G4VisCommandSceneAddExtent()
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation=G4Transform3D())=0
G4VisCommandSceneAddLine2D()
G4double StoD(G4String s)
static G4double ValueOf(const char *unitName)
G4VisCommandSceneAddEventID()
const G4double x[NPOINTSGL]
virtual ~G4VisCommandSceneAddText()
G4VPhysicalVolume * GetFoundVolume() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4String GetCurrentValue(G4UIcommand *command)
static G4double fCurrentLineWidth
static G4Colour fCurrentTextColour
static Verbosity GetVerbosity()
virtual ~G4VisCommandSceneAddLogo()
virtual ~G4VisCommandSceneAddTrajectories()
G4UIcmdWithoutParameter * fpCommand
G4int GetNumberOfEventToBeProcessed() const
size_t GetNoWorlds() const
G4VisCommandSceneAddVolume()
G4VisCommandSceneAddArrow2D()
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddDate()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4UIcmdWithoutParameter * fpCommand
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VViewer * GetCurrentViewer() const
virtual void EndPrimitives()=0
const G4Transform3D & GetFoundTransformation() const
virtual ~G4VisCommandSceneAddVolume()
const std::vector< UserVisAction > & GetEndOfRunUserVisActions() const
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandSceneAddEventID()
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandSceneAddMagneticField()
void SetGuidance(const char *theGuidance)
const G4Vector3D & GetUpVector() const
G4String GetCurrentValue(G4UIcommand *command)
Arrow2D(G4double x1, G4double y1, G4double x2, G4double y2, G4double width, const G4Colour &colour)
void SetGlobalDescription(const G4String &)
G4String GetCurrentValue(G4UIcommand *command)
G4int ApplyCommand(const char *aCommand)
G4Scene * GetCurrentScene() const
virtual ~G4VisCommandSceneAddUserAction()
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
void SetNewValue(G4UIcommand *command, G4String newValue)
G4GLOB_DLL std::ostream G4cerr
void SetScreenSize(G4double)
virtual ~G4VisCommandSceneAddArrow()
void DescribeYourselfTo(G4VGraphicsScene &)
G4VisCommandSceneAddLogo2D()
static G4VisManager * fpVisManager
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const