63 #ifdef G4MULTITHREADED
90 "WARNING: For some reason, possibly mentioned above, it has not been"
91 "\n possible to add to the scene."
100 fpCommand -> SetGuidance (
"Adds arrow to current scene.");
115 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
136 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
143 std::istringstream is(newValue);
144 is >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> unitString;
146 x1 *= unit; y1 *= unit; z1 *= unit;
147 x2 *= unit; y2 *= unit; z2 *= unit;
155 (x1, y1, z1, x2, y2, z2,
159 const G4String& currentSceneName = pScene -> GetName ();
160 G4bool successful = pScene -> AddRunDurationModel (model, warn);
163 G4cout <<
"Arrow has been added to scene \""
164 << currentSceneName <<
"\"."
176 fpCommand -> SetGuidance (
"Adds 2D arrow to current scene.");
205 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
211 std::istringstream is(newValue);
212 is >> x1 >> y1 >> x2 >>
y2;
221 const G4String& currentSceneName = pScene -> GetName ();
222 G4bool successful = pScene -> AddRunDurationModel (model, warn);
225 G4cout <<
"A 2D arrow has been added to scene \""
226 << currentSceneName <<
"\"."
238 fWidth(width), fColour(colour)
240 fShaftPolyline.push_back(
G4Point3D(x1,y1,0));
241 fShaftPolyline.push_back(
G4Point3D(x2,y2,0));
243 G4Vector3D arrowPointLeftDirection(arrowDirection);
245 G4Vector3D arrowPointRightDirection(arrowDirection);
247 fHeadPolyline.push_back(
G4Point3D(x2,y2,0)+0.04*arrowPointLeftDirection);
248 fHeadPolyline.push_back(
G4Point3D(x2,y2,0));
249 fHeadPolyline.push_back(
G4Point3D(x2,y2,0)+0.04*arrowPointRightDirection);
253 fShaftPolyline.SetVisAttributes(va);
254 fHeadPolyline.SetVisAttributes(va);
257 void G4VisCommandSceneAddArrow2D::Arrow2D::operator()
273 (
"Draws axes at (x0, y0, z0) of given length and colour.");
275 (
"If \"colour-string\" is \"auto\", x, y and z will be red, green and blue"
276 "\n respectively. Otherwise it can be one of the pre-defined text-specified"
277 "\n colours - see information printed by the vis manager at start-up or"
278 "\n use \"/vis/list\".");
280 (
"If \"length\" is negative, it is set to about 25% of scene extent.");
282 (
"If \"showtext\" is false, annotations are suppressed.");
293 parameter =
new G4UIparameter (
"length",
'd', omitable =
true);
296 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
299 parameter =
new G4UIparameter (
"colour-string",
's', omitable =
true);
302 parameter =
new G4UIparameter (
"showtext",
'b', omitable =
true);
323 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
330 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
337 G4String unitString, colourString, showTextString;
339 std::istringstream is (newValue);
340 is >> x0 >> y0 >> z0 >> length >> unitString
341 >> colourString >> showTextString;
346 x0 *= unit; y0 *= unit; z0 *= unit;
350 const G4double intLog10Length = std::floor(std::log10(lengthMax));
351 length = std::pow(10,intLog10Length);
352 if (5.*length < lengthMax) length *= 5.;
353 else if (2.*length < lengthMax) length *= 2.;
362 if (arrowWidth > length/50.) arrowWidth = length/50.;
365 (x0, y0, z0, length, arrowWidth, colourString, newValue,
368 G4bool successful = pScene -> AddRunDurationModel (model, warn);
369 const G4String& currentSceneName = pScene -> GetName ();
373 <<
"have been added to scene \"" << currentSceneName <<
"\"."
386 fpCommand -> SetGuidance (
"Adds date to current scene.");
388 (
"If \"date\"is omitted, the current date and time is drawn."
389 "\nOtherwise, the string, including the rest of the line, is drawn.");
391 parameter =
new G4UIparameter (
"size",
'i', omitable =
true);
392 parameter -> SetGuidance (
"Screen size of text in pixels.");
393 parameter -> SetDefaultValue (18);
395 parameter =
new G4UIparameter (
"x-position",
'd', omitable =
true);
396 parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
397 parameter -> SetDefaultValue (0.95);
399 parameter =
new G4UIparameter (
"y-position",
'd', omitable =
true);
400 parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
401 parameter -> SetDefaultValue (0.9);
403 parameter =
new G4UIparameter (
"layout",
's', omitable =
true);
404 parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
405 parameter -> SetDefaultValue (
"right");
407 parameter =
new G4UIparameter (
"date",
's', omitable =
true);
408 parameter -> SetDefaultValue (
"-");
428 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
436 std::istringstream is(newValue);
437 is >> size >> x >> y >> layoutString >> dateString;
439 const size_t NREMAINDER = 100;
440 char remainder[NREMAINDER];
442 is.getline(remainder, NREMAINDER);
443 dateString += remainder;
455 const G4String& currentSceneName = pScene -> GetName ();
456 G4bool successful = pScene -> AddRunDurationModel (model, warn);
459 G4cout <<
"Date has been added to scene \""
460 << currentSceneName <<
"\"."
468 void G4VisCommandSceneAddDate::Date::operator()
473 time = fTimer.GetClockTime();
478 std::string::size_type i = time.rfind(
'\n');
479 if (i != std::string::npos) time.erase(i);
494 fpCommand -> SetGuidance (
"Adds digis to current scene.");
496 (
"Digis are drawn at end of event when the scene in which"
497 "\nthey are added is current.");
516 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
522 const G4String& currentSceneName = pScene -> GetName ();
523 G4bool successful = pScene -> AddEndOfEventModel (model, warn);
526 G4cout <<
"Digis, if any, will be drawn at end of run in scene \""
527 << currentSceneName <<
"\"."
540 fpCommand -> SetGuidance (
"Adds eventID to current scene.");
542 (
"Run and event numbers are drawn at end of event or run when"
543 "\n the scene in which they are added is current.");
545 parameter =
new G4UIparameter (
"size",
'i', omitable =
true);
546 parameter -> SetGuidance (
"Screen size of text in pixels.");
547 parameter -> SetDefaultValue (18);
549 parameter =
new G4UIparameter (
"x-position",
'd', omitable =
true);
550 parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
551 parameter -> SetDefaultValue (-0.95);
553 parameter =
new G4UIparameter (
"y-position",
'd', omitable =
true);
554 parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
555 parameter -> SetDefaultValue (0.9);
557 parameter =
new G4UIparameter (
"layout",
's', omitable =
true);
558 parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
559 parameter -> SetDefaultValue (
"left");
579 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
587 std::istringstream is(newValue);
588 is >> size >> x >> y >> layoutString;
601 const G4String& currentSceneName = pScene -> GetName ();
602 G4bool successful = pScene -> AddEndOfEventModel (model, warn);
605 G4cout <<
"EventID has been added to scene \""
606 << currentSceneName <<
"\"."
614 void G4VisCommandSceneAddEventID::EventID::operator()
617 const G4Run* currentRun = 0;
619 #ifdef G4MULTITHREADED
626 G4VModel*
model = fpVisManager->GetCurrentSceneHandler()->GetModel();
628 const G4Event* currentEvent = 0;
635 G4cerr <<
"ERROR: No model defined for this SceneHandler : "
636 << fpVisManager->GetCurrentSceneHandler()->GetName()
640 if (currentRun && currentEvent) {
643 std::ostringstream oss;
644 if (fpVisManager->GetCurrentScene()->GetRefreshAtEndOfEvent()) {
645 oss <<
"Run " << runID <<
" Event " <<
eventID;
648 #ifdef G4MULTITHREADED
660 const std::vector<const G4Event*>* events =
662 if (events) nEvents = events->size();
664 #ifndef G4MULTITHREADED
669 if (eventID < nEvents - 1)
return;
671 oss <<
"Run " << runID <<
" (" << nEvents <<
" event";
672 if (nEvents != 1) oss <<
's';
677 text.SetLayout(fLayout);
679 text.SetVisAttributes(textAtts);
691 (
"Adds a dummy model with given extent to the current scene."
692 "\nRequires the limits: xmin, xmax, ymin, ymax, zmin, zmax unit."
693 "\nThis can be used to provide an extent to the scene even if"
694 "\nno other models with extent are available. For example,"
695 "\neven if there is no geometry. In that case, for example:"
697 "\n /vis/scene/create"
698 "\n /vis/scene/add/extent -300 300 -300 300 -300 300 cm"
699 "\n /vis/sceneHandler/attach");
702 parameter =
new G4UIparameter (
"xmin",
'd', omitable =
true);
703 parameter -> SetDefaultValue (0.);
705 parameter =
new G4UIparameter (
"xmax",
'd', omitable =
true);
706 parameter -> SetDefaultValue (0.);
708 parameter =
new G4UIparameter (
"ymin",
'd', omitable =
true);
709 parameter -> SetDefaultValue (0.);
711 parameter =
new G4UIparameter (
"ymax",
'd', omitable =
true);
712 parameter -> SetDefaultValue (0.);
714 parameter =
new G4UIparameter (
"zmin",
'd', omitable =
true);
715 parameter -> SetDefaultValue (0.);
717 parameter =
new G4UIparameter (
"zmax",
'd', omitable =
true);
718 parameter -> SetDefaultValue (0.);
720 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
721 parameter -> SetDefaultValue (
"m");
741 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
748 std::istringstream is(newValue);
749 is >> xmin >> xmax >> ymin >> ymax >> zmin >> zmax >> unitString;
751 xmin *= unit; xmax *= unit;
752 ymin *= unit; ymax *= unit;
753 zmin *= unit; zmax *= unit;
755 G4VisExtent visExtent(xmin, xmax, ymin, ymax, zmin, zmax);
756 Extent* extent =
new Extent(xmin, xmax, ymin, ymax, zmin, zmax);
763 const G4String& currentSceneName = pScene -> GetName ();
764 G4bool successful = pScene -> AddRunDurationModel (model, warn);
767 G4cout <<
"A benign model with extent "
769 <<
" has been added to scene \""
770 << currentSceneName <<
"\"."
782 fExtent(xmin,xmax,ymin,ymax,zmin,zmax)
785 void G4VisCommandSceneAddExtent::Extent::operator()
793 fpCommand -> SetGuidance (
"Add frame to current scene.");
796 parameter =
new G4UIparameter (
"size",
'd', omitable =
true);
797 parameter -> SetGuidance (
"Size of frame. 1 = full window.");
798 parameter -> SetParameterRange (
"size > 0 && size <=1");
799 parameter -> SetDefaultValue (0.97);
819 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
825 std::istringstream is(newValue);
834 const G4String& currentSceneName = pScene -> GetName ();
835 G4bool successful = pScene -> AddRunDurationModel (model, warn);
838 G4cout <<
"Frame has been added to scene \""
839 << currentSceneName <<
"\"."
847 void G4VisCommandSceneAddFrame::Frame::operator()
851 frame.push_back(
G4Point3D( fSize, fSize, 0.));
852 frame.push_back(
G4Point3D(-fSize, fSize, 0.));
853 frame.push_back(
G4Point3D(-fSize, -fSize, 0.));
854 frame.push_back(
G4Point3D( fSize, -fSize, 0.));
855 frame.push_back(
G4Point3D( fSize, fSize, 0.));
872 (
"A representation of the source(s) of the General Particle Source"
873 "\nwill be added to current scene and drawn, if applicable.");
876 parameter =
new G4UIparameter(
"red_or_string",
's', omitable =
true);
877 parameter -> SetDefaultValue (
"1.");
879 parameter =
new G4UIparameter(
"green",
'd', omitable =
true);
880 parameter -> SetDefaultValue (0.);
882 parameter =
new G4UIparameter (
"blue",
'd', omitable =
true);
883 parameter -> SetDefaultValue (0.);
885 parameter =
new G4UIparameter (
"opacity",
'd', omitable =
true);
886 parameter -> SetDefaultValue (0.3);
906 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
913 std::istringstream iss(newValue);
914 iss >> redOrString >> green >> blue >> opacity;
919 const G4String& currentSceneName = pScene -> GetName ();
920 G4bool successful = pScene -> AddRunDurationModel (model, warn);
924 "A representation of the source(s) of the General Particle Source will be drawn"
925 "\n in colour " << colour <<
" for scene \""
926 << currentSceneName <<
"\" if applicable."
938 fpCommand -> SetGuidance (
"Adds hits to current scene.");
940 (
"Hits are drawn at end of event when the scene in which"
941 "\nthey are added is current.");
960 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
966 const G4String& currentSceneName = pScene -> GetName ();
967 G4bool successful = pScene -> AddEndOfEventModel (model, warn);
970 G4cout <<
"Hits, if any, will be drawn at end of run in scene \""
971 << currentSceneName <<
"\"."
983 fpCommand -> SetGuidance (
"Adds line to current scene.");
998 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1019 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1026 std::istringstream is(newValue);
1027 is >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> unitString;
1029 x1 *= unit; y1 *= unit; z1 *= unit;
1030 x2 *= unit; y2 *= unit; z2 *= unit;
1032 Line* line =
new Line(x1, y1, z1, x2, y2, z2,
1039 const G4String& currentSceneName = pScene -> GetName ();
1040 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1043 G4cout <<
"Line has been added to scene \""
1044 << currentSceneName <<
"\"."
1056 fWidth(width), fColour(colour)
1058 fPolyline.push_back(
G4Point3D(x1,y1,z1));
1059 fPolyline.push_back(
G4Point3D(x2,y2,z2));
1063 fPolyline.SetVisAttributes(va);
1066 void G4VisCommandSceneAddLine::Line::operator()
1078 fpCommand -> SetGuidance (
"Adds 2D line to current scene.");
1081 parameter =
new G4UIparameter (
"x1",
'd', omitable =
false);
1083 parameter =
new G4UIparameter (
"y1",
'd', omitable =
false);
1085 parameter =
new G4UIparameter (
"x2",
'd', omitable =
false);
1087 parameter =
new G4UIparameter (
"y2",
'd', omitable =
false);
1107 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1113 std::istringstream is(newValue);
1114 is >> x1 >> y1 >> x2 >>
y2;
1123 const G4String& currentSceneName = pScene -> GetName ();
1124 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1127 G4cout <<
"A 2D line has been added to scene \""
1128 << currentSceneName <<
"\"."
1140 fWidth(width), fColour(colour)
1142 fPolyline.push_back(
G4Point3D(x1,y1,0));
1143 fPolyline.push_back(
G4Point3D(x2,y2,0));
1147 fPolyline.SetVisAttributes(va);
1150 void G4VisCommandSceneAddLine2D::Line2D::operator()
1163 fpCommand -> SetGuidance (
"Adds a logical volume to the current scene,");
1165 (
"Shows boolean components (if any), voxels (if any), readout geometry"
1166 "\n (if any), local axes and overlaps (if any), under control of the"
1167 "\n appropriate flag."
1168 "\n Note: voxels are not constructed until start of run -"
1169 "\n \"/run/beamOn\". (For voxels without a run, \"/run/beamOn 0\".)");
1171 parameter =
new G4UIparameter (
"logical-volume-name",
's', omitable =
false);
1173 parameter =
new G4UIparameter (
"depth-of-descent",
'i', omitable =
true);
1174 parameter -> SetGuidance (
"Depth of descent of geometry hierarchy.");
1175 parameter -> SetDefaultValue (1);
1177 parameter =
new G4UIparameter (
"booleans-flag",
'b', omitable =
true);
1178 parameter -> SetDefaultValue (
true);
1180 parameter =
new G4UIparameter (
"voxels-flag",
'b', omitable =
true);
1181 parameter -> SetDefaultValue (
true);
1183 parameter =
new G4UIparameter (
"readout-flag",
'b', omitable =
true);
1184 parameter -> SetDefaultValue (
true);
1186 parameter =
new G4UIparameter (
"axes-flag",
'b', omitable =
true);
1187 parameter -> SetDefaultValue (
true);
1188 parameter -> SetGuidance (
"Set \"false\" to suppress axes.");
1190 parameter =
new G4UIparameter(
"check-overlap-flag",
'b', omitable =
true);
1192 parameter -> SetGuidance (
"Set \"false\" to suppress overlap check.");
1213 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1219 G4int requestedDepthOfDescent;
1220 G4String booleansString, voxelsString, readoutString, axesString;
1222 std::istringstream is (newValue);
1223 is >> name >> requestedDepthOfDescent
1224 >> booleansString >> voxelsString >> readoutString >> axesString
1233 int nLV = pLVStore -> size ();
1236 for (iLV = 0; iLV < nLV; iLV++ ) {
1237 pLV = (*pLVStore) [iLV];
1238 if (pLV -> GetName () == name)
break;
1242 G4cerr <<
"ERROR: Logical volume " << name
1243 <<
" not found in logical volume store." <<
G4endl;
1248 const std::vector<G4Scene::Model>& rdModelList =
1249 pScene -> GetRunDurationModelList();
1250 std::vector<G4Scene::Model>::const_iterator i;
1251 for (i = rdModelList.begin(); i != rdModelList.end(); ++i) {
1252 if (i->fpModel->GetGlobalDescription().find(
"Volume") != std::string::npos)
break;
1254 if (i != rdModelList.end()) {
1256 G4cout <<
"There is already a volume, \""
1257 << i->fpModel->GetGlobalDescription()
1258 <<
"\",\n in the run-duration model list of scene \""
1259 << pScene -> GetName()
1260 <<
"\".\n Your logical volume must be the only volume in the scene."
1261 <<
"\n Create a new scene and try again:"
1262 <<
"\n /vis/specify " << name
1264 <<
"\n /vis/scene/create"
1265 <<
"\n /vis/scene/add/logicalVolume " << name
1266 <<
"\n /vis/sceneHandler/attach"
1267 <<
"\n (and also, if necessary, /vis/viewer/flush)"
1274 (pLV, requestedDepthOfDescent, booleans, voxels, readout, checkOverlaps);
1275 const G4String& currentSceneName = pScene -> GetName ();
1276 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1280 G4bool axesSuccessful =
false;
1283 const G4double axisLengthMax = radius / 2.;
1284 const G4double intLog10Length = std::floor(std::log10(axisLengthMax));
1285 G4double axisLength = std::pow(10,intLog10Length);
1286 if (5.*axisLength < axisLengthMax) axisLength *= 5.;
1287 else if (2.*axisLength < axisLengthMax) axisLength *= 2.;
1288 const G4double axisWidth = axisLength / 20.;
1290 axesSuccessful = pScene -> AddRunDurationModel (axesModel, warn);
1301 G4cout <<
"Logical volume \"" << pLV -> GetName ()
1302 <<
"\" with requested depth of descent "
1303 << requestedDepthOfDescent
1305 if (!booleans)
G4cout <<
"out";
1306 G4cout <<
" boolean components, with";
1307 if (!voxels)
G4cout <<
"out";
1308 G4cout <<
" voxels,\n with";
1309 if (!readout)
G4cout <<
"out";
1310 G4cout <<
" readout geometry and with";
1311 if (!checkOverlaps)
G4cout <<
"out";
1312 G4cout <<
" overlap checking"
1313 <<
"\n has been added to scene \"" << currentSceneName <<
"\".";
1315 if (axesSuccessful) {
1317 "\n Axes have also been added at the origin of local cooordinates.";
1320 "\n Axes have not been added for some reason possibly stated above.";
1340 fpCommand -> SetGuidance (
"Adds a G4 logo to the current scene.");
1342 (
"If \"unit\" is \"auto\", height is roughly one tenth of scene extent.");
1344 (
"\"direction\" is that of outward-facing normal to front face of logo."
1345 "\nIf \"direction\" is \"auto\", logo faces the user in the current viewer.");
1347 (
"\nIf \"placement\" is \"auto\", logo is placed at bottom right of screen"
1348 "\n when viewed from logo direction.");
1350 parameter =
new G4UIparameter (
"height",
'd', omitable =
true);
1353 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1356 parameter =
new G4UIparameter (
"direction",
's', omitable =
true);
1360 parameter =
new G4UIparameter (
"red",
'd', omitable =
true);
1363 parameter =
new G4UIparameter (
"green",
'd', omitable =
true);
1366 parameter =
new G4UIparameter (
"blue",
'd', omitable =
true);
1369 parameter =
new G4UIparameter (
"placement",
's', omitable =
true);
1370 parameter -> SetParameterCandidates(
"auto manual");
1373 parameter =
new G4UIparameter (
"xmid",
'd', omitable =
true);
1376 parameter =
new G4UIparameter (
"ymid",
'd', omitable =
true);
1379 parameter =
new G4UIparameter (
"zmid",
'd', omitable =
true);
1382 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1403 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1410 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
1421 "ERROR: G4VisCommandSceneAddLogo::SetNewValue: no viewer."
1422 "\n Auto direction needs a viewer."
1429 G4String userHeightUnit, direction, auto_manual, positionUnit;
1430 std::istringstream is (newValue);
1431 is >> userHeight >> userHeightUnit >> direction
1432 >> red >> green >> blue
1434 >> xmid >> ymid >> zmid >> positionUnit;
1438 if (userHeightUnit ==
"auto") {
1445 xmid *= unit; ymid *= unit; zmid *= unit;
1448 if (direction ==
"auto") {
1452 if (vp.
x() > vp.
y() && vp.
x() > vp.
z()) logoDirection =
X;
1453 else if (vp.
x() < vp.
y() && vp.
x() < vp.
z()) logoDirection =
minusX;
1454 else if (vp.
y() > vp.
x() && vp.
y() > vp.
z()) logoDirection =
Y;
1455 else if (vp.
y() < vp.
x() && vp.
y() < vp.
z()) logoDirection =
minusY;
1456 else if (vp.
z() > vp.
x() && vp.
z() > vp.
y()) logoDirection =
Z;
1457 else if (vp.
z() < vp.
x() && vp.
z() < vp.
y()) logoDirection =
minusZ;
1459 else if (direction(0) ==
'x') logoDirection =
X;
1460 else if (direction(0) ==
'y') logoDirection =
Y;
1461 else if (direction(0) ==
'z') logoDirection =
Z;
1462 else if (direction(0) ==
'-') {
1463 if (direction(1) ==
'x') logoDirection =
minusX;
1464 else if (direction(1) ==
'y') logoDirection =
minusY;
1465 else if (direction(1) ==
'z') logoDirection =
minusZ;
1468 G4cerr <<
"ERROR: Unrecogniseed direction: \""
1469 << direction <<
"\"." <<
G4endl;
1474 G4bool autoPlacing =
false;
if (auto_manual ==
"auto") autoPlacing =
true;
1491 "WARNING: Existing scene does not yet have any extent."
1492 "\n Maybe you have not yet added any geometrical object."
1498 const G4double halfHeight(height / 2.);
1500 const G4double freeHeightFraction (1. + 2. * comfort);
1504 switch (logoDirection) {
1507 if (freeHeightFraction * (xmax - xmin) < height) room =
false;
1511 if (freeHeightFraction * (ymax - ymin) < height) room =
false;
1515 if (freeHeightFraction * (zmax - zmin) < height) room =
false;
1522 "WARNING: Not enough room in existing scene. Maybe logo is too large."
1529 "WARNING: The logo you have asked for is bigger than the existing"
1530 "\n scene. Maybe you have added it too soon. It is recommended that"
1531 "\n you add the logo last so that it can be correctly auto-positioned"
1532 "\n so as not to be obscured by any existing object and so that the"
1533 "\n view parameters can be correctly recalculated."
1538 G4double sxmid(xmid), symid(ymid), szmid(zmid);
1542 const G4double xComfort = comfort * (xmax - xmin);
1544 const G4double zComfort = comfort * (zmax - zmin);
1545 switch (logoDirection) {
1547 sxmid = xmax + halfHeight + xComfort;
1548 symid = ymin - yComfort;
1549 szmid = zmin - zComfort;
1552 sxmid = xmin - halfHeight - xComfort;
1553 symid = ymin - yComfort;
1554 szmid = zmax + zComfort;
1557 sxmid = xmin - xComfort;
1558 symid = ymax + halfHeight + yComfort;
1559 szmid = zmin - zComfort;
1562 sxmid = xmax + xComfort;
1563 symid = ymin - halfHeight - yComfort;
1564 szmid = zmin - zComfort;
1567 sxmid = xmax + xComfort;
1568 symid = ymin - yComfort;
1569 szmid = zmax + halfHeight + zComfort;
1572 sxmid = xmin - xComfort;
1573 symid = ymin - yComfort;
1574 szmid = zmin - halfHeight - zComfort;
1580 switch (logoDirection) {
1620 const G4String& currentSceneName = pScene -> GetName ();
1621 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1624 G4cout <<
"G4 Logo of height " << userHeight <<
' ' << userHeightUnit
1625 <<
", " << direction <<
"-direction, added to scene \""
1626 << currentSceneName <<
"\"";
1628 G4cout <<
"\n with extent " << extent
1656 const G4double dx = xt - xb, dy = yt - yb;
1660 const G4double d = std::sqrt(dx * dx + dy * dy);
1663 const G4double x8 = ((-ss * d - dx * (yt - y8)) / dy) + xt;
1665 G4double x9 = ((-(ss -
w) * d - dx * (yt - y8)) / dy) + xt;
1668 x9 += xtr; y9 += ytr;
1683 G4Box bG(
"bG",w2,ro2,d2);
1690 G4Box b1(
"b1",h2,h2,d2);
1691 G4Box bS(
"bS",ss,ss,d2+e);
1692 G4Box bS2(
"bS2",ss,ss,d2+2.*e);
1701 fp4 = logo4.CreatePolyhedron();
1710 fp4->SetVisAttributes(&fVisAtts);
1719 void G4VisCommandSceneAddLogo::G4Logo::operator()
1732 fpCommand -> SetGuidance (
"Adds 2D logo to current scene.");
1734 parameter =
new G4UIparameter (
"size",
'i', omitable =
true);
1735 parameter -> SetGuidance (
"Screen size of text in pixels.");
1736 parameter -> SetDefaultValue (48);
1738 parameter =
new G4UIparameter (
"x-position",
'd', omitable =
true);
1739 parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
1740 parameter -> SetDefaultValue (-0.9);
1742 parameter =
new G4UIparameter (
"y-position",
'd', omitable =
true);
1743 parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
1744 parameter -> SetDefaultValue (-0.9);
1746 parameter =
new G4UIparameter (
"layout",
's', omitable =
true);
1747 parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
1748 parameter -> SetDefaultValue (
"left");
1768 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1776 std::istringstream is(newValue);
1777 is >> size >> x >> y >> layoutString;
1789 const G4String& currentSceneName = pScene -> GetName ();
1790 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1793 G4cout <<
"2D logo has been added to scene \""
1794 << currentSceneName <<
"\"."
1802 void G4VisCommandSceneAddLogo2D::Logo2D::operator()
1821 (
"Adds magnetic field representation to current scene.");
1823 (
"The first parameter is no. of data points per half scene. So, possibly, at"
1824 "\nmaximum, the number of data points sampled is (2*n+1)^3, which can grow"
1825 "\nlarge--be warned!"
1826 "\nYou might find that your scene is cluttered by thousands of arrows for"
1827 "\nthe default number of data points, so try reducing to 2 or 3, e.g:"
1828 "\n /vis/scene/add/magneticField 3"
1829 "\nor, if only a small part of the scene has a field:"
1830 "\n /vis/scene/add/magneticField 50 or more");
1832 (
"In the arrow representation, the length of the arrow is proportional"
1833 "\nto the magnitude of the field and the colour is mapped onto the range"
1834 "\nas a fraction of the maximum magnitude: 0->0.5->1 is blue->green->red.");
1836 parameter =
new G4UIparameter (
"nDataPointsPerHalfScene",
'i', omitable =
true);
1837 parameter -> SetDefaultValue (10);
1839 parameter =
new G4UIparameter (
"representation",
's', omitable =
true);
1840 parameter -> SetParameterCandidates(
"fullArrow lightArrow");
1841 parameter -> SetDefaultValue (
"fullArrow");
1862 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1867 G4int nDataPointsPerHalfScene;
1869 std::istringstream iss(newValue);
1870 iss >> nDataPointsPerHalfScene >> representation;
1873 if (representation ==
"lightArrow") {
1879 const G4String& currentSceneName = pScene -> GetName ();
1880 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1883 G4cout <<
"Magnetic field, if any, will be drawn in scene \""
1886 << nDataPointsPerHalfScene
1887 <<
" data points per half scene and with representation \""
1903 (
"Adds Primitive Scorer Hits (PSHits) to current scene.");
1905 (
"PSHits are drawn at end of run when the scene in which"
1906 "\nthey are added is current.");
1908 (
"Optional parameter specifies name of scoring map. By default all"
1909 "\nscoring maps registered with the G4ScoringManager are drawn.");
1910 fpCommand -> SetParameterName (
"mapname", omitable =
true);
1931 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1937 const G4String& currentSceneName = pScene -> GetName ();
1938 G4bool successful = pScene -> AddEndOfRunModel (model, warn);
1941 if (newValue ==
"all") {
1942 G4cout <<
"All Primitive Scorer hits";
1944 G4cout <<
"Hits of Primitive Scorer \"" << newValue <<
'"';
1946 G4cout <<
" will be drawn at end of run in scene \""
1947 << currentSceneName <<
"\"."
1961 (
"Adds an annotated scale line to the current scene.");
1963 (
"If \"unit\" is \"auto\", length is roughly one tenth of the scene extent.");
1965 (
"If \"direction\" is \"auto\", scale is roughly in the plane of the current view.");
1967 (
"If \"placement\" is \"auto\", scale is placed at bottom left of current view."
1968 "\n Otherwise placed at (xmid,ymid,zmid).");
1971 parameter =
new G4UIparameter (
"length",
'd', omitable =
true);
1974 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1977 parameter =
new G4UIparameter (
"direction",
's', omitable =
true);
1981 parameter =
new G4UIparameter (
"red",
'd', omitable =
true);
1984 parameter =
new G4UIparameter (
"green",
'd', omitable =
true);
1987 parameter =
new G4UIparameter (
"blue",
'd', omitable =
true);
1990 parameter =
new G4UIparameter (
"placement",
's', omitable =
true);
1991 parameter -> SetParameterCandidates(
"auto manual");
1994 parameter =
new G4UIparameter (
"xmid",
'd', omitable =
true);
1997 parameter =
new G4UIparameter (
"ymid",
'd', omitable =
true);
2000 parameter =
new G4UIparameter (
"zmid",
'd', omitable =
true);
2003 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
2024 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2031 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
2039 G4String userLengthUnit, direction, auto_manual, positionUnit;
2040 std::istringstream is (newValue);
2041 is >> userLength >> userLengthUnit >> direction
2042 >> red >> green >> blue
2044 >> xmid >> ymid >> zmid >> positionUnit;
2048 if (userLengthUnit ==
"auto") {
2050 const G4double intLog10Length = std::floor(std::log10(lengthMax));
2051 length = std::pow(10,intLog10Length);
2052 if (5.*length < lengthMax) length *= 5.;
2053 else if (2.*length < lengthMax) length *= 2.;
2060 xmid *= unit; ymid *= unit; zmid *= unit;
2063 if (direction(0) ==
'y') scaleDirection =
G4Scale::y;
2064 if (direction(0) ==
'z') scaleDirection =
G4Scale::z;
2070 "ERROR: G4VisCommandSceneAddScale::SetNewValue: no viewer."
2071 "\n Auto direction needs a viewer."
2082 if (direction ==
"auto") {
2083 if (std::abs(vp.
x()) > std::abs(vp.
y()) &&
2084 std::abs(vp.
x()) > std::abs(vp.
z())) {
2085 if (std::abs(up.
y()) > std::abs(up.
z())) scaleDirection =
G4Scale::z;
2088 else if (std::abs(vp.
y()) > std::abs(vp.
x()) &&
2089 std::abs(vp.
y()) > std::abs(vp.
z())) {
2090 if (std::abs(up.
x()) > std::abs(up.
z())) scaleDirection =
G4Scale::z;
2093 else if (std::abs(vp.
z()) > std::abs(vp.
x()) &&
2094 std::abs(vp.
z()) > std::abs(vp.
y())) {
2095 if (std::abs(up.
y()) > std::abs(up.
x())) scaleDirection =
G4Scale::x;
2100 G4bool autoPlacing =
false;
if (auto_manual ==
"auto") autoPlacing =
true;
2104 const G4double halfLength(length / 2.);
2106 const G4double freeLengthFraction (1. + 2. * comfort);
2121 "WARNING: Existing scene does not yet have any extent."
2122 "\n Maybe you have not yet added any geometrical object."
2128 switch (scaleDirection) {
2130 if (freeLengthFraction * (xmax - xmin) < length) room =
false;
2133 if (freeLengthFraction * (ymax - ymin) < length) room =
false;
2136 if (freeLengthFraction * (zmax - zmin) < length) room =
false;
2143 "WARNING: Not enough room in existing scene. Maybe scale is too long."
2150 "WARNING: The scale you have asked for is bigger than the existing"
2151 "\n scene. Maybe you have added it too soon. It is recommended that"
2152 "\n you add the scale last so that it can be correctly auto-positioned"
2153 "\n so as not to be obscured by any existing object and so that the"
2154 "\n view parameters can be correctly recalculated."
2162 false, xmid, ymid, zmid,
2168 globalDescription +=
" (" + newValue +
")";
2198 G4double sxmid(xmid), symid(ymid), szmid(zmid);
2202 const G4double xComfort = comfort * (xmax - xmin);
2204 const G4double zComfort = comfort * (zmax - zmin);
2205 switch (scaleDirection) {
2208 sxmid = xmax + xComfort;
2209 symid = ymin - yComfort;
2210 szmid = zmin - zComfort;
2212 sxmid = xmin - xComfort;
2213 symid = ymin - yComfort;
2214 szmid = zmax + zComfort;
2219 sxmid = xmin - xComfort;
2220 symid = ymax + yComfort;
2221 szmid = zmin - zComfort;
2223 sxmid = xmax + xComfort;
2224 symid = ymin - yComfort;
2225 szmid = zmin - zComfort;
2230 sxmid = xmax + xComfort;
2231 symid = ymin - yComfort;
2232 szmid = zmax + zComfort;
2234 sxmid = xmin - xComfort;
2235 symid = ymin - yComfort;
2236 szmid = zmax + zComfort;
2292 switch (scaleDirection) {
2294 scaleExtent =
G4VisExtent(-halfLength,halfLength,0,0,0,0);
2298 scaleExtent =
G4VisExtent(0,0,-halfLength,halfLength,0,0);
2302 scaleExtent =
G4VisExtent(0,0,0,0,-halfLength,halfLength);
2316 const G4String& currentSceneName = pScene -> GetName ();
2317 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2320 G4cout <<
"Scale of " << annotation
2321 <<
" added to scene \"" << currentSceneName <<
"\".";
2323 G4cout <<
"\n with extent " << scaleExtent
2340 fpCommand -> SetGuidance (
"Adds text to current scene.");
2342 (
"Use \"/vis/set/textColour\" to set colour.");
2344 (
"Use \"/vis/set/textLayout\" to set layout:");
2355 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
2358 parameter =
new G4UIparameter (
"font_size",
'd', omitable =
true);
2362 parameter =
new G4UIparameter (
"x_offset",
'd', omitable =
true);
2366 parameter =
new G4UIparameter (
"y_offset",
'd', omitable =
true);
2370 parameter =
new G4UIparameter (
"text",
's', omitable =
true);
2371 parameter->
SetGuidance (
"The rest of the line is text.");
2392 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2408 x *= unit; y *= unit; z *= unit;
2417 const G4String& currentSceneName = pScene -> GetName ();
2418 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2421 G4cout <<
"Text \"" << text
2422 <<
"\" has been added to scene \"" << currentSceneName <<
"\"."
2436 fpCommand -> SetGuidance (
"Adds 2D text to current scene.");
2438 (
"Use \"/vis/set/textColour\" to set colour.");
2440 (
"Use \"/vis/set/textLayout\" to set layout:");
2448 parameter =
new G4UIparameter (
"font_size",
'd', omitable =
true);
2452 parameter =
new G4UIparameter (
"x_offset",
'd', omitable =
true);
2456 parameter =
new G4UIparameter (
"y_offset",
'd', omitable =
true);
2460 parameter =
new G4UIparameter (
"text",
's', omitable =
true);
2461 parameter->
SetGuidance (
"The rest of the line is text.");
2482 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2507 const G4String& currentSceneName = pScene -> GetName ();
2508 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2511 G4cout <<
"2D text \"" << text
2512 <<
"\" has been added to scene \"" << currentSceneName <<
"\"."
2524 void G4VisCommandSceneAddText2D::G4Text2D::operator()
2537 (
"/vis/scene/add/trajectories",
this);
2539 (
"Adds trajectories to current scene.");
2541 (
"Causes trajectories, if any, to be drawn at the end of processing an"
2542 "\nevent. Switches on trajectory storing and sets the"
2543 "\ndefault trajectory type.");
2545 (
"The command line parameter list determines the default trajectory type."
2546 "\nIf it contains the string \"smooth\", auxiliary inter-step points will"
2547 "\nbe inserted to improve the smoothness of the drawing of a curved"
2549 "\nIf it contains the string \"rich\", significant extra information will"
2550 "\nbe stored in the trajectory (G4RichTrajectory) amenable to modeling"
2551 "\nand filtering with \"/vis/modeling/trajectories/create/drawByAttribute\""
2552 "\nand \"/vis/filtering/trajectories/create/attributeFilter\" commands."
2553 "\nIt may contain both strings in any order.");
2555 (
"\nTo switch off trajectory storing: \"/tracking/storeTrajectory 0\"."
2556 "\nSee also \"/vis/scene/endOfEventAction\".");
2558 (
"Note: This only sets the default. Independently of the result of this"
2559 "\ncommand, a user may instantiate a trajectory that overrides this default"
2560 "\nin PreUserTrackingAction.");
2561 fpCommand -> SetParameterName (
"default-trajectory-type", omitable =
true);
2582 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2589 if (newValue.find(
"smooth") != std::string::npos) smooth =
true;
2590 if (newValue.find(
"rich") != std::string::npos) rich =
true;
2591 if (newValue.size() && !(rich || smooth)) {
2593 G4cerr <<
"ERROR: Unrecognised parameter \"" << newValue <<
"\""
2594 "\n No action taken."
2602 G4int newVerbose = 2;
2605 if (smooth && rich) {
2606 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 4");
2607 defaultTrajectoryType =
"G4RichTrajectory configured for smooth steps";
2608 }
else if (smooth) {
2609 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 2");
2610 defaultTrajectoryType =
"G4SmoothTrajectory";
2612 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 3");
2613 defaultTrajectoryType =
"G4RichTrajectory";
2615 UImanager->
ApplyCommand(
"/tracking/storeTrajectory 1");
2616 defaultTrajectoryType =
"G4Trajectory";
2622 "Attributes available for modeling and filtering with"
2623 "\n \"/vis/modeling/trajectories/create/drawByAttribute\" and"
2624 "\n \"/vis/filtering/trajectories/create/attributeFilter\" commands:"
2630 }
else if (smooth) {
2640 const G4String& currentSceneName = pScene -> GetName ();
2641 pScene -> AddEndOfEventModel (model, warn);
2644 G4cout <<
"Default trajectory type " << defaultTrajectoryType
2645 <<
"\n will be used to store trajectories for scene \""
2646 << currentSceneName <<
"\"."
2652 "WARNING: Trajectory storing has been requested. This action may be"
2653 "\n reversed with \"/tracking/storeTrajectory 0\"."
2665 (
"Add named Vis User Action to current scene.");
2667 (
"Attempts to match search string to name of action - use unique sub-string.");
2669 (
"(Use /vis/list to see names of registered actions.)");
2671 (
"If name == \"all\" (default), all actions are added.");
2672 fpCommand -> SetParameterName(
"action-name", omitable =
true);
2692 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2699 const std::vector<G4VisManager::UserVisAction>& runDurationUserVisActions =
2701 for (
size_t i = 0; i < runDurationUserVisActions.size(); i++) {
2702 const G4String&
name = runDurationUserVisActions[i].fName;
2703 G4VUserVisAction* visAction = runDurationUserVisActions[i].fpUserVisAction;
2704 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2706 AddVisAction(name,visAction,pScene,runDuration,verbosity);
2710 const std::vector<G4VisManager::UserVisAction>& endOfEventUserVisActions =
2712 for (
size_t i = 0; i < endOfEventUserVisActions.size(); i++) {
2713 const G4String&
name = endOfEventUserVisActions[i].fName;
2715 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2717 AddVisAction(name,visAction,pScene,endOfEvent,verbosity);
2721 const std::vector<G4VisManager::UserVisAction>& endOfRunUserVisActions =
2723 for (
size_t i = 0; i < endOfRunUserVisActions.size(); i++) {
2724 const G4String&
name = endOfRunUserVisActions[i].fName;
2726 if (newValue ==
"all" || name.find(newValue) != std::string::npos) {
2728 AddVisAction(name,visAction,pScene,endOfRun,verbosity);
2734 G4cout <<
"WARNING: No User Vis Action registered." <<
G4endl;
2739 const G4String& currentSceneName = pScene -> GetName ();
2752 const std::map<G4VUserVisAction*,G4VisExtent>& visExtentMap =
2755 std::map<G4VUserVisAction*,G4VisExtent>::const_iterator i =
2756 visExtentMap.find(visAction);
2757 if (i != visExtentMap.end()) extent = i->second;
2760 G4cout <<
"WARNING: User Vis Action extent is null." <<
G4endl;
2765 model->
SetType(
"User Vis Action");
2769 G4bool successful =
false;;
2772 successful = pScene -> AddRunDurationModel (model, warn);
2775 successful = pScene -> AddEndOfEventModel (model, warn);
2778 successful = pScene -> AddEndOfRunModel (model, warn);
2782 const G4String& currentSceneName = pScene -> GetName ();
2783 G4cout <<
"User Vis Action added to scene \""
2784 << currentSceneName <<
"\"";
2786 G4cout <<
"\n with extent " << extent;
2799 (
"Adds a physical volume to current scene, with optional clipping volume.");
2801 (
"If physical-volume-name is \"world\" (the default), the top of the"
2802 "\nmain geometry tree (material world) is added. If \"worlds\", the"
2803 "\ntop of all worlds - material world and parallel worlds, if any - are"
2804 "\nadded. Otherwise a search of all worlds is made, taking the first"
2805 "\nmatching occurence only. To see a representation of the geometry"
2806 "\nhierarchy of the worlds, try \"/vis/drawTree [worlds]\" or one of the"
2807 "\ndriver/browser combinations that have the required functionality, e.g., HepRep.");
2809 (
"If clip-volume-type is specified, the subsequent parameters are used to"
2810 "\nto define a clipping volume. For example,"
2811 "\n\"/vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1\" will draw the world"
2812 "\nwith the positive octant cut away. (If the Boolean Processor issues"
2813 "\nwarnings try replacing 0 by 0.000000001 or something.)");
2815 (
"If clip-volume-type is prepended with '-', the clip-volume is subtracted"
2816 "\n(cutaway). (This is the default if there is no prepended character.)"
2817 "\nIf '*' is prepended, the intersection of the physical-volume and the"
2818 "\nclip-volume is made. (You can make a section/DCUT with a thin box, for"
2821 (
"For \"box\", the parameters are xmin,xmax,ymin,ymax,zmin,zmax."
2822 "\nOnly \"box\" is programmed at present.");
2824 parameter =
new G4UIparameter (
"physical-volume-name",
's', omitable =
true);
2825 parameter -> SetDefaultValue (
"world");
2827 parameter =
new G4UIparameter (
"copy-no",
'i', omitable =
true);
2828 parameter -> SetGuidance
2829 (
"If negative, matches any copy no. First name match is taken.");
2830 parameter -> SetDefaultValue (-1);
2832 parameter =
new G4UIparameter (
"depth-of-descent",
'i', omitable =
true);
2833 parameter -> SetGuidance
2834 (
"Depth of descent of geometry hierarchy. Default = unlimited depth.");
2837 parameter =
new G4UIparameter (
"clip-volume-type",
's', omitable =
true);
2838 parameter -> SetParameterCandidates(
"none box -box *box");
2839 parameter -> SetDefaultValue (
"none");
2840 parameter -> SetGuidance(
"[-|*]type. See general guidance.");
2842 parameter =
new G4UIparameter (
"parameter-unit",
's', omitable =
true);
2843 parameter -> SetDefaultValue (
"m");
2845 parameter =
new G4UIparameter (
"parameter-1",
'd', omitable =
true);
2846 parameter -> SetDefaultValue (0.);
2848 parameter =
new G4UIparameter (
"parameter-2",
'd', omitable =
true);
2849 parameter -> SetDefaultValue (0.);
2851 parameter =
new G4UIparameter (
"parameter-3",
'd', omitable =
true);
2852 parameter -> SetDefaultValue (0.);
2854 parameter =
new G4UIparameter (
"parameter-4",
'd', omitable =
true);
2855 parameter -> SetDefaultValue (0.);
2857 parameter =
new G4UIparameter (
"parameter-5",
'd', omitable =
true);
2858 parameter -> SetDefaultValue (0.);
2860 parameter =
new G4UIparameter (
"parameter-6",
'd', omitable =
true);
2861 parameter -> SetDefaultValue (0.);
2870 return "world 0 -1";
2882 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2888 G4int copyNo, requestedDepthOfDescent;
2889 G4double param1, param2, param3, param4, param5, param6;
2890 std::istringstream is (newValue);
2891 is >> name >> copyNo >> requestedDepthOfDescent
2892 >> clipVolumeType >> parameterUnit
2893 >> param1 >> param2 >> param3 >> param4 >> param5 >> param6;
2896 if (clipVolumeType[
size_t(0)] ==
'-') {
2897 clipVolumeType = clipVolumeType.substr(1);
2898 }
else if (clipVolumeType[
size_t(0)] ==
'*') {
2900 clipVolumeType = clipVolumeType.substr(1);
2903 param1 *= unit; param2 *= unit; param3 *= unit;
2904 param4 *= unit; param5 *= unit; param6 *= unit;
2909 size_t nWorlds = transportationManager->
GetNoWorlds();
2912 static G4bool warned =
false;
2913 if (!warned && name !=
"worlds") {
2915 "WARNING: Parallel worlds in operation. To visualise, specify"
2916 "\n \"worlds\" or the parallel world volume or sub-volume name"
2917 "\n and control visibility with /vis/geometry."
2919 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2921 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2922 G4cout <<
" World " << i <<
": " << (*iterWorld)->GetName()
2936 "ERROR: G4VisCommandSceneAddVolume::SetNewValue:"
2937 "\n No world. Maybe the geometry has not yet been defined."
2938 "\n Try \"/run/initialize\""
2944 std::vector<G4PhysicalVolumeModel*> models;
2945 std::vector<G4VPhysicalVolume*> foundVolumes;
2948 typedef std::vector<PVNodeID>
PVPath;
2949 PVPath foundFullPVPath;
2950 std::vector<G4int> foundDepths;
2951 std::vector<G4Transform3D> transformations;
2953 if (name ==
"world") {
2957 foundVolumes.push_back(world);
2958 foundDepths.push_back(0);
2961 }
else if (name ==
"worlds") {
2966 "WARNING: G4VisCommandSceneAddVolume::SetNewValue:"
2967 "\n Parallel worlds requested but none exist."
2968 "\n Just adding material world."
2972 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2974 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2977 foundVolumes.push_back(*iterWorld);
2978 foundDepths.push_back(0);
2984 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2986 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2994 foundWorld = *iterWorld;
2995 foundVolumes.push_back(foundVolume);
3003 if (foundVolumes.size()) {
3004 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
3006 (foundVolumes[i], requestedDepthOfDescent, transformations[i]);
3007 foundFullPVPath.pop_back();
3009 models.push_back(foundPVModel);
3013 G4cerr <<
"ERROR: Volume \"" << name <<
"\"";
3015 G4cerr <<
", copy no. " << copyNo <<
",";
3023 if (clipVolumeType ==
"box") {
3024 const G4double dX = (param2 - param1) / 2.;
3025 const G4double dY = (param4 - param3) / 2.;
3026 const G4double dZ = (param6 - param5) / 2.;
3027 const G4double x0 = (param2 + param1) / 2.;
3028 const G4double y0 = (param4 + param3) / 2.;
3032 (
"_displaced_clipping_box",
3033 new G4Box(
"_clipping_box",dX,dY,dZ),
3035 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
3036 models[i]->SetClippingSolid(clippingSolid);
3037 models[i]->SetClippingMode(clippingMode);
3041 const G4String& currentSceneName = pScene -> GetName ();
3043 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
3044 G4bool successful = pScene -> AddRunDurationModel (models[i], warn);
3048 G4cout <<
"First occurrence of \""
3049 << foundVolumes[i] -> GetName ()
3052 G4cout <<
", copy no. " << copyNo <<
",";
3057 G4cout <<
"at depth " << foundDepths[i]
3058 <<
",\n with a requested depth of further descent of ";
3059 if (requestedDepthOfDescent < 0) {
3060 G4cout <<
"<0 (unlimited)";
3063 G4cout << requestedDepthOfDescent;
3065 G4cout <<
",\n has been added to scene \"" << currentSceneName <<
"\"."
static G4double ValueOf(const char *unitName)
G4VisCommandSceneAddArrow()
G4VisCommandSceneAddUserAction()
void SetNewValue(G4UIcommand *command, G4String newValue)
static G4MTRunManager * GetMasterRunManager()
void SetGuidance(const char *aGuidance)
static G4RunManager * GetRunManager()
const G4Run * GetCurrentRun() const
virtual ~G4VisCommandSceneAddLine()
virtual ~G4VisCommandSceneAddMagneticField()
BasicVector3D< T > & rotateZ(T a)
void SetNewValue(G4UIcommand *command, G4String newValue)
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddScale()
CLHEP::Hep3Vector G4ThreeVector
virtual ~G4VisCommandSceneAddExtent()
G4String GetCurrentValue(G4UIcommand *command)
void DescribeYourselfTo(G4VGraphicsScene &)
G4Polyhedron * CreatePolyhedron() const
G4String GetCurrentValue(G4UIcommand *command)
void SetGlobalDescription(const G4String &)
Float_t y1[n_points_granero]
virtual ~G4VisCommandSceneAddText()
void SetGlobalTag(const G4String &)
const std::vector< UserVisAction > & GetEndOfRunUserVisActions() const
void SetExtent(const G4VisExtent &)
virtual ~G4VisCommandSceneAddFrame()
virtual ~G4VisCommandSceneAddLogo()
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandSceneAddGPS()
G4int ApplyCommand(const char *aCommand)
Float_t x1[n_points_granero]
G4VisCommandSceneAddDigis()
BasicVector3D< T > unit() const
G4VisCommandSceneAddHits()
virtual void EndPrimitives()=0
G4int GetFoundDepth() const
void SetType(const G4String &)
G4VisCommandSceneAddExtent()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VPhysicalVolume * GetFoundVolume() const
void SetTransformation(const G4Transform3D &)
G4String GetCurrentValue(G4UIcommand *command)
const G4ModelingParameters * GetModelingParameters() const
G4VisCommandSceneAddLogicalVolume()
const G4Vector3D & GetUpVector() const
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
G4String GetCurrentValue(G4UIcommand *command)
virtual void EndPrimitives2D()=0
G4String GetCurrentValue(G4UIcommand *command)
static G4bool ConvertToBool(const char *st)
G4VisCommandSceneAddPSHits()
G4VisCommandSceneAddArrow2D()
const G4String & GetGlobalDescription() const
const G4ViewParameters & GetViewParameters() const
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandSceneAddLine()
static G4double fCurrentLineWidth
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandSceneAddText2D()
void SetGuidance(const char *theGuidance)
G4String GetCurrentValue(G4UIcommand *command)
void SetVerboseLevel(G4int val)
G4Scene * GetCurrentScene() const
static G4UImanager * GetUIpointer()
virtual ~G4VisCommandSceneAddArrow()
Line(G4double x1, G4double y1, G4double z1, G4double x2, G4double y2, G4double z2, G4double width, const G4Colour &colour)
void UpdateVisManagerScene(const G4String &sceneName="")
virtual void BeginPrimitives(const G4Transform3D &objectTransformation=G4Transform3D())=0
void SetModelingParameters(const G4ModelingParameters *)
Float_t y2[n_points_geant4]
void SetNewValue(G4UIcommand *command, G4String newValue)
void ConvertToColour(G4Colour &colour, const G4String &redOrString, G4double green, G4double blue, G4double opacity)
void SetParameter(G4UIparameter *const newParameter)
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddLogo2D()
const G4Vector3D & GetViewpointDirection() const
void SetScreenSize(G4double)
void SetDefaultValue(const char *theDefaultValue)
const G4VisExtent & GetExtent() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4VisCommandSceneAddEventID()
static const G4String & GetGuidanceString()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
void SetBaseFullPVPath(const std::vector< G4PhysicalVolumeNodeID > &baseFullPVPath)
Line2D(G4double x1, G4double y1, G4double x2, G4double y2, G4double width, const G4Colour &colour)
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
void SetNewValue(G4UIcommand *command, G4String newValue)
static constexpr double deg
G4VisCommandSceneAddLogo()
void SetNewValue(G4UIcommand *command, G4String newValue)
std::vector< PVNodeID > PVPath
G4VViewer * GetCurrentViewer() const
virtual ~G4VisCommandSceneAddVolume()
void AddVisAction(const G4String &name, G4VUserVisAction *, G4Scene *, ActionType, G4VisManager::Verbosity)
G4VisCommandSceneAddTrajectories()
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandSceneAddLogicalVolume()
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
static constexpr double halfpi
static Verbosity GetVerbosity()
Arrow2D(G4double x1, G4double y1, G4double x2, G4double y2, G4double width, const G4Colour &colour)
static constexpr double rad
virtual ~G4VisCommandSceneAddScale()
virtual ~G4VisCommandSceneAddLogo2D()
G4VisCommandSceneAddVolume()
G4Logo(G4double height, const G4VisAttributes &)
size_t GetNoWorlds() const
virtual ~G4VisCommandSceneAddArrow2D()
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
const G4String & ConvertToColourGuidance()
G4GLOB_DLL std::ostream G4cerr
virtual void AddPrimitive(const G4Polyline &)=0
virtual ~G4VisCommandSceneAddEventID()
HepGeom::Vector3D< G4double > G4Vector3D
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4int GetNumberOfEventToBeProcessed() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
static G4Colour fCurrentColour
virtual ~G4VisCommandSceneAddDigis()
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
static G4TransportationManager * GetTransportationManager()
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandSceneAddLine2D()
void SetForceSolid(G4bool=true)
void SetOffset(double dx, double dy)
const std::vector< UserVisAction > & GetEndOfEventUserVisActions() const
void SetNewValue(G4UIcommand *command, G4String newValue)
const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > & GetFoundFullPVPath() const
G4VisCommandSceneAddAxes()
G4VisCommandSceneAddMagneticField()
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddText()
G4bool IsMultithreadedApplication()
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4ApplicationState GetCurrentState() const
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
const std::vector< UserVisAction > & GetRunDurationUserVisActions() const
G4double GetExtentRadius() const
G4int GetVerboseLevel() const
G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandSceneAddDate()
const std::vector< const G4Event * > * GetEventVector() const
G4String GetCurrentValue(G4UIcommand *command)
const G4Event * GetEvent() const
G4double StoD(G4String s)
virtual ~G4VisCommandSceneAddAxes()
HepRotation & rotateZ(double delta)
G4GLOB_DLL std::ostream G4cout
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
static G4Text::Layout fCurrentTextLayout
virtual ~G4VisCommandSceneAddPSHits()
void SetLineWidth(G4double)
static void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
void SetNewValue(G4UIcommand *command, G4String newValue)
const G4VisExtent & GetExtent() const
void SetColour(const G4Colour &)
virtual ~G4VisCommandSceneAddDate()
static G4int fCurrentArrow3DLineSegmentsPerCircle
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneAddFrame()
static G4Colour fCurrentTextColour
static constexpr double pi
virtual ~G4VisCommandSceneAddGPS()
static G4double fCurrentTextSize
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
const G4Transform3D & GetFoundTransformation() const
virtual ~G4VisCommandSceneAddUserAction()
Float_t x2[n_points_geant4]
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandSceneAddHits()
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation=G4Transform3D())=0
static G4VisManager * fpVisManager
G4UIcmdWithoutParameter * fpCommand
const XML_Char XML_Content * model
HepGeom::Point3D< G4double > G4Point3D
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandSceneAddTrajectories()
Extent(G4double xmin, G4double xmax, G4double ymin, G4double ymax, G4double zmin, G4double zmax)
G4VisCommandSceneAddText2D()
static G4LogicalVolumeStore * GetInstance()
void SetVisAttributes(const G4VisAttributes *)
const G4String & GetName() const
const std::map< G4VUserVisAction *, G4VisExtent > & GetUserVisActionExtents() const
G4VisCommandSceneAddLine2D()
static G4StateManager * GetStateManager()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4UIcmdWithoutParameter * fpCommand
void SetNewValue(G4UIcommand *command, G4String newValue)