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

A class for control of the Electric Field of the detector. More...

#include <Doxymodules_field.h>

Public Member Functions

 F02ElectricFieldSetup (G4ThreeVector)
 
 F02ElectricFieldSetup ()
 
virtual ~F02ElectricFieldSetup ()
 
void SetStepperType (G4int i)
 
void SetMinStep (G4double s)
 
void SetFieldValue (G4ThreeVector fieldVector)
 
void SetFieldZValue (G4double fieldValue)
 
G4ThreeVector GetConstantFieldValue ()
 
void UpdateIntegrator ()
 

Protected Member Functions

G4FieldManagerGetGlobalFieldManager ()
 
void CreateStepper ()
 

Private Attributes

G4double fMinStep = 0.010 * CLHEP::mm
 
G4FieldManagerfFieldManager = nullptr
 
G4ChordFinderfChordFinder = nullptr
 
G4EqMagElectricFieldfEquation = nullptr
 
G4ElectricFieldfEMfield = nullptr
 
G4ThreeVector fElFieldValue
 
G4MagIntegratorStepperfStepper = nullptr
 
G4MagInt_DriverfIntgrDriver = nullptr
 
G4int fStepperType = 4
 
F02FieldMessengerfFieldMessenger = nullptr
 

Detailed Description

A class for control of the Electric Field of the detector.

The field for this case is uniform.

The field for this case is uniform. It is simply a 'setup' class that creates the field and necessary other parts

Definition at line 59 of file Doxymodules_field.h.

Constructor & Destructor Documentation

◆ F02ElectricFieldSetup() [1/2]

F02ElectricFieldSetup::F02ElectricFieldSetup ( G4ThreeVector  fieldVector)

◆ F02ElectricFieldSetup() [2/2]

F02ElectricFieldSetup::F02ElectricFieldSetup ( )

Definition at line 70 of file F02ElectricFieldSetup.cc.

71{
73 G4ThreeVector(0.0,100000.0*kilovolt/cm,0.0));
75
77
80}

◆ ~F02ElectricFieldSetup()

F02ElectricFieldSetup::~F02ElectricFieldSetup ( )
virtual

Definition at line 97 of file F02ElectricFieldSetup.cc.

98{
99 // G4cout << " F02ElectricFieldSetup - dtor called. " << G4endl;
100
101 delete fFieldMessenger; fFieldMessenger= nullptr;
102 // Delete the messenger first, to avoid messages to deleted classes!
103
104 delete fChordFinder; fChordFinder= nullptr;
105 delete fStepper; fStepper = nullptr;
106 delete fEquation; fEquation = nullptr;
107 delete fEMfield; fEMfield = nullptr;
108}
G4MagIntegratorStepper * fStepper

Member Function Documentation

◆ SetStepperType()

void F02ElectricFieldSetup::SetStepperType ( G4int  i)
inline

◆ SetMinStep()

void F02ElectricFieldSetup::SetMinStep ( G4double  s)
inline

Definition at line 70 of file F02ElectricFieldSetup.hh.

◆ SetFieldValue()

void F02ElectricFieldSetup::SetFieldValue ( G4ThreeVector  fieldVector)

Definition at line 243 of file F02ElectricFieldSetup.cc.

244{
245 delete fEMfield;
246
247 // Set the value of the Global Field value to fieldVector
248
249 // Find the Field Manager for the global field
251
252 if (fieldVector != G4ThreeVector(0.,0.,0.))
253 {
254 fEMfield = new G4UniformElectricField(fieldVector);
255 }
256 else
257 {
258 // If the new field's value is Zero, then it is best to
259 // insure that it is not used for propagation.
260 fEMfield = nullptr;
261 }
262 fieldMgr->SetDetectorField(fEMfield);
263 fEquation->SetFieldObj(fEMfield); // must now point to the new field
264}

◆ SetFieldZValue()

void F02ElectricFieldSetup::SetFieldZValue ( G4double  fieldValue)

Definition at line 232 of file F02ElectricFieldSetup.cc.

233{
234 // Set the value of the Global Field to fieldValue along Z
235
236 G4ThreeVector fieldVector( 0.0, 0.0, fieldValue );
237
238 SetFieldValue( fieldVector );
239}
void SetFieldValue(G4ThreeVector fieldVector)

◆ GetConstantFieldValue()

G4ThreeVector F02ElectricFieldSetup::GetConstantFieldValue ( )

◆ UpdateIntegrator()

void F02ElectricFieldSetup::UpdateIntegrator ( )

Definition at line 112 of file F02ElectricFieldSetup.cc.

113{
114 // Register this field to 'global' Field Manager and
115 // Create Stepper and Chord Finder with predefined type, minstep (resp.)
116
117 // It must be possible to call 'again' after an alternative stepper
118 // has been chosen, or other changes have been made
119 assert(fEquation!=nullptr);
120
121 G4cout<< " F02ElectricFieldSetup: The minimal step is equal to "
122 << fMinStep/mm << " mm" << G4endl;
123
124 if (fChordFinder) {
125 delete fChordFinder;
126 fChordFinder= nullptr;
127 // The chord-finder's destructor deletes the driver
128 fIntgrDriver= nullptr;
129 }
130
131 // Currently driver does not 'own' stepper ( 17.05.2017 J.A. )
132 // -- so this stepper is still a valid object after this
133
134 if( fStepper ) {
135 delete fStepper;
136 fStepper = nullptr;
137 }
138
139 // Create the new objects, in turn for all relevant classes
140 // -- Careful to call this after all old objects are destroyed, and
141 // pointers nullified.
142 CreateStepper(); // Note that this method deleted the existing Stepper!
143 // G4cout << "F02ElectricFieldSetup::UpdateIntegrator> "
144 // << "New value of stepper ptr= " << fStepper << G4endl;
145 assert(fStepper != nullptr);
146
147 if( fStepper ) {
149 fStepper,
150 fStepper->GetNumberOfVariables());
151 if( fIntgrDriver ){
153 }
154 }
155
156 fFieldManager->SetChordFinder(fChordFinder);
157 fFieldManager->SetDetectorField(fEMfield);
158}

