QwGeant4
QweakSimMagneticFieldMessenger Class Reference

Scans input file for /MagnetField/xyz commands. More...

#include <QweakSimMagneticFieldMessenger.hh>

Inherits G4UImessenger.

+ Collaboration diagram for QweakSimMagneticFieldMessenger:

Public Member Functions

 QweakSimMagneticFieldMessenger (QweakSimMagneticField *)
 
 ~QweakSimMagneticFieldMessenger ()
 
void SetNewValue (G4UIcommand *command, G4String newValue)
 

Private Attributes

QweakSimMagneticFieldfMagneticField
 
G4UIdirectory * MagneticFieldDir
 
G4UIcmdWithAString * ReadCmd
 
G4UIcmdWith3VectorAndUnit * PrintCmd
 
G4UIcmdWithADoubleAndUnit * RotationCmd
 
G4UIcmdWithADoubleAndUnit * TranslationCmd
 
G4UIcmdWith3VectorAndUnit * TranslationVectorCmd
 
G4UIcmdWithADoubleAndUnit * MinZCmd
 
G4UIcmdWithADoubleAndUnit * MaxZCmd
 
G4UIcmdWithADoubleAndUnit * StepZCmd
 
G4UIcmdWithADoubleAndUnit * MinRCmd
 
G4UIcmdWithADoubleAndUnit * MaxRCmd
 
G4UIcmdWithADoubleAndUnit * StepRCmd
 
G4UIcmdWithADoubleAndUnit * MinPhiCmd
 
G4UIcmdWithADoubleAndUnit * MaxPhiCmd
 
G4UIcmdWithADoubleAndUnit * StepPhiCmd
 
G4UIcmdWithAnInteger * WrapPhiCmd
 
G4UIcmdWithADouble * ScaleCmd
 
G4UIcmdWithADouble * RefCurrentCmd
 
G4UIcmdWithADouble * ActCurrentCmd
 
G4UIcmdWithAnInteger * StepperCmd
 
G4UIcmdWithADoubleAndUnit * MinStepCmd
 
G4UIcmdWithoutParameter * UpdateCmd
 

Detailed Description

Scans input file for /MagnetField/xyz commands.

Not used yet. Intended to set the StepperType and SetMinStep for the magnet fields.

Placeholder for a long explaination

Definition at line 64 of file QweakSimMagneticFieldMessenger.hh.

Constructor & Destructor Documentation

QweakSimMagneticFieldMessenger::QweakSimMagneticFieldMessenger ( QweakSimMagneticField magneticfield)

Definition at line 44 of file QweakSimMagneticFieldMessenger.cc.

References ActCurrentCmd, MagneticFieldDir, MaxPhiCmd, MaxRCmd, MaxZCmd, MinPhiCmd, MinRCmd, MinStepCmd, MinZCmd, PrintCmd, ReadCmd, RefCurrentCmd, RotationCmd, ScaleCmd, StepperCmd, StepPhiCmd, StepRCmd, StepZCmd, TranslationCmd, TranslationVectorCmd, UpdateCmd, and WrapPhiCmd.

