Geant4 11.2.2
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 ()=default
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static G4VisManagerGetVisManager ()
 
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="")
 
void Twinkle (G4VViewer *currentViewer, const G4ViewParameters &baseVP, const std::vector< std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > > &paths)
 
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 CopyCameraParameters (G4ViewParameters &target, const G4ViewParameters &from)
 
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 LtoS (G4long l)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (const G4String &s)
 
G4long StoL (const G4String &s)
 
G4double StoD (const 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 = nullptr
 
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
 
static G4bool fThereWasAViewer = false
 
static G4ViewParameters fExistingVP
 
static G4SceneTreeItem fExistingSceneTree
 

Detailed Description

Definition at line 298 of file G4VisCommandsSceneAdd.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSceneAddLogicalVolume()

G4VisCommandSceneAddLogicalVolume::G4VisCommandSceneAddLogicalVolume ( )

Definition at line 1375 of file G4VisCommandsSceneAdd.cc.

1375 {
1376 G4bool omitable;
1377 fpCommand = new G4UIcommand ("/vis/scene/add/logicalVolume", this);
1378 fpCommand -> SetGuidance ("Adds a logical volume to the current scene,");
1379 fpCommand -> SetGuidance
1380 ("Shows boolean components (if any), voxels (if any), readout geometry"
1381 "\n (if any), local axes and overlaps (if any), under control of the"
1382 "\n appropriate flag."
1383 "\n Note: voxels are not constructed until start of run -"
1384 "\n \"/run/beamOn\". (For voxels without a run, \"/run/beamOn 0\".)");
1385 G4UIparameter* parameter;
1386 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = false);
1387 fpCommand -> SetParameter (parameter);
1388 parameter = new G4UIparameter ("depth-of-descent", 'i', omitable = true);
1389 parameter -> SetGuidance ("Depth of descent of geometry hierarchy.");
1390 parameter -> SetDefaultValue (1);
1391 fpCommand -> SetParameter (parameter);
1392 parameter = new G4UIparameter ("booleans-flag", 'b', omitable = true);
1393 parameter -> SetDefaultValue (true);
1394 fpCommand -> SetParameter (parameter);
1395 parameter = new G4UIparameter ("voxels-flag", 'b', omitable = true);
1396 parameter -> SetDefaultValue (true);
1397 fpCommand -> SetParameter (parameter);
1398 parameter = new G4UIparameter ("readout-flag", 'b', omitable = true);
1399 parameter -> SetDefaultValue (true);
1400 fpCommand -> SetParameter (parameter);
1401 parameter = new G4UIparameter ("axes-flag", 'b', omitable = true);
1402 parameter -> SetDefaultValue (true);
1403 parameter -> SetGuidance ("Set \"false\" to suppress axes.");
1404 fpCommand -> SetParameter (parameter);
1405 parameter = new G4UIparameter("check-overlap-flag", 'b', omitable = true);
1406 parameter->SetDefaultValue(true);
1407 parameter -> SetGuidance ("Set \"false\" to suppress overlap check.");
1408 fpCommand->SetParameter(parameter);
1409}
bool G4bool
Definition G4Types.hh:86
void SetParameter(G4UIparameter *const newParameter)
void SetDefaultValue(const char *theDefaultValue)

◆ ~G4VisCommandSceneAddLogicalVolume()

G4VisCommandSceneAddLogicalVolume::~G4VisCommandSceneAddLogicalVolume ( )
virtual

Definition at line 1411 of file G4VisCommandsSceneAdd.cc.

1411 {
1412 delete fpCommand;
1413}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSceneAddLogicalVolume::GetCurrentValue ( G4UIcommand * command)
virtual

Reimplemented from G4UImessenger.

Definition at line 1415 of file G4VisCommandsSceneAdd.cc.

1415 {
1416 return "";
1417}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 1419 of file G4VisCommandsSceneAdd.cc.

