Public Member Functions | Protected Member Functions | Private Attributes | List of all members
EDepSim::EMFieldSetup Class Reference

#include <EDepSimEMFieldSetup.hh>

Public Member Functions

 EMFieldSetup (G4ElectroMagneticField *field, G4FieldManager *m=0)
 
 EMFieldSetup (G4FieldManager *m=0)
 Create a zero field for the field manager. More...
 
virtual ~EMFieldSetup ()
 
void SetStepperType (G4int i)
 
void SetStepper ()
 
void SetMinStep (G4double s)
 

Protected Member Functions

G4FieldManager * GetGlobalFieldManager ()
 
void UpdateField ()
 

Private Attributes

G4FieldManager * fFieldManager
 
G4ChordFinder * fChordFinder
 
G4EqMagElectricField * fEquation
 
G4ElectroMagneticField * fEMfield
 
G4MagIntegratorStepper * fStepper
 
G4MagInt_Driver * fIntgrDriver
 
G4int fStepperType
 
G4double fMinStep
 

Detailed Description

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

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

Definition at line 58 of file EDepSimEMFieldSetup.hh.

Constructor & Destructor Documentation

EDepSim::EMFieldSetup::EMFieldSetup ( G4ElectroMagneticField *  field,
G4FieldManager *  m = 0 
)