45  : fMagneticField(magneticfield)
46 {
47  MagneticFieldDir = new G4UIdirectory("/MagneticField/");
48  MagneticFieldDir->SetGuidance("Main Magnet control.");
49 
50  ReadCmd = new G4UIcmdWithAString("/MagneticField/ReadFieldMap",this);
51  ReadCmd->SetGuidance("Read the specified magnetic field from file");
52  ReadCmd->SetParameterName("file",true);
53  ReadCmd->SetDefaultValue("MainMagnet_FieldMap.dat");
54  ReadCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
55 
56 
57  PrintCmd = new G4UIcmdWith3VectorAndUnit("/MagneticField/PrintValue",this);
58  PrintCmd->SetGuidance("Print the magnetic field value for specified position");
59  PrintCmd->SetParameterName("x","y","z",false);
60  PrintCmd->SetDefaultValue(G4ThreeVector(0.0,0.0,0.0));
61  PrintCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
62 
63 
64  RefCurrentCmd = new G4UIcmdWithADouble("/MagneticField/SetReferenceCurrent",this);
65  RefCurrentCmd->SetGuidance("Set reference current of read field map");
66  RefCurrentCmd->SetParameterName("current",false);
67  RefCurrentCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
68 
69  ActCurrentCmd = new G4UIcmdWithADouble("/MagneticField/SetActualCurrent",this);
70  ActCurrentCmd->SetGuidance("Set actual current of the magnetic field for simulation");
71  ActCurrentCmd->SetParameterName("current",false);
72  ActCurrentCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
73 
74  ScaleCmd = new G4UIcmdWithADouble("/MagneticField/SetScale",this);
75  ScaleCmd->SetGuidance("Set scale of the magnetic field for simulation");
76  ScaleCmd->SetParameterName("bfil",false);
77  ScaleCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
78 
79 
80  RotationCmd = new G4UIcmdWithADoubleAndUnit("/MagneticField/SetRotation",this);
81  RotationCmd->SetGuidance("Set rotation angle of the magnetic field to be read");
82  RotationCmd->SetParameterName("rotation",false);
83  RotationCmd->SetDefaultUnit("degree");
84  RotationCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
85 
86  TranslationCmd = new G4UIcmdWithADoubleAndUnit("/MagneticField/SetTranslation",this);
87  TranslationCmd->SetGuidance("Set translation in z of the magnetic field (applied on field read-in)");
88  TranslationCmd->SetParameterName("z",false);
89  TranslationCmd->SetDefaultUnit("cm");
90  TranslationCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
91 
92  TranslationVectorCmd = new G4UIcmdWith3VectorAndUnit("/MagneticField/SetTranslationVector",this);
93  TranslationVectorCmd->SetGuidance("Set translation vector of the magnetic field (applied on field evaluation)");
94  TranslationVectorCmd->SetParameterName("x","y","z",false);
95  TranslationVectorCmd->SetDefaultUnit("cm");
96  TranslationVectorCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
97 
98 
99  MinZCmd = new G4UIcmdWithADoubleAndUnit("/MagneticField/SetMinZ",this);
100  MinZCmd->SetGuidance("Set the minimum z position of the field map grid to be read");
101  MinZCmd->SetParameterName("min_r",false);
102  MinZCmd->SetDefaultUnit("cm");
103  MinZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
104 
105  MaxZCmd = new G4UIcmdWithADoubleAndUnit("/MagneticField/SetMaxZ",this);
106  MaxZCmd->SetGuidance("Set the maximum z position of the field map grid to be read");
107  MaxZCmd->SetParameterName("max_r",false);
108  MaxZCmd->SetDefaultUnit("cm");
109  MaxZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
110 
111  StepZCmd = new G4UIcmdWithADoubleAndUnit("/MagneticField/SetStepZ",this);
112  StepZCmd->SetGuidance("Set the step z position of the field map grid to be read");
113  StepZCmd->SetParameterName("step_r",false);
114  StepZCmd->SetDefaultUnit("cm");
115  StepZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
116 
117 
118  MinRCmd = new G4UIcmdWithADoubleAndUnit("/MagneticField/SetMinR",this);
119  MinRCmd->SetGuidance("Set the minimum radius of the field map grid to be read");
120  MinRCmd->SetParameterName("min_r",false);
121  MinRCmd->SetDefaultUnit("cm");
122  MinRCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
123 
124  MaxRCmd = new G4UIcmdWithADoubleAndUnit("/MagneticField/SetMaxR",this);
125  MaxRCmd->SetGuidance("Set the maximum radius of the field map grid to be read");
126  MaxRCmd->SetParameterName("max_r",false);
127  MaxRCmd->SetDefaultUnit("cm");
128  MaxRCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
129 
130  StepRCmd = new G4UIcmdWithADoubleAndUnit("/MagneticField/SetStepR",this);
131  StepRCmd->SetGuidance("Set the step radius of the field map grid to be read");
132  StepRCmd->SetParameterName("step_r",false);
133  StepRCmd->SetDefaultUnit("cm");
134  StepRCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
135 
136 
137  MinPhiCmd = new G4UIcmdWithADoubleAndUnit("/MagneticField/SetMinPhi",this);
138  MinPhiCmd->SetGuidance("Set the minimum phi of the field map grid to be read");
139  MinPhiCmd->SetParameterName("min_phi",false);
140  MinPhiCmd->SetDefaultUnit("degree");
141  MinPhiCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
142 
143  MaxPhiCmd = new G4UIcmdWithADoubleAndUnit("/MagneticField/SetMaxPhi",this);
144  MaxPhiCmd->SetGuidance("Set the maximum phi of the field map grid to be read");
145  MaxPhiCmd->SetParameterName("max_phi",false);
146  MaxPhiCmd->SetDefaultUnit("degree");
147  MaxPhiCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
148 
149  StepPhiCmd = new G4UIcmdWithADoubleAndUnit("/MagneticField/SetStepPhi",this);
150  StepPhiCmd->SetGuidance("Set the step phi of the field map grid to be read");
151  StepPhiCmd->SetParameterName("step_phi",false);
152  StepPhiCmd->SetDefaultUnit("degree");
153  StepPhiCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
154 
155  WrapPhiCmd = new G4UIcmdWithAnInteger("/MagneticField/SetWrapPhi",this);
156  WrapPhiCmd->SetGuidance("Set the wrap in phi of the field map grid to be read");
157  WrapPhiCmd->SetParameterName("wrap_phi",false);
158  WrapPhiCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
159 
160 
161  StepperCmd = new G4UIcmdWithAnInteger("/MagneticField/SetStepperType",this);
162  StepperCmd->SetGuidance("Select stepper type for magnetic field");
163  StepperCmd->SetParameterName("choice",true);
164  StepperCmd->SetDefaultValue(4);
165  StepperCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
166 
167  MinStepCmd = new G4UIcmdWithADoubleAndUnit("/MagneticField/SetMinStep",this);
168  MinStepCmd->SetGuidance("Define minimal step");
169  MinStepCmd->SetParameterName("min step",false,false);
170  MinStepCmd->SetDefaultUnit("mm");
171  MinStepCmd->AvailableForStates(G4State_Idle);
172 
173  UpdateCmd = new G4UIcmdWithoutParameter("/MagneticField/Update",this);
174  UpdateCmd->SetGuidance("Update Main Magnet geometry.");
175  UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
176  UpdateCmd->SetGuidance("if you changed geometrical value(s).");
177  UpdateCmd->AvailableForStates(G4State_Idle);
178 
179 }
G4UIcmdWith3VectorAndUnit * TranslationVectorCmd
QweakSimMagneticFieldMessenger::~QweakSimMagneticFieldMessenger ( )

