source: trunk/examples/extended/field/field04/include/F04GlobalField.hh@ 1036

Last change on this file since 1036 was 807, checked in by garnier, 17 years ago

update

File size: 5.3 KB
RevLine 
[807]1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27//
28//
29
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
32
33#ifndef F04GlobalField_h
34#define F04GlobalField_h 1
35
36#include <vector>
37
38#include "G4FieldManager.hh"
39#include "G4PropagatorInField.hh"
40#include "G4MagIntegratorStepper.hh"
41#include "G4ChordFinder.hh"
42
43#include "G4MagneticField.hh"
44#include "G4ElectroMagneticField.hh"
45
46#include "G4Mag_EqRhs.hh"
47#include "G4Mag_SpinEqRhs.hh"
48
49#include "G4EqMagElectricField.hh"
50#include "G4EqEMFieldWithSpin.hh"
51
52#include "F04FieldMessenger.hh"
53#include "F04ElementField.hh"
54
55// F04GlobalField - handles the global ElectroMagnetic field
56//
57// There is a single G04GlobalField object.
58//
59// The field from each individual beamline element is given by a
60// ElementField object. Any number of overlapping ElementField
61// objects can be added to the global field. Any element that
62// represents an element with an EM field must add the appropriate
63// ElementField to the global GlobalField object.
64
65typedef std::vector<F04ElementField*> FieldList;
66
67class F04GlobalField : public G4ElectroMagneticField {
68//class F04GlobalField : public G4MagneticField {
69
70private:
71
72 F04GlobalField();
73 F04GlobalField(const F04GlobalField&);
74
75 ~F04GlobalField();
76
77 F04GlobalField& operator=(const F04GlobalField&);
78
79 void setupArray();
80
81public:
82
83 /// getObject() returns the single F04GlobalField object.
84 /// It is constructed, if necessary.
85 static F04GlobalField* getObject();
86
87 /// GetFieldValue() returns the field value at a given point[].
88 /// field is really field[6]: Bx,By,Bz,Ex,Ey,Ez.
89 /// point[] is in global coordinates: x,y,z,t.
90 void GetFieldValue(const G4double* point, G4double* field) const;
91
92 /// DoesFieldChangeEnergy() returns true.
93 G4bool DoesFieldChangeEnergy() const { return true; }
94
95 /// addElementField() adds the ElementField object for a single
96 /// element to the global field.
97 void addElementField(F04ElementField* f) { if (fields) fields->push_back(f); }
98
99 /// clear() removes all ElementField-s from the global object,
100 /// and destroys them. Used before the geometry is completely
101 /// re-created.
102 void clear();
103
104 /// updates all field tracking objects and clear()
105 void updateField();
106
107 /// Set the Stepper types
108 void SetStepperType( G4int i ) { fStepperType = i; }
109
110 /// Set the Stepper
111 void SetStepper();
112
113 /// Set the minimum step length
114 void SetMinStep(G4double s) { minStep = s; }
115
116 /// Set the delta chord length
117 void SetDeltaChord(G4double s) { deltaChord = s; }
118
119 /// Set the delta one step length
120 void SetDeltaOneStep(G4double s) { deltaOneStep = s; }
121
122 /// Set the delta intersection length
123 void SetDeltaIntersection(G4double s) { deltaIntersection = s; }
124
125 /// Set the minimum eps length
126 void SetEpsMin(G4double s) { epsMin = s; }
127
128 /// Set the maximum eps length
129 void SetEpsMax(G4double s) { epsMax = s; }
130
131 /// Return the list of Element Fields
132 FieldList* getFields() { return fields; }
133
134protected:
135
136 /// Get the global field manager
137 G4FieldManager* GetGlobalFieldManager();
138
139private:
140
141 static F04GlobalField* object;
142
143 G4int nfp;
144 G4bool first;
145
146 FieldList* fields;
147
148 const F04ElementField **fp;
149
150private:
151
152 G4int fStepperType;
153
154 G4double minStep;
155 G4double deltaChord;
156 G4double deltaOneStep;
157 G4double deltaIntersection;
158 G4double epsMin;
159 G4double epsMax;
160
161// G4Mag_EqRhs* fEquation;
162// G4Mag_SpinEqRhs* fEquation;
163
164// G4EqMagElectricField* fEquation;
165 G4EqEMFieldWithSpin* fEquation;
166
167 G4FieldManager* fFieldManager;
168 G4PropagatorInField* fFieldPropagator;
169 G4MagIntegratorStepper* fStepper;
170 G4ChordFinder* fChordFinder;
171
172 F04FieldMessenger* fFieldMessenger;
173
174};
175
176#endif
Note: See TracBrowser for help on using the repository browser.