8 #include "CLHEP/Units/PhysicalConstants.h" 13 ifstream IN(file.c_str());
22 if(strcmp (first.c_str(),
"<mfield>") != 0)
33 ifstream IN(file.c_str());
37 while(IN.good() && stop !=
"</mfield>")
40 content += stop +
" " ;
45 QDomDocument domDocument;
46 domDocument.setContent(QString(content.c_str()));
49 QDomElement docElem = domDocument.documentElement();
50 QDomNode n = docElem.firstChild();
53 QDomElement e = n.toElement();
56 if(e.tagName().toStdString() ==
"description")
63 if(e.tagName().toStdString() ==
"symmetry")
74 if(e.tagName().toStdString() ==
"dimension")
87 if(e.tagName().toStdString() ==
"dimension")
106 if(e.tagName().toStdString() ==
"map")
108 QDomNode nn= e.firstChild();
111 QDomElement ee = nn.toElement();
112 if(ee.tagName().toStdString() ==
"coordinate")
114 QDomNode nnn= ee.firstChild();
117 QDomElement eee = nnn.toElement();
119 if(eee.tagName().toStdString() ==
"first" || eee.tagName().toStdString() ==
"second" || eee.tagName().toStdString() ==
"third")
129 if(eee.tagName().toStdString() ==
"second") speed = 1;
130 if(eee.tagName().toStdString() ==
"third") speed = 2;
133 nnn=nnn.nextSibling();
137 if(ee.tagName().toStdString() ==
"shift")
145 if(ee.tagName().toStdString() ==
"field")
150 if(ee.tagName().toStdString() ==
"interpolation")
154 nn = nn.nextSibling();
170 for(
unsigned int d=0; d<olddim.size(); d++)
183 for(
unsigned int d=0; d<olddim.size(); d++)
185 if (d==1) newdim +=
stringify(gf.
scaleFactor*atof(olddim[d].substr(0, olddim[d].find(
"*")).c_str()))
186 +
"*" +
TrimSpaces(olddim[d].substr(olddim[d].find(
"*")+1, olddim[d].find(
"*") + 20)) +
" ";
187 else newdim += olddim[d]+
" ";
200 cout <<
" > Loading field map from " << map->
identifier <<
" with symmetry: " << map->
symmetry << endl;
204 loadFieldMap_Dipole(map, v);
208 loadFieldMap_Cylindrical(map, v);
212 if(map->
symmetry ==
"phi-segmented")
213 loadFieldMap_phiSegmented(map, v);
double mapOrigin[3]
Displacement of map. This is used in GetFieldValue.
string description
Field Description.
gMappedField * map
Mapped Field.
void loadFieldMap(gMappedField *, double)
vector< string > get_strings(string input)
returns a vector of strings from a stringstream, space is delimiter
string unit
field unit in the map
string integration
Integration Method.
string format
Field format (available: simple (for uniform) and map)
string symmetry
Field symmetry.
double get_number(string v, int warn_no_unit)
Returns number with dimension from string, i.e. 100*cm.
string name
Field name - used as key in the map<string, gfield>
string assignAttribute(QDomElement e, string attribute, string defaultValue)
string stringify(double x)
string dimensions
Field dimensions (with units), for non-mapped fields.
gfield loadField(string, goptions)
string factory
Field factory (format of magnetic field)
vector< gcoord > coordinates
Vector size depend on the symmetry.
void initialize(goptions)
Overloaded "<<" for gfield class. Dumps infos on screen.
string interpolation
map interpolation technique. Choices are "none", "linear", "quadratic"
double minStep
Minimum Step for the G4ChordFinder.
string TrimSpaces(string in)
Removes leading and trailing spaces.
string symmetry
map symmetry
string identifier
Pointer to map in factory (for example, hostname / filename with path / date)