Definition at line 182 of file QweakSimMagneticFieldMessenger.cc.

References ActCurrentCmd, MagneticFieldDir, MaxPhiCmd, MaxRCmd, MaxZCmd, MinPhiCmd, MinRCmd, MinStepCmd, MinZCmd, RefCurrentCmd, RotationCmd, ScaleCmd, StepperCmd, StepPhiCmd, StepRCmd, StepZCmd, TranslationCmd, TranslationVectorCmd, UpdateCmd, and WrapPhiCmd.

183 {
184 
185  delete ScaleCmd;
186  delete RefCurrentCmd;
187  delete ActCurrentCmd;
188 
189  delete MinZCmd;
190  delete MaxZCmd;
191  delete StepZCmd;
192 
193  delete MinRCmd;
194  delete MaxRCmd;
195  delete StepRCmd;
196 
197  delete MinPhiCmd;
198  delete MaxPhiCmd;
199  delete StepPhiCmd;
200  delete WrapPhiCmd;
201 
202  delete RotationCmd;
203  delete TranslationCmd;
204  delete TranslationVectorCmd;
205 
206  delete StepperCmd;
207  delete MinStepCmd;
208  delete UpdateCmd;
209 
210  delete MagneticFieldDir;
211 }
G4UIcmdWith3VectorAndUnit * TranslationVectorCmd

