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 \"colour-string\" is \"auto\", x, y and z will be red, green and blue"
273 "\n respectively. Otherwise it can be one of 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 (
"colour-string",
'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), readout geometry"
1094 "\n (if any) and local axes, under control of the appropriate flag."
1095 "\n Note: voxels are not constructed until start of run -"
1096 "\n \"/run/beamOn\". (For voxels without a run, \"/run/beamOn 0\".)");
1098 parameter =
new G4UIparameter (
"logical-volume-name",
's', omitable =
false);
1100 parameter =
new G4UIparameter (
"depth-of-descent",
'i', omitable =
true);
1101 parameter -> SetGuidance (
"Depth of descent of geometry hierarchy.");
1102 parameter -> SetDefaultValue (1);
1104 parameter =
new G4UIparameter (
"booleans-flag",
'b', omitable =
true);
1105 parameter -> SetDefaultValue (
true);
1107 parameter =
new G4UIparameter (
"voxels-flag",
'b', omitable =
true);
1108 parameter -> SetDefaultValue (
true);
1110 parameter =
new G4UIparameter (
"readout-flag",
'b', omitable =
true);
1111 parameter -> SetDefaultValue (
true);
1113 parameter =
new G4UIparameter (
"axes-flag",
'b', omitable =
true);
1114 parameter -> SetDefaultValue (
true);
1115 parameter -> SetGuidance (
"Set \"false\" to suppress axes.");
1136 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1142 G4int requestedDepthOfDescent;
1143 G4String booleansString, voxelsString, readoutString, axesString;
1144 std::istringstream is (newValue);
1145 is >> name >> requestedDepthOfDescent
1146 >> booleansString >> voxelsString >> readoutString >> axesString;
1153 int nLV = pLVStore -> size ();
1156 for (iLV = 0; iLV < nLV; iLV++ ) {
1157 pLV = (*pLVStore) [iLV];
1158 if (pLV -> GetName () == name)
break;
1162 G4cerr <<
"ERROR: Logical volume " << name
1163 <<
" not found in logical volume store." <<
G4endl;
1168 const std::vector<G4Scene::Model>& rdModelList =
1169 pScene -> GetRunDurationModelList();
1170 std::vector<G4Scene::Model>::const_iterator i;
1171 for (i = rdModelList.begin(); i != rdModelList.end(); ++i) {
1172 if (i->fpModel->GetGlobalDescription().find(
"Volume") != std::string::npos)
break;
1174 if (i != rdModelList.end()) {
1176 G4cout <<
"There is already a volume, \""
1177 << i->fpModel->GetGlobalDescription()
1178 <<
"\",\n in the run-duration model list of scene \""
1179 << pScene -> GetName()
1180 <<
"\".\n Your logical volume must be the only volume in the scene."
1181 <<
"\n Create a new scene and try again:"
1182 <<
"\n /vis/specify " << name
1184 <<
"\n /vis/scene/create"
1185 <<
"\n /vis/scene/add/logicalVolume " << name
1186 <<
"\n /vis/sceneHandler/attach"
1187 <<
"\n (and also, if necessary, /vis/viewer/flush)"
1194 (pLV, requestedDepthOfDescent, booleans, voxels, readout);
1195 const G4String& currentSceneName = pScene -> GetName ();
1196 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1200 G4bool axesSuccessful =
false;
1203 const G4double axisLengthMax = radius / 2.;
1204 const G4double intLog10Length = std::floor(std::log10(axisLengthMax));
1205 G4double axisLength = std::pow(10,intLog10Length);
1206 if (5.*axisLength < axisLengthMax) axisLength *= 5.;
1207 else if (2.*axisLength < axisLengthMax) axisLength *= 2.;
1208 const G4double axisWidth = axisLength / 20.;
1210 axesSuccessful = pScene -> AddRunDurationModel (axesModel, warn);
1221 G4cout <<
"Logical volume \"" << pLV -> GetName ()
1222 <<
" with requested depth of descent "
1223 << requestedDepthOfDescent
1225 if (!booleans)
G4cout <<
"out";
1226 G4cout <<
" boolean components, with";
1227 if (!voxels)
G4cout <<
"out";
1228 G4cout <<
" voxels and with";
1229 if (!readout)
G4cout <<
"out";
1230 G4cout <<
" readout geometry,"
1231 <<
"\n has been added to scene \"" << currentSceneName <<
"\".";
1233 if (axesSuccessful) {
1235 "\n Axes have also been added at the origin of local cooordinates.";
1238 "\n Axes have not been added for some reason possibly stated above.";
1258 fpCommand -> SetGuidance (
"Adds a G4 logo to the current scene.");
1260 (
"If \"unit\" is \"auto\", height is roughly one tenth of scene extent.");
1262 (
"\"direction\" is that of outward-facing normal to front face of logo."
1263 "\nIf \"direction\" is \"auto\", logo faces the user in the current viewer.");
1265 (
"\nIf \"placement\" is \"auto\", logo is placed at bottom right of screen"
1266 "\n when viewed from logo direction.");
1268 parameter =
new G4UIparameter (
"height",
'd', omitable =
true);
1271 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1274 parameter =
new G4UIparameter (
"direction",
's', omitable =
true);
1278 parameter =
new G4UIparameter (
"red",
'd', omitable =
true);
1281 parameter =
new G4UIparameter (
"green",
'd', omitable =
true);
1284 parameter =
new G4UIparameter (
"blue",
'd', omitable =
true);
1287 parameter =
new G4UIparameter (
"placement",
's', omitable =
true);
1288 parameter -> SetParameterCandidates(
"auto manual");
1291 parameter =
new G4UIparameter (
"xmid",
'd', omitable =
true);
1294 parameter =
new G4UIparameter (
"ymid",
'd', omitable =
true);
1297 parameter =
new G4UIparameter (
"zmid",
'd', omitable =
true);
1300 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1321 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1328 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
1339 "ERROR: G4VisCommandSceneAddLogo::SetNewValue: no viewer."
1340 "\n Auto direction needs a viewer."
1347 G4String userHeightUnit, direction, auto_manual, positionUnit;
1348 std::istringstream is (newValue);
1349 is >> userHeight >> userHeightUnit >> direction
1350 >> red >> green >> blue
1352 >> xmid >> ymid >> zmid >> positionUnit;
1356 if (userHeightUnit ==
"auto") {
1363 xmid *= unit; ymid *= unit; zmid *= unit;
1366 if (direction ==
"auto") {
1370 if (vp.x() > vp.y() && vp.x() > vp.z()) logoDirection =
X;
1371 else if (vp.x() < vp.y() && vp.x() < vp.z()) logoDirection =
minusX;
1372 else if (vp.y() > vp.x() && vp.y() > vp.z()) logoDirection =
Y;
1373 else if (vp.y() < vp.x() && vp.y() < vp.z()) logoDirection =
minusY;
1374 else if (vp.z() > vp.x() && vp.z() > vp.y()) logoDirection =
Z;
1375 else if (vp.z() < vp.x() && vp.z() < vp.y()) logoDirection =
minusZ;
1377 else if (direction(0) ==
'x') logoDirection =
X;
1378 else if (direction(0) ==
'y') logoDirection =
Y;
1379 else if (direction(0) ==
'z') logoDirection =
Z;
1380 else if (direction(0) ==
'-') {
1381 if (direction(1) ==
'x') logoDirection =
minusX;
1382 else if (direction(1) ==
'y') logoDirection =
minusY;
1383 else if (direction(1) ==
'z') logoDirection =
minusZ;
1386 G4cerr <<
"ERROR: Unrecogniseed direction: \""
1387 << direction <<
"\"." <<
G4endl;
1392 G4bool autoPlacing =
false;
if (auto_manual ==
"auto") autoPlacing =
true;
1409 "WARNING: Existing scene does not yet have any extent."
1410 "\n Maybe you have not yet added any geometrical object."
1416 const G4double halfHeight(height / 2.);
1418 const G4double freeHeightFraction (1. + 2. * comfort);
1422 switch (logoDirection) {
1425 if (freeHeightFraction * (xmax - xmin) < height) room =
false;
1429 if (freeHeightFraction * (ymax - ymin) < height) room =
false;
1433 if (freeHeightFraction * (zmax - zmin) < height) room =
false;
1440 "WARNING: Not enough room in existing scene. Maybe logo is too large."
1447 "WARNING: The logo you have asked for is bigger than the existing"
1448 "\n scene. Maybe you have added it too soon. It is recommended that"
1449 "\n you add the logo last so that it can be correctly auto-positioned"
1450 "\n so as not to be obscured by any existing object and so that the"
1451 "\n view parameters can be correctly recalculated."
1456 G4double sxmid(xmid), symid(ymid), szmid(zmid);
1460 const G4double xComfort = comfort * (xmax - xmin);
1461 const G4double yComfort = comfort * (ymax - ymin);
1462 const G4double zComfort = comfort * (zmax - zmin);
1463 switch (logoDirection) {
1465 sxmid = xmax + halfHeight + xComfort;
1466 symid = ymin - yComfort;
1467 szmid = zmin - zComfort;
1470 sxmid = xmin - halfHeight - xComfort;
1471 symid = ymin - yComfort;
1472 szmid = zmax + zComfort;
1475 sxmid = xmin - xComfort;
1476 symid = ymax + halfHeight + yComfort;
1477 szmid = zmin - zComfort;
1480 sxmid = xmax + xComfort;
1481 symid = ymin - halfHeight - yComfort;
1482 szmid = zmin - zComfort;
1485 sxmid = xmax + xComfort;
1486 symid = ymin - yComfort;
1487 szmid = zmax + halfHeight + zComfort;
1490 sxmid = xmin - xComfort;
1491 symid = ymin - yComfort;
1492 szmid = zmin - halfHeight - zComfort;
1498 switch (logoDirection) {
1538 const G4String& currentSceneName = pScene -> GetName ();
1539 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1542 G4cout <<
"G4 Logo of height " << userHeight <<
' ' << userHeightUnit
1543 <<
", " << direction <<
"-direction, added to scene \""
1544 << currentSceneName <<
"\"";
1546 G4cout <<
"\n with extent " << extent
1547 <<
"\n at " << transform.getRotation()
1548 << transform.getTranslation();
1573 const G4double xb = -h2, yb = f2 + w;
1574 const G4double dx = xt - xb, dy = yt - yb;
1577 rm.rotateZ(angle*
rad);
1578 const G4double d = std::sqrt(dx * dx + dy * dy);
1581 const G4double x8 = ((-ss * d - dx * (yt - y8)) / dy) + xt;
1583 G4double x9 = ((-(ss - w) * d - dx * (yt - y8)) / dy) + xt;
1585 const G4double xtr = ss - f1, ytr = -ss - f2 -w;
1586 x9 += xtr; y9 += ytr;
1601 G4Box bG(
"bG",w2,ro2,d2);
1608 G4Box b1(
"b1",h2,h2,d2);
1609 G4Box bS(
"bS",ss,ss,d2+e);
1610 G4Box bS2(
"bS2",ss,ss,d2+2.*e);
1619 fp4 = logo4.CreatePolyhedron();
1628 fp4->SetVisAttributes(&fVisAtts);
1637 void G4VisCommandSceneAddLogo::G4Logo::operator()
1650 fpCommand -> SetGuidance (
"Adds 2D logo to current scene.");
1652 parameter =
new G4UIparameter (
"size",
'i', omitable =
true);
1653 parameter -> SetGuidance (
"Screen size of text in pixels.");
1654 parameter -> SetDefaultValue (48);
1656 parameter =
new G4UIparameter (
"x-position",
'd', omitable =
true);
1657 parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
1658 parameter -> SetDefaultValue (-0.9);
1660 parameter =
new G4UIparameter (
"y-position",
'd', omitable =
true);
1661 parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
1662 parameter -> SetDefaultValue (-0.9);
1664 parameter =
new G4UIparameter (
"layout",
's', omitable =
true);
1665 parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
1666 parameter -> SetDefaultValue (
"left");
1686 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1694 std::istringstream is(newValue);
1695 is >> size >> x >> y >> layoutString;
1707 const G4String& currentSceneName = pScene -> GetName ();
1708 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1711 G4cout <<
"2D logo has been added to scene \""
1712 << currentSceneName <<
"\"."
1720 void G4VisCommandSceneAddLogo2D::Logo2D::operator()
1739 (
"Adds magnetic field representation to current scene.");
1741 (
"The first parameter is no. of data points per half scene. So, possibly, at"
1742 "\nmaximum, the number of data points sampled is (2*n+1)^3, which can grow"
1743 "\nlarge--be warned!"
1744 "\nYou might find that your scene is cluttered by thousands of arrows for"
1745 "\nthe default number of data points, so try reducing to 2 or 3, e.g:"
1746 "\n /vis/scene/add/magneticField 3"
1747 "\nor, if only a small part of the scene has a field:"
1748 "\n /vis/scene/add/magneticField 50 # or more");
1750 (
"In the arrow representation, the length of the arrow is proportional"
1751 "\nto the magnitude of the field and the colour is mapped onto the range"
1752 "\nas a fraction of the maximum magnitude: 0->0.5->1 is blue->green->red.");
1754 parameter =
new G4UIparameter (
"nDataPointsPerHalfScene",
'i', omitable =
true);
1755 parameter -> SetDefaultValue (10);
1757 parameter =
new G4UIparameter (
"representation",
's', omitable =
true);
1758 parameter -> SetParameterCandidates(
"fullArrow lightArrow");
1759 parameter -> SetDefaultValue (
"fullArrow");
1780 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1785 G4int nDataPointsPerHalfScene;
1787 std::istringstream iss(newValue);
1788 iss >> nDataPointsPerHalfScene >> representation;
1791 if (representation ==
"lightArrow") {
1796 const G4String& currentSceneName = pScene -> GetName ();
1797 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1800 G4cout <<
"Magnetic field, if any, will be drawn in scene \""
1803 << nDataPointsPerHalfScene
1804 <<
" data points per half scene and with representation \""
1820 (
"Adds Primitive Scorer Hits (PSHits) to current scene.");
1822 (
"PSHits are drawn at end of run when the scene in which"
1823 "\nthey are added is current.");
1825 (
"Optional parameter specifies name of scoring map. By default all"
1826 "\nscoring maps registered with the G4ScoringManager are drawn.");
1827 fpCommand -> SetParameterName (
"mapname", omitable =
true);
1848 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1854 const G4String& currentSceneName = pScene -> GetName ();
1855 G4bool successful = pScene -> AddEndOfRunModel (model, warn);
1858 if (newValue ==
"all") {
1859 G4cout <<
"All Primitive Scorer hits";
1861 G4cout <<
"Hits of Primitive Scorer \"" << newValue <<
'"';
1863 G4cout <<
" will be drawn at end of run in scene \""
1864 << currentSceneName <<
"\"."
1878 (
"Adds an annotated scale line to the current scene.");
1880 (
"If \"unit\" is \"auto\", length is roughly one tenth of the scene extent.");
1882 (
"If \"direction\" is \"auto\", scale is roughly in the plane of the current view.");
1884 (
"If \"placement\" is \"auto\", scale is placed at bottom left of current view."
1885 "\n Otherwise placed at (xmid,ymid,zmid).");
1888 parameter =
new G4UIparameter (
"length",
'd', omitable =
true);
1891 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1894 parameter =
new G4UIparameter (
"direction",
's', omitable =
true);
1898 parameter =
new G4UIparameter (
"red",
'd', omitable =
true);
1901 parameter =
new G4UIparameter (
"green",
'd', omitable =
true);
1904 parameter =
new G4UIparameter (
"blue",
'd', omitable =
true);
1907 parameter =
new G4UIparameter (
"placement",
's', omitable =
true);
1908 parameter -> SetParameterCandidates(
"auto manual");
1911 parameter =
new G4UIparameter (
"xmid",
'd', omitable =
true);
1914 parameter =
new G4UIparameter (
"ymid",
'd', omitable =
true);
1917 parameter =
new G4UIparameter (
"zmid",
'd', omitable =
true);
1920 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1941 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1948 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
1956 G4String userLengthUnit, direction, auto_manual, positionUnit;
1957 std::istringstream is (newValue);
1958 is >> userLength >> userLengthUnit >> direction
1959 >> red >> green >> blue
1961 >> xmid >> ymid >> zmid >> positionUnit;
1965 if (userLengthUnit ==
"auto") {
1967 const G4double intLog10Length = std::floor(std::log10(lengthMax));
1968 length = std::pow(10,intLog10Length);
1969 if (5.*length < lengthMax) length *= 5.;
1970 else if (2.*length < lengthMax) length *= 2.;
1977 xmid *= unit; ymid *= unit; zmid *= unit;
1980 if (direction(0) ==
'y') scaleDirection =
G4Scale::y;
1981 if (direction(0) ==
'z') scaleDirection =
G4Scale::z;
1987 "ERROR: G4VisCommandSceneAddScale::SetNewValue: no viewer."
1988 "\n Auto direction needs a viewer."
1999 if (direction ==
"auto") {
2000 if (std::abs(vp.x()) > std::abs(vp.y()) &&
2001 std::abs(vp.x()) > std::abs(vp.z())) {
2002 if (std::abs(up.y()) > std::abs(up.z())) scaleDirection =
G4Scale::z;
2005 else if (std::abs(vp.y()) > std::abs(vp.x()) &&
2006 std::abs(vp.y()) > std::abs(vp.z())) {
2007 if (std::abs(up.x()) > std::abs(up.z())) scaleDirection =
G4Scale::z;
2010 else if (std::abs(vp.z()) > std::abs(vp.x()) &&
2011 std::abs(vp.z()) > std::abs(vp.y())) {
2012 if (std::abs(up.y()) > std::abs(up.x())) scaleDirection =
G4Scale::x;
2017 G4bool autoPlacing =
false;
if (auto_manual ==
"auto") autoPlacing =
true;
2021 const G4double halfLength(length / 2.);
2023 const G4double freeLengthFraction (1. + 2. * comfort);
2038 "WARNING: Existing scene does not yet have any extent."
2039 "\n Maybe you have not yet added any geometrical object."
2045 switch (scaleDirection) {
2047 if (freeLengthFraction * (xmax - xmin) < length) room =
false;
2050 if (freeLengthFraction * (ymax - ymin) < length) room =
false;
2053 if (freeLengthFraction * (zmax - zmin) < length) room =
false;
2060 "WARNING: Not enough room in existing scene. Maybe scale is too long."
2067 "WARNING: The scale you have asked for is bigger than the existing"
2068 "\n scene. Maybe you have added it too soon. It is recommended that"
2069 "\n you add the scale last so that it can be correctly auto-positioned"
2070 "\n so as not to be obscured by any existing object and so that the"
2071 "\n view parameters can be correctly recalculated."
2078 G4Scale scale(length, annotation, scaleDirection,
2079 false, xmid, ymid, zmid,
2085 globalDescription +=
" (" + newValue +
")";
2115 G4double sxmid(xmid), symid(ymid), szmid(zmid);
2119 const G4double xComfort = comfort * (xmax - xmin);
2120 const G4double yComfort = comfort * (ymax - ymin);
2121 const G4double zComfort = comfort * (zmax - zmin);
2122 switch (scaleDirection) {
2125 sxmid = xmax + xComfort;
2126 symid = ymin - yComfort;
2127 szmid = zmin - zComfort;
2129 sxmid = xmin - xComfort;
2130 symid = ymin - yComfort;
2131 szmid = zmax + zComfort;
2136 sxmid = xmin - xComfort;
2137 symid = ymax + yComfort;
2138 szmid = zmin - zComfort;
2140 sxmid = xmax + xComfort;
2141 symid = ymin - yComfort;
2142 szmid = zmin - zComfort;
2147 sxmid = xmax + xComfort;
2148 symid = ymin - yComfort;
2149 szmid = zmax + zComfort;
2151 sxmid = xmin - xComfort;
2152 symid = ymin - yComfort;
2153 szmid = zmax + zComfort;
2209 switch (scaleDirection) {
2211 scaleExtent =
G4VisExtent(-halfLength,halfLength,0,0,0,0);
2215 scaleExtent =
G4VisExtent(0,0,-halfLength,halfLength,0,0);
2219 scaleExtent =
G4VisExtent(0,0,0,0,-halfLength,halfLength);
2233 const G4String& currentSceneName = pScene -> GetName ();
2234 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2237 G4cout <<
"Scale of " << annotation
2238 <<
" added to scene \"" << currentSceneName <<
"\".";
2240 G4cout <<
"\n with extent " << scaleExtent
2241 <<
"\n at " << transform.getRotation()
2242 << transform.getTranslation();
2257 fpCommand -> SetGuidance (
"Adds text to current scene.");
2259 (
"Use \"/vis/set/textColour\" to set colour.");
2261 (
"Use \"/vis/set/textLayout\" to set layout:");
2272 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
2275 parameter =
new G4UIparameter (
"font_size",
'd', omitable =
true);
2279 parameter =
new G4UIparameter (
"x_offset",
'd', omitable =
true);
2283 parameter =
new G4UIparameter (
"y_offset",
'd', omitable =
true);
2287 parameter =
new G4UIparameter (
"text",
's', omitable =
true);
2288 parameter->
SetGuidance (
"The rest of the line is text.");
2309 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2325 x *= unit; y *= unit; z *= unit;
2334 const G4String& currentSceneName = pScene -> GetName ();
2335 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2338 G4cout <<
"Text \"" << text
2339 <<
"\" has been added to scene \"" << currentSceneName <<
"\"."
2353 fpCommand -> SetGuidance (
"Adds 2D text to current scene.");
2355 (
"Use \"/vis/set/textColour\" to set colour.");
2357 (
"Use \"/vis/set/textLayout\" to set layout:");
2365 parameter =
new G4UIparameter (
"font_size",
'd', omitable =
true);
2369 parameter =
new G4UIparameter (
"x_offset",
'd', omitable =
true);
2373 parameter =
new G4UIparameter (
"y_offset",
'd', omitable =
true);
2377 parameter =
new G4UIparameter (
"text",
's', omitable =
true);
2378 parameter->
SetGuidance (
"The rest of the line is text.");
2399 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2424 const G4String& currentSceneName = pScene -> GetName ();
2425 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2428 G4cout <<
"2D text \"" << text
2429 <<
"\" has been added to scene \"" << currentSceneName <<
"\"."
2441 void G4VisCommandSceneAddText2D::G4Text2D::operator()
2454 (
"/vis/scene/add/trajectories",
this);
2456 (
"Adds trajectories to current scene.");
2458 (
"Causes trajectories, if any, to be drawn at the end of processing an"
2459 "\nevent. Switches on trajectory storing and sets the"
2460 "\ndefault trajectory type.");
2462 (
"The command line parameter list determines the default trajectory type."
2463 "\nIf it contains the string \"smooth\", auxiliary inter-step points will"
2464 "\nbe inserted to improve the smoothness of the drawing of a curved"
2466 "\nIf it contains the string \"rich\", significant extra information will"
2467 "\nbe stored in the trajectory (G4RichTrajectory) amenable to modeling"
2468 "\nand filtering with \"/vis/modeling/trajectories/create/drawByAttribute\""
2469 "\nand \"/vis/filtering/trajectories/create/attributeFilter\" commands."
2470 "\nIt may contain both strings in any order.");
2472 (
"\nTo switch off trajectory storing: \"/tracking/storeTrajectory 0\"."
2473 "\nSee also \"/vis/scene/endOfEventAction\".");
2475 (
"Note: This only sets the default. Independently of the result of this"
2476 "\ncommand, a user may instantiate a trajectory that overrides this default"
2477 "\nin PreUserTrackingAction.");
2478 fpCommand -> SetParameterName (
"default-trajectory-type", omitable =
true);
2499 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2506 if (newValue.find(
"smooth") != std::string::npos) smooth =
true;
2507 if (newValue.find(
"rich") != std::string::npos) rich =
true;
2508 if (newValue.size() && !(rich || smooth)) {
2510 G4cerr <<
"ERROR: Unrecognised parameter \"" << newValue <<
"\""
2511 "\n No action taken."
2519 G4int newVerbose = 2;
2522 if (smooth && rich) {
2523 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 4");
2524 defaultTrajectoryType =
"G4RichTrajectory configured for smooth steps";
2525 }
else if (smooth) {
2526 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 2");
2527 defaultTrajectoryType =
"G4SmoothTrajectory";
2529 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 3");
2530 defaultTrajectoryType =
"G4RichTrajectory";
2532 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 1");
2533 defaultTrajectoryType =
"G4Trajectory";
2539 "Attributes available for modeling and filtering with"
2540 "\n \"/vis/modeling/trajectories/create/drawByAttribute\" and"
2541 "\n \"/vis/filtering/trajectories/create/attributeFilter\" commands:"
2547 }
else if (smooth) {
2557 const G4String& currentSceneName = pScene -> GetName ();
2558 pScene -> AddEndOfEventModel (model, warn);
2561 G4cout <<
"Default trajectory type " << defaultTrajectoryType
2562 <<
"\n will be used to store trajectories for scene \""
2563 << currentSceneName <<
"\"."
2569 "WARNING: Trajectory storing has been requested. This action may be"
2570 "\n reversed with \"/tracking/storeTrajectory 0\"."
2582 (
"Add named Vis User Action to current scene.");
2584 (
"Attempts to match search string to name of action - use unique sub-string.");
2586 (
"(Use /vis/list to see names of registered actions.)");
2588 (
"If name == \"all\" (default), all actions are added.");
2589 fpCommand -> SetParameterName(
"action-name", omitable =
true);
2609 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2616 const std::vector<G4VisManager::UserVisAction>& runDurationUserVisActions =
2618 for (
size_t i = 0; i < runDurationUserVisActions.size(); i++) {
2619 const G4String&
name = runDurationUserVisActions[i].fName;
2620 G4VUserVisAction* visAction = runDurationUserVisActions[i].fpUserVisAction;
2621 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2623 AddVisAction(name,visAction,pScene,runDuration,verbosity);
2627 const std::vector<G4VisManager::UserVisAction>& endOfEventUserVisActions =
2629 for (
size_t i = 0; i < endOfEventUserVisActions.size(); i++) {
2630 const G4String&
name = endOfEventUserVisActions[i].fName;
2632 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2634 AddVisAction(name,visAction,pScene,endOfEvent,verbosity);
2638 const std::vector<G4VisManager::UserVisAction>& endOfRunUserVisActions =
2640 for (
size_t i = 0; i < endOfRunUserVisActions.size(); i++) {
2641 const G4String&
name = endOfRunUserVisActions[i].fName;
2643 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2645 AddVisAction(name,visAction,pScene,endOfRun,verbosity);
2651 G4cout <<
"WARNING: No User Vis Action registered." <<
G4endl;
2656 const G4String& currentSceneName = pScene -> GetName ();
2669 const std::map<G4VUserVisAction*,G4VisExtent>& visExtentMap =
2672 std::map<G4VUserVisAction*,G4VisExtent>::const_iterator i =
2673 visExtentMap.find(visAction);
2674 if (i != visExtentMap.end()) extent = i->second;
2677 G4cout <<
"WARNING: User Vis Action extent is null." <<
G4endl;
2682 model->
SetType(
"User Vis Action");
2686 G4bool successful =
false;;
2689 successful = pScene -> AddRunDurationModel (model, warn);
2692 successful = pScene -> AddEndOfEventModel (model, warn);
2695 successful = pScene -> AddEndOfRunModel (model, warn);
2699 const G4String& currentSceneName = pScene -> GetName ();
2700 G4cout <<
"User Vis Action added to scene \""
2701 << currentSceneName <<
"\"";
2703 G4cout <<
"\n with extent " << extent;
2716 (
"Adds a physical volume to current scene, with optional clipping volume.");
2718 (
"If physical-volume-name is \"world\" (the default), the top of the"
2719 "\nmain geometry tree (material world) is added. If \"worlds\", the"
2720 "\ntop of all worlds - material world and parallel worlds, if any - are"
2721 "\nadded. Otherwise a search of all worlds is made, taking the first"
2722 "\nmatching occurence only. To see a representation of the geometry"
2723 "\nhierarchy of the worlds, try \"/vis/drawTree [worlds]\" or one of the"
2724 "\ndriver/browser combinations that have the required functionality, e.g., HepRep.");
2726 (
"If clip-volume-type is specified, the subsequent parameters are used to"
2727 "\nto define a clipping volume. For example,"
2728 "\n\"/vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1\" will draw the world"
2729 "\nwith the positive octant cut away. (If the Boolean Processor issues"
2730 "\nwarnings try replacing 0 by 0.000000001 or something.)");
2732 (
"If clip-volume-type is prepended with '-', the clip-volume is subtracted"
2733 "\n(cutaway). (This is the default if there is no prepended character.)"
2734 "\nIf '*' is prepended, the intersection of the physical-volume and the"
2735 "\nclip-volume is made. (You can make a section/DCUT with a thin box, for"
2738 (
"For \"box\", the parameters are xmin,xmax,ymin,ymax,zmin,zmax."
2739 "\nOnly \"box\" is programmed at present.");
2741 parameter =
new G4UIparameter (
"physical-volume-name",
's', omitable =
true);
2742 parameter -> SetDefaultValue (
"world");
2744 parameter =
new G4UIparameter (
"copy-no",
'i', omitable =
true);
2745 parameter -> SetGuidance
2746 (
"If negative, matches any copy no. First name match is taken.");
2747 parameter -> SetDefaultValue (-1);
2749 parameter =
new G4UIparameter (
"depth-of-descent",
'i', omitable =
true);
2750 parameter -> SetGuidance
2751 (
"Depth of descent of geometry hierarchy. Default = unlimited depth.");
2754 parameter =
new G4UIparameter (
"clip-volume-type",
's', omitable =
true);
2755 parameter -> SetParameterCandidates(
"none box -box *box");
2756 parameter -> SetDefaultValue (
"none");
2757 parameter -> SetGuidance(
"[-|*]type. See general guidance.");
2759 parameter =
new G4UIparameter (
"parameter-unit",
's', omitable =
true);
2760 parameter -> SetDefaultValue (
"m");
2762 parameter =
new G4UIparameter (
"parameter-1",
'd', omitable =
true);
2763 parameter -> SetDefaultValue (0.);
2765 parameter =
new G4UIparameter (
"parameter-2",
'd', omitable =
true);
2766 parameter -> SetDefaultValue (0.);
2768 parameter =
new G4UIparameter (
"parameter-3",
'd', omitable =
true);
2769 parameter -> SetDefaultValue (0.);
2771 parameter =
new G4UIparameter (
"parameter-4",
'd', omitable =
true);
2772 parameter -> SetDefaultValue (0.);
2774 parameter =
new G4UIparameter (
"parameter-5",
'd', omitable =
true);
2775 parameter -> SetDefaultValue (0.);
2777 parameter =
new G4UIparameter (
"parameter-6",
'd', omitable =
true);
2778 parameter -> SetDefaultValue (0.);
2787 return "world 0 -1";
2799 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2805 G4int copyNo, requestedDepthOfDescent;
2806 G4double param1, param2, param3, param4, param5, param6;
2807 std::istringstream is (newValue);
2808 is >> name >> copyNo >> requestedDepthOfDescent
2809 >> clipVolumeType >> parameterUnit
2810 >> param1 >> param2 >> param3 >> param4 >> param5 >> param6;
2813 if (clipVolumeType[
size_t(0)] ==
'-') {
2814 clipVolumeType = clipVolumeType.substr(1);
2815 }
else if (clipVolumeType[
size_t(0)] ==
'*') {
2817 clipVolumeType = clipVolumeType.substr(1);
2820 param1 *= unit; param2 *= unit; param3 *= unit;
2821 param4 *= unit; param5 *= unit; param6 *= unit;
2826 size_t nWorlds = transportationManager->
GetNoWorlds();
2829 static G4bool warned =
false;
2830 if (!warned && name !=
"worlds") {
2832 "WARNING: Parallel worlds in operation. To visualise, specify"
2833 "\n \"worlds\" or the parallel world volume or sub-volume name"
2834 "\n and control visibility with /vis/geometry."
2836 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2838 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2839 G4cout <<
" World " << i <<
": " << (*iterWorld)->GetName()
2853 "ERROR: G4VisCommandSceneAddVolume::SetNewValue:"
2854 "\n No world. Maybe the geometry has not yet been defined."
2855 "\n Try \"/run/initialize\""
2861 std::vector<G4PhysicalVolumeModel*> models;
2862 std::vector<G4VPhysicalVolume*> foundVolumes;
2865 typedef std::vector<PVNodeID>
PVPath;
2866 PVPath foundFullPVPath;
2867 std::vector<G4int> foundDepths;
2868 std::vector<G4Transform3D> transformations;
2870 if (name ==
"world") {
2874 foundVolumes.push_back(world);
2875 foundDepths.push_back(0);
2878 }
else if (name ==
"worlds") {
2883 "WARNING: G4VisCommandSceneAddVolume::SetNewValue:"
2884 "\n Parallel worlds requested but none exist."
2885 "\n Just adding material world."
2889 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2891 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2894 foundVolumes.push_back(*iterWorld);
2895 foundDepths.push_back(0);
2901 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2903 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2911 foundWorld = *iterWorld;
2912 foundVolumes.push_back(foundVolume);
2920 if (foundVolumes.size()) {
2921 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2923 (foundVolumes[i], requestedDepthOfDescent, transformations[i]);
2924 foundFullPVPath.pop_back();
2926 models.push_back(foundPVModel);
2930 G4cerr <<
"ERROR: Volume \"" << name <<
"\"";
2932 G4cerr <<
", copy no. " << copyNo <<
",";
2940 if (clipVolumeType ==
"box") {
2941 const G4double dX = (param2 - param1) / 2.;
2942 const G4double dY = (param4 - param3) / 2.;
2943 const G4double dZ = (param6 - param5) / 2.;
2944 const G4double x0 = (param2 + param1) / 2.;
2945 const G4double y0 = (param4 + param3) / 2.;
2949 (
"_displaced_clipping_box",
2950 new G4Box(
"_clipping_box",dX,dY,dZ),
2952 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2953 models[i]->SetClippingSolid(clippingSolid);
2954 models[i]->SetClippingMode(clippingMode);
2958 const G4String& currentSceneName = pScene -> GetName ();
2960 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2961 G4bool successful = pScene -> AddRunDurationModel (models[i], warn);
2965 G4cout <<
"First occurrence of \""
2966 << foundVolumes[i] -> GetName ()
2969 G4cout <<
", copy no. " << copyNo <<
",";
2974 G4cout <<
"at depth " << foundDepths[i]
2975 <<
",\n with a requested depth of further descent of ";
2976 if (requestedDepthOfDescent < 0) {
2977 G4cout <<
"<0 (unlimited)";
2980 G4cout << requestedDepthOfDescent;
2982 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()
static G4double angle[DIM]
void SetDefaultValue(const char *theDefaultValue)
virtual void BeginPrimitives(const G4Transform3D &objectTransformation=G4Transform3D())=0
G4VisCommandSceneAddLine()
const std::vector< const G4Event * > * GetEventVector() const
G4VisCommandSceneAddTrajectories()
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
HepGeom::Point3D< G4double > G4Point3D
HepGeom::Vector3D< G4double > G4Vector3D
G4VisCommandSceneAddAxes()
const char * name(G4int ptype)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
static constexpr double rad
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)
void SetForceSolid(G4bool=true)
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)
static constexpr double pi
G4VViewer * GetCurrentViewer() const
virtual void EndPrimitives()=0
const G4Transform3D & GetFoundTransformation() const
static constexpr double halfpi
virtual ~G4VisCommandSceneAddVolume()
const std::vector< UserVisAction > & GetEndOfRunUserVisActions() const
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandSceneAddEventID()
static constexpr double deg
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