1420 {
1421
1423 G4bool warn(verbosity >= G4VisManager::warnings);
1424
1426 if (!pScene) {
1427 if (verbosity >= G4VisManager::errors) {
1428 G4warn << "ERROR: No current scene. Please create one." << G4endl;
1429 }
1430 return;
1431 }
1432
1433 G4String name;
1434 G4int requestedDepthOfDescent;
1435 G4String booleansString, voxelsString, readoutString, axesString;
1436 G4String overlapString;
1437 std::istringstream is (newValue);
1438 is >> name >> requestedDepthOfDescent
1439 >> booleansString >> voxelsString >> readoutString >> axesString
1440 >> overlapString;
1441 G4bool booleans = G4UIcommand::ConvertToBool(booleansString);
1442 G4bool voxels = G4UIcommand::ConvertToBool(voxelsString);
1443 G4bool readout = G4UIcommand::ConvertToBool(readoutString);
1444 G4bool axes = G4UIcommand::ConvertToBool(axesString);
1445 G4bool checkOverlaps = G4UIcommand::ConvertToBool(overlapString);
1446
1448 G4LogicalVolume* pLV = nullptr;
1449 pLV = pLVStore->GetVolume(name);
1450 if (pLV == nullptr) return; // Volume not found; warning message thrown
1451
1452 const std::vector<G4Scene::Model>& rdModelList =
1453 pScene -> GetRunDurationModelList();
1454 std::vector<G4Scene::Model>::const_iterator i;
1455 for (i = rdModelList.begin(); i != rdModelList.end(); ++i) {
1456 if (i->fpModel->GetGlobalDescription().find("Volume") != std::string::npos) break;
1457 }
1458 if (i != rdModelList.end()) {
1459 if (verbosity >= G4VisManager::errors) {
1460 G4warn << "There is already a volume, \""
1461 << i->fpModel->GetGlobalDescription()
1462 << "\",\n in the run-duration model list of scene \""
1463 << pScene -> GetName()
1464 << "\".\n Your logical volume must be the only volume in the scene."
1465 << "\n Create a new scene and try again:"
1466 << "\n /vis/specify " << name
1467 << "\n or"
1468 << "\n /vis/scene/create"
1469 << "\n /vis/scene/add/logicalVolume " << name
1470 << "\n /vis/sceneHandler/attach"
1471 << "\n (and also, if necessary, /vis/viewer/flush)"
1472 << G4endl;
1473 }
1474 return;
1475 }
1476
1478 (pLV, requestedDepthOfDescent, booleans, voxels, readout, checkOverlaps);
1479 const G4String& currentSceneName = pScene -> GetName ();
1480 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1481
1482 if (successful) {
1483
1484 G4bool axesSuccessful = false;
1485 if (axes) {
1486 const G4double radius = model->GetExtent().GetExtentRadius();
1487 const G4double axisLengthMax = radius / 2.;
1488 const G4double intLog10Length = std::floor(std::log10(axisLengthMax));
1489 G4double axisLength = std::pow(10,intLog10Length);
1490 if (5.*axisLength < axisLengthMax) axisLength *= 5.;
1491 else if (2.*axisLength < axisLengthMax) axisLength *= 2.;
1492 const G4double axisWidth = axisLength / 20.;
1493 G4VModel* axesModel = new G4AxesModel(0.,0.,0.,axisLength,axisWidth);
1494 axesSuccessful = pScene -> AddRunDurationModel (axesModel, warn);
1495 }
1496
1497// if (verbosity >= G4VisManager::warnings) {
1498// const std::map<G4String,G4AttDef>* attDefs = model->GetAttDefs();
1499// std::vector<G4AttValue>* attValues = model->CreateCurrentAttValues();
1500// G4warn << G4AttCheck(attValues, attDefs);
1501// delete attValues;
1502// }
1503
1504 if (verbosity >= G4VisManager::confirmations) {
1505 G4cout << "Logical volume \"" << pLV -> GetName ()
1506 << "\" with requested depth of descent "
1507 << requestedDepthOfDescent
1508 << ",\n with";
1509 if (!booleans) G4cout << "out";
1510 G4cout << " boolean components, with";
1511 if (!voxels) G4cout << "out";
1512 G4cout << " voxels,\n with";
1513 if (!readout) G4cout << "out";
1514 G4cout << " readout geometry and with";
1515 if (!checkOverlaps) G4cout << "out";
1516 G4cout << " overlap checking"
1517 << "\n has been added to scene \"" << currentSceneName << "\".";
1518 if (axes) {
1519 if (axesSuccessful) {
1520 G4cout <<
1521 "\n Axes have also been added at the origin of local cooordinates.";
1522 } else {
1523 G4cout <<
1524 "\n Axes have not been added for some reason possibly stated above.";
1525 }
1526 }
1527 G4cout << G4endl;
1528 }
1529 }
1530 else {
1532 return;
1533 }
1534
1536}
#define G4warn
Definition G4Scene.cc:41
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4LogicalVolume * GetVolume(const G4String &name, G4bool verbose=true, G4bool reverseSearch=false) const
static G4LogicalVolumeStore * GetInstance()
static G4bool ConvertToBool(const char *st)
const G4VisExtent & GetExtent() const
void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
void CheckSceneAndNotifyHandlers(G4Scene *=nullptr)
static G4VisManager * fpVisManager
G4double GetExtentRadius() const
G4Scene * GetCurrentScene() const
static Verbosity GetVerbosity()
const char * name(G4int ptype)

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