Geant4 11.1.1
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 ()
 
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 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 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
 

Detailed Description

Definition at line 298 of file G4VisCommandsSceneAdd.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSceneAddLogicalVolume()

G4VisCommandSceneAddLogicalVolume::G4VisCommandSceneAddLogicalVolume ( )

Definition at line 1373 of file G4VisCommandsSceneAdd.cc.

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

◆ ~G4VisCommandSceneAddLogicalVolume()

G4VisCommandSceneAddLogicalVolume::~G4VisCommandSceneAddLogicalVolume ( )
virtual

Definition at line 1409 of file G4VisCommandsSceneAdd.cc.

1409 {
1410 delete fpCommand;
1411}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSceneAddLogicalVolume::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 1413 of file G4VisCommandsSceneAdd.cc.

1413 {
1414 return "";
1415}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 1417 of file G4VisCommandsSceneAdd.cc.

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