92   fEventRefreshing          (false),
 
   93   fTransientsDrawnThisRun   (false),
 
   94   fTransientsDrawnThisEvent (false),
 
   95   fEventKeepingSuspended    (false),
 
   96   fKeptLastEvent            (false),
 
   98   fAbortReviewKeptEvents    (false),
 
  100   fDrawGroupNestingDepth    (0)
 
  109     (
"Simple graded message scheme - digit or string (1st character defines):");
 
  111     (
"  0) quiet,         // Nothing is printed.");
 
  113     (
"  1) startup,       // Startup and endup messages are printed...");
 
  115     (
"  2) errors,        // ...and errors...");
 
  117     (
"  3) warnings,      // ...and warnings...");
 
  119     (
"  4) confirmations, // ...and confirming messages...");
 
  121     (
"  5) parameters,    // ...and parameters of scenes and views...");
 
  123     (
"  6) all            // ...and everything available.");
 
  127       (
"G4VisManager::G4VisManager",
 
  129        "Attempt to Construct more than one VisManager");
 
  141     << 
"Visualization Manager instantiating with verbosity \"" 
  174   directory -> SetGuidance (
"Visualization commands.");
 
  175   fDirectoryList.push_back (directory);
 
  189   for (i = 0; i < fSceneList.size (); ++i) {
 
  190     delete fSceneList[i];
 
  192   for (i = 0; i < fAvailableSceneHandlers.size (); ++i) {
 
  193   if (fAvailableSceneHandlers[i] != NULL) {
 
  194     delete fAvailableSceneHandlers[i];
 
  197   for (i = 0; i < fAvailableGraphicsSystems.size (); ++i) {
 
  198     if (fAvailableGraphicsSystems[i]) {
 
  199       delete fAvailableGraphicsSystems[i];
 
  204     G4cout << 
"Visualization Manager deleting..." << 
G4endl;
 
  206   for (i = 0; i < fMessengerList.size (); ++i) {
 
  207     delete fMessengerList[i];
 
  209   for (i = 0; i < fDirectoryList.size (); ++i) {
 
  210     delete fDirectoryList[i];
 
  213   delete fpDigiFilterMgr;
 
  214   delete fpHitFilterMgr;
 
  215   delete fpTrajFilterMgr;
 
  216   delete fpTrajDrawModelMgr;
 
  222       (
"G4VisManager::GetInstance",
 
  230   if (fInitialised && fVerbosity >= 
warnings) {
 
  231     G4cout << 
"WARNING: G4VisManager::Initialise: already initialised." 
  237     G4cout << 
"Visualization Manager initialising..." << 
G4endl;
 
  242       "\nYou have instantiated your own Visualization Manager, inheriting" 
  243       "\n  G4VisManager and implementing RegisterGraphicsSystems(), in which" 
  244       "\n  you should, normally, instantiate drivers which do not need" 
  245       "\n  external packages or libraries, and, optionally, drivers under" 
  246       "\n  control of environment variables." 
  247       "\n  Also you should implement RegisterModelFactories()." 
  248       "\n  See visualization/include/G4VisExecutive.hh/icc, for example." 
  249       "\n  In your main() you will have something like:" 
  250       "\n  #ifdef G4VIS_USE" 
  251       "\n    G4VisManager* visManager = new G4VisExecutive;" 
  252       "\n    visManager -> SetVerboseLevel (Verbose);" 
  253       "\n    visManager -> Initialize ();" 
  255       "\n  (Don't forget to delete visManager;)" 
  268       "\nYou have successfully registered the following graphics systems." 
  278   directory -> SetGuidance (
"Modeling commands.");
 
  279   fDirectoryList.push_back (directory);
 
  280   directory = 
new G4UIdirectory (
"/vis/modeling/trajectories/");
 
  281   directory -> SetGuidance (
"Trajectory model commands.");
 
  282   fDirectoryList.push_back (directory);
 
  283   directory = 
new G4UIdirectory (
"/vis/modeling/trajectories/create/");
 
  284   directory -> SetGuidance (
"Create trajectory models and messengers.");
 
  285   fDirectoryList.push_back (directory);
 
  289   directory -> SetGuidance (
"Filtering commands.");
 
  290   fDirectoryList.push_back (directory);
 
  291   directory = 
new G4UIdirectory (
"/vis/filtering/trajectories/");
 
  292   directory -> SetGuidance (
"Trajectory filtering commands.");
 
  293   fDirectoryList.push_back (directory);
 
  294   directory = 
new G4UIdirectory (
"/vis/filtering/trajectories/create/");
 
  295   directory -> SetGuidance (
"Create trajectory filters and messengers.");
 
  296   fDirectoryList.push_back (directory);
 
  298   directory -> SetGuidance (
"Hit filtering commands.");
 
  299   fDirectoryList.push_back (directory);
 
  300   directory = 
new G4UIdirectory (
"/vis/filtering/hits/create/");
 
  301   directory -> SetGuidance (
"Create hit filters and messengers.");
 
  302   fDirectoryList.push_back (directory);
 
  304   directory -> SetGuidance (
"Digi filtering commands.");
 
  305   fDirectoryList.push_back (directory);
 
  306   directory = 
new G4UIdirectory (
"/vis/filtering/digi/create/");
 
  307   directory -> SetGuidance (
"Create digi filters and messengers.");
 
  308   fDirectoryList.push_back (directory);
 
  320       "\nYou have successfully registered the following model factories." 
  322     PrintAvailableModels (fVerbosity);
 
  327     PrintAvailableUserVisActions (fVerbosity);
 
  332     PrintAvailableColours (fVerbosity);
 
  365   directory -> SetGuidance(
"Operations on vis attributes of Geant4 geometry.");
 
  366   fDirectoryList.push_back (directory);
 
  371   directory -> SetGuidance(
"Set vis attributes of Geant4 geometry.");
 
  372   fDirectoryList.push_back (directory);
 
  384   directory -> SetGuidance
 
  385     (
"Set quantities for use in future commands where appropriate.");
 
  386   fDirectoryList.push_back (directory);
 
  394   directory -> SetGuidance (
"Operations on Geant4 scenes.");
 
  395   fDirectoryList.push_back (directory);
 
  405   directory -> SetGuidance (
"Add model to current scene.");
 
  406   fDirectoryList.push_back (directory);
 
  430   directory -> SetGuidance (
"Operations on Geant4 scene handlers.");
 
  431   fDirectoryList.push_back (directory);
 
  438   directory -> SetGuidance (
"Operations on touchables.");
 
  440   directory -> SetGuidance (
"Set vis attributes of current touchable.");
 
  441   fDirectoryList.push_back (directory);
 
  445   directory -> SetGuidance (
"Operations on Geant4 viewers.");
 
  446   fDirectoryList.push_back (directory);
 
  469   directory -> SetGuidance(
"Set default values for future viewers.");
 
  470   fDirectoryList.push_back (directory);
 
  475   directory -> SetGuidance (
"Set view parameters of current viewer.");
 
  476   fDirectoryList.push_back (directory);
 
  481             (fpTrajDrawModelMgr, fpTrajDrawModelMgr->
Placement()));
 
  483             (fpTrajDrawModelMgr, fpTrajDrawModelMgr->
Placement()));
 
  487                     (fpTrajFilterMgr, fpTrajFilterMgr->
Placement()));
 
  489                     (fpTrajFilterMgr, fpTrajFilterMgr->
Placement()));
 
  493                     (fpHitFilterMgr, fpHitFilterMgr->
Placement()));
 
  495                     (fpHitFilterMgr, fpHitFilterMgr->
Placement()));
 
  499                     (fpDigiFilterMgr, fpDigiFilterMgr->
Placement()));
 
  501                     (fpDigiFilterMgr, fpDigiFilterMgr->
Placement()));
 
  505   if (IsValidView ()) {
 
  507       G4cout << 
"G4VisManager::Enable: visualization enabled." << 
G4endl;
 
  513     "G4VisManager::Enable: WARNING: visualization remains disabled for" 
  514     "\n  above reasons.  Rectifying with valid vis commands will" 
  515     "\n  automatically enable." 
  525       "G4VisManager::Disable: visualization disabled." 
  526       "\n  The pointer returned by GetConcreteInstance will be zero." 
  527       "\n  Note that it will become enabled after some valid vis commands." 
  533   G4int nSystems = fAvailableGraphicsSystems.size ();
 
  536       G4cout << 
"G4VisManager::GetAvailableGraphicsSystems: WARNING: no" 
  537     "\n graphics system available!" 
  538     "\n  1) Did you have environment variables G4VIS_BUILD_xxxx_DRIVER set" 
  539     "\n     when you compiled/built the visualization code?" 
  540     "\n  2) Did you instantiate your own Visualization Manager and forget" 
  541     "\n     to implement RegisterGraphicsSystems correctly?" 
  542     "\n  3) You can register your own graphics system, e.g.," 
  543     "\n     visManager->RegisterGraphicsSystem(new MyGraphicsSystem);)" 
  544     "\n     after instantiating your vis manager and before" 
  545     "\n     visManager->Initialize()." 
  549   return fAvailableGraphicsSystems;
 
  555     fAvailableGraphicsSystems.push_back (pSystem);
 
  557       G4cout << 
"G4VisManager::RegisterGraphicsSystem: " 
  558          << pSystem -> GetName ();
 
  559       if (pSystem -> GetNickname () != 
"") {
 
  560     G4cout << 
" (" << pSystem -> GetNickname () << 
")";
 
  566     if (fVerbosity >= 
errors) {
 
  567       G4cout << 
"G4VisManager::RegisterGraphicsSystem: null pointer!" 
  578   assert (0 != fpTrajDrawModelMgr);
 
  588       G4cout<<
"G4VisManager: Using G4TrajectoryDrawByCharge as default trajectory model."<<
G4endl;
 
  589       G4cout<<
"See commands in /vis/modeling/trajectories/ for other options."<<
G4endl;
 
  593   model = fpTrajDrawModelMgr->
Current();
 
  601   fpTrajDrawModelMgr->
Register(model);
 
  607   fpTrajDrawModelMgr->
Register(factory);
 
  650   fDrawGroupNestingDepth++;
 
  651   if (fDrawGroupNestingDepth > 1) {
 
  653       (
"G4VSceneHandler::BeginDraw",
 
  655        "Nesting detected. It is illegal to nest Begin/EndDraw." 
  659   if (IsValidView ()) {
 
  660     ClearTransientStoreIfMarked();
 
  661     fpSceneHandler -> BeginPrimitives (objectTransform);
 
  668   fDrawGroupNestingDepth--;
 
  669   if (fDrawGroupNestingDepth != 0) {
 
  670     if (fDrawGroupNestingDepth < 0) fDrawGroupNestingDepth = 0;
 
  673   if (IsValidView ()) {
 
  674     fpSceneHandler -> EndPrimitives ();
 
  676   fIsDrawGroup = 
false;
 
  681   fDrawGroupNestingDepth++;
 
  682   if (fDrawGroupNestingDepth > 1) {
 
  684       (
"G4VSceneHandler::BeginDraw2D",
 
  686        "Nesting detected. It is illegal to nest Begin/EndDraw2D." 
  690   if (IsValidView ()) {
 
  691     ClearTransientStoreIfMarked();
 
  692     fpSceneHandler -> BeginPrimitives2D (objectTransform);
 
  699   fDrawGroupNestingDepth--;
 
  700   if (fDrawGroupNestingDepth != 0) {
 
  701     if (fDrawGroupNestingDepth < 0) fDrawGroupNestingDepth = 0;
 
  704   if (IsValidView ()) {
 
  705     fpSceneHandler -> EndPrimitives2D ();
 
  707   fIsDrawGroup = 
false;
 
  710 template <
class T> 
void G4VisManager::DrawT
 
  711 (
const T& graphics_primitive, 
const G4Transform3D& objectTransform) {
 
  715     (
"G4VSceneHandler::DrawT",
 
  717      "Different transform detected in Begin/EndDraw group.");
 
  719     fpSceneHandler -> AddPrimitive (graphics_primitive);
 
  721     if (IsValidView ()) {
 
  722       ClearTransientStoreIfMarked();
 
  723       fpSceneHandler -> BeginPrimitives (objectTransform);
 
  724       fpSceneHandler -> AddPrimitive (graphics_primitive);
 
  725       fpSceneHandler -> EndPrimitives ();
 
  730 template <
class T> 
void G4VisManager::DrawT2D
 
  731 (
const T& graphics_primitive, 
const G4Transform3D& objectTransform) {
 
  735     (
"G4VSceneHandler::DrawT",
 
  737      "Different transform detected in Begin/EndDraw2D group.");
 
  739     fpSceneHandler -> AddPrimitive (graphics_primitive);
 
  741     if (IsValidView ()) {
 
  742       ClearTransientStoreIfMarked();
 
  743       fpSceneHandler -> BeginPrimitives2D (objectTransform);
 
  744       fpSceneHandler -> AddPrimitive (graphics_primitive);
 
  745       fpSceneHandler -> EndPrimitives2D ();
 
  753   DrawT (circle, objectTransform);
 
  759   DrawT (nurbs, objectTransform);
 
  765   DrawT (polyhedron, objectTransform);
 
  771   DrawT (line, objectTransform);
 
  777   DrawT (polymarker, objectTransform);
 
  783   DrawT (scale, objectTransform);
 
  789   DrawT (square, objectTransform);
 
  795   DrawT (text, objectTransform);
 
  801   DrawT2D (circle, objectTransform);
 
  807   DrawT2D (nurbs, objectTransform);
 
  813   DrawT2D (polyhedron, objectTransform);
 
  819   DrawT2D (line, objectTransform);
 
  825   DrawT2D (polymarker, objectTransform);
 
  831   DrawT2D (square, objectTransform);
 
  837   DrawT2D (text, objectTransform);
 
  842     fpSceneHandler -> AddCompound (hit);
 
  844     if (IsValidView ()) {
 
  845       ClearTransientStoreIfMarked();
 
  846       fpSceneHandler -> AddCompound (hit);
 
  853     fpSceneHandler -> AddCompound (digi);
 
  855     if (IsValidView ()) {
 
  856       ClearTransientStoreIfMarked();
 
  857       fpSceneHandler -> AddCompound (digi);
 
  865     fpSceneHandler -> SetModel (&dummyTrajectoriesModel);
 
  867     fpSceneHandler -> AddCompound (traj);
 
  869     if (IsValidView ()) {
 
  870       ClearTransientStoreIfMarked();
 
  871       fpSceneHandler -> SetModel (&dummyTrajectoriesModel);
 
  873       fpSceneHandler -> AddCompound (traj);
 
  883   Draw (*pSol, attribs, objectTransform);
 
  890     fpSceneHandler -> PreAddSolid (objectTransform, attribs);
 
  892     fpSceneHandler -> PostAddSolid ();
 
  894     if (IsValidView ()) {
 
  895       ClearTransientStoreIfMarked();
 
  896       fpSceneHandler -> PreAddSolid (objectTransform, attribs);
 
  898       fpSceneHandler -> PostAddSolid ();
 
  908   G4VSolid*        pSol = pLV -> GetSolid ();
 
  909   Draw (*pSol, attribs, objectTransform);
 
  914   if (fpGraphicsSystem) {
 
  918       fAvailableSceneHandlers.push_back (pSceneHandler);
 
  919       fpSceneHandler = pSceneHandler;                         
 
  922       if(fVerbosity >= 
errors) {
 
  923     G4cout << 
"ERROR in G4VisManager::CreateSceneHandler during " 
  924            << fpGraphicsSystem -> GetName ()
 
  925            << 
" scene handler creation.\n  No action taken." 
  930   else PrintInvalidPointers ();
 
  937   if (!fpSceneHandler) {
 
  938     PrintInvalidPointers ();
 
  945     if (fVerbosity >= 
errors) {
 
  946       G4cout << 
"ERROR in G4VisManager::CreateViewer during " 
  947          << fpGraphicsSystem -> GetName ()
 
  948          << 
" viewer creation.\n  No action taken." 
  954   if (p -> GetViewId() < 0) {
 
  955     if (fVerbosity >= 
errors) {
 
  956       G4cout << 
"ERROR in G4VisManager::CreateViewer during " 
  957          << fpGraphicsSystem -> GetName ()
 
  958          << 
" viewer initialisation.\n  No action taken." 
  969   p -> SetViewParameters(initialvp);
 
  973   fpSceneHandler -> AddViewerToList (fpViewer);
 
  976     G4cout << 
"G4VisManager::CreateViewer: new viewer created." 
  986     static G4bool warned = 
false;
 
  990   "NOTE: objects with visibility flag set to \"false\"" 
  991   " will not be drawn!" 
  992   "\n  \"/vis/viewer/set/culling global false\" to Draw such objects." 
  993   "\n  Also see other \"/vis/viewer/set\" commands." 
 1000     static G4bool warned = 
false;
 
 1004   "WARNING: covered objects in solid mode will not be rendered!" 
 1005   "\n  \"/vis/viewer/set/culling coveredDaughters false\" to reverse this." 
 1006   "\n  Also see other \"/vis/viewer/set\" commands." 
 1016     G4cout << 
"G4VisManager::GeometryHasChanged() called." << 
G4endl;
 
 1022     -> GetNavigatorForTracking () -> GetWorldVolume ();
 
 1025       G4cout << 
"WARNING: There is no world volume!" << 
G4endl;
 
 1031   G4int iScene, nScenes = sceneList.size ();
 
 1032   for (iScene = 0; iScene < nScenes; iScene++) {
 
 1033     G4Scene* pScene = sceneList [iScene];
 
 1034     std::vector<G4Scene::Model>& modelList = pScene -> SetRunDurationModelList ();
 
 1035     if (modelList.size ()) {
 
 1038     modelInvalid = 
false;
 
 1039     std::vector<G4Scene::Model>::iterator iterModel;
 
 1040     for (iterModel = modelList.begin();
 
 1041          iterModel != modelList.end();
 
 1043       modelInvalid = !(iterModel->fpModel->Validate(fVerbosity>=
warnings));
 
 1047           G4cout << 
"WARNING: Model \"" 
 1048              << iterModel->fpModel->GetGlobalDescription ()
 
 1050         "\" is no longer valid - being removed\n  from scene \"" 
 1051              << pScene -> GetName () << 
"\"" 
 1054         modelList.erase (iterModel);
 
 1058       } 
while (modelInvalid);
 
 1060       if (modelList.size () == 0) {
 
 1062       G4cout << 
"WARNING: No models left in this scene \"" 
 1063          << pScene -> GetName ()
 
 1071       ApplyCommand (
G4String(
"/vis/scene/notifyHandlers " + pScene->
GetName()));
 
 1077   if (fpScene && fpScene -> GetRunDurationModelList ().size () == 0) {
 
 1079       G4cout << 
"WARNING: The current scene \"" 
 1080          << fpScene -> GetName ()
 
 1081          << 
"\" has no models." 
 1090     G4cout << 
"G4VisManager::NotifyHandler() called." << 
G4endl;
 
 1095   G4int iScene, nScenes = sceneList.size ();
 
 1096   for (iScene = 0; iScene < nScenes; iScene++) {
 
 1097     G4Scene* pScene = sceneList [iScene];
 
 1098     std::vector<G4Scene::Model>& modelList = pScene -> SetRunDurationModelList ();
 
 1100     if (modelList.size ()) {
 
 1103         ApplyCommand (
G4String(
"/vis/scene/notifyHandlers " + pScene->
GetName()));
 
 1108   if (fpScene && fpScene -> GetRunDurationModelList ().size () == 0) {
 
 1110       G4cout << 
"WARNING: The current scene \"" 
 1111          << fpScene -> GetName ()
 
 1112          << 
"\" has no models." 
 1121   return fpTrajFilterMgr->
Accept(trajectory);
 
 1126   return fpHitFilterMgr->
Accept(hit);
 
 1131   return fpDigiFilterMgr->
Accept(digi);
 
 1149   assert (0 != fpTrajDrawModelMgr);
 
 1153   assert (0 != trajectoryModel); 
 
 1155   trajectoryModel->
Draw(trajectory, visible);
 
 1173   assert (0 != fpTrajDrawModelMgr);
 
 1177   assert (0 != trajectoryModel); 
 
 1179   if (IsValidView()) {
 
 1182     if (trajectoriesModel) {
 
 1184     trajectoryModel->
Draw(trajectory, i_mode, visible);
 
 1186     trajectoryModel->
Draw(trajectory, visible);
 
 1190       trajectoryModel->
Draw(trajectory, i_mode, visible);
 
 1199   fRunDurationUserVisActions.push_back(
UserVisAction(name,pVisAction));
 
 1201     fUserVisActionExtents[pVisAction] = extent;
 
 1203     if (fVerbosity >= warnings) {
 
 1205     "WARNING: No extent set for user vis action \"" << name << 
"\"." 
 1215   fEndOfEventUserVisActions.push_back(
UserVisAction(name,pVisAction));
 
 1217     fUserVisActionExtents[pVisAction] = extent;
 
 1219     if (fVerbosity >= warnings) {
 
 1221     "WARNING: No extent set for user vis action \"" << name << 
"\"." 
 1231   fEndOfRunUserVisActions.push_back(
UserVisAction(name,pVisAction));
 
 1232   fUserVisActionExtents[pVisAction] = extent;
 
 1234     if (fVerbosity >= warnings) {
 
 1236     "WARNING: No extent set for user vis action \"" << name << 
"\"." 
 1243   if (pScene != fpScene) {
 
 1252   fpGraphicsSystem = pSystem;
 
 1254     G4cout << 
"G4VisManager::SetCurrentGraphicsSystem: system now " 
 1255        << pSystem -> GetName () << 
G4endl;
 
 1260   if (!(fpSceneHandler && fpSceneHandler -> GetGraphicsSystem () == pSystem)) {
 
 1262     G4int nSH = sceneHandlerList.size ();  
 
 1264     for (iSH = nSH - 1; iSH >= 0; iSH--) {
 
 1265       if (sceneHandlerList [iSH] -> GetGraphicsSystem () == pSystem) 
break;
 
 1268       fpSceneHandler = sceneHandlerList [iSH];
 
 1270     G4cout << 
"  Scene Handler now " 
 1271            << fpSceneHandler -> GetName () << 
G4endl;
 
 1273       if (fpScene != fpSceneHandler -> GetScene ()) {
 
 1274     fpScene = fpSceneHandler -> GetScene ();
 
 1276       G4cout << 
"  Scene now \"" 
 1277          << fpScene -> GetName () << 
"\"" << 
G4endl;
 
 1280       const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
 
 1281       if (viewerList.size ()) {
 
 1282     fpViewer = viewerList [0];
 
 1284       G4cout << 
"  Viewer now " << fpViewer -> GetName () << 
G4endl;
 
 1299   fpSceneHandler = pSceneHandler;
 
 1301     G4cout << 
"G4VisManager::SetCurrentSceneHandler: scene handler now \"" 
 1302        << pSceneHandler -> GetName () << 
"\"" << 
G4endl;
 
 1304   if (fpScene != fpSceneHandler -> GetScene ()) {
 
 1305     fpScene = fpSceneHandler -> GetScene ();
 
 1307       G4cout << 
"  Scene now \"" 
 1308          << fpScene -> GetName () << 
"\"" << 
G4endl;
 
 1311   if (fpGraphicsSystem != pSceneHandler -> GetGraphicsSystem ()) {
 
 1312     fpGraphicsSystem = pSceneHandler -> GetGraphicsSystem ();
 
 1314       G4cout << 
"  Graphics system now \"" 
 1315          << fpGraphicsSystem -> GetName () << 
"\"" << 
G4endl;
 
 1318   const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
 
 1319   G4int nViewers = viewerList.size ();
 
 1322     for (iViewer = 0; iViewer < nViewers; iViewer++) {
 
 1323       if (fpViewer == viewerList [iViewer]) 
break;
 
 1325     if (iViewer >= nViewers) {
 
 1326       fpViewer = viewerList [0];
 
 1328     G4cout << 
"  Viewer now \"" << fpViewer -> GetName () << 
"\"" 
 1332     if (!IsValidView ()) {
 
 1335   "WARNING: Problem setting scene handler - please report circumstances." 
 1344     "WARNING: No viewers for this scene handler - please create one." 
 1353     G4cout << 
"G4VisManager::SetCurrentViewer: viewer now " 
 1354        << pViewer -> GetName ()
 
 1357   fpSceneHandler = fpViewer -> GetSceneHandler ();
 
 1359   fpScene = fpSceneHandler -> GetScene ();
 
 1360   fpGraphicsSystem = fpSceneHandler -> GetGraphicsSystem ();
 
 1361   if (!IsValidView ()) {
 
 1364     "WARNING: Problem setting viewer - please report circumstances." 
 1371   struct NicknameComparison {
 
 1373     {
return lhs.length()<rhs.length();}
 
 1378   G4int nSystems = fAvailableGraphicsSystems.size ();
 
 1379   G4cout << 
"Current available graphics systems are:";
 
 1384     std::map<G4String,std::set<G4String,NicknameComparison> > systemMap;
 
 1385     for (
G4int i = 0; i < nSystems; i++) {
 
 1390     std::map<G4String,std::set<G4String,NicknameComparison> >::const_iterator i;
 
 1391     for (i = systemMap.begin(); i != systemMap.end(); ++i) {
 
 1392       G4cout << 
"\n  " << i->first << 
" (";
 
 1393       const std::set<G4String,NicknameComparison>& nicknames = i->second;
 
 1394       std::set<G4String,NicknameComparison>::const_iterator j;
 
 1395       for (j = nicknames.begin(); j != nicknames.end(); ++j) {
 
 1396         if (j != nicknames.begin()) 
G4cout << 
", ";
 
 1403     G4cout << 
"\n  NONE!!!  None registered - yet!  Mmmmm!";
 
 1408 void G4VisManager::PrintAvailableModels (Verbosity verbosity)
 const 
 1413     const std::vector<G4VModelFactory<G4VTrajectoryModel>*>& factoryList =
 
 1415     if (factoryList.empty()) G4cout << 
"  None" << G4endl;
 
 1417       std::vector<G4VModelFactory<G4VTrajectoryModel>*>::const_iterator i;
 
 1418       for (i = factoryList.begin(); i != factoryList.end(); ++i)
 
 1419     (*i)->Print(G4cout);
 
 1423     const std::map<G4String, G4VTrajectoryModel*>& modelMap =
 
 1425     if (!modelMap.empty()) {
 
 1427       std::map<G4String, G4VTrajectoryModel*>::const_iterator i;
 
 1428       for (i = modelMap.begin(); i != modelMap.end(); ++i) {
 
 1429     G4cout << 
"  " << i->second->Name();
 
 1430     if (i->second == listManager->
Current()) G4cout << 
" (Current)";
 
 1432     if (verbosity >= 
parameters) i->second->Print(G4cout);
 
 1442     const std::vector<G4VModelFactory<G4VFilter<G4VTrajectory> >*>&
 
 1444     if (factoryList.empty()) G4cout << 
"  None" << G4endl;
 
 1446       std::vector<G4VModelFactory<G4VFilter<G4VTrajectory> >*>::const_iterator i;
 
 1447       for (i = factoryList.begin(); i != factoryList.end(); ++i)
 
 1448     (*i)->Print(G4cout);
 
 1450     const std::vector<G4VFilter<G4VTrajectory>*>&
 
 1452     if (!filterList.empty()) {
 
 1454       std::vector<G4VFilter<G4VTrajectory>*>::const_iterator i;
 
 1455       for (i = filterList.begin(); i != filterList.end(); ++i) {
 
 1457     if (verbosity >= 
parameters) (*i)->PrintAll(G4cout);
 
 1463 void G4VisManager::PrintAvailableUserVisActions (Verbosity)
 const 
 1466     "You have successfully registered the following user vis actions." 
 1468   G4cout << 
"Run Duration User Vis Actions:";
 
 1469   if (fRunDurationUserVisActions.empty()) G4cout << 
" none" << G4endl;
 
 1472     for (
size_t i = 0; i < fRunDurationUserVisActions.size(); i++) {
 
 1473       const G4String& name = fRunDurationUserVisActions[i].fName;
 
 1478   G4cout << 
"End of Event User Vis Actions:";
 
 1479   if (fEndOfEventUserVisActions.empty()) G4cout << 
" none" << G4endl;
 
 1482     for (
size_t i = 0; i < fEndOfEventUserVisActions.size(); i++) {
 
 1483       const G4String& name = fEndOfEventUserVisActions[i].fName;
 
 1488   G4cout << 
"End of Run User Vis Actions:";
 
 1489   if (fEndOfRunUserVisActions.empty()) G4cout << 
" none" << G4endl;
 
 1492     for (
size_t i = 0; i < fEndOfRunUserVisActions.size(); i++) {
 
 1493       const G4String& name = fEndOfRunUserVisActions[i].fName;
 
 1499 void G4VisManager::PrintAvailableColours (Verbosity)
 const {
 
 1501     "Some /vis commands (optionally) take a string to specify colour." 
 1502     "\nAvailable colours:\n  ";
 
 1504   for (std::map<G4String, G4Colour>::const_iterator i = map.begin();
 
 1507     if (++i != map.end()) G4cout << 
", ";
 
 1512 void G4VisManager::PrintInvalidPointers ()
 const {
 
 1513   if (fVerbosity >= 
errors) {
 
 1514     G4cout << 
"ERROR: G4VisManager::PrintInvalidPointers:";
 
 1515     if (!fpGraphicsSystem) {
 
 1516       G4cout << 
"\n null graphics system pointer.";
 
 1519       G4cout << 
"\n  Graphics system is " << fpGraphicsSystem -> GetName ()
 
 1523       "\n  Null scene pointer. Use \"/vis/drawVolume\" or" 
 1524       " \"/vis/scene/create\".";
 
 1525       if (!fpSceneHandler)
 
 1527       "\n  Null scene handler pointer. Use \"/vis/open\" or" 
 1528       " \"/vis/sceneHandler/create\".";
 
 1531       "\n  Null viewer pointer. Use \"/vis/viewer/create\".";
 
 1537 void G4VisManager::BeginOfRun ()
 
 1540   fKeptLastEvent = 
false;
 
 1541   fEventKeepingSuspended = 
false;
 
 1542   fTransientsDrawnThisRun = 
false;
 
 1546 void G4VisManager::BeginOfEvent ()
 
 1549   fTransientsDrawnThisEvent = 
false;
 
 1553 void G4VisManager::EndOfEvent ()
 
 1568   if (!currentEvent) 
return;
 
 1578   ClearTransientStoreIfMarked();
 
 1581   fpSceneHandler->
DrawEvent(currentEvent);
 
 1583   G4int nEventsToBeProcessed = 0;
 
 1584   G4int nKeptEvents = 0;
 
 1589     const std::vector<const G4Event*>* events =
 
 1591     if (events) nKeptEvents = events->size();
 
 1597     if (eventID < nEventsToBeProcessed - 1) {
 
 1607     fKeptLastEvent = 
true;
 
 1614     if (maxNumberOfKeptEvents > 0 && nKeptEvents >= maxNumberOfKeptEvents) {
 
 1615       fEventKeepingSuspended = 
true;
 
 1616       static G4bool warned = 
false;
 
 1620  "WARNING: G4VisManager::EndOfEvent: Automatic event keeping suspended." 
 1621  "\n  The number of events exceeds the maximum, " 
 1622          << maxNumberOfKeptEvents <<
 
 1623  ", that can be kept by the vis manager." 
 1628     } 
else if (maxNumberOfKeptEvents != 0) {
 
 1634 void G4VisManager::EndOfRun ()
 
 1658     if (fEventKeepingSuspended && fVerbosity >= 
warnings) {
 
 1660  "WARNING: G4VisManager::EndOfRun: Automatic event keeping has been suspended." 
 1661  "\n  The number of events in the run exceeded the maximum, " 
 1663  ", that can be kept by the vis manager." <<
 
 1664  "\n  The number of events kept by the vis manager can be changed with" 
 1665  "\n  \"/vis/scene/endOfEventAction accumulate <N>\", where N is the" 
 1666  "\n  maximum number you wish to allow.  N < 0 means \"unlimited\"." 
 1670   fEventRefreshing = 
false;
 
 1675   G4int nKeptEvents = 0;
 
 1676   const std::vector<const G4Event*>* events =
 
 1678   if (events) nKeptEvents = events->size();
 
 1680   if (nKeptEvents && !fKeptLastEvent) {
 
 1684       if (nKeptEvents == 1) 
G4cout << 
" event has";
 
 1685       else G4cout << 
" events have";
 
 1686       G4cout << 
" been kept for refreshing and/or reviewing." << 
G4endl;
 
 1688     static G4bool warned = 
false;
 
 1689     if (!valid && fVerbosity >= 
warnings && !warned) {
 
 1691     "  Only useful if before starting the run:" 
 1692     "\n    a) trajectories are stored (\"/vis/scene/add/trajectories [smooth|rich]\"), or" 
 1693     "\n    b) the Draw method of any hits or digis is implemented." 
 1694     "\n  To view trajectories, hits or digis:" 
 1695     "\n    open a viewer, draw a volume, \"/vis/scene/add/trajectories\"" 
 1696     "\n    \"/vis/scene/add/hits\" or \"/vis/scene/add/digitisations\"" 
 1697     "\n    and, possibly, \"/vis/viewer/flush\"." 
 1698     "\n  To see all events: \"/vis/scene/endOfEventAction accumulate\"." 
 1699     "\n  To see events individually: \"/vis/reviewKeptEvents\"." 
 1706 void G4VisManager::ClearTransientStoreIfMarked(){
 
 1722   fTransientsDrawnThisRun = 
false;
 
 1723   fTransientsDrawnThisEvent = 
false;
 
 1725   for (i = fAvailableSceneHandlers.begin();
 
 1726        i != fAvailableSceneHandlers.end(); ++i) {
 
 1727     (*i)->SetTransientsDrawnThisEvent(
false);
 
 1728     (*i)->SetTransientsDrawnThisRun(
false);
 
 1733   G4String viewerShortName (viewerName);
 
 1734   viewerShortName = viewerShortName (0, viewerShortName.find (
' '));
 
 1735   return viewerShortName.
strip ();
 
 1740   size_t nHandlers = fAvailableSceneHandlers.size ();
 
 1741   size_t iHandler, iViewer;
 
 1744   for (iHandler = 0; iHandler < nHandlers; iHandler++) {
 
 1746     const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
 
 1747     for (iViewer = 0; iViewer < viewerList.size (); iViewer++) {
 
 1748       viewer = viewerList [iViewer];
 
 1749       if (viewerShortName == viewer -> GetShortName ()) {
 
 1756   if (found) 
return viewer;
 
 1764   switch (verbosity) {
 
 1765   case         quiet: rs = 
"quiet (0)"; 
break;
 
 1766   case       startup: rs = 
"startup (1)"; 
break;
 
 1767   case        errors: rs = 
"errors (2)"; 
break;
 
 1768   case      warnings: rs = 
"warnings (3)"; 
break;
 
 1770   case    parameters: rs = 
"parameters (5)"; 
break;
 
 1771   case           all: rs = 
"all (6)"; 
break;
 
 1780   if      (ss(0) == 
'q') verbosity = 
quiet;
 
 1781   else if (ss(0) == 
's') verbosity = 
startup;
 
 1782   else if (ss(0) == 
'e') verbosity = 
errors;
 
 1783   else if (ss(0) == 
'w') verbosity = 
warnings;
 
 1785   else if (ss(0) == 
'p') verbosity = 
parameters;
 
 1786   else if (ss(0) == 
'a') verbosity = 
all;
 
 1789     std::istringstream is(ss);
 
 1792       G4cout << 
"ERROR: G4VisManager::GetVerbosityValue: invalid verbosity \"" 
 1793          << verbosityString << 
"\"";
 
 1811   else if (intVerbosity > 
all)   verbosity = 
all;
 
 1812   else                           verbosity = 
Verbosity(intVerbosity);
 
 1828 G4bool G4VisManager::IsValidView () {
 
 1832   static G4bool noGSPrinting = 
true;
 
 1833   if (!fpGraphicsSystem) {
 
 1837       noGSPrinting = 
false;
 
 1840   "WARNING: G4VisManager::IsValidView(): Attempt to draw when no graphics system" 
 1841   "\n  has been instantiated.  Use \"/vis/open\" or \"/vis/sceneHandler/create\"." 
 1842   "\n  Alternatively, to avoid this message, suppress instantiation of vis" 
 1843   "\n  manager (G4VisExecutive), possibly by setting G4VIS_NONE, and ensure" 
 1844   "\n  drawing code is executed only if G4VVisManager::GetConcreteInstance()" 
 1852   if ((!fpScene) || (!fpSceneHandler) || (!fpViewer)) {
 
 1853     if (fVerbosity >= 
errors) {
 
 1855     "ERROR: G4VisManager::IsValidView(): Current view is not valid." 
 1857       PrintInvalidPointers ();
 
 1862   if (fpScene != fpSceneHandler -> GetScene ()) {
 
 1863     if (fVerbosity >= 
errors) {
 
 1864       G4cout << 
"ERROR: G4VisManager::IsValidView ():";
 
 1865       if (fpSceneHandler -> GetScene ()) {
 
 1867       "\n  The current scene \"" 
 1868            << fpScene -> GetName ()
 
 1869            << 
"\" is not handled by" 
 1870       "\n  the current scene handler \"" 
 1871            << fpSceneHandler -> GetName ()
 
 1873       "\n  (it currently handles scene \"" 
 1874            << fpSceneHandler -> GetScene () -> GetName ()
 
 1877       "\n  (a) attach it to the scene handler with" 
 1878       "\n      /vis/sceneHandler/attach " 
 1879            << fpScene -> GetName ()
 
 1881       "\n  (b) create a new scene handler with " 
 1882       "\n      /vis/sceneHandler/create <graphics-system>," 
 1883       "\n      in which case it should pick up the the new scene." 
 1887     G4cout << 
"\n  Scene handler \"" 
 1888            << fpSceneHandler -> GetName ()
 
 1889            << 
"\" has null scene pointer." 
 1890       "\n  Attach a scene with /vis/sceneHandler/attach [<scene-name>]" 
 1897   const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
 
 1898   if (viewerList.size () == 0) {
 
 1899     if (fVerbosity >= 
errors) {
 
 1901     "ERROR: G4VisManager::IsValidView (): the current scene handler\n  \"" 
 1902          << fpSceneHandler -> GetName ()
 
 1903          << 
"\" has no viewers.  Do /vis/viewer/create." 
 1910   if (fpScene -> IsEmpty ()) {  
 
 1912     G4bool successful = fpScene -> AddWorldIfEmpty (warn);
 
 1913     if (!successful || fpScene -> IsEmpty ()) {        
 
 1914       if (fVerbosity >= 
errors) {
 
 1915     G4cout << 
"ERROR: G4VisManager::IsViewValid ():";
 
 1917       "\n  Attempt at some drawing operation when scene is empty." 
 1918       "\n  Maybe the geometry has not yet been defined." 
 1919       "  Try /run/initialize." 
 1928       "WARNING: G4VisManager: the scene was empty, \"world\" has been" 
 1929       "\n  added and the scene handlers notified.";
 
 1942     G4cout<<
"G4VisManager: No model factories registered with G4VisManager."<<
G4endl;
 
 1943     G4cout<<
"G4VisManager::RegisterModelFactories() should be overridden in derived"<<
G4endl;
 
 1944     G4cout<<
"class. See G4VisExecutive for an example."<<
G4endl;