Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
F03FieldSetup Class Reference

A class for setting up the Magnetic Field. More...

#include <Doxymodules_field.h>

Public Member Functions

 F03FieldSetup ()
 
virtual ~F03FieldSetup ()
 
void SetStepperType (G4int i)
 
void CreateSteppers ()
 
void SetMinStep (G4double s)
 
void SetFieldValue (G4ThreeVector fieldVector)
 
void SetFieldZValue (G4double fieldValue)
 
void SetLocalFieldValue (G4ThreeVector fieldVector)
 
G4ThreeVector GetGlobalFieldValue () const
 
G4ThreeVector GetLocalFieldValue () const
 
void UpdateField ()
 
G4FieldManagerGetLocalFieldManager ()
 

Protected Member Functions

G4FieldManagerGetGlobalFieldManager ()
 
G4ThreeVector GetConstantFieldValue (G4MagneticField *magneticField) const
 

Protected Attributes

G4FieldManagerfFieldManager = nullptr
 
G4FieldManagerfLocalFieldManager = nullptr
 
G4ChordFinderfChordFinder = nullptr
 
G4ChordFinderfLocalChordFinder = nullptr
 
G4Mag_UsualEqRhsfEquation = nullptr
 
G4Mag_UsualEqRhsfLocalEquation = nullptr
 
G4MagneticFieldfMagneticField = nullptr
 
G4MagneticFieldfLocalMagneticField = nullptr
 
G4MagIntegratorStepperfStepper = nullptr
 
G4MagIntegratorStepperfLocalStepper = nullptr
 
G4int fStepperType = 4
 
G4double fMinStep = 0.25 * CLHEP::mm
 
F03FieldMessengerfFieldMessenger = nullptr
 

Detailed Description

A class for setting up the Magnetic Field.

It also creates the necessary classes to control accuracy of propagation. In this example

Definition at line 84 of file Doxymodules_field.h.

Constructor & Destructor Documentation

◆ F03FieldSetup()

F03FieldSetup::F03FieldSetup ( )

Definition at line 65 of file F03FieldSetup.cc.

66{
67 fMagneticField = new G4UniformMagField(G4ThreeVector(3.3*tesla,
68 0.0, // 0.5*tesla,
69 0.0));
70 fLocalMagneticField = new G4UniformMagField(G4ThreeVector(3.3*tesla,
71 0.0, // 0.5*tesla,
72 0.0));
73
75
78
81
83}
F03FieldMessenger * fFieldMessenger
G4Mag_UsualEqRhs * fLocalEquation
G4FieldManager * fFieldManager
G4MagneticField * fMagneticField
G4FieldManager * GetGlobalFieldManager()
G4Mag_UsualEqRhs * fEquation
G4FieldManager * fLocalFieldManager
G4MagneticField * fLocalMagneticField

◆ ~F03FieldSetup()

F03FieldSetup::~F03FieldSetup ( )
virtual

Definition at line 87 of file F03FieldSetup.cc.

88{
89 delete fMagneticField;
90 delete fChordFinder;
91 delete fStepper;
92 delete fFieldMessenger;
93}
G4ChordFinder * fChordFinder
G4MagIntegratorStepper * fStepper

Member Function Documentation

◆ SetStepperType()

void F03FieldSetup::SetStepperType ( G4int  i)
inline

Definition at line 63 of file F03FieldSetup.hh.

63{ fStepperType = i; }

◆ CreateSteppers()

void F03FieldSetup::CreateSteppers ( )

Definition at line 132 of file F03FieldSetup.cc.

