81 #ifdef G4MULTITHREADED
89 #ifdef G4VIS_USE_STD11
101 fInitialised (
false),
102 fpGraphicsSystem (0),
106 fpStateDependent (0),
107 fEventRefreshing (
false),
108 fTransientsDrawnThisRun (
false),
109 fTransientsDrawnThisEvent (
false),
110 fNoOfEventsDrawnThisRun (0),
112 fEventKeepingSuspended (
false),
113 fKeptLastEvent (
false),
114 fDrawEventOnlyIfToBeKept (
false),
115 fpRequestedEvent (0),
116 fReviewingKeptEvents (
false),
117 fAbortReviewKeptEvents (
false),
118 fIsDrawGroup (
false),
119 fDrawGroupNestingDepth (0),
120 fIgnoreStateChanges (
false)
121 #ifdef G4MULTITHREADED
122 , fMaxEventQueueSize (100)
123 , fWaitOnEventQueueFull (
true)
133 (
"Simple graded message scheme - digit or string (1st character defines):");
135 (
" 0) quiet, // Nothing is printed.");
137 (
" 1) startup, // Startup and endup messages are printed...");
139 (
" 2) errors, // ...and errors...");
141 (
" 3) warnings, // ...and warnings...");
143 (
" 4) confirmations, // ...and confirming messages...");
145 (
" 5) parameters, // ...and parameters of scenes and views...");
147 (
" 6) all // ...and everything available.");
151 (
"G4VisManager::G4VisManager",
153 "Attempt to Construct more than one VisManager");
165 <<
"Visualization Manager instantiating with verbosity \""
198 directory -> SetGuidance (
"Visualization commands.");
228 G4cout <<
"Visualization Manager deleting..." <<
G4endl;
246 (
"G4VisManager::GetInstance",
255 G4cout <<
"WARNING: G4VisManager::Initialise: already initialised."
261 G4cout <<
"Visualization Manager initialising..." <<
G4endl;
266 "\nYou have instantiated your own Visualization Manager, inheriting"
267 "\n G4VisManager and implementing RegisterGraphicsSystems(), in which"
268 "\n you should, normally, instantiate drivers which do not need"
269 "\n external packages or libraries, and, optionally, drivers under"
270 "\n control of environment variables."
271 "\n Also you should implement RegisterModelFactories()."
272 "\n See visualization/management/include/G4VisExecutive.hh/icc, for example."
273 "\n In your main() you will have something like:"
274 "\n #ifdef G4VIS_USE"
275 "\n G4VisManager* visManager = new G4VisExecutive;"
276 "\n visManager -> SetVerboseLevel (Verbose);"
277 "\n visManager -> Initialize ();"
279 "\n (Don't forget to delete visManager;)"
292 "\nYou have successfully registered the following graphics systems."
302 directory -> SetGuidance (
"Modeling commands.");
304 directory =
new G4UIdirectory (
"/vis/modeling/trajectories/");
305 directory -> SetGuidance (
"Trajectory model commands.");
307 directory =
new G4UIdirectory (
"/vis/modeling/trajectories/create/");
308 directory -> SetGuidance (
"Create trajectory models and messengers.");
313 directory -> SetGuidance (
"Filtering commands.");
315 directory =
new G4UIdirectory (
"/vis/filtering/trajectories/");
316 directory -> SetGuidance (
"Trajectory filtering commands.");
318 directory =
new G4UIdirectory (
"/vis/filtering/trajectories/create/");
319 directory -> SetGuidance (
"Create trajectory filters and messengers.");
322 directory -> SetGuidance (
"Hit filtering commands.");
324 directory =
new G4UIdirectory (
"/vis/filtering/hits/create/");
325 directory -> SetGuidance (
"Create hit filters and messengers.");
328 directory -> SetGuidance (
"Digi filtering commands.");
330 directory =
new G4UIdirectory (
"/vis/filtering/digi/create/");
331 directory -> SetGuidance (
"Create digi filters and messengers.");
344 "\nYou have successfully registered the following model factories."
359 "Some /vis commands (optionally) take a string to specify colour."
360 "\n\"/vis/list\" to see available colours."
376 #define TOOLS_COLORS_STAT(name,r,g,b) \
377 G4Colour::AddToMap(#name, G4Colour(r,g,b));
458 #undef TOOLS_COLORS_STAT
469 directory -> SetGuidance(
"Operations on vis attributes of Geant4 geometry.");
475 directory -> SetGuidance(
"Set vis attributes of Geant4 geometry.");
487 #ifdef G4MULTITHREADED
489 directory -> SetGuidance(
"Commands unique to multithreading mode.");
496 directory -> SetGuidance
497 (
"Set quantities for use in future commands where appropriate.");
510 directory -> SetGuidance (
"Operations on Geant4 scenes.");
522 directory -> SetGuidance (
"Add model to current scene.");
550 directory -> SetGuidance (
"Operations on Geant4 scene handlers.");
558 directory -> SetGuidance (
"Operations on touchables.");
563 directory -> SetGuidance (
"Set vis attributes of current touchable.");
568 directory -> SetGuidance (
"Operations on Geant4 viewers.");
596 directory -> SetGuidance(
"Set default values for future viewers.");
602 directory -> SetGuidance (
"Set view parameters of current viewer.");
652 G4cout <<
"G4VisManager::Enable: visualization enabled." <<
G4endl;
655 G4int nKeptEvents = 0;
659 "There are " << nKeptEvents <<
" kept events."
660 "\n \"/vis/reviewKeptEvents\" to review them one by one."
661 "\n \"/vis/viewer/flush\" or \"/vis/viewer/rebuild\" to see them accumulated."
668 "G4VisManager::Enable: WARNING: visualization remains disabled for"
669 "\n above reasons. Rectifying with valid vis commands will"
670 "\n automatically enable."
680 "G4VisManager::Disable: visualization disabled."
681 "\n The pointer returned by GetConcreteInstance will be zero."
682 "\n Note that it will become enabled after some valid vis commands."
686 G4int currentTrajectoryType =
688 if (currentTrajectoryType > 0) {
690 "You may wish to disable trajectory production too:"
691 "\n \"/tracking/storeTrajectory 0\""
692 "\nbut don't forget to re-enable with"
694 "\n \"/tracking/storeTrajectory " << currentTrajectoryType <<
'\"'
704 G4cout <<
"G4VisManager::GetAvailableGraphicsSystems: WARNING: no"
705 "\n graphics system available!"
706 "\n 1) Did you have environment variables G4VIS_BUILD_xxxx_DRIVER set"
707 "\n when you compiled/built the visualization code?"
708 "\n 2) Did you instantiate your own Visualization Manager and forget"
709 "\n to implement RegisterGraphicsSystems correctly?"
710 "\n 3) You can register your own graphics system, e.g.,"
711 "\n visManager->RegisterGraphicsSystem(new MyGraphicsSystem);)"
712 "\n after instantiating your vis manager and before"
713 "\n visManager->Initialize()."
725 G4cout <<
"G4VisManager::RegisterGraphicsSystem: "
726 << pSystem -> GetName ();
727 if (pSystem -> GetNickname () !=
"") {
728 G4cout <<
" (" << pSystem -> GetNickname () <<
")";
735 G4cout <<
"G4VisManager::RegisterGraphicsSystem: null pointer!"
755 G4cout<<
"G4VisManager: Using G4TrajectoryDrawByCharge as fallback trajectory model."<<
G4endl;
756 G4cout<<
"See commands in /vis/modeling/trajectories/ for other options."<<
G4endl;
817 #ifdef G4MULTITHREADED
823 (
"G4VisManager::BeginDraw",
825 "Nesting detected. It is illegal to nest Begin/EndDraw."
838 #ifdef G4MULTITHREADED
854 #ifdef G4MULTITHREADED
860 (
"G4VisManager::BeginDraw2D",
862 "Nesting detected. It is illegal to nest Begin/EndDraw2D."
875 #ifdef G4MULTITHREADED
891 #ifdef G4MULTITHREADED
895 if (objectTransform != fpSceneHandler->GetObjectTransformation()) {
897 (
"G4VSceneHandler::DrawT",
899 "Different transform detected in Begin/EndDraw group.");
901 fpSceneHandler -> AddPrimitive (graphics_primitive);
903 if (IsValidView ()) {
904 ClearTransientStoreIfMarked();
905 fpSceneHandler -> BeginPrimitives (objectTransform);
906 fpSceneHandler -> AddPrimitive (graphics_primitive);
907 fpSceneHandler -> EndPrimitives ();
914 #ifdef G4MULTITHREADED
918 if (objectTransform != fpSceneHandler->GetObjectTransformation()) {
920 (
"G4VSceneHandler::DrawT",
922 "Different transform detected in Begin/EndDraw2D group.");
924 fpSceneHandler -> AddPrimitive (graphics_primitive);
926 if (IsValidView ()) {
927 ClearTransientStoreIfMarked();
928 fpSceneHandler -> BeginPrimitives2D (objectTransform);
929 fpSceneHandler -> AddPrimitive (graphics_primitive);
930 fpSceneHandler -> EndPrimitives2D ();
938 DrawT (circle, objectTransform);
944 DrawT (polyhedron, objectTransform);
950 DrawT (line, objectTransform);
956 DrawT (polymarker, objectTransform);
962 DrawT (scale, objectTransform);
968 DrawT (square, objectTransform);
974 DrawT (text, objectTransform);
980 DrawT2D (circle, objectTransform);
986 DrawT2D (polyhedron, objectTransform);
992 DrawT2D (line, objectTransform);
998 DrawT2D (polymarker, objectTransform);
1004 DrawT2D (square, objectTransform);
1010 DrawT2D (text, objectTransform);
1014 #ifdef G4MULTITHREADED
1028 #ifdef G4MULTITHREADED
1042 #ifdef G4MULTITHREADED
1049 #ifdef G4MULTITHREADED
1080 #ifdef G4MULTITHREADED
1085 Draw (*pSol, attribs, objectTransform);
1091 #ifdef G4MULTITHREADED
1111 #ifdef G4MULTITHREADED
1127 G4VSolid* pSol = pLV -> GetSolid ();
1128 Draw (*pSol, attribs, objectTransform);
1136 if (pSceneHandler) {
1142 G4cout <<
"ERROR in G4VisManager::CreateSceneHandler during "
1144 <<
" scene handler creation.\n No action taken."
1156 if (!fInitialised) Initialise ();
1158 if (!fpSceneHandler) {
1159 PrintInvalidPointers ();
1163 G4VViewer*
p = fpGraphicsSystem -> CreateViewer (*fpSceneHandler, name);
1166 if (fVerbosity >= errors) {
1167 G4cerr <<
"ERROR in G4VisManager::CreateViewer: null pointer during "
1168 << fpGraphicsSystem -> GetName ()
1169 <<
" viewer creation.\n No action taken."
1175 if (p -> GetViewId() < 0) {
1176 if (fVerbosity >= errors) {
1177 G4cerr <<
"ERROR in G4VisManager::CreateViewer during "
1178 << fpGraphicsSystem -> GetName ()
1179 <<
" viewer instantiation.\n No action taken."
1190 p -> SetViewParameters(initialvp);
1192 if (p -> GetViewId() < 0) {
1193 if (fVerbosity >= errors) {
1194 G4cerr <<
"ERROR in G4VisManager::CreateViewer during "
1195 << fpGraphicsSystem -> GetName ()
1196 <<
" viewer initialisation.\n No action taken."
1203 fpSceneHandler -> AddViewerToList (fpViewer);
1204 fpSceneHandler -> SetCurrentViewer (fpViewer);
1205 if (fVerbosity >= confirmations) {
1206 G4cout <<
"G4VisManager::CreateViewer: new viewer created."
1216 static G4bool warned =
false;
1217 if (fVerbosity >= confirmations) {
1220 "NOTE: objects with visibility flag set to \"false\""
1221 " will not be drawn!"
1222 "\n \"/vis/viewer/set/culling global false\" to Draw such objects."
1223 "\n Also see other \"/vis/viewer/set\" commands."
1230 static G4bool warned =
false;
1231 if (fVerbosity >= warnings) {
1234 "WARNING: covered objects in solid mode will not be rendered!"
1235 "\n \"/vis/viewer/set/culling coveredDaughters false\" to reverse this."
1236 "\n Also see other \"/vis/viewer/set\" commands."
1246 G4cout <<
"G4VisManager::GeometryHasChanged() called." <<
G4endl;
1252 -> GetNavigatorForTracking () -> GetWorldVolume ();
1255 G4cout <<
"WARNING: There is no world volume!" <<
G4endl;
1261 G4int iScene, nScenes = sceneList.size ();
1262 for (iScene = 0; iScene < nScenes; iScene++) {
1263 G4Scene* pScene = sceneList [iScene];
1264 std::vector<G4Scene::Model>& modelList = pScene -> SetRunDurationModelList ();
1265 if (modelList.size ()) {
1268 modelInvalid =
false;
1269 std::vector<G4Scene::Model>::iterator iterModel;
1270 for (iterModel = modelList.begin();
1271 iterModel != modelList.end();
1277 G4cout <<
"WARNING: Model \""
1278 << iterModel->fpModel->GetGlobalDescription ()
1280 "\" is no longer valid - being removed\n from scene \""
1281 << pScene -> GetName () <<
"\""
1284 modelList.erase (iterModel);
1288 }
while (modelInvalid);
1290 if (modelList.size () == 0) {
1292 G4cout <<
"WARNING: No models left in this scene \""
1293 << pScene -> GetName ()
1301 ApplyCommand (
G4String(
"/vis/scene/notifyHandlers " + pScene->
GetName()));
1307 if (
fpScene &&
fpScene -> GetRunDurationModelList ().size () == 0) {
1309 G4cout <<
"WARNING: The current scene \""
1311 <<
"\" has no run duration models."
1312 <<
"\n Use \"/vis/scene/add/volume\" or create a new scene."
1327 G4cout <<
"G4VisManager::NotifyHandler() called." <<
G4endl;
1332 G4int iScene, nScenes = sceneList.size ();
1333 for (iScene = 0; iScene < nScenes; iScene++) {
1334 G4Scene* pScene = sceneList [iScene];
1335 std::vector<G4Scene::Model>& modelList = pScene -> SetRunDurationModelList ();
1337 if (modelList.size ()) {
1340 ApplyCommand (
G4String(
"/vis/scene/notifyHandlers " + pScene->
GetName()));
1345 if (
fpScene &&
fpScene -> GetRunDurationModelList ().size () == 0) {
1347 G4cout <<
"WARNING: The current scene \""
1349 <<
"\" has no run duration models."
1350 <<
"\n Use \"/vis/scene/add/volume\" or create a new scene."
1396 assert (0 != trajectoryModel);
1399 trajectoryModel->
Draw(trajectory, visible);
1406 if (fVerbosity >= warnings) {
1408 "WARNING: SetUserAction is deprecated. Use RegisterRunDurationUserVisAction."
1411 RegisterRunDurationUserVisAction(
"SetUserAction",pVisAction,extent);
1418 fRunDurationUserVisActions.push_back(
UserVisAction(name,pVisAction));
1420 fUserVisActionExtents[pVisAction] = extent;
1422 if (fVerbosity >= warnings) {
1424 "WARNING: No extent set for user vis action \"" << name <<
"\"."
1428 if (fVerbosity >= confirmations) {
1430 <<
"Run duration user vis action \"" << name <<
"\" registered"
1439 fEndOfEventUserVisActions.push_back(
UserVisAction(name,pVisAction));
1441 fUserVisActionExtents[pVisAction] = extent;
1443 if (fVerbosity >= warnings) {
1445 "WARNING: No extent set for user vis action \"" << name <<
"\"."
1449 if (fVerbosity >= confirmations) {
1451 <<
"End of event user vis action \"" << name <<
"\" registered"
1460 fEndOfRunUserVisActions.push_back(
UserVisAction(name,pVisAction));
1462 fUserVisActionExtents[pVisAction] = extent;
1464 if (fVerbosity >= warnings) {
1466 "WARNING: No extent set for user vis action \"" << name <<
"\"."
1470 if (fVerbosity >= confirmations) {
1472 <<
"End of run user vis action \"" << name <<
"\" registered"
1489 G4cout <<
"G4VisManager::SetCurrentGraphicsSystem: system now "
1490 << pSystem -> GetName () <<
G4endl;
1497 G4int nSH = sceneHandlerList.size ();
1499 for (iSH = nSH - 1; iSH >= 0; iSH--) {
1500 if (sceneHandlerList [iSH] -> GetGraphicsSystem () == pSystem)
break;
1505 G4cout <<
" Scene Handler now "
1511 G4cout <<
" Scene now \""
1516 if (viewerList.size ()) {
1536 G4cout <<
"G4VisManager::SetCurrentSceneHandler: scene handler now \""
1537 << pSceneHandler -> GetName () <<
"\"" <<
G4endl;
1542 G4cout <<
" Scene now \""
1549 G4cout <<
" Graphics system now \""
1554 G4int nViewers = viewerList.size ();
1557 for (iViewer = 0; iViewer < nViewers; iViewer++) {
1558 if (
fpViewer == viewerList [iViewer])
break;
1560 if (iViewer >= nViewers) {
1570 "WARNING: Problem setting scene handler - please report circumstances."
1579 "WARNING: No viewers for this scene handler - please create one."
1588 G4cout <<
"G4VisManager::SetCurrentViewer: viewer now "
1589 << pViewer -> GetName ()
1596 "WARNING: No scene handler for this viewer - please create one."
1608 "WARNING: Problem setting viewer - please report circumstances."
1616 G4cout <<
"Current available graphics systems are:\n";
1619 const G4String& name = gs->GetName();
1620 const std::vector<G4String>& nicknames = gs->GetNicknames();
1624 for (
size_t i = 0; i < nicknames.size(); ++i) {
1638 G4cout <<
"\n NONE!!! None registered - yet! Mmmmm!" <<
G4endl;
1647 const std::vector<G4VModelFactory<G4VTrajectoryModel>*>& factoryList =
1649 if (factoryList.empty())
G4cout <<
" None" << G4endl;
1651 std::vector<G4VModelFactory<G4VTrajectoryModel>*>::const_iterator i;
1652 for (i = factoryList.begin(); i != factoryList.end(); ++i)
1657 const std::map<G4String, G4VTrajectoryModel*>& modelMap =
1659 if (!modelMap.empty()) {
1661 std::map<G4String, G4VTrajectoryModel*>::const_iterator i;
1662 for (i = modelMap.begin(); i != modelMap.end(); ++i) {
1663 G4cout <<
" " << i->second->Name();
1664 if (i->second == listManager->
Current())
G4cout <<
" (Current)";
1676 const std::vector<G4VModelFactory<G4VFilter<G4VTrajectory> >*>&
1678 if (factoryList.empty())
G4cout <<
" None" << G4endl;
1680 std::vector<G4VModelFactory<G4VFilter<G4VTrajectory> >*>::const_iterator i;
1681 for (i = factoryList.begin(); i != factoryList.end(); ++i)
1684 const std::vector<G4VFilter<G4VTrajectory>*>&
1686 if (!filterList.empty()) {
1688 std::vector<G4VFilter<G4VTrajectory>*>::const_iterator i;
1689 for (i = filterList.begin(); i != filterList.end(); ++i) {
1700 "You have successfully registered the following user vis actions."
1702 G4cout <<
"Run Duration User Vis Actions:";
1712 G4cout <<
"End of Event User Vis Actions:";
1722 G4cout <<
"End of Run User Vis Actions:";
1735 "Some /vis commands (optionally) take a string to specify colour."
1736 "\nAvailable colours:\n ";
1738 for (std::map<G4String, G4Colour>::const_iterator i = map.begin();
1741 if (++i != map.end())
G4cout <<
", ";
1748 G4cerr <<
"ERROR: G4VisManager::PrintInvalidPointers:";
1750 G4cerr <<
"\n null graphics system pointer.";
1757 "\n Null scene pointer. Use \"/vis/drawVolume\" or"
1758 " \"/vis/scene/create\".";
1761 "\n Null scene handler pointer. Use \"/vis/open\" or"
1762 " \"/vis/sceneHandler/create\".";
1765 "\n Null viewer pointer. Use \"/vis/viewer/create\".";
1771 #ifdef G4MULTITHREADED
1774 G4bool mtRunInProgress =
false;
1775 std::deque<const G4Event*> mtVisEventQueue;
1784 if (!pSceneHandler)
return 0;
1786 if (!pScene)
return 0;
1788 if (!pViewer)
return 0;
1803 pViewer->SwitchToVisSubThread();
1808 G4int eventQueueSize = mtVisEventQueue.size();
1812 while (eventQueueSize) {
1815 const G4Event*
event = mtVisEventQueue.front();
1855 mtVisEventQueue.pop_front();
1856 event->PostProcessingFinished();
1857 eventQueueSize = mtVisEventQueue.size();
1863 G4int runInProgress = mtRunInProgress;
1865 if (!runInProgress) {
1872 #ifdef G4VIS_USE_STD11
1873 std::this_thread::sleep_for(std::chrono::milliseconds(100));
1880 pViewer->DoneWithVisSubThread();
1881 pViewer->MovingToMasterThread();
1899 #ifdef G4MULTITHREADED
1906 #ifdef G4MULTITHREADED
1914 if (nEventsToBeProcessed == 0)
return;
1929 #ifdef G4MULTITHREADED
1943 mtRunInProgress =
true;
1969 #ifndef G4MULTITHREADED
1991 #ifdef G4MULTITHREADED
1998 #ifdef G4MULTITHREADED
2005 if (!currentRun)
return;
2010 if (!currentEvent)
return;
2015 if (!currentEvent->
ToBeKept())
return;
2020 #ifdef G4MULTITHREADED
2024 G4int eventQueueSize = mtVisEventQueue.size();
2028 G4bool eventQueueFull =
false;
2029 while (fMaxEventQueueSize > 0 && eventQueueSize >= fMaxEventQueueSize) {
2032 if (fWaitOnEventQueueFull) {
2033 static G4bool warned =
false;
2036 "WARNING: The number of events in the visualisation queue has exceeded"
2038 << fMaxEventQueueSize <<
2039 ".\n If, during a multithreaded run, the simulation gets ahead of the"
2040 "\n visualisation by more than this maximum, the simulation is delayed"
2041 "\n until the vis sub-thread has drawn a few more events and removed them"
2042 "\n from the queue. You may change this maximum number of events with"
2043 "\n \"/vis/multithreading/maxEventQueueSize <N>\", where N is the maximum"
2044 "\n number you wish to allow. N <= 0 means \"unlimited\"."
2045 "\n Alternatively you may choose to discard events for drawing by setting"
2046 "\n \"/vis/multithreading/actionOnEventQueueFull discard\"."
2047 "\n To avoid visualisation altogether: \"/vis/disable\"."
2048 "\n And maybe \"/tracking/storeTrajectories 0\"."
2054 #ifdef G4VIS_USE_STD11
2055 std::this_thread::sleep_for(std::chrono::milliseconds(100));
2061 static G4bool warned =
false;
2064 "WARNING: The number of events in the visualisation queue has exceeded"
2066 << fMaxEventQueueSize <<
2067 ".\n Some events have been discarded for drawing. You may change this"
2068 "\n behaviour with \"/vis/multithreading/actionOnEventQueueFull wait\"."
2069 "\n To avoid visualisation altogether: \"/vis/disable\"."
2070 "\n And maybe \"/tracking/storeTrajectories 0\"."
2074 eventQueueFull =
true;
2079 eventQueueSize = mtVisEventQueue.size();
2083 if (!eventQueueFull) {
2087 mtVisEventQueue.push_back(currentEvent);
2102 G4int nEventsToBeProcessed = 0;
2103 G4int nKeptEvents = 0;
2108 const std::vector<const G4Event*>* events = currentRun->
GetEventVector();
2109 if (events) nKeptEvents = events->size();
2129 if (eventID < nEventsToBeProcessed - 1) {
2136 if (nKeptEvents == 0) {
2155 if (maxNumberOfKeptEvents > 0 &&
2159 static G4bool warned =
false;
2163 "WARNING: G4VisManager::EndOfEvent: Automatic event keeping suspended."
2164 "\n The number of events exceeds the maximum, "
2165 << maxNumberOfKeptEvents <<
2166 ", that may be kept by\n the vis manager."
2172 }
else if (maxNumberOfKeptEvents != 0) {
2191 #ifdef G4MULTITHREADED
2199 #ifdef G4MULTITHREADED
2207 if (nEventsToBeProcessed == 0)
return;
2210 if (!currentRun)
return;
2212 #ifdef G4MULTITHREADED
2217 mtRunInProgress =
false;
2221 delete mtVisSubThread;
2226 #ifdef G4MULTITHREADED
2236 <<
"WARNING: Number of events drawn this run, "
2238 << noOfEventsRequested <<
2239 ".\n (This is because you requested \"/vis/multithreading/actionOnEventQueueFull discard\".)"
2246 G4int nKeptEvents = 0;
2247 const std::vector<const G4Event*>* events = currentRun->
GetEventVector();
2248 if (events) nKeptEvents = events->size();
2252 if (nKeptEvents == 1)
G4cout <<
" event has";
2253 else G4cout <<
" events have";
2254 G4cout <<
" been kept for refreshing and/or reviewing." <<
G4endl;
2258 G4cout <<
"No keep requests were";
2260 G4cout <<
"Only 1 keep request was";
2267 "\n \"/vis/reviewKeptEvents\" to review them one by one."
2268 "\n \"/vis/enable\", then \"/vis/viewer/flush\" or \"/vis/viewer/rebuild\" to see them accumulated."
2291 "WARNING: G4VisManager::EndOfRun: Automatic event keeping was suspended."
2292 "\n The number of events in the run exceeded the maximum, "
2294 ", that may be\n kept by the vis manager." <<
2295 "\n The number of events kept by the vis manager can be changed with"
2296 "\n \"/vis/scene/endOfEventAction accumulate <N>\", where N is the"
2297 "\n maximum number you wish to allow. N < 0 means \"unlimited\"."
2328 G4cout <<
"\"/vis/viewer/update\" to close file." <<
G4endl;
2358 (*i)->SetTransientsDrawnThisEvent(
false);
2359 (*i)->SetTransientsDrawnThisRun(
false);
2364 G4String viewerShortName (viewerName);
2365 viewerShortName = viewerShortName (0, viewerShortName.find (
' '));
2366 return viewerShortName.
strip ();
2372 size_t iHandler, iViewer;
2375 for (iHandler = 0; iHandler < nHandlers; iHandler++) {
2377 const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
2378 for (iViewer = 0; iViewer < viewerList.size (); iViewer++) {
2379 viewer = viewerList [iViewer];
2380 if (viewerShortName == viewer -> GetShortName ()) {
2387 if (found)
return viewer;
2395 switch (verbosity) {
2396 case quiet: rs =
"quiet (0)";
break;
2397 case startup: rs =
"startup (1)";
break;
2398 case errors: rs =
"errors (2)";
break;
2399 case warnings: rs =
"warnings (3)";
break;
2401 case parameters: rs =
"parameters (5)";
break;
2402 case all: rs =
"all (6)";
break;
2411 if (ss(0) ==
'q') verbosity =
quiet;
2412 else if (ss(0) ==
's') verbosity =
startup;
2413 else if (ss(0) ==
'e') verbosity =
errors;
2414 else if (ss(0) ==
'w') verbosity =
warnings;
2416 else if (ss(0) ==
'p') verbosity =
parameters;
2417 else if (ss(0) ==
'a') verbosity =
all;
2420 std::istringstream is(ss);
2423 G4cerr <<
"ERROR: G4VisManager::GetVerbosityValue: invalid verbosity \""
2424 << verbosityString <<
"\"";
2442 else if (intVerbosity >
all) verbosity =
all;
2443 else verbosity =
Verbosity(intVerbosity);
2463 static G4bool noGSPrinting =
true;
2468 noGSPrinting =
false;
2471 "WARNING: G4VisManager::IsValidView(): Attempt to draw when no graphics system"
2472 "\n has been instantiated. Use \"/vis/open\" or \"/vis/sceneHandler/create\"."
2473 "\n Alternatively, to avoid this message, suppress instantiation of vis"
2474 "\n manager (G4VisExecutive) and ensure drawing code is executed only if"
2475 "\n G4VVisManager::GetConcreteInstance() is non-zero."
2485 "ERROR: G4VisManager::IsValidView(): Current view is not valid."
2494 G4cerr <<
"ERROR: G4VisManager::IsValidView ():";
2497 "\n The current scene \""
2499 <<
"\" is not handled by"
2500 "\n the current scene handler \""
2503 "\n (it currently handles scene \""
2507 "\n (a) attach it to the scene handler with"
2508 "\n /vis/sceneHandler/attach "
2511 "\n (b) create a new scene handler with "
2512 "\n /vis/sceneHandler/create <graphics-system>,"
2513 "\n in which case it should pick up the the new scene."
2517 G4cout <<
"\n Scene handler \""
2519 <<
"\" has null scene pointer."
2520 "\n Attach a scene with /vis/sceneHandler/attach [<scene-name>]"
2528 if (viewerList.size () == 0) {
2531 "ERROR: G4VisManager::IsValidView (): the current scene handler\n \""
2533 <<
"\" has no viewers. Do /vis/viewer/create."
2543 if (!successful ||
fpScene -> IsEmpty ()) {
2545 G4cerr <<
"ERROR: G4VisManager::IsValidView ():";
2547 "\n Attempt at some drawing operation when scene is empty."
2548 "\n Maybe the geometry has not yet been defined."
2549 " Try /run/initialize."
2550 "\n Or use \"/vis/scene/add/extent\"."
2559 "WARNING: G4VisManager: the scene was empty, \"world\" has been"
2560 "\n added and the scene handlers notified.";
2572 G4cout<<
"G4VisManager: No model factories registered with G4VisManager."<<
G4endl;
2573 G4cout<<
"G4VisManager::RegisterModelFactories() should be overridden in derived"<<
G4endl;
2574 G4cout<<
"class. See G4VisExecutive for an example."<<
G4endl;
2578 #ifdef G4MULTITHREADED
2579 void G4VisManager::SetUpForAThread()