Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F04GlobalField Class Reference

#include <F04GlobalField.hh>

Inheritance diagram for F04GlobalField:
Collaboration diagram for F04GlobalField:

Public Member Functions

virtual ~F04GlobalField ()
 
virtual void GetFieldValue (const G4double *point, G4double *field) const
 
virtual G4bool DoesFieldChangeEnergy () const
 DoesFieldChangeEnergy() returns true. More...
 
void AddElementField (F04ElementField *f)
 
void Clear ()
 
void ConstructField ()
 constructs all field tracking objects More...
 
void SetStepperType (G4int i)
 Set the Stepper types. More...
 
void SetStepper ()
 Set the Stepper. More...
 
void SetMinStep (G4double stp)
 Set the minimum step length. More...
 
void SetDeltaChord (G4double dcr)
 Set the delta chord length. More...
 
void SetDeltaOneStep (G4double stp)
 Set the delta one step length. More...
 
void SetDeltaIntersection (G4double its)
 Set the delta intersection length. More...
 
void SetEpsMin (G4double eps)
 Set the minimum eps length. More...
 
void SetEpsMax (G4double eps)
 Set the maximum eps length. More...
 
FieldListGetFields ()
 Return the list of Element Fields. More...
 
- Public Member Functions inherited from G4ElectroMagneticField
 G4ElectroMagneticField ()
 
virtual ~G4ElectroMagneticField ()
 
 G4ElectroMagneticField (const G4ElectroMagneticField &r)
 
G4ElectroMagneticFieldoperator= (const G4ElectroMagneticField &p)
 
virtual void GetFieldValue (const G4double Point[4], G4double *Bfield) const =0
 
- Public Member Functions inherited from G4Field
 G4Field (G4bool gravityOn=false)
 
 G4Field (const G4Field &)
 
virtual ~G4Field ()
 
G4Fieldoperator= (const G4Field &p)
 
G4bool IsGravityActive () const
 
void SetGravityActive (G4bool OnOffFlag)
 
virtual G4FieldClone () const
 

Static Public Member Functions

static F04GlobalFieldGetObject (F04DetectorConstruction *const)
 
static F04GlobalFieldGetObject ()
 

Protected Member Functions

G4FieldManagerGetGlobalFieldManager ()
 Get the global field manager. More...
 

Detailed Description

Definition at line 68 of file F04GlobalField.hh.

Constructor & Destructor Documentation

F04GlobalField::~F04GlobalField ( )
virtual

Definition at line 91 of file F04GlobalField.cc.

92 {
93  Clear();
94 
95  delete fFields;
96 
97  delete fFieldMessenger;
98 
99  if (fEquation) delete fEquation;
100  if (fStepper) delete fStepper;
101  if (fChordFinder) delete fChordFinder;
102 }

Here is the call graph for this function:

Member Function Documentation

void F04GlobalField::AddElementField ( F04ElementField f)
inline

AddElementField() adds the ElementField object for a single element to the global field.

Definition at line 99 of file F04GlobalField.hh.

100  {
101  if (fFields) fFields->push_back(f);
102  }

Here is the caller graph for this function:

void F04GlobalField::Clear ( )

Clear() removes all ElementField-s from the global object, and destroys them. Used before the geometry is completely re-created.

Definition at line 292 of file F04GlobalField.cc.

293 {
294  if (fFields) {
295  if (fFields->size()>0) {
296  FieldList::iterator i;
297  for (i=fFields->begin(); i!=fFields->end(); ++i) delete *i;
298  fFields->clear();
299  }
300  }
301 
302  if (fFp) { delete [] fFp; }
303  fFirst = true;
304  fNfp = 0;
305  fFp = NULL;
306 }

Here is the caller graph for this function:

void F04GlobalField::ConstructField ( )

constructs all field tracking objects

Definition at line 106 of file F04GlobalField.cc.

