8 #include "G4UniformMagField.hh" 9 #include "G4ChordFinder.hh" 10 #include "G4ClassicalRK4.hh" 11 #include "G4HelixSimpleRunge.hh" 12 #include "G4HelixImplicitEuler.hh" 13 #include "G4HelixExplicitEuler.hh" 14 #include "G4CachedMagneticField.hh" 21 void gfield::create_MFM()
36 G4Mag_UsualEqRhs* iEquation =
new G4Mag_UsualEqRhs(
map);
38 G4ChordFinder* iChordFinder =
new G4ChordFinder(
map,
minStep, iStepper);
43 MFM =
new G4FieldManager(pCachedMagField, iChordFinder);
48 MFM->SetMinimumEpsilonStep( minEps );
49 MFM->SetMaximumEpsilonStep( maxEps );
50 MFM->SetDeltaOneStep(0.01 * mm);
51 MFM->SetDeltaIntersection(0.01 * mm);
61 cout <<
" !!! Error: dimension of field " <<
name <<
" are wrong: " 62 <<
dimensions <<
" has dimension " << dim.size() << endl;
65 G4UniformMagField* magField =
new G4UniformMagField(constField);
67 G4Mag_UsualEqRhs* iEquation =
new G4Mag_UsualEqRhs(magField);
69 G4ChordFinder* iChordFinder =
new G4ChordFinder(magField,
minStep, iStepper);
71 MFM =
new G4FieldManager(magField, iChordFinder);
75 cout <<
" > <" <<
name <<
">: uniform magnetic field is built." << endl;
84 cout <<
" !!! Error: dimension of field " <<
name <<
" are wrong: " 85 <<
dimensions <<
" has dimension " << dim.size() << endl;
91 G4Mag_UsualEqRhs* iEquation =
new G4Mag_UsualEqRhs(magField);
93 G4ChordFinder* iChordFinder =
new G4ChordFinder(magField,
minStep, iStepper);
95 MFM =
new G4FieldManager(magField, iChordFinder);
99 cout <<
" > <" <<
name <<
">: multipole magnetic field is built with " 106 if (sname ==
"ClassicalRK4")
return new G4ClassicalRK4(ie);
107 if (sname ==
"RungeKutta")
return new G4HelixSimpleRunge(ie);
108 if (sname ==
"ImplicitEuler")
return new G4HelixImplicitEuler(ie);
109 if (sname ==
"ExplicitEuler")
return new G4HelixExplicitEuler(ie);
112 cout <<
" !!! Error: stepper " << sname <<
" is not defined " << endl;
118 string hd_msg =
" >> fields Init: ";
119 vector<aopt> FIELD_SCALES_OPTION = Opt.
getArgs(
"SCALE_FIELD");
121 for (
unsigned int f = 0; f < FIELD_SCALES_OPTION.size(); f++)
123 vector < string > scales =
get_strings(FIELD_SCALES_OPTION[f].args,
",");
124 if (scales.size() == 2)
126 if (scales[0].find(
name) != string::npos)
141 cout <<
" > Field name: " << gf.
name << endl;
142 cout <<
" - factory: " << gf.
factory << endl;
144 cout <<
" - format: " << gf.
format << endl;
145 cout <<
" - symmetry: " << gf.
symmetry << endl;
146 cout <<
" - scale factor: " << gf.
scaleFactor << endl;
147 cout <<
" - integration method: " << gf.
integration << endl;
148 cout <<
" - minimum Step: " << gf.
minStep << endl;
150 cout <<
" - dimensions: " << gf.
dimensions << endl;
159 cout <<
" - Map Field Unit: " << gf.
map->
unit << endl;
double mapOrigin[3]
Displacement of map. This is used in GetFieldValue.
string description
Field Description.
gMappedField * map
Mapped Field.
vector< string > get_strings(string input)
returns a vector of strings from a stringstream, space is delimiter
int verbosity
map verbosity
string unit
field unit in the map
string integration
Integration Method.
string format
Field format (available: simple (for uniform) and map)
double scaleFactor
copy of the gfield scaleFactor
string symmetry
Field symmetry.
vector< aopt > getArgs(string)
get a vector of arguments matching a string
double get_number(string v, int warn_no_unit)
Returns number with dimension from string, i.e. 100*cm.
friend ostream & operator<<(ostream &stream, gfield gf)
string name
Field name - used as key in the map<string, gfield>
G4MagIntegratorStepper * createStepper(string sname, G4Mag_UsualEqRhs *ie)
void create_simple_multipole_MFM()
string dimensions
Field dimensions (with units), for non-mapped fields.
string factory
Field factory (format of magnetic field)
vector< gcoord > coordinates
Vector size depend on the symmetry.
double verbosity
Log verbosity.
void initialize(goptions)
Overloaded "<<" for gfield class. Dumps infos on screen.
string interpolation
map interpolation technique. Choices are "none", "linear", "quadratic"
fieldFactory * fFactory
fieldFactory that created the field
double minStep
Minimum Step for the G4ChordFinder.
virtual void loadFieldMap(gMappedField *, double)=0
string identifier
Pointer to map in factory (for example, hostname / filename with path / date)