83 static void G4VisCommandsSceneAddUnsuccessful
 
   87       "WARNING: For some reason, possibly mentioned above, it has not been" 
   88       "\n  possible to add to the scene." 
   96   fpCommand = 
new G4UIcommand(
"/vis/scene/add/arrow", 
this);
 
   97   fpCommand -> SetGuidance (
"Adds arrow to current scene.");
 
  101   fpCommand -> SetParameter (parameter);
 
  103   fpCommand -> SetParameter (parameter);
 
  105   fpCommand -> SetParameter (parameter);
 
  107   fpCommand -> SetParameter (parameter);
 
  109   fpCommand -> SetParameter (parameter);
 
  111   fpCommand -> SetParameter (parameter);
 
  112   parameter =  
new G4UIparameter (
"unit", 
's', omitable = 
true);
 
  133       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
  140   std::istringstream is(newValue);
 
  141   is >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> unitString;
 
  143   x1 *= unit; y1 *= unit; z1 *= unit;
 
  144   x2 *= unit; y2 *= unit; z2 *= unit;
 
  152     (x1, y1, z1, x2, y2, z2,
 
  155   const G4String& currentSceneName = pScene -> GetName ();
 
  156   G4bool successful = pScene -> AddRunDurationModel (model, warn);
 
  159       G4cout << 
"Arrow has been added to scene \"" 
  160          << currentSceneName << 
"\"." 
  164   else G4VisCommandsSceneAddUnsuccessful(verbosity);
 
  171   fpCommand = 
new G4UIcommand(
"/vis/scene/add/arrow2D", 
this);
 
  172   fpCommand -> SetGuidance (
"Adds 2D arrow to current scene.");
 
  176   fpCommand -> SetParameter (parameter);
 
  178   fpCommand -> SetParameter (parameter);
 
  180   fpCommand -> SetParameter (parameter);
 
  182   fpCommand -> SetParameter (parameter);
 
  201       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
  207   std::istringstream is(newValue);
 
  208   is >> x1 >> y1 >> x2 >> 
y2;
 
  210   Arrow2D* arrow2D = 
new Arrow2D
 
  217   const G4String& currentSceneName = pScene -> GetName ();
 
  218   G4bool successful = pScene -> AddRunDurationModel (model, warn);
 
  221       G4cout << 
"A 2D arrow has been added to scene \"" 
  222          << currentSceneName << 
"\"." 
  226   else G4VisCommandsSceneAddUnsuccessful(verbosity);
 
  230 G4VisCommandSceneAddArrow2D::Arrow2D::Arrow2D
 
  234   fWidth(width), fColour(colour)
 
  236   fShaftPolyline.push_back(
G4Point3D(x1,y1,0));
 
  237   fShaftPolyline.push_back(
G4Point3D(x2,y2,0));
 
  239   G4Vector3D arrowPointLeftDirection(arrowDirection);
 
  240   arrowPointLeftDirection.rotateZ(150.*
deg);
 
  241   G4Vector3D arrowPointRightDirection(arrowDirection);
 
  242   arrowPointRightDirection.rotateZ(-150.*
deg);
 
  243   fHeadPolyline.push_back(
G4Point3D(x2,y2,0)+0.04*arrowPointLeftDirection);
 
  244   fHeadPolyline.push_back(
G4Point3D(x2,y2,0));
 
  245   fHeadPolyline.push_back(
G4Point3D(x2,y2,0)+0.04*arrowPointRightDirection);
 
  249   fShaftPolyline.SetVisAttributes(va);
 
  250   fHeadPolyline.SetVisAttributes(va);
 
  253 void G4VisCommandSceneAddArrow2D::Arrow2D::operator()
 
  256   sceneHandler.BeginPrimitives2D();
 
  257   sceneHandler.AddPrimitive(fShaftPolyline);
 
  258   sceneHandler.AddPrimitive(fHeadPolyline);
 
  259   sceneHandler.EndPrimitives2D();
 
  266   fpCommand = 
new G4UIcommand (
"/vis/scene/add/axes", 
this);
 
  267   fpCommand -> SetGuidance (
"Add axes.");
 
  268   fpCommand -> SetGuidance
 
  269     (
"Draws axes at (x0, y0, z0) of given length and colour.");
 
  280   parameter =  
new G4UIparameter (
"length", 
'd', omitable = 
true);
 
  283     (
"If negative, length automatic, about 25% of scene extent.");
 
  285   parameter =  
new G4UIparameter (
"unit", 
's', omitable = 
true);
 
  288   parameter =  
new G4UIparameter (
"unitcolour", 
's', omitable = 
true);
 
  291     (
"If \"auto\", x, y and z will be red, green and blue respectively.");
 
  293     (
"Otherwise choose from the pre-defined text-specified colours - " 
  294      "\n  see information printed by the vis manager at start-up or" 
  295      "\n  use \"/vis/list\".");
 
  315       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
  322   std::istringstream is (newValue);
 
  323   is >> x0 >> y0 >> z0 >> length >> unitString  >> colourString;
 
  326   x0 *= unit; y0 *= unit; z0 *= unit;
 
  330     G4double intLog10Length = std::floor(std::log10(length));
 
  331     length = std::pow(10,intLog10Length);
 
  341   if (arrowWidth > length/50.) arrowWidth = length/50.;
 
  344     (x0, y0, z0, length, arrowWidth, colourString, newValue);
 
  346   G4bool successful = pScene -> AddRunDurationModel (model, warn);
 
  347   const G4String& currentSceneName = pScene -> GetName ();
 
  350       G4cout << 
"Axes have been added to scene \"" << currentSceneName << 
"\"." 
  354   else G4VisCommandsSceneAddUnsuccessful(verbosity);
 
  362   fpCommand = 
new G4UIcommand (
"/vis/scene/add/date", 
this);
 
  363   fpCommand -> SetGuidance (
"Adds date to current scene.");
 
  365   parameter = 
new G4UIparameter (
"size", 
'i', omitable = 
true);
 
  366   parameter -> SetGuidance (
"Screen size of text in pixels.");
 
  367   parameter -> SetDefaultValue (18);
 
  368   fpCommand -> SetParameter (parameter);
 
  369   parameter = 
new G4UIparameter (
"x-position", 
'd', omitable = 
true);
 
  370   parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
 
  371   parameter -> SetDefaultValue (0.0);  
 
  372   fpCommand -> SetParameter (parameter);
 
  373   parameter = 
new G4UIparameter (
"y-position", 
'd', omitable = 
true);
 
  374   parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
 
  375   parameter -> SetDefaultValue (0.9);
 
  376   fpCommand -> SetParameter (parameter);
 
  377   parameter = 
new G4UIparameter (
"layout", 
's', omitable = 
true);
 
  378   parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
 
  379   parameter -> SetDefaultValue (
"left");  
 
  380   fpCommand -> SetParameter (parameter);
 
  381   parameter = 
new G4UIparameter (
"date", 
's', omitable = 
true);
 
  382   parameter -> SetGuidance
 
  383   (
"The date you want to appear on the view of the scene (this includes the" 
  384    "\nrest of the line, including spaces).  The default, \'-\', writes the" 
  385    "\ndate and time of the moment of drawing.");
 
  386   parameter -> SetDefaultValue (
"-");
 
  387   fpCommand -> SetParameter (parameter);
 
  406       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
  414   std::istringstream is(newValue);
 
  415   is >> size >> x >> y >> layoutString >> dateString;
 
  417   const size_t NREMAINDER = 100;
 
  418   char remainder[NREMAINDER];
 
  419   is.getline(remainder, NREMAINDER);
 
  420   dateString += remainder;
 
  426   Date* date = 
new Date(
fpVisManager, size, x, y, layout, dateString);
 
  432   const G4String& currentSceneName = pScene -> GetName ();
 
  433   G4bool successful = pScene -> AddRunDurationModel (model, warn);
 
  436       G4cout << 
"Date has been added to scene \"" 
  437          << currentSceneName << 
"\"." 
  441   else G4VisCommandsSceneAddUnsuccessful(verbosity);
 
  445 void G4VisCommandSceneAddDate::Date::operator()
 
  450     time = fTimer.GetClockTime();
 
  455   std::string::size_type i = time.rfind(
'\n');
 
  456   if (i != std::string::npos) time.erase(i);
 
  458   text.SetScreenSize(fSize);
 
  459   text.SetLayout(fLayout);
 
  461   text.SetVisAttributes(textAtts);
 
  462   sceneHandler.BeginPrimitives2D();
 
  463   sceneHandler.AddPrimitive(text);
 
  464   sceneHandler.EndPrimitives2D();
 
  471   fpCommand -> SetGuidance (
"Adds digis to current scene.");
 
  472   fpCommand -> SetGuidance
 
  473     (
"Digis are drawn at end of event when the scene in which" 
  474      "\nthey are added is current.");
 
  493       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
  499   const G4String& currentSceneName = pScene -> GetName ();
 
  500   G4bool successful = pScene -> AddEndOfEventModel (model, warn);
 
  503       G4cout << 
"Digis, if any, will be drawn at end of run in scene \"" 
  504          << currentSceneName << 
"\"." 
  508   else G4VisCommandsSceneAddUnsuccessful(verbosity);
 
  516   fpCommand = 
new G4UIcommand (
"/vis/scene/add/eventID", 
this);
 
  517   fpCommand -> SetGuidance (
"Adds eventID to current scene.");
 
  518   fpCommand -> SetGuidance
 
  519     (
"Run and event numbers are drawn at end of event or run when" 
  520      "\n the scene in which they are added is current.");
 
  522   parameter = 
new G4UIparameter (
"size", 
'i', omitable = 
true);
 
  523   parameter -> SetGuidance (
"Screen size of text in pixels.");
 
  524   parameter -> SetDefaultValue (18);
 
  525   fpCommand -> SetParameter (parameter);
 
  526   parameter = 
new G4UIparameter (
"x-position", 
'd', omitable = 
true);
 
  527   parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
 
  528   parameter -> SetDefaultValue (-0.95);
 
  529   fpCommand -> SetParameter (parameter);
 
  530   parameter = 
new G4UIparameter (
"y-position", 
'd', omitable = 
true);
 
  531   parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
 
  532   parameter -> SetDefaultValue (0.9);
 
  533   fpCommand -> SetParameter (parameter);
 
  534   parameter = 
new G4UIparameter (
"layout", 
's', omitable = 
true);
 
  535   parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
 
  536   parameter -> SetDefaultValue (
"left");
 
  537   fpCommand -> SetParameter (parameter);
 
  556       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
  564   std::istringstream is(newValue);
 
  565   is >> size >> x >> y >> layoutString;
 
  572   EventID* eventID = 
new EventID(
fpVisManager, size, x, y, layout);
 
  578   const G4String& currentSceneName = pScene -> GetName ();
 
  579   G4bool successful = pScene -> AddEndOfEventModel (model, warn);
 
  582       G4cout << 
"EventID has been added to scene \"" 
  583          << currentSceneName << 
"\"." 
  587   else G4VisCommandsSceneAddUnsuccessful(verbosity);
 
  591 void G4VisCommandSceneAddEventID::EventID::operator()
 
  594   const G4Run* currentRun = 0;
 
  598   G4VModel* 
model = fpVisManager->GetCurrentSceneHandler()->GetModel();
 
  600   const G4Event* currentEvent = 0;
 
  607       G4cout << 
"ERROR: No model defined for this SceneHandler : " 
  608          << fpVisManager->GetCurrentSceneHandler()->GetName()
 
  612   if (currentRun && currentEvent) {
 
  615     std::ostringstream oss;
 
  616     if (fpVisManager->GetCurrentScene()->GetRefreshAtEndOfEvent()) {
 
  617       oss << 
"Run " << runID << 
" Event " << eventID;
 
  625     const std::vector<const G4Event*>* events =
 
  627     if (events) nEvents = events->size();
 
  629       if (eventID < nEvents - 1) 
return;  
 
  631     oss << 
"Run " << runID << 
" (" << nEvents << 
" event";
 
  632     if (nEvents != 1) oss << 
's';
 
  638     text.SetLayout(fLayout);
 
  640     text.SetVisAttributes(textAtts);
 
  641     sceneHandler.BeginPrimitives2D();
 
  642     sceneHandler.AddPrimitive(text);
 
  643     sceneHandler.EndPrimitives2D();
 
  650   fpCommand = 
new G4UIcommand(
"/vis/scene/add/frame", 
this);
 
  651   fpCommand -> SetGuidance (
"Adds frame to current scene.");
 
  654   parameter = 
new G4UIparameter (
"size", 
'd', omitable = 
true);
 
  655   parameter -> SetGuidance (
"Size of frame.  1 = full window.");
 
  656   parameter -> SetParameterRange (
"size > 0 && size <=1");
 
  657   parameter -> SetDefaultValue (0.97);
 
  658   fpCommand -> SetParameter (parameter);
 
  677       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
  683   std::istringstream is(newValue);
 
  692   const G4String& currentSceneName = pScene -> GetName ();
 
  693   G4bool successful = pScene -> AddRunDurationModel (model, warn);
 
  696       G4cout << 
"Frame has been added to scene \"" 
  697          << currentSceneName << 
"\"." 
  701   else G4VisCommandsSceneAddUnsuccessful(verbosity);
 
  705 void G4VisCommandSceneAddFrame::Frame::operator()
 
  709   frame.push_back(
G4Point3D( fSize,  fSize, 0.));
 
  710   frame.push_back(
G4Point3D(-fSize,  fSize, 0.));
 
  711   frame.push_back(
G4Point3D(-fSize, -fSize, 0.));
 
  712   frame.push_back(
G4Point3D( fSize, -fSize, 0.));
 
  713   frame.push_back(
G4Point3D( fSize,  fSize, 0.));
 
  718   sceneHandler.BeginPrimitives2D();
 
  719   sceneHandler.AddPrimitive(frame);
 
  720   sceneHandler.EndPrimitives2D();
 
  728   fpCommand -> SetGuidance
 
  729     (
"Adds ghost volumes (G4FlavoredParallelWorld) to the current scene.");
 
  730   fpCommand -> SetGuidance (
"Selects by particle.");
 
  731   fpCommand -> SetParameterName (
"particle", omitable = 
true);
 
  732   fpCommand -> SetDefaultValue (
"all");
 
  751       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
  755   const G4String& currentSceneName = pScene -> GetName ();
 
  759   if(!(theGlobalFastSimulationManager = 
 
  762       G4cout << 
"ERROR: no G4GlobalFastSimulationManager" << 
G4endl;
 
  774       G4bool successful = 
false;
 
  775       for (
G4int iParticle=0; iParticle<theParticleTable->
entries(); 
 
  778       CurrentFlavoredWorld = theGlobalFastSimulationManager->
 
  779         GetFlavoredWorldForThis(theParticleTable->
GetParticle(iParticle));
 
  781       if(CurrentFlavoredWorld)
 
  782         successful = successful || pScene -> 
 
  784                   (CurrentFlavoredWorld), warn);
 
  789         G4cout << 
"Ghosts have been added to scene \"" 
  790            << currentSceneName << 
"\"." 
  797       G4VisCommandsSceneAddUnsuccessful(verbosity);
 
  806   if (currentParticle == NULL) 
 
  809     G4cout << 
"ERROR: \"" << newValue
 
  810            << 
"\": not found this particle name!" << 
G4endl;
 
  818       G4bool successful = pScene -> AddRunDurationModel
 
  822       G4cout << 
"Ghosts have been added to scene \"" 
  823          << currentSceneName << 
"\"." 
  831     G4cout << 
"ERROR: There are no ghosts for \""<<newValue<<
"\""<<
G4endl;
 
  832     G4VisCommandsSceneAddUnsuccessful(verbosity);
 
  841   fpCommand -> SetGuidance (
"Adds hits to current scene.");
 
  842   fpCommand -> SetGuidance
 
  843     (
"Hits are drawn at end of event when the scene in which" 
  844      "\nthey are added is current.");
 
  863       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
  869   const G4String& currentSceneName = pScene -> GetName ();
 
  870   G4bool successful = pScene -> AddEndOfEventModel (model, warn);
 
  873       G4cout << 
"Hits, if any, will be drawn at end of run in scene \"" 
  874          << currentSceneName << 
"\"." 
  878   else G4VisCommandsSceneAddUnsuccessful(verbosity);
 
  885   fpCommand = 
new G4UIcommand(
"/vis/scene/add/line", 
this);
 
  886   fpCommand -> SetGuidance (
"Adds line to current scene.");
 
  890   fpCommand -> SetParameter (parameter);
 
  892   fpCommand -> SetParameter (parameter);
 
  894   fpCommand -> SetParameter (parameter);
 
  896   fpCommand -> SetParameter (parameter);
 
  898   fpCommand -> SetParameter (parameter);
 
  900   fpCommand -> SetParameter (parameter);
 
  901   parameter =  
new G4UIparameter (
"unit", 
's', omitable = 
true);
 
  922       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
  929   std::istringstream is(newValue);
 
  930   is >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> unitString;
 
  932   x1 *= unit; y1 *= unit; z1 *= unit;
 
  933   x2 *= unit; y2 *= unit; z2 *= unit;
 
  935   Line* line = 
new Line(x1, y1, z1, x2, y2, z2,
 
  942   const G4String& currentSceneName = pScene -> GetName ();
 
  943   G4bool successful = pScene -> AddRunDurationModel (model, warn);
 
  946       G4cout << 
"Line has been added to scene \"" 
  947          << currentSceneName << 
"\"." 
  951   else G4VisCommandsSceneAddUnsuccessful(verbosity);
 
  955 G4VisCommandSceneAddLine::Line::Line
 
  959   fWidth(width), fColour(colour)
 
  961   fPolyline.push_back(
G4Point3D(x1,y1,z1));
 
  962   fPolyline.push_back(
G4Point3D(x2,y2,z2));
 
  966   fPolyline.SetVisAttributes(va);
 
  969 void G4VisCommandSceneAddLine::Line::operator()
 
  972   sceneHandler.BeginPrimitives();
 
  973   sceneHandler.AddPrimitive(fPolyline);
 
  974   sceneHandler.EndPrimitives();
 
  980   fpCommand = 
new G4UIcommand(
"/vis/scene/add/line2D", 
this);
 
  981   fpCommand -> SetGuidance (
"Adds 2D line to current scene.");
 
  985   fpCommand -> SetParameter (parameter);
 
  987   fpCommand -> SetParameter (parameter);
 
  989   fpCommand -> SetParameter (parameter);
 
  991   fpCommand -> SetParameter (parameter);
 
 1010       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
 1016   std::istringstream is(newValue);
 
 1017   is >> x1 >> y1 >> x2 >> 
y2;
 
 1019   Line2D* line2D = 
new Line2D
 
 1026   const G4String& currentSceneName = pScene -> GetName ();
 
 1027   G4bool successful = pScene -> AddRunDurationModel (model, warn);
 
 1030       G4cout << 
"A 2D line has been added to scene \"" 
 1031          << currentSceneName << 
"\"." 
 1035   else G4VisCommandsSceneAddUnsuccessful(verbosity);
 
 1039 G4VisCommandSceneAddLine2D::Line2D::Line2D
 
 1043   fWidth(width), fColour(colour)
 
 1045   fPolyline.push_back(
G4Point3D(x1,y1,0));
 
 1046   fPolyline.push_back(
G4Point3D(x2,y2,0));
 
 1050   fPolyline.SetVisAttributes(va);
 
 1053 void G4VisCommandSceneAddLine2D::Line2D::operator()
 
 1056   sceneHandler.BeginPrimitives2D();
 
 1057   sceneHandler.AddPrimitive(fPolyline);
 
 1058   sceneHandler.EndPrimitives2D();
 
 1065   fpCommand = 
new G4UIcommand (
"/vis/scene/add/logicalVolume", 
this);
 
 1066   fpCommand -> SetGuidance (
"Adds a logical volume to the current scene,");
 
 1067   fpCommand -> SetGuidance
 
 1068     (
"Shows boolean components (if any), voxels (if any) and readout geometry" 
 1069      "\n(if any).  Note: voxels are not constructed until start of run -" 
 1070      "\n \"/run/beamOn\".");
 
 1072   parameter = 
new G4UIparameter (
"logical-volume-name", 
's', omitable = 
false);
 
 1073   fpCommand -> SetParameter (parameter);
 
 1074   parameter = 
new G4UIparameter (
"depth-of-descent", 
'i', omitable = 
true);
 
 1075   parameter -> SetGuidance (
"Depth of descent of geometry hierarchy.");
 
 1076   parameter -> SetDefaultValue (1);
 
 1077   fpCommand -> SetParameter (parameter);
 
 1078   parameter = 
new G4UIparameter (
"booleans-flag", 
'b', omitable = 
true);
 
 1079   parameter -> SetDefaultValue (
true);
 
 1080   fpCommand -> SetParameter (parameter);
 
 1081   parameter = 
new G4UIparameter (
"voxels-flag", 
'b', omitable = 
true);
 
 1082   parameter -> SetDefaultValue (
true);
 
 1083   fpCommand -> SetParameter (parameter);
 
 1084   parameter = 
new G4UIparameter (
"readout-flag", 
'b', omitable = 
true);
 
 1085   parameter -> SetDefaultValue (
true);
 
 1086   fpCommand -> SetParameter (parameter);
 
 1106       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
 1112   G4int requestedDepthOfDescent;
 
 1113   G4String booleansString, voxelsString, readoutString;
 
 1114   std::istringstream is (newValue);
 
 1115   is >> name >> requestedDepthOfDescent
 
 1116      >>  booleansString >> voxelsString >> readoutString;
 
 1122   int nLV = pLVStore -> size ();
 
 1125   for (iLV = 0; iLV < nLV; iLV++ ) {
 
 1126     pLV = (*pLVStore) [iLV];
 
 1127     if (pLV -> GetName () == name) 
break;
 
 1131       G4cout << 
"ERROR: Logical volume " << name
 
 1132          << 
" not found in logical volume store." << 
G4endl;
 
 1137   const std::vector<G4Scene::Model>& rdModelList = pScene -> GetRunDurationModelList();
 
 1138   std::vector<G4Scene::Model>::const_iterator i;
 
 1139   for (i = rdModelList.begin(); i != rdModelList.end(); ++i) {
 
 1140     if (i->fpModel->GetGlobalDescription().find(
"Volume") != std::string::npos) 
break;
 
 1142   if (i != rdModelList.end()) {
 
 1144       G4cout << 
"There is already a volume, \"" 
 1145              << i->fpModel->GetGlobalDescription()
 
 1146              << 
"\",\n in the run-duration model list of scene \"" 
 1147              << pScene -> GetName()
 
 1148              << 
"\".\n Your logical volume must be the only volume in the scene." 
 1149          << 
"\n Create a new scene and try again:" 
 1150          << 
"\n  /vis/specify " << name
 
 1152          << 
"\n  /vis/scene/create" 
 1153          << 
"\n  /vis/scene/add/logicalVolume " << name
 
 1154          << 
"\n  /vis/sceneHandler/attach" 
 1155          << 
"\n (and also, if necessary, /vis/viewer/flush)" 
 1161     (pLV, requestedDepthOfDescent, booleans, voxels, readout);
 
 1162   const G4String& currentSceneName = pScene -> GetName ();
 
 1163   G4bool successful = pScene -> AddRunDurationModel (model, warn);
 
 1166       G4cout << 
"Logical volume \"" << pLV -> GetName ()
 
 1167          << 
" with requested depth of descent " 
 1168          << requestedDepthOfDescent
 
 1170       if (!booleans) 
G4cout << 
"out";
 
 1171       G4cout << 
" boolean components, with";
 
 1172       if (!voxels) 
G4cout << 
"out";
 
 1173       G4cout << 
" voxels and with";
 
 1174       if (!readout) 
G4cout << 
"out";
 
 1175       G4cout << 
" readout geometry," 
 1176          << 
"\n  has been added to scene \"" << currentSceneName << 
"\"." 
 1181     G4VisCommandsSceneAddUnsuccessful(verbosity);
 
 1193   fpCommand = 
new G4UIcommand (
"/vis/scene/add/logo", 
this);
 
 1194   fpCommand -> SetGuidance (
"Adds a G4 logo to the current scene.");
 
 1196   parameter = 
new G4UIparameter (
"height", 
'd', omitable = 
true);
 
 1199   parameter =  
new G4UIparameter (
"unit", 
's', omitable = 
true);
 
 1201     (
"auto or valid length unit - defaults to auto." 
 1202      "\nIf auto, height is roughly one tenth of scene extent.");
 
 1205   parameter =  
new G4UIparameter (
"direction", 
's', omitable = 
true);
 
 1207     (
"auto|[-]x|[-]y|[-]z - defaults to auto." 
 1208      "\nDirection of outward-facing normal to front face of logo." 
 1209      "\nIf automatic, logo faces the user in the current viewer.");
 
 1212   parameter =  
new G4UIparameter (
"red", 
'd', omitable = 
true);
 
 1215   parameter =  
new G4UIparameter (
"green", 
'd', omitable = 
true);
 
 1218   parameter =  
new G4UIparameter (
"blue", 
'd', omitable = 
true);
 
 1221   parameter =  
new G4UIparameter (
"auto|manual", 
's', omitable = 
true);
 
 1223     (
"Automatic placement or manual placement at (xmid,ymid,zmid).");
 
 1225     (
"If automatic, placed at bottom right of screen when viewed from");
 
 1227     (
"logo direction.");
 
 1228   parameter -> SetParameterCandidates(
"auto manual");
 
 1231   parameter =  
new G4UIparameter (
"xmid", 
'd', omitable = 
true);
 
 1234   parameter =  
new G4UIparameter (
"ymid", 
'd', omitable = 
true);
 
 1237   parameter =  
new G4UIparameter (
"zmid", 
'd', omitable = 
true);
 
 1240   parameter =  
new G4UIparameter (
"unit", 
's', omitable = 
true);
 
 1261       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
 1270     "ERROR: G4VisCommandSceneAddLogo::SetNewValue: no viewer." 
 1271     "\n  Auto direction needs a viewer." 
 1278   G4String userHeightUnit, direction, auto_manual, positionUnit;
 
 1279   std::istringstream is (newValue);
 
 1280   is >> userHeight >> userHeightUnit >> direction
 
 1281      >> red >> green >> blue
 
 1283      >> xmid >> ymid >> zmid >> positionUnit;
 
 1287   if (userHeightUnit == 
"auto") {
 
 1294   xmid *= unit; ymid *= unit; zmid *= unit;
 
 1296   Direction logoDirection = X;  
 
 1297   if (direction == 
"auto") {
 
 1301     if (vp.
x() > vp.
y() && vp.
x() > vp.
z()) logoDirection = X;
 
 1302     else if (vp.
x() < vp.
y() && vp.
x() < vp.
z()) logoDirection = minusX;
 
 1303     else if (vp.
y() > vp.
x() && vp.
y() > vp.
z()) logoDirection = Y;
 
 1304     else if (vp.
y() < vp.
x() && vp.
y() < vp.
z()) logoDirection = minusY;
 
 1305     else if (vp.
z() > vp.
x() && vp.
z() > vp.
y()) logoDirection = Z;
 
 1306     else if (vp.
z() < vp.
x() && vp.
z() < vp.
y()) logoDirection = minusZ;
 
 1308   else if (direction(0) == 
'x') logoDirection = X;
 
 1309   else if (direction(0) == 
'y') logoDirection = Y;
 
 1310   else if (direction(0) == 
'z') logoDirection = Z;
 
 1311   else if (direction(0) == 
'-') {
 
 1312     if (direction(1) == 
'x') logoDirection = minusX;
 
 1313     else if (direction(1) == 
'y') logoDirection = minusY;
 
 1314     else if (direction(1) == 
'z') logoDirection = minusZ;
 
 1317       G4cout << 
"ERROR: Unrecogniseed direction: \"" 
 1318          << direction << 
"\"." << 
G4endl;
 
 1323   G4bool autoPlacing = 
false; 
if (auto_manual == 
"auto") autoPlacing = 
true;
 
 1340     "WARNING: Existing scene does not yet have any extent." 
 1341     "\n  Maybe you have not yet added any geometrical object." 
 1347   const G4double halfHeight(height / 2.);
 
 1349   const G4double freeHeightFraction (1. + 2. * comfort);
 
 1353   switch (logoDirection) {
 
 1356     if (freeHeightFraction * (xmax - xmin) < height) room = 
false; 
break;
 
 1359     if (freeHeightFraction * (ymax - ymin) < height) room = 
false; 
break;
 
 1362     if (freeHeightFraction * (zmax - zmin) < height) room = 
false; 
break;
 
 1368     "WARNING: Not enough room in existing scene.  Maybe logo is too large." 
 1375     "WARNING: The logo you have asked for is bigger than the existing" 
 1376     "\n  scene.  Maybe you have added it too soon.  It is recommended that" 
 1377     "\n  you add the logo last so that it can be correctly auto-positioned" 
 1378     "\n  so as not to be obscured by any existing object and so that the" 
 1379     "\n  view parameters can be correctly recalculated." 
 1384   G4double sxmid(xmid), symid(ymid), szmid(zmid);
 
 1388     const G4double xComfort = comfort * (xmax - xmin);
 
 1389     const G4double yComfort = comfort * (ymax - ymin);
 
 1390     const G4double zComfort = comfort * (zmax - zmin);
 
 1391     switch (logoDirection) {
 
 1393       sxmid = xmax + halfHeight + xComfort;
 
 1394       symid = ymin - yComfort;
 
 1395       szmid = zmin - zComfort;
 
 1398       sxmid = xmin - halfHeight - xComfort;
 
 1399       symid = ymin - yComfort;
 
 1400       szmid = zmax + zComfort;
 
 1403       sxmid = xmin - xComfort;
 
 1404       symid = ymax + halfHeight + yComfort;
 
 1405       szmid = zmin - zComfort;
 
 1408       sxmid = xmax + xComfort;
 
 1409       symid = ymin - halfHeight - yComfort;
 
 1410       szmid = zmin - zComfort;
 
 1413       sxmid = xmax + xComfort;
 
 1414       symid = ymin - yComfort;
 
 1415       szmid = zmax + halfHeight + zComfort;
 
 1418       sxmid = xmin - xComfort;
 
 1419       symid = ymin - yComfort;
 
 1420       szmid = zmin - halfHeight - zComfort;
 
 1426   switch (logoDirection) {
 
 1451   G4Logo* logo = 
new G4Logo(height,visAtts);
 
 1466   const G4String& currentSceneName = pScene -> GetName ();
 
 1467   G4bool successful = pScene -> AddRunDurationModel (model, warn);
 
 1470       G4cout << 
"G4 Logo of height " << userHeight << 
' ' << userHeightUnit
 
 1471          << 
", " << direction << 
"-direction, added to scene \"" 
 1472          << currentSceneName << 
"\"";
 
 1474     G4cout << 
"\n  with extent " << extent
 
 1481   else G4VisCommandsSceneAddUnsuccessful(verbosity);
 
 1485 G4VisCommandSceneAddLogo::G4Logo::G4Logo
 
 1503   const G4double dx = xt - xb, dy = yt - yb;
 
 1504   const G4double angle = std::atan2(dy,dx);
 
 1507   const G4double d = std::sqrt(dx * dx + dy * dy);
 
 1510   const G4double x8 = ((-ss * d - dx * (yt - y8)) / dy) + xt;
 
 1512   G4double x9 = ((-(ss - w) * d - dx * (yt - y8)) / dy) + xt;
 
 1514   const G4double xtr = ss - 
f1, ytr = -ss - f2 -w;
 
 1515   x9 += xtr; y9 += ytr;
 
 1519   G4Box bG(
"bG",w2,ro2,d2);
 
 1521   fpG = logoG.CreatePolyhedron();
 
 1522   fpG->SetVisAttributes(&fVisAtts);
 
 1526   G4Box b1(
"b1",h2,h2,d2);
 
 1527   G4Box bS(
"bS",ss,ss,d2+e);  
 
 1528   G4Box bS2(
"bS2",ss,ss,d2+2.*e);  
 
 1537   fp4 = logo4.CreatePolyhedron();
 
 1546   fp4->SetVisAttributes(&fVisAtts);
 
 1550 G4VisCommandSceneAddLogo::G4Logo::~G4Logo() {
 
 1555 void G4VisCommandSceneAddLogo::G4Logo::operator()
 
 1557   sceneHandler.BeginPrimitives(transform);
 
 1558   sceneHandler.AddPrimitive(*fpG);
 
 1559   sceneHandler.AddPrimitive(*fp4);
 
 1560   sceneHandler.EndPrimitives();
 
 1567   fpCommand = 
new G4UIcommand (
"/vis/scene/add/logo2D", 
this);
 
 1568   fpCommand -> SetGuidance (
"Adds 2D logo to current scene.");
 
 1570   parameter = 
new G4UIparameter (
"size", 
'i', omitable = 
true);
 
 1571   parameter -> SetGuidance (
"Screen size of text in pixels.");
 
 1572   parameter -> SetDefaultValue (48);
 
 1573   fpCommand -> SetParameter (parameter);
 
 1574   parameter = 
new G4UIparameter (
"x-position", 
'd', omitable = 
true);
 
 1575   parameter -> SetGuidance (
"x screen position in range -1 < x < 1.");
 
 1576   parameter -> SetDefaultValue (-0.9);
 
 1577   fpCommand -> SetParameter (parameter);
 
 1578   parameter = 
new G4UIparameter (
"y-position", 
'd', omitable = 
true);
 
 1579   parameter -> SetGuidance (
"y screen position in range -1 < y < 1.");
 
 1580   parameter -> SetDefaultValue (-0.9);
 
 1581   fpCommand -> SetParameter (parameter);
 
 1582   parameter = 
new G4UIparameter (
"layout", 
's', omitable = 
true);
 
 1583   parameter -> SetGuidance (
"Layout, i.e., adjustment: left|centre|right.");
 
 1584   parameter -> SetDefaultValue (
"left");
 
 1585   fpCommand -> SetParameter (parameter);
 
 1604       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
 1612   std::istringstream is(newValue);
 
 1613   is >> size >> x >> y >> layoutString;
 
 1619   Logo2D* logo2D = 
new Logo2D(
fpVisManager, size, x, y, layout);
 
 1625   const G4String& currentSceneName = pScene -> GetName ();
 
 1626   G4bool successful = pScene -> AddRunDurationModel (model, warn);
 
 1629       G4cout << 
"2D logo has been added to scene \"" 
 1630          << currentSceneName << 
"\"." 
 1634   else G4VisCommandsSceneAddUnsuccessful(verbosity);
 
 1638 void G4VisCommandSceneAddLogo2D::Logo2D::operator()
 
 1642   text.SetScreenSize(fSize);
 
 1643   text.SetLayout(fLayout);
 
 1645   text.SetVisAttributes(textAtts);
 
 1646   sceneHandler.BeginPrimitives2D();
 
 1647   sceneHandler.AddPrimitive(text);
 
 1648   sceneHandler.EndPrimitives2D();
 
 1656   fpCommand -> SetGuidance
 
 1657     (
"Adds Primitive Scorer Hits (PSHits) to current scene.");
 
 1658   fpCommand -> SetGuidance
 
 1659     (
"PSHits are drawn at end of run when the scene in which" 
 1660      "\nthey are added is current.");
 
 1661   fpCommand -> SetGuidance
 
 1662     (
"Optional parameter specifies name of scoring map.  By default all" 
 1663      "\nscoring maps registered with the G4ScoringManager are drawn.");
 
 1664   fpCommand -> SetParameterName (
"mapname", omitable = 
true);
 
 1665   fpCommand -> SetDefaultValue (
"all");
 
 1682   G4Scene* pScene = fpVisManager->GetCurrentScene();
 
 1685       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
 1691   const G4String& currentSceneName = pScene -> GetName ();
 
 1692   G4bool successful = pScene -> AddEndOfRunModel (model, warn);
 
 1695       if (newValue == 
"all") {
 
 1696     G4cout << 
"All Primitive Scorer hits";
 
 1698     G4cout << 
"Hits of Primitive Scorer \"" << newValue << 
'"';
 
 1700       G4cout << 
" will be drawn at end of run in scene \"" 
 1701          << currentSceneName << 
"\"." 
 1705   else G4VisCommandsSceneAddUnsuccessful(verbosity);
 
 1706   UpdateVisManagerScene (currentSceneName);
 
 1713   fpCommand = 
new G4UIcommand (
"/vis/scene/add/scale", 
this);
 
 1714   fpCommand -> SetGuidance 
 
 1715     (
"Adds an annotated scale line to the current scene.");
 
 1718   parameter = 
new G4UIparameter (
"length", 
'd', omitable = 
true);
 
 1721   parameter =  
new G4UIparameter (
"unit", 
's', omitable = 
true);
 
 1723   (
"auto or valid length unit - defaults to auto." 
 1724    "\nIf auto, length is roughly one tenth of the scene extent.");
 
 1727   parameter =  
new G4UIparameter (
"direction", 
's', omitable = 
true);
 
 1729   (
"auto|x|y|z - defaults to auto." 
 1730    "\nIf auto, scale is roughly in the plane of the current view.");
 
 1733   parameter =  
new G4UIparameter (
"red", 
'd', omitable = 
true);
 
 1736   parameter =  
new G4UIparameter (
"green", 
'd', omitable = 
true);
 
 1739   parameter =  
new G4UIparameter (
"blue", 
'd', omitable = 
true);
 
 1742   parameter =  
new G4UIparameter (
"auto|manual", 
's', omitable = 
true);
 
 1744   (
"Automatic placement or manual placement at (xmid,ymid,zmid)." 
 1745    "\nIf automatic, scale is placed at bottom left of current view.");
 
 1746   parameter -> SetParameterCandidates(
"auto manual");
 
 1749   parameter =  
new G4UIparameter (
"xmid", 
'd', omitable = 
true);
 
 1752   parameter =  
new G4UIparameter (
"ymid", 
'd', omitable = 
true);
 
 1755   parameter =  
new G4UIparameter (
"zmid", 
'd', omitable = 
true);
 
 1758   parameter =  
new G4UIparameter (
"unit", 
's', omitable = 
true);
 
 1779       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
 1785   G4String userLengthUnit, direction, auto_manual, positionUnit;
 
 1786   std::istringstream is (newValue);
 
 1787   is >> userLength >> userLengthUnit >> direction
 
 1788      >> red >> green >> blue
 
 1790      >> xmid >> ymid >> zmid >> positionUnit;
 
 1794   if (userLengthUnit == 
"auto") {
 
 1796     G4double intLog10Length = std::floor(std::log10(length));
 
 1797     length = std::pow(10,intLog10Length);
 
 1804   xmid *= unit; ymid *= unit; zmid *= unit;
 
 1807   if (direction(0) == 
'y') scaleDirection = 
G4Scale::y;
 
 1808   if (direction(0) == 
'z') scaleDirection = 
G4Scale::z;
 
 1814     "ERROR: G4VisCommandSceneAddScale::SetNewValue: no viewer." 
 1815     "\n  Auto direction needs a viewer." 
 1826   if (direction == 
"auto") {  
 
 1827     if (std::abs(vp.
x()) > std::abs(vp.
y()) &&
 
 1828     std::abs(vp.
x()) > std::abs(vp.
z())) {  
 
 1829       if (std::abs(up.
y()) > std::abs(up.
z())) scaleDirection = 
G4Scale::z;
 
 1832     else if (std::abs(vp.
y()) > std::abs(vp.
x()) &&
 
 1833          std::abs(vp.
y()) > std::abs(vp.
z())) {  
 
 1834       if (std::abs(up.
x()) > std::abs(up.
z())) scaleDirection = 
G4Scale::z;
 
 1837     else if (std::abs(vp.
z()) > std::abs(vp.
x()) &&
 
 1838          std::abs(vp.
z()) > std::abs(vp.
y())) {  
 
 1839       if (std::abs(up.
y()) > std::abs(up.
x())) scaleDirection = 
G4Scale::x;
 
 1844   G4bool autoPlacing = 
false; 
if (auto_manual == 
"auto") autoPlacing = 
true;
 
 1848   const G4double halfLength(length / 2.);
 
 1850   const G4double freeLengthFraction (1. + 2. * comfort);
 
 1865     "WARNING: Existing scene does not yet have any extent." 
 1866     "\n  Maybe you have not yet added any geometrical object." 
 1872   switch (scaleDirection) {
 
 1874     if (freeLengthFraction * (xmax - xmin) < length) room = 
false; 
break;
 
 1876     if (freeLengthFraction * (ymax - ymin) < length) room = 
false; 
break;
 
 1878     if (freeLengthFraction * (zmax - zmin) < length) room = 
false; 
break;
 
 1884     "WARNING: Not enough room in existing scene.  Maybe scale is too long." 
 1891     "WARNING: The scale you have asked for is bigger than the existing" 
 1892     "\n  scene.  Maybe you have added it too soon.  It is recommended that" 
 1893     "\n  you add the scale last so that it can be correctly auto-positioned" 
 1894     "\n  so as not to be obscured by any existing object and so that the" 
 1895     "\n  view parameters can be correctly recalculated." 
 1903         false, xmid, ymid, zmid);
 
 1939   G4double sxmid(xmid), symid(ymid), szmid(zmid);
 
 1943     const G4double xComfort = comfort * (xmax - xmin);
 
 1944     const G4double yComfort = comfort * (ymax - ymin);
 
 1945     const G4double zComfort = comfort * (zmax - zmin);
 
 1946     switch (scaleDirection) {
 
 1949     sxmid = xmax + xComfort;
 
 1950     symid = ymin - yComfort;
 
 1951     szmid = zmin - zComfort;
 
 1953     sxmid = xmin - xComfort;
 
 1954     symid = ymin - yComfort;
 
 1955     szmid = zmax + zComfort;
 
 1960     sxmid = xmin - xComfort;
 
 1961     symid = ymax + yComfort;
 
 1962     szmid = zmin - zComfort;
 
 1964     sxmid = xmax + xComfort;
 
 1965     symid = ymin - yComfort;
 
 1966     szmid = zmin - zComfort;
 
 1971     sxmid = xmax + xComfort;
 
 1972     symid = ymin - yComfort;
 
 1973     szmid = zmax + zComfort;
 
 1975     sxmid = xmin - xComfort;
 
 1976     symid = ymin - yComfort;
 
 1977     szmid = zmax + zComfort;
 
 2033   switch (scaleDirection) {
 
 2035     scaleExtent = 
G4VisExtent(-halfLength,halfLength,0,0,0,0);
 
 2039     scaleExtent = 
G4VisExtent(0,0,-halfLength,halfLength,0,0);
 
 2043     scaleExtent = 
G4VisExtent(0,0,0,0,-halfLength,halfLength);
 
 2057   const G4String& currentSceneName = pScene -> GetName ();
 
 2058   G4bool successful = pScene -> AddRunDurationModel (model, warn);
 
 2061       G4cout << 
"Scale of " << annotation
 
 2062          << 
" added to scene \"" << currentSceneName << 
"\".";
 
 2064     G4cout << 
"\n  with extent " << scaleExtent
 
 2071   else G4VisCommandsSceneAddUnsuccessful(verbosity);
 
 2080   fpCommand = 
new G4UIcommand (
"/vis/scene/add/text", 
this);
 
 2081   fpCommand -> SetGuidance (
"Adds text to current scene.");
 
 2082   fpCommand -> SetGuidance
 
 2083     (
"Use \"/vis/set/textColour\" to set colour.");
 
 2084   fpCommand -> SetGuidance
 
 2085     (
"Use \"/vis/set/textLayout\" to set layout:");
 
 2099   parameter =  
new G4UIparameter (
"unit", 
's', omitable = 
true);
 
 2102   parameter =  
new G4UIparameter (
"font_size", 
'd', omitable = 
true);
 
 2106   parameter =  
new G4UIparameter (
"x_offset", 
'd', omitable = 
true);
 
 2110   parameter =  
new G4UIparameter (
"y_offset", 
'd', omitable = 
true);
 
 2114   parameter =  
new G4UIparameter (
"text", 
's', omitable = 
true);
 
 2115   parameter->
SetGuidance (
"The rest of the line is text.");
 
 2136       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
 2152   x *= unit; y *= unit; z *= unit;
 
 2161   const G4String& currentSceneName = pScene -> GetName ();
 
 2162   G4bool successful = pScene -> AddRunDurationModel (model, warn);
 
 2165       G4cout << 
"Text \"" << text
 
 2166          << 
"\" has been added to scene \"" << currentSceneName << 
"\"." 
 2170   else G4VisCommandsSceneAddUnsuccessful(verbosity);
 
 2179   fpCommand = 
new G4UIcommand (
"/vis/scene/add/text2D", 
this);
 
 2180   fpCommand -> SetGuidance (
"Adds 2D text to current scene.");
 
 2181   fpCommand -> SetGuidance
 
 2182     (
"Use \"/vis/set/textColour\" to set colour.");
 
 2183   fpCommand -> SetGuidance
 
 2184     (
"Use \"/vis/set/textLayout\" to set layout:");
 
 2194   parameter =  
new G4UIparameter (
"font_size", 
'd', omitable = 
true);
 
 2198   parameter =  
new G4UIparameter (
"x_offset", 
'd', omitable = 
true);
 
 2202   parameter =  
new G4UIparameter (
"y_offset", 
'd', omitable = 
true);
 
 2206   parameter =  
new G4UIparameter (
"text", 
's', omitable = 
true);
 
 2207   parameter->
SetGuidance (
"The rest of the line is text.");
 
 2228       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
 2247   G4Text2D* g4text2D = 
new G4Text2D(g4text);
 
 2253   const G4String& currentSceneName = pScene -> GetName ();
 
 2254   G4bool successful = pScene -> AddRunDurationModel (model, warn);
 
 2257       G4cout << 
"2D text \"" << text
 
 2258          << 
"\" has been added to scene \"" << currentSceneName << 
"\"." 
 2262   else G4VisCommandsSceneAddUnsuccessful(verbosity);
 
 2266 G4VisCommandSceneAddText2D::G4Text2D::G4Text2D(
const G4Text& text):
 
 2270 void G4VisCommandSceneAddText2D::G4Text2D::operator()
 
 2272   sceneHandler.BeginPrimitives2D(transform);
 
 2273   sceneHandler.AddPrimitive(fText);
 
 2274   sceneHandler.EndPrimitives2D();
 
 2283     (
"/vis/scene/add/trajectories", 
this);
 
 2284   fpCommand -> SetGuidance
 
 2285     (
"Adds trajectories to current scene.");
 
 2286   fpCommand -> SetGuidance
 
 2287     (
"Causes trajectories, if any, to be drawn at the end of processing an" 
 2288      "\nevent.  Switches on trajectory storing and sets the" 
 2289      "\ndefault trajectory type.");
 
 2290   fpCommand -> SetGuidance
 
 2291     (
"The command line parameter list determines the default trajectory type." 
 2292      "\nIf it contains the string \"smooth\", auxiliary inter-step points will" 
 2293      "\nbe inserted to improve the smoothness of the drawing of a curved" 
 2295      "\nIf it contains the string \"rich\", significant extra information will" 
 2296      "\nbe stored in the trajectory (G4RichTrajectory) amenable to modeling" 
 2297      "\nand filtering with \"/vis/modeling/trajectories/create/drawByAttribute\"" 
 2298      "\nand \"/vis/filtering/trajectories/create/attributeFilter\" commands." 
 2299      "\nIt may contain both strings in any order.");
 
 2300   fpCommand -> SetGuidance
 
 2301     (
"\nTo switch off trajectory storing: \"/tracking/storeTrajectory 0\"." 
 2302      "\nSee also \"/vis/scene/endOfEventAction\".");
 
 2303   fpCommand -> SetGuidance
 
 2304     (
"Note:  This only sets the default.  Independently of the result of this" 
 2305      "\ncommand, a user may instantiate a trajectory that overrides this default" 
 2306      "\nin PreUserTrackingAction.");
 
 2307   fpCommand -> SetParameterName (
"default-trajectory-type", omitable = 
true);
 
 2308   fpCommand -> SetDefaultValue (
"");
 
 2328       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
 2333   G4bool smooth = 
false, rich = 
false;
 
 2334   if (newValue.find(
"smooth") != std::string::npos) smooth = 
true;
 
 2335   if (newValue.find(
"rich") != std::string::npos) rich = 
true;
 
 2339   G4int newVerbose = 2;
 
 2343     GetPropagatorInField();
 
 2347   G4bool i_mode_found = 
false;
 
 2349   if (smooth && rich) {
 
 2350     UImanager->
ApplyCommand(
"/tracking/storeTrajectory 3");
 
 2352     defaultTrajectoryType = 
"G4RichTrajectory configured for smooth steps";
 
 2353   } 
else if (smooth) {
 
 2354     UImanager->
ApplyCommand(
"/tracking/storeTrajectory 2");
 
 2356     defaultTrajectoryType = 
"G4SmoothTrajectory";
 
 2358     UImanager->
ApplyCommand(
"/tracking/storeTrajectory 3");
 
 2359     defaultTrajectoryType = 
"G4RichTrajectory";
 
 2361     if (!newValue.empty()) {
 
 2362       std::istringstream iss(newValue);
 
 2365     i_mode_found = 
true;
 
 2368   "WARNING: Integer parameter " << i_mode << 
" found." 
 2369   "\n  DEPRECATED - its use in this command will be removed at a future major" 
 2370   "\n  release.  Use \"/vis/modeling/trajectories\" commands." 
 2375       G4cout << 
"ERROR: Unrecognised parameter \"" << newValue << 
"\"" 
 2376         "\n  No action taken." 
 2382     UImanager->
ApplyCommand(
"/tracking/storeTrajectory 1");
 
 2383     defaultTrajectoryType = 
"G4Trajectory";
 
 2389       "Attributes available for modeling and filtering with" 
 2390       "\n  \"/vis/modeling/trajectories/create/drawByAttribute\" and" 
 2391       "\n  \"/vis/filtering/trajectories/create/attributeFilter\" commands:" 
 2397     } 
else if (smooth) {
 
 2412   const G4String& currentSceneName = pScene -> GetName ();
 
 2413   pScene -> AddEndOfEventModel (model, warn);
 
 2416     G4cout << 
"Default trajectory type " << defaultTrajectoryType
 
 2417        << 
"\n  will be used to store trajectories for scene \"" 
 2418        << currentSceneName << 
"\"." 
 2424       "WARNING: Trajectory storing has been requested.  This action may be" 
 2425       "\n  reversed with \"/tracking/storeTrajectory 0\"." 
 2436   fpCommand -> SetGuidance
 
 2437     (
"Add named Vis User Action to current scene.");
 
 2438   fpCommand -> SetGuidance
 
 2439     (
"Attempts to match search string to name of action - use unique sub-string.");
 
 2440   fpCommand -> SetGuidance
 
 2441     (
"(Use /vis/list to see names of registered actions.)");
 
 2442   fpCommand -> SetGuidance
 
 2443     (
"If name == \"all\" (default), all actions are added.");
 
 2444   fpCommand -> SetParameterName(
"action-name", omitable = 
true);
 
 2445   fpCommand -> SetDefaultValue(
"all");
 
 2461   G4Scene* pScene = fpVisManager->GetCurrentScene();
 
 2464       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
 2471   const std::vector<G4VisManager::UserVisAction>& runDurationUserVisActions =
 
 2472     fpVisManager->GetRunDurationUserVisActions();
 
 2473   for (
size_t i = 0; i < runDurationUserVisActions.size(); i++) {
 
 2474     const G4String& 
name = runDurationUserVisActions[i].fName;
 
 2475     G4VUserVisAction* visAction = runDurationUserVisActions[i].fpUserVisAction;
 
 2476     if (newValue == 
"all" || name.find(newValue) != std::string::npos) {
 
 2478       AddVisAction(name,visAction,pScene,runDuration,verbosity);
 
 2482   const std::vector<G4VisManager::UserVisAction>& endOfEventUserVisActions =
 
 2483     fpVisManager->GetEndOfEventUserVisActions();
 
 2484   for (
size_t i = 0; i < endOfEventUserVisActions.size(); i++) {
 
 2485     const G4String& 
name = endOfEventUserVisActions[i].fName;
 
 2487     if (newValue == 
"all" || name.find(newValue) != std::string::npos) {
 
 2489       AddVisAction(name,visAction,pScene,endOfEvent,verbosity);
 
 2493   const std::vector<G4VisManager::UserVisAction>& endOfRunUserVisActions =
 
 2494     fpVisManager->GetEndOfRunUserVisActions();
 
 2495   for (
size_t i = 0; i < endOfRunUserVisActions.size(); i++) {
 
 2496     const G4String& 
name = endOfRunUserVisActions[i].fName;
 
 2498     if (newValue == 
"all" || name.find(newValue) != std::string::npos) {
 
 2500       AddVisAction(name,visAction,pScene,endOfRun,verbosity);
 
 2506       G4cout << 
"WARNING: No User Vis Action registered." << 
G4endl;
 
 2511   const G4String& currentSceneName = pScene -> GetName ();
 
 2512   UpdateVisManagerScene (currentSceneName);
 
 2515 void G4VisCommandSceneAddUserAction::AddVisAction
 
 2519  G4VisCommandSceneAddUserAction::ActionType type,
 
 2524   const std::map<G4VUserVisAction*,G4VisExtent>& visExtentMap =
 
 2527   std::map<G4VUserVisAction*,G4VisExtent>::const_iterator i =
 
 2528     visExtentMap.find(visAction);
 
 2529   if (i != visExtentMap.end()) extent = i->second;
 
 2532       G4cout << 
"WARNING: User Vis Action extent is null." << 
G4endl;
 
 2537   model->
SetType(
"User Vis Action");
 
 2541   G4bool successful = 
false;;
 
 2544     successful = pScene -> AddRunDurationModel (model, warn);
 
 2547     successful = pScene -> AddEndOfEventModel (model, warn);
 
 2550     successful = pScene -> AddEndOfRunModel (model, warn);
 
 2554     const G4String& currentSceneName = pScene -> GetName ();
 
 2555     G4cout << 
"User Vis Action added to scene \"" 
 2556        << currentSceneName << 
"\"";
 
 2558       G4cout << 
"\n  with extent " << extent;
 
 2568   fpCommand = 
new G4UIcommand (
"/vis/scene/add/volume", 
this);
 
 2569   fpCommand -> SetGuidance 
 
 2570    (
"Adds a physical volume to current scene, with optional clipping volume.");
 
 2571   fpCommand -> SetGuidance 
 
 2572     (
"If physical-volume-name is \"world\" (the default), the top of the" 
 2573      "\nmain geometry tree (material world) is added.  If \"worlds\", the" 
 2574      "\ntop of all worlds - material world and parallel worlds, if any - are" 
 2575      "\nadded.  Otherwise a search of all worlds is made, taking the first" 
 2576      "\nmatching occurence only.  To see a representation of the geometry" 
 2577      "\nhierarchy of the worlds, try \"/vis/drawTree [worlds]\" or one of the" 
 2578      "\ndriver/browser combinations that have the required functionality, e.g., HepRep.");
 
 2579   fpCommand -> SetGuidance
 
 2580     (
"If clip-volume-type is specified, the subsequent parameters are used to" 
 2581      "\nto define a clipping volume.  For example," 
 2582      "\n\"vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1\" will draw the world" 
 2583      "\nwith the positive octant cut away."); 
 
 2584   fpCommand -> SetGuidance
 
 2585     (
"If clip-volume-type is prepended with '-', the clip-volume is subtracted" 
 2586      "\n(cutaway). (This is the default if there is no prepended character.)" 
 2587      "\nIf '*' is prepended, the intersection of the physical-volume and the" 
 2588      "\nclip-volume is made. (You can make a section/DCUT with a thin box, for" 
 2590   fpCommand -> SetGuidance
 
 2591     (
"For \"box\", the parameters are xmin,xmax,ymin,ymax,zmin,zmax." 
 2592      "\nOnly \"box\" is programmed at present.");
 
 2594   parameter = 
new G4UIparameter (
"physical-volume-name", 
's', omitable = 
true);
 
 2595   parameter -> SetDefaultValue (
"world");
 
 2596   fpCommand -> SetParameter (parameter);
 
 2597   parameter = 
new G4UIparameter (
"copy-no", 
'i', omitable = 
true);
 
 2598   parameter -> SetGuidance
 
 2599     (
"If negative, matches any copy no.  First name match is taken.");
 
 2600   parameter -> SetDefaultValue (-1);
 
 2601   fpCommand -> SetParameter (parameter);
 
 2602   parameter = 
new G4UIparameter (
"depth-of-descent", 
'i', omitable = 
true);
 
 2603   parameter -> SetGuidance
 
 2604     (
"Depth of descent of geometry hierarchy. Default = unlimited depth.");
 
 2606   fpCommand -> SetParameter (parameter);
 
 2607   parameter = 
new G4UIparameter (
"clip-volume-type", 
's', omitable = 
true);
 
 2608   parameter -> SetParameterCandidates(
"none box -box *box");
 
 2609   parameter -> SetDefaultValue (
"none");
 
 2610   parameter -> SetGuidance(
"[-|*]type.  See general guidance.");
 
 2611   fpCommand -> SetParameter (parameter);
 
 2612   parameter = 
new G4UIparameter (
"parameter-unit", 
's', omitable = 
true);
 
 2613   parameter -> SetDefaultValue (
"m");
 
 2614   fpCommand -> SetParameter (parameter);
 
 2615   parameter = 
new G4UIparameter (
"parameter-1", 
'd', omitable = 
true);
 
 2616   parameter -> SetDefaultValue (0.);
 
 2617   fpCommand -> SetParameter (parameter);
 
 2618   parameter = 
new G4UIparameter (
"parameter-2", 
'd', omitable = 
true);
 
 2619   parameter -> SetDefaultValue (0.);
 
 2620   fpCommand -> SetParameter (parameter);
 
 2621   parameter = 
new G4UIparameter (
"parameter-3", 
'd', omitable = 
true);
 
 2622   parameter -> SetDefaultValue (0.);
 
 2623   fpCommand -> SetParameter (parameter);
 
 2624   parameter = 
new G4UIparameter (
"parameter-4", 
'd', omitable = 
true);
 
 2625   parameter -> SetDefaultValue (0.);
 
 2626   fpCommand -> SetParameter (parameter);
 
 2627   parameter = 
new G4UIparameter (
"parameter-5", 
'd', omitable = 
true);
 
 2628   parameter -> SetDefaultValue (0.);
 
 2629   fpCommand -> SetParameter (parameter);
 
 2630   parameter = 
new G4UIparameter (
"parameter-6", 
'd', omitable = 
true);
 
 2631   parameter -> SetDefaultValue (0.);
 
 2632   fpCommand -> SetParameter (parameter);
 
 2640   return "world 0 -1";
 
 2652       G4cout << 
"ERROR: No current scene.  Please create one." << 
G4endl;
 
 2658   G4int copyNo, requestedDepthOfDescent;
 
 2659   G4double param1, param2, param3, param4, param5, param6;
 
 2660   std::istringstream is (newValue);
 
 2661   is >> name >> copyNo >> requestedDepthOfDescent
 
 2662      >> clipVolumeType >> parameterUnit
 
 2663      >> param1 >> param2 >> param3 >> param4 >> param5 >> param6;
 
 2666   if (clipVolumeType[
size_t(0)] == 
'-') {
 
 2667     clipVolumeType = clipVolumeType.substr(1);  
 
 2668   } 
else if (clipVolumeType[
size_t(0)] == 
'*') {
 
 2670     clipVolumeType = clipVolumeType.substr(1);
 
 2673   param1 *= unit; param2 *= unit; param3 *= unit;
 
 2674   param4 *= unit; param5 *= unit; param6 *= unit;
 
 2679   size_t nWorlds = transportationManager->
GetNoWorlds();
 
 2682       static G4bool warned = 
false;
 
 2683       if (!warned && name != 
"worlds") {
 
 2685       "WARNING: Parallel worlds in operation.  To visualise, specify" 
 2686       "\n  \"worlds\" or the parallel world volume or sub-volume name" 
 2687       "\n   and control visibility with /vis/geometry." 
 2689     std::vector<G4VPhysicalVolume*>::iterator iterWorld =
 
 2691     for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
 
 2692       G4cout << 
"  World " << i << 
": " << (*iterWorld)->GetName()
 
 2705     "ERROR: G4VisCommandSceneAddVolume::SetNewValue:" 
 2706     "\n  No world.  Maybe the geometry has not yet been defined." 
 2707     "\n  Try \"/run/initialize\"" 
 2713   const std::vector<G4Scene::Model>& rdModelList = pScene -> GetRunDurationModelList();
 
 2714   std::vector<G4Scene::Model>::const_iterator it;
 
 2715   for (it = rdModelList.begin(); it != rdModelList.end(); ++it) {
 
 2716     if (it->fpModel->GetGlobalDescription().find(
"G4PhysicalVolumeModel")
 
 2717     != std::string::npos) {
 
 2721   if (it != rdModelList.end()) {
 
 2723       G4cout << 
"WARNING: There is already a volume, \"" 
 2724              << it -> fpModel -> GetGlobalDescription()
 
 2725              << 
"\",\n in the run-duration model list of scene \"" 
 2726              << pScene -> GetName()
 
 2727              << 
"\".\n To get a clean scene:" 
 2728          << 
"\n  /vis/drawVolume " << name
 
 2730          << 
"\n  /vis/scene/create" 
 2731          << 
"\n  /vis/scene/add/volume " << name
 
 2732          << 
"\n  /vis/sceneHandler/attach" 
 2733          << 
"\n (and also, if necessary, /vis/viewer/flush)" 
 2739   std::vector<G4PhysicalVolumeModel*> models;
 
 2740   std::vector<G4VPhysicalVolume*> foundVolumes;
 
 2743   typedef std::vector<PVNodeID> 
PVPath;
 
 2744   PVPath foundFullPVPath;
 
 2745   std::vector<G4int> foundDepths;
 
 2746   std::vector<G4Transform3D> transformations;
 
 2748   if (name == 
"world") {
 
 2752     foundVolumes.push_back(world);
 
 2753     foundDepths.push_back(0);
 
 2756   } 
else if (name == 
"worlds") {
 
 2761       "WARNING: G4VisCommandSceneAddVolume::SetNewValue:" 
 2762       "\n  Parallel worlds requested but none exist." 
 2763       "\n  Just adding material world." 
 2767     std::vector<G4VPhysicalVolume*>::iterator iterWorld =
 
 2769     for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
 
 2772       foundVolumes.push_back(*iterWorld);
 
 2773       foundDepths.push_back(0);
 
 2779     std::vector<G4VPhysicalVolume*>::iterator iterWorld =
 
 2781     for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
 
 2789     foundWorld = *iterWorld;
 
 2790     foundVolumes.push_back(foundVolume);
 
 2798     if (foundVolumes.size()) {
 
 2799       for (
size_t i = 0; i < foundVolumes.size(); ++i) {
 
 2801         (foundVolumes[i], requestedDepthOfDescent, transformations[i]);
 
 2802         foundFullPVPath.pop_back();  
 
 2804     models.push_back(foundPVModel);
 
 2808     G4cout << 
"ERROR: Volume \"" << name << 
"\"";
 
 2810       G4cout << 
", copy no. " << copyNo << 
",";
 
 2818   if (clipVolumeType == 
"box") {
 
 2819     const G4double dX = (param2 - param1) / 2.;
 
 2820     const G4double dY = (param4 - param3) / 2.;
 
 2821     const G4double dZ = (param6 - param5) / 2.;
 
 2822     const G4double x0 = (param2 + param1) / 2.;
 
 2823     const G4double y0 = (param4 + param3) / 2.;
 
 2824     const G4double z0 = (param6 + param5) / 2.;
 
 2827       (
"_displaced_clipping_box",
 
 2828        new G4Box(
"_clipping_box",dX,dY,dZ),
 
 2830     for (
size_t i = 0; i < foundVolumes.size(); ++i) {
 
 2831       models[i]->SetClippingSolid(clippingSolid);
 
 2832       models[i]->SetClippingMode(clippingMode);
 
 2836   const G4String& currentSceneName = pScene -> GetName ();
 
 2838   for (
size_t i = 0; i < foundVolumes.size(); ++i) {
 
 2839     G4bool successful = pScene -> AddRunDurationModel (models[i], warn);
 
 2843     G4cout << 
"First occurrence of \"" 
 2844            << foundVolumes[i] -> GetName ()
 
 2847       G4cout << 
", copy no. " << copyNo << 
",";
 
 2852     G4cout << 
"at depth " << foundDepths[i]
 
 2853            << 
",\n  with a requested depth of further descent of ";
 
 2854     if (requestedDepthOfDescent < 0) {
 
 2855       G4cout << 
"<0 (unlimited)";
 
 2858       G4cout << requestedDepthOfDescent;
 
 2860     G4cout << 
",\n  has been added to scene \"" << currentSceneName << 
"\"." 
 2867     G4VisCommandsSceneAddUnsuccessful(verbosity);