90 fpCommand =
new G4UIcommand(
"/vis/scene/add/arrow",
this);
91 fpCommand -> SetGuidance (
"Adds arrow to current scene.");
95 fpCommand -> SetParameter (parameter);
97 fpCommand -> SetParameter (parameter);
99 fpCommand -> SetParameter (parameter);
101 fpCommand -> SetParameter (parameter);
103 fpCommand -> SetParameter (parameter);
105 fpCommand -> SetParameter (parameter);
106 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
108 fpCommand->SetParameter (parameter);
127 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
134 std::istringstream is(newValue);
135 is >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> unitString;
137 x1 *= unit; y1 *= unit; z1 *= unit;
138 x2 *= unit; y2 *= unit; z2 *= unit;
146 (x1, y1, z1, x2, y2, z2,
150 const G4String& currentSceneName = pScene -> GetName ();
151 G4bool successful = pScene -> AddRunDurationModel (model, warn);
154 G4cout <<
"Arrow has been added to scene \""
155 << currentSceneName <<
"\"."
167 fpCommand =
new G4UIcommand(
"/vis/scene/add/arrow2D",
this);
168 fpCommand -> SetGuidance (
"Adds 2D arrow to current scene.");
169 fpCommand -> SetGuidance (
"x,y in range [-1,1]");
173 fpCommand -> SetParameter (parameter);
175 fpCommand -> SetParameter (parameter);
177 fpCommand -> SetParameter (parameter);
179 fpCommand -> SetParameter (parameter);
198 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
204 std::istringstream is(newValue);
205 is >> x1 >> y1 >> x2 >> y2;
207 Arrow2D* arrow2D =
new Arrow2D
214 const G4String& currentSceneName = pScene -> GetName ();
215 G4bool successful = pScene -> AddRunDurationModel (model, warn);
218 G4cout <<
"A 2D arrow has been added to scene \""
219 << currentSceneName <<
"\"."
228G4VisCommandSceneAddArrow2D::Arrow2D::Arrow2D
232 fWidth(width), fColour(colour)
234 fShaftPolyline.push_back(
G4Point3D(x1,y1,0));
235 fShaftPolyline.push_back(
G4Point3D(x2,y2,0));
237 G4Vector3D arrowPointLeftDirection(arrowDirection);
238 arrowPointLeftDirection.rotateZ(150.*deg);
239 G4Vector3D arrowPointRightDirection(arrowDirection);
240 arrowPointRightDirection.rotateZ(-150.*deg);
241 fHeadPolyline.push_back(
G4Point3D(x2,y2,0)+0.04*arrowPointLeftDirection);
242 fHeadPolyline.push_back(
G4Point3D(x2,y2,0));
243 fHeadPolyline.push_back(
G4Point3D(x2,y2,0)+0.04*arrowPointRightDirection);
247 fShaftPolyline.SetVisAttributes(va);
248 fHeadPolyline.SetVisAttributes(va);
251void G4VisCommandSceneAddArrow2D::Arrow2D::operator()
254 sceneHandler.BeginPrimitives2D();
255 sceneHandler.AddPrimitive(fShaftPolyline);
256 sceneHandler.AddPrimitive(fHeadPolyline);
257 sceneHandler.EndPrimitives2D();
264 fpCommand =
new G4UIcommand (
"/vis/scene/add/axes",
this);
265 fpCommand -> SetGuidance (
"Add axes.");
266 fpCommand -> SetGuidance
267 (
"Draws axes at (x0, y0, z0) of given length and colour.");
268 fpCommand -> SetGuidance
269 (
"If \"colour-string\" is \"auto\", x, y and z will be red, green and blue"
270 "\n respectively. Otherwise it can be one of the pre-defined text-specified"
271 "\n colours - see information printed by the vis manager at start-up or"
272 "\n use \"/vis/list\".");
273 fpCommand -> SetGuidance
274 (
"If \"length\" is negative, it is set to about 25% of scene extent.");
275 fpCommand -> SetGuidance
276 (
"If \"showtext\" is false, annotations are suppressed.");
280 fpCommand->SetParameter (parameter);
283 fpCommand->SetParameter (parameter);
286 fpCommand->SetParameter (parameter);
287 parameter =
new G4UIparameter (
"length",
'd', omitable =
true);
289 fpCommand->SetParameter (parameter);
290 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
292 fpCommand->SetParameter (parameter);
293 parameter =
new G4UIparameter (
"colour-string",
's', omitable =
true);
295 fpCommand->SetParameter (parameter);
296 parameter =
new G4UIparameter (
"showtext",
'b', omitable =
true);
298 fpCommand->SetParameter (parameter);
317 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
324 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
331 G4String unitString, colourString, showTextString;
333 std::istringstream is (newValue);
334 is >> x0 >> y0 >> z0 >> length >> unitString
335 >> colourString >> showTextString;
340 x0 *= unit; y0 *= unit; z0 *= unit;
344 const G4double intLog10Length = std::floor(std::log10(lengthMax));
345 length = std::pow(10,intLog10Length);
346 if (5.*length < lengthMax) length *= 5.;
347 else if (2.*length < lengthMax) length *= 2.;
356 if (arrowWidth > length/30.) arrowWidth = length/30.;
359 (x0, y0, z0, length, arrowWidth, colourString, newValue,
362 G4bool successful = pScene -> AddRunDurationModel (model, warn);
363 const G4String& currentSceneName = pScene -> GetName ();
367 <<
"have been added to scene \"" << currentSceneName <<
"\"."
380 fpCommand =
new G4UIcommand (
"/vis/scene/add/date",
this);
381 fpCommand -> SetGuidance (
"Adds date to current scene.");
382 fpCommand -> SetGuidance
383 (
"If \"date\"is omitted, the current date and time is drawn."
384 "\nOtherwise, the string, including the rest of the line, is drawn.");
386 parameter =
new G4UIparameter (
"size",
'i', omitable =
true);
387 parameter -> SetGuidance (
"Screen size of text in pixels.");
388 parameter -> SetDefaultValue (18);
389 fpCommand -> SetParameter (parameter);
390 parameter =
new G4UIparameter (
"x-position",
'd', omitable =
true);
391 parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
392 parameter -> SetDefaultValue (0.95);
393 fpCommand -> SetParameter (parameter);
394 parameter =
new G4UIparameter (
"y-position",
'd', omitable =
true);
395 parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
396 parameter -> SetDefaultValue (0.9);
397 fpCommand -> SetParameter (parameter);
398 parameter =
new G4UIparameter (
"layout",
's', omitable =
true);
399 parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
400 parameter -> SetDefaultValue (
"right");
401 fpCommand -> SetParameter (parameter);
402 parameter =
new G4UIparameter (
"date",
's', omitable =
true);
403 parameter -> SetDefaultValue (
"-");
404 fpCommand -> SetParameter (parameter);
423 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
431 std::istringstream is(newValue);
432 is >> size >> x >> y >> layoutString >> dateString;
434 const size_t NREMAINDER = 100;
435 char remainder[NREMAINDER];
437 is.getline(remainder, NREMAINDER);
438 dateString += remainder;
444 Date* date =
new Date(
fpVisManager, size, x, y, layout, dateString);
450 const G4String& currentSceneName = pScene -> GetName ();
451 G4bool successful = pScene -> AddEndOfEventModel(model, warn);
454 G4cout <<
"Date has been added to scene \""
455 << currentSceneName <<
"\"."
464void G4VisCommandSceneAddDate::Date::operator()
469 time = fTimer.GetClockTime();
474 std::string::size_type i = time.rfind(
'\n');
475 if (i != std::string::npos) time.erase(i);
477 text.SetScreenSize(fSize);
478 text.SetLayout(fLayout);
480 text.SetVisAttributes(textAtts);
481 sceneHandler.BeginPrimitives2D();
482 sceneHandler.AddPrimitive(text);
483 sceneHandler.EndPrimitives2D();
490 fpCommand -> SetGuidance (
"Adds digis to current scene.");
491 fpCommand -> SetGuidance
492 (
"Digis are drawn at end of event when the scene in which"
493 "\nthey are added is current.");
512 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
518 const G4String& currentSceneName = pScene -> GetName ();
519 G4bool successful = pScene -> AddEndOfEventModel (model, warn);
522 G4cout <<
"Digis, if any, will be drawn at end of run in scene \""
523 << currentSceneName <<
"\"."
536 fpCommand =
new G4UIcommand (
"/vis/scene/add/electricField",
this);
537 fpCommand -> SetGuidance
538 (
"Adds electric field representation to current scene.");
539 fpCommand -> SetGuidance
540 (
"The first parameter is no. of data points per half extent. So, possibly, at"
541 "\nmaximum, the number of data points sampled is (2*n+1)^3, which can grow"
542 "\nlarge--be warned!"
543 "\nThe default value is 10, i.e., a 21x21x21 array, i.e., 9,261 sampling points."
544 "\nThat may swamp your view, but usually, a field is limited to a small part of"
545 "\nthe extent, so it's not a problem. But if it is, here are some of the things"
547 "\n- reduce the number of data points per half extent (first parameter);"
548 "\n- specify \"lightArrow\" (second parameter);"
549 "\n- restrict the region sampled with \"/vis/set/extentForField\";"
550 "\n- restrict the drawing to a specific volume with"
551 "\n \"/vis/set/volumeForField\" or \"/vis/touchable/volumeForField\"."
552 "\nNote: you might have to deactivate existing field models with"
553 "\n \"/vis/scene/activateModel Field false\" and re-issue"
554 "\n \"/vis/scene/add/...Field\" command again.");
555 fpCommand -> SetGuidance
556 (
"In the arrow representation, the length of the arrow is proportional"
557 "\nto the magnitude of the field and the colour is mapped onto the range"
558 "\nas a fraction of the maximum magnitude: 0->0.5->1 is red->green->blue.");
560 parameter =
new G4UIparameter (
"nDataPointsPerHalfExtent",
'i', omitable =
true);
561 parameter -> SetDefaultValue (10);
562 fpCommand -> SetParameter (parameter);
563 parameter =
new G4UIparameter (
"representation",
's', omitable =
true);
564 parameter -> SetParameterCandidates(
"fullArrow lightArrow");
565 parameter -> SetDefaultValue (
"fullArrow");
566 fpCommand -> SetParameter (parameter);
586 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
591 G4int nDataPointsPerHalfExtent;
593 std::istringstream iss(newValue);
594 iss >> nDataPointsPerHalfExtent >> representation;
597 if (representation ==
"lightArrow") {
602 (nDataPointsPerHalfExtent,modelRepresentation,
606 const G4String& currentSceneName = pScene -> GetName ();
607 G4bool successful = pScene -> AddRunDurationModel (model, warn);
611 <<
"Electric field, if any, will be drawn in scene \""
614 << nDataPointsPerHalfExtent
615 <<
" data points per half extent and with representation \""
631 fpCommand -> SetGuidance (
"Macro is executed at end of run and when rebuild required.");
632 fpCommand -> SetGuidance
633 (
"WARNING: some vis commands in the macro cause recursion."
634 "\n Stick to simple commmands, e.g., which invoke vis manager Draw() methods.");
635 fpCommand -> SetParameterName (
"macro", omitable =
false);
654 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
659 auto endOfRunMacro =
new EndOfRunMacro(newValue);
662 model->
SetType(
"EndOfRunMacro");
665 const G4String& currentSceneName = pScene -> GetName ();
666 G4bool successful = pScene -> AddEndOfRunModel(model, warn);
669 G4cout <<
"EndOfRunMacro has been added to scene \""
670 << currentSceneName <<
"\"."
679void G4VisCommandSceneAddEndOfRunMacro::EndOfRunMacro::operator()
689 fpCommand =
new G4UIcommand (
"/vis/scene/add/eventID",
this);
690 fpCommand -> SetGuidance (
"Adds eventID to current scene.");
691 fpCommand -> SetGuidance
692 (
"Run and event numbers are drawn at end of event or run when"
693 "\n the scene in which they are added is current.");
695 parameter =
new G4UIparameter (
"size",
'i', omitable =
true);
696 parameter -> SetGuidance (
"Screen size of text in pixels.");
697 parameter -> SetDefaultValue (18);
698 fpCommand -> SetParameter (parameter);
699 parameter =
new G4UIparameter (
"x-position",
'd', omitable =
true);
700 parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
701 parameter -> SetDefaultValue (-0.95);
702 fpCommand -> SetParameter (parameter);
703 parameter =
new G4UIparameter (
"y-position",
'd', omitable =
true);
704 parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
705 parameter -> SetDefaultValue (0.9);
706 fpCommand -> SetParameter (parameter);
707 parameter =
new G4UIparameter (
"layout",
's', omitable =
true);
708 parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
709 parameter -> SetDefaultValue (
"left");
710 fpCommand -> SetParameter (parameter);
729 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
737 std::istringstream is(newValue);
738 is >> size >> x >> y >> layoutString;
747 =
new EventID(forEndOfEvent,
fpVisManager, size, x, y, layout);
750 eoeModel->
SetType(
"EoEEventID");
753 G4bool successfulEoE = pScene -> AddEndOfEventModel (eoeModel, warn);
757 =
new EventID(forEndOfRun,
fpVisManager, size, x, y, layout);
760 eorModel->
SetType(
"EoREventID");
763 G4bool successfulEoR = pScene -> AddEndOfRunModel (eorModel, warn);
765 if (successfulEoE && successfulEoR) {
767 const G4String& currentSceneName = pScene -> GetName ();
768 G4cout <<
"EventID has been added to scene \""
769 << currentSceneName <<
"\"."
778void G4VisCommandSceneAddEventID::EventID::operator()
786 if (!currentRun)
return;
790 std::ostringstream oss;
795 if (!fpVisManager->GetReviewingKeptEvents())
return;
796 const G4Event* currentEvent = mp->GetEvent();
797 if (!currentEvent)
return;
799 oss <<
"Run " << currentRunID <<
" Event " << eventID;
805 if (fpVisManager->GetReviewingKeptEvents())
return;
808 oss <<
"Run " << currentRunID <<
" (" << nEvents <<
" event";
809 if (nEvents != 1) oss <<
's';
810 oss <<
", " << nKeptEvents <<
" kept)";
818 text.SetScreenSize(fSize);
819 text.SetLayout(fLayout);
821 text.SetVisAttributes(textAtts);
822 sceneHandler.BeginPrimitives2D();
823 sceneHandler.AddPrimitive(text);
824 sceneHandler.EndPrimitives2D();
830 fpCommand =
new G4UIcommand(
"/vis/scene/add/extent",
this);
831 fpCommand -> SetGuidance
832 (
"Adds a dummy model with given extent to the current scene."
833 "\nRequires the limits: xmin, xmax, ymin, ymax, zmin, zmax unit."
834 "\nThis can be used to provide an extent to the scene even if"
835 "\nno other models with extent are available. For example,"
836 "\neven if there is no geometry. In that case, for example:"
838 "\n /vis/scene/create"
839 "\n /vis/scene/add/extent -300 300 -300 300 -300 300 cm"
840 "\n /vis/sceneHandler/attach");
843 parameter =
new G4UIparameter (
"xmin",
'd', omitable =
true);
844 parameter -> SetDefaultValue (0.);
845 fpCommand -> SetParameter (parameter);
846 parameter =
new G4UIparameter (
"xmax",
'd', omitable =
true);
847 parameter -> SetDefaultValue (0.);
848 fpCommand -> SetParameter (parameter);
849 parameter =
new G4UIparameter (
"ymin",
'd', omitable =
true);
850 parameter -> SetDefaultValue (0.);
851 fpCommand -> SetParameter (parameter);
852 parameter =
new G4UIparameter (
"ymax",
'd', omitable =
true);
853 parameter -> SetDefaultValue (0.);
854 fpCommand -> SetParameter (parameter);
855 parameter =
new G4UIparameter (
"zmin",
'd', omitable =
true);
856 parameter -> SetDefaultValue (0.);
857 fpCommand -> SetParameter (parameter);
858 parameter =
new G4UIparameter (
"zmax",
'd', omitable =
true);
859 parameter -> SetDefaultValue (0.);
860 fpCommand -> SetParameter (parameter);
861 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
862 parameter -> SetDefaultValue (
"m");
863 fpCommand -> SetParameter (parameter);
882 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
887 G4double xmin, xmax, ymin, ymax, zmin, zmax;
889 std::istringstream is(newValue);
890 is >> xmin >> xmax >> ymin >> ymax >> zmin >> zmax >> unitString;
892 xmin *= unit; xmax *= unit;
893 ymin *= unit; ymax *= unit;
894 zmin *= unit; zmax *= unit;
896 G4VisExtent visExtent(xmin, xmax, ymin, ymax, zmin, zmax);
897 Extent* extent =
new Extent(xmin, xmax, ymin, ymax, zmin, zmax);
904 const G4String& currentSceneName = pScene -> GetName ();
905 G4bool successful = pScene -> AddRunDurationModel (model, warn);
908 G4cout <<
"A benign model with extent "
910 <<
" has been added to scene \""
911 << currentSceneName <<
"\"."
920G4VisCommandSceneAddExtent::Extent::Extent
924fExtent(xmin,xmax,ymin,ymax,zmin,zmax)
927void G4VisCommandSceneAddExtent::Extent::operator()
934 fpCommand =
new G4UIcommand(
"/vis/scene/add/frame",
this);
935 fpCommand -> SetGuidance (
"Add frame to current scene.");
938 parameter =
new G4UIparameter (
"size",
'd', omitable =
true);
939 parameter -> SetGuidance (
"Size of frame. 1 = full window.");
940 parameter -> SetParameterRange (
"size > 0 && size <=1");
941 parameter -> SetDefaultValue (0.97);
942 fpCommand -> SetParameter (parameter);
961 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
967 std::istringstream is(newValue);
976 const G4String& currentSceneName = pScene -> GetName ();
977 G4bool successful = pScene -> AddRunDurationModel (model, warn);
980 G4cout <<
"Frame has been added to scene \""
981 << currentSceneName <<
"\"."
990void G4VisCommandSceneAddFrame::Frame::operator()
994 frame.push_back(
G4Point3D( fSize, fSize, 0.));
995 frame.push_back(
G4Point3D(-fSize, fSize, 0.));
996 frame.push_back(
G4Point3D(-fSize, -fSize, 0.));
997 frame.push_back(
G4Point3D( fSize, -fSize, 0.));
998 frame.push_back(
G4Point3D( fSize, fSize, 0.));
1003 sceneHandler.BeginPrimitives2D();
1004 sceneHandler.AddPrimitive(frame);
1005 sceneHandler.EndPrimitives2D();
1013 fpCommand =
new G4UIcommand (
"/vis/scene/add/gps",
this);
1014 fpCommand -> SetGuidance
1015 (
"A representation of the source(s) of the General Particle Source"
1016 "\nwill be added to current scene and drawn, if applicable.");
1018 fpCommand->SetGuidance(
"Default: red and transparent.");
1019 parameter =
new G4UIparameter(
"red_or_string",
's', omitable =
true);
1020 parameter -> SetDefaultValue (
"1.");
1021 fpCommand -> SetParameter (parameter);
1022 parameter =
new G4UIparameter(
"green",
'd', omitable =
true);
1023 parameter -> SetDefaultValue (0.);
1024 fpCommand -> SetParameter (parameter);
1025 parameter =
new G4UIparameter (
"blue",
'd', omitable =
true);
1026 parameter -> SetDefaultValue (0.);
1027 fpCommand -> SetParameter (parameter);
1028 parameter =
new G4UIparameter (
"opacity",
'd', omitable =
true);
1029 parameter -> SetDefaultValue (0.3);
1030 fpCommand -> SetParameter (parameter);
1049 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
1056 std::istringstream iss(newValue);
1057 iss >> redOrString >> green >> blue >> opacity;
1062 const G4String& currentSceneName = pScene -> GetName ();
1063 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1067 "A representation of the source(s) of the General Particle Source will be drawn"
1068 "\n in colour " << colour <<
" for scene \""
1069 << currentSceneName <<
"\" if applicable."
1082 fpCommand -> SetGuidance (
"Adds hits to current scene.");
1083 fpCommand -> SetGuidance
1084 (
"Hits are drawn at end of event when the scene in which"
1085 "\nthey are added is current.");
1104 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
1110 const G4String& currentSceneName = pScene -> GetName ();
1111 G4bool successful = pScene -> AddEndOfEventModel (model, warn);
1114 G4cout <<
"Hits, if any, will be drawn at end of run in scene \""
1115 << currentSceneName <<
"\"."
1127 fpCommand =
new G4UIcommand(
"/vis/scene/add/line",
this);
1128 fpCommand -> SetGuidance (
"Adds line to current scene.");
1131 parameter =
new G4UIparameter (
"x1",
'd', omitable =
false);
1132 fpCommand -> SetParameter (parameter);
1133 parameter =
new G4UIparameter (
"y1",
'd', omitable =
false);
1134 fpCommand -> SetParameter (parameter);
1135 parameter =
new G4UIparameter (
"z1",
'd', omitable =
false);
1136 fpCommand -> SetParameter (parameter);
1137 parameter =
new G4UIparameter (
"x2",
'd', omitable =
false);
1138 fpCommand -> SetParameter (parameter);
1139 parameter =
new G4UIparameter (
"y2",
'd', omitable =
false);
1140 fpCommand -> SetParameter (parameter);
1141 parameter =
new G4UIparameter (
"z2",
'd', omitable =
false);
1142 fpCommand -> SetParameter (parameter);
1143 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1145 fpCommand->SetParameter (parameter);
1164 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
1171 std::istringstream is(newValue);
1172 is >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> unitString;
1174 x1 *= unit; y1 *= unit; z1 *= unit;
1175 x2 *= unit; y2 *= unit; z2 *= unit;
1177 Line* line =
new Line(x1, y1, z1, x2, y2, z2,
1184 const G4String& currentSceneName = pScene -> GetName ();
1185 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1188 G4cout <<
"Line has been added to scene \""
1189 << currentSceneName <<
"\"."
1198G4VisCommandSceneAddLine::Line::Line
1202 fWidth(width), fColour(colour)
1204 fPolyline.push_back(
G4Point3D(x1,y1,z1));
1205 fPolyline.push_back(
G4Point3D(x2,y2,z2));
1209 fPolyline.SetVisAttributes(va);
1212void G4VisCommandSceneAddLine::Line::operator()
1215 sceneHandler.BeginPrimitives();
1216 sceneHandler.AddPrimitive(fPolyline);
1217 sceneHandler.EndPrimitives();
1223 fpCommand =
new G4UIcommand(
"/vis/scene/add/line2D",
this);
1224 fpCommand -> SetGuidance (
"Adds 2D line to current scene.");
1225 fpCommand -> SetGuidance (
"x,y in range [-1,1]");
1228 parameter =
new G4UIparameter (
"x1",
'd', omitable =
false);
1229 fpCommand -> SetParameter (parameter);
1230 parameter =
new G4UIparameter (
"y1",
'd', omitable =
false);
1231 fpCommand -> SetParameter (parameter);
1232 parameter =
new G4UIparameter (
"x2",
'd', omitable =
false);
1233 fpCommand -> SetParameter (parameter);
1234 parameter =
new G4UIparameter (
"y2",
'd', omitable =
false);
1235 fpCommand -> SetParameter (parameter);
1254 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
1260 std::istringstream is(newValue);
1261 is >> x1 >> y1 >> x2 >> y2;
1263 Line2D* line2D =
new Line2D
1270 const G4String& currentSceneName = pScene -> GetName ();
1271 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1274 G4cout <<
"A 2D line has been added to scene \""
1275 << currentSceneName <<
"\"."
1284G4VisCommandSceneAddLine2D::Line2D::Line2D
1288 fWidth(width), fColour(colour)
1290 fPolyline.push_back(
G4Point3D(x1,y1,0));
1291 fPolyline.push_back(
G4Point3D(x2,y2,0));
1295 fPolyline.SetVisAttributes(va);
1298void G4VisCommandSceneAddLine2D::Line2D::operator()
1301 sceneHandler.BeginPrimitives2D();
1302 sceneHandler.AddPrimitive(fPolyline);
1303 sceneHandler.EndPrimitives2D();
1310 fpCommand =
new G4UIcommand (
"/vis/scene/add/localAxes",
this);
1311 fpCommand -> SetGuidance
1312 (
"Adds local axes to physical volume(s).");
1314 parameter =
new G4UIparameter (
"physical-volume-name",
's', omitable =
false);
1315 fpCommand -> SetParameter (parameter);
1316 parameter =
new G4UIparameter (
"copy-no",
'i', omitable =
true);
1317 parameter -> SetGuidance (
"If negative, matches any copy no.");
1318 parameter -> SetDefaultValue (-1);
1319 fpCommand -> SetParameter (parameter);
1327 return "world 0 -1";
1339 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
1346 std::istringstream is (newValue);
1347 is >> name >> copyNo;
1349 std::vector<G4PhysicalVolumesSearchScene::Findings> findingsVector;
1354 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
1356 size_t nWorlds = transportationManager->
GetNoWorlds();
1357 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
1366 (&searchModel, name, copyNo);
1368 for (
const auto& findings: searchScene.
GetFindings()) {
1369 findingsVector.push_back(findings);
1374 for (
const auto& findings: findingsVector) {
1377 const auto& extent = findings.fpFoundPV->GetLogicalVolume()->GetSolid()->GetExtent();
1378 const auto& transform = findings.fFoundObjectTransformation;
1380 const G4double lengthMax = extent.GetExtentRadius()/2.;
1381 const G4double intLog10LengthMax = std::floor(std::log10(lengthMax));
1382 G4double length = std::pow(10,intLog10LengthMax);
1383 if (5.*length < lengthMax) length *= 5.;
1384 else if (2.*length < lengthMax) length *= 2.;
1386 const auto& axesModel =
new G4AxesModel(0.,0.,0.,length,transform);
1387 axesModel->SetGlobalTag(
"LocalAxesModel");
1388 std::ostringstream oss; oss
1389 <<
"Local Axes for " << findings.fpFoundPV->GetName()
1390 <<
':' << findings.fFoundPVCopyNo <<
':' <<
id++;
1391 axesModel->SetGlobalDescription(oss.str());
1396 G4cout <<
"\"" << findings.fpFoundPV->GetName()
1397 <<
"\", copy no. " << findings.fFoundPVCopyNo
1398 <<
",\n found in searched volume \""
1399 << findings.fpSearchPV->GetName()
1400 <<
"\" at depth " << findings.fFoundDepth
1401 <<
",\n base path: \"" << findings.fFoundBasePVPath
1402 <<
"\".\n Local axes have been added to scene \""
1403 << pScene->
GetName() <<
"\".";
1405 G4cout <<
" With extent " << extent
1406 <<
"\n at " << transform.getRotation()
1407 <<
" " << transform.getTranslation();
1416 if (findingsVector.empty()) {
1418 G4warn <<
"ERROR: Volume \"" << name <<
"\"";
1420 G4warn <<
", copy no. " << copyNo <<
",";
1435 fpCommand =
new G4UIcommand (
"/vis/scene/add/logicalVolume",
this);
1436 fpCommand -> SetGuidance (
"Adds a logical volume to the current scene,");
1437 fpCommand -> SetGuidance
1438 (
"Shows boolean components (if any), voxels (if any), readout geometry"
1439 "\n (if any), local axes and overlaps (if any), under control of the"
1440 "\n appropriate flag."
1441 "\n Note: voxels are not constructed until start of run -"
1442 "\n \"/run/beamOn\". (For voxels without a run, \"/run/beamOn 0\".)");
1444 parameter =
new G4UIparameter (
"logical-volume-name",
's', omitable =
false);
1445 fpCommand -> SetParameter (parameter);
1446 parameter =
new G4UIparameter (
"depth-of-descent",
'i', omitable =
true);
1447 parameter -> SetGuidance (
"Depth of descent of geometry hierarchy.");
1448 parameter -> SetDefaultValue (1);
1449 fpCommand -> SetParameter (parameter);
1450 parameter =
new G4UIparameter (
"booleans-flag",
'b', omitable =
true);
1451 parameter -> SetDefaultValue (
true);
1452 fpCommand -> SetParameter (parameter);
1453 parameter =
new G4UIparameter (
"voxels-flag",
'b', omitable =
true);
1454 parameter -> SetDefaultValue (
true);
1455 fpCommand -> SetParameter (parameter);
1456 parameter =
new G4UIparameter (
"readout-flag",
'b', omitable =
true);
1457 parameter -> SetDefaultValue (
true);
1458 fpCommand -> SetParameter (parameter);
1459 parameter =
new G4UIparameter (
"axes-flag",
'b', omitable =
true);
1460 parameter -> SetDefaultValue (
true);
1461 parameter -> SetGuidance (
"Set \"false\" to suppress axes.");
1462 fpCommand -> SetParameter (parameter);
1463 parameter =
new G4UIparameter(
"check-overlap-flag",
'b', omitable =
true);
1465 parameter -> SetGuidance (
"Set \"false\" to suppress overlap check.");
1466 fpCommand->SetParameter(parameter);
1486 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
1492 G4int requestedDepthOfDescent;
1493 G4String booleansString, voxelsString, readoutString, axesString;
1495 std::istringstream is (newValue);
1496 is >> name >> requestedDepthOfDescent
1497 >> booleansString >> voxelsString >> readoutString >> axesString
1508 if (pLV ==
nullptr)
return;
1510 const std::vector<G4Scene::Model>& rdModelList =
1511 pScene -> GetRunDurationModelList();
1512 std::vector<G4Scene::Model>::const_iterator i;
1513 for (i = rdModelList.begin(); i != rdModelList.end(); ++i) {
1514 if (i->fpModel->GetGlobalDescription().find(
"Volume") != std::string::npos)
break;
1516 if (i != rdModelList.end()) {
1518 G4warn <<
"There is already a volume, \""
1519 << i->fpModel->GetGlobalDescription()
1520 <<
"\",\n in the run-duration model list of scene \""
1521 << pScene -> GetName()
1522 <<
"\".\n Your logical volume must be the only volume in the scene."
1523 <<
"\n Create a new scene and try again:"
1524 <<
"\n /vis/specify " << name
1526 <<
"\n /vis/scene/create"
1527 <<
"\n /vis/scene/add/logicalVolume " << name
1528 <<
"\n /vis/sceneHandler/attach"
1529 <<
"\n (and also, if necessary, /vis/viewer/flush)"
1536 (pLV, requestedDepthOfDescent, booleans, voxels, readout, checkOverlaps);
1537 const G4String& currentSceneName = pScene -> GetName ();
1538 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1542 G4bool axesSuccessful =
false;
1545 const G4double axisLengthMax = radius / 2.;
1546 const G4double intLog10Length = std::floor(std::log10(axisLengthMax));
1547 G4double axisLength = std::pow(10,intLog10Length);
1548 if (5.*axisLength < axisLengthMax) axisLength *= 5.;
1549 else if (2.*axisLength < axisLengthMax) axisLength *= 2.;
1550 const G4double axisWidth = axisLength / 20.;
1552 axesSuccessful = pScene -> AddRunDurationModel (axesModel, warn);
1563 G4cout <<
"Logical volume \"" << pLV -> GetName ()
1564 <<
"\" with requested depth of descent "
1565 << requestedDepthOfDescent
1567 if (!booleans)
G4cout <<
"out";
1568 G4cout <<
" boolean components, with";
1569 if (!voxels)
G4cout <<
"out";
1570 G4cout <<
" voxels,\n with";
1571 if (!readout)
G4cout <<
"out";
1572 G4cout <<
" readout geometry and with";
1573 if (!checkOverlaps)
G4cout <<
"out";
1574 G4cout <<
" overlap checking"
1575 <<
"\n has been added to scene \"" << currentSceneName <<
"\".";
1577 if (axesSuccessful) {
1579 "\n Axes have also been added at the origin of local cooordinates.";
1582 "\n Axes have not been added for some reason possibly stated above.";
1601 fpCommand =
new G4UIcommand (
"/vis/scene/add/logo",
this);
1602 fpCommand -> SetGuidance (
"Adds a G4 logo to the current scene.");
1603 fpCommand -> SetGuidance
1604 (
"If \"unit\" is \"auto\", height is roughly one tenth of scene extent.");
1605 fpCommand -> SetGuidance
1606 (
"\"direction\" is that of outward-facing normal to front face of logo."
1607 "\nIf \"direction\" is \"auto\", logo faces the user in the current viewer.");
1608 fpCommand -> SetGuidance
1609 (
"\nIf \"placement\" is \"auto\", logo is placed at bottom right of screen"
1610 "\n when viewed from logo direction.");
1612 parameter =
new G4UIparameter (
"height",
'd', omitable =
true);
1614 fpCommand->SetParameter (parameter);
1615 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1617 fpCommand->SetParameter (parameter);
1618 parameter =
new G4UIparameter (
"direction",
's', omitable =
true);
1621 fpCommand->SetParameter (parameter);
1622 parameter =
new G4UIparameter (
"red",
'd', omitable =
true);
1624 fpCommand->SetParameter (parameter);
1625 parameter =
new G4UIparameter (
"green",
'd', omitable =
true);
1627 fpCommand->SetParameter (parameter);
1628 parameter =
new G4UIparameter (
"blue",
'd', omitable =
true);
1630 fpCommand->SetParameter (parameter);
1631 parameter =
new G4UIparameter (
"placement",
's', omitable =
true);
1632 parameter -> SetParameterCandidates(
"auto manual");
1634 fpCommand->SetParameter (parameter);
1635 parameter =
new G4UIparameter (
"xmid",
'd', omitable =
true);
1637 fpCommand->SetParameter (parameter);
1638 parameter =
new G4UIparameter (
"ymid",
'd', omitable =
true);
1640 fpCommand->SetParameter (parameter);
1641 parameter =
new G4UIparameter (
"zmid",
'd', omitable =
true);
1643 fpCommand->SetParameter (parameter);
1644 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1646 fpCommand->SetParameter (parameter);
1665 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
1672 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
1683 "ERROR: G4VisCommandSceneAddLogo::SetNewValue: no viewer."
1684 "\n Auto direction needs a viewer."
1690 G4double userHeight, red, green, blue, xmid, ymid, zmid;
1691 G4String userHeightUnit, direction, placement, positionUnit;
1692 std::istringstream is (newValue);
1693 is >> userHeight >> userHeightUnit >> direction
1694 >> red >> green >> blue
1696 >> xmid >> ymid >> zmid >> positionUnit;
1700 if (userHeightUnit ==
"auto") {
1707 xmid *= unit; ymid *= unit; zmid *= unit;
1709 Direction logoDirection = X;
1710 if (direction ==
"auto") {
1714 if (vp.
x() > vp.
y() && vp.
x() > vp.
z()) logoDirection = X;
1715 else if (vp.
x() < vp.
y() && vp.
x() < vp.
z()) logoDirection = minusX;
1716 else if (vp.
y() > vp.
x() && vp.
y() > vp.
z()) logoDirection = Y;
1717 else if (vp.
y() < vp.
x() && vp.
y() < vp.
z()) logoDirection = minusY;
1718 else if (vp.
z() > vp.
x() && vp.
z() > vp.
y()) logoDirection = Z;
1719 else if (vp.
z() < vp.
x() && vp.
z() < vp.
y()) logoDirection = minusZ;
1721 else if (direction[0] ==
'x') logoDirection = X;
1722 else if (direction[0] ==
'y') logoDirection = Y;
1723 else if (direction[0] ==
'z') logoDirection = Z;
1724 else if (direction[0] ==
'-') {
1725 if (direction[1] ==
'x') logoDirection = minusX;
1726 else if (direction[1] ==
'y') logoDirection = minusY;
1727 else if (direction[1] ==
'z') logoDirection = minusZ;
1730 G4warn <<
"ERROR: Unrecogniseed direction: \""
1731 << direction <<
"\"." <<
G4endl;
1736 G4bool autoPlacing =
false;
if (placement ==
"auto") autoPlacing =
true;
1753 "WARNING: Existing scene does not yet have any extent."
1754 "\n Maybe you have not yet added any geometrical object."
1760 const G4double halfHeight(height / 2.);
1762 const G4double freeHeightFraction (1. + 2. * comfort);
1766 switch (logoDirection) {
1769 if (freeHeightFraction * (xmax - xmin) < height) room =
false;
1773 if (freeHeightFraction * (ymax - ymin) < height) room =
false;
1777 if (freeHeightFraction * (zmax - zmin) < height) room =
false;
1784 "WARNING: Not enough room in existing scene. Maybe logo is too large."
1791 "WARNING: The logo you have asked for is bigger than the existing"
1792 "\n scene. Maybe you have added it too soon. It is recommended that"
1793 "\n you add the logo last so that it can be correctly auto-positioned"
1794 "\n so as not to be obscured by any existing object and so that the"
1795 "\n view parameters can be correctly recalculated."
1800 G4double sxmid(xmid), symid(ymid), szmid(zmid);
1804 const G4double xComfort = comfort * (xmax - xmin);
1805 const G4double yComfort = comfort * (ymax - ymin);
1806 const G4double zComfort = comfort * (zmax - zmin);
1807 switch (logoDirection) {
1809 sxmid = xmax + halfHeight + xComfort;
1810 symid = ymin - yComfort;
1811 szmid = zmin - zComfort;
1814 sxmid = xmin - halfHeight - xComfort;
1815 symid = ymin - yComfort;
1816 szmid = zmax + zComfort;
1819 sxmid = xmin - xComfort;
1820 symid = ymax + halfHeight + yComfort;
1821 szmid = zmin - zComfort;
1824 sxmid = xmax + xComfort;
1825 symid = ymin - halfHeight - yComfort;
1826 szmid = zmin - zComfort;
1829 sxmid = xmax + xComfort;
1830 symid = ymin - yComfort;
1831 szmid = zmax + halfHeight + zComfort;
1834 sxmid = xmin - xComfort;
1835 symid = ymin - yComfort;
1836 szmid = zmin - halfHeight - zComfort;
1842 switch (logoDirection) {
1867 G4Logo* logo =
new G4Logo(height,visAtts,transform);
1879 const G4String& currentSceneName = pScene -> GetName ();
1880 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1883 G4cout <<
"G4 Logo of height " << userHeight <<
' ' << userHeightUnit
1884 <<
", " << direction <<
"-direction, added to scene \""
1885 << currentSceneName <<
"\"";
1887 G4cout <<
"\n with extent " << extent
1899G4VisCommandSceneAddLogo::G4Logo::G4Logo
1914 const G4double xb = -h2, yb = f2 + w;
1915 const G4double dx = xt - xb, dy = yt - yb;
1916 const G4double angle = std::atan2(dy,dx);
1919 const G4double d = std::sqrt(dx * dx + dy * dy);
1922 const G4double x8 = ((-ss * d - dx * (yt - y8)) / dy) + xt;
1924 G4double x9 = ((-(ss - w) * d - dx * (yt - y8)) / dy) + xt;
1926 const G4double xtr = ss - f1, ytr = -ss - f2 -w;
1927 x9 += xtr; y9 += ytr;
1941 G4Tubs tG(
"tG",ri,ro,d2,0.15*pi,1.85*pi);
1942 G4Box bG(
"bG",w2,ro2,d2);
1947 fpG = logoG.CreatePolyhedron();
1954 G4Box b1(
"b1",h2,h2,d2);
1955 G4Box bS(
"bS",ss,ss,d2+e);
1956 G4Box bS2(
"bS2",ss,ss,d2+2.*e);
1965 fp4 = logo4.CreatePolyhedron();
1979G4VisCommandSceneAddLogo::G4Logo::~G4Logo() {
1984void G4VisCommandSceneAddLogo::G4Logo::operator()
1985 (G4VGraphicsScene& sceneHandler,
const G4ModelingParameters*) {
1986 sceneHandler.BeginPrimitives();
1987 sceneHandler.AddPrimitive(*fpG);
1988 sceneHandler.AddPrimitive(*fp4);
1989 sceneHandler.EndPrimitives();
1996 fpCommand =
new G4UIcommand (
"/vis/scene/add/logo2D",
this);
1997 fpCommand -> SetGuidance (
"Adds 2D logo to current scene.");
1999 parameter =
new G4UIparameter (
"size",
'i', omitable =
true);
2000 parameter -> SetGuidance (
"Screen size of text in pixels.");
2001 parameter -> SetDefaultValue (48);
2002 fpCommand -> SetParameter (parameter);
2003 parameter =
new G4UIparameter (
"x-position",
'd', omitable =
true);
2004 parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
2005 parameter -> SetDefaultValue (-0.9);
2006 fpCommand -> SetParameter (parameter);
2007 parameter =
new G4UIparameter (
"y-position",
'd', omitable =
true);
2008 parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
2009 parameter -> SetDefaultValue (-0.9);
2010 fpCommand -> SetParameter (parameter);
2011 parameter =
new G4UIparameter (
"layout",
's', omitable =
true);
2012 parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
2013 parameter -> SetDefaultValue (
"left");
2014 fpCommand -> SetParameter (parameter);
2033 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
2041 std::istringstream is(newValue);
2042 is >> size >> x >> y >> layoutString;
2048 Logo2D* logo2D =
new Logo2D(
fpVisManager, size, x, y, layout);
2054 const G4String& currentSceneName = pScene -> GetName ();
2055 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2058 G4cout <<
"2D logo has been added to scene \""
2059 << currentSceneName <<
"\"."
2068void G4VisCommandSceneAddLogo2D::Logo2D::operator()
2072 text.SetScreenSize(fSize);
2073 text.SetLayout(fLayout);
2075 text.SetVisAttributes(textAtts);
2076 sceneHandler.BeginPrimitives2D();
2077 sceneHandler.AddPrimitive(text);
2078 sceneHandler.EndPrimitives2D();
2084 fpCommand =
new G4UIcommand (
"/vis/scene/add/magneticField",
this);
2085 fpCommand -> SetGuidance
2086 (
"Adds magnetic field representation to current scene.");
2112 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
2117 G4int nDataPointsPerHalfScene;
2119 std::istringstream iss(newValue);
2120 iss >> nDataPointsPerHalfScene >> representation;
2123 if (representation ==
"lightArrow") {
2128 (nDataPointsPerHalfScene,modelRepresentation,
2132 const G4String& currentSceneName = pScene -> GetName ();
2133 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2137 <<
"Magnetic field, if any, will be drawn in scene \""
2140 << nDataPointsPerHalfScene
2141 <<
" data points per half extent and with representation \""
2157 fpCommand -> SetGuidance
2158 (
"Adds Primitive Scorer Hits (PSHits) to current scene.");
2159 fpCommand -> SetGuidance
2160 (
"PSHits are drawn at end of run when the scene in which"
2161 "\nthey are added is current.");
2162 fpCommand -> SetGuidance
2163 (
"Optional parameter specifies name of scoring map. By default all"
2164 "\nscoring maps registered with the G4ScoringManager are drawn.");
2165 fpCommand -> SetParameterName (
"mapname", omitable =
true);
2166 fpCommand -> SetDefaultValue (
"all");
2186 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
2192 const G4String& currentSceneName = pScene -> GetName ();
2193 G4bool successful = pScene -> AddEndOfRunModel (model, warn);
2196 if (newValue ==
"all") {
2197 G4cout <<
"All Primitive Scorer hits";
2199 G4cout <<
"Hits of Primitive Scorer \"" << newValue <<
'"';
2201 G4cout <<
" will be drawn at end of run in scene \""
2202 << currentSceneName <<
"\"."
2215 fpCommand =
new G4UIcommand (
"/vis/scene/add/scale",
this);
2216 fpCommand -> SetGuidance
2217 (
"Adds an annotated scale line to the current scene.");
2218 fpCommand -> SetGuidance
2219 (
"If \"unit\" is \"auto\", length is roughly one tenth of the scene extent.");
2220 fpCommand -> SetGuidance
2221 (
"If \"direction\" is \"auto\", scale is roughly in the plane of the current view.");
2222 fpCommand -> SetGuidance
2223 (
"If \"placement\" is \"auto\", scale is placed at bottom left of current view."
2224 "\n Otherwise placed at (xmid,ymid,zmid).");
2225 fpCommand -> SetGuidance
2226 (
"An annotated line in the specified direction with tick marks at the"
2227 "\nend. If autoPlacing is true it is required to be centred at the"
2228 "\nfront, right, bottom corner of the world space, comfortably outside"
2229 "\nthe existing bounding box/sphere so that existing objects do not"
2230 "\nobscure it. Otherwise it is required to be drawn with mid-point at"
2231 "\n(xmid, ymid, zmid)."
2233 "\nThe auto placing algorithm is (approx):"
2234 "\n x = xmin + (1 + comfort) * (xmax - xmin);"
2235 "\n y = ymin - comfort * (ymax - ymin);"
2236 "\n z = zmin + (1 + comfort) * (zmax - zmin);"
2237 "\n if direction == x then (x - length,y,z) to (x,y,z);"
2238 "\n if direction == y then (x,y,z) to (x,y + length,z);"
2239 "\n if direction == z then (x,y,z - length) to (x,y,z);"
2242 parameter =
new G4UIparameter (
"length",
'd', omitable =
true);
2244 fpCommand->SetParameter (parameter);
2245 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
2247 fpCommand->SetParameter (parameter);
2248 parameter =
new G4UIparameter (
"direction",
's', omitable =
true);
2251 fpCommand->SetParameter (parameter);
2252 parameter =
new G4UIparameter (
"red",
'd', omitable =
true);
2254 fpCommand->SetParameter (parameter);
2255 parameter =
new G4UIparameter (
"green",
'd', omitable =
true);
2257 fpCommand->SetParameter (parameter);
2258 parameter =
new G4UIparameter (
"blue",
'd', omitable =
true);
2260 fpCommand->SetParameter (parameter);
2261 parameter =
new G4UIparameter (
"placement",
's', omitable =
true);
2262 parameter -> SetParameterCandidates(
"auto manual");
2264 fpCommand->SetParameter (parameter);
2265 parameter =
new G4UIparameter (
"xmid",
'd', omitable =
true);
2267 fpCommand->SetParameter (parameter);
2268 parameter =
new G4UIparameter (
"ymid",
'd', omitable =
true);
2270 fpCommand->SetParameter (parameter);
2271 parameter =
new G4UIparameter (
"zmid",
'd', omitable =
true);
2273 fpCommand->SetParameter (parameter);
2274 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
2276 fpCommand->SetParameter (parameter);
2295 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
2302 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
2309 G4double userLength, red, green, blue, xmid, ymid, zmid;
2310 G4String userLengthUnit, direction, placement, positionUnit;
2311 std::istringstream is (newValue);
2312 is >> userLength >> userLengthUnit >> direction
2313 >> red >> green >> blue
2315 >> xmid >> ymid >> zmid >> positionUnit;
2319 if (userLengthUnit ==
"auto") {
2321 const G4double intLog10Length = std::floor(std::log10(lengthMax));
2322 length = std::pow(10,intLog10Length);
2323 if (5.*length < lengthMax) length *= 5.;
2324 else if (2.*length < lengthMax) length *= 2.;
2331 xmid *= unit; ymid *= unit; zmid *= unit;
2333 Scale::Direction scaleDirection (Scale::x);
2334 if (direction[0] ==
'y') scaleDirection = Scale::y;
2335 if (direction[0] ==
'z') scaleDirection = Scale::z;
2341 "ERROR: G4VisCommandSceneAddScale::SetNewValue: no viewer."
2342 "\n Auto direction needs a viewer."
2353 if (direction ==
"auto") {
2354 if (std::abs(vp.
x()) > std::abs(vp.
y()) &&
2355 std::abs(vp.
x()) > std::abs(vp.
z())) {
2356 if (std::abs(up.
y()) > std::abs(up.
z())) scaleDirection = Scale::z;
2357 else scaleDirection = Scale::y;
2359 else if (std::abs(vp.
y()) > std::abs(vp.
x()) &&
2360 std::abs(vp.
y()) > std::abs(vp.
z())) {
2361 if (std::abs(up.
x()) > std::abs(up.
z())) scaleDirection = Scale::z;
2362 else scaleDirection = Scale::x;
2364 else if (std::abs(vp.
z()) > std::abs(vp.
x()) &&
2365 std::abs(vp.
z()) > std::abs(vp.
y())) {
2366 if (std::abs(up.
y()) > std::abs(up.
x())) scaleDirection = Scale::x;
2367 else scaleDirection = Scale::y;
2371 G4bool autoPlacing =
false;
if (placement ==
"auto") autoPlacing =
true;
2375 const G4double halfLength(length / 2.);
2377 const G4double freeLengthFraction (1. + 2. * comfort);
2392 "WARNING: Existing scene does not yet have any extent."
2393 "\n Maybe you have not yet added any geometrical object."
2400 switch (scaleDirection) {
2402 if (freeLengthFraction * (xmax - xmin) < length) room =
false;
2405 if (freeLengthFraction * (ymax - ymin) < length) room =
false;
2408 if (freeLengthFraction * (zmax - zmin) < length) room =
false;
2415 "WARNING: Not enough room in existing scene. Maybe scale is too long."
2422 "WARNING: The scale you have asked for is bigger than the existing"
2423 "\n scene. Maybe you have added it too soon. It is recommended that"
2424 "\n you add the scale last so that it can be correctly auto-positioned"
2425 "\n so as not to be obscured by any existing object and so that the"
2426 "\n view parameters can be correctly recalculated."
2454 G4double sxmid(xmid), symid(ymid), szmid(zmid);
2458 const G4double xComfort = comfort * (xmax - xmin);
2459 const G4double yComfort = comfort * (ymax - ymin);
2460 const G4double zComfort = comfort * (zmax - zmin);
2461 switch (scaleDirection) {
2464 sxmid = xmax + xComfort;
2465 symid = ymin - yComfort;
2466 szmid = zmin - zComfort;
2468 sxmid = xmin - xComfort;
2469 symid = ymin - yComfort;
2470 szmid = zmax + zComfort;
2475 sxmid = xmin - xComfort;
2476 symid = ymax + yComfort;
2477 szmid = zmin - zComfort;
2479 sxmid = xmax + xComfort;
2480 symid = ymin - yComfort;
2481 szmid = zmin - zComfort;
2486 sxmid = xmax + xComfort;
2487 symid = ymin - yComfort;
2488 szmid = zmax + zComfort;
2490 sxmid = xmin - xComfort;
2491 symid = ymin - yComfort;
2492 szmid = zmax + zComfort;
2502 switch (scaleDirection) {
2513 scaleExtent = scaleExtent.
Transform(transform);
2516 if (direction ==
"auto") {
2517 switch (scaleDirection) {
2531 Scale* scale =
new Scale
2532 (visAttr, length, transform,
2540 const G4String& currentSceneName = pScene -> GetName ();
2541 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2544 G4cout <<
"Scale of " << annotation
2545 <<
" added to scene \"" << currentSceneName <<
"\".";
2547 G4cout <<
"\n with extent " << scaleExtent
2559G4VisCommandSceneAddScale::Scale::Scale
2567 const G4double halfLength(length / 2.);
2568 const G4double tickLength(length / 20.);
2572 fScaleLine.SetVisAttributes(&fVisAtts);
2573 fTick11.SetVisAttributes(&fVisAtts);
2574 fTick12.SetVisAttributes(&fVisAtts);
2575 fTick21.SetVisAttributes(&fVisAtts);
2576 fTick22.SetVisAttributes(&fVisAtts);
2582 fScaleLine.push_back(r1);
2583 fScaleLine.push_back(r2);
2586 fTick11.push_back(r1 + ticky);
2587 fTick11.push_back(r1 - ticky);
2588 fTick12.push_back(r1 + tickz);
2589 fTick12.push_back(r1 - tickz);
2590 fTick21.push_back(r2 + ticky);
2591 fTick21.push_back(r2 - ticky);
2592 fTick22.push_back(r2 + tickz);
2593 fTick22.push_back(r2 - tickz);
2595 fScaleLine.transform(transform);
2596 fTick11.transform(transform);
2597 fTick12.transform(transform);
2598 fTick21.transform(transform);
2599 fTick22.transform(transform);
2601 G4Point3D textPosition(0., tickLength, 0.);
2602 textPosition.transform(transform);
2603 fText =
G4Text(annotation,textPosition);
2604 fText.SetVisAttributes(annotationColour);
2605 fText.SetScreenSize(annotationSize);
2608void G4VisCommandSceneAddScale::Scale::operator()
2612 sceneHandler.BeginPrimitives();
2613 sceneHandler.AddPrimitive(fScaleLine);
2614 sceneHandler.AddPrimitive(fTick11);
2615 sceneHandler.AddPrimitive(fTick12);
2616 sceneHandler.AddPrimitive(fTick21);
2617 sceneHandler.AddPrimitive(fTick22);
2618 sceneHandler.AddPrimitive(fText);
2619 sceneHandler.EndPrimitives();
2626 fpCommand =
new G4UIcommand (
"/vis/scene/add/text",
this);
2627 fpCommand -> SetGuidance (
"Adds text to current scene.");
2628 fpCommand -> SetGuidance
2629 (
"Use \"/vis/set/textColour\" to set colour.");
2630 fpCommand -> SetGuidance
2631 (
"Use \"/vis/set/textLayout\" to set layout:");
2635 fpCommand->SetParameter (parameter);
2638 fpCommand->SetParameter (parameter);
2641 fpCommand->SetParameter (parameter);
2642 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
2644 fpCommand->SetParameter (parameter);
2645 parameter =
new G4UIparameter (
"font_size",
'd', omitable =
true);
2648 fpCommand->SetParameter (parameter);
2649 parameter =
new G4UIparameter (
"x_offset",
'd', omitable =
true);
2652 fpCommand->SetParameter (parameter);
2653 parameter =
new G4UIparameter (
"y_offset",
'd', omitable =
true);
2656 fpCommand->SetParameter (parameter);
2657 parameter =
new G4UIparameter (
"text",
's', omitable =
true);
2658 parameter->
SetGuidance (
"The rest of the line is text.");
2660 fpCommand->SetParameter (parameter);
2679 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
2695 x *= unit; y *= unit; z *= unit;
2704 const G4String& currentSceneName = pScene -> GetName ();
2705 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2708 G4cout <<
"Text '" << text
2709 <<
"' has been added to scene \"" << currentSceneName <<
"\"."
2723 fpCommand =
new G4UIcommand (
"/vis/scene/add/text2D",
this);
2724 fpCommand -> SetGuidance (
"Adds 2D text to current scene.");
2725 fpCommand -> SetGuidance (
"x,y in range [-1,1]");
2726 fpCommand -> SetGuidance
2727 (
"Use \"/vis/set/textColour\" to set colour.");
2728 fpCommand -> SetGuidance
2729 (
"Use \"/vis/set/textLayout\" to set layout:");
2733 fpCommand->SetParameter (parameter);
2736 fpCommand->SetParameter (parameter);
2737 parameter =
new G4UIparameter (
"font_size",
'd', omitable =
true);
2740 fpCommand->SetParameter (parameter);
2741 parameter =
new G4UIparameter (
"x_offset",
'd', omitable =
true);
2744 fpCommand->SetParameter (parameter);
2745 parameter =
new G4UIparameter (
"y_offset",
'd', omitable =
true);
2748 fpCommand->SetParameter (parameter);
2749 parameter =
new G4UIparameter (
"text",
's', omitable =
true);
2750 parameter->
SetGuidance (
"The rest of the line is text.");
2752 fpCommand->SetParameter (parameter);
2771 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
2790 G4Text2D* g4text2D =
new G4Text2D(g4text);
2795 std::ostringstream oss;
2796 oss <<
"Text2D: '" << g4text.
GetText()
2801 const G4String& currentSceneName = pScene -> GetName ();
2802 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2805 G4cout <<
"2D text '" << text
2806 <<
"' has been added to scene \"" << currentSceneName <<
"\"."
2815G4VisCommandSceneAddText2D::G4Text2D::G4Text2D(
const G4Text& text):
2819void G4VisCommandSceneAddText2D::G4Text2D::operator()
2821 sceneHandler.BeginPrimitives2D();
2822 sceneHandler.AddPrimitive(fText);
2823 sceneHandler.EndPrimitives2D();
2832 (
"/vis/scene/add/trajectories",
this);
2833 fpCommand -> SetGuidance
2834 (
"Adds trajectories to current scene.");
2835 fpCommand -> SetGuidance
2836 (
"Causes trajectories, if any, to be drawn at the end of processing an"
2837 "\nevent. Switches on trajectory storing and sets the"
2838 "\ndefault trajectory type.");
2839 fpCommand -> SetGuidance
2840 (
"The command line parameter list determines the default trajectory type."
2841 "\nIf it contains the string \"smooth\", auxiliary inter-step points will"
2842 "\nbe inserted to improve the smoothness of the drawing of a curved"
2844 "\nIf it contains the string \"rich\", significant extra information will"
2845 "\nbe stored in the trajectory (G4RichTrajectory) amenable to modeling"
2846 "\nand filtering with \"/vis/modeling/trajectories/create/drawByAttribute\""
2847 "\nand \"/vis/filtering/trajectories/create/attributeFilter\" commands."
2848 "\nIt may contain both strings in any order.");
2849 fpCommand -> SetGuidance
2850 (
"\nTo switch off trajectory storing: \"/tracking/storeTrajectory 0\"."
2851 "\nSee also \"/vis/scene/endOfEventAction\".");
2852 fpCommand -> SetGuidance
2853 (
"Note: This only sets the default. Independently of the result of this"
2854 "\ncommand, a user may instantiate a trajectory that overrides this default"
2855 "\nin PreUserTrackingAction.");
2856 fpCommand -> SetParameterName (
"default-trajectory-type", omitable =
true);
2857 fpCommand -> SetDefaultValue (
"");
2877 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
2881 const G4String& currentSceneName = pScene -> GetName ();
2885 if (newValue.find(
"smooth") != std::string::npos) smooth =
true;
2886 if (newValue.find(
"rich") != std::string::npos) rich =
true;
2887 if (newValue.size() && !(rich || smooth)) {
2889 G4warn <<
"ERROR: Unrecognised parameter \"" << newValue <<
"\""
2890 "\n No action taken."
2898 if (smooth && rich) {
2899 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 4");
2900 defaultTrajectoryType =
"G4RichTrajectory configured for smooth steps";
2901 }
else if (smooth) {
2902 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 2");
2903 defaultTrajectoryType =
"G4SmoothTrajectory";
2905 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 3");
2906 defaultTrajectoryType =
"G4RichTrajectory";
2908 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 1");
2909 defaultTrajectoryType =
"G4Trajectory";
2914 "Attributes available for modeling and filtering with"
2915 "\n \"/vis/modeling/trajectories/create/drawByAttribute\" and"
2916 "\n \"/vis/filtering/trajectories/create/attributeFilter\" commands:"
2922 }
else if (smooth) {
2932 auto eoeModel = eoeList.begin();
2933 for (; eoeModel != eoeList.end(); ++eoeModel) {
2934 const auto* actualModel = eoeModel->fpModel;
2937 if (eoeModel == eoeList.end()) {
2940 pScene -> AddEndOfEventModel (model, warn);
2946 G4cout <<
"Default trajectory type " << defaultTrajectoryType
2947 <<
"\n will be used to store trajectories for scene \""
2948 << currentSceneName <<
"\"."
2954 "WARNING: Trajectory storing has been requested. This action may be"
2955 "\n reversed with \"/tracking/storeTrajectory 0\"."
2967 fpCommand -> SetGuidance
2968 (
"Add named Vis User Action to current scene.");
2969 fpCommand -> SetGuidance
2970 (
"Attempts to match search string to name of action - use unique sub-string.");
2971 fpCommand -> SetGuidance
2972 (
"(Use /vis/list to see names of registered actions.)");
2973 fpCommand -> SetGuidance
2974 (
"If name == \"all\" (default), all actions are added.");
2975 fpCommand -> SetParameterName(
"action-name", omitable =
true);
2976 fpCommand -> SetDefaultValue(
"all");
2995 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
3002 const std::vector<G4VisManager::UserVisAction>& runDurationUserVisActions =
3004 for (
const auto& runDurationUserVisAction : runDurationUserVisActions) {
3005 const G4String& name = runDurationUserVisAction.fName;
3007 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
3009 AddVisAction(name,visAction,pScene,runDuration,verbosity);
3013 const std::vector<G4VisManager::UserVisAction>& endOfEventUserVisActions =
3015 for (
const auto& endOfEventUserVisAction : endOfEventUserVisActions) {
3016 const G4String& name = endOfEventUserVisAction.fName;
3018 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
3020 AddVisAction(name,visAction,pScene,endOfEvent,verbosity);
3024 const std::vector<G4VisManager::UserVisAction>& endOfRunUserVisActions =
3026 for (
const auto& endOfRunUserVisAction : endOfRunUserVisActions) {
3027 const G4String& name = endOfRunUserVisAction.fName;
3029 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
3031 AddVisAction(name,visAction,pScene,endOfRun,verbosity);
3037 G4warn <<
"WARNING: No User Vis Action registered." <<
G4endl;
3045void G4VisCommandSceneAddUserAction::AddVisAction
3049 G4VisCommandSceneAddUserAction::ActionType type,
3054 const std::map<G4VUserVisAction*,G4VisExtent>& visExtentMap =
3057 std::map<G4VUserVisAction*,G4VisExtent>::const_iterator i =
3058 visExtentMap.find(visAction);
3059 if (i != visExtentMap.end()) extent = i->second;
3063 <<
"WARNING: User Vis Action \"" << name <<
"\" extent is null."
3068 G4VModel* model =
new G4CallbackModel<G4VUserVisAction>(visAction);
3069 model->
SetType(
"User Vis Action");
3073 G4bool successful =
false;;
3076 successful = pScene -> AddRunDurationModel (model, warn);
3079 successful = pScene -> AddEndOfEventModel (model, warn);
3082 successful = pScene -> AddEndOfRunModel (model, warn);
3087 const G4String& currentSceneName = pScene -> GetName ();
3088 G4cout <<
"User Vis Action added to scene \""
3089 << currentSceneName <<
"\"";
3091 G4cout <<
"\n with extent " << extent;
3103 fpCommand =
new G4UIcommand (
"/vis/scene/add/volume",
this);
3104 fpCommand -> SetGuidance
3105 (
"Adds a physical volume to current scene, with optional clipping volume.");
3106 fpCommand -> SetGuidance
3107 (
"If physical-volume-name is \"world\" (the default), the top of the"
3108 "\nmain geometry tree (material world) is added. If \"worlds\", the"
3109 "\ntops of all worlds - material world and parallel worlds, if any - are"
3110 "\nadded. Otherwise a search of all worlds is made.");
3111 fpCommand -> SetGuidance
3112 (
"In the last case the names of all volumes in all worlds are matched"
3113 "\nagainst physical-volume-name. If this is of the form \"/regexp/\","
3114 "\nwhere regexp is a regular expression (see C++ regex), the match uses"
3115 "\nthe usual rules of regular expression matching. Otherwise an exact"
3116 "\nmatch is required."
3117 "\nFor example, \"/Shap/\" adds \"Shape1\" and \"Shape2\".");
3118 fpCommand -> SetGuidance
3119 (
"It may help to see a textual representation of the geometry hierarchy of"
3120 "\nthe worlds. Try \"/vis/drawTree [worlds]\".");
3121 fpCommand -> SetGuidance
3122 (
"If clip-volume-type is specified, the subsequent parameters are used to"
3123 "\nto define a clipping volume. For example,"
3124 "\n\"/vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1\" will draw the world"
3125 "\nwith the positive octant cut away. (If the Boolean Processor issues"
3126 "\nwarnings try replacing 0 by 0.000000001 or something.)");
3127 fpCommand -> SetGuidance
3128 (
"If clip-volume-type is prepended with '-', the clip-volume is subtracted"
3129 "\n(cutaway). (This is the default if there is no prepended character.)"
3130 "\nIf '*' is prepended, the intersection of the physical-volume and the"
3131 "\nclip-volume is made. (You can make a section through the detector with"
3132 "\na thin box, for example).");
3133 fpCommand -> SetGuidance
3134 (
"For \"box\", the parameters are xmin,xmax,ymin,ymax,zmin,zmax."
3135 "\nOnly \"box\" is programmed at present.");
3137 parameter =
new G4UIparameter (
"physical-volume-name",
's', omitable =
true);
3138 parameter -> SetDefaultValue (
"world");
3139 fpCommand -> SetParameter (parameter);
3140 parameter =
new G4UIparameter (
"copy-no",
'i', omitable =
true);
3141 parameter -> SetGuidance (
"If negative, matches any copy no.");
3142 parameter -> SetDefaultValue (-1);
3143 fpCommand -> SetParameter (parameter);
3144 parameter =
new G4UIparameter (
"depth-of-descent",
'i', omitable =
true);
3145 parameter -> SetGuidance
3146 (
"Depth of descent of geometry hierarchy. Default = unlimited depth.");
3148 fpCommand -> SetParameter (parameter);
3149 parameter =
new G4UIparameter (
"clip-volume-type",
's', omitable =
true);
3150 parameter -> SetParameterCandidates(
"none box -box *box");
3151 parameter -> SetDefaultValue (
"none");
3152 parameter -> SetGuidance(
"[-|*]type. See general guidance.");
3153 fpCommand -> SetParameter (parameter);
3154 parameter =
new G4UIparameter (
"parameter-unit",
's', omitable =
true);
3155 parameter -> SetDefaultValue (
"m");
3156 fpCommand -> SetParameter (parameter);
3157 parameter =
new G4UIparameter (
"parameter-1",
'd', omitable =
true);
3158 parameter -> SetDefaultValue (0.);
3159 fpCommand -> SetParameter (parameter);
3160 parameter =
new G4UIparameter (
"parameter-2",
'd', omitable =
true);
3161 parameter -> SetDefaultValue (0.);
3162 fpCommand -> SetParameter (parameter);
3163 parameter =
new G4UIparameter (
"parameter-3",
'd', omitable =
true);
3164 parameter -> SetDefaultValue (0.);
3165 fpCommand -> SetParameter (parameter);
3166 parameter =
new G4UIparameter (
"parameter-4",
'd', omitable =
true);
3167 parameter -> SetDefaultValue (0.);
3168 fpCommand -> SetParameter (parameter);
3169 parameter =
new G4UIparameter (
"parameter-5",
'd', omitable =
true);
3170 parameter -> SetDefaultValue (0.);
3171 fpCommand -> SetParameter (parameter);
3172 parameter =
new G4UIparameter (
"parameter-6",
'd', omitable =
true);
3173 parameter -> SetDefaultValue (0.);
3174 fpCommand -> SetParameter (parameter);
3182 return "world 0 -1";
3194 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
3199 G4String name, clipVolumeType, parameterUnit;
3200 G4int copyNo, requestedDepthOfDescent;
3201 G4double param1, param2, param3, param4, param5, param6;
3202 std::istringstream is (newValue);
3203 is >> name >> copyNo >> requestedDepthOfDescent
3204 >> clipVolumeType >> parameterUnit
3205 >> param1 >> param2 >> param3 >> param4 >> param5 >> param6;
3208 if (clipVolumeType[
size_t(0)] ==
'-') {
3209 clipVolumeType = clipVolumeType.substr(1);
3210 }
else if (clipVolumeType[
size_t(0)] ==
'*') {
3212 clipVolumeType = clipVolumeType.substr(1);
3215 param1 *= unit; param2 *= unit; param3 *= unit;
3216 param4 *= unit; param5 *= unit; param6 *= unit;
3219 if (clipVolumeType ==
"box") {
3220 const G4double dX = (param2 - param1) / 2.;
3221 const G4double dY = (param4 - param3) / 2.;
3222 const G4double dZ = (param6 - param5) / 2.;
3223 const G4double x0 = (param2 + param1) / 2.;
3224 const G4double y0 = (param4 + param3) / 2.;
3225 const G4double z0 = (param6 + param5) / 2.;
3227 (
"_displaced_clipping_box",
3228 new G4Box(
"_clipping_box",dX,dY,dZ),
3235 size_t nWorlds = transportationManager->
GetNoWorlds();
3238 static G4bool warned =
false;
3239 if (!warned && name !=
"worlds") {
3241 "WARNING: Parallel worlds in operation. To visualise, specify"
3242 "\n \"worlds\" or the parallel world volume or sub-volume name"
3243 "\n and control visibility with /vis/geometry."
3245 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
3247 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
3248 G4warn <<
" World " << i <<
": " << (*iterWorld)->GetName()
3262 "ERROR: G4VisCommandSceneAddVolume::SetNewValue:"
3263 "\n No world. Maybe the geometry has not yet been defined."
3264 "\n Try \"/run/initialize\""
3270 std::vector<G4PhysicalVolumesSearchScene::Findings> findingsVector;
3282 G4bool useFullExtent =
false;
3290 if (name ==
"world") {
3292 findingsVector.push_back
3295 }
else if (name ==
"worlds") {
3300 "WARNING: G4VisCommandSceneAddVolume::SetNewValue:"
3301 "\n Parallel worlds requested but none exist."
3302 "\n Just adding material world."
3306 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
3308 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
3309 findingsVector.push_back
3311 (*iterWorld,*iterWorld));
3321 useFullExtent =
true;
3323 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
3325 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
3329 requestedDepthOfDescent,
3335 for (
const auto& findings: searchScene.
GetFindings()) {
3336 findingsVector.push_back(findings);
3341 for (
const auto& findings: findingsVector) {
3343 findings.fpFoundPV->SetCopyNo(findings.fFoundPVCopyNo);
3345 (findings.fpFoundPV,
3346 requestedDepthOfDescent,
3347 findings.fFoundObjectTransformation,
3350 findings.fFoundBasePVPath);
3351 if (clippingSolid) {
3355 if (!foundPVModel->
Validate(warn))
return;
3360 G4cout <<
"\"" << findings.fpFoundPV->GetName()
3361 <<
"\", copy no. " << findings.fFoundPVCopyNo
3362 <<
",\n found in searched volume \""
3363 << findings.fpSearchPV->GetName()
3364 <<
"\" at depth " << findings.fFoundDepth
3365 <<
",\n base path: \"" << findings.fFoundBasePVPath
3366 <<
"\",\n with a requested depth of further descent of ";
3367 if (requestedDepthOfDescent < 0) {
3368 G4cout <<
"<0 (unlimited)";
3371 G4cout << requestedDepthOfDescent;
3373 G4cout <<
",\n has been added to scene \"" << pScene->
GetName() <<
"\"."
3381 if (findingsVector.empty()) {
3383 G4warn <<
"ERROR: Volume \"" << name <<
"\"";
3385 G4warn <<
", copy no. " << copyNo <<
",";
3400 fpCommand =
new G4UIcommand(
"/vis/scene/add/plotter",
this);
3401 fpCommand -> SetGuidance (
"Add a plotter to current scene.");
3405 fpCommand->SetParameter(parameter);
3420 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
3428 const G4String& currentSceneName = pScene -> GetName ();
3429 G4bool successful = pScene -> AddEndOfRunModel(model, warn);
3434 <<
"\" has been added to scene \"" << currentSceneName <<
"\"."
HepGeom::Point3D< G4double > G4Point3D
CLHEP::HepRotation G4RotationMatrix
CLHEP::Hep3Vector G4ThreeVector
HepGeom::Vector3D< G4double > G4Vector3D
G4GLOB_DLL std::ostream G4cout
HepRotation & rotateZ(double delta)
G4Box is a cuboid of given half lengths dx,dy,dz. The Box is centred on the origin with sides paralle...
G4DisplacedSolid is a solid that has been shifted from its original frame of reference to a new one....
G4LogicalVolumeStore is a singleton class, acting as container for all logical volumes,...
G4LogicalVolume * GetVolume(const G4String &name, G4bool verbose=true, G4bool reverseSearch=false) const
static G4LogicalVolumeStore * GetInstance()
G4LogicalVolume represents a leaf node or unpositioned subtree in the geometry hierarchy....
void SetClippingSolid(G4VSolid *pClippingSolid)
G4bool Validate(G4bool warn)
void SetClippingMode(ClippingMode mode)
void DescribeYourselfTo(G4VGraphicsScene &)
const std::vector< Findings > & GetFindings() const
G4Plotter & GetPlotter(const G4String &a_name)
static G4PlotterManager & GetInstance()
const std::map< G4String, G4AttDef > * GetAttDefs() const override
const std::map< G4String, G4AttDef > * GetAttDefs() const override
static G4RunManager * GetMasterRunManager()
const G4Run * GetCurrentRun() const
G4int GetNumberOfEventToBeProcessed() const
G4int GetNumberOfKeptEvents() const
G4bool AddRunDurationModel(G4VModel *, G4bool warn=false)
const G4VisExtent & GetExtent() const
const G4String & GetName() const
const std::vector< Model > & GetEndOfEventModelList() const
const std::map< G4String, G4AttDef > * GetAttDefs() const override
const std::map< G4String, G4AttDef > * GetAttDefs() const override
G4SubtractionSolid is a solid describing the Boolean subtraction of two solids.
G4double GetYOffset() const
G4double GetXOffset() const
void SetOffset(double dx, double dy)
const std::map< G4String, G4AttDef > * GetAttDefs() const
const std::map< G4String, G4AttDef > * GetAttDefs() const override
const std::map< G4String, G4AttDef > * GetAttDefs() const override
G4TransportationManager is a singleton class which stores the navigator used by the transportation pr...
static G4TransportationManager * GetTransportationManager()
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
std::size_t GetNoWorlds() const
G4Tubs is a tube or tube segment with curved sides parallel to the Z-axis. The tube has a specified h...
G4UIcommand * FindPath(const char *commandPath) const
static G4double ValueOf(const char *unitName)
static G4bool ConvertToBool(const char *st)
G4UIcommandTree * GetTree() const
G4int ApplyCommand(const char *aCommand)
static G4UImanager * GetUIpointer()
G4double StoD(const G4String &s)
void SetDefaultValue(const char *theDefaultValue)
void SetGuidance(const char *theGuidance)
G4UnionSolid is a solid describing the Boolean union of two solids.
G4double GetScreenSize() const
void SetScreenSize(G4double)
G4Point3D GetPosition() const
void SetType(const G4String &)
void SetGlobalDescription(const G4String &)
virtual G4String GetCurrentDescription() const
void SetGlobalTag(const G4String &)
void SetExtent(const G4VisExtent &)
const G4VisExtent & GetExtent() const
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
G4VSolid is an abstract base class for solids, physical shapes that can be tracked through....
const G4ViewParameters & GetViewParameters() const
static G4double fCurrentTextSize
void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
static G4Colour fCurrentTextColour
void CheckSceneAndNotifyHandlers(G4Scene *=nullptr)
static std::vector< G4PhysicalVolumesSearchScene::Findings > fCurrrentPVFindingsForField
void ConvertToColour(G4Colour &colour, const G4String &redOrString, G4double green, G4double blue, G4double opacity)
static G4VisManager * fpVisManager
static G4VisExtent fCurrentExtentForField
const G4String & ConvertToColourGuidance()
void CopyParametersFrom(const G4UIcommand *fromCmd, G4UIcommand *toCmd)
static G4int fCurrentArrow3DLineSegmentsPerCircle
static G4Text::Layout fCurrentTextLayout
static G4double fCurrentLineWidth
static G4Colour fCurrentColour
void CopyGuidanceFrom(const G4UIcommand *fromCmd, G4UIcommand *toCmd, G4int startLine=0)
G4int GetNoOfSides() const
const G4Vector3D & GetViewpointDirection() const
const G4Vector3D & GetUpVector() const
void SetColour(const G4Colour &)
void SetLineWidth(G4double)
void SetForceSolid(G4bool=true)
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandSceneAddArrow2D()
G4VisCommandSceneAddArrow2D()
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddArrow()
virtual ~G4VisCommandSceneAddArrow()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandSceneAddAxes()
virtual ~G4VisCommandSceneAddAxes()
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandSceneAddDate()
G4VisCommandSceneAddDate()
G4VisCommandSceneAddDigis()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandSceneAddDigis()
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandSceneAddElectricField()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandSceneAddElectricField()
virtual ~G4VisCommandSceneAddEndOfRunMacro()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddEndOfRunMacro()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddEventID()
virtual ~G4VisCommandSceneAddEventID()
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandSceneAddExtent()
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddExtent()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandSceneAddFrame()
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandSceneAddFrame()
virtual ~G4VisCommandSceneAddGPS()
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddGPS()
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandSceneAddHits()
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddHits()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandSceneAddLine2D()
virtual ~G4VisCommandSceneAddLine2D()
G4VisCommandSceneAddLine()
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandSceneAddLine()
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandSceneAddLocalAxes()
G4VisCommandSceneAddLocalAxes()
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddLogicalVolume()
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandSceneAddLogicalVolume()
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandSceneAddLogo2D()
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandSceneAddLogo2D()
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddLogo()
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandSceneAddLogo()
virtual ~G4VisCommandSceneAddMagneticField()
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddMagneticField()
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandSceneAddPSHits()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddPSHits()
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandSceneAddPlotter()
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddPlotter()
virtual ~G4VisCommandSceneAddScale()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandSceneAddScale()
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddText2D()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandSceneAddText2D()
virtual ~G4VisCommandSceneAddText()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddText()
G4VisCommandSceneAddTrajectories()
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandSceneAddTrajectories()
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandSceneAddUserAction()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandSceneAddUserAction()
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddVolume()
virtual ~G4VisCommandSceneAddVolume()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4double GetExtentRadius() const
G4VisExtent & Transform(const G4Transform3D &)
const std::map< G4VUserVisAction *, G4VisExtent > & GetUserVisActionExtents() const
G4VViewer * GetCurrentViewer() const
void SetVisAttributes(const G4VisAttributes *)
BasicVector3D< T > unit() const
static void SetNumberOfRotationSteps(G4int n)
HepPolyhedron & Transform(const G4Transform3D &t)
static void ResetNumberOfRotationSteps()