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;
break;
1427 if (freeHeightFraction * (ymax - ymin) < height) room =
false;
break;
1430 if (freeHeightFraction * (zmax - zmin) < height) room =
false;
break;
1436 "WARNING: Not enough room in existing scene. Maybe logo is too large."
1443 "WARNING: The logo you have asked for is bigger than the existing"
1444 "\n scene. Maybe you have added it too soon. It is recommended that"
1445 "\n you add the logo last so that it can be correctly auto-positioned"
1446 "\n so as not to be obscured by any existing object and so that the"
1447 "\n view parameters can be correctly recalculated."
1452 G4double sxmid(xmid), symid(ymid), szmid(zmid);
1456 const G4double xComfort = comfort * (xmax - xmin);
1457 const G4double yComfort = comfort * (ymax - ymin);
1458 const G4double zComfort = comfort * (zmax - zmin);
1459 switch (logoDirection) {
1461 sxmid = xmax + halfHeight + xComfort;
1462 symid = ymin - yComfort;
1463 szmid = zmin - zComfort;
1466 sxmid = xmin - halfHeight - xComfort;
1467 symid = ymin - yComfort;
1468 szmid = zmax + zComfort;
1471 sxmid = xmin - xComfort;
1472 symid = ymax + halfHeight + yComfort;
1473 szmid = zmin - zComfort;
1476 sxmid = xmax + xComfort;
1477 symid = ymin - halfHeight - yComfort;
1478 szmid = zmin - zComfort;
1481 sxmid = xmax + xComfort;
1482 symid = ymin - yComfort;
1483 szmid = zmax + halfHeight + zComfort;
1486 sxmid = xmin - xComfort;
1487 symid = ymin - yComfort;
1488 szmid = zmin - halfHeight - zComfort;
1494 switch (logoDirection) {
1534 const G4String& currentSceneName = pScene -> GetName ();
1535 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1538 G4cout <<
"G4 Logo of height " << userHeight <<
' ' << userHeightUnit
1539 <<
", " << direction <<
"-direction, added to scene \""
1540 << currentSceneName <<
"\"";
1542 G4cout <<
"\n with extent " << extent
1543 <<
"\n at " << transform.getRotation()
1544 << transform.getTranslation();
1570 const G4double dx = xt - xb, dy = yt - yb;
1571 const G4double angle = std::atan2(dy,dx);
1573 rm.rotateZ(angle*
rad);
1574 const G4double d = std::sqrt(dx * dx + dy * dy);
1577 const G4double x8 = ((-ss * d - dx * (yt - y8)) / dy) + xt;
1579 G4double x9 = ((-(ss -
w) * d - dx * (yt - y8)) / dy) + xt;
1582 x9 += xtr; y9 += ytr;
1586 G4Box bG(
"bG",w2,ro2,d2);
1594 G4Box bS(
"bS",ss,ss,d2+e);
1595 G4Box bS2(
"bS2",ss,ss,d2+2.*e);
1604 fp4 = logo4.CreatePolyhedron();
1613 fp4->SetVisAttributes(&fVisAtts);
1622 void G4VisCommandSceneAddLogo::G4Logo::operator()
1635 fpCommand -> SetGuidance (
"Adds 2D logo to current scene.");
1637 parameter =
new G4UIparameter (
"size",
'i', omitable =
true);
1638 parameter -> SetGuidance (
"Screen size of text in pixels.");
1639 parameter -> SetDefaultValue (48);
1641 parameter =
new G4UIparameter (
"x-position",
'd', omitable =
true);
1642 parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
1643 parameter -> SetDefaultValue (-0.9);
1645 parameter =
new G4UIparameter (
"y-position",
'd', omitable =
true);
1646 parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
1647 parameter -> SetDefaultValue (-0.9);
1649 parameter =
new G4UIparameter (
"layout",
's', omitable =
true);
1650 parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
1651 parameter -> SetDefaultValue (
"left");
1671 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1679 std::istringstream is(newValue);
1680 is >> size >> x >> y >> layoutString;
1692 const G4String& currentSceneName = pScene -> GetName ();
1693 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1696 G4cout <<
"2D logo has been added to scene \""
1697 << currentSceneName <<
"\"."
1705 void G4VisCommandSceneAddLogo2D::Logo2D::operator()
1724 (
"Adds magnetic field representation to current scene.");
1726 (
"The first parameter is no. of data points per half scene. So, possibly, at"
1727 "\nmaximum, the number of data points sampled is (2*n+1)^3, which can grow"
1728 "\nlarge--be warned!"
1729 "\nYou might find that your scene is cluttered by thousands of arrows for"
1730 "\nthe default number of data points, so try reducing to 2 or 3, e.g:"
1731 "\n /vis/scene/add/magneticField 3"
1732 "\nor, if only a small part of the scene has a field:"
1733 "\n /vis/scene/add/magneticField 50 # or more");
1735 (
"In the arrow representation, the length of the arrow is proportional"
1736 "\nto the magnitude of the field and the colour is mapped onto the range"
1737 "\nas a fraction of the maximum magnitude: 0->0.5->1 is blue->green->red.");
1739 parameter =
new G4UIparameter (
"nDataPointsPerHalfScene",
'i', omitable =
true);
1740 parameter -> SetDefaultValue (10);
1742 parameter =
new G4UIparameter (
"representation",
's', omitable =
true);
1743 parameter -> SetParameterCandidates(
"fullArrow lightArrow");
1744 parameter -> SetDefaultValue (
"fullArrow");
1765 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1770 G4int nDataPointsPerHalfScene;
1772 std::istringstream iss(newValue);
1773 iss >> nDataPointsPerHalfScene >> representation;
1776 if (representation ==
"lightArrow") {
1781 const G4String& currentSceneName = pScene -> GetName ();
1782 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1785 G4cout <<
"Magnetic field, if any, will be drawn in scene \""
1788 << nDataPointsPerHalfScene
1789 <<
" data points per half scene and with representation \""
1805 (
"Adds Primitive Scorer Hits (PSHits) to current scene.");
1807 (
"PSHits are drawn at end of run when the scene in which"
1808 "\nthey are added is current.");
1810 (
"Optional parameter specifies name of scoring map. By default all"
1811 "\nscoring maps registered with the G4ScoringManager are drawn.");
1812 fpCommand -> SetParameterName (
"mapname", omitable =
true);
1833 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1839 const G4String& currentSceneName = pScene -> GetName ();
1840 G4bool successful = pScene -> AddEndOfRunModel (model, warn);
1843 if (newValue ==
"all") {
1844 G4cout <<
"All Primitive Scorer hits";
1846 G4cout <<
"Hits of Primitive Scorer \"" << newValue <<
'"';
1848 G4cout <<
" will be drawn at end of run in scene \""
1849 << currentSceneName <<
"\"."
1863 (
"Adds an annotated scale line to the current scene.");
1865 (
"If \"unit\" is \"auto\", length is roughly one tenth of the scene extent.");
1867 (
"If \"direction\" is \"auto\", scale is roughly in the plane of the current view.");
1869 (
"If \"placement\" is \"auto\", scale is placed at bottom left of current view."
1870 "\n Otherwise placed at (xmid,ymid,zmid).");
1873 parameter =
new G4UIparameter (
"length",
'd', omitable =
true);
1876 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1879 parameter =
new G4UIparameter (
"direction",
's', omitable =
true);
1883 parameter =
new G4UIparameter (
"red",
'd', omitable =
true);
1886 parameter =
new G4UIparameter (
"green",
'd', omitable =
true);
1889 parameter =
new G4UIparameter (
"blue",
'd', omitable =
true);
1892 parameter =
new G4UIparameter (
"placement",
's', omitable =
true);
1893 parameter -> SetParameterCandidates(
"auto manual");
1896 parameter =
new G4UIparameter (
"xmid",
'd', omitable =
true);
1899 parameter =
new G4UIparameter (
"ymid",
'd', omitable =
true);
1902 parameter =
new G4UIparameter (
"zmid",
'd', omitable =
true);
1905 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1926 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1933 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
1941 G4String userLengthUnit, direction, auto_manual, positionUnit;
1942 std::istringstream is (newValue);
1943 is >> userLength >> userLengthUnit >> direction
1944 >> red >> green >> blue
1946 >> xmid >> ymid >> zmid >> positionUnit;
1950 if (userLengthUnit ==
"auto") {
1952 const G4double intLog10Length = std::floor(std::log10(lengthMax));
1953 length = std::pow(10,intLog10Length);
1954 if (5.*length < lengthMax) length *= 5.;
1955 else if (2.*length < lengthMax) length *= 2.;
1962 xmid *= unit; ymid *= unit; zmid *= unit;
1965 if (direction(0) ==
'y') scaleDirection =
G4Scale::y;
1966 if (direction(0) ==
'z') scaleDirection =
G4Scale::z;
1972 "ERROR: G4VisCommandSceneAddScale::SetNewValue: no viewer."
1973 "\n Auto direction needs a viewer."
1984 if (direction ==
"auto") {
1985 if (std::abs(vp.x()) > std::abs(vp.y()) &&
1986 std::abs(vp.x()) > std::abs(vp.z())) {
1987 if (std::abs(up.y()) > std::abs(up.z())) scaleDirection =
G4Scale::z;
1990 else if (std::abs(vp.y()) > std::abs(vp.x()) &&
1991 std::abs(vp.y()) > std::abs(vp.z())) {
1992 if (std::abs(up.x()) > std::abs(up.z())) scaleDirection =
G4Scale::z;
1995 else if (std::abs(vp.z()) > std::abs(vp.x()) &&
1996 std::abs(vp.z()) > std::abs(vp.y())) {
1997 if (std::abs(up.y()) > std::abs(up.x())) scaleDirection =
G4Scale::x;
2002 G4bool autoPlacing =
false;
if (auto_manual ==
"auto") autoPlacing =
true;
2006 const G4double halfLength(length / 2.);
2008 const G4double freeLengthFraction (1. + 2. * comfort);
2023 "WARNING: Existing scene does not yet have any extent."
2024 "\n Maybe you have not yet added any geometrical object."
2030 switch (scaleDirection) {
2032 if (freeLengthFraction * (xmax - xmin) < length) room =
false;
break;
2034 if (freeLengthFraction * (ymax - ymin) < length) room =
false;
break;
2036 if (freeLengthFraction * (zmax - zmin) < length) room =
false;
break;
2042 "WARNING: Not enough room in existing scene. Maybe scale is too long."
2049 "WARNING: The scale you have asked for is bigger than the existing"
2050 "\n scene. Maybe you have added it too soon. It is recommended that"
2051 "\n you add the scale last so that it can be correctly auto-positioned"
2052 "\n so as not to be obscured by any existing object and so that the"
2053 "\n view parameters can be correctly recalculated."
2060 G4Scale scale(length, annotation, scaleDirection,
2061 false, xmid, ymid, zmid,
2067 globalDescription +=
" (" + newValue +
")";
2097 G4double sxmid(xmid), symid(ymid), szmid(zmid);
2101 const G4double xComfort = comfort * (xmax - xmin);
2102 const G4double yComfort = comfort * (ymax - ymin);
2103 const G4double zComfort = comfort * (zmax - zmin);
2104 switch (scaleDirection) {
2107 sxmid = xmax + xComfort;
2108 symid = ymin - yComfort;
2109 szmid = zmin - zComfort;
2111 sxmid = xmin - xComfort;
2112 symid = ymin - yComfort;
2113 szmid = zmax + zComfort;
2118 sxmid = xmin - xComfort;
2119 symid = ymax + yComfort;
2120 szmid = zmin - zComfort;
2122 sxmid = xmax + xComfort;
2123 symid = ymin - yComfort;
2124 szmid = zmin - zComfort;
2129 sxmid = xmax + xComfort;
2130 symid = ymin - yComfort;
2131 szmid = zmax + zComfort;
2133 sxmid = xmin - xComfort;
2134 symid = ymin - yComfort;
2135 szmid = zmax + zComfort;
2191 switch (scaleDirection) {
2193 scaleExtent =
G4VisExtent(-halfLength,halfLength,0,0,0,0);
2197 scaleExtent =
G4VisExtent(0,0,-halfLength,halfLength,0,0);
2201 scaleExtent =
G4VisExtent(0,0,0,0,-halfLength,halfLength);
2215 const G4String& currentSceneName = pScene -> GetName ();
2216 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2219 G4cout <<
"Scale of " << annotation
2220 <<
" added to scene \"" << currentSceneName <<
"\".";
2222 G4cout <<
"\n with extent " << scaleExtent
2223 <<
"\n at " << transform.getRotation()
2224 << transform.getTranslation();
2239 fpCommand -> SetGuidance (
"Adds text to current scene.");
2241 (
"Use \"/vis/set/textColour\" to set colour.");
2243 (
"Use \"/vis/set/textLayout\" to set layout:");
2254 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
2257 parameter =
new G4UIparameter (
"font_size",
'd', omitable =
true);
2261 parameter =
new G4UIparameter (
"x_offset",
'd', omitable =
true);
2265 parameter =
new G4UIparameter (
"y_offset",
'd', omitable =
true);
2269 parameter =
new G4UIparameter (
"text",
's', omitable =
true);
2270 parameter->
SetGuidance (
"The rest of the line is text.");
2291 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2307 x *= unit; y *= unit; z *= unit;
2316 const G4String& currentSceneName = pScene -> GetName ();
2317 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2320 G4cout <<
"Text \"" << text
2321 <<
"\" has been added to scene \"" << currentSceneName <<
"\"."
2335 fpCommand -> SetGuidance (
"Adds 2D text to current scene.");
2337 (
"Use \"/vis/set/textColour\" to set colour.");
2339 (
"Use \"/vis/set/textLayout\" to set layout:");
2347 parameter =
new G4UIparameter (
"font_size",
'd', omitable =
true);
2351 parameter =
new G4UIparameter (
"x_offset",
'd', omitable =
true);
2355 parameter =
new G4UIparameter (
"y_offset",
'd', omitable =
true);
2359 parameter =
new G4UIparameter (
"text",
's', omitable =
true);
2360 parameter->
SetGuidance (
"The rest of the line is text.");
2381 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2406 const G4String& currentSceneName = pScene -> GetName ();
2407 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2410 G4cout <<
"2D text \"" << text
2411 <<
"\" has been added to scene \"" << currentSceneName <<
"\"."
2423 void G4VisCommandSceneAddText2D::G4Text2D::operator()
2436 (
"/vis/scene/add/trajectories",
this);
2438 (
"Adds trajectories to current scene.");
2440 (
"Causes trajectories, if any, to be drawn at the end of processing an"
2441 "\nevent. Switches on trajectory storing and sets the"
2442 "\ndefault trajectory type.");
2444 (
"The command line parameter list determines the default trajectory type."
2445 "\nIf it contains the string \"smooth\", auxiliary inter-step points will"
2446 "\nbe inserted to improve the smoothness of the drawing of a curved"
2448 "\nIf it contains the string \"rich\", significant extra information will"
2449 "\nbe stored in the trajectory (G4RichTrajectory) amenable to modeling"
2450 "\nand filtering with \"/vis/modeling/trajectories/create/drawByAttribute\""
2451 "\nand \"/vis/filtering/trajectories/create/attributeFilter\" commands."
2452 "\nIt may contain both strings in any order.");
2454 (
"\nTo switch off trajectory storing: \"/tracking/storeTrajectory 0\"."
2455 "\nSee also \"/vis/scene/endOfEventAction\".");
2457 (
"Note: This only sets the default. Independently of the result of this"
2458 "\ncommand, a user may instantiate a trajectory that overrides this default"
2459 "\nin PreUserTrackingAction.");
2460 fpCommand -> SetParameterName (
"default-trajectory-type", omitable =
true);
2481 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2488 if (newValue.find(
"smooth") != std::string::npos) smooth =
true;
2489 if (newValue.find(
"rich") != std::string::npos) rich =
true;
2490 if (newValue.size() && !(rich || smooth)) {
2492 G4cerr <<
"ERROR: Unrecognised parameter \"" << newValue <<
"\""
2493 "\n No action taken."
2501 G4int newVerbose = 2;
2504 if (smooth && rich) {
2505 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 4");
2506 defaultTrajectoryType =
"G4RichTrajectory configured for smooth steps";
2507 }
else if (smooth) {
2508 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 2");
2509 defaultTrajectoryType =
"G4SmoothTrajectory";
2511 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 3");
2512 defaultTrajectoryType =
"G4RichTrajectory";
2514 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 1");
2515 defaultTrajectoryType =
"G4Trajectory";
2521 "Attributes available for modeling and filtering with"
2522 "\n \"/vis/modeling/trajectories/create/drawByAttribute\" and"
2523 "\n \"/vis/filtering/trajectories/create/attributeFilter\" commands:"
2529 }
else if (smooth) {
2539 const G4String& currentSceneName = pScene -> GetName ();
2540 pScene -> AddEndOfEventModel (model, warn);
2543 G4cout <<
"Default trajectory type " << defaultTrajectoryType
2544 <<
"\n will be used to store trajectories for scene \""
2545 << currentSceneName <<
"\"."
2551 "WARNING: Trajectory storing has been requested. This action may be"
2552 "\n reversed with \"/tracking/storeTrajectory 0\"."
2564 (
"Add named Vis User Action to current scene.");
2566 (
"Attempts to match search string to name of action - use unique sub-string.");
2568 (
"(Use /vis/list to see names of registered actions.)");
2570 (
"If name == \"all\" (default), all actions are added.");
2571 fpCommand -> SetParameterName(
"action-name", omitable =
true);
2591 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2598 const std::vector<G4VisManager::UserVisAction>& runDurationUserVisActions =
2600 for (
size_t i = 0; i < runDurationUserVisActions.size(); i++) {
2601 const G4String&
name = runDurationUserVisActions[i].fName;
2602 G4VUserVisAction* visAction = runDurationUserVisActions[i].fpUserVisAction;
2603 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2605 AddVisAction(name,visAction,pScene,runDuration,verbosity);
2609 const std::vector<G4VisManager::UserVisAction>& endOfEventUserVisActions =
2611 for (
size_t i = 0; i < endOfEventUserVisActions.size(); i++) {
2612 const G4String&
name = endOfEventUserVisActions[i].fName;
2614 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2616 AddVisAction(name,visAction,pScene,endOfEvent,verbosity);
2620 const std::vector<G4VisManager::UserVisAction>& endOfRunUserVisActions =
2622 for (
size_t i = 0; i < endOfRunUserVisActions.size(); i++) {
2623 const G4String&
name = endOfRunUserVisActions[i].fName;
2625 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2627 AddVisAction(name,visAction,pScene,endOfRun,verbosity);
2633 G4cout <<
"WARNING: No User Vis Action registered." <<
G4endl;
2638 const G4String& currentSceneName = pScene -> GetName ();
2651 const std::map<G4VUserVisAction*,G4VisExtent>& visExtentMap =
2654 std::map<G4VUserVisAction*,G4VisExtent>::const_iterator i =
2655 visExtentMap.find(visAction);
2656 if (i != visExtentMap.end()) extent = i->second;
2659 G4cout <<
"WARNING: User Vis Action extent is null." <<
G4endl;
2664 model->
SetType(
"User Vis Action");
2668 G4bool successful =
false;;
2671 successful = pScene -> AddRunDurationModel (model, warn);
2674 successful = pScene -> AddEndOfEventModel (model, warn);
2677 successful = pScene -> AddEndOfRunModel (model, warn);
2681 const G4String& currentSceneName = pScene -> GetName ();
2682 G4cout <<
"User Vis Action added to scene \""
2683 << currentSceneName <<
"\"";
2685 G4cout <<
"\n with extent " << extent;
2698 (
"Adds a physical volume to current scene, with optional clipping volume.");
2700 (
"If physical-volume-name is \"world\" (the default), the top of the"
2701 "\nmain geometry tree (material world) is added. If \"worlds\", the"
2702 "\ntop of all worlds - material world and parallel worlds, if any - are"
2703 "\nadded. Otherwise a search of all worlds is made, taking the first"
2704 "\nmatching occurence only. To see a representation of the geometry"
2705 "\nhierarchy of the worlds, try \"/vis/drawTree [worlds]\" or one of the"
2706 "\ndriver/browser combinations that have the required functionality, e.g., HepRep.");
2708 (
"If clip-volume-type is specified, the subsequent parameters are used to"
2709 "\nto define a clipping volume. For example,"
2710 "\n\"/vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1\" will draw the world"
2711 "\nwith the positive octant cut away. (If the Boolean Processor issues"
2712 "\nwarnings try replacing 0 by 0.000000001 or something.)");
2714 (
"If clip-volume-type is prepended with '-', the clip-volume is subtracted"
2715 "\n(cutaway). (This is the default if there is no prepended character.)"
2716 "\nIf '*' is prepended, the intersection of the physical-volume and the"
2717 "\nclip-volume is made. (You can make a section/DCUT with a thin box, for"
2720 (
"For \"box\", the parameters are xmin,xmax,ymin,ymax,zmin,zmax."
2721 "\nOnly \"box\" is programmed at present.");
2723 parameter =
new G4UIparameter (
"physical-volume-name",
's', omitable =
true);
2724 parameter -> SetDefaultValue (
"world");
2726 parameter =
new G4UIparameter (
"copy-no",
'i', omitable =
true);
2727 parameter -> SetGuidance
2728 (
"If negative, matches any copy no. First name match is taken.");
2729 parameter -> SetDefaultValue (-1);
2731 parameter =
new G4UIparameter (
"depth-of-descent",
'i', omitable =
true);
2732 parameter -> SetGuidance
2733 (
"Depth of descent of geometry hierarchy. Default = unlimited depth.");
2736 parameter =
new G4UIparameter (
"clip-volume-type",
's', omitable =
true);
2737 parameter -> SetParameterCandidates(
"none box -box *box");
2738 parameter -> SetDefaultValue (
"none");
2739 parameter -> SetGuidance(
"[-|*]type. See general guidance.");
2741 parameter =
new G4UIparameter (
"parameter-unit",
's', omitable =
true);
2742 parameter -> SetDefaultValue (
"m");
2744 parameter =
new G4UIparameter (
"parameter-1",
'd', omitable =
true);
2745 parameter -> SetDefaultValue (0.);
2747 parameter =
new G4UIparameter (
"parameter-2",
'd', omitable =
true);
2748 parameter -> SetDefaultValue (0.);
2750 parameter =
new G4UIparameter (
"parameter-3",
'd', omitable =
true);
2751 parameter -> SetDefaultValue (0.);
2753 parameter =
new G4UIparameter (
"parameter-4",
'd', omitable =
true);
2754 parameter -> SetDefaultValue (0.);
2756 parameter =
new G4UIparameter (
"parameter-5",
'd', omitable =
true);
2757 parameter -> SetDefaultValue (0.);
2759 parameter =
new G4UIparameter (
"parameter-6",
'd', omitable =
true);
2760 parameter -> SetDefaultValue (0.);
2769 return "world 0 -1";
2781 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2787 G4int copyNo, requestedDepthOfDescent;
2788 G4double param1, param2, param3, param4, param5, param6;
2789 std::istringstream is (newValue);
2790 is >> name >> copyNo >> requestedDepthOfDescent
2791 >> clipVolumeType >> parameterUnit
2792 >> param1 >> param2 >> param3 >> param4 >> param5 >> param6;
2795 if (clipVolumeType[
size_t(0)] ==
'-') {
2796 clipVolumeType = clipVolumeType.substr(1);
2797 }
else if (clipVolumeType[
size_t(0)] ==
'*') {
2799 clipVolumeType = clipVolumeType.substr(1);
2802 param1 *= unit; param2 *= unit; param3 *= unit;
2803 param4 *= unit; param5 *= unit; param6 *= unit;
2808 size_t nWorlds = transportationManager->
GetNoWorlds();
2811 static G4bool warned =
false;
2812 if (!warned && name !=
"worlds") {
2814 "WARNING: Parallel worlds in operation. To visualise, specify"
2815 "\n \"worlds\" or the parallel world volume or sub-volume name"
2816 "\n and control visibility with /vis/geometry."
2818 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2820 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2821 G4cout <<
" World " << i <<
": " << (*iterWorld)->GetName()
2834 "ERROR: G4VisCommandSceneAddVolume::SetNewValue:"
2835 "\n No world. Maybe the geometry has not yet been defined."
2836 "\n Try \"/run/initialize\""
2842 const std::vector<G4Scene::Model>& rdModelList = pScene -> GetRunDurationModelList();
2843 std::vector<G4Scene::Model>::const_iterator it;
2844 for (it = rdModelList.begin(); it != rdModelList.end(); ++it) {
2845 if (it->fpModel->GetGlobalDescription().find(
"G4PhysicalVolumeModel")
2846 != std::string::npos) {
2850 if (it != rdModelList.end()) {
2852 G4cout <<
"WARNING: There is already a volume, \""
2853 << it -> fpModel -> GetGlobalDescription()
2854 <<
"\",\n in the run-duration model list of scene \""
2855 << pScene -> GetName()
2856 <<
"\".\n To get a clean scene:"
2857 <<
"\n /vis/drawVolume " << name
2859 <<
"\n /vis/scene/create"
2860 <<
"\n /vis/scene/add/volume " << name
2861 <<
"\n /vis/sceneHandler/attach"
2862 <<
"\n (and also, if necessary, /vis/viewer/flush)"
2868 std::vector<G4PhysicalVolumeModel*> models;
2869 std::vector<G4VPhysicalVolume*> foundVolumes;
2872 typedef std::vector<PVNodeID>
PVPath;
2873 PVPath foundFullPVPath;
2874 std::vector<G4int> foundDepths;
2875 std::vector<G4Transform3D> transformations;
2877 if (name ==
"world") {
2881 foundVolumes.push_back(world);
2882 foundDepths.push_back(0);
2885 }
else if (name ==
"worlds") {
2890 "WARNING: G4VisCommandSceneAddVolume::SetNewValue:"
2891 "\n Parallel worlds requested but none exist."
2892 "\n Just adding material world."
2896 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2898 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2901 foundVolumes.push_back(*iterWorld);
2902 foundDepths.push_back(0);
2908 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2910 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2918 foundWorld = *iterWorld;
2919 foundVolumes.push_back(foundVolume);
2927 if (foundVolumes.size()) {
2928 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2930 (foundVolumes[i], requestedDepthOfDescent, transformations[i]);
2931 foundFullPVPath.pop_back();
2933 models.push_back(foundPVModel);
2937 G4cerr <<
"ERROR: Volume \"" << name <<
"\"";
2939 G4cerr <<
", copy no. " << copyNo <<
",";
2947 if (clipVolumeType ==
"box") {
2948 const G4double dX = (param2 - param1) / 2.;
2949 const G4double dY = (param4 - param3) / 2.;
2950 const G4double dZ = (param6 - param5) / 2.;
2951 const G4double x0 = (param2 + param1) / 2.;
2952 const G4double y0 = (param4 + param3) / 2.;
2956 (
"_displaced_clipping_box",
2957 new G4Box(
"_clipping_box",dX,dY,dZ),
2959 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2960 models[i]->SetClippingSolid(clippingSolid);
2961 models[i]->SetClippingMode(clippingMode);
2965 const G4String& currentSceneName = pScene -> GetName ();
2967 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2968 G4bool successful = pScene -> AddRunDurationModel (models[i], warn);
2972 G4cout <<
"First occurrence of \""
2973 << foundVolumes[i] -> GetName ()
2976 G4cout <<
", copy no. " << copyNo <<
",";
2981 G4cout <<
"at depth " << foundDepths[i]
2982 <<
",\n with a requested depth of further descent of ";
2983 if (requestedDepthOfDescent < 0) {
2984 G4cout <<
"<0 (unlimited)";
2987 G4cout << requestedDepthOfDescent;
2989 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()
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