64 #ifdef G4MULTITHREADED
90 fpCommand -> SetGuidance (
"Adds arrow to current scene.");
105 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
126 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
133 std::istringstream is(newValue);
134 is >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> unitString;
136 x1 *= unit; y1 *= unit; z1 *= unit;
137 x2 *= unit; y2 *= unit; z2 *= unit;
145 (x1, y1, z1, x2, y2, z2,
149 const G4String& currentSceneName = pScene -> GetName ();
150 G4bool successful = pScene -> AddRunDurationModel (model, warn);
153 G4cout <<
"Arrow has been added to scene \""
154 << currentSceneName <<
"\"."
167 fpCommand -> SetGuidance (
"Adds 2D arrow to current scene.");
196 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
202 std::istringstream is(newValue);
203 is >> x1 >> y1 >> x2 >>
y2;
212 const G4String& currentSceneName = pScene -> GetName ();
213 G4bool successful = pScene -> AddRunDurationModel (model, warn);
216 G4cout <<
"A 2D arrow has been added to scene \""
217 << currentSceneName <<
"\"."
230 fWidth(width), fColour(colour)
232 fShaftPolyline.push_back(
G4Point3D(x1,y1,0));
233 fShaftPolyline.push_back(
G4Point3D(x2,y2,0));
235 G4Vector3D arrowPointLeftDirection(arrowDirection);
237 G4Vector3D arrowPointRightDirection(arrowDirection);
239 fHeadPolyline.push_back(
G4Point3D(x2,y2,0)+0.04*arrowPointLeftDirection);
240 fHeadPolyline.push_back(
G4Point3D(x2,y2,0));
241 fHeadPolyline.push_back(
G4Point3D(x2,y2,0)+0.04*arrowPointRightDirection);
245 fShaftPolyline.SetVisAttributes(va);
246 fHeadPolyline.SetVisAttributes(va);
249 void G4VisCommandSceneAddArrow2D::Arrow2D::operator()
265 (
"Draws axes at (x0, y0, z0) of given length and colour.");
267 (
"If \"colour-string\" is \"auto\", x, y and z will be red, green and blue"
268 "\n respectively. Otherwise it can be one of the pre-defined text-specified"
269 "\n colours - see information printed by the vis manager at start-up or"
270 "\n use \"/vis/list\".");
272 (
"If \"length\" is negative, it is set to about 25% of scene extent.");
274 (
"If \"showtext\" is false, annotations are suppressed.");
285 parameter =
new G4UIparameter (
"length",
'd', omitable =
true);
288 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
291 parameter =
new G4UIparameter (
"colour-string",
's', omitable =
true);
294 parameter =
new G4UIparameter (
"showtext",
'b', omitable =
true);
315 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
322 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
329 G4String unitString, colourString, showTextString;
331 std::istringstream is (newValue);
332 is >> x0 >> y0 >> z0 >> length >> unitString
333 >> colourString >> showTextString;
338 x0 *= unit; y0 *= unit; z0 *= unit;
342 const G4double intLog10Length = std::floor(std::log10(lengthMax));
343 length = std::pow(10,intLog10Length);
344 if (5.*length < lengthMax) length *= 5.;
345 else if (2.*length < lengthMax) length *= 2.;
354 if (arrowWidth > length/50.) arrowWidth = length/50.;
357 (x0, y0, z0, length, arrowWidth, colourString, newValue,
360 G4bool successful = pScene -> AddRunDurationModel (model, warn);
361 const G4String& currentSceneName = pScene -> GetName ();
365 <<
"have been added to scene \"" << currentSceneName <<
"\"."
379 fpCommand -> SetGuidance (
"Adds date to current scene.");
381 (
"If \"date\"is omitted, the current date and time is drawn."
382 "\nOtherwise, the string, including the rest of the line, is drawn.");
384 parameter =
new G4UIparameter (
"size",
'i', omitable =
true);
385 parameter -> SetGuidance (
"Screen size of text in pixels.");
386 parameter -> SetDefaultValue (18);
388 parameter =
new G4UIparameter (
"x-position",
'd', omitable =
true);
389 parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
390 parameter -> SetDefaultValue (0.95);
392 parameter =
new G4UIparameter (
"y-position",
'd', omitable =
true);
393 parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
394 parameter -> SetDefaultValue (0.9);
396 parameter =
new G4UIparameter (
"layout",
's', omitable =
true);
397 parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
398 parameter -> SetDefaultValue (
"right");
400 parameter =
new G4UIparameter (
"date",
's', omitable =
true);
401 parameter -> SetDefaultValue (
"-");
421 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
429 std::istringstream is(newValue);
430 is >> size >> x >> y >> layoutString >> dateString;
432 const size_t NREMAINDER = 100;
433 char remainder[NREMAINDER];
435 is.getline(remainder, NREMAINDER);
436 dateString += remainder;
448 const G4String& currentSceneName = pScene -> GetName ();
449 G4bool successful = pScene -> AddRunDurationModel (model, warn);
452 G4cout <<
"Date has been added to scene \""
453 << currentSceneName <<
"\"."
462 void G4VisCommandSceneAddDate::Date::operator()
467 time = fTimer.GetClockTime();
472 std::string::size_type i = time.rfind(
'\n');
473 if (i != std::string::npos) time.erase(i);
488 fpCommand -> SetGuidance (
"Adds digis to current scene.");
490 (
"Digis are drawn at end of event when the scene in which"
491 "\nthey are added is current.");
510 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
516 const G4String& currentSceneName = pScene -> GetName ();
517 G4bool successful = pScene -> AddEndOfEventModel (model, warn);
520 G4cout <<
"Digis, if any, will be drawn at end of run in scene \""
521 << currentSceneName <<
"\"."
536 (
"Adds electric field representation to current scene.");
538 (
"The first parameter is no. of data points per half scene. So, possibly, at"
539 "\nmaximum, the number of data points sampled is (2*n+1)^3, which can grow"
540 "\nlarge--be warned!"
541 "\nThe default value is 10, i.e., a 21x21x21 array, i.e., 9,261 sampling points."
542 "\nThat may swamp you scene, but usually, a field is limited to a small part of"
543 "\nthe scene, so it's not a problem. But if it is, here are some of the things"
545 "\n- reduce the number of data points per half scene (first parameter);"
546 "\n- specify \"lightArrow\" (second parameter);"
547 "\n- restrict the region sampled with \"/vis/set/extentForField\";"
548 "\n- restrict the drawing to a specific volume with"
549 "\n \"/vis/set/volumeForField\" or \"/vis/touchable/volumeForField\"."
550 "\nNote: you may have to deactivate existing field models with"
551 "\n \"/vis/scene/activateModel Field false\" and re-issue"
552 "\n \"/vis/scene/add/...Field\" command again.");
554 (
"In the arrow representation, the length of the arrow is proportional"
555 "\nto the magnitude of the field and the colour is mapped onto the range"
556 "\nas a fraction of the maximum magnitude: 0->0.5->1 is blue->green->red.");
558 parameter =
new G4UIparameter (
"nDataPointsPerHalfScene",
'i', omitable =
true);
559 parameter -> SetDefaultValue (10);
561 parameter =
new G4UIparameter (
"representation",
's', omitable =
true);
562 parameter -> SetParameterCandidates(
"fullArrow lightArrow");
563 parameter -> SetDefaultValue (
"fullArrow");
581 G4Scene* pScene = fpVisManager->GetCurrentScene();
584 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
589 G4int nDataPointsPerHalfScene;
591 std::istringstream iss(newValue);
592 iss >> nDataPointsPerHalfScene >> representation;
595 if (representation ==
"lightArrow") {
600 (nDataPointsPerHalfScene,modelRepresentation,
601 fCurrentArrow3DLineSegmentsPerCircle,
602 fCurrentExtentForField,
603 fCurrrentPVFindingsForField);
604 const G4String& currentSceneName = pScene -> GetName ();
605 G4bool successful = pScene -> AddRunDurationModel (model, warn);
609 <<
"Electric field, if any, will be drawn in scene \""
612 << nDataPointsPerHalfScene
613 <<
" data points per half scene and with representation \""
619 else G4VisCommandsSceneAddUnsuccessful(verbosity);
621 CheckSceneAndNotifyHandlers (pScene);
629 fpCommand -> SetGuidance (
"Adds eventID to current scene.");
631 (
"Run and event numbers are drawn at end of event or run when"
632 "\n the scene in which they are added is current.");
634 parameter =
new G4UIparameter (
"size",
'i', omitable =
true);
635 parameter -> SetGuidance (
"Screen size of text in pixels.");
636 parameter -> SetDefaultValue (18);
638 parameter =
new G4UIparameter (
"x-position",
'd', omitable =
true);
639 parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
640 parameter -> SetDefaultValue (-0.95);
642 parameter =
new G4UIparameter (
"y-position",
'd', omitable =
true);
643 parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
644 parameter -> SetDefaultValue (0.9);
646 parameter =
new G4UIparameter (
"layout",
's', omitable =
true);
647 parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
648 parameter -> SetDefaultValue (
"left");
668 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
676 std::istringstream is(newValue);
677 is >> size >> x >> y >> layoutString;
689 eoeModel->
SetType(
"EoEEventID");
692 G4bool successfulEoE = pScene -> AddEndOfEventModel (eoeModel, warn);
699 eorModel->
SetType(
"EoREventID");
702 G4bool successfulEoR = pScene -> AddEndOfRunModel (eorModel, warn);
704 if (successfulEoE && successfulEoR) {
706 const G4String& currentSceneName = pScene -> GetName ();
707 G4cout <<
"EventID has been added to scene \""
708 << currentSceneName <<
"\"."
717 void G4VisCommandSceneAddEventID::EventID::operator()
721 #ifdef G4MULTITHREADED
726 if (!runManager)
return;
729 if (!currentRun)
return;
733 std::ostringstream oss;
738 if (!fpVisManager->GetReviewingKeptEvents())
return;
739 const G4Event* currentEvent = mp->GetEvent();
740 if (!currentEvent)
return;
742 oss <<
"Run " << currentRunID <<
" Event " << eventID;
748 if (fpVisManager->GetReviewingKeptEvents())
return;
751 size_t nKeptEvents = events? events->size(): 0;
752 oss <<
"Run " << currentRunID <<
" (" << nEvents <<
" event";
753 if (nEvents != 1) oss <<
's';
754 oss <<
", " << nKeptEvents <<
" kept)";
763 text.SetLayout(fLayout);
765 text.SetVisAttributes(textAtts);
776 (
"Adds a dummy model with given extent to the current scene."
777 "\nRequires the limits: xmin, xmax, ymin, ymax, zmin, zmax unit."
778 "\nThis can be used to provide an extent to the scene even if"
779 "\nno other models with extent are available. For example,"
780 "\neven if there is no geometry. In that case, for example:"
782 "\n /vis/scene/create"
783 "\n /vis/scene/add/extent -300 300 -300 300 -300 300 cm"
784 "\n /vis/sceneHandler/attach");
787 parameter =
new G4UIparameter (
"xmin",
'd', omitable =
true);
788 parameter -> SetDefaultValue (0.);
790 parameter =
new G4UIparameter (
"xmax",
'd', omitable =
true);
791 parameter -> SetDefaultValue (0.);
793 parameter =
new G4UIparameter (
"ymin",
'd', omitable =
true);
794 parameter -> SetDefaultValue (0.);
796 parameter =
new G4UIparameter (
"ymax",
'd', omitable =
true);
797 parameter -> SetDefaultValue (0.);
799 parameter =
new G4UIparameter (
"zmin",
'd', omitable =
true);
800 parameter -> SetDefaultValue (0.);
802 parameter =
new G4UIparameter (
"zmax",
'd', omitable =
true);
803 parameter -> SetDefaultValue (0.);
805 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
806 parameter -> SetDefaultValue (
"m");
826 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
833 std::istringstream is(newValue);
834 is >> xmin >> xmax >> ymin >> ymax >> zmin >> zmax >> unitString;
836 xmin *= unit; xmax *= unit;
837 ymin *= unit; ymax *= unit;
838 zmin *= unit; zmax *= unit;
840 G4VisExtent visExtent(xmin, xmax, ymin, ymax, zmin, zmax);
841 Extent* extent =
new Extent(xmin, xmax, ymin, ymax, zmin, zmax);
848 const G4String& currentSceneName = pScene -> GetName ();
849 G4bool successful = pScene -> AddRunDurationModel (model, warn);
852 G4cout <<
"A benign model with extent "
854 <<
" has been added to scene \""
855 << currentSceneName <<
"\"."
868 fExtent(xmin,xmax,ymin,ymax,zmin,zmax)
871 void G4VisCommandSceneAddExtent::Extent::operator()
879 fpCommand -> SetGuidance (
"Add frame to current scene.");
882 parameter =
new G4UIparameter (
"size",
'd', omitable =
true);
883 parameter -> SetGuidance (
"Size of frame. 1 = full window.");
884 parameter -> SetParameterRange (
"size > 0 && size <=1");
885 parameter -> SetDefaultValue (0.97);
905 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
911 std::istringstream is(newValue);
920 const G4String& currentSceneName = pScene -> GetName ();
921 G4bool successful = pScene -> AddRunDurationModel (model, warn);
924 G4cout <<
"Frame has been added to scene \""
925 << currentSceneName <<
"\"."
934 void G4VisCommandSceneAddFrame::Frame::operator()
938 frame.push_back(
G4Point3D( fSize, fSize, 0.));
939 frame.push_back(
G4Point3D(-fSize, fSize, 0.));
940 frame.push_back(
G4Point3D(-fSize, -fSize, 0.));
941 frame.push_back(
G4Point3D( fSize, -fSize, 0.));
942 frame.push_back(
G4Point3D( fSize, fSize, 0.));
959 (
"A representation of the source(s) of the General Particle Source"
960 "\nwill be added to current scene and drawn, if applicable.");
963 parameter =
new G4UIparameter(
"red_or_string",
's', omitable =
true);
964 parameter -> SetDefaultValue (
"1.");
966 parameter =
new G4UIparameter(
"green",
'd', omitable =
true);
967 parameter -> SetDefaultValue (0.);
969 parameter =
new G4UIparameter (
"blue",
'd', omitable =
true);
970 parameter -> SetDefaultValue (0.);
972 parameter =
new G4UIparameter (
"opacity",
'd', omitable =
true);
973 parameter -> SetDefaultValue (0.3);
993 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1000 std::istringstream iss(newValue);
1001 iss >> redOrString >> green >> blue >> opacity;
1006 const G4String& currentSceneName = pScene -> GetName ();
1007 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1011 "A representation of the source(s) of the General Particle Source will be drawn"
1012 "\n in colour " << colour <<
" for scene \""
1013 << currentSceneName <<
"\" if applicable."
1026 fpCommand -> SetGuidance (
"Adds hits to current scene.");
1028 (
"Hits are drawn at end of event when the scene in which"
1029 "\nthey are added is current.");
1048 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1054 const G4String& currentSceneName = pScene -> GetName ();
1055 G4bool successful = pScene -> AddEndOfEventModel (model, warn);
1058 G4cout <<
"Hits, if any, will be drawn at end of run in scene \""
1059 << currentSceneName <<
"\"."
1072 fpCommand -> SetGuidance (
"Adds line to current scene.");
1075 parameter =
new G4UIparameter (
"x1",
'd', omitable =
false);
1077 parameter =
new G4UIparameter (
"y1",
'd', omitable =
false);
1079 parameter =
new G4UIparameter (
"z1",
'd', omitable =
false);
1081 parameter =
new G4UIparameter (
"x2",
'd', omitable =
false);
1083 parameter =
new G4UIparameter (
"y2",
'd', omitable =
false);
1085 parameter =
new G4UIparameter (
"z2",
'd', omitable =
false);
1087 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1108 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1115 std::istringstream is(newValue);
1116 is >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> unitString;
1118 x1 *= unit; y1 *= unit; z1 *= unit;
1119 x2 *= unit; y2 *= unit; z2 *= unit;
1121 Line* line =
new Line(x1, y1, z1, x2, y2, z2,
1128 const G4String& currentSceneName = pScene -> GetName ();
1129 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1132 G4cout <<
"Line has been added to scene \""
1133 << currentSceneName <<
"\"."
1146 fWidth(width), fColour(colour)
1148 fPolyline.push_back(
G4Point3D(x1,y1,z1));
1149 fPolyline.push_back(
G4Point3D(x2,y2,z2));
1153 fPolyline.SetVisAttributes(va);
1156 void G4VisCommandSceneAddLine::Line::operator()
1168 fpCommand -> SetGuidance (
"Adds 2D line to current scene.");
1171 parameter =
new G4UIparameter (
"x1",
'd', omitable =
false);
1173 parameter =
new G4UIparameter (
"y1",
'd', omitable =
false);
1175 parameter =
new G4UIparameter (
"x2",
'd', omitable =
false);
1177 parameter =
new G4UIparameter (
"y2",
'd', omitable =
false);
1197 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1203 std::istringstream is(newValue);
1204 is >> x1 >> y1 >> x2 >>
y2;
1213 const G4String& currentSceneName = pScene -> GetName ();
1214 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1217 G4cout <<
"A 2D line has been added to scene \""
1218 << currentSceneName <<
"\"."
1231 fWidth(width), fColour(colour)
1233 fPolyline.push_back(
G4Point3D(x1,y1,0));
1234 fPolyline.push_back(
G4Point3D(x2,y2,0));
1238 fPolyline.SetVisAttributes(va);
1241 void G4VisCommandSceneAddLine2D::Line2D::operator()
1254 fpCommand -> SetGuidance (
"Adds a logical volume to the current scene,");
1256 (
"Shows boolean components (if any), voxels (if any), readout geometry"
1257 "\n (if any), local axes and overlaps (if any), under control of the"
1258 "\n appropriate flag."
1259 "\n Note: voxels are not constructed until start of run -"
1260 "\n \"/run/beamOn\". (For voxels without a run, \"/run/beamOn 0\".)");
1262 parameter =
new G4UIparameter (
"logical-volume-name",
's', omitable =
false);
1264 parameter =
new G4UIparameter (
"depth-of-descent",
'i', omitable =
true);
1265 parameter -> SetGuidance (
"Depth of descent of geometry hierarchy.");
1266 parameter -> SetDefaultValue (1);
1268 parameter =
new G4UIparameter (
"booleans-flag",
'b', omitable =
true);
1269 parameter -> SetDefaultValue (
true);
1271 parameter =
new G4UIparameter (
"voxels-flag",
'b', omitable =
true);
1272 parameter -> SetDefaultValue (
true);
1274 parameter =
new G4UIparameter (
"readout-flag",
'b', omitable =
true);
1275 parameter -> SetDefaultValue (
true);
1277 parameter =
new G4UIparameter (
"axes-flag",
'b', omitable =
true);
1278 parameter -> SetDefaultValue (
true);
1279 parameter -> SetGuidance (
"Set \"false\" to suppress axes.");
1281 parameter =
new G4UIparameter(
"check-overlap-flag",
'b', omitable =
true);
1283 parameter -> SetGuidance (
"Set \"false\" to suppress overlap check.");
1304 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1310 G4int requestedDepthOfDescent;
1311 G4String booleansString, voxelsString, readoutString, axesString;
1313 std::istringstream is (newValue);
1314 is >> name >> requestedDepthOfDescent
1315 >> booleansString >> voxelsString >> readoutString >> axesString
1324 int nLV = pLVStore -> size ();
1327 for (iLV = 0; iLV < nLV; iLV++ ) {
1328 pLV = (*pLVStore) [iLV];
1329 if (pLV -> GetName () == name)
break;
1333 G4cerr <<
"ERROR: Logical volume " << name
1334 <<
" not found in logical volume store." <<
G4endl;
1339 const std::vector<G4Scene::Model>& rdModelList =
1340 pScene -> GetRunDurationModelList();
1341 std::vector<G4Scene::Model>::const_iterator i;
1342 for (i = rdModelList.begin(); i != rdModelList.end(); ++i) {
1343 if (i->fpModel->GetGlobalDescription().find(
"Volume") != std::string::npos)
break;
1345 if (i != rdModelList.end()) {
1347 G4cout <<
"There is already a volume, \""
1348 << i->fpModel->GetGlobalDescription()
1349 <<
"\",\n in the run-duration model list of scene \""
1350 << pScene -> GetName()
1351 <<
"\".\n Your logical volume must be the only volume in the scene."
1352 <<
"\n Create a new scene and try again:"
1353 <<
"\n /vis/specify " << name
1355 <<
"\n /vis/scene/create"
1356 <<
"\n /vis/scene/add/logicalVolume " << name
1357 <<
"\n /vis/sceneHandler/attach"
1358 <<
"\n (and also, if necessary, /vis/viewer/flush)"
1365 (pLV, requestedDepthOfDescent, booleans, voxels, readout, checkOverlaps);
1366 const G4String& currentSceneName = pScene -> GetName ();
1367 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1371 G4bool axesSuccessful =
false;
1374 const G4double axisLengthMax = radius / 2.;
1375 const G4double intLog10Length = std::floor(std::log10(axisLengthMax));
1376 G4double axisLength = std::pow(10,intLog10Length);
1377 if (5.*axisLength < axisLengthMax) axisLength *= 5.;
1378 else if (2.*axisLength < axisLengthMax) axisLength *= 2.;
1379 const G4double axisWidth = axisLength / 20.;
1381 axesSuccessful = pScene -> AddRunDurationModel (axesModel, warn);
1392 G4cout <<
"Logical volume \"" << pLV -> GetName ()
1393 <<
"\" with requested depth of descent "
1394 << requestedDepthOfDescent
1396 if (!booleans)
G4cout <<
"out";
1397 G4cout <<
" boolean components, with";
1398 if (!voxels)
G4cout <<
"out";
1399 G4cout <<
" voxels,\n with";
1400 if (!readout)
G4cout <<
"out";
1401 G4cout <<
" readout geometry and with";
1402 if (!checkOverlaps)
G4cout <<
"out";
1403 G4cout <<
" overlap checking"
1404 <<
"\n has been added to scene \"" << currentSceneName <<
"\".";
1406 if (axesSuccessful) {
1408 "\n Axes have also been added at the origin of local cooordinates.";
1411 "\n Axes have not been added for some reason possibly stated above.";
1431 fpCommand -> SetGuidance (
"Adds a G4 logo to the current scene.");
1433 (
"If \"unit\" is \"auto\", height is roughly one tenth of scene extent.");
1435 (
"\"direction\" is that of outward-facing normal to front face of logo."
1436 "\nIf \"direction\" is \"auto\", logo faces the user in the current viewer.");
1438 (
"\nIf \"placement\" is \"auto\", logo is placed at bottom right of screen"
1439 "\n when viewed from logo direction.");
1441 parameter =
new G4UIparameter (
"height",
'd', omitable =
true);
1444 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1447 parameter =
new G4UIparameter (
"direction",
's', omitable =
true);
1451 parameter =
new G4UIparameter (
"red",
'd', omitable =
true);
1454 parameter =
new G4UIparameter (
"green",
'd', omitable =
true);
1457 parameter =
new G4UIparameter (
"blue",
'd', omitable =
true);
1460 parameter =
new G4UIparameter (
"placement",
's', omitable =
true);
1461 parameter -> SetParameterCandidates(
"auto manual");
1464 parameter =
new G4UIparameter (
"xmid",
'd', omitable =
true);
1467 parameter =
new G4UIparameter (
"ymid",
'd', omitable =
true);
1470 parameter =
new G4UIparameter (
"zmid",
'd', omitable =
true);
1473 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1494 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1501 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
1512 "ERROR: G4VisCommandSceneAddLogo::SetNewValue: no viewer."
1513 "\n Auto direction needs a viewer."
1519 G4double userHeight, red, green, blue, xmid, ymid, zmid;
1520 G4String userHeightUnit, direction, auto_manual, positionUnit;
1521 std::istringstream is (newValue);
1522 is >> userHeight >> userHeightUnit >> direction
1523 >> red >> green >> blue
1525 >> xmid >> ymid >> zmid >> positionUnit;
1529 if (userHeightUnit ==
"auto") {
1536 xmid *= unit; ymid *= unit; zmid *= unit;
1539 if (direction ==
"auto") {
1543 if (vp.
x() > vp.
y() && vp.
x() > vp.
z()) logoDirection =
X;
1544 else if (vp.
x() < vp.
y() && vp.
x() < vp.
z()) logoDirection =
minusX;
1545 else if (vp.
y() > vp.
x() && vp.
y() > vp.
z()) logoDirection =
Y;
1546 else if (vp.
y() < vp.
x() && vp.
y() < vp.
z()) logoDirection =
minusY;
1547 else if (vp.
z() > vp.
x() && vp.
z() > vp.
y()) logoDirection =
Z;
1548 else if (vp.
z() < vp.
x() && vp.
z() < vp.
y()) logoDirection =
minusZ;
1550 else if (direction(0) ==
'x') logoDirection =
X;
1551 else if (direction(0) ==
'y') logoDirection =
Y;
1552 else if (direction(0) ==
'z') logoDirection =
Z;
1553 else if (direction(0) ==
'-') {
1554 if (direction(1) ==
'x') logoDirection =
minusX;
1555 else if (direction(1) ==
'y') logoDirection =
minusY;
1556 else if (direction(1) ==
'z') logoDirection =
minusZ;
1559 G4cerr <<
"ERROR: Unrecogniseed direction: \""
1560 << direction <<
"\"." <<
G4endl;
1565 G4bool autoPlacing =
false;
if (auto_manual ==
"auto") autoPlacing =
true;
1582 "WARNING: Existing scene does not yet have any extent."
1583 "\n Maybe you have not yet added any geometrical object."
1589 const G4double halfHeight(height / 2.);
1591 const G4double freeHeightFraction (1. + 2. * comfort);
1595 switch (logoDirection) {
1598 if (freeHeightFraction * (xmax - xmin) < height) room =
false;
1602 if (freeHeightFraction * (ymax - ymin) < height) room =
false;
1606 if (freeHeightFraction * (zmax - zmin) < height) room =
false;
1613 "WARNING: Not enough room in existing scene. Maybe logo is too large."
1620 "WARNING: The logo you have asked for is bigger than the existing"
1621 "\n scene. Maybe you have added it too soon. It is recommended that"
1622 "\n you add the logo last so that it can be correctly auto-positioned"
1623 "\n so as not to be obscured by any existing object and so that the"
1624 "\n view parameters can be correctly recalculated."
1629 G4double sxmid(xmid), symid(ymid), szmid(zmid);
1635 const G4double zComfort = comfort * (zmax - zmin);
1636 switch (logoDirection) {
1638 sxmid = xmax + halfHeight + xComfort;
1639 symid = ymin - yComfort;
1640 szmid = zmin - zComfort;
1643 sxmid = xmin - halfHeight - xComfort;
1644 symid = ymin - yComfort;
1645 szmid = zmax + zComfort;
1648 sxmid = xmin - xComfort;
1649 symid = ymax + halfHeight + yComfort;
1650 szmid = zmin - zComfort;
1653 sxmid = xmax + xComfort;
1654 symid = ymin - halfHeight - yComfort;
1655 szmid = zmin - zComfort;
1658 sxmid = xmax + xComfort;
1659 symid = ymin - yComfort;
1660 szmid = zmax + halfHeight + zComfort;
1663 sxmid = xmin - xComfort;
1664 symid = ymin - yComfort;
1665 szmid = zmin - halfHeight - zComfort;
1671 switch (logoDirection) {
1711 const G4String& currentSceneName = pScene -> GetName ();
1712 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1715 G4cout <<
"G4 Logo of height " << userHeight <<
' ' << userHeightUnit
1716 <<
", " << direction <<
"-direction, added to scene \""
1717 << currentSceneName <<
"\"";
1719 G4cout <<
"\n with extent " << extent
1752 const G4double d = std::sqrt(dx * dx + dy * dy);
1755 const G4double x8 = ((-ss * d - dx * (yt - y8)) /
dy) + xt;
1757 G4double x9 = ((-(ss -
w) * d - dx * (yt - y8)) / dy) + xt;
1760 x9 += xtr; y9 += ytr;
1775 G4Box bG(
"bG",w2,ro2,d2);
1782 G4Box b1(
"b1",h2,h2,d2);
1783 G4Box bS(
"bS",ss,ss,d2+e);
1784 G4Box bS2(
"bS2",ss,ss,d2+2.*e);
1793 fp4 = logo4.CreatePolyhedron();
1802 fp4->SetVisAttributes(&fVisAtts);
1811 void G4VisCommandSceneAddLogo::G4Logo::operator()
1824 fpCommand -> SetGuidance (
"Adds 2D logo to current scene.");
1826 parameter =
new G4UIparameter (
"size",
'i', omitable =
true);
1827 parameter -> SetGuidance (
"Screen size of text in pixels.");
1828 parameter -> SetDefaultValue (48);
1830 parameter =
new G4UIparameter (
"x-position",
'd', omitable =
true);
1831 parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
1832 parameter -> SetDefaultValue (-0.9);
1834 parameter =
new G4UIparameter (
"y-position",
'd', omitable =
true);
1835 parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
1836 parameter -> SetDefaultValue (-0.9);
1838 parameter =
new G4UIparameter (
"layout",
's', omitable =
true);
1839 parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
1840 parameter -> SetDefaultValue (
"left");
1860 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1868 std::istringstream is(newValue);
1869 is >> size >> x >> y >> layoutString;
1881 const G4String& currentSceneName = pScene -> GetName ();
1882 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1885 G4cout <<
"2D logo has been added to scene \""
1886 << currentSceneName <<
"\"."
1895 void G4VisCommandSceneAddLogo2D::Logo2D::operator()
1913 (
"Adds magnetic field representation to current scene.");
1939 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1944 G4int nDataPointsPerHalfScene;
1946 std::istringstream iss(newValue);
1947 iss >> nDataPointsPerHalfScene >> representation;
1950 if (representation ==
"lightArrow") {
1955 (nDataPointsPerHalfScene,modelRepresentation,
1959 const G4String& currentSceneName = pScene -> GetName ();
1960 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1964 <<
"Magnetic field, if any, will be drawn in scene \""
1967 << nDataPointsPerHalfScene
1968 <<
" data points per half extent and with representation \""
1985 (
"Adds Primitive Scorer Hits (PSHits) to current scene.");
1987 (
"PSHits are drawn at end of run when the scene in which"
1988 "\nthey are added is current.");
1990 (
"Optional parameter specifies name of scoring map. By default all"
1991 "\nscoring maps registered with the G4ScoringManager are drawn.");
1992 fpCommand -> SetParameterName (
"mapname", omitable =
true);
2013 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2019 const G4String& currentSceneName = pScene -> GetName ();
2020 G4bool successful = pScene -> AddEndOfRunModel (model, warn);
2023 if (newValue ==
"all") {
2024 G4cout <<
"All Primitive Scorer hits";
2026 G4cout <<
"Hits of Primitive Scorer \"" << newValue <<
'"';
2028 G4cout <<
" will be drawn at end of run in scene \""
2029 << currentSceneName <<
"\"."
2044 (
"Adds an annotated scale line to the current scene.");
2046 (
"If \"unit\" is \"auto\", length is roughly one tenth of the scene extent.");
2048 (
"If \"direction\" is \"auto\", scale is roughly in the plane of the current view.");
2050 (
"If \"placement\" is \"auto\", scale is placed at bottom left of current view."
2051 "\n Otherwise placed at (xmid,ymid,zmid).");
2054 parameter =
new G4UIparameter (
"length",
'd', omitable =
true);
2057 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
2060 parameter =
new G4UIparameter (
"direction",
's', omitable =
true);
2064 parameter =
new G4UIparameter (
"red",
'd', omitable =
true);
2067 parameter =
new G4UIparameter (
"green",
'd', omitable =
true);
2070 parameter =
new G4UIparameter (
"blue",
'd', omitable =
true);
2073 parameter =
new G4UIparameter (
"placement",
's', omitable =
true);
2074 parameter -> SetParameterCandidates(
"auto manual");
2077 parameter =
new G4UIparameter (
"xmid",
'd', omitable =
true);
2080 parameter =
new G4UIparameter (
"ymid",
'd', omitable =
true);
2083 parameter =
new G4UIparameter (
"zmid",
'd', omitable =
true);
2086 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
2107 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2114 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
2121 G4double userLength, red, green, blue, xmid, ymid, zmid;
2122 G4String userLengthUnit, direction, auto_manual, positionUnit;
2123 std::istringstream is (newValue);
2124 is >> userLength >> userLengthUnit >> direction
2125 >> red >> green >> blue
2127 >> xmid >> ymid >> zmid >> positionUnit;
2131 if (userLengthUnit ==
"auto") {
2133 const G4double intLog10Length = std::floor(std::log10(lengthMax));
2134 length = std::pow(10,intLog10Length);
2135 if (5.*length < lengthMax) length *= 5.;
2136 else if (2.*length < lengthMax) length *= 2.;
2143 xmid *= unit; ymid *= unit; zmid *= unit;
2146 if (direction(0) ==
'y') scaleDirection =
G4Scale::y;
2147 if (direction(0) ==
'z') scaleDirection =
G4Scale::z;
2153 "ERROR: G4VisCommandSceneAddScale::SetNewValue: no viewer."
2154 "\n Auto direction needs a viewer."
2165 if (direction ==
"auto") {
2183 G4bool autoPlacing =
false;
if (auto_manual ==
"auto") autoPlacing =
true;
2187 const G4double halfLength(length / 2.);
2189 const G4double freeLengthFraction (1. + 2. * comfort);
2204 "WARNING: Existing scene does not yet have any extent."
2205 "\n Maybe you have not yet added any geometrical object."
2211 switch (scaleDirection) {
2213 if (freeLengthFraction * (xmax - xmin) <
length) room =
false;
2216 if (freeLengthFraction * (ymax - ymin) <
length) room =
false;
2219 if (freeLengthFraction * (zmax - zmin) <
length) room =
false;
2226 "WARNING: Not enough room in existing scene. Maybe scale is too long."
2233 "WARNING: The scale you have asked for is bigger than the existing"
2234 "\n scene. Maybe you have added it too soon. It is recommended that"
2235 "\n you add the scale last so that it can be correctly auto-positioned"
2236 "\n so as not to be obscured by any existing object and so that the"
2237 "\n view parameters can be correctly recalculated."
2245 false, xmid, ymid, zmid,
2251 globalDescription +=
" (" + newValue +
")";
2281 G4double sxmid(xmid), symid(ymid), szmid(zmid);
2287 const G4double zComfort = comfort * (zmax - zmin);
2288 switch (scaleDirection) {
2291 sxmid = xmax + xComfort;
2292 symid = ymin - yComfort;
2293 szmid = zmin - zComfort;
2295 sxmid = xmin - xComfort;
2296 symid = ymin - yComfort;
2297 szmid = zmax + zComfort;
2302 sxmid = xmin - xComfort;
2303 symid = ymax + yComfort;
2304 szmid = zmin - zComfort;
2306 sxmid = xmax + xComfort;
2307 symid = ymin - yComfort;
2308 szmid = zmin - zComfort;
2313 sxmid = xmax + xComfort;
2314 symid = ymin - yComfort;
2315 szmid = zmax + zComfort;
2317 sxmid = xmin - xComfort;
2318 symid = ymin - yComfort;
2319 szmid = zmax + zComfort;
2375 switch (scaleDirection) {
2377 scaleExtent =
G4VisExtent(-halfLength,halfLength,0,0,0,0);
2381 scaleExtent =
G4VisExtent(0,0,-halfLength,halfLength,0,0);
2385 scaleExtent =
G4VisExtent(0,0,0,0,-halfLength,halfLength);
2398 const G4String& currentSceneName = pScene -> GetName ();
2399 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2402 G4cout <<
"Scale of " << annotation
2403 <<
" added to scene \"" << currentSceneName <<
"\".";
2405 G4cout <<
"\n with extent " << scaleExtent
2423 fpCommand -> SetGuidance (
"Adds text to current scene.");
2425 (
"Use \"/vis/set/textColour\" to set colour.");
2427 (
"Use \"/vis/set/textLayout\" to set layout:");
2438 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
2441 parameter =
new G4UIparameter (
"font_size",
'd', omitable =
true);
2445 parameter =
new G4UIparameter (
"x_offset",
'd', omitable =
true);
2449 parameter =
new G4UIparameter (
"y_offset",
'd', omitable =
true);
2453 parameter =
new G4UIparameter (
"text",
's', omitable =
true);
2454 parameter->
SetGuidance (
"The rest of the line is text.");
2475 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2491 x *= unit; y *= unit; z *= unit;
2500 const G4String& currentSceneName = pScene -> GetName ();
2501 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2504 G4cout <<
"Text \"" << text
2505 <<
"\" has been added to scene \"" << currentSceneName <<
"\"."
2520 fpCommand -> SetGuidance (
"Adds 2D text to current scene.");
2522 (
"Use \"/vis/set/textColour\" to set colour.");
2524 (
"Use \"/vis/set/textLayout\" to set layout:");
2532 parameter =
new G4UIparameter (
"font_size",
'd', omitable =
true);
2536 parameter =
new G4UIparameter (
"x_offset",
'd', omitable =
true);
2540 parameter =
new G4UIparameter (
"y_offset",
'd', omitable =
true);
2544 parameter =
new G4UIparameter (
"text",
's', omitable =
true);
2545 parameter->
SetGuidance (
"The rest of the line is text.");
2566 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2591 const G4String& currentSceneName = pScene -> GetName ();
2592 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2595 G4cout <<
"2D text \"" << text
2596 <<
"\" has been added to scene \"" << currentSceneName <<
"\"."
2609 void G4VisCommandSceneAddText2D::G4Text2D::operator()
2622 (
"/vis/scene/add/trajectories",
this);
2624 (
"Adds trajectories to current scene.");
2626 (
"Causes trajectories, if any, to be drawn at the end of processing an"
2627 "\nevent. Switches on trajectory storing and sets the"
2628 "\ndefault trajectory type.");
2630 (
"The command line parameter list determines the default trajectory type."
2631 "\nIf it contains the string \"smooth\", auxiliary inter-step points will"
2632 "\nbe inserted to improve the smoothness of the drawing of a curved"
2634 "\nIf it contains the string \"rich\", significant extra information will"
2635 "\nbe stored in the trajectory (G4RichTrajectory) amenable to modeling"
2636 "\nand filtering with \"/vis/modeling/trajectories/create/drawByAttribute\""
2637 "\nand \"/vis/filtering/trajectories/create/attributeFilter\" commands."
2638 "\nIt may contain both strings in any order.");
2640 (
"\nTo switch off trajectory storing: \"/tracking/storeTrajectory 0\"."
2641 "\nSee also \"/vis/scene/endOfEventAction\".");
2643 (
"Note: This only sets the default. Independently of the result of this"
2644 "\ncommand, a user may instantiate a trajectory that overrides this default"
2645 "\nin PreUserTrackingAction.");
2646 fpCommand -> SetParameterName (
"default-trajectory-type", omitable =
true);
2667 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2671 const G4String& currentSceneName = pScene -> GetName ();
2675 if (newValue.find(
"smooth") != std::string::npos) smooth =
true;
2676 if (newValue.find(
"rich") != std::string::npos) rich =
true;
2677 if (newValue.size() && !(rich || smooth)) {
2679 G4cerr <<
"ERROR: Unrecognised parameter \"" << newValue <<
"\""
2680 "\n No action taken."
2688 G4int newVerbose = 2;
2691 if (smooth && rich) {
2692 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 4");
2693 defaultTrajectoryType =
"G4RichTrajectory configured for smooth steps";
2694 }
else if (smooth) {
2695 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 2");
2696 defaultTrajectoryType =
"G4SmoothTrajectory";
2698 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 3");
2699 defaultTrajectoryType =
"G4RichTrajectory";
2701 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 1");
2702 defaultTrajectoryType =
"G4Trajectory";
2708 "Attributes available for modeling and filtering with"
2709 "\n \"/vis/modeling/trajectories/create/drawByAttribute\" and"
2710 "\n \"/vis/filtering/trajectories/create/attributeFilter\" commands:"
2716 }
else if (smooth) {
2726 auto eoeModel = eoeList.begin();
2727 for (; eoeModel != eoeList.end(); ++eoeModel) {
2728 const auto* actualModel = eoeModel->fpModel;
2729 if (dynamic_cast<const G4TrajectoriesModel*>(actualModel))
break;
2731 if (eoeModel == eoeList.end()) {
2734 pScene -> AddEndOfEventModel (model, warn);
2740 G4cout <<
"Default trajectory type " << defaultTrajectoryType
2741 <<
"\n will be used to store trajectories for scene \""
2742 << currentSceneName <<
"\"."
2748 "WARNING: Trajectory storing has been requested. This action may be"
2749 "\n reversed with \"/tracking/storeTrajectory 0\"."
2762 (
"Add named Vis User Action to current scene.");
2764 (
"Attempts to match search string to name of action - use unique sub-string.");
2766 (
"(Use /vis/list to see names of registered actions.)");
2768 (
"If name == \"all\" (default), all actions are added.");
2769 fpCommand -> SetParameterName(
"action-name", omitable =
true);
2789 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2796 const std::vector<G4VisManager::UserVisAction>& runDurationUserVisActions =
2798 for (
size_t i = 0; i < runDurationUserVisActions.size(); i++) {
2799 const G4String&
name = runDurationUserVisActions[i].fName;
2800 G4VUserVisAction* visAction = runDurationUserVisActions[i].fpUserVisAction;
2801 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2803 AddVisAction(name,visAction,pScene,runDuration,verbosity);
2807 const std::vector<G4VisManager::UserVisAction>& endOfEventUserVisActions =
2809 for (
size_t i = 0; i < endOfEventUserVisActions.size(); i++) {
2810 const G4String&
name = endOfEventUserVisActions[i].fName;
2812 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2814 AddVisAction(name,visAction,pScene,endOfEvent,verbosity);
2818 const std::vector<G4VisManager::UserVisAction>& endOfRunUserVisActions =
2820 for (
size_t i = 0; i < endOfRunUserVisActions.size(); i++) {
2821 const G4String&
name = endOfRunUserVisActions[i].fName;
2823 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2825 AddVisAction(name,visAction,pScene,endOfRun,verbosity);
2831 G4cout <<
"WARNING: No User Vis Action registered." <<
G4endl;
2848 const std::map<G4VUserVisAction*,G4VisExtent>& visExtentMap =
2851 std::map<G4VUserVisAction*,G4VisExtent>::const_iterator i =
2852 visExtentMap.find(visAction);
2853 if (i != visExtentMap.end()) extent = i->second;
2857 <<
"WARNING: User Vis Action \"" << name <<
"\" extent is null."
2863 model->
SetType(
"User Vis Action");
2867 G4bool successful =
false;;
2870 successful = pScene -> AddRunDurationModel (model, warn);
2873 successful = pScene -> AddEndOfEventModel (model, warn);
2876 successful = pScene -> AddEndOfRunModel (model, warn);
2881 const G4String& currentSceneName = pScene -> GetName ();
2882 G4cout <<
"User Vis Action added to scene \""
2883 << currentSceneName <<
"\"";
2885 G4cout <<
"\n with extent " << extent;
2899 (
"Adds a physical volume to current scene, with optional clipping volume.");
2901 (
"If physical-volume-name is \"world\" (the default), the top of the"
2902 "\nmain geometry tree (material world) is added. If \"worlds\", the"
2903 "\ntops of all worlds - material world and parallel worlds, if any - are"
2904 "\nadded. Otherwise a search of all worlds is made.");
2906 (
"In the last case the names of all volumes in all worlds are matched"
2907 "\nagainst physical-volume-name. If this is of the form \"/regexp/\","
2908 "\nwhere regexp is a regular expression (see C++ regex), the match uses"
2909 "\nthe usual rules of regular expression matching. Otherwise an exact"
2910 "\nmatch is required."
2911 "\nFor example, \"/Shap/\" adds \"Shape1\" and \"Shape2\".");
2913 (
"It may help to see a textual representation of the geometry hierarchy of"
2914 "\nthe worlds. Try \"/vis/drawTree [worlds]\" or one of the driver/browser"
2915 "\ncombinations that have the required functionality, e.g., HepRepFile.");
2917 (
"If clip-volume-type is specified, the subsequent parameters are used to"
2918 "\nto define a clipping volume. For example,"
2919 "\n\"/vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1\" will draw the world"
2920 "\nwith the positive octant cut away. (If the Boolean Processor issues"
2921 "\nwarnings try replacing 0 by 0.000000001 or something.)");
2923 (
"If clip-volume-type is prepended with '-', the clip-volume is subtracted"
2924 "\n(cutaway). (This is the default if there is no prepended character.)"
2925 "\nIf '*' is prepended, the intersection of the physical-volume and the"
2926 "\nclip-volume is made. (You can make a section through the detector with"
2927 "\na thin box, for example).");
2929 (
"For \"box\", the parameters are xmin,xmax,ymin,ymax,zmin,zmax."
2930 "\nOnly \"box\" is programmed at present.");
2932 parameter =
new G4UIparameter (
"physical-volume-name",
's', omitable =
true);
2933 parameter -> SetDefaultValue (
"world");
2935 parameter =
new G4UIparameter (
"copy-no",
'i', omitable =
true);
2936 parameter -> SetGuidance (
"If negative, matches any copy no.");
2937 parameter -> SetDefaultValue (-1);
2939 parameter =
new G4UIparameter (
"depth-of-descent",
'i', omitable =
true);
2940 parameter -> SetGuidance
2941 (
"Depth of descent of geometry hierarchy. Default = unlimited depth.");
2944 parameter =
new G4UIparameter (
"clip-volume-type",
's', omitable =
true);
2945 parameter -> SetParameterCandidates(
"none box -box *box");
2946 parameter -> SetDefaultValue (
"none");
2947 parameter -> SetGuidance(
"[-|*]type. See general guidance.");
2949 parameter =
new G4UIparameter (
"parameter-unit",
's', omitable =
true);
2950 parameter -> SetDefaultValue (
"m");
2952 parameter =
new G4UIparameter (
"parameter-1",
'd', omitable =
true);
2953 parameter -> SetDefaultValue (0.);
2955 parameter =
new G4UIparameter (
"parameter-2",
'd', omitable =
true);
2956 parameter -> SetDefaultValue (0.);
2958 parameter =
new G4UIparameter (
"parameter-3",
'd', omitable =
true);
2959 parameter -> SetDefaultValue (0.);
2961 parameter =
new G4UIparameter (
"parameter-4",
'd', omitable =
true);
2962 parameter -> SetDefaultValue (0.);
2964 parameter =
new G4UIparameter (
"parameter-5",
'd', omitable =
true);
2965 parameter -> SetDefaultValue (0.);
2967 parameter =
new G4UIparameter (
"parameter-6",
'd', omitable =
true);
2968 parameter -> SetDefaultValue (0.);
2977 return "world 0 -1";
2989 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2995 G4int copyNo, requestedDepthOfDescent;
2996 G4double param1, param2, param3, param4, param5, param6;
2997 std::istringstream is (newValue);
2998 is >> name >> copyNo >> requestedDepthOfDescent
2999 >> clipVolumeType >> parameterUnit
3000 >> param1 >> param2 >> param3 >> param4 >> param5 >> param6;
3003 if (clipVolumeType[
size_t(0)] ==
'-') {
3004 clipVolumeType = clipVolumeType.substr(1);
3005 }
else if (clipVolumeType[
size_t(0)] ==
'*') {
3007 clipVolumeType = clipVolumeType.substr(1);
3010 param1 *= unit; param2 *= unit; param3 *= unit;
3011 param4 *= unit; param5 *= unit; param6 *= unit;
3014 if (clipVolumeType ==
"box") {
3017 const G4double dZ = (param6 - param5) / 2.;
3018 const G4double x0 = (param2 + param1) / 2.;
3019 const G4double y0 = (param4 + param3) / 2.;
3022 (
"_displaced_clipping_box",
3023 new G4Box(
"_clipping_box",dX,dY,dZ),
3030 size_t nWorlds = transportationManager->
GetNoWorlds();
3033 static G4bool warned =
false;
3034 if (!warned && name !=
"worlds") {
3036 "WARNING: Parallel worlds in operation. To visualise, specify"
3037 "\n \"worlds\" or the parallel world volume or sub-volume name"
3038 "\n and control visibility with /vis/geometry."
3040 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
3042 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
3043 G4cout <<
" World " << i <<
": " << (*iterWorld)->GetName()
3057 "ERROR: G4VisCommandSceneAddVolume::SetNewValue:"
3058 "\n No world. Maybe the geometry has not yet been defined."
3059 "\n Try \"/run/initialize\""
3065 std::vector<G4PhysicalVolumesSearchScene::Findings> findingsVector;
3067 if (name ==
"world") {
3069 findingsVector.push_back
3072 }
else if (name ==
"worlds") {
3077 "WARNING: G4VisCommandSceneAddVolume::SetNewValue:"
3078 "\n Parallel worlds requested but none exist."
3079 "\n Just adding material world."
3083 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
3085 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
3086 findingsVector.push_back
3088 (*iterWorld,*iterWorld));
3093 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
3095 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
3101 for (
const auto& findings: searchScene.
GetFindings()) {
3102 findingsVector.push_back(findings);
3107 for (
const auto& findings: findingsVector) {
3109 findings.fpFoundPV->SetCopyNo(findings.fFoundPVCopyNo);
3112 (findings.fpFoundPV,
3113 requestedDepthOfDescent,
3114 findings.fFoundObjectTransformation,
3117 findings.fFoundBasePVPath);
3118 if (clippingSolid) {
3122 if (!foundPVModel->
Validate(warn))
return;
3127 G4cout <<
"\"" << findings.fpFoundPV->GetName()
3128 <<
"\", copy no. " << findings.fFoundPVCopyNo
3129 <<
",\n found in searched volume \""
3130 << findings.fpSearchPV->GetName()
3131 <<
"\" at depth " << findings.fFoundDepth
3132 <<
",\n base path: \"" << findings.fFoundBasePVPath
3133 <<
"\",\n with a requested depth of further descent of ";
3134 if (requestedDepthOfDescent < 0) {
3135 G4cout <<
"<0 (unlimited)";
3138 G4cout << requestedDepthOfDescent;
3140 G4cout <<
",\n has been added to scene \"" << pScene->
GetName() <<
"\"."
3148 if (findingsVector.empty()) {
3150 G4cerr <<
"ERROR: Volume \"" << name <<
"\"";
3152 G4cerr <<
", copy no. " << copyNo <<
",";