◆ GetGlobalFieldManager()

G4FieldManager * F02ElectricFieldSetup::GetGlobalFieldManager ( )
protected

Definition at line 268 of file F02ElectricFieldSetup.cc.

269{
270// Utility method
271
272 return G4TransportationManager::GetTransportationManager()
273 ->GetFieldManager();
274}

◆ CreateStepper()

void F02ElectricFieldSetup::CreateStepper ( )
protected

Definition at line 162 of file F02ElectricFieldSetup.cc.

163{
164 // Deletes the existing stepper
165 // and creates a new stepper object of the chosen stepper type
166
167 const G4int nvar = 8;
168
169 auto oldStepper= fStepper;
170
171 switch ( fStepperType )
172 {
173 case 0:
174 fStepper = new G4ExplicitEuler( fEquation, nvar );
175 G4cout<<"G4ExplicitEuler is calledS"<<G4endl;
176 break;
177 case 1:
178 fStepper = new G4ImplicitEuler( fEquation, nvar );
179 G4cout<<"G4ImplicitEuler is called"<<G4endl;
180 break;
181 case 2:
182 fStepper = new G4SimpleRunge( fEquation, nvar );
183 G4cout<<"G4SimpleRunge is called"<<G4endl;
184 break;
185 case 3:
186 fStepper = new G4SimpleHeum( fEquation, nvar );
187 G4cout<<"G4SimpleHeum is called"<<G4endl;
188 break;
189 case 4:
190 fStepper = new G4ClassicalRK4( fEquation, nvar );
191 G4cout<<"G4ClassicalRK4 is called"<<G4endl;
192 break;
193 case 5:
194 fStepper = new G4CashKarpRKF45( fEquation, nvar );
195 G4cout<<"G4CashKarpRKF45 is called"<<G4endl;
196 break;
197 case 6:
198 fStepper = nullptr; // new G4RKG3_Stepper( fEquation, nvar );
199 G4cout<<"G4RKG3_Stepper is not currently working for Electric Field"
200 <<G4endl;
201 break;
202 case 7:
203 fStepper = nullptr; // new G4HelixExplicitEuler( fEquation );
204 G4cout<<"G4HelixExplicitEuler is not valid for Electric Field"<<G4endl;
205 break;
206 case 8:
207 fStepper = nullptr; // new G4HelixImplicitEuler( fEquation );
208 G4cout<<"G4HelixImplicitEuler is not valid for Electric Field"<<G4endl;
209 break;
210 case 9:
211 fStepper = nullptr; // new G4HelixSimpleRunge( fEquation );
212 G4cout<<"G4HelixSimpleRunge is not valid for Electric Field"<<G4endl;
213 break;
214 default: /* fStepper = 0; // Older code */
215 fStepper = new G4ClassicalRK4( fEquation, nvar );
216 G4cout<<"G4ClassicalRK4 (default) is called"<<G4endl;
217 break;
218 }
219
220 delete oldStepper;
221 // Now must make sure it is 'stripped' from the dependent object(s)
222 // ... but the next line does this anyway - by informing
223 // the driver (if it exists) about the new stepper.
224
225 // Always inform the (existing) driver about the new stepper
226 if( fIntgrDriver )
227 fIntgrDriver->RenewStepperAndAdjust( fStepper );
228}

Member Data Documentation

◆ fMinStep

G4double F02ElectricFieldSetup::fMinStep = 0.010 * CLHEP::mm
private

Definition at line 92 of file F02ElectricFieldSetup.hh.

◆ fFieldManager

G4FieldManager* F02ElectricFieldSetup::fFieldManager = nullptr
private

Definition at line 94 of file F02ElectricFieldSetup.hh.

◆ fChordFinder

G4ChordFinder* F02ElectricFieldSetup::fChordFinder = nullptr
private

Definition at line 95 of file F02ElectricFieldSetup.hh.

◆ fEquation

G4EqMagElectricField* F02ElectricFieldSetup::fEquation = nullptr
private

Definition at line 96 of file F02ElectricFieldSetup.hh.

◆ fEMfield

G4ElectricField* F02ElectricFieldSetup::fEMfield = nullptr
private

Definition at line 97 of file F02ElectricFieldSetup.hh.

◆ fElFieldValue

G4ThreeVector F02ElectricFieldSetup::fElFieldValue
private

Definition at line 99 of file F02ElectricFieldSetup.hh.

◆ fStepper

G4MagIntegratorStepper* F02ElectricFieldSetup::fStepper = nullptr
private

Definition at line 101 of file F02ElectricFieldSetup.hh.

◆ fIntgrDriver

G4MagInt_Driver* F02ElectricFieldSetup::fIntgrDriver = nullptr
private

Definition at line 102 of file F02ElectricFieldSetup.hh.

◆ fStepperType

G4int F02ElectricFieldSetup::fStepperType = 4
private

Definition at line 104 of file F02ElectricFieldSetup.hh.

◆ fFieldMessenger

F02FieldMessenger* F02ElectricFieldSetup::fFieldMessenger = nullptr
private

Definition at line 106 of file F02ElectricFieldSetup.hh.


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

Applications | User Support | Publications | Collaboration