133{
134 delete fStepper;
135 fStepper= nullptr;
136
137 delete fLocalStepper;
138 fLocalStepper= nullptr;
139
140 switch ( fStepperType )
141 {
142 case 0:
145 G4cout<<"G4ExplicitEuler is called"<<G4endl;
146 break;
147 case 1:
150 G4cout<<"G4ImplicitEuler is called"<<G4endl;
151 break;
152 case 2:
155 G4cout<<"G4SimpleRunge is called"<<G4endl;
156 break;
157 case 3:
160 G4cout<<"G4SimpleHeum is called"<<G4endl;
161 break;
162 case 4:
165 G4cout<<"G4ClassicalRK4 (default) is called"<<G4endl;
166 break;
167 case 5:
170 G4cout<<"G4HelixExplicitEuler is called"<<G4endl;
171 break;
172 case 6:
175 G4cout<<"G4HelixImplicitEuler is called"<<G4endl;
176 break;
177 case 7:
180 G4cout<<"G4HelixSimpleRunge is called"<<G4endl;
181 break;
182 case 8:
185 G4cout<<"G4CashKarpRKF45 is called"<<G4endl;
186 break;
187 case 9:
190 G4cout<<"G4RKG3_Stepper is called"<<G4endl;
191 break;
192 default: fStepper = nullptr;
193 }
194}
G4MagIntegratorStepper * fLocalStepper

◆ SetMinStep()

void F03FieldSetup::SetMinStep ( G4double  s)
inline

Definition at line 67 of file F03FieldSetup.hh.

67{ fMinStep = s; }
G4double fMinStep

◆ SetFieldValue()

void F03FieldSetup::SetFieldValue ( G4ThreeVector  fieldVector)

Definition at line 206 of file F03FieldSetup.cc.

207{
208 delete fMagneticField;
209
210 if(fieldVector != G4ThreeVector(0.,0.,0.))
211 {
212 fMagneticField = new G4UniformMagField(fieldVector);
213 }
214 else
215 {
216 // If the new field's value is Zero, then
217 // setting the pointer to zero ensures
218 // that it is not used for propagation.
219 fMagneticField = nullptr;
220 }
221
222 // Either
223 // - UpdateField() to reset all (ChordFinder, Equation);
224 // UpdateField();
225 // or simply update the field manager & equation of motion
226 // with pointer to new field
227 GetGlobalFieldManager()->SetDetectorField(fMagneticField);
228 fEquation->SetFieldObj( fMagneticField );
229
230}

◆ SetFieldZValue()

void F03FieldSetup::SetFieldZValue ( G4double  fieldValue)

Definition at line 198 of file F03FieldSetup.cc.

199{
200 G4ThreeVector fieldSetVec(0.0, 0.0, fieldStrength);
201 SetFieldValue( fieldSetVec );
202}
void SetFieldValue(G4ThreeVector fieldVector)

◆ SetLocalFieldValue()

void F03FieldSetup::SetLocalFieldValue ( G4ThreeVector  fieldVector)

Definition at line 234 of file F03FieldSetup.cc.

235{
236 delete fLocalMagneticField;
237
238 if(fieldVector != G4ThreeVector(0.,0.,0.))
239 {
240 fLocalMagneticField = new G4UniformMagField(fieldVector);
241 }
242 else
243 {
244 // If the new field's value is Zero, then
245 // setting the pointer to zero ensures
246 // that it is not used for propagation.
247 fLocalMagneticField = nullptr;
248 }
249
250 // Either
251 // - UpdateField() to reset all (ChordFinder, Equation);
252 // UpdateField();
253 // or simply update the field manager & equation of motion
254 // with pointer to new field
255 GetLocalFieldManager()->SetDetectorField(fLocalMagneticField);
256 fEquation->SetFieldObj( fLocalMagneticField );
257}
G4FieldManager * GetLocalFieldManager()

◆ GetGlobalFieldValue()

G4ThreeVector F03FieldSetup::GetGlobalFieldValue ( ) const
inline

Definition at line 72 of file F03FieldSetup.hh.

G4ThreeVector GetConstantFieldValue(G4MagneticField *magneticField) const

◆ GetLocalFieldValue()

G4ThreeVector F03FieldSetup::GetLocalFieldValue ( ) const
inline

Definition at line 73 of file F03FieldSetup.hh.

◆ UpdateField()

void F03FieldSetup::UpdateField ( )

Definition at line 97 of file F03FieldSetup.cc.

