Commit b86c0ea3 authored by TOUZE Francois's avatar TOUZE Francois
Browse files

change unit of the magnetic field of solenoid

parent ac06bcef
......@@ -556,11 +556,11 @@ string softwareBeta::elementsData(const vector<psvs>& v,int &num)
double EMev = atof(bunch_.find("energy")->second.c_str());
double gamma = EMev/EREST_MeV;
double gbeta = sqrt(gamma*gamma-1.);
double brho = gbeta*17.04512e-04; // BEAM RIGIDITY in T.m
string str2 = v.at(1).second.at(2); // field strength (kG)
double Brho = gbeta*17.04512e-04; // BEAM RIGIDITY in T.m
string str2 = v.at(1).second.at(2); // field strength (T)
if (str2.find("none") == std::string::npos) {
double Hfield = atof( str2.c_str() );
KS = 0.1*Hfield/brho;
KS = Hfield/Brho;
}
}
......@@ -1392,11 +1392,11 @@ void softwareBeta::FinalValues()
}
if (eType == "solenoid") {
double brho = gbeta*17.04512e-04; // BEAM RIGIDITY in T.m
double Brho = gbeta*17.04512e-04; // BEAM RIGIDITY in T.m
// SOLENOID STRENGTH KS = 2.*SO
double ksfit = 2.*atof(xValue.c_str()); //
// Hfield = Ks*Βρ in T = 10000 Gauss
double bfit = ksfit*brho*10.; // in kG
// Hfield = Ks*Βρ in T
double bfit = ksfit*Brho;
ofs << scientific << ptr->getLabel() << "\tKS" << "\t" << ksfit << "\tH" << "\t" << bfit << endl;
}
......
......@@ -832,10 +832,10 @@ string softwareElegant::elementsData(const vector<psvs>& v)
if (str1.find("none") == std::string::npos ) {
os << ", KS= " << atof(str1.c_str());
} else {
string str2 = v.at(1).second.at(2); // field strength (kG)
string str2 = v.at(1).second.at(2); // field strength (T)
if (str2.find("none") == std::string::npos) {
double Hfield = atof( str2.c_str() );
os << ", B= " << 0.1*Hfield; // in T
os << ", B= " << Hfield;
}
}
......@@ -1227,9 +1227,9 @@ void softwareElegant::FinalValues()
if (eType == "solenoid") {
std::size_t pos = keys.find("KS=");
string xValue = keys.substr(pos+3);
double brho = gbeta*17.04512e-04; // BEAM RIGIDITY in T.m
double Brho = gbeta*17.04512e-04; // BEAM RIGIDITY in T.m
double ksfit = atof(xValue.c_str()); //
double bfit = ksfit*brho*10.; // in kG
double bfit = ksfit*Brho;
ofs << scientific << ptr->getLabel() << "\tKs" << "\t" << ksfit << "\tH" << "\t" << bfit << endl;
}
......
......@@ -999,12 +999,12 @@ string softwareMadx::elementsData(const vector<psvs>& v)
double EGev = atof(Energy_.c_str());
double gamma = EGev/EREST_GeV;
double gbeta = sqrt(gamma*gamma-1.);
double brho = gbeta*17.04512e-04; // BEAM RIGIDITY in T.m
string str2 = v.at(1).second.at(2); // field strength (kG)
double Brho = gbeta*17.04512e-04; // BEAM RIGIDITY in T.m
string str2 = v.at(1).second.at(2); // field strength (T)
if (str2.find("none") == std::string::npos) {
double Hfield = atof( str2.c_str() );
// Ks = Hfield (in T)/Βρ where T = 10.000 Gauss
os << ", KS= " << 0.1*Hfield/brho;
// Ks = Hfield (in T)/Βρ
os << ", KS= " << Hfield/Brho;
}
}
......@@ -1356,11 +1356,11 @@ void softwareMadx::FinalValues()
if (eType == "solenoid") {
// double brho = 3.3356*eGev; // BEAM RIGIDITY in T.m
// Βρ = γβ*m0*c/q = γβ*17.04512e-04 T.m
double brho = gbeta*17.04512e-04; // BEAM RIGIDITY in T.m
double Brho = gbeta*17.04512e-04; // BEAM RIGIDITY in T.m
// SOLENOID STRENGTH
double ksfit = atof(FinalValue.c_str());
// Hfield = Ks*Βρ in T = 10000 Gauss
double bfit = ksfit*brho*10.; // in kG
// Hfield = Ks*Βρ in T
double bfit = ksfit*Brho;
ofs << scientific << ptr->getLabel() << "\t" << "Ks" << "\t" << ksfit << "\t" << "H" << "\t" << bfit << endl;
}
}
......
......@@ -215,11 +215,11 @@ string softwareParmela::beamLine(const vector<smap>& amap)
ostr << " /IOUT= 1";
double Hfield = 0.;
string str = v.at(1).second.at(2); // Hfield (kG)
string str = v.at(1).second.at(2); // Hfield (T)
if (str.find("none") == std::string::npos) {
Hfield = atof( str.c_str() );
}
ostr << " /H= " << 1000.*Hfield << endl; // in Gauss
ostr << " /H= " << 10000.*Hfield << endl; // in Gauss
} else if (eType == "bend") {
......
......@@ -39,9 +39,9 @@ void elementSolenoid::setElement()
componentName_ = defaultSpecificName_;
if (!vtr_.empty()) vtr_.clear(); // #3 = nbParam_-1;
vtr_.push_back("none"); // length
vtr_.push_back("none"); // strength
vtr_.push_back("none"); // field strength
vtr_.push_back("none"); // length (m)
vtr_.push_back("none"); // strength (rad/m)
vtr_.push_back("none"); // field strength (T)
}
string* elementSolenoid::getParametersString() const
......@@ -217,7 +217,7 @@ void elementSolenoid::toJSON(json& j)
j["parameters"]["B$strength"]["type"] = "number";
// field (kG)
j["parameters"]["C$hfield"]["displayName"] = "B (kG)";
j["parameters"]["C$hfield"]["displayName"] = "B (T)";
j["parameters"]["C$hfield"]["tipText"] = "field strength (used if KS is not defined)";
if (vtr_[ 2 ].find("none") == std::string::npos) {
j["parameters"]["C$hfield"]["value"] = atof(vtr_[ 2 ].c_str());
......
......@@ -19,7 +19,7 @@ export class SolenoidParameters {
type: 'number'
};
this.hfield = {
displayName: 'B (kG)',
displayName: 'B (T)',
tipText: 'field strength (used if KS is not defined)',
value: null,
type: 'number'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment