Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F04GlobalField.hh
Go to the documentation of this file.
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 // $Id: F04GlobalField.hh 79251 2014-02-20 16:16:23Z gcosmo $
27 //
28 /// \file field/field04/include/F04GlobalField.hh
29 /// \brief Definition of the F04GlobalField class
30 //
31 
32 #ifndef F04GlobalField_h
33 #define F04GlobalField_h 1
34 
35 #include <vector>
36 
37 #include "G4FieldManager.hh"
38 #include "G4PropagatorInField.hh"
40 #include "G4ChordFinder.hh"
41 
42 #include "G4MagneticField.hh"
44 
45 #include "G4Mag_EqRhs.hh"
46 #include "G4Mag_SpinEqRhs.hh"
47 
48 #include "G4EqMagElectricField.hh"
49 #include "G4EqEMFieldWithSpin.hh"
50 
51 #include "F04FieldMessenger.hh"
52 #include "F04ElementField.hh"
53 
55 
56 // F04GlobalField - handles the global ElectroMagnetic field
57 //
58 // There is a single G04GlobalField object.
59 //
60 // The field from each individual beamline element is given by a
61 // ElementField object. Any number of overlapping ElementField
62 // objects can be added to the global field. Any element that
63 // represents an element with an EM field must add the appropriate
64 // ElementField to the global GlobalField object.
65 
66 typedef std::vector<F04ElementField*> FieldList;
67 
69 //class F04GlobalField : public G4MagneticField {
70 
71 private:
72 
75 
76  F04GlobalField& operator=(const F04GlobalField&);
77 
78  void SetupArray();
79 
80 public:
81 
82  virtual ~F04GlobalField();
83 
84  /// GetObject() returns the single F04GlobalField object.
85  /// It is constructed, if necessary.
87  static F04GlobalField* GetObject();
88 
89  /// GetFieldValue() returns the field value at a given point[].
90  /// field is really field[6]: Bx,By,Bz,Ex,Ey,Ez.
91  /// point[] is in global coordinates: x,y,z,t.
92  virtual void GetFieldValue(const G4double* point, G4double* field) const;
93 
94  /// DoesFieldChangeEnergy() returns true.
95  virtual G4bool DoesFieldChangeEnergy() const { return true; }
96 
97  /// AddElementField() adds the ElementField object for a single
98  /// element to the global field.
100  {
101  if (fFields) fFields->push_back(f);
102  }
103 
104  /// Clear() removes all ElementField-s from the global object,
105  /// and destroys them. Used before the geometry is completely
106  /// re-created.
107  void Clear();
108 
109  /// constructs all field tracking objects
110  void ConstructField();
111 
112  /// Set the Stepper types
113  void SetStepperType( G4int i ) { fStepperType = i; }
114 
115  /// Set the Stepper
116  void SetStepper();
117 
118  /// Set the minimum step length
119  void SetMinStep(G4double stp) { fMinStep = stp; }
120 
121  /// Set the delta chord length
122  void SetDeltaChord(G4double dcr) { fDeltaChord = dcr; }
123 
124  /// Set the delta one step length
125  void SetDeltaOneStep(G4double stp) { fDeltaOneStep = stp; }
126 
127  /// Set the delta intersection length
128  void SetDeltaIntersection(G4double its) { fDeltaIntersection = its; }
129 
130  /// Set the minimum eps length
131  void SetEpsMin(G4double eps) { fEpsMin = eps; }
132 
133  /// Set the maximum eps length
134  void SetEpsMax(G4double eps) { fEpsMax = eps; }
135 
136  /// Return the list of Element Fields
137  FieldList* GetFields() { return fFields; }
138 
139 protected:
140 
141  /// Get the global field manager
143 
144 private:
145 
146  static G4ThreadLocal F04GlobalField* fObject;
147 
148  G4int fNfp;
149  G4bool fFirst;
150 
151  FieldList* fFields;
152 
153  const F04ElementField **fFp;
154 
155 private:
156 
157  G4int fStepperType;
158 
159  G4double fMinStep;
160  G4double fDeltaChord;
161  G4double fDeltaOneStep;
162  G4double fDeltaIntersection;
163  G4double fEpsMin;
164  G4double fEpsMax;
165 
166 // G4Mag_EqRhs* fEquation;
167 // G4Mag_SpinEqRhs* fEquation;
168 
169 // G4EqMagElectricField* fEquation;
170  G4EqEMFieldWithSpin* fEquation;
171 
172  G4FieldManager* fFieldManager;
173  G4PropagatorInField* fFieldPropagator;
174  G4MagIntegratorStepper* fStepper;
175  G4ChordFinder* fChordFinder;
176 
177  F04FieldMessenger* fFieldMessenger;
178 
179  F04DetectorConstruction* fDetectorConstruction;
180 
181 };
182 
183 #endif
void SetDeltaIntersection(G4double its)
Set the delta intersection length.
void SetEpsMax(G4double eps)
Set the maximum eps length.
virtual ~F04GlobalField()
Definition of the F04FieldMessenger class.
void SetEpsMin(G4double eps)
Set the minimum eps length.
Definition of the F04ElementField class.
virtual void GetFieldValue(const G4double *point, G4double *field) const
#define G4ThreadLocal
Definition: tls.hh:52
int G4int
Definition: G4Types.hh:78
static F04GlobalField * GetObject()
Definition of the F04DetectorConstruction class.
std::vector< F04ElementField * > FieldList
bool G4bool
Definition: G4Types.hh:79
G4FieldManager * GetGlobalFieldManager()
Get the global field manager.
void SetDeltaChord(G4double dcr)
Set the delta chord length.
void SetDeltaOneStep(G4double stp)
Set the delta one step length.
void ConstructField()
constructs all field tracking objects
void SetMinStep(G4double stp)
Set the minimum step length.
double G4double
Definition: G4Types.hh:76
void SetStepper()
Set the Stepper.
virtual G4bool DoesFieldChangeEnergy() const
DoesFieldChangeEnergy() returns true.
void AddElementField(F04ElementField *f)
FieldList * GetFields()
Return the list of Element Fields.
void SetStepperType(G4int i)
Set the Stepper types.