Member Function Documentation

void QweakSimMagneticFieldMessenger::SetNewValue ( G4UIcommand *  command,
G4String  newValue 
)

Definition at line 214 of file QweakSimMagneticFieldMessenger.cc.

References ActCurrentCmd, fMagneticField, MaxPhiCmd, MaxRCmd, MaxZCmd, MinPhiCmd, MinRCmd, MinZCmd, PrintCmd, QweakSimMagneticField::PrintFieldValue(), ReadCmd, QweakSimMagneticField::ReadFieldMap(), RefCurrentCmd, RotationCmd, ScaleCmd, QweakSimMagneticField::SetActualCurrent(), QweakSimMagneticField::SetMaximum(), QweakSimMagneticField::SetMinimum(), QweakSimMagneticField::SetReferenceCurrent(), QweakSimMagneticField::SetRotation(), QweakSimMagneticField::SetScaleFactor(), QweakSimMagneticField::SetStep(), QweakSimMagneticField::SetTranslation(), QweakSimMagneticField::SetTranslationVector(), QweakSimMagneticField::SetWrap(), StepPhiCmd, StepRCmd, StepZCmd, TranslationCmd, TranslationVectorCmd, and WrapPhiCmd.

215 {
216  if (command == ScaleCmd) {
217  fMagneticField->SetScaleFactor(ScaleCmd->GetNewDoubleValue(newValue));
218  } else if (command == ActCurrentCmd) {
219  fMagneticField->SetActualCurrent(ScaleCmd->GetNewDoubleValue(newValue));
220  } else if (command == RefCurrentCmd) {
221  fMagneticField->SetReferenceCurrent(ScaleCmd->GetNewDoubleValue(newValue));
222  } else if (command == MinZCmd) {
223  fMagneticField->SetMinimum(MinZCmd->GetNewDoubleValue(newValue)/cm,0);
224  } else if (command == MinRCmd) {
225  fMagneticField->SetMinimum(MinRCmd->GetNewDoubleValue(newValue)/cm,1);
226  } else if (command == MinPhiCmd) {
227  fMagneticField->SetMinimum(MinPhiCmd->GetNewDoubleValue(newValue)/radian,2);
228  } else if (command == MaxZCmd) {
229  fMagneticField->SetMaximum(MaxZCmd->GetNewDoubleValue(newValue)/cm,0);
230  } else if (command == MaxRCmd) {
231  fMagneticField->SetMaximum(MaxRCmd->GetNewDoubleValue(newValue)/cm,1);
232  } else if (command == MaxPhiCmd) {
233  fMagneticField->SetMaximum(MaxPhiCmd->GetNewDoubleValue(newValue)/radian,2);
234  } else if (command == StepZCmd) {
235  fMagneticField->SetStep(StepZCmd->GetNewDoubleValue(newValue)/cm,0);
236  } else if (command == StepRCmd) {
237  fMagneticField->SetStep(StepRCmd->GetNewDoubleValue(newValue)/cm,1);
238  } else if (command == StepPhiCmd) {
239  fMagneticField->SetStep(StepPhiCmd->GetNewDoubleValue(newValue)/radian,2);
240  } else if (command == WrapPhiCmd) {
241  fMagneticField->SetWrap(WrapPhiCmd->GetNewIntValue(newValue),2);
242  } else if (command == RotationCmd) {
243  fMagneticField->SetRotation(RotationCmd->GetNewDoubleValue(newValue));
244  } else if (command == TranslationCmd) {
245  fMagneticField->SetTranslation(TranslationCmd->GetNewDoubleValue(newValue));
246  } else if (command == TranslationVectorCmd) {
247  fMagneticField->SetTranslationVector(TranslationVectorCmd->GetNew3VectorValue(newValue));
248  } else if (command == PrintCmd) {
249  G4ThreeVector vector = PrintCmd->GetNew3VectorValue(newValue);
250  G4double point[4];
251  point[0] = vector.x();
252  point[1] = vector.y();
253  point[2] = vector.z();
254  point[3] = 0.0;
256  } else if (command == ReadCmd) {
257  fMagneticField->ReadFieldMap(newValue);
258  }
259 }
void SetTranslationVector(const G4ThreeVector translationvector)
Set the field translation vector.
void SetTranslation(const double translation)
Set the field translation along z.
void SetWrap(const int value, const int i)
Set the wrap.
void SetReferenceCurrent(const double referencecurrent)
Set the reference current.
void ReadFieldMap(const G4String &filename)
Read the field map.
void SetScaleFactor(const double scalefactor)
Set the scale factor.
void SetStep(const double value, const int i)
Set the step.
G4UIcmdWith3VectorAndUnit * TranslationVectorCmd
void SetRotation(const double rotation)
Set the field rotation around z.
void SetMaximum(const double value, const int i)
Set the maximum.
void PrintFieldValue(const G4double point[4]) const
Print the field value.
void SetMinimum(const double value, const int i)
Set the minimum.
void SetActualCurrent(const double actualcurrent)
Set the actual current.

