Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4GlobalMagFieldMessenger Class Reference

#include <G4GlobalMagFieldMessenger.hh>

Inheritance diagram for G4GlobalMagFieldMessenger:
Collaboration 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 ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
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 (G4String s)
 
G4double StoD (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
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

Detailed Description

Definition at line 56 of file G4GlobalMagFieldMessenger.hh.

Constructor & Destructor Documentation

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

Definition at line 49 of file G4GlobalMagFieldMessenger.cc.

50  : G4UImessenger(),
51  fMagField(0),
52  fVerboseLevel(0),
53  fDirectory(0),
54  fSetValueCmd(0),
55  fSetVerboseCmd(0)
56 {
57  fDirectory = new G4UIdirectory("/globalField/");
58  fDirectory->SetGuidance("Global uniform magnetic field UI commands");
59 
60  fSetValueCmd = new G4UIcmdWith3VectorAndUnit("/globalField/setValue",this);
61  fSetValueCmd->SetGuidance("Set uniform magnetic field value.");
62  fSetValueCmd->SetParameterName("Bx", "By", "By", false);
63  fSetValueCmd->SetUnitCategory("Magnetic flux density");
65 
66  fSetVerboseCmd = new G4UIcmdWithAnInteger("/globalField/verbose",this);
67  fSetVerboseCmd->SetGuidance("Set verbose level: ");
68  fSetVerboseCmd->SetGuidance(" 0: no output");
69  fSetVerboseCmd->SetGuidance(" 1: printing new field value");
70  fSetVerboseCmd->SetParameterName("globalFieldVerbose", false);
71  fSetVerboseCmd->SetRange("globalFieldVerbose>=0");
73 
74  // Create field
75  fMagField = new G4UniformMagField(value);
76 
77  // Set field value (the field is not activated if value is zero)
78  SetField(value, "G4GlobalMagFieldMessenger::G4GlobalMagFieldMessenger");
79 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetUnitCategory(const char *unitCategory)
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:240

Here is the call graph for this function:

G4GlobalMagFieldMessenger::~G4GlobalMagFieldMessenger ( )
virtual

Definition at line 83 of file G4GlobalMagFieldMessenger.cc.

84 {
85  delete fMagField;
86  delete fSetValueCmd;
87  delete fSetVerboseCmd;
88  delete fDirectory;
89 }

Member Function Documentation

G4ThreeVector G4GlobalMagFieldMessenger::GetFieldValue ( ) const

Definition at line 150 of file G4GlobalMagFieldMessenger.cc.

151 {
152  if ( fMagField ) return fMagField->GetConstantFieldValue();
153 
154  return G4ThreeVector();
155 }
CLHEP::Hep3Vector G4ThreeVector
G4ThreeVector GetConstantFieldValue() const

Here is the call graph for this function:

G4int G4GlobalMagFieldMessenger::GetVerboseLevel ( ) const
inline

Definition at line 88 of file G4GlobalMagFieldMessenger.hh.

89 { return fVerboseLevel; }
void G4GlobalMagFieldMessenger::SetFieldValue ( const G4ThreeVector value)

Definition at line 143 of file G4GlobalMagFieldMessenger.cc.

144 {
145  SetField(value, "G4GlobalMagFieldMessenger::SetFieldValue");
146 }
void G4GlobalMagFieldMessenger::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 128 of file G4GlobalMagFieldMessenger.cc.

129 {
130  if ( command == fSetValueCmd )
131  {
132  SetField(fSetValueCmd->GetNew3VectorValue(newValue),
133  "G4GlobalMagFieldMessenger::SetNewValue");
134  }
135  else if ( command == fSetVerboseCmd )
136  {
137  SetVerboseLevel(fSetVerboseCmd->GetNewIntValue(newValue));
138  }
139 }
void SetVerboseLevel(G4int verboseLevel)
static G4int GetNewIntValue(const char *paramString)
static G4ThreeVector GetNew3VectorValue(const char *paramString)

Here is the call graph for this function:

void G4GlobalMagFieldMessenger::SetVerboseLevel ( G4int  verboseLevel)
inline

Definition at line 85 of file G4GlobalMagFieldMessenger.hh.

86 { fVerboseLevel = verboseLevel; }

Here is the caller graph for this function:


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