Geant4 11.1.1
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())
 
virtual ~G4GlobalMagFieldMessenger ()
 
virtual void SetNewValue (G4UIcommand *, G4String)
 
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)
 
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

- 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)
 
- 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.

47{
48 fDirectory = new G4UIdirectory("/globalField/");
49 fDirectory->SetGuidance("Global uniform magnetic field UI commands");
50
51 fSetValueCmd = new G4UIcmdWith3VectorAndUnit("/globalField/setValue",this);
52 fSetValueCmd->SetGuidance("Set uniform magnetic field value.");
53 fSetValueCmd->SetParameterName("Bx", "By", "By", false);
54 fSetValueCmd->SetUnitCategory("Magnetic flux density");
56
57 fSetVerboseCmd = new G4UIcmdWithAnInteger("/globalField/verbose",this);
58 fSetVerboseCmd->SetGuidance("Set verbose level: ");
59 fSetVerboseCmd->SetGuidance(" 0: no output");
60 fSetVerboseCmd->SetGuidance(" 1: printing new field value");
61 fSetVerboseCmd->SetParameterName("globalFieldVerbose", false);
62 fSetVerboseCmd->SetRange("globalFieldVerbose>=0");
64
65 // Create field
66 fMagField = new G4UniformMagField(value);
67
68 // Set field value (the field is not activated if value is zero)
69 SetField(value, "G4GlobalMagFieldMessenger::G4GlobalMagFieldMessenger");
70}
@ 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)
Definition: G4UIcommand.hh:157
void SetRange(const char *rs)
Definition: G4UIcommand.hh:121
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:287
G4UImessenger()=default

◆ ~G4GlobalMagFieldMessenger()

G4GlobalMagFieldMessenger::~G4GlobalMagFieldMessenger ( )
virtual

Definition at line 74 of file G4GlobalMagFieldMessenger.cc.

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

Member Function Documentation

◆ GetFieldValue()

G4ThreeVector G4GlobalMagFieldMessenger::GetFieldValue ( ) const

Definition at line 141 of file G4GlobalMagFieldMessenger.cc.

142{
143 if ( fMagField ) return fMagField->GetConstantFieldValue();
144
145 return G4ThreeVector();
146}
CLHEP::Hep3Vector G4ThreeVector
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 134 of file G4GlobalMagFieldMessenger.cc.

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

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 119 of file G4GlobalMagFieldMessenger.cc.

120{
121 if ( command == fSetValueCmd )
122 {
123 SetField(fSetValueCmd->GetNew3VectorValue(newValue),
124 "G4GlobalMagFieldMessenger::SetNewValue");
125 }
126 else if ( command == fSetVerboseCmd )
127 {
128 SetVerboseLevel(fSetVerboseCmd->GetNewIntValue(newValue));
129 }
130}
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: