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

#include <G4VisCommandsSceneAdd.hh>

+ Inheritance diagram for G4VisCommandSceneAddLocalAxes:

Public Member Functions

 G4VisCommandSceneAddLocalAxes ()
 
virtual ~G4VisCommandSceneAddLocalAxes ()
 
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 286 of file G4VisCommandsSceneAdd.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSceneAddLocalAxes()

G4VisCommandSceneAddLocalAxes::G4VisCommandSceneAddLocalAxes ( )

Definition at line 1248 of file G4VisCommandsSceneAdd.cc.

1248 {
1249 G4bool omitable;
1250 fpCommand = new G4UIcommand ("/vis/scene/add/localAxes", this);
1251 fpCommand -> SetGuidance
1252 ("Adds local axes to physical volume(s).");
1253 G4UIparameter* parameter;
1254 parameter = new G4UIparameter ("physical-volume-name", 's', omitable = false);
1255 fpCommand -> SetParameter (parameter);
1256 parameter = new G4UIparameter ("copy-no", 'i', omitable = true);
1257 parameter -> SetGuidance ("If negative, matches any copy no.");
1258 parameter -> SetDefaultValue (-1);
1259 fpCommand -> SetParameter (parameter);
1260}
bool G4bool
Definition: G4Types.hh:86

◆ ~G4VisCommandSceneAddLocalAxes()

G4VisCommandSceneAddLocalAxes::~G4VisCommandSceneAddLocalAxes ( )
virtual

Definition at line 1262 of file G4VisCommandsSceneAdd.cc.

1262 {
1263 delete fpCommand;
1264}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSceneAddLocalAxes::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 1266 of file G4VisCommandsSceneAdd.cc.

1266 {
1267 return "world 0 -1";
1268}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 1270 of file G4VisCommandsSceneAdd.cc.

1271 {
1272
1274 G4bool warn = verbosity >= G4VisManager::warnings;
1275
1277 if (!pScene) {
1278 if (verbosity >= G4VisManager::errors) {
1279 G4warn << "ERROR: No current scene. Please create one." << G4endl;
1280 }
1281 return;
1282 }
1283
1284 G4String name;
1285 G4int copyNo;
1286 std::istringstream is (newValue);
1287 is >> name >> copyNo;
1288
1289 std::vector<G4PhysicalVolumesSearchScene::Findings> findingsVector;
1290
1291 // Search all worlds...
1292 G4TransportationManager* transportationManager =
1294 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
1295 transportationManager->GetWorldsIterator();
1296 size_t nWorlds = transportationManager->GetNoWorlds();
1297 for (size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
1298 G4ModelingParameters mp; // Default - no culling.
1299 G4PhysicalVolumeModel searchModel
1300 (*iterWorld,
1302 G4Transform3D(),
1303 &mp,
1304 true); // Use full extent (avoids initial descent of geometry tree)
1306 (&searchModel, name, copyNo);
1307 searchModel.DescribeYourselfTo (searchScene); // Initiate search.
1308 for (const auto& findings: searchScene.GetFindings()) {
1309 findingsVector.push_back(findings);
1310 }
1311 }
1312
1313 G4int id = 0; // To distinguish axes models by their global description
1314 for (const auto& findings: findingsVector) {
1315
1316 // Create axes model based on size and transformation of found volume(s).
1317 const auto& extent = findings.fpFoundPV->GetLogicalVolume()->GetSolid()->GetExtent();
1318 const auto& transform = findings.fFoundObjectTransformation;
1319
1320 const G4double lengthMax = extent.GetExtentRadius()/2.;
1321 const G4double intLog10LengthMax = std::floor(std::log10(lengthMax));
1322 G4double length = std::pow(10,intLog10LengthMax);
1323 if (5.*length < lengthMax) length *= 5.;
1324 else if (2.*length < lengthMax) length *= 2.;
1325
1326 const auto& axesModel = new G4AxesModel(0.,0.,0.,length,transform);
1327 axesModel->SetGlobalTag("LocalAxesModel");
1328 std::ostringstream oss; oss
1329 << "Local Axes for " << findings.fpFoundPV->GetName()
1330 << ':' << findings.fFoundPVCopyNo << ':' << id++;
1331 axesModel->SetGlobalDescription(oss.str());
1332 // ...so add it to the scene.
1333 G4bool successful = pScene->AddRunDurationModel(axesModel,warn);
1334 if (successful) {
1335 if (verbosity >= G4VisManager::confirmations) {
1336 G4cout << "\"" << findings.fpFoundPV->GetName()
1337 << "\", copy no. " << findings.fFoundPVCopyNo
1338 << ",\n found in searched volume \""
1339 << findings.fpSearchPV->GetName()
1340 << "\" at depth " << findings.fFoundDepth
1341 << ",\n base path: \"" << findings.fFoundBasePVPath
1342 << "\".\n Local axes have been added to scene \""
1343 << pScene->GetName() << "\".";
1344 if (verbosity >= G4VisManager::parameters) {
1345 G4cout << " With extent " << extent
1346 << "\n at " << transform.getRotation()
1347 << " " << transform.getTranslation();
1348 }
1349 G4cout << G4endl;
1350 }
1351 } else {
1353 }
1354 }
1355
1356 if (findingsVector.empty()) {
1357 if (verbosity >= G4VisManager::errors) {
1358 G4warn << "ERROR: Volume \"" << name << "\"";
1359 if (copyNo >= 0) {
1360 G4warn << ", copy no. " << copyNo << ",";
1361 }
1362 G4warn << " not found." << G4endl;
1363 }
1365 return;
1366 }
1367
1369}
#define G4warn
Definition: G4Scene.cc:41
HepGeom::Transform3D G4Transform3D
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4bool AddRunDurationModel(G4VModel *, G4bool warn=false)
Definition: G4Scene.cc:160
const G4String & GetName() const
static G4TransportationManager * GetTransportationManager()
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
std::size_t GetNoWorlds() const
void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
void CheckSceneAndNotifyHandlers(G4Scene *=nullptr)
static G4VisManager * fpVisManager
G4Scene * GetCurrentScene() const
static Verbosity GetVerbosity()
const char * name(G4int ptype)

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