GEMC  1.8
Geant4 Monte-Carlo Framework
MagneticField.h
Go to the documentation of this file.
1 #ifndef MagneticField_H
6 #define MagneticField_H 1
7 
8 // %%%%%%%%%%
9 // G4 headers
10 // %%%%%%%%%%
11 #include "G4FieldManager.hh"
12 #include "G4MagneticField.hh"
13 
14 
15 // %%%%%%%%%%%%%
16 // gemc headers
17 // %%%%%%%%%%%%%
18 #include "usage.h"
19 
20 // %%%%%%%%%%%
21 // C++ headers
22 // %%%%%%%%%%%
23 #include <sstream>
24 using namespace std;
25 
30 {
31  gemc_opts gemcOpt;
32  double table_start[3];
33  double cell_size[3];
34  double mapOrigin[3];
35 
36  string hd_msg;
37  int MGN_VERBOSITY;
38 
39  public:
40  MappedField();
41  ~MappedField();
42 
43  // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44  // Constructor for 1D-dipole field in cartesian coordinates
45  // Example: A field along y that only depends on xz coordinate (code: dipole-y)
46  // Arguments:
47  // GEMC Options
48  // Number of Tranverse Points, Number of Longitudinal Points
49  // Lower and Upper limits of the Tranverse Coordinates
50  // Lower and Upper limits of the Longitudinal Coordinates
51  // Map Filename
52  // Map Origin
53  // String of Units
54  // Scale Factor
55  // Symmetry
56  // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57  MappedField(gemc_opts, int, int, double Tlimits[2], double Llimits[2], string, double origin[3], string units[5], double scale_factor, string symmetry);
58 
59  // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
60  // Constructor for phi-symmetric field in cylindrical coordinates
61  // Arguments:
62  // GEMC Options
63  // Number of Tranverse Points, Number of Longitudinal Points
64  // Lower and Upper limits of the Tranverse Coordinates
65  // Lower and Upper limits of the Longitudinal Coordinates
66  // Map Filename
67  // Map Origin
68  // String of Units
69  // Scale Factor
70  // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71  MappedField(gemc_opts, int, int, double Tlimits[2], double Llimits[2], string, double origin[3], string units[5], double scale_factor, string symmetry, int dummy);
72 
73  // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74  // Constructor for phi-segmented field in cylindrical coordinates. Field is in cartesian coordinates.
75  // The map is assumed to cover half the segment
76  // Arguments:
77  // GEMC Options
78  // Number of Transverse Points, Number of Azimuthal Points, Number of Longitudinal Points
79  // Lower and Upper limits of the Tranverse Coordinates
80  // Lower and Upper limits of the Azimuthal Coordinates
81  // Lower and Upper limits of the Longitudinal Coordinates
82  // Map Filename
83  // Map Origin
84  // String of Units
85  // Scale Factor
86  // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
87  MappedField(gemc_opts, int, int, int, double Tlimits[2], double Llimits[2], double Zlimits[2], string, double origin[3], string units[5], double scale_factor);
88 
89  // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
90  // Constructor for segmented field in cartesian coordinates. Field is in cartesian coordinates.
91  // Arguments:
92  // GEMC Options
93  // Number of Y Points, Number of X Points, Number of Z Points
94  // Lower and Upper limits of the Y Coordinates
95  // Lower and Upper limits of the X Coordinates
96  // Lower and Upper limits of the Z Coordinates
97  // Map Filename
98  // Map Origin
99  // String of Units
100  // Scale Factor
101  // Symmetry
102  // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
103  MappedField(gemc_opts, int, int, int, double Tlimits[2], double Llimits[2], double Zlimits[2], string, double origin[3],
104  string units[5], double scale_factor, bool ySymmetry);
105 
106 
107  void GetFieldValue( const double x[3], double *Bfield) const;
108 
109  double segm_phi_span;
110  int nsegments;
111  string Symmetry;
112 
113  private:
114 
115  // 3D Cartesian Maps
116  vector< vector < vector <double> > > B3DCartX ;
117  vector< vector < vector <double> > > B3DCartY ;
118  vector< vector < vector <double> > > B3DCartZ ;
119 
120  // 2D Cylindrical Maps - phi-symmetric, need only transverse and longitudinal (z) component
121  vector< vector <double> > B2DCylT ;
122  vector< vector <double> > B2DCylL ;
123 
124  // 3D Cylindrical Coordinates, Cartesian field Maps - phi-segmented
125  vector< vector < vector <double> > > B3DCylX ;
126  vector< vector < vector <double> > > B3DCylY ;
127  vector< vector < vector <double> > > B3DCylZ ;
128 
129  // Dipole Maps - 1D dependent on two variable
130  vector< vector <double> > BDipole ;
131 
132 
133 };
134 
135 
142 {
143 public:
146 
147 public:
149  string name;
150  string type;
151  string magnitude;
152  string swim_method;
153  string description;
154  double scale_factor;
155 
157 
158 private:
159  G4FieldManager *MFM;
160 
161 public:
162  G4FieldManager* get_MFM(){return MFM;}
163  void init_MFM(){MFM = NULL;}
164  void create_MFM();
165 
166 };
167 
168 map<string, MagneticField> get_magnetic_Fields(gemc_opts);
169 
170 
171 #endif
double scale_factor
Scale factor.
double segm_phi_span
azimuthal span of the map for phi-segmented fields
STL namespace.
void init_MFM()
Initialize Field Manager Pointer to NULL.
int nsegments
number of segments
map< string, MagneticField > get_magnetic_Fields(gemc_opts)
Fills magnetic field maps from Database.
string magnitude
Magnetic Field magnitude infos.
string swim_method
Magnetic Field Swim Method.
gemc_opts gemcOpt
gemc options map
G4FieldManager * get_MFM()
Returns Magnetic Field Manager Pointer.
string Symmetry
string name
Magnetic Field identifier.
MappedField * mappedfield
Mapped Magnetic Field.
string type
Type of Magnetic Field.
string description
Field Description.