Geant4 10.7.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, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static void SetVisManager (G4VisManager *pVisManager)
 
static const G4ColourGetCurrentTextColour ()
 
- Protected Member Functions inherited from G4VVisCommandScene
G4String CurrentSceneName ()
 
- Protected Member Functions inherited from G4VVisCommand
void SetViewParameters (G4VViewer *viewer, const G4ViewParameters &viewParams)
 
void RefreshIfRequired (G4VViewer *viewer)
 
void InterpolateViews (G4VViewer *currentViewer, std::vector< G4ViewParameters > viewVector, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")
 
void InterpolateToNewView (G4VViewer *currentViewer, const G4ViewParameters &oldVP, const G4ViewParameters &newVP, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")
 
const G4StringConvertToColourGuidance ()
 
void ConvertToColour (G4Colour &colour, const G4String &redOrString, G4double green, G4double blue, G4double opacity)
 
G4bool ProvideValueOfUnit (const G4String &where, const G4String &unit, const G4String &category, G4double &value)
 
void CheckSceneAndNotifyHandlers (G4Scene *=nullptr)
 
G4bool CheckView ()
 
void G4VisCommandsSceneAddUnsuccessful (G4VisManager::Verbosity verbosity)
 
void CopyGuidanceFrom (const G4UIcommand *fromCmd, G4UIcommand *toCmd, G4int startLine=0)
 
void CopyParametersFrom (const G4UIcommand *fromCmd, G4UIcommand *toCmd)
 
void DrawExtent (const G4VisExtent &)
 
- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4long StoL (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
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 G4bool ConvertToDoublePair (const G4String &paramString, G4double &xval, G4double &yval)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 
- Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = 0
 
static G4int fCurrentArrow3DLineSegmentsPerCircle = 6
 
static G4Colour fCurrentColour = G4Colour::White()
 
static G4double fCurrentLineWidth = 1.
 
static G4Colour fCurrentTextColour = G4Colour::Blue()
 
static G4Text::Layout fCurrentTextLayout = G4Text::left
 
static G4double fCurrentTextSize = 12.
 
static G4PhysicalVolumeModel::TouchableProperties fCurrentTouchableProperties
 
static G4VisExtent fCurrentExtentForField
 
static std::vector< G4PhysicalVolumesSearchScene::FindingsfCurrrentPVFindingsForField
 

Detailed Description

Definition at line 286 of file G4VisCommandsSceneAdd.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSceneAddLogicalVolume()

G4VisCommandSceneAddLogicalVolume::G4VisCommandSceneAddLogicalVolume ( )

Definition at line 1245 of file G4VisCommandsSceneAdd.cc.

1245 {
1246 G4bool omitable;
1247 fpCommand = new G4UIcommand ("/vis/scene/add/logicalVolume", this);
1248 fpCommand -> SetGuidance ("Adds a logical volume to the current scene,");
1249 fpCommand -> SetGuidance
1250 ("Shows boolean components (if any), voxels (if any), readout geometry"
1251 "\n (if any), local axes and overlaps (if any), under control of the"
1252 "\n appropriate flag."
1253 "\n Note: voxels are not constructed until start of run -"
1254 "\n \"/run/beamOn\". (For voxels without a run, \"/run/beamOn 0\".)");
1255 G4UIparameter* parameter;
1256 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = false);
1257 fpCommand -> SetParameter (parameter);
1258 parameter = new G4UIparameter ("depth-of-descent", 'i', omitable = true);
1259 parameter -> SetGuidance ("Depth of descent of geometry hierarchy.");
1260 parameter -> SetDefaultValue (1);
1261 fpCommand -> SetParameter (parameter);
1262 parameter = new G4UIparameter ("booleans-flag", 'b', omitable = true);
1263 parameter -> SetDefaultValue (true);
1264 fpCommand -> SetParameter (parameter);
1265 parameter = new G4UIparameter ("voxels-flag", 'b', omitable = true);
1266 parameter -> SetDefaultValue (true);
1267 fpCommand -> SetParameter (parameter);
1268 parameter = new G4UIparameter ("readout-flag", 'b', omitable = true);
1269 parameter -> SetDefaultValue (true);
1270 fpCommand -> SetParameter (parameter);
1271 parameter = new G4UIparameter ("axes-flag", 'b', omitable = true);
1272 parameter -> SetDefaultValue (true);
1273 parameter -> SetGuidance ("Set \"false\" to suppress axes.");
1274 fpCommand -> SetParameter (parameter);
1275 parameter = new G4UIparameter("check-overlap-flag", 'b', omitable = true);
1276 parameter->SetDefaultValue(true);
1277 parameter -> SetGuidance ("Set \"false\" to suppress overlap check.");
1278 fpCommand->SetParameter(parameter);
1279}
bool G4bool
Definition: G4Types.hh:86
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:146
void SetDefaultValue(const char *theDefaultValue)

◆ ~G4VisCommandSceneAddLogicalVolume()

G4VisCommandSceneAddLogicalVolume::~G4VisCommandSceneAddLogicalVolume ( )
virtual

Definition at line 1281 of file G4VisCommandsSceneAdd.cc.

1281 {
1282 delete fpCommand;
1283}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSceneAddLogicalVolume::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 1285 of file G4VisCommandsSceneAdd.cc.

1285 {
1286 return "";
1287}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 1289 of file G4VisCommandsSceneAdd.cc.

1290 {
1291
1293 G4bool warn(verbosity >= G4VisManager::warnings);
1294
1296 if (!pScene) {
1297 if (verbosity >= G4VisManager::errors) {
1298 G4cerr << "ERROR: No current scene. Please create one." << G4endl;
1299 }
1300 return;
1301 }
1302
1303 G4String name;
1304 G4int requestedDepthOfDescent;
1305 G4String booleansString, voxelsString, readoutString, axesString;
1306 G4String overlapString;
1307 std::istringstream is (newValue);
1308 is >> name >> requestedDepthOfDescent
1309 >> booleansString >> voxelsString >> readoutString >> axesString
1310 >> overlapString;
1311 G4bool booleans = G4UIcommand::ConvertToBool(booleansString);
1312 G4bool voxels = G4UIcommand::ConvertToBool(voxelsString);
1313 G4bool readout = G4UIcommand::ConvertToBool(readoutString);
1314 G4bool axes = G4UIcommand::ConvertToBool(axesString);
1315 G4bool checkOverlaps = G4UIcommand::ConvertToBool(overlapString);
1316
1318 int nLV = pLVStore -> size ();
1319 int iLV;
1320 G4LogicalVolume* pLV = 0;
1321 for (iLV = 0; iLV < nLV; iLV++ ) {
1322 pLV = (*pLVStore) [iLV];
1323 if (pLV -> GetName () == name) break;
1324 }
1325 if (iLV == nLV) {
1326 if (verbosity >= G4VisManager::errors) {
1327 G4cerr << "ERROR: Logical volume " << name
1328 << " not found in logical volume store." << G4endl;
1329 }
1330 return;
1331 }
1332
1333 const std::vector<G4Scene::Model>& rdModelList =
1334 pScene -> GetRunDurationModelList();
1335 std::vector<G4Scene::Model>::const_iterator i;
1336 for (i = rdModelList.begin(); i != rdModelList.end(); ++i) {
1337 if (i->fpModel->GetGlobalDescription().find("Volume") != std::string::npos) break;
1338 }
1339 if (i != rdModelList.end()) {
1340 if (verbosity >= G4VisManager::errors) {
1341 G4cout << "There is already a volume, \""
1342 << i->fpModel->GetGlobalDescription()
1343 << "\",\n in the run-duration model list of scene \""
1344 << pScene -> GetName()
1345 << "\".\n Your logical volume must be the only volume in the scene."
1346 << "\n Create a new scene and try again:"
1347 << "\n /vis/specify " << name
1348 << "\n or"
1349 << "\n /vis/scene/create"
1350 << "\n /vis/scene/add/logicalVolume " << name
1351 << "\n /vis/sceneHandler/attach"
1352 << "\n (and also, if necessary, /vis/viewer/flush)"
1353 << G4endl;
1354 }
1355 return;
1356 }
1357
1359 (pLV, requestedDepthOfDescent, booleans, voxels, readout, checkOverlaps);
1360 const G4String& currentSceneName = pScene -> GetName ();
1361 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1362
1363 if (successful) {
1364
1365 G4bool axesSuccessful = false;
1366 if (axes) {
1367 const G4double radius = model->GetExtent().GetExtentRadius();
1368 const G4double axisLengthMax = radius / 2.;
1369 const G4double intLog10Length = std::floor(std::log10(axisLengthMax));
1370 G4double axisLength = std::pow(10,intLog10Length);
1371 if (5.*axisLength < axisLengthMax) axisLength *= 5.;
1372 else if (2.*axisLength < axisLengthMax) axisLength *= 2.;
1373 const G4double axisWidth = axisLength / 20.;
1374 G4VModel* axesModel = new G4AxesModel(0.,0.,0.,axisLength,axisWidth);
1375 axesSuccessful = pScene -> AddRunDurationModel (axesModel, warn);
1376 }
1377
1378// if (verbosity >= G4VisManager::warnings) {
1379// const std::map<G4String,G4AttDef>* attDefs = model->GetAttDefs();
1380// std::vector<G4AttValue>* attValues = model->CreateCurrentAttValues();
1381// G4cout << G4AttCheck(attValues, attDefs);
1382// delete attValues;
1383// }
1384
1385 if (verbosity >= G4VisManager::confirmations) {
1386 G4cout << "Logical volume \"" << pLV -> GetName ()
1387 << "\" with requested depth of descent "
1388 << requestedDepthOfDescent
1389 << ",\n with";
1390 if (!booleans) G4cout << "out";
1391 G4cout << " boolean components, with";
1392 if (!voxels) G4cout << "out";
1393 G4cout << " voxels,\n with";
1394 if (!readout) G4cout << "out";
1395 G4cout << " readout geometry and with";
1396 if (!checkOverlaps) G4cout << "out";
1397 G4cout << " overlap checking"
1398 << "\n has been added to scene \"" << currentSceneName << "\".";
1399 if (axes) {
1400 if (axesSuccessful) {
1401 G4cout <<
1402 "\n Axes have also been added at the origin of local cooordinates.";
1403 } else {
1404 G4cout <<
1405 "\n Axes have not been added for some reason possibly stated above.";
1406 }
1407 }
1408 G4cout << G4endl;
1409 }
1410 }
1411 else {
1413 return;
1414 }
1415
1417}
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4LogicalVolumeStore * GetInstance()
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:530
const G4VisExtent & GetExtent() const
void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
void CheckSceneAndNotifyHandlers(G4Scene *=nullptr)
static G4VisManager * fpVisManager
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:75
G4Scene * GetCurrentScene() const
static Verbosity GetVerbosity()
const char * name(G4int ptype)

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