107 {
108  Clear();
109 
110  // Construct equ. of motion of particles through B fields
111 // fEquation = new G4Mag_EqRhs(this);
112  // Construct equ. of motion of particles through e.m. fields
113 // fEquation = new G4EqMagElectricField(this);
114  // Construct equ. of motion of particles including spin through B fields
115 // fEquation = new G4Mag_SpinEqRhs(this);
116  // Construct equ. of motion of particles including spin through e.m. fields
117  fEquation = new G4EqEMFieldWithSpin(this);
118 
119  // Get transportation, field, and propagator managers
120  G4TransportationManager* transportManager =
122 
123  fFieldManager = GetGlobalFieldManager();
124 
125  fFieldPropagator = transportManager->GetPropagatorInField();
126 
127  // Need to SetFieldChangesEnergy to account for a time varying electric
128  // field (r.f. fields)
129  fFieldManager->SetFieldChangesEnergy(true);
130 
131  // Set the field
132  fFieldManager->SetDetectorField(this);
133 
134  // Choose a stepper for integration of the equation of motion
135  SetStepper();
136 
137  // Create a cord finder providing the (global field, min step length,
138  // a pointer to the stepper)
139  fChordFinder = new G4ChordFinder((G4MagneticField*)this,fMinStep,fStepper);
140 
141  // Set accuracy parameters
142  fChordFinder->SetDeltaChord( fDeltaChord );
143 
144  fFieldManager->SetAccuraciesWithDeltaOneStep(fDeltaOneStep);
145 
146  fFieldManager->SetDeltaIntersection(fDeltaIntersection);
147 
148  fFieldPropagator->SetMinimumEpsilonStep(fEpsMin);
149  fFieldPropagator->SetMaximumEpsilonStep(fEpsMax);
150 
151  G4cout << "Accuracy Parameters:" <<
152  " MinStep=" << fMinStep <<
153  " DeltaChord=" << fDeltaChord <<
154  " DeltaOneStep=" << fDeltaOneStep << G4endl;
155  G4cout << " " <<
156  " DeltaIntersection=" << fDeltaIntersection <<
157  " EpsMin=" << fEpsMin <<
158  " EpsMax=" << fEpsMax << G4endl;
159 
160  fFieldManager->SetChordFinder(fChordFinder);
161 
162  G4double l = 0.0;
163  G4double B1 = fDetectorConstruction->GetCaptureMgntB1();
164  G4double B2 = fDetectorConstruction->GetCaptureMgntB2();
165 
166  G4LogicalVolume* logicCaptureMgnt = fDetectorConstruction->GetCaptureMgnt();
167  G4ThreeVector captureMgntCenter =
168  fDetectorConstruction->GetCaptureMgntCenter();
169 
170  F04FocusSolenoid* focusSolenoid =
171  new F04FocusSolenoid(B1, B2, l, logicCaptureMgnt,captureMgntCenter);
172  focusSolenoid -> SetHalf(true);
173 
174  G4double B = fDetectorConstruction->GetTransferMgntB();
175 
176  G4LogicalVolume* logicTransferMgnt =
177  fDetectorConstruction->GetTransferMgnt();
178  G4ThreeVector transferMgntCenter =
179  fDetectorConstruction->GetTransferMgntCenter();
180 
181  F04SimpleSolenoid* simpleSolenoid =
182  new F04SimpleSolenoid(B, l, logicTransferMgnt,transferMgntCenter);
183 
184  simpleSolenoid->SetColor("1,0,1");
185  simpleSolenoid->SetColor("0,1,1");
186  simpleSolenoid->SetMaxStep(1.5*mm);
187  simpleSolenoid->SetMaxStep(2.5*mm);
188 
189  if (fFields) {
190  if (fFields->size()>0) {
191  FieldList::iterator i;
192  for (i=fFields->begin(); i!=fFields->end(); ++i){
193  (*i)->Construct();
194  }
195  }
196  }
197 }
void SetMaxStep(G4double stp)
SetMaxStep(G4double) sets the max. step size.
G4LogicalVolume * GetTransferMgnt()
static constexpr double mm
Definition: G4SIunits.hh:115
G4bool SetDetectorField(G4Field *detectorField)
double B(double temperature)
void SetChordFinder(G4ChordFinder *aChordFinder)
void SetColor(G4String c)
SetColor(G4String) sets the color.
void SetAccuraciesWithDeltaOneStep(G4double valDeltaOneStep)
G4GLOB_DLL std::ostream G4cout
G4FieldManager * GetGlobalFieldManager()
Get the global field manager.
static G4TransportationManager * GetTransportationManager()
#define fMinStep
G4LogicalVolume * GetCaptureMgnt()
void SetDeltaIntersection(G4double valueDintersection)
void SetMinimumEpsilonStep(G4double newEpsMin)
void SetFieldChangesEnergy(G4bool value)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void SetMaximumEpsilonStep(G4double newEpsMax)
G4PropagatorInField * GetPropagatorInField() const
void SetStepper()
Set the Stepper.
void SetDeltaChord(G4double newval)

Here is the call graph for this function:

virtual G4bool F04GlobalField::DoesFieldChangeEnergy ( ) const
inlinevirtual

DoesFieldChangeEnergy() returns true.

Implements G4ElectroMagneticField.

Definition at line 95 of file F04GlobalField.hh.

95 { return true; }
FieldList* F04GlobalField::GetFields ( )
inline

Return the list of Element Fields.

Definition at line 137 of file F04GlobalField.hh.

137 { return fFields; }
void F04GlobalField::GetFieldValue ( const G4double point,
G4double field 
) const
virtual

GetFieldValue() returns the field value at a given point[]. field is really field[6]: Bx,By,Bz,Ex,Ey,Ez. point[] is in global coordinates: x,y,z,t.

Definition at line 267 of file F04GlobalField.cc.

