Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VisCommandSceneAddLogicalVolume Class Reference

#include <G4VisCommandsSceneAdd.hh>

+ Inheritance diagram for G4VisCommandSceneAddLogicalVolume:

Public Member Functions

 G4VisCommandSceneAddLogicalVolume ()
 
virtual ~G4VisCommandSceneAddLogicalVolume ()
 
G4String GetCurrentValue (G4UIcommand *command)
 
void SetNewValue (G4UIcommand *command, G4String newValue)
 
- Public Member Functions inherited from G4VVisCommandScene
 G4VVisCommandScene ()
 
virtual ~G4VVisCommandScene ()
 
- Public Member Functions inherited from G4VVisCommand
 G4VVisCommand ()
 
virtual ~G4VVisCommand ()
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static void SetVisManager (G4VisManager *)
 
- Protected Member Functions inherited from G4VVisCommandScene
G4String CurrentSceneName ()
 
- Protected Member Functions inherited from G4VVisCommand
void UpdateVisManagerScene (const G4String &sceneName="")
 
- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Static Protected Member Functions inherited from G4VVisCommand
static G4String ConvertToString (G4double x, G4double y, const char *unitName)
 
static void ConvertToDoublePair (const G4String &paramString, G4double &xval, G4double &yval)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
- Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = 0
 
static G4Colour fCurrentColour = G4Colour::White()
 
static G4Colour fCurrentTextColour = G4Colour::Blue()
 
static G4Text::Layout fCurrentTextLayout = G4Text::left
 
static G4double fCurrentLineWidth = 1.
 
static G4ModelingParameters::PVNameCopyNoPath fCurrentTouchablePath
 

Detailed Description

Definition at line 240 of file G4VisCommandsSceneAdd.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSceneAddLogicalVolume()

G4VisCommandSceneAddLogicalVolume::G4VisCommandSceneAddLogicalVolume ( )

Definition at line 1063 of file G4VisCommandsSceneAdd.cc.

1063 {
1064 G4bool omitable;
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\".");
1071 G4UIparameter* parameter;
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);
1087}
bool G4bool
Definition: G4Types.hh:67

◆ ~G4VisCommandSceneAddLogicalVolume()

G4VisCommandSceneAddLogicalVolume::~G4VisCommandSceneAddLogicalVolume ( )
virtual

Definition at line 1089 of file G4VisCommandsSceneAdd.cc.

1089 {
1090 delete fpCommand;
1091}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSceneAddLogicalVolume::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 1093 of file G4VisCommandsSceneAdd.cc.

1093 {
1094 return "";
1095}

◆ SetNewValue()

void G4VisCommandSceneAddLogicalVolume::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 1097 of file G4VisCommandsSceneAdd.cc.

1098 {
1099
1101 G4bool warn(verbosity >= G4VisManager::warnings);
1102
1104 if (!pScene) {
1105 if (verbosity >= G4VisManager::errors) {
1106 G4cout << "ERROR: No current scene. Please create one." << G4endl;
1107 }
1108 return;
1109 }
1110
1111 G4String name;
1112 G4int requestedDepthOfDescent;
1113 G4String booleansString, voxelsString, readoutString;
1114 std::istringstream is (newValue);
1115 is >> name >> requestedDepthOfDescent
1116 >> booleansString >> voxelsString >> readoutString;
1117 G4bool booleans = G4UIcommand::ConvertToBool(booleansString);
1118 G4bool voxels = G4UIcommand::ConvertToBool(voxelsString);
1119 G4bool readout = G4UIcommand::ConvertToBool(readoutString);
1120
1122 int nLV = pLVStore -> size ();
1123 int iLV;
1124 G4LogicalVolume* pLV = 0;
1125 for (iLV = 0; iLV < nLV; iLV++ ) {
1126 pLV = (*pLVStore) [iLV];
1127 if (pLV -> GetName () == name) break;
1128 }
1129 if (iLV == nLV) {
1130 if (verbosity >= G4VisManager::errors) {
1131 G4cout << "ERROR: Logical volume " << name
1132 << " not found in logical volume store." << G4endl;
1133 }
1134 return;
1135 }
1136
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;
1141 }
1142 if (i != rdModelList.end()) {
1143 if (verbosity >= G4VisManager::errors) {
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
1151 << "\n or"
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)"
1156 << G4endl;
1157 }
1158 }
1159
1160 G4VModel* model = new G4LogicalVolumeModel
1161 (pLV, requestedDepthOfDescent, booleans, voxels, readout);
1162 const G4String& currentSceneName = pScene -> GetName ();
1163 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1164 if (successful) {
1165 if (verbosity >= G4VisManager::confirmations) {
1166 G4cout << "Logical volume \"" << pLV -> GetName ()
1167 << " with requested depth of descent "
1168 << requestedDepthOfDescent
1169 << ",\n with";
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 << "\"."
1177 << G4endl;
1178 }
1179 }
1180 else {
1181 G4VisCommandsSceneAddUnsuccessful(verbosity);
1182 return;
1183 }
1184
1185 UpdateVisManagerScene (currentSceneName);
1186}
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
static G4LogicalVolumeStore * GetInstance()
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:403
static G4VisManager * fpVisManager
void UpdateVisManagerScene(const G4String &sceneName="")
G4Scene * GetCurrentScene() const
static Verbosity GetVerbosity()

The documentation for this class was generated from the following files: