Commit 2a4ae588 authored by winklehner_d's avatar winklehner_d
Browse files

Fixed ParallelCyclotronTracker.cpp after changing units to m. -DW

parent e09b8c0f
......@@ -95,7 +95,7 @@ using Physics::pi;
using Physics::q_e;
const double c_mmtns = Physics::c * 1.0e-6; // m/s --> mm/ns
const double c_mtns = Physics::c * 1.0e-3; // m/s --> m/ns
const double c_mtns = Physics::c * 1.0e-9; // m/s --> m/ns
const double mass_coeff = 1.0e18 * q_e / Physics::c / Physics::c; // from GeV/c^2 to basic unit: GV*C*s^2/m^2
Vector_t const ParallelCyclotronTracker::xaxis = Vector_t(1.0, 0.0, 0.0);
......@@ -792,6 +792,7 @@ void ParallelCyclotronTracker::visitRFCavity(const RFCavity &as) {
std::string fmfn = elptr->getFieldMapFN();
*gmsg << "* RF Field map file name= " << fmfn << endl;
double angle = elptr->getAzimuth();
*gmsg << "* Cavity azimuth position= " << angle << " [deg] " << endl;
......@@ -849,7 +850,7 @@ void ParallelCyclotronTracker::visitRFCavity(const RFCavity &as) {
BcParameter[0] = 0.001 * rmin;
BcParameter[1] = 0.001 * rmax;
BcParameter[2] = pdis;
BcParameter[2] = 0.001 * pdis;
BcParameter[3] = angle;
buildupFieldList(BcParameter, ElementBase::RFCAVITY, elptr);
......@@ -2280,7 +2281,8 @@ bool ParallelCyclotronTracker::checkGapCross(Vector_t Rold, Vector_t Rnew, RFCav
bool flag = false;
double sinx = rfcavity->getSinAzimuth();
double cosx = rfcavity->getCosAzimuth();
double PerpenDistance = rfcavity->getPerpenDistance();
// TODO: Presumably this is still in mm, so for now, change to m -DW
double PerpenDistance = 0.001 * rfcavity->getPerpenDistance();
double distNew = (Rnew[0] * sinx - Rnew[1] * cosx) - PerpenDistance;
double distOld = (Rold[0] * sinx - Rold[1] * cosx) - PerpenDistance;
if(distOld > 0.0 && distNew <= 0.0) flag = true;
......
......@@ -372,13 +372,15 @@ bool Cyclotron::apply(const size_t &id, const double &t, Vector_t &E, Vector_t &
flagNeedUpdate = true;
Inform gmsgALL("OPAL ", INFORM_ALL_NODES);
gmsgALL << getName() << ": particle "<< id <<" out of the global aperture of cyclotron!"<< endl;
gmsgALL << getName() << ": Coords: "<< RefPartBunch_m->R[id] << endl;
} else{
flagNeedUpdate = apply(RefPartBunch_m->R[id], RefPartBunch_m->P[id], t, E, B);
if(flagNeedUpdate){
Inform gmsgALL("OPAL ", INFORM_ALL_NODES);
gmsgALL << getName() << ": particle "<< id <<" out of the field map boundary!"<< endl;
gmsgALL << getName() << ": Coords: "<< RefPartBunch_m->R[id] << endl;
}
}
......@@ -396,7 +398,7 @@ bool Cyclotron::apply(const Vector_t &R, const Vector_t &P, const double &t, Vec
const double xir = (rad - BP.rmin) / BP.delr;
// ir : the mumber of path whoes radius is less then the 4 points of cell which surrond particle.
const int ir = (int)xir;
const int ir = (int)xir;
// wr1 : the relative distance to the inner path radius
const double wr1 = xir - (double)ir;
......@@ -532,7 +534,7 @@ bool Cyclotron::apply(const Vector_t &R, const Vector_t &P, const double &t, Vec
//*gmsg << "R = " << rad << ", Theta = " << tet << ", B = (" << B[0] << "/" << B[1] << "/" << B[2] << ")" << endl;
} else {
return true;
return true;
}
if(myBFieldType_m == BANDRF) {
//The RF field is suppose to be sampled on a cartesian grid
......@@ -930,17 +932,19 @@ void Cyclotron::getFieldFromFile(const double &scaleFactor) {
CHECK_CYC_FSCANF_EOF(fscanf(f, "%lf", &BP.rmin));
*gmsg << "* Minimal radius of measured field map: " << BP.rmin << " [mm]" << endl;
BP.rmin *= 0.001; // mm --> m
CHECK_CYC_FSCANF_EOF(fscanf(f, "%lf", &BP.delr));
//if the value is nagtive, the actual value is its reciprocal.
//if the value is negative, the actual value is its reciprocal.
if(BP.delr < 0.0) BP.delr = 1.0 / (-BP.delr);
*gmsg << "* Stepsize in radial direction: " << BP.delr << " [mm]" << endl;
BP.delr *= 0.001; // mm --> m
CHECK_CYC_FSCANF_EOF(fscanf(f, "%lf", &BP.tetmin));
*gmsg << "* Minimal angle of measured field map: " << BP.tetmin << " [deg.]" << endl;
CHECK_CYC_FSCANF_EOF(fscanf(f, "%lf", &BP.dtet));
//if the value is nagtive, the actual value is its reciprocal.
//if the value is negative, the actual value is its reciprocal.
if(BP.dtet < 0.0) BP.dtet = 1.0 / (-BP.dtet);
*gmsg << "* Stepsize in azimuth direction: " << BP.dtet << " [deg.]" << endl;
......@@ -1025,7 +1029,7 @@ void Cyclotron::getFieldFromFile(const double &scaleFactor) {
// Calculates Radiae of initial grid.
// dimensions in [mm]!
// dimensions in [m]!
void Cyclotron::initR(double rmin, double dr, int nrad) {
BP.rarr.resize(nrad);
for(int i = 0; i < nrad; i++) {
......@@ -1577,4 +1581,4 @@ void Cyclotron::getFieldFromFile_Synchrocyclotron(const double &scaleFactor) {
void Cyclotron::getDimensions(double &zBegin, double &zEnd) const
{ }
#undef CHECK_CYC_FSCANF_EOF
\ No newline at end of file
#undef CHECK_CYC_FSCANF_EOF
......@@ -320,4 +320,4 @@ protected:
BPositions BP;
};
#endif // CLASSIC_Cyclotron_HH
\ No newline at end of file
#endif // CLASSIC_Cyclotron_HH
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