Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects

Opal maps

Merged snuverink_j requested to merge OPAL-maps into master
1 file
+ 49
50
Compare changes
  • Side-by-side
  • Inline
@@ -112,7 +112,7 @@ public:
@@ -112,7 +112,7 @@ public:
typedef FVector<double, 6> particle_t;
typedef FVector<double, 6> particle_t;
typedef std::tuple<series_t, std::size_t, double> tuple_t;
typedef std::tuple<series_t, std::size_t, double> tuple_t;
typedef std::list<tuple_t> beamline_t;
typedef std::list<tuple_t> beamline_t;
public:
public:
/// Constructor.
/// Constructor.
@@ -141,7 +141,7 @@ public:
@@ -141,7 +141,7 @@ public:
const std::vector<double> &zstop,
const std::vector<double> &zstop,
const std::vector<double> &dt,
const std::vector<double> &dt,
const int& truncOrder);
const int& truncOrder);
virtual ~ThickTracker();
virtual ~ThickTracker();
@@ -229,48 +229,48 @@ public:
@@ -229,48 +229,48 @@ public:
double& gamma0, double& P0, double& q, std::array<double,2>& entrFringe, std::string e);
double& gamma0, double& P0, double& q, std::array<double,2>& entrFringe, std::string e);
*/
*/
private:
private:
// Not implemented.
// Not implemented.
ThickTracker() = delete;
ThickTracker() = delete;
ThickTracker(const ThickTracker &) = delete;
ThickTracker(const ThickTracker &) = delete;
void operator=(const ThickTracker &) = delete;
void operator=(const ThickTracker &) = delete;
void throwElementError_m(std::string element) {
void throwElementError_m(std::string element) {
throw LogicalError("ThickTracker::execute()",
throw LogicalError("ThickTracker::execute()",
"Element '" + element + "' not supported.");
"Element '" + element + "' not supported.");
}
}
/*!
/*!
* Tests the order of the elements in the beam line according to their position
* Tests the order of the elements in the beam line according to their position
*/
*/
void checkElementOrder_m();
void checkElementOrder_m();
/*!
/*!
* Inserts Drift maps in undefined beam line sections
* Inserts Drift maps in undefined beam line sections
*/
*/
void fillGaps_m();
void fillGaps_m();
/*!
/*!
* Tracks itsBunch_m trough beam line
* Tracks itsBunch_m trough beam line
*/
*/
void track_m();
void track_m();
particle_t particleToVector_m(const Vector_t& R,
particle_t particleToVector_m(const Vector_t& R,
const Vector_t& P) const;
const Vector_t& P) const;
void vectorToParticle_m(const particle_t& particle,
void vectorToParticle_m(const particle_t& particle,
Vector_t& R,
Vector_t& R,
Vector_t& P) const;
Vector_t& P) const;
/*!
/*!
* Advances itsBunch_m trough map
* Advances itsBunch_m trough map
* @param map Map of slice
* @param map Map of slice
*/
*/
void advanceParticles_m(const map_t& map);
void advanceParticles_m(const map_t& map);
/*!
/*!
* Applies map on particle
* Applies map on particle
* @param particle tracked particle
* @param particle tracked particle
@@ -278,12 +278,12 @@ private:
@@ -278,12 +278,12 @@ private:
*/
*/
void updateParticle_m(particle_t& particle,
void updateParticle_m(particle_t& particle,
const map_t& map);
const map_t& map);
/*!
/*!
* Dumps bunch in .stat or .h5 files
* Dumps bunch in .stat or .h5 files
*/
*/
void dump_m();
void dump_m();
/*!
/*!
* Updates itsBunch_m
* Updates itsBunch_m
@@ -292,25 +292,25 @@ private:
@@ -292,25 +292,25 @@ private:
*/
*/
void update_m(const double& spos,
void update_m(const double& spos,
const std::size_t& step);
const std::size_t& step);
/*!
/*!
* Writes map (Transfermap) in .map file
* Writes map (Transfermap) in .map file
* @map text for .map file
* @map text for .map file
*/
*/
void write_m(const map_t& map);
void write_m(const map_t& map);
/*!
/*!
* Concatenate map x and y
* Concatenate map x and y
* \f[
* \f[
* y = x \circ y
* y = x \circ y
* \f]
* \f]
* @param x
* @param x
* @param y is result
* @param y is result
*/
*/
void concatenateMaps_m(const map_t& x, map_t& y);
void concatenateMaps_m(const map_t& x, map_t& y);
/*!
/*!
* Tracks Dispersion along beam line
* Tracks Dispersion along beam line
* writes it in .dispersion file.
* writes it in .dispersion file.
@@ -332,7 +332,7 @@ private:
@@ -332,7 +332,7 @@ private:
void advanceDispersion_m(fMatrix_t tempMatrix,
void advanceDispersion_m(fMatrix_t tempMatrix,
FMatrix<double, 1, 4> initialVal,
FMatrix<double, 1, 4> initialVal,
double pos);
double pos);
/*! :TODO:
/*! :TODO:
* Fringe fields for entrance of SBEND.
* Fringe fields for entrance of SBEND.
*
*
@@ -358,15 +358,15 @@ private:
@@ -358,15 +358,15 @@ private:
Hamiltonian hamiltonian_m;
Hamiltonian hamiltonian_m;
MapAnalyser mapAnalyser_m;
MapAnalyser mapAnalyser_m;
Vector_t RefPartR_m;
Vector_t RefPartR_m;
Vector_t RefPartP_m;
Vector_t RefPartP_m;
DataSink *itsDataSink_m;
DataSink *itsDataSink_m;
OpalBeamline itsOpalBeamline_m;
OpalBeamline itsOpalBeamline_m;
double zstart_m; ///< Start of beam line
double zstart_m; ///< Start of beam line
double zstop_m; ///< End of beam line
double zstop_m; ///< End of beam line
double threshold_m; ///< Threshold for element overlaps and gaps
double threshold_m; ///< Threshold for element overlaps and gaps
@@ -419,12 +419,12 @@ inline void ThickTracker::visitDiagnostic(const Diagnostic &diag) {
@@ -419,12 +419,12 @@ inline void ThickTracker::visitDiagnostic(const Diagnostic &diag) {
inline void ThickTracker::visitDrift(const Drift &drift) {
inline void ThickTracker::visitDrift(const Drift &drift) {
itsOpalBeamline_m.visit(drift, *this, itsBunch_m);
itsOpalBeamline_m.visit(drift, *this, itsBunch_m);
double gamma = itsReference.getGamma();
double gamma = itsReference.getGamma();
std::size_t nSlices = drift.getNSlices();
std::size_t nSlices = drift.getNSlices();
double length = drift.getElementLength();
double length = drift.getElementLength();
elements_m.push_back(std::make_tuple(hamiltonian_m.drift(gamma),
elements_m.push_back(std::make_tuple(hamiltonian_m.drift(gamma),
nSlices,
nSlices,
length));
length));
@@ -457,7 +457,7 @@ inline void ThickTracker::visitMonitor(const Monitor &mon) {
@@ -457,7 +457,7 @@ inline void ThickTracker::visitMonitor(const Monitor &mon) {
inline void ThickTracker::visitMultipole(const Multipole &mult) {
inline void ThickTracker::visitMultipole(const Multipole &mult) {
itsOpalBeamline_m.visit(mult, *this, itsBunch_m);
itsOpalBeamline_m.visit(mult, *this, itsBunch_m);
std::size_t nSlices = mult.getNSlices();
std::size_t nSlices = mult.getNSlices();
double length = mult.getElementLength();
double length = mult.getElementLength();
double gamma = itsReference.getGamma();
double gamma = itsReference.getGamma();
@@ -466,9 +466,9 @@ inline void ThickTracker::visitMultipole(const Multipole &mult) {
@@ -466,9 +466,9 @@ inline void ThickTracker::visitMultipole(const Multipole &mult) {
double gradB = mult.getField().getNormalComponent(2) * ( Physics::c/ p0 ); // [T / m]
double gradB = mult.getField().getNormalComponent(2) * ( Physics::c/ p0 ); // [T / m]
//FIXME remove the next line
//FIXME remove the next line
gradB = std::round(gradB*1e6)*1e-6;
gradB = std::round(gradB*1e6)*1e-6;
double k1 = gradB * q *Physics::c / p0; // [1 / m^2]
double k1 = gradB * q *Physics::c / p0; // [1 / m^2]
elements_m.push_back(std::make_tuple(hamiltonian_m.quadrupole(gamma, q, k1),
elements_m.push_back(std::make_tuple(hamiltonian_m.quadrupole(gamma, q, k1),
nSlices,
nSlices,
length));
length));
@@ -504,47 +504,46 @@ inline void ThickTracker::visitRFQuadrupole(const RFQuadrupole &rfq) {
@@ -504,47 +504,46 @@ inline void ThickTracker::visitRFQuadrupole(const RFQuadrupole &rfq) {
inline void ThickTracker::visitSBend(const SBend &bend) {
inline void ThickTracker::visitSBend(const SBend &bend) {
itsOpalBeamline_m.visit(bend, *this, itsBunch_m);
itsOpalBeamline_m.visit(bend, *this, itsBunch_m);
double q = itsReference.getQ(); // particle change [e]
double q = itsReference.getQ(); // particle change [e]
double ekin = bend.getDesignEnergy();
double ekin = bend.getDesignEnergy();
double m = itsReference.getM(); // eV / c^2
double m = itsReference.getM(); // eV / c^2
double gamma = ekin / m + 1.0;
double gamma = ekin / m + 1.0;
double beta = std::sqrt(1.0 - 1.0 / ( gamma * gamma ) );
double beta = std::sqrt(1.0 - 1.0 / ( gamma * gamma ) );
double p0 = gamma * beta * m; // eV / c
double p0 = gamma * beta * m; // eV / c
double B = bend.getB() * Physics::c / p0; // T = V * s / m^2
double B = bend.getB() * Physics::c / p0; // T = V * s / m^2
double r = std::abs(p0 / ( q * B * Physics::c )); // m
double r = std::abs(p0 / ( q * B * Physics::c )); // m
double k0 = B * q * Physics::c / p0; // V * s * e * m / (m^2 * s * c )
double k0 = B * q * Physics::c / p0; // V * s * e * m / (m^2 * s * c )
// [1/m]
// [1/m]
double h = 1.0 / r;
double h = 1.0 / r;
double L = bend.getElementLength();
double L = bend.getElementLength();
if ( k0 < 0.0 )
if ( k0 < 0.0 )
h *= -1.0;
h *= -1.0;
std::size_t nSlices = bend.getNSlices();
std::size_t nSlices = bend.getNSlices();
double arclength = 2.0 * r * std::asin( L / ( 2.0 * r ) ); //bend.getEffectiveLength();
double arclength = 2.0 * r * std::asin( L / ( 2.0 * r ) ); //bend.getEffectiveLength();
 
// Fringe fields currently not working
//FIXME e1 not initialised
//FIXME e1 not initialised
double e1 = bend.getEntranceAngle();
//double e1 = bend.getEntranceAngle();
//elements_m.push_back(std::make_tuple(hamiltonian_m.fringeField(e1, h),
elements_m.push_back(std::make_tuple(hamiltonian_m.fringeField(e1, h),
// 1, 0.0));
1, 0.0));
elements_m.push_back(std::make_tuple(hamiltonian_m.sbend(gamma, h, k0),
elements_m.push_back(std::make_tuple(hamiltonian_m.sbend(gamma, h, k0),
nSlices,
nSlices,
arclength));
arclength));
//FIXME e2 not initialised
//FIXME e2 not initialised
double e2 = bend.getExitAngle();
//double e2 = bend.getExitAngle();
//elements_m.push_back(std::make_tuple(hamiltonian_m.fringeField(e2, h),
elements_m.push_back(std::make_tuple(hamiltonian_m.fringeField(e2, h),
// 1, 0.0));
1, 0.0));
}
}
Loading