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;
650 const std::vector<const G4Event*>* events =
652 if (events) nEvents = events->size();
654 if (eventID < nEvents - 1)
return;
656 oss <<
"Run " << runID <<
" (" << nEvents <<
" event";
657 if (nEvents != 1) oss <<
's';
663 text.SetLayout(fLayout);
665 text.SetVisAttributes(textAtts);
677 (
"Adds a dummy model with given extent to the current scene."
678 "\nThis can be used to provide an extent to the scene even if"
679 "\nno other models with extent are available. For example,"
680 "\neven if there is no geometry.");
683 parameter =
new G4UIparameter (
"xmin",
'd', omitable =
true);
684 parameter -> SetDefaultValue (0.);
686 parameter =
new G4UIparameter (
"xmax",
'd', omitable =
true);
687 parameter -> SetDefaultValue (0.);
689 parameter =
new G4UIparameter (
"ymin",
'd', omitable =
true);
690 parameter -> SetDefaultValue (0.);
692 parameter =
new G4UIparameter (
"ymax",
'd', omitable =
true);
693 parameter -> SetDefaultValue (0.);
695 parameter =
new G4UIparameter (
"zmin",
'd', omitable =
true);
696 parameter -> SetDefaultValue (0.);
698 parameter =
new G4UIparameter (
"zmax",
'd', omitable =
true);
699 parameter -> SetDefaultValue (0.);
701 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
702 parameter -> SetDefaultValue (
"m");
722 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
727 G4double xmin, xmax, ymin, ymax, zmin, zmax;
729 std::istringstream is(newValue);
730 is >> xmin >> xmax >> ymin >> ymax >> zmin >> zmax >> unitString;
732 xmin *= unit; xmax *= unit;
733 ymin *= unit; ymax *= unit;
734 zmin *= unit; zmax *= unit;
736 G4VisExtent visExtent(xmin, xmax, ymin, ymax, zmin, zmax);
737 Extent* extent =
new Extent(xmin, xmax, ymin, ymax, zmin, zmax);
744 const G4String& currentSceneName = pScene -> GetName ();
745 G4bool successful = pScene -> AddRunDurationModel (model, warn);
748 G4cout <<
"A benign model with extent "
750 <<
" has been added to scene \""
751 << currentSceneName <<
"\"."
763 fExtent(xmin,xmax,ymin,ymax,zmin,zmax)
766 void G4VisCommandSceneAddExtent::Extent::operator()
774 fpCommand -> SetGuidance (
"Adds frame to current scene.");
777 parameter =
new G4UIparameter (
"size",
'd', omitable =
true);
778 parameter -> SetGuidance (
"Size of frame. 1 = full window.");
779 parameter -> SetParameterRange (
"size > 0 && size <=1");
780 parameter -> SetDefaultValue (0.97);
800 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
806 std::istringstream is(newValue);
815 const G4String& currentSceneName = pScene -> GetName ();
816 G4bool successful = pScene -> AddRunDurationModel (model, warn);
819 G4cout <<
"Frame has been added to scene \""
820 << currentSceneName <<
"\"."
828 void G4VisCommandSceneAddFrame::Frame::operator()
832 frame.push_back(
G4Point3D( fSize, fSize, 0.));
833 frame.push_back(
G4Point3D(-fSize, fSize, 0.));
834 frame.push_back(
G4Point3D(-fSize, -fSize, 0.));
835 frame.push_back(
G4Point3D( fSize, -fSize, 0.));
836 frame.push_back(
G4Point3D( fSize, fSize, 0.));
850 fpCommand -> SetGuidance (
"Adds hits to current scene.");
852 (
"Hits are drawn at end of event when the scene in which"
853 "\nthey are added is current.");
872 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
878 const G4String& currentSceneName = pScene -> GetName ();
879 G4bool successful = pScene -> AddEndOfEventModel (model, warn);
882 G4cout <<
"Hits, if any, will be drawn at end of run in scene \""
883 << currentSceneName <<
"\"."
895 fpCommand -> SetGuidance (
"Adds line to current scene.");
910 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
931 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
938 std::istringstream is(newValue);
939 is >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> unitString;
941 x1 *= unit; y1 *= unit; z1 *= unit;
942 x2 *= unit; y2 *= unit; z2 *= unit;
944 Line* line =
new Line(x1, y1, z1, x2, y2, z2,
951 const G4String& currentSceneName = pScene -> GetName ();
952 G4bool successful = pScene -> AddRunDurationModel (model, warn);
955 G4cout <<
"Line has been added to scene \""
956 << currentSceneName <<
"\"."
968 fWidth(width), fColour(colour)
970 fPolyline.push_back(
G4Point3D(x1,y1,z1));
971 fPolyline.push_back(
G4Point3D(x2,y2,z2));
975 fPolyline.SetVisAttributes(va);
978 void G4VisCommandSceneAddLine::Line::operator()
990 fpCommand -> SetGuidance (
"Adds 2D line to current scene.");
1019 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1025 std::istringstream is(newValue);
1026 is >> x1 >> y1 >> x2 >> y2;
1035 const G4String& currentSceneName = pScene -> GetName ();
1036 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1039 G4cout <<
"A 2D line has been added to scene \""
1040 << currentSceneName <<
"\"."
1052 fWidth(width), fColour(colour)
1054 fPolyline.push_back(
G4Point3D(x1,y1,0));
1055 fPolyline.push_back(
G4Point3D(x2,y2,0));
1059 fPolyline.SetVisAttributes(va);
1062 void G4VisCommandSceneAddLine2D::Line2D::operator()
1075 fpCommand -> SetGuidance (
"Adds a logical volume to the current scene,");
1077 (
"Shows boolean components (if any), voxels (if any) and readout geometry"
1078 "\n(if any). Note: voxels are not constructed until start of run -"
1079 "\n \"/run/beamOn\". (For voxels without a run, \"/run/beamOn 0\".)");
1081 parameter =
new G4UIparameter (
"logical-volume-name",
's', omitable =
false);
1083 parameter =
new G4UIparameter (
"depth-of-descent",
'i', omitable =
true);
1084 parameter -> SetGuidance (
"Depth of descent of geometry hierarchy.");
1085 parameter -> SetDefaultValue (1);
1087 parameter =
new G4UIparameter (
"booleans-flag",
'b', omitable =
true);
1088 parameter -> SetDefaultValue (
true);
1090 parameter =
new G4UIparameter (
"voxels-flag",
'b', omitable =
true);
1091 parameter -> SetDefaultValue (
true);
1093 parameter =
new G4UIparameter (
"readout-flag",
'b', omitable =
true);
1094 parameter -> SetDefaultValue (
true);
1096 parameter =
new G4UIparameter (
"axes-flag",
'b', omitable =
true);
1097 parameter -> SetDefaultValue (
true);
1098 parameter -> SetGuidance (
"Set \"false\" to suppress axes.");
1119 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1125 G4int requestedDepthOfDescent;
1126 G4String booleansString, voxelsString, readoutString, axesString;
1127 std::istringstream is (newValue);
1128 is >> name >> requestedDepthOfDescent
1129 >> booleansString >> voxelsString >> readoutString >> axesString;
1136 int nLV = pLVStore -> size ();
1139 for (iLV = 0; iLV < nLV; iLV++ ) {
1140 pLV = (*pLVStore) [iLV];
1141 if (pLV -> GetName () == name)
break;
1145 G4cerr <<
"ERROR: Logical volume " << name
1146 <<
" not found in logical volume store." <<
G4endl;
1151 const std::vector<G4Scene::Model>& rdModelList =
1152 pScene -> GetRunDurationModelList();
1153 std::vector<G4Scene::Model>::const_iterator i;
1154 for (i = rdModelList.begin(); i != rdModelList.end(); ++i) {
1155 if (i->fpModel->GetGlobalDescription().find(
"Volume") != std::string::npos)
break;
1157 if (i != rdModelList.end()) {
1159 G4cout <<
"There is already a volume, \""
1160 << i->fpModel->GetGlobalDescription()
1161 <<
"\",\n in the run-duration model list of scene \""
1162 << pScene -> GetName()
1163 <<
"\".\n Your logical volume must be the only volume in the scene."
1164 <<
"\n Create a new scene and try again:"
1165 <<
"\n /vis/specify " << name
1167 <<
"\n /vis/scene/create"
1168 <<
"\n /vis/scene/add/logicalVolume " << name
1169 <<
"\n /vis/sceneHandler/attach"
1170 <<
"\n (and also, if necessary, /vis/viewer/flush)"
1177 (pLV, requestedDepthOfDescent, booleans, voxels, readout);
1178 const G4String& currentSceneName = pScene -> GetName ();
1179 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1183 G4bool axesSuccessful =
false;
1186 const G4double axisLengthMax = radius / 2.;
1187 const G4double intLog10Length = std::floor(std::log10(axisLengthMax));
1188 G4double axisLength = std::pow(10,intLog10Length);
1189 if (5.*axisLength < axisLengthMax) axisLength *= 5.;
1190 else if (2.*axisLength < axisLengthMax) axisLength *= 2.;
1191 const G4double axisWidth = axisLength / 20.;
1193 axesSuccessful = pScene -> AddRunDurationModel (axesModel, warn);
1204 G4cout <<
"Logical volume \"" << pLV -> GetName ()
1205 <<
" with requested depth of descent "
1206 << requestedDepthOfDescent
1208 if (!booleans)
G4cout <<
"out";
1209 G4cout <<
" boolean components, with";
1210 if (!voxels)
G4cout <<
"out";
1211 G4cout <<
" voxels and with";
1212 if (!readout)
G4cout <<
"out";
1213 G4cout <<
" readout geometry,"
1214 <<
"\n has been added to scene \"" << currentSceneName <<
"\".";
1216 if (axesSuccessful) {
1218 "\n Axes have also been added at the origin of local cooordinates.";
1221 "\n Axes have not been added for some reason possibly stated above.";
1241 fpCommand -> SetGuidance (
"Adds a G4 logo to the current scene.");
1243 (
"If \"unit\" is \"auto\", height is roughly one tenth of scene extent.");
1245 (
"\"direction\" is that of outward-facing normal to front face of logo."
1246 "\nIf \"direction\" is \"auto\", logo faces the user in the current viewer.");
1248 (
"\nIf \"placement\" is \"auto\", logo is placed at bottom right of screen"
1249 "\n when viewed from logo direction.");
1251 parameter =
new G4UIparameter (
"height",
'd', omitable =
true);
1254 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1257 parameter =
new G4UIparameter (
"direction",
's', omitable =
true);
1261 parameter =
new G4UIparameter (
"red",
'd', omitable =
true);
1264 parameter =
new G4UIparameter (
"green",
'd', omitable =
true);
1267 parameter =
new G4UIparameter (
"blue",
'd', omitable =
true);
1270 parameter =
new G4UIparameter (
"placement",
's', omitable =
true);
1271 parameter -> SetParameterCandidates(
"auto manual");
1274 parameter =
new G4UIparameter (
"xmid",
'd', omitable =
true);
1277 parameter =
new G4UIparameter (
"ymid",
'd', omitable =
true);
1280 parameter =
new G4UIparameter (
"zmid",
'd', omitable =
true);
1283 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1304 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1311 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
1322 "ERROR: G4VisCommandSceneAddLogo::SetNewValue: no viewer."
1323 "\n Auto direction needs a viewer."
1330 G4String userHeightUnit, direction, auto_manual, positionUnit;
1331 std::istringstream is (newValue);
1332 is >> userHeight >> userHeightUnit >> direction
1333 >> red >> green >> blue
1335 >> xmid >> ymid >> zmid >> positionUnit;
1339 if (userHeightUnit ==
"auto") {
1346 xmid *= unit; ymid *= unit; zmid *= unit;
1349 if (direction ==
"auto") {
1353 if (vp.x() > vp.y() && vp.x() > vp.z()) logoDirection =
X;
1354 else if (vp.x() < vp.y() && vp.x() < vp.z()) logoDirection =
minusX;
1355 else if (vp.y() > vp.x() && vp.y() > vp.z()) logoDirection =
Y;
1356 else if (vp.y() < vp.x() && vp.y() < vp.z()) logoDirection =
minusY;
1357 else if (vp.z() > vp.x() && vp.z() > vp.y()) logoDirection =
Z;
1358 else if (vp.z() < vp.x() && vp.z() < vp.y()) logoDirection =
minusZ;
1360 else if (direction(0) ==
'x') logoDirection =
X;
1361 else if (direction(0) ==
'y') logoDirection =
Y;
1362 else if (direction(0) ==
'z') logoDirection =
Z;
1363 else if (direction(0) ==
'-') {
1364 if (direction(1) ==
'x') logoDirection =
minusX;
1365 else if (direction(1) ==
'y') logoDirection =
minusY;
1366 else if (direction(1) ==
'z') logoDirection =
minusZ;
1369 G4cerr <<
"ERROR: Unrecogniseed direction: \""
1370 << direction <<
"\"." <<
G4endl;
1375 G4bool autoPlacing =
false;
if (auto_manual ==
"auto") autoPlacing =
true;
1392 "WARNING: Existing scene does not yet have any extent."
1393 "\n Maybe you have not yet added any geometrical object."
1399 const G4double halfHeight(height / 2.);
1401 const G4double freeHeightFraction (1. + 2. * comfort);
1405 switch (logoDirection) {
1408 if (freeHeightFraction * (xmax - xmin) < height) room =
false;
break;
1411 if (freeHeightFraction * (ymax - ymin) < height) room =
false;
break;
1414 if (freeHeightFraction * (zmax - zmin) < height) room =
false;
break;
1420 "WARNING: Not enough room in existing scene. Maybe logo is too large."
1427 "WARNING: The logo you have asked for is bigger than the existing"
1428 "\n scene. Maybe you have added it too soon. It is recommended that"
1429 "\n you add the logo last so that it can be correctly auto-positioned"
1430 "\n so as not to be obscured by any existing object and so that the"
1431 "\n view parameters can be correctly recalculated."
1436 G4double sxmid(xmid), symid(ymid), szmid(zmid);
1440 const G4double xComfort = comfort * (xmax - xmin);
1441 const G4double yComfort = comfort * (ymax - ymin);
1442 const G4double zComfort = comfort * (zmax - zmin);
1443 switch (logoDirection) {
1445 sxmid = xmax + halfHeight + xComfort;
1446 symid = ymin - yComfort;
1447 szmid = zmin - zComfort;
1450 sxmid = xmin - halfHeight - xComfort;
1451 symid = ymin - yComfort;
1452 szmid = zmax + zComfort;
1455 sxmid = xmin - xComfort;
1456 symid = ymax + halfHeight + yComfort;
1457 szmid = zmin - zComfort;
1460 sxmid = xmax + xComfort;
1461 symid = ymin - halfHeight - yComfort;
1462 szmid = zmin - zComfort;
1465 sxmid = xmax + xComfort;
1466 symid = ymin - yComfort;
1467 szmid = zmax + halfHeight + zComfort;
1470 sxmid = xmin - xComfort;
1471 symid = ymin - yComfort;
1472 szmid = zmin - halfHeight - zComfort;
1478 switch (logoDirection) {
1518 const G4String& currentSceneName = pScene -> GetName ();
1519 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1522 G4cout <<
"G4 Logo of height " << userHeight <<
' ' << userHeightUnit
1523 <<
", " << direction <<
"-direction, added to scene \""
1524 << currentSceneName <<
"\"";
1526 G4cout <<
"\n with extent " << extent
1527 <<
"\n at " << transform.getRotation()
1528 << transform.getTranslation();
1553 const G4double xb = -h2, yb = f2 + w;
1554 const G4double dx = xt - xb, dy = yt - yb;
1555 const G4double angle = std::atan2(dy,dx);
1557 rm.rotateZ(angle*
rad);
1558 const G4double d = std::sqrt(dx * dx + dy * dy);
1561 const G4double x8 = ((-ss * d - dx * (yt - y8)) / dy) + xt;
1563 G4double x9 = ((-(ss - w) * d - dx * (yt - y8)) / dy) + xt;
1565 const G4double xtr = ss -
f1, ytr = -ss - f2 -w;
1566 x9 += xtr; y9 += ytr;
1570 G4Box bG(
"bG",w2,ro2,d2);
1578 G4Box bS(
"bS",ss,ss,d2+e);
1579 G4Box bS2(
"bS2",ss,ss,d2+2.*e);
1588 fp4 = logo4.CreatePolyhedron();
1597 fp4->SetVisAttributes(&fVisAtts);
1606 void G4VisCommandSceneAddLogo::G4Logo::operator()
1619 fpCommand -> SetGuidance (
"Adds 2D logo to current scene.");
1621 parameter =
new G4UIparameter (
"size",
'i', omitable =
true);
1622 parameter -> SetGuidance (
"Screen size of text in pixels.");
1623 parameter -> SetDefaultValue (48);
1625 parameter =
new G4UIparameter (
"x-position",
'd', omitable =
true);
1626 parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
1627 parameter -> SetDefaultValue (-0.9);
1629 parameter =
new G4UIparameter (
"y-position",
'd', omitable =
true);
1630 parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
1631 parameter -> SetDefaultValue (-0.9);
1633 parameter =
new G4UIparameter (
"layout",
's', omitable =
true);
1634 parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
1635 parameter -> SetDefaultValue (
"left");
1655 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1663 std::istringstream is(newValue);
1664 is >> size >> x >> y >> layoutString;
1676 const G4String& currentSceneName = pScene -> GetName ();
1677 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1680 G4cout <<
"2D logo has been added to scene \""
1681 << currentSceneName <<
"\"."
1689 void G4VisCommandSceneAddLogo2D::Logo2D::operator()
1707 fpCommand->SetParameterName(
"nDataPointsPerHalfScene",ommitable=
true);
1710 (
"Adds magnetic field representation to current scene.");
1712 (
"The parameter is no. of data points per half scene. So, possibly, at"
1713 "\nmaximum, the number of data points sampled is (2*n+1)^3, which can grow"
1714 "\nlarge--be warned!"
1715 "\nYou might find that your scene is cluttered by thousands of arrows for"
1716 "\nthe default number of data points, so try reducing to 2 or 3, e.g:"
1717 "\n /vis/scene/add/magneticField 3"
1718 "\nor, if only a small part of the scene has a field:"
1719 "\n /vis/scene/add/magneticField 50 # or more");
1721 (
"In the arrow representation, the length of the arrow is proportional"
1722 "\nto the magnitude of the field and the colour is mapped onto the range"
1723 "\nas a fraction of the maximum magnitude: 0->0.5->1 is blue->green->red.");
1743 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1748 G4int nDataPointsPerHalfScene =
fpCommand->GetNewIntValue(newValue);
1752 const G4String& currentSceneName = pScene -> GetName ();
1753 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1756 G4cout <<
"Magnetic field, if any, will be drawn in scene \""
1759 << nDataPointsPerHalfScene <<
" data points per half scene."
1773 (
"Adds Primitive Scorer Hits (PSHits) to current scene.");
1775 (
"PSHits are drawn at end of run when the scene in which"
1776 "\nthey are added is current.");
1778 (
"Optional parameter specifies name of scoring map. By default all"
1779 "\nscoring maps registered with the G4ScoringManager are drawn.");
1780 fpCommand -> SetParameterName (
"mapname", omitable =
true);
1801 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1807 const G4String& currentSceneName = pScene -> GetName ();
1808 G4bool successful = pScene -> AddEndOfRunModel (model, warn);
1811 if (newValue ==
"all") {
1812 G4cout <<
"All Primitive Scorer hits";
1814 G4cout <<
"Hits of Primitive Scorer \"" << newValue <<
'"';
1816 G4cout <<
" will be drawn at end of run in scene \""
1817 << currentSceneName <<
"\"."
1831 (
"Adds an annotated scale line to the current scene.");
1833 (
"If \"unit\" is \"auto\", length is roughly one tenth of the scene extent.");
1835 (
"If \"direction\" is \"auto\", scale is roughly in the plane of the current view.");
1837 (
"If \"placement\" is \"auto\", scale is placed at bottom left of current view."
1838 "\n Otherwise placed at (xmid,ymid,zmid).");
1841 parameter =
new G4UIparameter (
"length",
'd', omitable =
true);
1844 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1847 parameter =
new G4UIparameter (
"direction",
's', omitable =
true);
1851 parameter =
new G4UIparameter (
"red",
'd', omitable =
true);
1854 parameter =
new G4UIparameter (
"green",
'd', omitable =
true);
1857 parameter =
new G4UIparameter (
"blue",
'd', omitable =
true);
1860 parameter =
new G4UIparameter (
"placement",
's', omitable =
true);
1861 parameter -> SetParameterCandidates(
"auto manual");
1864 parameter =
new G4UIparameter (
"xmid",
'd', omitable =
true);
1867 parameter =
new G4UIparameter (
"ymid",
'd', omitable =
true);
1870 parameter =
new G4UIparameter (
"zmid",
'd', omitable =
true);
1873 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1894 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1901 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
1909 G4String userLengthUnit, direction, auto_manual, positionUnit;
1910 std::istringstream is (newValue);
1911 is >> userLength >> userLengthUnit >> direction
1912 >> red >> green >> blue
1914 >> xmid >> ymid >> zmid >> positionUnit;
1918 if (userLengthUnit ==
"auto") {
1920 const G4double intLog10Length = std::floor(std::log10(lengthMax));
1921 length = std::pow(10,intLog10Length);
1922 if (5.*length < lengthMax) length *= 5.;
1923 else if (2.*length < lengthMax) length *= 2.;
1930 xmid *= unit; ymid *= unit; zmid *= unit;
1933 if (direction(0) ==
'y') scaleDirection =
G4Scale::y;
1934 if (direction(0) ==
'z') scaleDirection =
G4Scale::z;
1940 "ERROR: G4VisCommandSceneAddScale::SetNewValue: no viewer."
1941 "\n Auto direction needs a viewer."
1952 if (direction ==
"auto") {
1953 if (std::abs(vp.x()) > std::abs(vp.y()) &&
1954 std::abs(vp.x()) > std::abs(vp.z())) {
1955 if (std::abs(up.y()) > std::abs(up.z())) scaleDirection =
G4Scale::z;
1958 else if (std::abs(vp.y()) > std::abs(vp.x()) &&
1959 std::abs(vp.y()) > std::abs(vp.z())) {
1960 if (std::abs(up.x()) > std::abs(up.z())) scaleDirection =
G4Scale::z;
1963 else if (std::abs(vp.z()) > std::abs(vp.x()) &&
1964 std::abs(vp.z()) > std::abs(vp.y())) {
1965 if (std::abs(up.y()) > std::abs(up.x())) scaleDirection =
G4Scale::x;
1970 G4bool autoPlacing =
false;
if (auto_manual ==
"auto") autoPlacing =
true;
1974 const G4double halfLength(length / 2.);
1976 const G4double freeLengthFraction (1. + 2. * comfort);
1991 "WARNING: Existing scene does not yet have any extent."
1992 "\n Maybe you have not yet added any geometrical object."
1998 switch (scaleDirection) {
2000 if (freeLengthFraction * (xmax - xmin) < length) room =
false;
break;
2002 if (freeLengthFraction * (ymax - ymin) < length) room =
false;
break;
2004 if (freeLengthFraction * (zmax - zmin) < length) room =
false;
break;
2010 "WARNING: Not enough room in existing scene. Maybe scale is too long."
2017 "WARNING: The scale you have asked for is bigger than the existing"
2018 "\n scene. Maybe you have added it too soon. It is recommended that"
2019 "\n you add the scale last so that it can be correctly auto-positioned"
2020 "\n so as not to be obscured by any existing object and so that the"
2021 "\n view parameters can be correctly recalculated."
2028 G4Scale scale(length, annotation, scaleDirection,
2029 false, xmid, ymid, zmid,
2035 globalDescription +=
" (" + newValue +
")";
2065 G4double sxmid(xmid), symid(ymid), szmid(zmid);
2069 const G4double xComfort = comfort * (xmax - xmin);
2070 const G4double yComfort = comfort * (ymax - ymin);
2071 const G4double zComfort = comfort * (zmax - zmin);
2072 switch (scaleDirection) {
2075 sxmid = xmax + xComfort;
2076 symid = ymin - yComfort;
2077 szmid = zmin - zComfort;
2079 sxmid = xmin - xComfort;
2080 symid = ymin - yComfort;
2081 szmid = zmax + zComfort;
2086 sxmid = xmin - xComfort;
2087 symid = ymax + yComfort;
2088 szmid = zmin - zComfort;
2090 sxmid = xmax + xComfort;
2091 symid = ymin - yComfort;
2092 szmid = zmin - zComfort;
2097 sxmid = xmax + xComfort;
2098 symid = ymin - yComfort;
2099 szmid = zmax + zComfort;
2101 sxmid = xmin - xComfort;
2102 symid = ymin - yComfort;
2103 szmid = zmax + zComfort;
2159 switch (scaleDirection) {
2161 scaleExtent =
G4VisExtent(-halfLength,halfLength,0,0,0,0);
2165 scaleExtent =
G4VisExtent(0,0,-halfLength,halfLength,0,0);
2169 scaleExtent =
G4VisExtent(0,0,0,0,-halfLength,halfLength);
2183 const G4String& currentSceneName = pScene -> GetName ();
2184 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2187 G4cout <<
"Scale of " << annotation
2188 <<
" added to scene \"" << currentSceneName <<
"\".";
2190 G4cout <<
"\n with extent " << scaleExtent
2191 <<
"\n at " << transform.getRotation()
2192 << transform.getTranslation();
2207 fpCommand -> SetGuidance (
"Adds text to current scene.");
2209 (
"Use \"/vis/set/textColour\" to set colour.");
2211 (
"Use \"/vis/set/textLayout\" to set layout:");
2222 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
2225 parameter =
new G4UIparameter (
"font_size",
'd', omitable =
true);
2229 parameter =
new G4UIparameter (
"x_offset",
'd', omitable =
true);
2233 parameter =
new G4UIparameter (
"y_offset",
'd', omitable =
true);
2237 parameter =
new G4UIparameter (
"text",
's', omitable =
true);
2238 parameter->
SetGuidance (
"The rest of the line is text.");
2259 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2275 x *= unit; y *= unit; z *= unit;
2284 const G4String& currentSceneName = pScene -> GetName ();
2285 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2288 G4cout <<
"Text \"" << text
2289 <<
"\" has been added to scene \"" << currentSceneName <<
"\"."
2303 fpCommand -> SetGuidance (
"Adds 2D text to current scene.");
2305 (
"Use \"/vis/set/textColour\" to set colour.");
2307 (
"Use \"/vis/set/textLayout\" to set layout:");
2315 parameter =
new G4UIparameter (
"font_size",
'd', omitable =
true);
2319 parameter =
new G4UIparameter (
"x_offset",
'd', omitable =
true);
2323 parameter =
new G4UIparameter (
"y_offset",
'd', omitable =
true);
2327 parameter =
new G4UIparameter (
"text",
's', omitable =
true);
2328 parameter->
SetGuidance (
"The rest of the line is text.");
2349 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2374 const G4String& currentSceneName = pScene -> GetName ();
2375 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2378 G4cout <<
"2D text \"" << text
2379 <<
"\" has been added to scene \"" << currentSceneName <<
"\"."
2391 void G4VisCommandSceneAddText2D::G4Text2D::operator()
2404 (
"/vis/scene/add/trajectories",
this);
2406 (
"Adds trajectories to current scene.");
2408 (
"Causes trajectories, if any, to be drawn at the end of processing an"
2409 "\nevent. Switches on trajectory storing and sets the"
2410 "\ndefault trajectory type.");
2412 (
"The command line parameter list determines the default trajectory type."
2413 "\nIf it contains the string \"smooth\", auxiliary inter-step points will"
2414 "\nbe inserted to improve the smoothness of the drawing of a curved"
2416 "\nIf it contains the string \"rich\", significant extra information will"
2417 "\nbe stored in the trajectory (G4RichTrajectory) amenable to modeling"
2418 "\nand filtering with \"/vis/modeling/trajectories/create/drawByAttribute\""
2419 "\nand \"/vis/filtering/trajectories/create/attributeFilter\" commands."
2420 "\nIt may contain both strings in any order.");
2422 (
"\nTo switch off trajectory storing: \"/tracking/storeTrajectory 0\"."
2423 "\nSee also \"/vis/scene/endOfEventAction\".");
2425 (
"Note: This only sets the default. Independently of the result of this"
2426 "\ncommand, a user may instantiate a trajectory that overrides this default"
2427 "\nin PreUserTrackingAction.");
2428 fpCommand -> SetParameterName (
"default-trajectory-type", omitable =
true);
2449 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2456 if (newValue.find(
"smooth") != std::string::npos) smooth =
true;
2457 if (newValue.find(
"rich") != std::string::npos) rich =
true;
2458 if (newValue.size() && !(rich || smooth)) {
2460 G4cerr <<
"ERROR: Unrecognised parameter \"" << newValue <<
"\""
2461 "\n No action taken."
2469 G4int newVerbose = 2;
2472 if (smooth && rich) {
2473 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 4");
2474 defaultTrajectoryType =
"G4RichTrajectory configured for smooth steps";
2475 }
else if (smooth) {
2476 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 2");
2477 defaultTrajectoryType =
"G4SmoothTrajectory";
2479 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 3");
2480 defaultTrajectoryType =
"G4RichTrajectory";
2482 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 1");
2483 defaultTrajectoryType =
"G4Trajectory";
2489 "Attributes available for modeling and filtering with"
2490 "\n \"/vis/modeling/trajectories/create/drawByAttribute\" and"
2491 "\n \"/vis/filtering/trajectories/create/attributeFilter\" commands:"
2497 }
else if (smooth) {
2507 const G4String& currentSceneName = pScene -> GetName ();
2508 pScene -> AddEndOfEventModel (model, warn);
2511 G4cout <<
"Default trajectory type " << defaultTrajectoryType
2512 <<
"\n will be used to store trajectories for scene \""
2513 << currentSceneName <<
"\"."
2519 "WARNING: Trajectory storing has been requested. This action may be"
2520 "\n reversed with \"/tracking/storeTrajectory 0\"."
2532 (
"Add named Vis User Action to current scene.");
2534 (
"Attempts to match search string to name of action - use unique sub-string.");
2536 (
"(Use /vis/list to see names of registered actions.)");
2538 (
"If name == \"all\" (default), all actions are added.");
2539 fpCommand -> SetParameterName(
"action-name", omitable =
true);
2559 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2566 const std::vector<G4VisManager::UserVisAction>& runDurationUserVisActions =
2568 for (
size_t i = 0; i < runDurationUserVisActions.size(); i++) {
2569 const G4String&
name = runDurationUserVisActions[i].fName;
2570 G4VUserVisAction* visAction = runDurationUserVisActions[i].fpUserVisAction;
2571 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2573 AddVisAction(name,visAction,pScene,runDuration,verbosity);
2577 const std::vector<G4VisManager::UserVisAction>& endOfEventUserVisActions =
2579 for (
size_t i = 0; i < endOfEventUserVisActions.size(); i++) {
2580 const G4String&
name = endOfEventUserVisActions[i].fName;
2582 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2584 AddVisAction(name,visAction,pScene,endOfEvent,verbosity);
2588 const std::vector<G4VisManager::UserVisAction>& endOfRunUserVisActions =
2590 for (
size_t i = 0; i < endOfRunUserVisActions.size(); i++) {
2591 const G4String&
name = endOfRunUserVisActions[i].fName;
2593 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2595 AddVisAction(name,visAction,pScene,endOfRun,verbosity);
2601 G4cout <<
"WARNING: No User Vis Action registered." <<
G4endl;
2606 const G4String& currentSceneName = pScene -> GetName ();
2619 const std::map<G4VUserVisAction*,G4VisExtent>& visExtentMap =
2622 std::map<G4VUserVisAction*,G4VisExtent>::const_iterator i =
2623 visExtentMap.find(visAction);
2624 if (i != visExtentMap.end()) extent = i->second;
2627 G4cout <<
"WARNING: User Vis Action extent is null." <<
G4endl;
2632 model->
SetType(
"User Vis Action");
2636 G4bool successful =
false;;
2639 successful = pScene -> AddRunDurationModel (model, warn);
2642 successful = pScene -> AddEndOfEventModel (model, warn);
2645 successful = pScene -> AddEndOfRunModel (model, warn);
2649 const G4String& currentSceneName = pScene -> GetName ();
2650 G4cout <<
"User Vis Action added to scene \""
2651 << currentSceneName <<
"\"";
2653 G4cout <<
"\n with extent " << extent;
2666 (
"Adds a physical volume to current scene, with optional clipping volume.");
2668 (
"If physical-volume-name is \"world\" (the default), the top of the"
2669 "\nmain geometry tree (material world) is added. If \"worlds\", the"
2670 "\ntop of all worlds - material world and parallel worlds, if any - are"
2671 "\nadded. Otherwise a search of all worlds is made, taking the first"
2672 "\nmatching occurence only. To see a representation of the geometry"
2673 "\nhierarchy of the worlds, try \"/vis/drawTree [worlds]\" or one of the"
2674 "\ndriver/browser combinations that have the required functionality, e.g., HepRep.");
2676 (
"If clip-volume-type is specified, the subsequent parameters are used to"
2677 "\nto define a clipping volume. For example,"
2678 "\n\"vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1\" will draw the world"
2679 "\nwith the positive octant cut away.");
2681 (
"If clip-volume-type is prepended with '-', the clip-volume is subtracted"
2682 "\n(cutaway). (This is the default if there is no prepended character.)"
2683 "\nIf '*' is prepended, the intersection of the physical-volume and the"
2684 "\nclip-volume is made. (You can make a section/DCUT with a thin box, for"
2687 (
"For \"box\", the parameters are xmin,xmax,ymin,ymax,zmin,zmax."
2688 "\nOnly \"box\" is programmed at present.");
2690 parameter =
new G4UIparameter (
"physical-volume-name",
's', omitable =
true);
2691 parameter -> SetDefaultValue (
"world");
2693 parameter =
new G4UIparameter (
"copy-no",
'i', omitable =
true);
2694 parameter -> SetGuidance
2695 (
"If negative, matches any copy no. First name match is taken.");
2696 parameter -> SetDefaultValue (-1);
2698 parameter =
new G4UIparameter (
"depth-of-descent",
'i', omitable =
true);
2699 parameter -> SetGuidance
2700 (
"Depth of descent of geometry hierarchy. Default = unlimited depth.");
2703 parameter =
new G4UIparameter (
"clip-volume-type",
's', omitable =
true);
2704 parameter -> SetParameterCandidates(
"none box -box *box");
2705 parameter -> SetDefaultValue (
"none");
2706 parameter -> SetGuidance(
"[-|*]type. See general guidance.");
2708 parameter =
new G4UIparameter (
"parameter-unit",
's', omitable =
true);
2709 parameter -> SetDefaultValue (
"m");
2711 parameter =
new G4UIparameter (
"parameter-1",
'd', omitable =
true);
2712 parameter -> SetDefaultValue (0.);
2714 parameter =
new G4UIparameter (
"parameter-2",
'd', omitable =
true);
2715 parameter -> SetDefaultValue (0.);
2717 parameter =
new G4UIparameter (
"parameter-3",
'd', omitable =
true);
2718 parameter -> SetDefaultValue (0.);
2720 parameter =
new G4UIparameter (
"parameter-4",
'd', omitable =
true);
2721 parameter -> SetDefaultValue (0.);
2723 parameter =
new G4UIparameter (
"parameter-5",
'd', omitable =
true);
2724 parameter -> SetDefaultValue (0.);
2726 parameter =
new G4UIparameter (
"parameter-6",
'd', omitable =
true);
2727 parameter -> SetDefaultValue (0.);
2736 return "world 0 -1";
2748 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2754 G4int copyNo, requestedDepthOfDescent;
2755 G4double param1, param2, param3, param4, param5, param6;
2756 std::istringstream is (newValue);
2757 is >> name >> copyNo >> requestedDepthOfDescent
2758 >> clipVolumeType >> parameterUnit
2759 >> param1 >> param2 >> param3 >> param4 >> param5 >> param6;
2762 if (clipVolumeType[
size_t(0)] ==
'-') {
2763 clipVolumeType = clipVolumeType.substr(1);
2764 }
else if (clipVolumeType[
size_t(0)] ==
'*') {
2766 clipVolumeType = clipVolumeType.substr(1);
2769 param1 *= unit; param2 *= unit; param3 *= unit;
2770 param4 *= unit; param5 *= unit; param6 *= unit;
2775 size_t nWorlds = transportationManager->
GetNoWorlds();
2778 static G4bool warned =
false;
2779 if (!warned && name !=
"worlds") {
2781 "WARNING: Parallel worlds in operation. To visualise, specify"
2782 "\n \"worlds\" or the parallel world volume or sub-volume name"
2783 "\n and control visibility with /vis/geometry."
2785 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2787 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2788 G4cout <<
" World " << i <<
": " << (*iterWorld)->GetName()
2801 "ERROR: G4VisCommandSceneAddVolume::SetNewValue:"
2802 "\n No world. Maybe the geometry has not yet been defined."
2803 "\n Try \"/run/initialize\""
2809 const std::vector<G4Scene::Model>& rdModelList = pScene -> GetRunDurationModelList();
2810 std::vector<G4Scene::Model>::const_iterator it;
2811 for (it = rdModelList.begin(); it != rdModelList.end(); ++it) {
2812 if (it->fpModel->GetGlobalDescription().find(
"G4PhysicalVolumeModel")
2813 != std::string::npos) {
2817 if (it != rdModelList.end()) {
2819 G4cout <<
"WARNING: There is already a volume, \""
2820 << it -> fpModel -> GetGlobalDescription()
2821 <<
"\",\n in the run-duration model list of scene \""
2822 << pScene -> GetName()
2823 <<
"\".\n To get a clean scene:"
2824 <<
"\n /vis/drawVolume " << name
2826 <<
"\n /vis/scene/create"
2827 <<
"\n /vis/scene/add/volume " << name
2828 <<
"\n /vis/sceneHandler/attach"
2829 <<
"\n (and also, if necessary, /vis/viewer/flush)"
2835 std::vector<G4PhysicalVolumeModel*> models;
2836 std::vector<G4VPhysicalVolume*> foundVolumes;
2839 typedef std::vector<PVNodeID>
PVPath;
2840 PVPath foundFullPVPath;
2841 std::vector<G4int> foundDepths;
2842 std::vector<G4Transform3D> transformations;
2844 if (name ==
"world") {
2848 foundVolumes.push_back(world);
2849 foundDepths.push_back(0);
2852 }
else if (name ==
"worlds") {
2857 "WARNING: G4VisCommandSceneAddVolume::SetNewValue:"
2858 "\n Parallel worlds requested but none exist."
2859 "\n Just adding material world."
2863 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2865 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2868 foundVolumes.push_back(*iterWorld);
2869 foundDepths.push_back(0);
2875 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2877 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2885 foundWorld = *iterWorld;
2886 foundVolumes.push_back(foundVolume);
2894 if (foundVolumes.size()) {
2895 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2897 (foundVolumes[i], requestedDepthOfDescent, transformations[i]);
2898 foundFullPVPath.pop_back();
2900 models.push_back(foundPVModel);
2904 G4cerr <<
"ERROR: Volume \"" << name <<
"\"";
2906 G4cerr <<
", copy no. " << copyNo <<
",";
2914 if (clipVolumeType ==
"box") {
2915 const G4double dX = (param2 - param1) / 2.;
2916 const G4double dY = (param4 - param3) / 2.;
2917 const G4double dZ = (param6 - param5) / 2.;
2918 const G4double x0 = (param2 + param1) / 2.;
2919 const G4double y0 = (param4 + param3) / 2.;
2923 (
"_displaced_clipping_box",
2924 new G4Box(
"_clipping_box",dX,dY,dZ),
2926 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2927 models[i]->SetClippingSolid(clippingSolid);
2928 models[i]->SetClippingMode(clippingMode);
2932 const G4String& currentSceneName = pScene -> GetName ();
2934 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2935 G4bool successful = pScene -> AddRunDurationModel (models[i], warn);
2939 G4cout <<
"First occurrence of \""
2940 << foundVolumes[i] -> GetName ()
2943 G4cout <<
", copy no. " << copyNo <<
",";
2948 G4cout <<
"at depth " << foundDepths[i]
2949 <<
",\n with a requested depth of further descent of ";
2950 if (requestedDepthOfDescent < 0) {
2951 G4cout <<
"<0 (unlimited)";
2954 G4cout << requestedDepthOfDescent;
2956 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)
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()
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()
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