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

#include <G4GlobalMagFieldMessenger.hh>

+ Inheritance diagram for G4GlobalMagFieldMessenger:

Public Member Functions

 G4GlobalMagFieldMessenger (const G4ThreeVector &value=G4ThreeVector())
 
 ~G4GlobalMagFieldMessenger () override
 
void SetNewValue (G4UIcommand *, G4String) override
 
void SetFieldValue (const G4ThreeVector &value)
 
G4ThreeVector GetFieldValue () const
 
void SetVerboseLevel (G4int verboseLevel)
 
G4int GetVerboseLevel () const
 
- 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)
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- 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)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Detailed Description

Definition at line 54 of file G4GlobalMagFieldMessenger.hh.

Constructor & Destructor Documentation

◆ G4GlobalMagFieldMessenger()

G4GlobalMagFieldMessenger::G4GlobalMagFieldMessenger ( const G4ThreeVector & value = G4ThreeVector())

Definition at line 45 of file G4GlobalMagFieldMessenger.cc.

46{
47 fDirectory = new G4UIdirectory("/globalField/");
48 fDirectory->SetGuidance("Global uniform magnetic field UI commands");
49
50 fSetValueCmd = new G4UIcmdWith3VectorAndUnit("/globalField/setValue",this);
51 fSetValueCmd->SetGuidance("Set uniform magnetic field value.");
52 fSetValueCmd->SetParameterName("Bx", "By", "By", false);
53 fSetValueCmd->SetUnitCategory("Magnetic flux density");
55
56 fSetVerboseCmd = new G4UIcmdWithAnInteger("/globalField/verbose",this);
57 fSetVerboseCmd->SetGuidance("Set verbose level: ");
58 fSetVerboseCmd->SetGuidance(" 0: no output");
59 fSetVerboseCmd->SetGuidance(" 1: printing new field value");
60 fSetVerboseCmd->SetParameterName("globalFieldVerbose", false);
61 fSetVerboseCmd->SetRange("globalFieldVerbose>=0");
63
64 // Create field
65 fMagField = new G4UniformMagField(value);
66
67 // Set field value (the field is not activated if value is zero)
68 SetField(value, "G4GlobalMagFieldMessenger::G4GlobalMagFieldMessenger");
69}
@ G4State_Idle
@ G4State_PreInit
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
void SetUnitCategory(const char *unitCategory)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetGuidance(const char *aGuidance)
void SetRange(const char *rs)
void AvailableForStates(G4ApplicationState s1)

◆ ~G4GlobalMagFieldMessenger()

G4GlobalMagFieldMessenger::~G4GlobalMagFieldMessenger ( )
override

Definition at line 73 of file G4GlobalMagFieldMessenger.cc.

74{
75 delete fMagField;
76 delete fSetValueCmd;
77 delete fSetVerboseCmd;
78 delete fDirectory;
79}

Member Function Documentation

◆ GetFieldValue()

G4ThreeVector G4GlobalMagFieldMessenger::GetFieldValue ( ) const

Definition at line 140 of file G4GlobalMagFieldMessenger.cc.

141{
142 if ( fMagField != nullptr ) { return fMagField->GetConstantFieldValue(); }
143
144 return {};
145}
G4ThreeVector GetConstantFieldValue() const

◆ GetVerboseLevel()

G4int G4GlobalMagFieldMessenger::GetVerboseLevel ( ) const
inline

Definition at line 86 of file G4GlobalMagFieldMessenger.hh.

87{ return fVerboseLevel; }

◆ SetFieldValue()

void G4GlobalMagFieldMessenger::SetFieldValue ( const G4ThreeVector & value)

Definition at line 133 of file G4GlobalMagFieldMessenger.cc.

134{
135 SetField(value, "G4GlobalMagFieldMessenger::SetFieldValue");
136}

◆ SetNewValue()

void G4GlobalMagFieldMessenger::SetNewValue ( G4UIcommand * command,
G4String newValue )
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 118 of file G4GlobalMagFieldMessenger.cc.

119{
120 if ( command == fSetValueCmd )
121 {
122 SetField(fSetValueCmd->GetNew3VectorValue(newValue),
123 "G4GlobalMagFieldMessenger::SetNewValue");
124 }
125 else if ( command == fSetVerboseCmd )
126 {
127 SetVerboseLevel(fSetVerboseCmd->GetNewIntValue(newValue));
128 }
129}
void SetVerboseLevel(G4int verboseLevel)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
static G4int GetNewIntValue(const char *paramString)

◆ SetVerboseLevel()

void G4GlobalMagFieldMessenger::SetVerboseLevel ( G4int verboseLevel)
inline

Definition at line 83 of file G4GlobalMagFieldMessenger.hh.

84{ fVerboseLevel = verboseLevel; }

Referenced by SetNewValue().


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