98{
99 // It must be possible to call 'again' - e.g. to choose an alternative stepper
100 // has been chosen, or in case other changes have been made.
101
102 // 1. First clean up previous state.
103 delete fChordFinder;
104 fChordFinder= nullptr;
105 delete fLocalChordFinder;
106 fLocalChordFinder= nullptr;
107
108 G4cout<<"F03FieldSetup::UpdateField> The minimal step is equal to "
109 << fMinStep/mm <<" mm"<<G4endl;
110 G4cout<<" Stepper Type chosen = " << fStepperType
111 << G4endl;
112
113 // 2. Create the steppers ( Note: this also deletes the previous ones. )
115
116
117 // 3. Create the chord finder(s)
121
122 fFieldManager->SetChordFinder(fChordFinder);
123 fLocalFieldManager->SetChordFinder(fLocalChordFinder);
124
125 // 4. Ensure that the field is updated (in Field manager & equation)
126 fFieldManager->SetDetectorField(fMagneticField);
127 fLocalFieldManager->SetDetectorField(fLocalMagneticField);
128}
G4ChordFinder * fLocalChordFinder

◆ GetLocalFieldManager()

G4FieldManager * F03FieldSetup::GetLocalFieldManager ( )
inline

Definition at line 77 of file F03FieldSetup.hh.

77{ return fLocalFieldManager;}

◆ GetGlobalFieldManager()

G4FieldManager * F03FieldSetup::GetGlobalFieldManager ( )
protected

Definition at line 261 of file F03FieldSetup.cc.

262{
263 return G4TransportationManager::GetTransportationManager()
264 ->GetFieldManager();
265}

◆ GetConstantFieldValue()

G4ThreeVector F03FieldSetup::GetConstantFieldValue ( G4MagneticField magneticField) const
protected

Definition at line 269 of file F03FieldSetup.cc.

270{
271 if ( ! magneticField ) return G4ThreeVector();
272
273 static G4double fieldValue[6], position[4];
274 position[0] = position[1] = position[2] = position[3] = 0.0;
275
276 magneticField->GetFieldValue( position, fieldValue);
277 G4ThreeVector fieldVec(fieldValue[0], fieldValue[1], fieldValue[2]);
278
279 return fieldVec;
280}

Member Data Documentation

◆ fFieldManager

G4FieldManager* F03FieldSetup::fFieldManager = nullptr
protected

Definition at line 85 of file F03FieldSetup.hh.

◆ fLocalFieldManager

G4FieldManager* F03FieldSetup::fLocalFieldManager = nullptr
protected

Definition at line 86 of file F03FieldSetup.hh.

◆ fChordFinder

G4ChordFinder* F03FieldSetup::fChordFinder = nullptr
protected

Definition at line 87 of file F03FieldSetup.hh.

◆ fLocalChordFinder

G4ChordFinder* F03FieldSetup::fLocalChordFinder = nullptr
protected

Definition at line 88 of file F03FieldSetup.hh.

◆ fEquation

G4Mag_UsualEqRhs* F03FieldSetup::fEquation = nullptr
protected

Definition at line 89 of file F03FieldSetup.hh.

◆ fLocalEquation

G4Mag_UsualEqRhs* F03FieldSetup::fLocalEquation = nullptr
protected

Definition at line 90 of file F03FieldSetup.hh.

◆ fMagneticField

G4MagneticField* F03FieldSetup::fMagneticField = nullptr
protected

Definition at line 91 of file F03FieldSetup.hh.

◆ fLocalMagneticField

G4MagneticField* F03FieldSetup::fLocalMagneticField = nullptr
protected

Definition at line 92 of file F03FieldSetup.hh.

◆ fStepper

G4MagIntegratorStepper* F03FieldSetup::fStepper = nullptr
protected

Definition at line 94 of file F03FieldSetup.hh.

◆ fLocalStepper

G4MagIntegratorStepper* F03FieldSetup::fLocalStepper = nullptr
protected

Definition at line 95 of file F03FieldSetup.hh.

◆ fStepperType

G4int F03FieldSetup::fStepperType = 4
protected

Definition at line 96 of file F03FieldSetup.hh.

◆ fMinStep

G4double F03FieldSetup::fMinStep = 0.25 * CLHEP::mm
protected

Definition at line 98 of file F03FieldSetup.hh.

◆ fFieldMessenger

F03FieldMessenger* F03FieldSetup::fFieldMessenger = nullptr
protected

Definition at line 100 of file F03FieldSetup.hh.


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

Applications | User Support | Publications | Collaboration