Create a new field. The first argument is a general EM field (for example, G4UniformMagneticField, or G4UniformElectricField. The second argument is the field manager to setup.

Definition at line 90 of file EDepSimEMFieldSetup.cc.

92  : fFieldManager(fieldManager),
93  fChordFinder(0),
94  fEquation(0),
95  fEMfield(field),
96  fStepper(0),
97  fIntgrDriver(0),
98  fStepperType(4), // ClassicalRK4 -- the default stepper
99  fMinStep(0.010*mm) // minimal step of 10 microns
100 {
101  fEquation = new G4EqMagElectricField(fEMfield);
102 
103  UpdateField();
104 }
G4EqMagElectricField * fEquation
G4ChordFinder * fChordFinder
G4FieldManager * fFieldManager
G4MagIntegratorStepper * fStepper
G4MagInt_Driver * fIntgrDriver
G4ElectroMagneticField * fEMfield
static constexpr double mm
Definition: Units.h:65
EDepSim::EMFieldSetup::EMFieldSetup ( G4FieldManager *  m = 0)

Create a zero field for the field manager.

Definition at line 72 of file EDepSimEMFieldSetup.cc.

73  : fFieldManager(fieldManager),
74  fChordFinder(0),
75  fEquation(0),
76  fEMfield(0),
77  fStepper(0),
78  fIntgrDriver(0),
79  fStepperType(4), // ClassicalRK4 -- the default stepper
80  fMinStep(0.010*mm) // minimal step of 10 microns
81 {
82  fEMfield = new G4UniformElectricField(G4ThreeVector(0.0,500.0*volt/cm,0.0));
83  fEquation = new G4EqMagElectricField(fEMfield);
84 
85  UpdateField();
86 }
static constexpr double cm
Definition: Units.h:68
G4EqMagElectricField * fEquation
G4ChordFinder * fChordFinder
volt_as<> volt
Type of potential stored in volts, in double precision.
G4FieldManager * fFieldManager
G4MagIntegratorStepper * fStepper
G4MagInt_Driver * fIntgrDriver
G4ElectroMagneticField * fEMfield
static constexpr double mm
Definition: Units.h:65
EDepSim::EMFieldSetup::~EMFieldSetup ( )
virtual

Definition at line 108 of file EDepSimEMFieldSetup.cc.

109 {
110  delete fChordFinder;
111  delete fStepper;
112  delete fEquation;
113  delete fEMfield;
114 }
G4EqMagElectricField * fEquation
G4ChordFinder * fChordFinder
G4MagIntegratorStepper * fStepper
G4ElectroMagneticField * fEMfield

Member Function Documentation

G4FieldManager * EDepSim::EMFieldSetup::GetGlobalFieldManager ( )
protected

Definition at line 201 of file EDepSimEMFieldSetup.cc.

202 {
203 // Utility method
204 
205  return G4TransportationManager::GetTransportationManager()
206  ->GetFieldManager();
207 }
void EDepSim::EMFieldSetup::SetMinStep ( G4double  s)
inline

Definition at line 75 of file EDepSimEMFieldSetup.hh.

75 { fMinStep = s ; }
static QCString * s
Definition: config.cpp:1042
void EDepSim::EMFieldSetup::SetStepper ( )

Definition at line 144 of file EDepSimEMFieldSetup.cc.

145 {
146 // Set stepper according to the stepper type
147 
148  G4int nvar = 8;
149 
150  if (fStepper) delete fStepper;
151 
152  switch ( fStepperType )
153  {
154  case 0:
155  fStepper = new G4ExplicitEuler( fEquation, nvar );
156  G4cout<<"G4ExplicitEuler is calledS"<<G4endl;
157  break;
158  case 1:
159  fStepper = new G4ImplicitEuler( fEquation, nvar );
160  G4cout<<"G4ImplicitEuler is called"<<G4endl;
161  break;
162  case 2:
163  fStepper = new G4SimpleRunge( fEquation, nvar );
164  G4cout<<"G4SimpleRunge is called"<<G4endl;
165  break;
166  case 3:
167  fStepper = new G4SimpleHeum( fEquation, nvar );
168  G4cout<<"G4SimpleHeum is called"<<G4endl;
169  break;
170  case 4:
171  fStepper = new G4ClassicalRK4( fEquation, nvar );
172  G4cout<<"G4ClassicalRK4 (default) is called"<<G4endl;
173  break;
174  case 5:
175  fStepper = new G4CashKarpRKF45( fEquation, nvar );
176  G4cout<<"G4CashKarpRKF45 is called"<<G4endl;
177  break;
178  case 6:
179  fStepper = 0; // new G4RKG3_Stepper( fEquation, nvar );
180  G4cout<<"G4RKG3_Stepper is not currently working for Electric Field"
181  <<G4endl;
182  break;
183  case 7:
184  fStepper = 0; // new G4HelixExplicitEuler( fEquation );
185  G4cout<<"G4HelixExplicitEuler is not valid for Electric Field"<<G4endl;
186  break;
187  case 8:
188  fStepper = 0; // new G4HelixImplicitEuler( fEquation );
189  G4cout<<"G4HelixImplicitEuler is not valid for Electric Field"<<G4endl;
190  break;
191  case 9:
192  fStepper = 0; // new G4HelixSimpleRunge( fEquation );
193  G4cout<<"G4HelixSimpleRunge is not valid for Electric Field"<<G4endl;
194  break;
195  default: fStepper = 0;
196  }
197 }
G4EqMagElectricField * fEquation
G4MagIntegratorStepper * fStepper
void EDepSim::EMFieldSetup::SetStepperType ( G4int  i)
inline

Definition at line 71 of file EDepSimEMFieldSetup.hh.

void EDepSim::EMFieldSetup::UpdateField ( )
protected

Definition at line 118 of file EDepSimEMFieldSetup.cc.

119 {
120  // Register this field to 'global' Field Manager and
121  // Create Stepper and Chord Finder with predefined type, minstep (resp.)
122 
124 
125  SetStepper();
126 
127  G4cout<<"The minimal step is equal to "<<fMinStep/mm<<" mm"<<G4endl;
128 
129  fFieldManager->SetDetectorField(fEMfield);
130 
131  if (fChordFinder) delete fChordFinder;
132 
133  fIntgrDriver = new G4MagInt_Driver(fMinStep,
134  fStepper,
135  fStepper->GetNumberOfVariables());
136 
137  fChordFinder = new G4ChordFinder(fIntgrDriver);
138 
139  fFieldManager->SetChordFinder(fChordFinder);
140 }
G4ChordFinder * fChordFinder
G4FieldManager * fFieldManager
G4MagIntegratorStepper * fStepper
G4MagInt_Driver * fIntgrDriver
G4ElectroMagneticField * fEMfield
static constexpr double mm
Definition: Units.h:65
G4FieldManager * GetGlobalFieldManager()

Member Data Documentation

G4ChordFinder* EDepSim::EMFieldSetup::fChordFinder
private

Definition at line 89 of file EDepSimEMFieldSetup.hh.

G4ElectroMagneticField* EDepSim::EMFieldSetup::fEMfield
private

Definition at line 93 of file EDepSimEMFieldSetup.hh.

G4EqMagElectricField* EDepSim::EMFieldSetup::fEquation
private

Definition at line 91 of file EDepSimEMFieldSetup.hh.

G4FieldManager* EDepSim::EMFieldSetup::fFieldManager
private

Definition at line 87 of file EDepSimEMFieldSetup.hh.

G4MagInt_Driver* EDepSim::EMFieldSetup::fIntgrDriver
private

Definition at line 96 of file EDepSimEMFieldSetup.hh.

G4double EDepSim::EMFieldSetup::fMinStep
private

Definition at line 100 of file EDepSimEMFieldSetup.hh.

G4MagIntegratorStepper* EDepSim::EMFieldSetup::fStepper
private

Definition at line 95 of file EDepSimEMFieldSetup.hh.

G4int EDepSim::EMFieldSetup::fStepperType
private

Definition at line 98 of file EDepSimEMFieldSetup.hh.


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