+ Here is the call graph for this function:

Field Documentation

G4UIcmdWithADouble* QweakSimMagneticFieldMessenger::ActCurrentCmd
private
QweakSimMagneticField* QweakSimMagneticFieldMessenger::fMagneticField
private

Definition at line 74 of file QweakSimMagneticFieldMessenger.hh.

Referenced by SetNewValue().

G4UIdirectory* QweakSimMagneticFieldMessenger::MagneticFieldDir
private
G4UIcmdWithADoubleAndUnit* QweakSimMagneticFieldMessenger::MaxPhiCmd
private
G4UIcmdWithADoubleAndUnit* QweakSimMagneticFieldMessenger::MaxRCmd
private
G4UIcmdWithADoubleAndUnit* QweakSimMagneticFieldMessenger::MaxZCmd
private
G4UIcmdWithADoubleAndUnit* QweakSimMagneticFieldMessenger::MinPhiCmd
private
G4UIcmdWithADoubleAndUnit* QweakSimMagneticFieldMessenger::MinRCmd
private
G4UIcmdWithADoubleAndUnit* QweakSimMagneticFieldMessenger::MinStepCmd
private
G4UIcmdWithADoubleAndUnit* QweakSimMagneticFieldMessenger::MinZCmd
private
G4UIcmdWith3VectorAndUnit* QweakSimMagneticFieldMessenger::PrintCmd
private
G4UIcmdWithAString* QweakSimMagneticFieldMessenger::ReadCmd
private
G4UIcmdWithADouble* QweakSimMagneticFieldMessenger::RefCurrentCmd
private
G4UIcmdWithADoubleAndUnit* QweakSimMagneticFieldMessenger::RotationCmd
private
G4UIcmdWithADouble* QweakSimMagneticFieldMessenger::ScaleCmd
private
G4UIcmdWithAnInteger* QweakSimMagneticFieldMessenger::StepperCmd
private
G4UIcmdWithADoubleAndUnit* QweakSimMagneticFieldMessenger::StepPhiCmd
private
G4UIcmdWithADoubleAndUnit* QweakSimMagneticFieldMessenger::StepRCmd
private
G4UIcmdWithADoubleAndUnit* QweakSimMagneticFieldMessenger::StepZCmd
private
G4UIcmdWithADoubleAndUnit* QweakSimMagneticFieldMessenger::TranslationCmd
private
G4UIcmdWith3VectorAndUnit* QweakSimMagneticFieldMessenger::TranslationVectorCmd
private
G4UIcmdWithoutParameter* QweakSimMagneticFieldMessenger::UpdateCmd
private
G4UIcmdWithAnInteger* QweakSimMagneticFieldMessenger::WrapPhiCmd
private

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