268 {
269  // NOTE: this routine dominates the CPU time for tracking.
270  // Using the simple array fFp[] instead of fields[]
271  // directly sped it up
272 
273  field[0] = field[1] = field[2] = field[3] = field[4] = field[5] = 0.0;
274 
275  // protect against Geant4 bug that calls us with point[] NaN.
276  if(point[0] != point[0]) return;
277 
278  // (can't use fNfp or fFp, as they may change)
279  if (fFirst) ((F04GlobalField*)this)->SetupArray(); // (cast away const)
280 
281  for (int i=0; i<fNfp; ++i) {
282  const F04ElementField* p = fFp[i];
283  if (p->IsInBoundingBox(point)) {
284  p->AddFieldValue(point,field);
285  }
286  }
287 
288 }
const char * p
Definition: xmltok.h:285
virtual void AddFieldValue(const G4double point[4], G4double field[6]) const =0
bool IsInBoundingBox(const G4double point[4]) const

Here is the call graph for this function:

G4FieldManager * F04GlobalField::GetGlobalFieldManager ( )
protected

Get the global field manager.

Definition at line 259 of file F04GlobalField.cc.

260 {
262  ->GetFieldManager();
263 }
static G4TransportationManager * GetTransportationManager()
G4FieldManager * GetFieldManager() const

Here is the call graph for this function:

Here is the caller graph for this function:

F04GlobalField * F04GlobalField::GetObject ( F04DetectorConstruction * const  det)
static

GetObject() returns the single F04GlobalField object. It is constructed, if necessary.

Definition at line 201 of file F04GlobalField.cc.

202 {
203  if (!fObject) new F04GlobalField(det);
204  return fObject;
205 }
F04GlobalField * F04GlobalField::GetObject ( )
static

Definition at line 209 of file F04GlobalField.cc.

210 {
211  if (fObject) return fObject;
212  return NULL;
213 }

Here is the caller graph for this function:

void F04GlobalField::SetDeltaChord ( G4double  dcr)
inline

Set the delta chord length.

Definition at line 122 of file F04GlobalField.hh.

122 { fDeltaChord = dcr; }

Here is the caller graph for this function:

void F04GlobalField::SetDeltaIntersection ( G4double  its)
inline

Set the delta intersection length.

Definition at line 128 of file F04GlobalField.hh.

128 { fDeltaIntersection = its; }
void F04GlobalField::SetDeltaOneStep ( G4double  stp)
inline

Set the delta one step length.

Definition at line 125 of file F04GlobalField.hh.

125 { fDeltaOneStep = stp; }
void F04GlobalField::SetEpsMax ( G4double  eps)
inline

Set the maximum eps length.

Definition at line 134 of file F04GlobalField.hh.

134 { fEpsMax = eps; }
static const G4double eps

Here is the caller graph for this function:

void F04GlobalField::SetEpsMin ( G4double  eps)
inline

Set the minimum eps length.

Definition at line 131 of file F04GlobalField.hh.

131 { fEpsMin = eps; }
static const G4double eps

Here is the caller graph for this function:

void F04GlobalField::SetMinStep ( G4double  stp)
inline

Set the minimum step length.

Definition at line 119 of file F04GlobalField.hh.

119 { fMinStep = stp; }
#define fMinStep

Here is the caller graph for this function:

void F04GlobalField::SetStepper ( )

Set the Stepper.

Definition at line 217 of file F04GlobalField.cc.

218 {
219  if(fStepper) delete fStepper;
220 
221  switch ( fStepperType )
222  {
223  case 0:
224 // fStepper = new G4ExplicitEuler( fEquation, 8 ); // no spin tracking
225  fStepper = new G4ExplicitEuler( fEquation, 12 ); // with spin tracking
226  G4cout << "G4ExplicitEuler is called" << G4endl;
227  break;
228  case 1:
229 // fStepper = new G4ImplicitEuler( fEquation, 8 ); // no spin tracking
230  fStepper = new G4ImplicitEuler( fEquation, 12 ); // with spin tracking
231  G4cout << "G4ImplicitEuler is called" << G4endl;
232  break;
233  case 2:
234 // fStepper = new G4SimpleRunge( fEquation, 8 ); // no spin tracking
235  fStepper = new G4SimpleRunge( fEquation, 12 ); // with spin tracking
236  G4cout << "G4SimpleRunge is called" << G4endl;
237  break;
238  case 3:
239 // fStepper = new G4SimpleHeum( fEquation, 8 ); // no spin tracking
240  fStepper = new G4SimpleHeum( fEquation, 12 ); // with spin tracking
241  G4cout << "G4SimpleHeum is called" << G4endl;
242  break;
243  case 4:
244 // fStepper = new G4ClassicalRK4( fEquation, 8 ); // no spin tracking
245  fStepper = new G4ClassicalRK4( fEquation, 12 ); // with spin tracking
246  G4cout << "G4ClassicalRK4 (default) is called" << G4endl;
247  break;
248  case 5:
249 // fStepper = new G4CashKarpRKF45( fEquation, 8 ); // no spin tracking
250  fStepper = new G4CashKarpRKF45( fEquation, 12 ); // with spin tracking
251  G4cout << "G4CashKarpRKF45 is called" << G4endl;
252  break;
253  default: fStepper = 0;
254  }
255 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

void F04GlobalField::SetStepperType ( G4int  i)
inline

Set the Stepper types.

Definition at line 113 of file F04GlobalField.hh.

113 { fStepperType = i; }

Here is the caller graph for this function:


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