[807] | 1 | |
---|
| 2 | |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | #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 | |
---|
| 26 | class MappedField : public G4MagneticField |
---|
| 27 | { |
---|
| 28 | gemc_opts gemcOpt; |
---|
| 29 | double table_start[3]; |
---|
| 30 | double cell_size[3]; |
---|
| 31 | double mapOrigin[3]; |
---|
| 32 | |
---|
| 33 | string hd_msg; |
---|
| 34 | int MGN_VERBOSITY; |
---|
| 35 | |
---|
| 36 | public: |
---|
| 37 | MappedField(); |
---|
| 38 | ~MappedField(); |
---|
| 39 | |
---|
| 40 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 41 | // Constructor for phi-symmetric field in cylindrical coordinates |
---|
| 42 | // Arguments: |
---|
| 43 | // Options |
---|
| 44 | // Number of Tranverse Points, Number of Longitudinal Points |
---|
| 45 | // Lower and Upper limits of the Tranverse Coordinates |
---|
| 46 | // Lower and Upper limits of the Longitudinal Coordinates |
---|
| 47 | // Map Filename |
---|
| 48 | // Map Origin |
---|
| 49 | // String of Units |
---|
| 50 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 51 | MappedField(gemc_opts, int, int, double Tlimits[2], double Llimits[2], string, double origin[3], string units[5]); |
---|
| 52 | |
---|
| 53 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 54 | // Constructor for phi-segmented field in cylindrical coordinates. Field is in cartesian coordinates. |
---|
| 55 | // The map is assumed to cover half the segment |
---|
| 56 | // Arguments: |
---|
| 57 | // Options |
---|
| 58 | // Number of Transverse Points, Number of Azimuthal Points, Number of Longitudinal Points |
---|
| 59 | // Lower and Upper limits of the Tranverse Coordinates |
---|
| 60 | // Lower and Upper limits of the Azimuthal Coordinates |
---|
| 61 | // Lower and Upper limits of the Longitudinal Coordinates |
---|
| 62 | // Map Filename |
---|
| 63 | // Map Origin |
---|
| 64 | // String of Units |
---|
| 65 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 66 | MappedField(gemc_opts, int, int, int, double Tlimits[2], double Llimits[2], double Zlimits[2], string, double origin[3], string units[5]); |
---|
| 67 | |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | void GetFieldValue( const double x[3], double *Bfield) const; |
---|
| 73 | double segm_phi_span; |
---|
| 74 | int nsegments; |
---|
| 75 | |
---|
| 76 | private: |
---|
| 77 | |
---|
| 78 | // 3D Cartesian Maps |
---|
| 79 | vector< vector < vector <double> > > B3DCartX ; |
---|
| 80 | vector< vector < vector <double> > > B3DCartY ; |
---|
| 81 | vector< vector < vector <double> > > B3DCartZ ; |
---|
| 82 | |
---|
| 83 | // 2D Cylindrical Maps - phi-symmetric, need only transverse and longitudinal (z) component |
---|
| 84 | vector< vector <double> > B2DCylT ; |
---|
| 85 | vector< vector <double> > B2DCylL ; |
---|
| 86 | |
---|
| 87 | // 3D Cylindrical Coordinates, Cartesian field Maps - phi-segmented |
---|
| 88 | vector< vector < vector <double> > > B3DCylX ; |
---|
| 89 | vector< vector < vector <double> > > B3DCylY ; |
---|
| 90 | vector< vector < vector <double> > > B3DCylZ ; |
---|
| 91 | }; |
---|
| 92 | |
---|
| 93 | |
---|
| 94 | class MagneticField |
---|
| 95 | { |
---|
| 96 | public: |
---|
| 97 | MagneticField(){;} |
---|
| 98 | ~MagneticField(){;} |
---|
| 99 | |
---|
| 100 | public: |
---|
| 101 | gemc_opts gemcOpt; |
---|
| 102 | string name; |
---|
| 103 | string type; |
---|
| 104 | string magnitude; |
---|
| 105 | string swim_method; |
---|
| 106 | string description; |
---|
| 107 | |
---|
| 108 | MappedField *mappedfield; |
---|
| 109 | |
---|
| 110 | private: |
---|
| 111 | G4FieldManager *MFM; |
---|
| 112 | |
---|
| 113 | public: |
---|
| 114 | G4FieldManager* get_MFM(){return MFM;} |
---|
| 115 | void init_MFM(){MFM = NULL;} |
---|
| 116 | void create_MFM(); |
---|
| 117 | |
---|
| 118 | }; |
---|
| 119 | |
---|
| 120 | map<string, MagneticField> get_magnetic_Fields(gemc_opts); |
---|
| 121 | |
---|
| 122 | |
---|
| 123 | #endif |
---|