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

#include <G4VisCommandsSceneAdd.hh>

+ Inheritance diagram for G4VisCommandSceneAddGhosts:

Public Member Functions

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

Constructor & Destructor Documentation

◆ G4VisCommandSceneAddGhosts()

G4VisCommandSceneAddGhosts::G4VisCommandSceneAddGhosts ( )

Definition at line 725 of file G4VisCommandsSceneAdd.cc.

725 {
726 G4bool omitable;
727 fpCommand = new G4UIcmdWithAString ("/vis/scene/add/ghosts", this);
728 fpCommand -> SetGuidance
729 ("Adds ghost volumes (G4FlavoredParallelWorld) to the current scene.");
730 fpCommand -> SetGuidance ("Selects by particle.");
731 fpCommand -> SetParameterName ("particle", omitable = true);
732 fpCommand -> SetDefaultValue ("all");
733}
bool G4bool
Definition: G4Types.hh:67

◆ ~G4VisCommandSceneAddGhosts()

G4VisCommandSceneAddGhosts::~G4VisCommandSceneAddGhosts ( )
virtual

Definition at line 735 of file G4VisCommandsSceneAdd.cc.

735 {
736 delete fpCommand;
737}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSceneAddGhosts::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 739 of file G4VisCommandsSceneAdd.cc.

739 {
740 return "";
741}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 743 of file G4VisCommandsSceneAdd.cc.

743 {
744
746 G4bool warn(verbosity >= G4VisManager::warnings);
747
749 if (!pScene) {
750 if (verbosity >= G4VisManager::errors) {
751 G4cout << "ERROR: No current scene. Please create one." << G4endl;
752 }
753 return;
754 }
755 const G4String& currentSceneName = pScene -> GetName ();
756
757 // Gets the G4GlobalFastSimulationManager pointer if any.
758 G4VGlobalFastSimulationManager* theGlobalFastSimulationManager;
759 if(!(theGlobalFastSimulationManager =
761 if (verbosity >= G4VisManager::errors) {
762 G4cout << "ERROR: no G4GlobalFastSimulationManager" << G4endl;
763 }
764 return;
765 }
766
767 // Gets the G4ParticleTable pointer.
769
770 // If "all" (the default) loops on all known particles
771 if(newValue=="all")
772 {
773 G4VFlavoredParallelWorld* CurrentFlavoredWorld = 0;
774 G4bool successful = false;
775 for (G4int iParticle=0; iParticle<theParticleTable->entries();
776 iParticle++)
777 {
778 CurrentFlavoredWorld = theGlobalFastSimulationManager->
779 GetFlavoredWorldForThis(theParticleTable->GetParticle(iParticle));
780
781 if(CurrentFlavoredWorld)
782 successful = successful || pScene ->
783 AddRunDurationModel(new G4FlavoredParallelWorldModel
784 (CurrentFlavoredWorld), warn);
785 }
786 if (successful)
787 {
788 if (verbosity >= G4VisManager::confirmations)
789 G4cout << "Ghosts have been added to scene \""
790 << currentSceneName << "\"."
791 << G4endl;
792 UpdateVisManagerScene (currentSceneName);
793 }
794 else
795 {
796 G4cout << "ERROR: There are no ghosts."<<G4endl;
797 G4VisCommandsSceneAddUnsuccessful(verbosity);
798 }
799 return;
800 }
801
802 // Given a particle name looks just for the concerned Ghosts, if any.
803 G4ParticleDefinition* currentParticle =
804 theParticleTable->FindParticle(newValue);
805
806 if (currentParticle == NULL)
807 {
808 if (verbosity >= G4VisManager::errors)
809 G4cout << "ERROR: \"" << newValue
810 << "\": not found this particle name!" << G4endl;
811 return;
812 }
813
814 G4VFlavoredParallelWorld* worldForThis =
815 theGlobalFastSimulationManager->GetFlavoredWorldForThis(currentParticle);
816 if(worldForThis)
817 {
818 G4bool successful = pScene -> AddRunDurationModel
819 (new G4FlavoredParallelWorldModel (worldForThis), warn);
820 if (successful) {
821 if (verbosity >= G4VisManager::confirmations)
822 G4cout << "Ghosts have been added to scene \""
823 << currentSceneName << "\"."
824 << G4endl;
825 UpdateVisManagerScene (currentSceneName);
826 }
827 }
828 else
829 if (verbosity >= G4VisManager::errors)
830 {
831 G4cout << "ERROR: There are no ghosts for \""<<newValue<<"\""<<G4endl;
832 G4VisCommandsSceneAddUnsuccessful(verbosity);
833 }
834}
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4int entries() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
G4ParticleDefinition * GetParticle(G4int index)
virtual G4VFlavoredParallelWorld * GetFlavoredWorldForThis(G4ParticleDefinition *)=0
static G4VGlobalFastSimulationManager * GetConcreteInstance()
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: